EastDraw.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. // EastDraw.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "EastDraw.h"
  5. #include "MainFrm.h"
  6. #include "ChildFrm.h"
  7. #include "EastDrawDoc.h"
  8. #include "EastDrawView.h"
  9. #include "Splash.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CEastDrawApp
  17. BEGIN_MESSAGE_MAP(CEastDrawApp, CWinApp)
  18. //{{AFX_MSG_MAP(CEastDrawApp)
  19. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  20. // NOTE - the ClassWizard will add and remove mapping macros here.
  21. // DO NOT EDIT what you see in these blocks of generated code!
  22. //}}AFX_MSG_MAP
  23. // Standard file based document commands
  24. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  25. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  26. // Standard print setup command
  27. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  28. END_MESSAGE_MAP()
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CEastDrawApp construction
  31. CEastDrawApp::CEastDrawApp()
  32. {
  33. // TODO: add construction code here,
  34. // Place all significant initialization in InitInstance
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // The one and only CEastDrawApp object
  38. CEastDrawApp theApp;
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CEastDrawApp initialization
  41. BOOL CEastDrawApp::InitInstance()
  42. {
  43. // CG: The following block was added by the Splash Screen component.
  44. \
  45. {
  46. \
  47. CCommandLineInfo cmdInfo;
  48. \
  49. ParseCommandLine(cmdInfo);
  50. \
  51. \
  52. CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
  53. \
  54. }
  55. AfxEnableControlContainer();
  56. // Standard initialization
  57. // If you are not using these features and wish to reduce the size
  58. // of your final executable, you should remove from the following
  59. // the specific initialization routines you do not need.
  60. #ifdef _AFXDLL
  61. Enable3dControls(); // Call this when using MFC in a shared DLL
  62. #else
  63. Enable3dControlsStatic(); // Call this when linking to MFC statically
  64. #endif
  65. // Change the registry key under which our settings are stored.
  66. // TODO: You should modify this string to be something appropriate
  67. // such as the name of your company or organization.
  68. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  69. LoadStdProfileSettings(); // Load standard INI file options (including MRU)
  70. // Register the application's document templates. Document templates
  71. // serve as the connection between documents, frame windows and views.
  72. CMultiDocTemplate* pDocTemplate;
  73. pDocTemplate = new CMultiDocTemplate(
  74. IDR_EASTDRTYPE,
  75. RUNTIME_CLASS(CEastDrawDoc),
  76. RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  77. RUNTIME_CLASS(CEastDrawView));
  78. AddDocTemplate(pDocTemplate);
  79. // create main MDI Frame window
  80. CMainFrame* pMainFrame = new CMainFrame;
  81. if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  82. return FALSE;
  83. m_pMainWnd = pMainFrame;
  84. // Enable drag/drop open
  85. m_pMainWnd->DragAcceptFiles();
  86. // Enable DDE Execute open
  87. EnableShellOpen();
  88. RegisterShellFileTypes(TRUE);
  89. // Parse command line for standard shell commands, DDE, file open
  90. CCommandLineInfo cmdInfo;
  91. ParseCommandLine(cmdInfo);
  92. // Dispatch commands specified on the command line
  93. if (!ProcessShellCommand(cmdInfo))
  94. return FALSE;
  95. // The main window has been initialized, so show and update it.
  96. pMainFrame->ShowWindow(m_nCmdShow);
  97. pMainFrame->UpdateWindow();
  98. return TRUE;
  99. }
  100. /////////////////////////////////////////////////////////////////////////////
  101. // CAboutDlg dialog used for App About
  102. class CAboutDlg : public CDialog
  103. {
  104. public:
  105. CAboutDlg();
  106. // Dialog Data
  107. //{{AFX_DATA(CAboutDlg)
  108. enum { IDD = IDD_ABOUTBOX };
  109. //}}AFX_DATA
  110. // ClassWizard generated virtual function overrides
  111. //{{AFX_VIRTUAL(CAboutDlg)
  112. protected:
  113. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  114. //}}AFX_VIRTUAL
  115. // Implementation
  116. protected:
  117. //{{AFX_MSG(CAboutDlg)
  118. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  119. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  120. //}}AFX_MSG
  121. DECLARE_MESSAGE_MAP()
  122. };
  123. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  124. {
  125. //{{AFX_DATA_INIT(CAboutDlg)
  126. //}}AFX_DATA_INIT
  127. }
  128. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  129. {
  130. CDialog::DoDataExchange(pDX);
  131. //{{AFX_DATA_MAP(CAboutDlg)
  132. //}}AFX_DATA_MAP
  133. }
  134. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  135. //{{AFX_MSG_MAP(CAboutDlg)
  136. ON_WM_CTLCOLOR()
  137. ON_WM_LBUTTONDOWN()
  138. //}}AFX_MSG_MAP
  139. END_MESSAGE_MAP()
  140. // App command to run the dialog
  141. void CEastDrawApp::OnAppAbout()
  142. {
  143. CAboutDlg aboutDlg;
  144. aboutDlg.DoModal();
  145. }
  146. /////////////////////////////////////////////////////////////////////////////
  147. // CEastDrawApp message handlers
  148. HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  149. {
  150. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  151. // TODO: Change any attributes of the DC here
  152. pDC->SetTextColor(RGB(0,100,255));
  153. pDC->SetBkColor(RGB(100,200,200));
  154. //pDC->SelectObject(&brush);
  155. pDC->SetBkMode(TRANSPARENT);
  156. // TODO: Return a different brush if the default is not desired
  157. return hbr;
  158. }
  159. BOOL CEastDrawApp::PreTranslateMessage(MSG* pMsg)
  160. {
  161. // CG: The following lines were added by the Splash Screen component.
  162. if (CSplashWnd::PreTranslateAppMessage(pMsg))
  163. return TRUE;
  164. return CWinApp::PreTranslateMessage(pMsg);
  165. }
  166. void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point)
  167. {
  168. // TODO: Add your message handler code here and/or call default
  169. OnOK();
  170. //CDialog::OnLButtonDown(nFlags, point);
  171. }