Click here to Skip to main content
15,884,537 members
Articles / Desktop Programming / MFC

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

Rate me:
Please Sign up or sign in to vote.
4.98/5 (71 votes)
10 Jan 2005CPOL25 min read 530.4K   12.1K   201  
An application/add-in to organise and renumber resource symbol IDs
/************************************************************************
 *
 *                   Resource ID Organiser Add-In
 *
 * (c) Copyright 2000-2002 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgAppProjectsView2.cpp
 *
 *  Description : CResOrgAppProjectsView2 - project workspace list view 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/ResOrgAppProjectsView2.cpp $
 *   $Revision: 12 $
 *       $Date: 26/03/03 14:10 $
 *     $Author: Anna $
 *
 *    $History: ResOrgAppProjectsView2.cpp $
 * 
 * *****************  Version 12  *****************
 * User: Anna         Date: 26/03/03   Time: 14:10
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Added CResOrgSymbolsDocMultiFile::GetDisplayTitle() to choose the title
 * displayed for a multi-file Symbols Display
 * 
 * *****************  Version 11  *****************
 * User: Anna         Date: 2/01/03    Time: 0:21
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * 1.  Added support for WinXP visual themes
 * 2.  Initial support for multi-symbol file editing
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 25/11/02   Time: 14:59
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Changed website address in banner
 * 
 * *****************  Version 9  *****************
 * User: Anna         Date: 22/10/02   Time: 13:28
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Changed name/mail address (at last!)
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 10/22/01   Time: 11:18a
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Added the option to prompt if the "Next Symbol" values are in use
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 10/03/01   Time: 12:51p
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Added "Properties" to the context menu
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 8/07/01    Time: 8:40
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * The Projects Display now autosizes the list control when it is resized
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 5/05/01    Time: 20:49
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Trap attempts to Renumber symbols in empty resource symbol files from
 * the Workspace Display
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 26/04/01   Time: 19:47
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Renamed Resource.h to ResOrgAddIn_Res.h
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 23/04/01   Time: 21:25
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * Added icons to context menu
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 5/03/01    Time: 19:12
 * Updated in $/Projects/AddIns/ResOrg/ResOrgApp
 * 1.  CResOrgAppProjectsView2::OnCmdOpenProject() now displays a message
 * box if a resource symbol file cannot be located in a project instead of
 * ASSERTing
 * 2.  The Workspace Display is now disabled if no workspace is loaded
 * 3.  CResOrgAppProjectsView2::SortList() now calls the base class
 * implementation to set the correct sort image in the header control
 * 4.  Items inserted into the list control now have their item data set
 * to allow sorting
 * 5.  CResOrgAppProjectsView2::OnCmdOpenProject() now displays a message
 * box instead of ASSERTing if no resource symbol file can be identified
 * within a project
 * 
 * *****************  Version 1  *****************
 * User: Andy         Date: 2/03/01    Time: 17:20
 * Created in $/Projects/AddIns/ResOrg/ResOrgApp
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 17/02/01   Time: 7:08
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * Context menu ID changed
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 29/11/00   Time: 18:37
 * Updated in $/Projects/AddIns/ResOrg/ResOrgAddIn
 * 1.  Moved Office2KDlg code to its own DLL
 * 2.  Added file banners
 *
 * $Nokeywords: $
 *
 ************************************************************************/

#include "StdAfx.h"
#include "ResOrgApp_Res.h"

#include "ResOrgApp.h"
#include "ResOrgAppProjectsDoc.h"

#include "ResOrgAppProjectsView2.h"


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


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2

IMPLEMENT_DYNCREATE(CResOrgAppProjectsView2, CResOrgAppProjectsView2_BASE)

BEGIN_MESSAGE_MAP(CResOrgAppProjectsView2, CResOrgAppProjectsView2_BASE)
	//{{AFX_MSG_MAP(CResOrgAppProjectsView2)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_WM_CONTEXTMENU()
	ON_COMMAND(						ID_PROJ_OPEN,				OnCmdOpenProject)
	ON_COMMAND(						ID_PROJ_OPEN_MULTIPLE,		OnCmdOpenProjectsTogether)
	ON_UPDATE_COMMAND_UI(			ID_PROJ_OPEN_MULTIPLE,		OnUpdateOpenProjectsTogether)
	ON_COMMAND(						ID_PROJ_RENUMBER,			OnCmdRenumberProject)
	ON_UPDATE_COMMAND_UI(			ID_PROJ_RENUMBER,			OnUpdateRenumberProject)
	ON_COMMAND(						ID_PROJ_PROPERTIES,			OnCmdProjectProperties)
	ON_UPDATE_COMMAND_UI(			ID_PROJ_PROPERTIES,			OnUpdateProjectProperties)
	//}}AFX_MSG_MAP

	// The following are outside of ClassWizard's reach as it can't understand
	// them....
//	ON_NOTIFY_REFLECT(	NM_DBLCLK,								OnDblClick)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2 construction/destruction

CResOrgAppProjectsView2::CResOrgAppProjectsView2(void)
{
	m_bInitialised		= false;
}


CResOrgAppProjectsView2::~CResOrgAppProjectsView2(void)
{
	Clear();
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2 overrides

/******************************************************************************
 *	This method is called by the framework before the creation of the
 *	window attached to this CWnd object.
 *
 *	This override is used to modify the window styles here to set the List
 *	control style to report view.
 *
 *	This is achieved by masking out the view style using LVS_TYPEMASK
 *	and setting the LVS_REPORT style. LVS_SINGLESEL is also set to allow
 *	only single selections.
 *
 *	Note that we DON'T want the LVS_SORTASCENDING style as this sorts items
 *	by item text and in this case we cannot have a comparison function.
 *
 ******************************************************************************/

BOOL CResOrgAppProjectsView2::PreCreateWindow(CREATESTRUCT& cs)
{
//	cs.style = (cs.style & ~LVS_TYPEMASK) | LVS_REPORT /*| LVS_SINGLESEL*/ | LVS_SHOWSELALWAYS;

	return CResOrgAppProjectsView2_BASE::PreCreateWindow(cs);
}


void CResOrgAppProjectsView2::OnInitialUpdate(void)
{
	// Change style to have:
	//
	//	1.	Flat header (requires CJListCtrl)
	//	2.	Full row selection (requires ComCtl32.dll v4.71)
	//
	if (!m_bInitialised)
	{
//		CCJThemeHelper theme;
//		if (!theme.IsAppThemed() )
//		{
//			SubclassHeader();
//		}
//		SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);

//		CRect rect;
//		GetClientRect(rect);

//		m_ctrlProjects.InsertColumn(0,
//									_T("Project"),
//									LVCFMT_LEFT,
//									rect.Width(),
//									-1);
		m_bInitialised = TRUE;
	}
	CResOrgAppProjectsView2_BASE::OnInitialUpdate();
}


void CResOrgAppProjectsView2::OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint)
{
	UNREFERENCED_PARAMETER(pSender);
	UNREFERENCED_PARAMETER(pHint);

	switch (lHint)
	{
		case CLEAR_WORKSPACE:
			m_ctrlProjects.DeleteAllItems();
			m_ctrlProjects.EnableWindow(FALSE);
			Clear();
			break;

		case SHOW_WORKSPACE:
			m_ctrlProjects.DeleteAllItems();
			m_ctrlProjects.EnableWindow(TRUE);
			Clear();

			GetDocument()->GetProjects(m_arrayProjects);
			FillListCtrl();

			// If there's only one project, open its symbol
			// file automatically
			if (m_arrayProjects.GetSize() == 1)
			{
				CString sProject = m_arrayProjects[0];
				if (!sProject.IsEmpty())
				{
					OpenProject(sProject,
								Options.WarnIfNextSymbolValuesInUse() );
				}
			}
			break;


		default:
			m_ctrlProjects.DeleteAllItems();
			Clear();

			GetDocument()->GetProjects(m_arrayProjects);
			m_ctrlProjects.EnableWindow( (m_arrayProjects.GetSize() > 0) );

			FillListCtrl();

			break;
	}
}	


void CResOrgAppProjectsView2::OnDraw(CDC* /*pDC*/)
{
	CResOrgAppProjectsDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2 diagnostics

#ifdef _DEBUG
void CResOrgAppProjectsView2::AssertValid(void) const
{
	CResOrgAppProjectsView2_BASE::AssertValid();
}


void CResOrgAppProjectsView2::Dump(CDumpContext& dc) const
{
	CResOrgAppProjectsView2_BASE::Dump(dc);
}


CResOrgAppProjectsDoc* CResOrgAppProjectsView2::GetDocument(void) const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CResOrgAppProjectsDoc)));

	return (CResOrgAppProjectsDoc*)m_pDocument;
}
#endif //_DEBUG


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2 implementation

void CResOrgAppProjectsView2::FillListCtrl(void)
{
	m_ctrlProjects.SetRedraw(FALSE);

	m_ctrlProjects.DeleteAllItems();

	CResOrgAppProjectsDoc* pDoc = GetDocument();

	if (NULL != pDoc)
	{
		int nItem = -1;

		CString sSolution = pDoc->GetSolutionName();

		int nImage = m_images.AddIcon(IDI_SYM_SOLUTION);

		HTREEITEM hRootItem = m_ctrlProjects.InsertItem(_T("Solution: ") + sSolution,
														nImage,
														nImage,
														TVI_ROOT);

		for (int n = 0; n < m_arrayProjects.GetSize(); n++)
		{
			CString sProject = m_arrayProjects[n];

			nImage = m_images.AddIcon(IDI_SYM_PROJECT);

			HTREEITEM hProjectItem = m_ctrlProjects.InsertItem(	sProject,
																nImage,
																nImage,
																hRootItem);
			ASSERT(NULL != hProjectItem);

			m_ctrlProjects.SetItemData(hProjectItem, (DWORD)&(m_arrayProjects[n]) );

			CStringArray arrayResourceFilePathNames;
			pDoc->GetResourceFilePathNames(sProject, arrayResourceFilePathNames);

			for (int n = 0; n < arrayResourceFilePathNames.GetSize(); n++)
			{
				CString sResourceFilePathName = arrayResourceFilePathNames[n];

				CNGSplitPath split(sResourceFilePathName);

				nImage = m_images.AddIcon(IDI_SYM_RESOURCE_FILE);

				HTREEITEM hResourceFileItem = m_ctrlProjects.InsertItem(split.GetFileName() + split.GetExtension(),
																		nImage,
																		nImage,
																		hProjectItem);
				ASSERT(NULL != hResourceFileItem);

				// Retrieve the name of the symbol file by parsing the rc file
				CString sSymbolFilePathName = ::GetSymbolFileName(sResourceFilePathName);

				CNGSplitPath splitSymFile(sSymbolFilePathName);

				nImage = m_images.AddIcon(IDI_SYM_FILE);

				HTREEITEM hSymbolFileItem = m_ctrlProjects.InsertItem(	splitSymFile.GetFileName() + splitSymFile.GetExtension(),
																		nImage,
																		nImage,
																		hResourceFileItem);
			}
		}
		m_ctrlProjects.SortChildren(hRootItem);
		m_ctrlProjects.Expand(hRootItem, TVE_EXPAND);
	}

	m_ctrlProjects.SetRedraw(TRUE);
}


void CResOrgAppProjectsView2::Clear(void)
{
	m_arrayProjects.RemoveAll();
}


CString CResOrgAppProjectsView2::GetSymbolFilePathName(const CString& sProject)
{
	CString sSymbolFilePathName;

	// First, extract the rc file name by parsing the .dsp file
	CString sResourceFilePathName = GetDocument()->GetResourceFileName(sProject);
	if (!sResourceFilePathName.IsEmpty())
	{
		// Retrieve the name of the symbol file by parsing the rc file
		sSymbolFilePathName = ::GetSymbolFileName(sResourceFilePathName);
	}
	return sSymbolFilePathName;
}


CDocument* CResOrgAppProjectsView2::OpenResourceSymbolFile(	const CString& sPathName,
															BOOL bCheckNextSymbolValues /*= true*/)
{
	CDocument* pDoc = NULL;

	if (!sPathName.IsEmpty())
	{
		pDoc = GetDocument()->GetOpenDocument(sPathName);
		if (NULL != pDoc)
		{
			// If the file is already open, just activate it
			GetDocument()->SetActiveDocument(pDoc);
		}
		else
		{
			// ...otherwise, we have to open it...
			//
			// To Do: convert to flash box
			//AfxMessageBox( "Displaying symbols for: " + sSymbolFile);

			CResOrgApp* pApp = (CResOrgApp*)::AfxGetApp();
			BOOL bCheckOption = pApp->CheckNextSymbolValues();
			pApp->CheckNextSymbolValues(FALSE);

			pDoc = pApp->OpenDocumentFile(sPathName);
			ASSERT(NULL != pDoc);

			pApp->CheckNextSymbolValues(bCheckOption);
		}
		CResOrgSymbolsDoc* pSymDoc = dynamic_cast<CResOrgSymbolsDoc*>(pDoc);
		if ( (NULL != pSymDoc) && bCheckNextSymbolValues)
		{
			// This is too intrusive if we're opening multiple files
			pSymDoc->CheckNextSymbolValues();
		}
	}
	return pDoc;
}


CDocument* CResOrgAppProjectsView2::OpenProject(const CString& sProject,
											   BOOL bCheckNextSymbolValues /*= TRUE*/)
{
	CDocument* pDoc = NULL;

	CString sSymbolFile = GetSymbolFilePathName(sProject);
	if (!sSymbolFile.IsEmpty())
	{
		return OpenResourceSymbolFile(sSymbolFile, bCheckNextSymbolValues);
	}
	return NULL;
}


int CResOrgAppProjectsView2::DoNextSymbolValuesInUsePrompt(const CStringArray& arrayProjects)
{
	CString sProjects;

	for (int n = 0; n < arrayProjects.GetSize(); n++)
	{
		CString sLine;
	
		sLine.Format( _T("%s\\par\r\n"), arrayProjects[n]);	// Dontcha just love RTF???

		sProjects += sLine;
	}
	CNGMessageBox dlg;

	dlg.FormatMsgEx(MAKEINTRESOURCE(IDP_PRJ_SYM_NEXT_VALUES_IN_USE),
					_T("RTF"),
					sProjects);

	dlg.SetRtf();
	dlg.SetStandardIcon(IDI_WARNING);
	dlg.AddButton(IDOK, TRUE, TRUE, _T("OK") );

	return dlg.DoModal();
}


bool CResOrgAppProjectsView2::IsProject(const CString& sItem) const
{
	return false;
}


bool CResOrgAppProjectsView2::IsResourceFile(const CString& sItem) const
{
	return false;
}


bool CResOrgAppProjectsView2::IsSolution(const CString& sItem) const
{
	if ( (NULL != GetDocument() ) && (sItem == GetDocument()->GetSolutionName() ) )
	{
		return true;
	}
	return false;
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgAppProjectsView2 message handlers

int CResOrgAppProjectsView2::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	int nResult = CResOrgAppProjectsView2_BASE::OnCreate(lpCreateStruct);
	
	if (-1 != nResult)
	{
		m_ctrlProjects.EnableMultiSelect(true);

		if (!m_ctrlProjects.Create(	WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SHOWSELALWAYS,
									CRect(0,0,0,0),
									this,
									IDC_RESORG_SYMBOLS))
		{
			TRACE( _T("Failed to create projects tree control.\n"));

			return -1;
		}

		m_images.Create(16, 16, ILC_COLOR | ILC_MASK, 0, 1);

		m_ctrlProjects.SetImageList(&m_images, TVSIL_NORMAL);
	}
	return nResult;
}


void CResOrgAppProjectsView2::OnSize(UINT nType, int cx, int cy) 
{
	CResOrgAppProjectsView2_BASE::OnSize(nType, cx, cy);
	
	if (NULL != m_ctrlProjects.GetSafeHwnd() )
	{
		m_ctrlProjects.SetWindowPos(	NULL,
									0,
									0,
									cx,
									cy,
									SWP_SHOWWINDOW | SWP_NOZORDER
									);
	}
}


//	Context Menu handler
void CResOrgAppProjectsView2::OnContextMenu(CWnd* pWnd, CPoint point) 
{
/*
	UNREFERENCED_PARAMETER(pWnd);

	// Make sure window is active
	GetParentFrame()->ActivateFrame();

	// Convert to client coordinates for hit testing
	// Note that TrackPopupMenu() expects its coordinates to be screen, not client!
	CPoint ptClient = point;
	ScreenToClient(&ptClient);

	UINT nFlags = 0;
	int nIndex = m_ctrlProjects.HitTest(ptClient, &nFlags);
	
	if (nIndex >= 0)
	{
		CCJMenu menu;
		if (menu.LoadMenu(IDM_PRJ_CONTEXT_MENU))
		{
			menu.LoadToolbar(IDM_PRJ_CONTEXT_MENU);

			CMenu* pPopup = menu.GetSubMenu(0);
			ASSERT(NULL != pPopup);

			pPopup->SetDefaultItem(ID_PROJ_OPEN);
			pPopup->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN,
								   point.x,
								   point.y,
								   AfxGetMainWnd()); // route commands through main window
			return;
		}
	}
	Default();									// Default message handling if we didn't do anything
*/
}


void CResOrgAppProjectsView2::OnDblClick(NMHDR* /*pNMHDR*/, LRESULT* pResult) 
{
	*pResult = 0;

	OnCmdOpenProject();
}


void CResOrgAppProjectsView2::OnCmdOpenProject(void)
{
	if (NULL != GetDocument() )
	{
		// Get the first selected item
		HTREEITEM hItem = m_ctrlProjects.GetFirstSelectedItem();

		while (NULL != hItem)
		{
			CString sItem = m_ctrlProjects.GetItemText(hItem);
			ASSERT(!sItem.IsEmpty() );

			if (!sItem.IsEmpty() )
			{
				if (IsProject(sItem) )
				{
					// Open all symbol files associated with the project
				}
				else if (IsResourceFile(sItem) )
				{
					CString sResourceFilePathName = sItem;		// TODO: Get full pathname from sItem
					if (!sResourceFilePathName.IsEmpty())
					{
						// Open the symbol file associated with the resource file
						CResOrgSymbolsDoc* pSymDoc = DYNAMIC_DOWNCAST(	CResOrgSymbolsDoc,
																		OpenResourceSymbolFile( ::GetSymbolFileName(sResourceFilePathName),
																		FALSE ) );
						if (NULL != pSymDoc)
						{
							if (pSymDoc->CheckNextSymbolValues(FALSE) )
							{
	//							arrayProjects.Add(sProject);
							}
						}
						else
						{
//							CString sMsg;
//							sMsg.Format(IDP_PRJ_NO_SYM_FILE, sProject);

//							::AfxMessageBox(sMsg,
//											MB_OK | MB_ICONEXCLAMATION);
						}
					}
				}
				else if (IsSolution(sItem) )
				{
					// Open ALL symbol files within the solution
				}
				else
				{
					// Open the symbol file
				}
			}
			hItem = m_ctrlProjects.GetNextSelectedItem(hItem);
		}
	}
/*
	if (nSelCount > 0)
	{
			CStringArray arrayProjects;

			POSITION pos = m_ctrlProjects.GetFirstSelectedItemPosition();
			while (pos != NULL)
			{
				int nItem = m_ctrlProjects.GetNextSelectedItem(pos);
				if (nItem >= 0)
				{
					CString sProject = m_ctrlProjects.GetItemText(nItem, 0);

					CResOrgSymbolsDoc* pSymDoc = DYNAMIC_DOWNCAST(	CResOrgSymbolsDoc,
																	OpenProject(sProject,
																	FALSE ) );
					if (NULL != pSymDoc)
					{
						if (pSymDoc->CheckNextSymbolValues(FALSE) )
						{
							arrayProjects.Add(sProject);
						}
					}
					else
					{
						CString sMsg;
						sMsg.Format(IDP_PRJ_NO_SYM_FILE, sProject);

						::AfxMessageBox(sMsg,
										MB_OK | MB_ICONEXCLAMATION);
					}
				}
			}
			if (Options.WarnIfNextSymbolValuesInUse())
			{
				if (arrayProjects.GetSize() > 0)
				{
					DoNextSymbolValuesInUsePrompt(arrayProjects);
				}
			}
		}
	}
*/
}


void CResOrgAppProjectsView2::OnCmdOpenProjectsTogether(void)
{
/*
	int nSelCount = m_ctrlProjects.GetSelectedCount();

	if (nSelCount > 0)
	{
		CResOrgAppProjectsDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);

		if (NULL != pDoc)
		{
			CStringArray arraySymbolFilePathNames;

			POSITION pos = m_ctrlProjects.GetFirstSelectedItemPosition();
			while (pos != NULL)
			{
				int nItem = m_ctrlProjects.GetNextSelectedItem(pos);
				if (nItem >= 0)
				{
					CString sProject = m_ctrlProjects.GetItemText(nItem, 0);

					CString sSymbolFilePathName = GetSymbolFilePathName(sProject);

					if (!sSymbolFilePathName.IsEmpty())
					{
						arraySymbolFilePathNames.Add(sSymbolFilePathName);
					}
				}
			}
			if (arraySymbolFilePathNames.GetSize() > 0)
			{
				CResOrgApp* pApp = (CResOrgApp*)::AfxGetApp();

				pApp->OpenMultiFileSymbolsView(arraySymbolFilePathNames);
			}
			else
			{
				::AfxMessageBox(_T("No resource symbol files were found in the selected projects"),
								MB_OK | MB_ICONSTOP);
			}
		}
	}
*/
}


void CResOrgAppProjectsView2::OnUpdateOpenProjectsTogether(CCmdUI* pCmdUI)
{
//	pCmdUI->Enable( m_ctrlProjects.GetSelectedCount() >= 2);
}


void CResOrgAppProjectsView2::OnCmdRenumberProject(void)
{
/*
	if (m_ctrlProjects.GetSelectedCount() > 0)
	{
		CResOrgAppProjectsDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);

		if (NULL != pDoc)
		{
			POSITION pos = m_ctrlProjects.GetFirstSelectedItemPosition();
			while (pos != NULL)
			{
				int nItem = m_ctrlProjects.GetNextSelectedItem(pos);
				if (nItem >= 0)
				{
					CString sProject = m_ctrlProjects.GetItemText(nItem, 0);

					CResOrgSymbolsDoc* pDoc = dynamic_cast<CResOrgSymbolsDoc*>( OpenProject(sProject, FALSE) );
					if (NULL != pDoc)
					{
						if (pDoc->GetSymbolBuffer()->GetSymbolCount() > 0)
						{
							AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_TOOLS_RENUMBER);
						}
						else
						{
							AfxMessageBox(	_T("This file contains no symbols"),
											MB_OK | MB_ICONSTOP);
						}
					}
				}
			}
		}
	}
*/
}


void CResOrgAppProjectsView2::OnUpdateRenumberProject(CCmdUI* pCmdUI)
{
//	pCmdUI->Enable( m_ctrlProjects.GetSelectedCount() == 1);
}


void CResOrgAppProjectsView2::OnCmdProjectProperties(void)
{
/*	if (m_ctrlProjects.GetSelectedCount() > 0)
	{
		CResOrgAppProjectsDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);

		if (NULL != pDoc)
		{
			POSITION pos = m_ctrlProjects.GetFirstSelectedItemPosition();
			while (pos != NULL)
			{
				int nItem = m_ctrlProjects.GetNextSelectedItem(pos);
				if (nItem >= 0)
				{
					CString sProject = m_ctrlProjects.GetItemText(nItem, 0);

					CResOrgSymbolsDoc* pDoc = dynamic_cast<CResOrgSymbolsDoc*>( OpenProject(sProject, FALSE) );
					if (NULL != pDoc)
					{
						::AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_FILE_PROPERTIES);
					}
				}
			}
		}
	}
*/
}


void CResOrgAppProjectsView2::OnUpdateProjectProperties(CCmdUI* pCmdUI)
{
//	pCmdUI->Enable( m_ctrlProjects.GetSelectedCount() == 1);
}

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)


Written By
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!

Comments and Discussions