/************************************************************************
*
* Resource ID Organiser Core Library
*
* (c) Copyright 2000-2003 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
* All rights reserved.
*
************************************************************************
*
* Filename : ResourceSymbolFileStatisticsPage.cpp
*
* Description : CResourceSymbolFileStatisticsPage - "Statistics" page for
* resource symbol file properties
*
* 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/ResourceSymbolFileStatisticsPage.cpp $
* $Revision: 8 $
* $Date: 1/07/03 21:02 $
* $Author: Anna $
*
* $History: ResourceSymbolFileStatisticsPage.cpp $
*
* ***************** Version 8 *****************
* User: Anna Date: 1/07/03 Time: 21:02
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Fixed selection bugs with multi-file symbols displays
*
* ***************** Version 7 *****************
* User: Anna Date: 26/06/03 Time: 20:18
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Added resizing support
*
* ***************** Version 6 *****************
* User: Anna Date: 19/01/03 Time: 17:22
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Modifications for compatibility with multi-file symbol editing
*
* ***************** Version 5 *****************
* User: Anna Date: 25/11/02 Time: 15:19
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed website address in banner
*
* ***************** Version 4 *****************
* User: Anna Date: 22/10/02 Time: 13:24
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed name/mail address (at last!)
*
* ***************** Version 3 *****************
* 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 2 *****************
* User: Andy Date: 27/05/02 Time: 13:43
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Knock on changes from CResourceSymbolBuffer (now
* CResourceSymbolManager)
*
* ***************** Version 1 *****************
* User: Andy Date: 10/03/01 Time: 12:50p
* Created in $/Projects/AddIns/ResOrg/ResOrgUtils
*
* $Nokeywords: $
*
************************************************************************/
#include "StdAfx.h"
#include "ResOrgCore_Priv.h"
#include "ResourceSymbolManager.h"
#include "ResourceSymbolFileStatisticsPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResourceSymbolFileStatisticsPage property page
IMPLEMENT_DYNAMIC(CResourceSymbolFileStatisticsPage, CResourceSymbolFileStatisticsPage_BASE)
CResourceSymbolFileStatisticsPage::CResourceSymbolFileStatisticsPage(void)
: CResourceSymbolFileStatisticsPage_BASE(CResourceSymbolFileStatisticsPage::IDD)
{
//{{AFX_DATA_INIT(CResourceSymbolFileStatisticsPage)
m_sResourceRange = _T("");
m_sCommandRange = _T("");
m_nBitmaps = 0;
m_nCommands = 0;
m_nControls = 0;
m_nIcons = 0;
m_nMenus = 0;
m_nPrompts = 0;
m_nStrings = 0;
m_nDialogs = 0;
m_nResources = 0;
//}}AFX_DATA_INIT
}
CResourceSymbolFileStatisticsPage::~CResourceSymbolFileStatisticsPage(void)
{
}
void CResourceSymbolFileStatisticsPage::DoDataExchange(CDataExchange* pDX)
{
CResourceSymbolFileStatisticsPage_BASE::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CResourceSymbolFileStatisticsPage)
DDX_Control(pDX, IDC_SYM_LOW_RANGE, m_ctrlResourceRange);
DDX_Control(pDX, IDC_SYM_HIGH_RANGE, m_ctrlCommandRange);
DDX_Text(pDX, IDC_SYM_LOW_RANGE, m_sResourceRange);
DDX_Text(pDX, IDC_SYM_HIGH_RANGE, m_sCommandRange);
DDX_Text(pDX, IDC_SYM_BITMAPS, m_nBitmaps);
DDX_Text(pDX, IDC_SYM_COMMANDS, m_nCommands);
DDX_Text(pDX, IDC_SYM_CONTROLS, m_nControls);
DDX_Text(pDX, IDC_SYM_ICONS, m_nIcons);
DDX_Text(pDX, IDC_SYM_MENUS, m_nMenus);
DDX_Text(pDX, IDC_SYM_PROMPTS, m_nPrompts);
DDX_Text(pDX, IDC_SYM_STRINGS, m_nStrings);
DDX_Text(pDX, IDC_SYM_DIALOGS, m_nDialogs);
DDX_Text(pDX, IDC_SYM_RESOURCES, m_nResources);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResourceSymbolFileStatisticsPage, CResourceSymbolFileStatisticsPage_BASE)
//{{AFX_MSG_MAP(CResourceSymbolFileStatisticsPage)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResourceSymbolFileNextValuesPage virtual overrides
BOOL CResourceSymbolFileStatisticsPage::OnInitDialog(void)
{
ASSERT(NULL != m_pSymbols); // Must be set first
BOOL bResult = CResourceSymbolFileStatisticsPage_BASE::OnInitDialog();
m_Resizer.Add(IDC_SYM_RANGE_GROUP, 0, 0, 100, 30);
m_Resizer.Add(IDC_SYM_LOW_RANGE_CAPTION, 0, 10, 0, 0);
m_Resizer.Add(IDC_SYM_LOW_RANGE, 0, 10, 0, 0);
m_Resizer.Add(IDC_SYM_HIGH_RANGE_CAPTION, 0, 20, 0, 0);
m_Resizer.Add(IDC_SYM_HIGH_RANGE, 0, 20, 0, 0);
m_Resizer.Add(IDC_SYM_TYPES_GROUP, 0, 30, 100, 70);
m_Resizer.Add(IDC_SYM_DIALOGS_CAPTION, 0, 50, 0, 0);
m_Resizer.Add(IDC_SYM_DIALOGS, 0, 50, 0, 0);
m_Resizer.Add(IDC_SYM_PROMPTS_CAPTION, 0, 50, 0, 0);
m_Resizer.Add(IDC_SYM_PROMPTS, 0, 50, 0, 0);
m_Resizer.Add(IDC_SYM_BITMAPS_CAPTION, 0, 60, 0, 0);
m_Resizer.Add(IDC_SYM_BITMAPS, 0, 60, 0, 0);
m_Resizer.Add(IDC_SYM_RESOURCES_CAPTION, 0, 60, 0, 0);
m_Resizer.Add(IDC_SYM_RESOURCES, 0, 60, 0, 0);
m_Resizer.Add(IDC_SYM_MENUS_CAPTION, 0, 70, 0, 0);
m_Resizer.Add(IDC_SYM_MENUS, 0, 70, 0, 0);
m_Resizer.Add(IDC_SYM_CONTROLS_CAPTION, 0, 70, 0, 0);
m_Resizer.Add(IDC_SYM_CONTROLS, 0, 70, 0, 0);
m_Resizer.Add(IDC_SYM_STRINGS_CAPTION, 0, 80, 0, 0);
m_Resizer.Add(IDC_SYM_STRINGS, 0, 80, 0, 0);
m_Resizer.Add(IDC_SYM_COMMANDS_CAPTION, 0, 80, 0, 0);
m_Resizer.Add(IDC_SYM_COMMANDS, 0, 80, 0, 0);
m_Resizer.Add(IDC_SYM_ICONS_CAPTION, 0, 90, 0, 0);
m_Resizer.Add(IDC_SYM_ICONS, 0, 90, 0, 0);
return bResult;
}
/////////////////////////////////////////////////////////////////////////////
// CResourceSymbolFileStatisticsPage operations
bool CResourceSymbolFileStatisticsPage::SetSymbolManager(CResourceSymbolManager* pSymbols)
{
if (CResourceSymbolFileStatisticsPage_BASE::SetSymbolManager(pSymbols) )
{
m_pSymbols = pSymbols;
ASSERT(NULL != m_pSymbols);
if (NULL != m_pSymbols)
{
CResourceSymbolCounts Info;
m_pSymbols->GetSymbolCount(Info);
// Update Statistics text
m_nResources = Info.m_nOtherResources;
m_nControls = Info.m_nControls;
m_nBitmaps = Info.m_nBitmaps;
m_nIcons = Info.m_nIcons;
m_nMenus = Info.m_nMenus;
m_nPrompts = Info.m_nPrompts;
m_nStrings = Info.m_nStrings;
m_nDialogs = Info.m_nDialogs;
m_nCommands = Info.m_nCommands;
m_sResourceRange.LoadString(IDP_SYM_RANGE_NONE);
m_sCommandRange.LoadString(IDP_SYM_RANGE_NONE);
if (Info.m_uMaxResource > 0)
{
m_sResourceRange.Format( _T("%d - %d"), Info.m_uMinResource, Info.m_uMaxResource);
}
if (Info.m_uMaxCommand > 0)
{
m_sCommandRange.Format( _T("%d - %d"), Info.m_uMinCommand, Info.m_uMaxCommand);
}
// Display these in bold text
m_sResourceRange = _T("<b>") + m_sResourceRange + _T("</b>");
m_sCommandRange = _T("<b>") + m_sCommandRange + _T("</b>");
if (::IsWindow(GetSafeHwnd() ) )
{
UpdateData(FALSE);
Invalidate();
}
}
return true;
}
return false;
}
/////////////////////////////////////////////////////////////////////////////
// CResourceSymbolFileStatisticsPage implementation
void CResourceSymbolFileStatisticsPage::SetAvailableControls(void)
{
BOOL bAvail = (NULL != m_pSymbols);
ShowDlgControl(IDC_SYM_LOW_RANGE, bAvail);
ShowDlgControl(IDC_SYM_HIGH_RANGE, bAvail);
ShowDlgControl(IDC_SYM_BITMAPS, bAvail);
ShowDlgControl(IDC_SYM_COMMANDS, bAvail);
ShowDlgControl(IDC_SYM_CONTROLS, bAvail);
ShowDlgControl(IDC_SYM_ICONS, bAvail);
ShowDlgControl(IDC_SYM_MENUS, bAvail);
ShowDlgControl(IDC_SYM_PROMPTS, bAvail);
ShowDlgControl(IDC_SYM_STRINGS, bAvail);
ShowDlgControl(IDC_SYM_DIALOGS, bAvail);
ShowDlgControl(IDC_SYM_RESOURCES, bAvail);
}
/////////////////////////////////////////////////////////////////////////////
// CResourceSymbolFileStatisticsPage message handlers
BOOL CResourceSymbolFileStatisticsPage::OnSetActive(void)
{
SetAvailableControls();
return CResourceSymbolFileStatisticsPage_BASE::OnSetActive();
}