Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Resource ID Organiser Add-In for Visual C++ 5.0/6.0/.NET

, 10 Jan 2005 CPOL
An application/add-in to organise and renumber resource symbol IDs
resorg103.zip
ResOrg103.exe
resorg104.zip
ResOrg104.exe
resorgaddinsetup.zip
ResOrgAddInSetup.exe
resorgaddin_executables.zip
ResOrg.exe
BXFileDialog.dll
CJ609Lib.dll
NGLib103.dll
ResOrgAddIn.dll
ResOrgCore.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
resorgnetaddinsetup.zip
ResOrgNETAddInSetup.msi
resorgnetaddin_executables.zip
ResOrgNETAddInToolWindows.ocx
ResOrgNET.exe
CJ609LibVc7.dll
NGLib103Vc7.dll
ResOrgNETAddIn.dll
ResOrgNETCore.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
ReadMe.rtf
Licence.rtf
resorgnet_executables.zip
ResOrgNET_executables
CJ609LibVc7.dll
NGLib103Vc7.dll
QHTMLight.dll
ResOrg.cnt
resorg.fts
ResOrg.hlp
ResOrgNETAddIn.dll
ResOrgNETAddInToolWindows.ocx
ResOrgNETCore.dll
resorg_demo.zip
ResOrg103.exe
resorg_executables.zip
ResOrgAddIn.dll
BXFileDialog.dll
CJ609Lib.dll
ResOrg.exe
ResOrg.cnt
resorg.fts
ResOrg.hlp
ResOrgCore.dll
NGLib103.dll
resorg_src.zip
BXFileDialog
BXFileDialog.dsp
Lib
Release
Res
bitmap2.bmp
FileOpen.bmp
filesave.bmp
CJLibrary
CJLibrary
CJLibrary.def
CJLibrary.dsp
CJLibrary.dsw
CJLibrarydep.jpg
CJLibraryStatic.dsp
Debug_Unicode
Release
Release_Unicode
res
Include
res
btn_arro.bmp
btn_explorer.bmp
button_images.bmp
cj_logo.bmp
dragging.cur
handcur.cur
headerba.bmp
hsplitba.cur
icr_hand.cur
nodraggi.cur
PushPin.bmp
Toolbar.bmp
vsplitba.cur
Lib
default.doxygen
NGLibrary
Bin
NGLibrary.def
NGLibrary.dsp
NGLibrary.dsw
Release
Res
Drives.bmp
Release
ResOrg.dsw
ResOrgAddIn
Release
Res
HtmlDoc.ico
ResOrg.ico
ResOrgDoc.ico
TBarLrge.bmp
TBarMedm.bmp
Toolbar.bmp
WorkspaceTabs.bmp
ResOrgAddIn.def
ResOrgAddIn.dsp
ResOrgAddIn.odl
ResOrgAddIn_Res.hm
ResOrgApp
Lint
Release
Res
HtmlDoc.ico
MAINFRAM.BMP
ResOrg.ico
ResOrgDoc.ico
TBarLrge.bmp
TBarMedm.bmp
Toolbar.bmp
workspace.ico
WorkspaceTabs.bmp
ResOrgApp.dsp
ResOrgApp_Res.hm
ResOrgApp_Res.resorg
ResOrgCore
Lint
Release
Res
Anna.bmp
BuildOptions.ico
ComCtl Version Prompt.rtf
File Reload Warning Ex.rtf
File Reload Warning.rtf
Global Next Symbol Value Warning Prompt.rtf
information.ico
Invalid Symbol Name.rtf
Mailing List Prompt.rtf
Next Symbol Value Warning Prompt.rtf
project context menu.bmp
project.ico
RenumWiz Completion.rtf
Report.ico
ResOrg Logo.bmp
ResOrg Updated.rtf
ResOrg.ico
resource file.ico
riverblade_logo.bmp
solution.ico
Symbol Delete Warning.rtf
Symbol Name Warning.rtf
Symbol Rename Warning.rtf
SymbolFile.ico
Symbols Delete Warning.rtf
sym_binary.ico
sym_bitmap.ico
sym_command.ico
sym_control.ico
sym_dialog.ico
sym_icon.ico
sym_menu.ico
sym_prompt.ico
sym_resource.ico
sym_string.ico
Toolbar.bmp
VcAddIn.ico
VersionCheck.ico
warning.ico
WizardHeader256.bmp
WizardWatermark256.bmp
ResOrgCore.def
ResOrgCore.dsp
ResOrgCore_Res.hm
ResOrgCore_Res.resorg
Xml
ProblemSymbolReportHtml.xsl
SymbolsReportHtml.xsl
ResOrgNETAddIn
AddIn.def
Release
Res
AddIn.rgs
HtmlDoc.ico
ResOrg.ico
ResOrgDoc.ico
Toolbar.bmp
WorkspaceTabs.bmp
ResOrgNETAddInSetup
Banner.jpg
Intro screen.jpg
Licence.rtf
ReadMe.rtf
Release
ResOrg.ico
ResOrgNETAddInSetup.vdproj
ResOrgNETAddInToolWindows
Release
Res
Edit.ico
Properties.ico
Renumber.ico
ResOrgNETAddInToolWindows.ico
ResOrgNETAddInToolWindowsCtrl.bmp
ResOrgNETAddInToolWindows.def
SatelliteDll
Release
res
AboutBoxCmd.bmp
OpenResOrgCmd.bmp
OptionsCmd.bmp
ViewMainToolWinCmd.bmp
/************************************************************************
 *
 *                   Resource ID Organiser Add-In
 *
 * (c) Copyright 2000-2002 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : MainFrame.cpp
 *
 *  Description : CMainFrame - MDI main frame window class
 *
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or later
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT/2000/XP
 *
 *  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/ResOrgAddIn/MainFrame.cpp $
 *   $Revision: 16 $
 *       $Date: 25/11/02 16:52 $
 *     $Author: Anna $
 *
 *    $History: MainFrame.cpp $
 * 
 * *****************  Version 16  *****************
 * User: Anna         Date: 25/11/02   Time: 16:52
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Changed website address in banner
 * 
 * *****************  Version 15  *****************
 * User: Anna         Date: 22/10/02   Time: 13:34
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Changed name/mail address (at last!)
 * 
 * *****************  Version 14  *****************
 * User: Andy         Date: 2/08/02    Time: 17:03
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Renamed CWorkspaceHelper to CVc6AutomationHelper, and moved it to the
 * ResOrgCore module
 * 
 * *****************  Version 13  *****************
 * User: Andy         Date: 1/24/02    Time: 11:35p
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * CMainFrame::DoModal() in the add-in now shows the workspace if
 * necessary
 * 
 * *****************  Version 12  *****************
 * User: Andy         Date: 1/18/02    Time: 10:41p
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Enabled "flat look" for the workspace
 * 
 * *****************  Version 11  *****************
 * User: Andy         Date: 2/06/01    Time: 16:51
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Moved common functionality to a new class (CResOrgMDIFrameWnd) in
 * ResOrgUtils
 * 
 * *****************  Version 10  *****************
 * User: Andy         Date: 26/05/01   Time: 21:01
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Cleaned up DoModal() a bit
 * 
 * *****************  Version 9  *****************
 * User: Andy         Date: 26/05/01   Time: 17:22
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * 1.  Removed help message handlers (these have been moved to the app)
 * 2.  Set the ID of the Projects View so we can link in the topic for
 * context help
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 22/05/01   Time: 7:00
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * OnCmdMsg() now routes messages to the "Options" global helper
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 26/04/01   Time: 19:40
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Renamed Resource.h to ResOrgAddIn_Res.h
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 2/04/01    Time: 17:51
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Use CResOrgSymbolsDoc::GetSymbolBuffer() instead of accessing directly
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 5/03/01    Time: 19:03
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Added "Close All" command to the Window menu
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 2/03/01    Time: 17:33
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Removed unnecessary code
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 17/02/01   Time: 7:07
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * CResOrgSymbolsView => CResOrgSymbolsListView
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 29/11/00   Time: 18:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * 1.  CMainFrame::OnClose() now saves modified files if necessary
 * 2.  Added file banner
 *
 * $Nokeywords: $
 *
 ************************************************************************/

// MainFrame.cpp : implementation of the CMainFrame class
//

#include "StdAfx.h"
#include <afxpriv.h>			// For WM_KICKIDLE

#include "ResOrgAddIn_Res.h"

#include "ResOrgAddInApp.h"		// For CWorkspaceHelper extern declaration
#include "ResOrgProjectsDoc.h"
#include "ResOrgProjectsView.h"

#include "MainFrame.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CMainFrame_BASE)

BEGIN_MESSAGE_MAP(CMainFrame, CMainFrame_BASE)

	//{{AFX_MSG_MAP(CMainFrame)
	ON_MESSAGE(				WM_KICKIDLE,					OnKickIdle)
	ON_WM_CREATE()
	ON_WM_CLOSE()
	//}}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)
{
	m_pProjectsDoc = NULL;	
}


CMainFrame::~CMainFrame(void)
{
}


/////////////////////////////////////////////////////////////////////////////
// CMainFrame virtual overrides

int CMainFrame::DoModal(HWND hWndDevStudio)
{
	// Disable parent (before creating window)
	PreModal();
	BOOL bEnableParent	= FALSE;
	BOOL bMaximised		= FALSE;
	BOOL bActive		= FALSE;

	if ( (hWndDevStudio != NULL) && ::IsWindowEnabled(hWndDevStudio) )
	{
		bMaximised	= ::IsZoomed(hWndDevStudio) ;
		bActive		= (::GetActiveWindow() == hWndDevStudio);

		::ShowWindow(hWndDevStudio, SW_HIDE);
		::EnableWindow(hWndDevStudio, FALSE);

		bEnableParent = TRUE;
	}

	try
	{
		// Refresh the workspace
		m_pProjectsDoc->UpdateAllViews(NULL, SHOW_WORKSPACE);
		
		if (Options.AutoHideWorkspace())
		{
			ShowWorkspace(Workspace.GetProjectCount() > 0);
		}
		else
		{
			ShowWorkspace(TRUE);
		}

		// Show window
		ShowWindow(bMaximised ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL);

		// Get the size/position of the DevStudio main window and use them
		WINDOWPLACEMENT wndPlacement;
		if (::GetWindowPlacement(hWndDevStudio, &wndPlacement) )
		{
			::SetWindowPlacement(m_hWnd, &wndPlacement);
		}
		RunModalLoop(MLF_SHOWONIDLE);

		// Hide the window before enabling the parent, etc.
		if (m_hWnd != NULL)
		{
			ShowWindow(SW_HIDE);
		}
	}
	catch (CException* e)
	{
		e->Delete();
		m_nModalResult = -1;
	}

	// Get the workspace to clear and release it's IProject pointers
	m_pProjectsDoc->UpdateAllViews(NULL, CLEAR_WORKSPACE);

	if (hWndDevStudio != NULL)
	{
		if (bEnableParent)
		{
			::ShowWindow(hWndDevStudio, bMaximised ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL);
			::EnableWindow(hWndDevStudio, TRUE);
		}
		if (bActive)
		{
			::SetActiveWindow(hWndDevStudio);
		}
	}
	PostModal();

	// Close all symbol documents
	// Note that the "Projects" document is unaffected
	AfxGetApp()->CloseAllDocuments(FALSE);

	// unlock/free resources as necessary
	return m_nModalResult;
}


void CMainFrame::PreModal(void)
{
	// Allow OLE servers to disable themselves
	CWinApp* pApp = AfxGetApp();
	if (pApp != NULL)
	{
		pApp->EnableModeless(FALSE);
	}
}


void CMainFrame::PostModal(void)
{
	// R-enable windows
	if (::IsWindow(m_hWndTop))
	{
		::EnableWindow(m_hWndTop, TRUE);
	}

	m_hWndTop = NULL;
	CWinApp* pApp = AfxGetApp();
	if (pApp != NULL)
	{
		pApp->EnableModeless(TRUE);
	}
}


BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
{
	if (CMainFrame_BASE::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo) )
	{
		return TRUE;
	}
	return m_wndWorkspace.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}


/////////////////////////////////////////////////////////////////////////////
// CMainFrame operations

void CMainFrame::ShowWorkspace(BOOL bShow)
{
	ShowControlBar(&m_wndWorkspace, bShow, FALSE);
}


/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid(void) const
{
	CMainFrame_BASE::AssertValid();
}


void CMainFrame::Dump(CDumpContext& dc) const
{
	CMainFrame_BASE::Dump(dc);
}

#endif //_DEBUG


/////////////////////////////////////////////////////////////////////////////
// CMainFrame implementation
// (none)


/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	int nResult = CMainFrame_BASE::OnCreate(lpCreateStruct);
	if (-1 != nResult)
	{
		// Create the "Workspace" docking window.
		//
		// Initialise m_wndWorkspace control bar
		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 (the only one at present)
		m_pProjectsDoc = new CResOrgProjectsDoc;
		ASSERT_KINDOF( CDocument, m_pProjectsDoc );
		m_wndWorkspace.AddView( _T( "Projects" ), RUNTIME_CLASS( CResOrgProjectsView ), m_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 popoup menu id.
		m_wndWorkspace.SetMenuID( IDR_MAINFRAME, NULL, 1 );

		// 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);
		}

		// Restore the previous bar and window states.
		LoadBarState(_T("Bar State"));
	}
	return nResult;
}


void CMainFrame::OnClose(void)
{
	CWinApp* pApp = AfxGetApp();
	if ( (NULL != pApp) && (this == pApp->m_pMainWnd) )
	{
		// Attempt to save all modified documents
		if (!pApp->SaveAllModified())
		{
			return;     // Don't close just yet
		}
	}
	// Save the bar and window states.
	m_state.SaveWindowPos(this);
	SaveBarState(_T("Bar State"));

	m_nModalResult = IDOK;
	EndModalLoop(m_nModalResult);
}


// Handle MFC private message WM_KICKIDLE. LPARAM is the idle count. 
// Return TRUE/FALSE continue/discontinue idle processing.
LRESULT CMainFrame::OnKickIdle(WPARAM, LPARAM lCount)
{
	return AfxGetApp()->OnIdle(lCount);
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Anna-Jayne Metcalfe
Founder Riverblade Limited
United Kingdom United Kingdom
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...Laugh | :laugh:
 
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!
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 10 Jan 2005
Article Copyright 2001 by Anna-Jayne Metcalfe
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid