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

📄 resorgsymbolsdocmultifile.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Core Library
 *
 * (c) Copyright 2000-2004 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgSymbolsDocMultiFile.h
 *
 *  Description : CResOrgSymbolsDocMultiFile - document class for multiple
 *                resource symbol files
 *                
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or later
 *                Microsoft Visual C++ .NET 2003
 *                                                                       
 *  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/ResOrgSymbolsDocMultiFile.cpp $
 *   $Revision: 11 $
 *       $Date: 29/08/04 22:00 $
 *     $Author: Anna $
 *
 *    $History: ResOrgSymbolsDocMultiFile.cpp $
 * 
 * *****************  Version 11  *****************
 * User: Anna         Date: 29/08/04   Time: 22:00
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 *  CResOrgSymbolsDocMultiFile::Serialize() now checks if the file being
 * saved exists before assuming it is read only
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 29/08/04   Time: 21:25
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Removed CResOrgSymbolsDocMultiFile::DoOverwritePrompt(). This is now a
 * global function in ResOrgCore-Globals.cpp
 * 
 * *****************  Version 9  *****************
 * User: Anna         Date: 26/03/03   Time: 14:09
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Added CResOrgSymbolsDocMultiFile::GetDisplayTitle() to choose the title
 * displayed for a multi-file Symbols Display
 * 
 * *****************  Version 8  *****************
 * User: Anna         Date: 6/03/03    Time: 23:58
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Minor mod to CResOrgSymbolsDocMultiFile::AddFile()
 * 
 * *****************  Version 7  *****************
 * User: Anna         Date: 4/03/03    Time: 20:50
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * CResOrgSymbolsDocMultiFile::AddFiles() now displays a progress dialog
 * 
 * *****************  Version 6  *****************
 * User: Anna         Date: 15/02/03   Time: 20:49
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed big BOOLs into little bools
 * 
 * *****************  Version 5  *****************
 * User: Anna         Date: 28/01/03   Time: 21:19
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Improved multi-file support by allowing files to be Added/Removed from
 * a multi-file display via the File Properties Dialog
 * 
 * *****************  Version 4  *****************
 * User: Anna         Date: 19/01/03   Time: 17:19
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * 1.  Added CResOrgSymbolsDocMultiFile::GetMultiFileSymbolManager()
 * 2.  Added an override of CResOrgSymbolsDoc()::Set
 * 3.  Implemented multi-file saving
 * 
 * *****************  Version 3  *****************
 * User: Anna         Date: 3/01/03    Time: 15:51
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Added a "Files" tab to the Symbol File Properties dialog. Not fully
 * functional yet
 * 
 * *****************  Version 2  *****************
 * User: Anna         Date: 3/01/03    Time: 0:09
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Speeded up multi-file loading slightly
 * 
 * *****************  Version 1  *****************
 * User: Anna         Date: 2/01/03    Time: 0:03
 * Created in $/Projects/AddIns/ResOrg/ResOrgCore
 * 
 *
 * $Nokeywords: $
 *
 ************************************************************************/


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

#include "ResourceSymbolManagerMultiFile.h"
#include "ResourceSymbolFilePropertySheet.h"
#include "ResOrgProgressDlg.h"

#include "ResOrgSymbolsDocMultiFile.h"




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


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile

IMPLEMENT_DYNCREATE(CResOrgSymbolsDocMultiFile, CResOrgSymbolsDocMultiFile_BASE)

BEGIN_MESSAGE_MAP(CResOrgSymbolsDocMultiFile, CResOrgSymbolsDocMultiFile_BASE)

	ON_COMMAND(				ID_FILE_CLOSE,					OnFileClose)
	ON_COMMAND(				ID_FILE_SAVE,					OnFileSave)
	ON_UPDATE_COMMAND_UI(	ID_FILE_SAVE,					OnUpdateFileSave)
	ON_UPDATE_COMMAND_UI(	ID_FILE_SAVE_AS,				OnUpdateFileSaveAs)
	ON_COMMAND(				ID_FILE_CHANGED,				OnCmdFileChanged)
	ON_COMMAND(				ID_FILE_PROPERTIES,				OnCmdFileProperties)
	ON_COMMAND(				ID_TOOLS_RENUMBER,				OnCmdRenumberSymbols)
	ON_UPDATE_COMMAND_UI(	ID_TOOLS_RENUMBER,				OnUpdateRenumberSymbols)

END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile construction/destruction

CResOrgSymbolsDocMultiFile::CResOrgSymbolsDocMultiFile(void)
{
}


CResOrgSymbolsDocMultiFile::~CResOrgSymbolsDocMultiFile(void)
{
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile overrides

BOOL CResOrgSymbolsDocMultiFile::OnNewDocument(void)
{
	BOOL bResult = CResOrgSymbolsDocMultiFile_BASE::OnNewDocument();

	return bResult;
}


BOOL CResOrgSymbolsDocMultiFile::OnOpenDocument(LPCTSTR lpszPathName)
{
	BOOL bResult = CResOrgSymbolsDocMultiFile_BASE::OnOpenDocument(lpszPathName);
//	if (bResult)
//	{
//		StartFileChangeMonitor(lpszPathName);
//	}
	return bResult;
}


BOOL CResOrgSymbolsDocMultiFile::OnSaveDocument(LPCTSTR lpszPathName)
{
	BOOL bResult = CResOrgSymbolsDocMultiFile_BASE::OnSaveDocument(lpszPathName);

//	if (bResult)
//	{
//		m_pSymbolManager->SetModifiedFlag(FALSE);
//
//		StartFileChangeMonitor(lpszPathName);
//
//		UpdateAllViews(NULL, SYM_REFRESH);
//	}
	return bResult;
}


void CResOrgSymbolsDocMultiFile::OnCloseDocument(void)
{
//	StopFileChangeMonitor();

	CResOrgSymbolsDocMultiFile_BASE::OnCloseDocument();
}


void CResOrgSymbolsDocMultiFile::DeleteContents(void) 
{
//	if (NULL != m_pSymbolManager)
//	{
//		m_pSymbolManager->RemoveAll();
//	}
//	else
//	{
//		VERIFY( CreateSymbolManager() );
//	}
//
//	UpdateAllViews(NULL, SYM_REFRESH);

	CResOrgSymbolsDocMultiFile_BASE::DeleteContents();
}


bool CResOrgSymbolsDocMultiFile::Set(	CResourceSymbol* pSymbol,
										const CString& sName,
										UINT uValue,
										bool bReadOnly /*= false*/)
{
	CResourceSymbolList listSymbols;

	m_pSymbolManager->GetSymbols(	pSymbol->GetValue(),
									listSymbols);

	// Work out which symbols are affected so we can issue the right view hints
	CResourceSymbolList listSymbolsWithNewValue;

	m_pSymbolManager->GetSymbols(	uValue,
									listSymbolsWithNewValue);

	listSymbols.AddTail(&listSymbolsWithNewValue);

	bool bResult = m_pSymbolManager->Set(	pSymbol,
											sName,
											uValue,
											bReadOnly);
	if (bResult)
	{
		CResourceSymbolManager* pMngr = reinterpret_cast<CResourceSymbolManager*>
														( pSymbol->GetUserData() );
		ASSERT(NULL != pMngr);

		if (Options.AutoFixNextSymbolValues() && (NULL != pMngr) )
		{
			pMngr->FixNextSymbolValues();
		}

		if (m_pSymbolManager->IsModified())
		{
			if (NULL != pMngr)
			{
				pMngr->SetModifiedFlag(true);
			}
			SetModifiedFlag(TRUE);
		}

		POSITION pos = listSymbols.GetHeadPosition();
		while (NULL != pos)
		{
			CResourceSymbol* pSymbol = listSymbols.GetNext(pos);
			if (NULL != pSymbol)
			{
				UpdateAllViews(NULL, SYM_CHANGED, (CObject*)pSymbol);
			}
		}
	}
	return bResult;
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile serialization

void CResOrgSymbolsDocMultiFile::Serialize(CArchive& ar)
{
	CResOrgSymbolsDocMultiFile_BASE::Serialize(ar);

//	if (NULL != m_pSymbolManager)
//	{
//		m_pSymbolManager->Serialize(ar);
//	}
}


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile diagnostics

#ifdef _DEBUG
void CResOrgSymbolsDocMultiFile::AssertValid(void) const
{
	CResOrgSymbolsDocMultiFile_BASE::AssertValid();
}


void CResOrgSymbolsDocMultiFile::Dump(CDumpContext& dc) const
{
	CResOrgSymbolsDocMultiFile_BASE::Dump(dc);
}
#endif //_DEBUG


/////////////////////////////////////////////////////////////////////////////
// CResOrgSymbolsDocMultiFile operations

CResourceSymbolManagerMultiFile* CResOrgSymbolsDocMultiFile::GetMultiFileSymbolManager(void) const
{
	return static_cast<CResourceSymbolManagerMultiFile*>(m_pSymbolManager);
}


CString CResOrgSymbolsDocMultiFile::GetDisplayTitle(const CStringArray& arraySymbolFilePathNames, int nMaxFiles /*= 2*/)
{
	CString sTitle;

	for (int n = 0; n <  arraySymbolFilePathNames.GetSize(); n++)
	{
		 CNGSplitPath split(arraySymbolFilePathNames[n]);
		 
		 sTitle += split.GetFileName() + split.GetExtension() + _T(", ");

		 if (n + 1 >= nMaxFiles)
		 {
			 if (nMaxFiles < arraySymbolFilePathNames.GetSize() )
			 {
				 sTitle += _T("...");			// Indicate there's more...
			 }
			 break;
		 }
	}
	sTitle.TrimRight( _T(", ") );

	return sTitle;
}

⌨️ 快捷键说明

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