📄 mainframe.cpp
字号:
/************************************************************************
*
* Resource ID Organiser Application
*
* (c) Copyright 2000-2001 by Andy Metcalfe (andy.metcalfe@lineone.net)
* All rights reserved.
*
************************************************************************
*
* Filename : MainFrame.cpp
*
* Description : CMainFrame - MDI main frame class
*
* Compiler : Microsoft Visual C++ 6.0, Service Pack 3 or 4
*
* Target
* Environment : Windows 98/NT
*
* NOTE:
*
* This software is provided "as is" free for personal use. All
* title and copyrights in and to the software, including but not
* limited to any images, text, etc. incorporated into it, are
* owned by Andy Metcalfe, except where acknowledged otherwise.
*
* Your may freely to use this code in your own products, PROVIDED
* this notice is not removed or modified.
*
*
* Visit http://www.resorg.co.uk for latest updates
*
************************************************************************
*
* MODIFICATION HISTORY:
*
* This is a controlled document. See project configuration
* control tool for latest version and full version history.
*
* $Archive: /Projects/AddIns/ResOrg/ResOrgApp/MainFrame.cpp $
* $Revision: 10 $
* $Date: 8/07/01 8:39 $
* $Author: Andy $
*
* $History: MainFrame.cpp $
*
* ***************** Version 10 *****************
* User: Andy Date: 8/07/01 Time: 8:39
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* CMainFrame::OnCreate() now hides the workspace by default (the code was
* in the wrong place for the call to work before)
*
* ***************** Version 9 *****************
* User: Andy Date: 2/06/01 Time: 16:51
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Moved common functionality to a new class (CResOrgMDIFrameWnd) in
* ResOrgUtils
*
* ***************** Version 8 *****************
* User: Andy Date: 26/05/01 Time: 17:19
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Set the ID of the Projects View so we can link in the topic for context
* help
*
* ***************** Version 7 *****************
* User: Andy Date: 22/05/01 Time: 6:50
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* OnCmdMsg() now routes messages to the "Options" helper
*
* ***************** Version 6 *****************
* User: Andy Date: 21/04/01 Time: 7:31
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Added CMainFrame::ShowWorkspace()
*
* ***************** Version 5 *****************
* User: Andy Date: 2/04/01 Time: 17:52
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Use CResOrgSymbolsDoc::GetSymbolBuffer() instead of accessing directly
*
* ***************** Version 4 *****************
* User: Andy Date: 5/03/01 Time: 19:14
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* 1. Corrected File|Close and File|Save/Save As command handlers
* 2. Moved workspace open/close related code to the application class
*
* ***************** Version 3 *****************
* User: Andy Date: 2/03/01 Time: 17:18
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* 1. Added symbol count indicators to the status bar
* 2. Added basic workspace functionality
*
* ***************** Version 2 *****************
* User: Andy Date: 29/11/00 Time: 18:37
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* 1. Moved Office2KDlg code to its own DLL
* 2. Added file banners
*
* $Nokeywords: $
*
************************************************************************/
// MainFrame.cpp : implementation of the CMainFrame class
//
#include "StdAfx.h"
#include "ResOrgApp.h"
#include "ResOrgAppProjectsDoc.h"
#include "ResOrgAppProjectsView.h"
#include "MainFrame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMainFrame_BASE)
BEGIN_MESSAGE_MAP(CMainFrame, CMainFrame_BASE)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_COMMAND_EX( ID_VIEW_WORKSPACE, OnBarCheck)
ON_UPDATE_COMMAND_UI( ID_VIEW_WORKSPACE, OnUpdateControlBarMenu)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame(void)
{
}
CMainFrame::~CMainFrame(void)
{
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame virtual overrides
/////////////////////////////////////////////////////////////////////////////
// CMainFrame operations
void CMainFrame::ShowWorkspace(BOOL bShow)
{
ShowControlBar(&m_wndWorkspace, bShow, FALSE);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame implementation
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMainFrame_BASE::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMainFrame_BASE::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
int nResult = CMainFrame_BASE::OnCreate(lpCreateStruct);
if (nResult != -1)
{
// Create the "Workspace" docking window (m_wndWorkspace)
if (!m_wndWorkspace.Create( this,
ID_VIEW_WORKSPACE,
_T("Workspace"),
CSize(225,100),
CBRS_LEFT ))
{
TRACE0("Failed to create dialog bar m_wndWorkspace\n");
return -1; // fail to create
}
// Create the document for each of the tab views, then add the
// document / view to the tab control. This is a very simple implementation.
// you could go further and actually create a document template for each tab,
// and add it to the app. If so, you would pass in m_pMyDocTemplate->CreateNewDocument(),
// instead of dynamically allocating a pointer for each document as shown here.
// This was done for simplicity.
//
// Projects tab
CDocument* pProjectsDoc = ((CResOrgApp*)AfxGetApp())->GetProjectsDoc();
m_wndWorkspace.AddView( _T( "Projects" ),
RUNTIME_CLASS( CResOrgAppProjectsView ),
pProjectsDoc );
// Define the image list to use with the tab control
m_TabImages.Create( IDB_WORKSPACE_TABS, 16, 1, RGB( 0,255,0 ));
m_wndWorkspace.SetTabImageList( &m_TabImages );
m_wndWorkspace.EnableDockingOnSizeBar( CBRS_ALIGN_ANY );
EnableDockingSizeBar( CBRS_ALIGN_ANY );
DockSizeBar( &m_wndWorkspace );
// Set the ID of the view so we can link in the topic
// for context help
//
// Note that this has to be a command (ID_) or the
// wrong help context ID will be generated by the
// framework (this only happens because the view
// is inside a control bar)
CView* pView = m_wndWorkspace.GetView(0);
if (NULL != pView)
{
pView->SetDlgCtrlID(ID_DISPLAY_WORKSPACE);
}
// Set the popoup menu id.
m_wndWorkspace.SetMenuID( IDR_MAINFRAME, NULL, 1 );
// Restore the previous bar and window states.
LoadBarState(_T("Bar State"));
// Don't show the workspace by default
ShowWorkspace(FALSE);
}
return nResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -