1 | // MainFrm.cpp : implementation of the CMainFrame class
|
---|
2 | //
|
---|
3 |
|
---|
4 | #include "stdafx.h"
|
---|
5 | #include "LispEditor.h"
|
---|
6 |
|
---|
7 | #include "MainFrm.h"
|
---|
8 |
|
---|
9 | #ifdef _DEBUG
|
---|
10 | #define new DEBUG_NEW
|
---|
11 | #undef THIS_FILE
|
---|
12 | static char THIS_FILE[] = __FILE__;
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | /////////////////////////////////////////////////////////////////////////////
|
---|
16 | // CMainFrame
|
---|
17 |
|
---|
18 | IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
|
---|
19 |
|
---|
20 | BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
|
---|
21 | //{{AFX_MSG_MAP(CMainFrame)
|
---|
22 | // NOTE - the ClassWizard will add and remove mapping macros here.
|
---|
23 | // DO NOT EDIT what you see in these blocks of generated code !
|
---|
24 | ON_WM_CREATE()
|
---|
25 | //}}AFX_MSG_MAP
|
---|
26 | END_MESSAGE_MAP()
|
---|
27 |
|
---|
28 | static UINT indicators[] =
|
---|
29 | {
|
---|
30 | ID_SEPARATOR, // status line indicator
|
---|
31 | ID_INDICATOR_CAPS,
|
---|
32 | ID_INDICATOR_NUM,
|
---|
33 | ID_INDICATOR_SCRL,
|
---|
34 | };
|
---|
35 |
|
---|
36 | /////////////////////////////////////////////////////////////////////////////
|
---|
37 | // CMainFrame construction/destruction
|
---|
38 |
|
---|
39 | CMainFrame::CMainFrame()
|
---|
40 | {
|
---|
41 | // TODO: add member initialization code here
|
---|
42 |
|
---|
43 | }
|
---|
44 |
|
---|
45 | CMainFrame::~CMainFrame()
|
---|
46 | {
|
---|
47 | }
|
---|
48 |
|
---|
49 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
---|
50 | {
|
---|
51 | if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
|
---|
52 | return -1;
|
---|
53 |
|
---|
54 | if (!m_wndToolBar.CreateEx(this) ||
|
---|
55 | !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
---|
56 | {
|
---|
57 | TRACE0("Failed to create toolbar\n");
|
---|
58 | return -1; // fail to create
|
---|
59 | }
|
---|
60 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() & ~CBRS_HIDE_INPLACE);
|
---|
61 | if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
|
---|
62 | CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
|
---|
63 | {
|
---|
64 | TRACE0("Failed to create dialogbar\n");
|
---|
65 | return -1; // fail to create
|
---|
66 | }
|
---|
67 |
|
---|
68 | if (!m_wndReBar.Create(this) ||
|
---|
69 | !m_wndReBar.AddBar(&m_wndToolBar) ||
|
---|
70 | !m_wndReBar.AddBar(&m_wndDlgBar))
|
---|
71 | {
|
---|
72 | TRACE0("Failed to create rebar\n");
|
---|
73 | return -1; // fail to create
|
---|
74 | }
|
---|
75 | m_wndReBar.SetBarStyle(m_wndReBar.GetBarStyle() & ~CBRS_HIDE_INPLACE);
|
---|
76 |
|
---|
77 | if (!m_wndStatusBar.Create(this) ||
|
---|
78 | !m_wndStatusBar.SetIndicators(indicators,
|
---|
79 | sizeof(indicators)/sizeof(UINT)))
|
---|
80 | {
|
---|
81 | TRACE0("Failed to create status bar\n");
|
---|
82 | return -1; // fail to create
|
---|
83 | }
|
---|
84 |
|
---|
85 | // TODO: Remove this if you don't want tool tips
|
---|
86 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
|
---|
87 | CBRS_TOOLTIPS | CBRS_FLYBY);
|
---|
88 |
|
---|
89 | return 0;
|
---|
90 | }
|
---|
91 |
|
---|
92 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
---|
93 | {
|
---|
94 | if( !CMDIFrameWnd::PreCreateWindow(cs) )
|
---|
95 | return FALSE;
|
---|
96 | // TODO: Modify the Window class or styles here by modifying
|
---|
97 | // the CREATESTRUCT cs
|
---|
98 |
|
---|
99 | return TRUE;
|
---|
100 | }
|
---|
101 |
|
---|
102 | /////////////////////////////////////////////////////////////////////////////
|
---|
103 | // CMainFrame diagnostics
|
---|
104 |
|
---|
105 | #ifdef _DEBUG
|
---|
106 | void CMainFrame::AssertValid() const
|
---|
107 | {
|
---|
108 | CMDIFrameWnd::AssertValid();
|
---|
109 | }
|
---|
110 |
|
---|
111 | void CMainFrame::Dump(CDumpContext& dc) const
|
---|
112 | {
|
---|
113 | CMDIFrameWnd::Dump(dc);
|
---|
114 | }
|
---|
115 |
|
---|
116 | #endif //_DEBUG
|
---|
117 |
|
---|
118 | /////////////////////////////////////////////////////////////////////////////
|
---|
119 | // CMainFrame message handlers
|
---|
120 |
|
---|
121 |
|
---|
122 | CStatusBar *CMainFrame::GetStatusBar()
|
---|
123 | {
|
---|
124 | return &m_wndStatusBar;
|
---|
125 | }
|
---|