⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symbolpropertysheet.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Core Library
 *
 * (c) Copyright 2000-2003 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : SymbolPropertySheet.cpp
 *
 *  Description : CSymbolPropertySheet - property sheet 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/SymbolPropertySheet.cpp $
 *   $Revision: 11 $
 *       $Date: 11/07/04 16:14 $
 *     $Author: Anna $
 *
 *    $History: SymbolPropertySheet.cpp $
 * 
 * *****************  Version 11  *****************
 * User: Anna         Date: 11/07/04   Time: 16:14
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Added support for detection of out of range symbols
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 25/02/03   Time: 21:24
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * CSymbolPropertySheet::OnMsgSymbolChanging() now handles Name/Value
 * conflicts better
 * 
 * *****************  Version 9  *****************
 * User: Anna         Date: 15/02/03   Time: 20:51
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Comment changes only
 * 
 * *****************  Version 8  *****************
 * User: Anna         Date: 2/01/03    Time: 23:52
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * The "filename" attribute of duplicate CResourceSymbol objects created
 * specifically for the "Conflicts" property page is now set correctly
 * 
 * *****************  Version 7  *****************
 * User: Anna         Date: 2/01/03    Time: 0:18
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Added a "File Name" control to the "General" property page
 * 
 * *****************  Version 6  *****************
 * User: Anna         Date: 25/11/02   Time: 15:19
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed website address in banner
 * 
 * *****************  Version 5  *****************
 * User: Anna         Date: 22/10/02   Time: 13:24
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed name/mail address (at last!)
 * 
 * *****************  Version 4  *****************
 * 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 3  *****************
 * User: Andy         Date: 27/05/02   Time: 13:36
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Knock on changes from CResourceSymbolBuffer (now
 * CResourceSymbolManager)
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 2/04/01    Time: 17:31
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 1.  Improved external interface
 * 2.  Implemented "Conflicts" page
 * 
 * *****************  Version 1  *****************
 * User: Andy         Date: 27/03/01   Time: 15:17
 * Created in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 
 * $Nokeywords: $
 *
 ************************************************************************/

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

#include "SymbolPropertySheet.h"


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


// Registered message definitions
const UINT WM_SYM_CHANGING	= ::RegisterWindowMessage( _T("SymbolChanging") );


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet class

IMPLEMENT_DYNAMIC(CSymbolPropertySheet, CSymbolPropertySheet_BASE)

BEGIN_MESSAGE_MAP(CSymbolPropertySheet, CSymbolPropertySheet_BASE)
	//{{AFX_MSG_MAP(CSymbolPropertySheet)
	ON_REGISTERED_MESSAGE(	WM_SYM_CHANGING,			OnMsgSymbolChanging)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet construction/destruction

CSymbolPropertySheet::CSymbolPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CSymbolPropertySheet_BASE(nIDCaption, pParentWnd, iSelectPage)
{
	m_pSymbols			= NULL;
	m_pSymbol			= NULL;

	m_bHasConflictsPage = false;

	Initialise();
}

CSymbolPropertySheet::CSymbolPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CSymbolPropertySheet_BASE(pszCaption, pParentWnd, iSelectPage)
{
	m_pSymbols			= NULL;
	m_pSymbol			= NULL;

	m_bHasConflictsPage = false;

	Initialise();
}


CSymbolPropertySheet::~CSymbolPropertySheet(void)
{
}


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet virtual overrides

BOOL CSymbolPropertySheet::OnInitDialog(void)
{
	BOOL bResult = CSymbolPropertySheet_BASE::OnInitDialog();

	ASSERT(m_pSymbols != NULL);		// Must be set first

	return bResult;
}


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet operations

BOOL CSymbolPropertySheet::Initialise(	CResourceSymbolManager* pSymbols,
										CResourceSymbol* pSymbol,
										bool bEditValueOnly /*= false*/)
{
	m_pSymbols	= pSymbols;
	ASSERT(NULL != m_pSymbols);

	m_pSymbol	= pSymbol;
	ASSERT(NULL != m_pSymbol);

	m_GeneralPage.Initialise(m_pSymbols, m_pSymbol, bEditValueOnly);

	m_ConflictsPage.AddSymbols(&m_ConflictingSymbols);		// Will be empty right now

	return (NULL != m_pSymbols);
}


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet implementation

BOOL CSymbolPropertySheet::Initialise(void)
{
	m_psh.dwFlags |= PSH_NOAPPLYNOW;		// Remove the "Apply" button

	AddPage(&m_GeneralPage);

	return true;
}


/////////////////////////////////////////////////////////////////////////////
// CSymbolPropertySheet message handlers

/// Handler for WM_SYM_CHANGING registered message.
/// Called when a symbol name or value is in the process of being changed
/// in the "General" page
///
/// \param wParam The value of the symbol
/// \param lParam A NULL terminated string containing the symbol name
///
LRESULT CSymbolPropertySheet::OnMsgSymbolChanging(WPARAM wParam, LPARAM lParam)
{
	CString sSymbolName	= (LPCTSTR)lParam;
	UINT uSymbolValue	= (UINT)wParam;

	// Tell the "Conflicts" page to update itself
	m_ConflictingSymbols.RemoveAll();

	CResourceSymbolList listSymbols;
	m_pSymbols->GetSymbols(sSymbolName, listSymbols);

	CResourceSymbolList listSymbols2;
	m_pSymbols->GetSymbols(uSymbolValue, listSymbols2);

	POSITION pos = listSymbols2.GetHeadPosition();
	while (NULL != pos)
	{
		CResourceSymbol* pSymbol = listSymbols2.GetNext(pos);
		if (NULL == listSymbols.Find(pSymbol) )
		{
			listSymbols.AddTail(pSymbol);
		}
	}
	pos = listSymbols.GetHeadPosition();
	while (NULL != pos)
	{
		CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
		if (pSymbol != m_pSymbol)
		{
			CResourceSymbol* pCopy = m_ConflictingSymbols.Add(	pSymbol->GetName(),
																pSymbol->GetValue(),
																0);

			ASSERT(NULL != pCopy);
			if (NULL != pCopy)
			{
				pCopy->SetFileName( pSymbol->GetFileName() );
			}
		}
	}
	if (m_ConflictingSymbols.GetSymbolCount() > 0)
	{
		if (!m_bHasConflictsPage)
		{
			AddPage(&m_ConflictsPage);
			m_bHasConflictsPage = true;
		}
		m_ConflictsPage.AddSymbols(&m_ConflictingSymbols);
	}
	else
	{
		if (m_bHasConflictsPage)
		{
			RemovePage(&m_ConflictsPage);
			m_bHasConflictsPage = false;
		}
	}

	return (LRESULT)true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -