home *** CD-ROM | disk | FTP | other *** search
- // gridapp.cpp : Defines the class behaviors for the application.
- //
-
- // This is a part of the Objective Grid C++ Library.
- // Copyright (C) 1995,1996 ClassWorks, Stefan Hoenig.
- // All rights reserved.
- //
- // This source code is only intended as a supplement to
- // the Objective Grid Classes Reference and related
- // electronic documentation provided with the library.
- // See these sources for detailed information regarding
- // the Objective Grid product.
- //
-
- #include "stdafx.h"
- #include "gridapp.h"
-
- #include "mainfrm.h"
- #include "gridsdoc.h"
- #include "griddoc2.h"
- #include "gridfrms.h"
- #include "scrltmdi.h"
- #include "browsevw.h"
-
- #include "dlgsamp1.h"
- #include "dlgsamp2.h"
- #include "dlgsamp3.h"
- #include "dlgsamp4.h"
- #include "dlgsamp5.h"
-
- #include "gridsvw.h"
- #include "gridsvw2.h"
- #include "gridsvw3.h"
- #include "gridsvw4.h"
- #include "gridsvw5.h"
- #include "gridsvw6.h"
- #include "gridsvw7.h"
- #include "formvw1.h"
-
- #ifndef _GXSTATE_H_
- #include "gxstate.h"
- #endif
-
- #include "locale.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- #define new DEBUG_NEW
-
- /////////////////////////////////////////////////////////////////////////////
- // CGridSampleApp
-
- BEGIN_MESSAGE_MAP(CGridSampleApp, CWinApp)
- //{{AFX_MSG_MAP(CGridSampleApp)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- ON_COMMAND(ID_DIALOG_SAMPLE1, OnDialogSample1)
- ON_COMMAND(ID_DIALOG_SAMPLE2, OnDialogSample2)
- ON_COMMAND(ID_DIALOG_SAMPLE3, OnDialogSample3)
- ON_COMMAND(ID_DIALOG_SAMPLE4, OnDialogSample4)
- ON_COMMAND(ID_DIALOG_SAMPLE5, OnDialogSample5)
- //}}AFX_MSG_MAP
- // Standard file based document commands
- ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
- ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
- // Standard print setup command
- ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CGridSampleApp construction
-
- CGridSampleApp::CGridSampleApp()
- {
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CGridSampleApp object
-
- CGridSampleApp NEAR theApp;
-
- /////////////////////////////////////////////////////////////////////////////
- // CGridSampleApp initialization
-
- BOOL CGridSampleApp::InitInstance()
- {
- /**********************************************************************/
- // Don't forget to call GXInit() as first command in InitInstance!
- // If you have created custom control's with DECLARE/IMPLEMENT_REGISTER,
- // you also have to call the RegisterClass methods of your control.
- /**********************************************************************/
-
- GXInit(); // initializes library and resources
-
- #if _MFC_VER >= 0x0400
- AfxOleInit();
- #endif
-
- _tsetlocale(LC_ALL, _T(""));
-
- CSample4GridWnd::RegisterClass();
-
- #if _MFC_VER >= 0x0300 && !defined(_MAC)
- SetRegistryKey(_T("Stingray"));
- #endif
-
- SetDialogBkColor(); // set dialog background color to gray
- #if _MFC_VER >= 0x300
- Enable3dControls();
- #endif
- LoadStdProfileSettings(); // Load standard INI file options (including MRU)
-
- // Register the application's document templates. Document templates
- // serve as the connection between documents, frame windows and views.
-
- // CGridSampleView templates
-
- AddDocTemplate(new CMultiDocTemplate(IDR_GRIDAPTYPE,
- RUNTIME_CLASS(CGridSampleDoc),
- RUNTIME_CLASS(CScrltabsMDIChildWnd), //
- RUNTIME_CLASS(CGridSampleView)));
-
- AddDocTemplate(new CMultiDocTemplate(IDR_GRIDFWTYPE,
- RUNTIME_CLASS(CSampleDocument2),
- RUNTIME_CLASS(CMDIChildWnd), //
- RUNTIME_CLASS(CSample1FormView)));
-
- m_pSplitterTemplate = new CMultiDocTemplate(IDR_GRIDAPTYPE,
- RUNTIME_CLASS(CGridSampleDoc),
- RUNTIME_CLASS(CSplitterMDIChildWnd),
- RUNTIME_CLASS(CGridSampleView));
-
- // CDBaseBrowserView templates
-
- AddDocTemplate(m_pDBaseBrowser = new CMultiDocTemplate(IDR_DBFBROWSETYPE,
- RUNTIME_CLASS(CDBaseBrowserDoc),
- RUNTIME_CLASS(CSplitterMDIChildWnd),
- RUNTIME_CLASS(CDBaseBrowserView)));
-
- // create main MDI Frame window
- CMainFrame* pMainFrame = new CMainFrame;
- pMainFrame->m_sSection = _T("Settings");
- if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
- return FALSE;
- pMainFrame->ShowWindow(m_nCmdShow);
- pMainFrame->UpdateWindow();
- m_pMainWnd = pMainFrame;
-
- // enable file manager drag/drop and DDE Execute open
- EnableShellOpen();
- RegisterShellFileTypes();
-
- // simple command line parsing
- if (m_lpCmdLine[0] == _T('\0'))
- {
- // create a new (empty) document
- OnFileNew();
- }
- else if ((m_lpCmdLine[0] == _T('-') || m_lpCmdLine[0] == _T('/')) &&
- (m_lpCmdLine[1] == _T('e') || m_lpCmdLine[1] == _T('E')))
- {
- // program launched embedded - wait for DDE or OLE open
- }
- else
- {
- // open an existing document
- OpenDocumentFile(m_lpCmdLine);
- }
-
- return TRUE;
- }
-
- BOOL CGridSampleApp::ExitInstance()
- {
- delete m_pSplitterTemplate;
-
- GXTerminate();
-
- // Here, you can also call the UnregisterClass methods of your
- // custom controls.
-
- return CWinApp::ExitInstance();
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CAboutDlg dialog used for App About
-
- class CAboutDlg : public CDialog
- {
- public:
- CAboutDlg();
-
- // Dialog Data
- //{{AFX_DATA(CAboutDlg)
- enum { IDD = IDD_ABOUTBOX };
- //}}AFX_DATA
-
- // Implementation
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //{{AFX_MSG(CAboutDlg)
- // No message handlers
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
-
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- //{{AFX_DATA_INIT(CAboutDlg)
- //}}AFX_DATA_INIT
- }
-
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAboutDlg)
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- //{{AFX_MSG_MAP(CAboutDlg)
- // No message handlers
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- // App command to run the dialog
- void CGridSampleApp::OnAppAbout()
- {
- CAboutDlg aboutDlg;
- aboutDlg.DoModal();
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CGridSampleApp commands
-
- void CGridSampleApp::OnDialogSample1()
- {
- CSample1Dialog dlg;
- dlg.DoModal();
- }
-
- void CGridSampleApp::OnDialogSample2()
- {
- CSample2Dialog dlg;
- dlg.DoModal();
- }
-
- void CGridSampleApp::OnDialogSample3()
- {
- CSample3Dialog dlg;
- dlg.DoModal();
- }
-
- void CGridSampleApp::OnDialogSample4()
- {
- CSample4Dialog dlg;
- dlg.DoModal();
- }
-
- void CGridSampleApp::OnDialogSample5()
- {
- CSample5Dialog dlg;
- dlg.DoModal();
- }
-
-
-
-