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
An application/add-in to organise and renumber resource symbol IDs
resorg103.zip
resorg104.zip
resorgaddinsetup.zip
resorgaddin_executables.zip
resorgnetaddinsetup.zip
resorgnetaddin_executables.zip
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
resorg_executables.zip
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
NGLibrary
Bin
NGLibrary.def
NGLibrary.dsp
NGLibrary.dsw
Release
Res
Drives.bmp
Release
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 Core Library
 *
 * (c) Copyright 2000-2003 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : RenumWizSelectSymbolsPage.cpp
 *
 *  Description : RenumWizSelectSymbolsPage - Symbol Renumbering Wizard
 *                "Select Symbols" page class
 *
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or later
 *                Microsoft Visual C++ .NET 2002
 *                                                                       
 *  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/ResOrgCore/RenumWizSelectSymbolsPage.cpp $
 *   $Revision: 10 $
 *       $Date: 15/04/03 20:38 $
 *     $Author: Anna $
 *
 *    $History: RenumWizSelectSymbolsPage.cpp $
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 15/04/03   Time: 20:38
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * 1.  Removed unnecessary file guards (#pragma once works well enough)
 * 2.  Updated file banners
 * 
 * *****************  Version 9  *****************
 * User: Anna         Date: 25/11/02   Time: 15:10
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed website address in banner
 * 
 * *****************  Version 8  *****************
 * User: Anna         Date: 22/10/02   Time: 13:24
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed name/mail address (at last!)
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 7/06/02    Time: 17:04
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Renamed the ResOrgUtils module to ResOrgCore. Updated file banners
 * accordingly
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 27/05/02   Time: 16:41
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Knock on changes from CResourceSymbolBuffer (now
 * CResourceSymbolManager) and CResourceSymbol
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 1/03/02    Time: 7:44p
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 *  CRenumWizSelectSymbolsPage::OnWizardBack() now re-enables the "Next"
 * button just in case it was disabled (thanks to Arnt Witteveen for the
 * bug report)
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 12/28/01   Time: 4:37p
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Double clicking on a symbol now selects or deselects it
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 4/05/01    Time: 22:37
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Implemented resizing
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 23/04/01   Time: 21:18
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Implemented the "Auto" symbol selection options
 * 
 * *****************  Version 1  *****************
 * User: Andy         Date: 21/04/01   Time: 7:13
 * Created in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 
 * $Nokeywords: $
 *
 ************************************************************************/


#include "StdAfx.h"
#include "ResOrgCore_Priv.h"

#include "RenumWizAutoSelectSymbolsDlg.h"

#include "RenumWizSelectSymbolsPage.h"


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


// Selection modes
// used to determine whether to add or remove items from the selection list
enum
{
	SEL_MODE_NONE = 0,
	SEL_MODE_ADD,
	SEL_MODE_REMOVE
};


/////////////////////////////////////////////////////////////////////////////
// CRenumWizSelectSymbolsPage wizard page

IMPLEMENT_DYNCREATE(CRenumWizSelectSymbolsPage, CRenumWizSelectSymbolsPage_BASE)

CRenumWizSelectSymbolsPage::CRenumWizSelectSymbolsPage(void)
 : CRenumWizSelectSymbolsPage_BASE(	CRenumWizSelectSymbolsPage::IDD,
									IDS_RENUMWIZ,
									IDS_RENUMWIZ_SELECT_SYMBOLS_PAGE_TITLE,
									IDS_RENUMWIZ_SELECT_SYMBOLS_PAGE_SUBTITLE)
{
	//{{AFX_DATA_INIT(CRenumWizSelectSymbolsPage)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	m_sSelBtnLegend		= _T("");
	m_eSelMode			= SEL_MODE_NONE;
}


CRenumWizSelectSymbolsPage::~CRenumWizSelectSymbolsPage(void)
{
}


void CRenumWizSelectSymbolsPage::DoDataExchange(CDataExchange* pDX)
{
	CRenumWizSelectSymbolsPage_BASE::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRenumWizSelectSymbolsPage)
	DDX_Control(pDX,			IDC_RENUMWIZ_AVAIL_SYMBOLS,		m_ctrlAvailableSymbols);
	DDX_Control(pDX,			IDC_RENUMWIZ_SEL_SYMBOLS,		m_ctrlSelectedSymbols);
	DDX_Text(pDX,				IDC_RENUMWIZ_SEL,				m_sSelBtnLegend);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRenumWizSelectSymbolsPage, CRenumWizSelectSymbolsPage_BASE)
	//{{AFX_MSG_MAP(CRenumWizSelectSymbolsPage)
	ON_BN_CLICKED(				IDC_RENUMWIZ_SEL,				OnClickedSelect)
	ON_BN_CLICKED(				IDC_RENUMWIZ_SEL_ALL,			OnClickedSelectAll)
	ON_BN_CLICKED(				IDC_RENUMWIZ_SEL_NONE,			OnClickedDeselectAll)
	ON_BN_CLICKED(				IDC_RENUMWIZ_SEL_AUTO,			OnClickedAutoSelect)
	ON_NOTIFY(LVN_ITEMCHANGED,	IDC_RENUMWIZ_AVAIL_SYMBOLS,		OnItemchangedAvailSymbols)
	ON_NOTIFY(LVN_ITEMCHANGED,	IDC_RENUMWIZ_SEL_SYMBOLS,		OnItemchangedSelectedSymbols)
	ON_NOTIFY(NM_SETFOCUS,		IDC_RENUMWIZ_AVAIL_SYMBOLS,		OnSetfocusAvailSymbols)
	ON_NOTIFY(NM_SETFOCUS,		IDC_RENUMWIZ_SEL_SYMBOLS,		OnSetfocusSelectedSymbols)
	ON_NOTIFY(NM_DBLCLK,		IDC_RENUMWIZ_AVAIL_SYMBOLS,		OnDblClickAvailableSymbols)
	ON_NOTIFY(NM_DBLCLK,		IDC_RENUMWIZ_SEL_SYMBOLS,		OnDblClickSelectedSymbols)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CRenumWizSelectSymbolsPage overrides

BOOL CRenumWizSelectSymbolsPage::OnInitDialog(void) 
{
	CRenumWizSelectSymbolsPage_BASE::OnInitDialog();
	
	if (IsResizeable())
	{
		m_Resizer.Add( IDC_RENUMWIZ_AVAIL_SYMBOLS_CAPTION,	0, 0, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_AVAIL_SYMBOLS,			0, 0, 50, 100);
		m_Resizer.Add( IDC_RENUMWIZ_SEL_ALL,				50, 20, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_SEL,					50, 40, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_SEL_NONE,				50, 60, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_SEL_AUTO,				50, 80, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_SEL_SYMBOLS_CAPTION,	50, 0, 0, 0);
		m_Resizer.Add( IDC_RENUMWIZ_SEL_SYMBOLS,			50, 0, 50, 100);
	}
	CWaitCursor wait;

	m_ctrlAvailableSymbols.Initialise();
	m_ctrlSelectedSymbols.Initialise();

	// Temporary fix
	m_ctrlAvailableSymbols.AddSymbols(m_pEngine->m_pSymbolManager);
	m_ctrlSelectedSymbols.AddSymbols(m_pEngine->m_pSymbolManager);

	m_ctrlAvailableSymbols.AutoSizeColumn();
	m_ctrlSelectedSymbols.AutoSizeColumn();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


BOOL CRenumWizSelectSymbolsPage::OnSetActive(void)
{
	BOOL bResult = CRenumWizSelectSymbolsPage_BASE::OnSetActive();

	if (!IsInitialising())
	{
		if (bResult)
		{
			CWaitCursor wait;

			FillListCtrl();
			FillSelListCtrl();

			SetAvailableControls();
		}
	}
	return bResult;
}


LRESULT CRenumWizSelectSymbolsPage::OnWizardBack(void) 
{
	EnableWizardButtons(PSWIZB_NEXT, TRUE);

	return IDD_RENUMWIZ_OPTIONS_PAGE;
}


LRESULT CRenumWizSelectSymbolsPage::OnWizardNext(void) 
{
	//if (m_pEngine->m_listSelectedSymbols.GetCount() > 0)
	return IDD_RENUMWIZ_BASE_VALUES_PAGE;
}


/////////////////////////////////////////////////////////////////////////////
// CRenumWizSelectSymbolsPage implementation

/******************************************************************************
 *	Fill the list controls
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::FillListCtrl(void)
{
	m_ctrlAvailableSymbols.SetRedraw(FALSE);

	m_ctrlAvailableSymbols.DeleteAllItems();

	CResourceSymbolList listSymbols;
	GetAvailableSymbols(listSymbols);

	POSITION pos = listSymbols.GetHeadPosition();
	while (NULL != pos)
	{
		CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
		ASSERT(NULL != pSymbol);

		if (NULL != pSymbol)
		{
			if (!IsSelected(pSymbol) )
			{
				m_ctrlAvailableSymbols.AddSymbol(pSymbol);
			}
		}
	}
	m_ctrlAvailableSymbols.SetRedraw(TRUE);
}


void CRenumWizSelectSymbolsPage::FillSelListCtrl(void)
{
	m_ctrlSelectedSymbols.SetRedraw(FALSE);

	m_ctrlSelectedSymbols.DeleteAllItems();

	CResourceSymbolList listSymbols;
	GetSelectedSymbols(listSymbols);

	POSITION pos = listSymbols.GetHeadPosition();
	while (NULL != pos)
	{
		CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
		ASSERT(NULL != pSymbol);

		if (NULL != pSymbol)
		{
			m_ctrlSelectedSymbols.AddSymbol(pSymbol);
		}
	}
	m_ctrlSelectedSymbols.SetRedraw(TRUE);
}


int CRenumWizSelectSymbolsPage::GetAvailableSymbolCount(BOOL bSelectionsOnly /*= FALSE*/) const
{
	if (bSelectionsOnly)
	{
		return m_ctrlAvailableSymbols.GetSelectedCount();
	}
	return m_ctrlAvailableSymbols.GetItemCount();
}


int CRenumWizSelectSymbolsPage::GetSelectedSymbolCount(BOOL bSelectionsOnly /*= FALSE*/) const
{
	if (bSelectionsOnly)
	{
		return m_ctrlSelectedSymbols.GetSelectedCount();
	}
	return m_ctrlSelectedSymbols.GetItemCount();
}


int CRenumWizSelectSymbolsPage::GetAvailableSymbols(CResourceSymbolList& rlistSymbols) const
{
	return m_pEngine->GetAvailableSymbols(rlistSymbols);
}


int CRenumWizSelectSymbolsPage::GetSelectedSymbols(CResourceSymbolList& rlistSymbols) const
{
	return m_pEngine->GetSelectedSymbols(rlistSymbols);
}


void CRenumWizSelectSymbolsPage::SetAvailableControls(void)
{
	CResourceSymbolList listSymbols;
	GetSelectedSymbols(listSymbols);

	EnableWizardButtons(PSWIZB_NEXT, (listSymbols.GetCount() > 0) );
}


void CRenumWizSelectSymbolsPage::SetMode(int eMode)
{
	m_eSelMode = eMode;
	BOOL bEnable = FALSE;
	switch(m_eSelMode)
	{
		case SEL_MODE_NONE:
			m_sSelBtnLegend		= _T("<< >>");
			bEnable = FALSE;
			break;

		case SEL_MODE_ADD:
			m_sSelBtnLegend		= _T(">>");
			bEnable = TRUE;
			break;

		case SEL_MODE_REMOVE:
			m_sSelBtnLegend		= _T("<<");
			bEnable = TRUE;
			break;

	}
	UpdateData(FALSE);

	EnableDlgControl(IDC_RENUMWIZ_SEL,		bEnable);
	EnableDlgControl(IDC_RENUMWIZ_SEL_ALL,	(GetAvailableSymbolCount() > 0) );
	EnableDlgControl(IDC_RENUMWIZ_SEL_NONE,	(GetSelectedSymbolCount() > 0) );
}


BOOL CRenumWizSelectSymbolsPage::Select(CResourceSymbol* pSymbol)
{
	if (m_pEngine->Select(pSymbol) )
	{
		m_ctrlAvailableSymbols.RemoveSymbol(pSymbol);
		m_ctrlSelectedSymbols.AddSymbol(pSymbol);

		return TRUE;
	}
	return FALSE;
}
 

BOOL CRenumWizSelectSymbolsPage::IsSelected(CResourceSymbol* pSymbol) const
{
	return m_pEngine->IsSelected(pSymbol);
}


BOOL CRenumWizSelectSymbolsPage::Deselect(CResourceSymbol* pSymbol)
{
	if (m_pEngine->Deselect(pSymbol) )
	{
		m_ctrlSelectedSymbols.RemoveSymbol(pSymbol);
		m_ctrlAvailableSymbols.AddSymbol(pSymbol);

		return TRUE;
	}
	return FALSE;
}


/////////////////////////////////////////////////////////////////////////////
// CRenumWizSelectSymbolsPage message handlers

/******************************************************************************
 *	"Select" button handler
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnClickedSelect(void) 
{
	// Work out which control is focused (left or right):
	//
	//	*	If the left control is focused, add to the selection
	//	*	If the right control is focused, remove from the selection
	//
	// Note that we use a temporary list of symbols to prevent the list controls
	// being modified whilst their contents are being examined.
	switch (m_eSelMode)
	{
		case SEL_MODE_ADD:
			{
				m_ctrlAvailableSymbols.SetRedraw(FALSE);
				m_ctrlSelectedSymbols.SetRedraw(FALSE);

				CResourceSymbolList listSymbols;

				POSITION pos = m_ctrlAvailableSymbols.GetFirstSelectedItemPosition();
				while (NULL != pos)
				{
					int nItem = m_ctrlAvailableSymbols.GetNextSelectedItem(pos);
					ASSERT(nItem >= 0);

					CResourceSymbol* pSymbol = (CResourceSymbol*)m_ctrlAvailableSymbols.GetItemData(nItem);
					ASSERT(NULL != pSymbol);
					listSymbols.AddTail(pSymbol);
				}

				pos = listSymbols.GetHeadPosition();
				while (NULL != pos)
				{
					CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
					Select(pSymbol);
				}
			
				m_ctrlAvailableSymbols.SetRedraw(TRUE);
				m_ctrlSelectedSymbols.SetRedraw(TRUE);
			}
			break;

		case SEL_MODE_REMOVE:
			{
				m_ctrlAvailableSymbols.SetRedraw(FALSE);
				m_ctrlSelectedSymbols.SetRedraw(FALSE);

				CResourceSymbolList listSymbols;

				POSITION pos = m_ctrlSelectedSymbols.GetFirstSelectedItemPosition();
				while (NULL != pos)
				{
					int nItem = m_ctrlSelectedSymbols.GetNextSelectedItem(pos);
					ASSERT(nItem >= 0);

					CResourceSymbol* pSymbol = (CResourceSymbol*)m_ctrlSelectedSymbols.GetItemData(nItem);
					ASSERT(NULL != pSymbol);
					listSymbols.AddTail(pSymbol);
				}

				pos = listSymbols.GetHeadPosition();
				while (NULL != pos)
				{
					CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
					Deselect(pSymbol);
				}
			
				m_ctrlAvailableSymbols.SetRedraw(TRUE);
				m_ctrlSelectedSymbols.SetRedraw(TRUE);
			}
			break;

		default:
			ASSERT(FALSE);
			break;
	}
	SetAvailableControls();
}


/******************************************************************************
 *	"Select All" button handler
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnClickedSelectAll(void)
{
	int nItemCount = m_ctrlAvailableSymbols.GetItemCount();
	if (nItemCount > 0)
	{
		m_ctrlAvailableSymbols.SetRedraw(FALSE);
		m_ctrlSelectedSymbols.SetRedraw(FALSE);

		for (int nItem = nItemCount - 1; nItem >= 0; nItem--)
		{
			CResourceSymbol* pSymbol = (CResourceSymbol*)m_ctrlAvailableSymbols.GetItemData(nItem);
			ASSERT(NULL != pSymbol);
			Select(pSymbol);
		}
		m_ctrlAvailableSymbols.SetRedraw(TRUE);
		m_ctrlSelectedSymbols.SetRedraw(TRUE);

		SetMode(SEL_MODE_NONE);
	}
	SetAvailableControls();
}


/******************************************************************************
 *	"Deselect All" button handler
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnClickedDeselectAll(void)
{
	int nItemCount = m_ctrlSelectedSymbols.GetItemCount();
	if (nItemCount > 0)
	{
		m_ctrlAvailableSymbols.SetRedraw(FALSE);
		m_ctrlSelectedSymbols.SetRedraw(FALSE);

		for (int nItem = nItemCount - 1; nItem >= 0; nItem--)
		{
			CResourceSymbol* pSymbol = (CResourceSymbol*)m_ctrlSelectedSymbols.GetItemData(nItem);
			ASSERT(NULL != pSymbol);
			Deselect(pSymbol);
		}
		m_ctrlAvailableSymbols.SetRedraw(TRUE);
		m_ctrlSelectedSymbols.SetRedraw(TRUE);

		SetMode(SEL_MODE_NONE);
	}
	SetAvailableControls();
}


/******************************************************************************
 *	"Auto" button handler
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnClickedAutoSelect(void) 
{
	CRenumWizAutoSelectSymbolsDlg dlg;

	if (IDOK == dlg.DoModal() )
	{
		OnClickedDeselectAll();  // Deselect all symbols to start with

		m_ctrlAvailableSymbols.SetRedraw(FALSE);
		m_ctrlSelectedSymbols.SetRedraw(FALSE);

		POSITION pos = m_pEngine->m_listAvailableSymbols.GetHeadPosition();
		while (NULL != pos)
		{
			CResourceSymbol* pSymbol = m_pEngine->m_listAvailableSymbols.GetNext(pos);
			if (NULL != pSymbol)
			{
				BOOL bRenumberSymbol = TRUE;

				if (dlg.m_bRenumberConflicts)
				{
					// If this option is set only renumber conflicting symbols
					if (!pSymbol->HasConflicts() )
					{
						bRenumberSymbol = FALSE;
						continue;
					}
				}
				switch (pSymbol->GetType())
				{
					case SYM_RESOURCE:
						bRenumberSymbol = dlg.m_bRenumberResources;
						break;

					case SYM_BITMAP:
						bRenumberSymbol = dlg.m_bRenumberBitmaps;
						break;

					case SYM_CONTROL:
						bRenumberSymbol = dlg.m_bRenumberControls;
						break;

					case SYM_DIALOG:
						bRenumberSymbol = dlg.m_bRenumberDialogs;
						break;

					case SYM_MENU:
						bRenumberSymbol = dlg.m_bRenumberMenus;
						break;

					case SYM_ICON:
						bRenumberSymbol = dlg.m_bRenumberIcons;
						break;

					case SYM_PROMPT:
						bRenumberSymbol = dlg.m_bRenumberPrompts;
						break;

					case SYM_STRING:
						bRenumberSymbol = dlg.m_bRenumberStrings;
						break;

					case SYM_COMMAND:
						bRenumberSymbol = dlg.m_bRenumberCommands;
						break;

					default:
						break;
				}

				if (bRenumberSymbol)
				{
					Select(pSymbol);
				}
			}
		}
		m_ctrlAvailableSymbols.SetRedraw(TRUE);
		m_ctrlSelectedSymbols.SetRedraw(TRUE);

		SetAvailableControls();
	}
}


/******************************************************************************
 *	Called when an item changes in one of the list controls
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnItemchangedAvailSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	if (GetAvailableSymbolCount(TRUE) > 0)
	{
		SetMode(SEL_MODE_ADD);
	}
	else
	{
		SetMode(SEL_MODE_NONE);
	}
}


void CRenumWizSelectSymbolsPage::OnItemchangedSelectedSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	if (GetSelectedSymbolCount(TRUE) > 0)
	{
		SetMode(SEL_MODE_REMOVE);
	}
	else
	{
		SetMode(SEL_MODE_NONE);
	}
}


/******************************************************************************
 *	Called when one of the list controls receives the input focus
 *
 ******************************************************************************/

void CRenumWizSelectSymbolsPage::OnSetfocusAvailSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	if (GetAvailableSymbolCount(TRUE) > 0)
	{
		SetMode(SEL_MODE_ADD);
	}
}


void CRenumWizSelectSymbolsPage::OnSetfocusSelectedSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	if (GetSelectedSymbolCount() > 0)
	{
		SetMode(SEL_MODE_REMOVE);
	}
}


void CRenumWizSelectSymbolsPage::OnDblClickAvailableSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	CResourceSymbolList listSymbols;
	m_ctrlAvailableSymbols.GetSelection(listSymbols);

	if (listSymbols.GetCount() > 0)
	{
		m_ctrlSelectedSymbols.SetRedraw(FALSE);
		m_ctrlAvailableSymbols.SetRedraw(FALSE);

		POSITION pos = listSymbols.GetHeadPosition();
		while (NULL != pos)
		{
			CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
			if (NULL != pSymbol)
			{
				Select(pSymbol);
			}
		}
		m_ctrlAvailableSymbols.SetRedraw(TRUE);
		m_ctrlSelectedSymbols.SetRedraw(TRUE);
	}
}


void CRenumWizSelectSymbolsPage::OnDblClickSelectedSymbols(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UNREFERENCED_PARAMETER(pResult);

	CResourceSymbolList listSymbols;
	m_ctrlSelectedSymbols.GetSelection(listSymbols);

	if (listSymbols.GetCount() > 0)
	{
		m_ctrlAvailableSymbols.SetRedraw(FALSE);
		m_ctrlSelectedSymbols.SetRedraw(FALSE);

		POSITION pos = listSymbols.GetHeadPosition();
		while (NULL != pos)
		{
			CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
			if (NULL != pSymbol)
			{
				Deselect(pSymbol);
			}
		}
		m_ctrlSelectedSymbols.SetRedraw(TRUE);
		m_ctrlAvailableSymbols.SetRedraw(TRUE);
	}
}


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 | Mobile
Web03 | 2.8.140814.1 | Last Updated 10 Jan 2005
Article Copyright 2001 by Anna-Jayne Metcalfe
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid