| Hits/True | False | - | Line | Source |
|
| | 1 | // mainfrm.cpp : implementation of the CMainFrame class |
| | 2 | // |
| | 3 | // This is a part of the Microsoft Foundation Classes C++ library. |
| | 4 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 5 | // |
| | 6 | // This source code is only intended as a supplement to the |
| | 7 | // Microsoft Foundation Classes Reference and related |
| | 8 | // electronic documentation provided with the library. |
| | 9 | // See these sources for detailed information regarding the |
| | 10 | // Microsoft Foundation Classes product. |
| | 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 | // CMainFrame |
| | 26 | |
| Top |
| 2 | | | 27 | IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) |
| 2 | | | 27 | return new CMainFrame |
| | | | 27 | } |
| Top |
| 32 | | | 27 | FUNCTION CMainFrame::_GetBaseClass() |
| 32 | | | 27 | return ( CFrameWnd::GetThisClass ( ) ) |
| | | | 27 | } |
| Top |
| 2 | | | 27 | FUNCTION CMainFrame::GetThisClass() |
| 2 | | | 27 | return ( ( CRuntimeClass * ) ( & CMainFrame::classCMainFrame ) ) |
| | | | 27 | } |
| Top |
| 38132 | | | 27 | FUNCTION CMainFrame::GetRuntimeClass() |
| 38132 | | | 27 | return ( ( CRuntimeClass * ) ( & CMainFrame::classCMainFrame ) ) |
| | | | 27 | } |
| | 28 | |
| Top |
| 32470 | | | 29 | BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) |
| 32470 | | | 29 | return GetThisMessageMap ( ) |
| | | | 29 | } |
| Top |
| 32470 | | | 29 | FUNCTION CMainFrame::GetThisMessageMap() |
| | 30 | //{{AFX_MSG_MAP(CMainFrame) |
| | 31 | ON_WM_CREATE() |
| | 32 | ON_WM_PALETTECHANGED() |
| | 33 | ON_WM_QUERYNEWPALETTE() |
| | 34 | //}}AFX_MSG_MAP |
| 32470 | | | 35 | END_MESSAGE_MAP() |
| | | | 35 | } |
| | 36 | |
| | 37 | ///////////////////////////////////////////////////////////////////////////// |
| | 38 | // arrays of IDs used to initialize control bars |
| | 39 | |
| | 40 | // toolbar buttons - IDs are command buttons |
| | 41 | static UINT BASED_CODE buttons[] = |
| | 42 | { |
| | 43 | // same order as in the bitmap 'toolbar.bmp' |
| | 44 | ID_FILE_PLAY, |
| | 45 | ID_APP_ABOUT, |
| | 46 | }; |
| | 47 | |
| | 48 | ///////////////////////////////////////////////////////////////////////////// |
| | 49 | // CMainFrame construction/destruction |
| | 50 | |
| Top |
| 2 | | | 51 | CMainFrame::CMainFrame() |
| | 52 | { |
| | 53 | // TODO: add member initialization code here |
| | 54 | |
| 2 | | | 55 | } |
| | 56 | |
| Top |
| 2 | | | 57 | CMainFrame::~CMainFrame() |
| | 58 | { |
| 2 | | | 59 | } |
| | 60 | |
| Top |
| 2 | | | 61 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) |
| | 62 | { |
| 0 | 2 | - | 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 | 2 | - | 69 | sizeof(buttons)/sizeof(UINT))) |
| 0 | | - | 69 | 1: T || _ || _ |
| 0 | | - | 69 | 2: F || T || _ |
| 0 | | - | 69 | 3: F || F || T |
| | 2 | | 69 | 4: F || F || F |
| | 70 | { |
| | 71 | TRACE0("Failed to create toolbar\n"); |
| 0 | | - | 72 | return -1; // fail to create |
| | 73 | } |
| | 74 | |
| | 75 | // TODO: Delete these three lines if you don't want the toolbar to |
| | 76 | // be dockable |
| | 77 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); |
| | 78 | EnableDocking(CBRS_ALIGN_ANY); |
| | 79 | DockControlBar(&m_wndToolBar); |
| | 80 | |
| | 81 | // TODO: Remove this if you don't want tool tips |
| | 82 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | |
| | 83 | CBRS_TOOLTIPS | CBRS_FLYBY); |
| | 84 | |
| 2 | | | 85 | return 0; |
| | | | 86 | } |
| | 87 | |
| | 88 | ///////////////////////////////////////////////////////////////////////////// |
| | 89 | // CMainFrame diagnostics |
| | 90 | |
| | 91 | #ifdef _DEBUG |
| Top |
| 38087 | | | 92 | void CMainFrame::AssertValid() const |
| | 93 | { |
| | 94 | CFrameWnd::AssertValid(); |
| 38087 | | | 95 | } |
| | 96 | |
| Top |
| 0 | | - | 97 | void CMainFrame::Dump(CDumpContext& dc) const |
| | 98 | { |
| | 99 | CFrameWnd::Dump(dc); |
| 0 | | - | 100 | } |
| | 101 | |
| | 102 | #endif //_DEBUG |
| | 103 | |
| | 104 | ///////////////////////////////////////////////////////////////////////////// |
| | 105 | // CMainFrame message handlers |
| | 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 |
| 4 | | | 134 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) |
| | 135 | { |
| | 136 | // remove this flag to remove " - Untitled" from the frame's caption |
| | 137 | |
| | 138 | cs.style &= ~ FWS_ADDTOTITLE; |
| | 139 | |
| 4 | | | 140 | return CFrameWnd::PreCreateWindow(cs); |
| | | | 141 | } |
| ***TER 60 | % (25/42) of SOURCE FILE mainfrm.cpp |
| 56 | % (22/39) statement |