1 ////////////////////////////////////////////////////
\r
2 // Mainfrm.cpp - definitions for the CMainFrame class
\r
5 #include "resource.h"
\r
8 CMainFrame::CMainFrame()
\r
10 // Set m_View as the view window of the frame
\r
14 CMainFrame::~CMainFrame()
\r
18 BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
\r
20 // Process the messages from the Menu and Tool Bar
\r
21 switch (LOWORD(wParam))
\r
24 m_View.ClearPoints();
\r
25 m_PathName = _T("");
\r
33 case IDM_FILE_SAVEAS:
\r
36 case IDM_FILE_PRINT:
\r
37 ::MessageBox(NULL, _T("File Print Implemented Later"), _T("Menu"), MB_OK);
\r
40 m_View.SetPen(RGB(255,0,0));
\r
43 m_View.SetPen(RGB(0,0,255));
\r
46 m_View.SetPen(RGB(0,196,0));
\r
49 m_View.SetPen(RGB(0,0,0));
\r
51 case IDM_HELP_ABOUT:
\r
55 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
\r
62 void CMainFrame::OnFileOpen()
\r
65 CString str = File.OpenFileDialog(0, OFN_FILEMUSTEXIST, _T("Scribble Files (*.dat)\0*.dat\0\0"), this);
\r
69 // Retrieve the PlotPoint data
\r
70 if (m_View.FileOpen(str))
\r
72 // Save the filename
\r
81 void CMainFrame::OnFileSave()
\r
83 if (m_PathName == _T(""))
\r
86 m_View.FileSave(m_PathName);
\r
89 void CMainFrame::OnFileSaveAs()
\r
92 CString str = File.SaveFileDialog(0, OFN_OVERWRITEPROMPT, _T("Scribble Files (*.dat)\0*.dat\0\0"), _T("dat"), this);
\r
94 // Store the PlotPoint data in the file
\r
99 // Save the file name
\r
100 m_View.FileSave(str);
\r
105 void CMainFrame::SetupToolBar()
\r
107 // Set the Resource IDs for the toolbar buttons
\r
108 AddToolBarButton( IDM_FILE_NEW );
\r
109 AddToolBarButton( IDM_FILE_OPEN );
\r
110 AddToolBarButton( IDM_FILE_SAVE );
\r
112 AddToolBarButton( 0 ); // Separator
\r
113 AddToolBarButton( IDM_EDIT_CUT );
\r
114 AddToolBarButton( IDM_EDIT_COPY );
\r
115 AddToolBarButton( IDM_EDIT_PASTE );
\r
117 AddToolBarButton( 0 ); // Separator
\r
118 AddToolBarButton( IDM_FILE_PRINT );
\r
120 AddToolBarButton( 0 ); // Separator
\r
121 AddToolBarButton ( IDM_PEN_RED );
\r
122 AddToolBarButton ( IDM_PEN_BLUE );
\r
123 AddToolBarButton ( IDM_PEN_GREEN );
\r
124 AddToolBarButton ( IDM_PEN_BLACK );
\r
125 AddToolBarButton ( IDM_HELP_ABOUT );
\r
128 LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
133 // } // switch (uMsg)
\r
135 return WndProcDefault(uMsg, wParam, lParam);
\r
136 } // LRESULT CMainFrame::WndProc(...)
\r