|
/************************************************************************
*
* Resource ID Organiser Application
*
* (c) Copyright 2000-2002 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
* 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 Anna-Jayne 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.annasplace.me.uk/resorg 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: 14 $
* $Date: 25/11/02 14:59 $
* $Author: Anna $
*
* $History: MainFrame.cpp $
*
* ***************** Version 14 *****************
* User: Anna Date: 25/11/02 Time: 14:59
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Changed website address in banner
*
* ***************** Version 13 *****************
* User: Anna Date: 22/10/02 Time: 13:28
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Changed name/mail address (at last!)
*
* ***************** Version 12 *****************
* User: Andy Date: 1/14/02 Time: 8:18p
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* The workspace now uses the "flat" look
*
* ***************** Version 11 *****************
* User: Andy Date: 12/28/01 Time: 12:31a
* Updated in $/Projects/AddIns/ResOrg/ResOrgApp
* Added "Auto Hide Workspace" option
*
* ***************** 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
}
m_wndWorkspace.EnableFlatLook();
// 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 = static_cast<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
if (Options.AutoHideWorkspace() )
{
ShowWorkspace(FALSE);
}
}
return nResult;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I haven't always written software for a living. When I graduated from Surrey University in 1989, it was with an Electronic Engineering degree, but unfortunately that never really gave me the opportunity to do anything particularly interesting (with the possible exception of designing
Darth Vader's Codpiece * for the UK Army in 1990).
* Also known as the Standard Army Bootswitch. But that's another story...
Since the opportunity arose to lead a software team developing C++ software for
Avionic Test Systems in 1996, I've not looked back. More recently I've been involved in the development of subsea acoustic navigation systems, digital TV broadcast systems, port security/tracking systems, and most recently software development tools with my own company,
Riverblade Ltd.
One of my personal specialities is IDE plug-in development.
ResOrg was my first attempt at a plug-in, but my day to day work is with
Visual Lint, an interactive code analysis tool environment with works within the Visual Studio and Eclipse IDEs or on build servers.
I love lots of things, but particularly music, photography and anything connected with history or engineering. I
despise ignorant, intolerant and obstructive people - and it shows...I can be a bolshy cow if you wind me up the wrong way...
I'm currently based 15 minutes walk from the beach in Bournemouth on the south coast of England. Since I moved here I've grown to love the place - even if it is full of grockles in Summer!