📄 renumwizengine.cpp
字号:
/************************************************************************
*
* Resource ID Organiser Utility Library
*
* (c) Copyright 2001 by Andy Metcalfe (andy.metcalfe@lineone.net)
* All rights reserved.
*
************************************************************************
*
* Filename : RenumWizEngine.cpp
*
* Description : CRenumWizEngine - Settings and operations for the
* Symbol Renumbering Wizard
*
* 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/ResOrgUtils/RenumWizEngine.cpp $
* $Revision: 5 $
* $Date: 2/07/01 22:06 $
* $Author: Andy $
*
* $History: RenumWizEngine.cpp $
*
* ***************** Version 5 *****************
* User: Andy Date: 2/07/01 Time: 22:06
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* CRenumWizEngine::Renumber() now shows a waitcursor while renumbering
* symbols
*
* ***************** Version 4 *****************
* User: Andy Date: 23/05/01 Time: 16:11
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Changed default options
*
* ***************** Version 3 *****************
* User: Andy Date: 5/05/01 Time: 20:51
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Filter out read-only symbols from the list of symbols available for
* renumbering
*
* ***************** Version 2 *****************
* User: Andy Date: 4/05/01 Time: 22:37
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Renumber() no longer requires the editable symbols base value
*
* ***************** Version 1 *****************
* User: Andy Date: 21/04/01 Time: 7:12
* Created in $/Projects/AddIns/ResOrg/ResOrgUtils
*
* $Nokeywords: $
*
************************************************************************/
// RenumWizEngine.cpp : implementation file
#include "StdAfx.h"
#include "RenumWizEngine.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRenumWizEngine
CRenumWizEngine::CRenumWizEngine(void)
{
m_pResourceSymbolBuffer = NULL;
m_eSymbolSelection = RENUMWIZ_CONFLICTING_SYMBOLS;
m_eSymbolOrder = RENUMWIZ_PRESERVE_ORDER;
m_uBaseCommand = 0;
m_uBaseControl = 0;
m_uBaseResource = 0;
m_uBaseSymed = 0;
}
CRenumWizEngine::~CRenumWizEngine(void)
{
}
/////////////////////////////////////////////////////////////////////////////
// Virtual Overrides
/////////////////////////////////////////////////////////////////////////////
// Operations
void CRenumWizEngine::Initialise(CResourceSymbolBuffer* pResourceSymbolBuffer)
{
m_pResourceSymbolBuffer = pResourceSymbolBuffer;
ASSERT_VALID(m_pResourceSymbolBuffer);
m_pResourceSymbolBuffer->GetSymbols(m_listAvailableSymbols);
// Filter out read-only symbols
POSITION pos = m_listAvailableSymbols.GetHeadPosition();
while (NULL != pos)
{
POSITION posPrev = pos;
CResourceSymbol* pSymbol = m_listAvailableSymbols.GetNext(pos);
if ( (NULL == pSymbol) || pSymbol->IsReadOnly() )
{
m_listAvailableSymbols.RemoveAt(posPrev);
}
}
}
int CRenumWizEngine::GetAvailableSymbols(CResourceSymbolList& rlistSymbols) const
{
rlistSymbols.RemoveAll();
rlistSymbols.AddTail( (CResourceSymbolList*)&m_listAvailableSymbols);
return rlistSymbols.GetCount();
}
int CRenumWizEngine::GetSelectedSymbols(CResourceSymbolList& rlistSymbols) const
{
rlistSymbols.RemoveAll();
rlistSymbols.AddTail( (CResourceSymbolList*)&m_listSelectedSymbols);
return rlistSymbols.GetCount();
}
BOOL CRenumWizEngine::Select(CResourceSymbol* pSymbol)
{
BOOL bResult = FALSE;
POSITION pos = m_listAvailableSymbols.Find(pSymbol);
if (NULL != pos)
{
m_listAvailableSymbols.RemoveAt(pos);
m_listSelectedSymbols.AddTail(pSymbol);
bResult = TRUE;
}
return bResult;
}
BOOL CRenumWizEngine::IsSelected(CResourceSymbol* pSymbol) const
{
BOOL bResult = FALSE;
POSITION pos = m_listSelectedSymbols.Find(pSymbol);
if (NULL != pos)
{
bResult = TRUE;
}
return bResult;
}
BOOL CRenumWizEngine::Deselect(CResourceSymbol* pSymbol)
{
BOOL bResult = FALSE;
POSITION pos = m_listSelectedSymbols.Find(pSymbol);
if (NULL != pos)
{
m_listSelectedSymbols.RemoveAt(pos);
m_listAvailableSymbols.AddTail(pSymbol);
bResult = TRUE;
}
return bResult;
}
BOOL CRenumWizEngine::Renumber(void)
{
BOOL bResult = FALSE;
CWaitCursor wait;
BOOL bSortByName = (RENUMWIZ_SORT_BY_NAME == m_eSymbolOrder);
switch (m_eSymbolSelection)
{
case RENUMWIZ_ALL_SYMBOLS: // All symbols
bResult = m_pResourceSymbolBuffer->Renumber(m_uBaseResource,
m_uBaseCommand,
m_uBaseControl,
bSortByName);
break;
case RENUMWIZ_SELECTED_SYMBOLS: // Selected symbols only
bResult = m_pResourceSymbolBuffer->Renumber(&m_listSelectedSymbols,
m_uBaseResource,
m_uBaseCommand,
m_uBaseControl,
bSortByName);
break;
case RENUMWIZ_CONFLICTING_SYMBOLS: // Conflicting symbols only
bResult = m_pResourceSymbolBuffer->Renumber(&m_listSelectedSymbols,
m_uBaseResource,
m_uBaseCommand,
m_uBaseControl,
bSortByName);
break;
default:
ASSERT(FALSE);
break;
}
return bResult;
}
/////////////////////////////////////////////////////////////////////////////
// Implementation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -