| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | #include "stdafx.h" |
| 13 | #include "cube.h" |
| 14 | |
| 15 | #include "cubedoc.h" |
| 16 | #include "cubeview.h" |
| 17 | #include "mainfrm.h" |
| 18 | |
| 19 | #ifdef _DEBUG |
| 20 | #undef THIS_FILE |
| 21 | static char BASED_CODE THIS_FILE[] = __FILE__; |
| 22 | #endif |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
Top |
1 | | 27 | IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) |
1 | | 27 | return new CMainFrame |
| 27 | } |
Top |
11 | | 27 | FUNCTION CMainFrame::_GetBaseClass() |
11 | | 27 | return ( CFrameWnd::GetThisClass ( ) ) |
| 27 | } |
Top |
1 | | 27 | FUNCTION CMainFrame::GetThisClass() |
1 | | 27 | return ( ( CRuntimeClass * ) ( & CMainFrame::classCMainFrame ) ) |
| 27 | } |
Top |
2754 | | 27 | FUNCTION CMainFrame::GetRuntimeClass() |
2754 | | 27 | return ( ( CRuntimeClass * ) ( & CMainFrame::classCMainFrame ) ) |
| 27 | } |
| 28 | |
Top |
2058 | | 29 | BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) |
2058 | | 29 | return GetThisMessageMap ( ) |
| 29 | } |
Top |
2058 | | 29 | FUNCTION CMainFrame::GetThisMessageMap() |
| 30 | |
| 31 | ON_WM_CREATE() |
| 32 | ON_WM_PALETTECHANGED() |
| 33 | ON_WM_QUERYNEWPALETTE() |
| 34 | |
2058 | | 35 | END_MESSAGE_MAP() |
| 35 | } |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | static UINT BASED_CODE buttons[] = |
| 42 | { |
| 43 | |
| 44 | ID_FILE_PLAY, |
| 45 | ID_APP_ABOUT, |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
Top |
1 | | 51 | CMainFrame::CMainFrame() |
| 52 | { |
| 53 | |
| 54 | |
1 | | 55 | } |
| 56 | |
Top |
1 | | 57 | CMainFrame::~CMainFrame() |
| 58 | { |
1 | | 59 | } |
| 60 | |
Top |
1 | | 61 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) |
| 62 | { |
0 | 1 | 63 | if (CFrameWnd::OnCreate(lpCreateStruct) == -1) |
0 | | 64 | return -1; |
| 65 | |
| 66 | if (!m_wndToolBar.Create(this) || |
| 67 | !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) || |
| 68 | !m_wndToolBar.SetButtons(buttons, |
0 | 1 | 69 | sizeof(buttons)/sizeof(UINT))) |
0 | | 69 | 1: T || _ || _ |
0 | | 69 | 2: F || T || _ |
0 | | 69 | 3: F || F || T |
| 1 | 69 | 4: F || F || F |
- | 69 | MC/DC (cond 1): 1 - 4 |
- | 69 | MC/DC (cond 2): 2 - 4 |
- | 69 | MC/DC (cond 3): 3 - 4 |
| 70 | { |
| 71 | TRACE0("Failed to create toolbar\n"); |
0 | | 72 | return -1; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | |
| 77 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); |
| 78 | EnableDocking(CBRS_ALIGN_ANY); |
| 79 | DockControlBar(&m_wndToolBar); |
| 80 | |
| 81 | |
| 82 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | |
| 83 | CBRS_TOOLTIPS | CBRS_FLYBY); |
| 84 | |
1 | | 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | #ifdef _DEBUG |
Top |
2744 | | 92 | void CMainFrame::AssertValid() const |
| 93 | { |
| 94 | CFrameWnd::AssertValid(); |
2744 | | 95 | } |
| 96 | |
Top |
0 | | 97 | void CMainFrame::Dump(CDumpContext& dc) const |
| 98 | { |
| 99 | CFrameWnd::Dump(dc); |
0 | | 100 | } |
| 101 | |
| 102 | #endif |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
Top |
0 | | 107 | void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) |
| 108 | { |
| 109 | CFrameWnd::OnPaletteChanged(pFocusWnd); |
| 110 | |
0 | 0 | 111 | if(pFocusWnd != this) |
| 112 | OnQueryNewPalette(); |
0 | | 113 | } |
| 114 | |
Top |
0 | | 115 | BOOL CMainFrame::OnQueryNewPalette() |
| 116 | { |
| 117 | int i; |
| 118 | CPalette *pOldPal; |
| 119 | CCubeView *pView = (CCubeView *)GetActiveView(); |
| 120 | CClientDC dc(pView); |
| 121 | |
| 122 | |
| 123 | pOldPal = dc.SelectPalette(&pView->m_cPalette, FALSE); |
| 124 | i = dc.RealizePalette(); |
| 125 | dc.SelectPalette(pOldPal, FALSE); |
| 126 | |
0 | 0 | 127 | if(i > 0) |
| 128 | InvalidateRect(NULL); |
| 129 | |
| 130 | |
0 | | 131 | return CFrameWnd::OnQueryNewPalette(); |
| 132 | } |
| 133 | |
Top |
2 | | 134 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) |
| 135 | { |
| 136 | |
| 137 | |
| 138 | cs.style &= ~ FWS_ADDTOTITLE; |
| 139 | |
2 | | 140 | return CFrameWnd::PreCreateWindow(cs); |
| 141 | } |