remove metrics dialogs
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="smpackage\ZipArchive\Release\ZipArchive.lib"
|
||||||
OutputFile="../../Program/tools-debug.exe"
|
OutputFile="../../Program/tools-debug.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
@@ -107,7 +108,7 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="ZipArchive\Release\ZipArchive.lib"
|
AdditionalDependencies="smpackage\ZipArchive\Release\ZipArchive.lib"
|
||||||
OutputFile=".\../../Program/tools.exe"
|
OutputFile=".\../../Program/tools.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
@@ -162,12 +163,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\smpackage\EditInsallations.h">
|
RelativePath=".\smpackage\EditInsallations.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\smpackage\EditMetricsDlg.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\smpackage\EditMetricsDlg.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\smpackage\EnterComment.cpp">
|
RelativePath=".\smpackage\EnterComment.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -186,12 +181,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\smpackage\MainMenuDlg.h">
|
RelativePath=".\smpackage\MainMenuDlg.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\smpackage\onvertThemeDlg.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\smpackage\onvertThemeDlg.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\smpackage\resource.h">
|
RelativePath=".\smpackage\resource.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -262,17 +251,14 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="menu.bmp">
|
RelativePath="menu.bmp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="res\smpackage.ico">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="smpackage.ICO">
|
RelativePath="smpackage.ICO">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="smpackage.rc">
|
RelativePath="res\smpackage.ico">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="res\smpackage.rc2">
|
RelativePath=".\smpackage\smpackage.rc">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="res\StepMania.ICO">
|
RelativePath="res\StepMania.ICO">
|
||||||
@@ -290,6 +276,15 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\ProductInfo.h">
|
RelativePath=".\ProductInfo.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SpecialFiles.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SpecialFiles.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\StdString.h">
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="system">
|
Name="system">
|
||||||
<File
|
<File
|
||||||
@@ -309,16 +304,53 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Rage"
|
Name="Rage"
|
||||||
Filter="">
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileDriverMemory.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileDriverMemory.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileDriverZip.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileDriverZip.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileManager.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageFileManager.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\RageLog.cpp">
|
RelativePath=".\RageLog.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\RageLog.h">
|
RelativePath=".\RageLog.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageUtil.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RageUtil.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="File Types"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\IniFile.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IniFile.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\XmlFile.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\XmlFile.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\zdll.lib">
|
|
||||||
</File>
|
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
<Global
|
<Global
|
||||||
|
|||||||
@@ -1,286 +0,0 @@
|
|||||||
// EditMetricsDlg.cpp : implementation file
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "smpackage.h"
|
|
||||||
#include "EditMetricsDlg.h"
|
|
||||||
#include "IniFile.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define new DEBUG_NEW
|
|
||||||
#undef THIS_FILE
|
|
||||||
static char THIS_FILE[] = __FILE__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define BLACK RGB(0,0,0)
|
|
||||||
#define RED RGB(255,0,0)
|
|
||||||
#define SET_ITEM_STYLE(item,bInBase,bInTheme) {m_tree.SetItemColor(item,bInBase?BLACK:RED);m_tree.SetItemBold(item,bInTheme);}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// EditMetricsDlg dialog
|
|
||||||
|
|
||||||
|
|
||||||
EditMetricsDlg::EditMetricsDlg(CWnd* pParent /*=NULL*/)
|
|
||||||
: CDialog(EditMetricsDlg::IDD, pParent)
|
|
||||||
{
|
|
||||||
//{{AFX_DATA_INIT(EditMetricsDlg)
|
|
||||||
//}}AFX_DATA_INIT
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EditMetricsDlg::DoDataExchange(CDataExchange* pDX)
|
|
||||||
{
|
|
||||||
CDialog::DoDataExchange(pDX);
|
|
||||||
//{{AFX_DATA_MAP(EditMetricsDlg)
|
|
||||||
DDX_Control(pDX, IDC_EDIT_VALUE, m_editValue);
|
|
||||||
DDX_Control(pDX, IDC_EDIT_DEFAULT, m_editDefault);
|
|
||||||
DDX_Control(pDX, IDC_BUTTON_REMOVE, m_buttonRemove);
|
|
||||||
DDX_Control(pDX, IDC_BUTTON_OVERRIDE, m_buttonOverride);
|
|
||||||
DDX_Control(pDX, IDC_TREE, m_tree);
|
|
||||||
//}}AFX_DATA_MAP
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(EditMetricsDlg, CDialog)
|
|
||||||
//{{AFX_MSG_MAP(EditMetricsDlg)
|
|
||||||
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE, OnSelchangedTree)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_OVERRIDE, OnButtonOverride)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_REMOVE, OnButtonRemove)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave)
|
|
||||||
ON_EN_CHANGE(IDC_EDIT_VALUE, OnChangeEditValue)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp)
|
|
||||||
ON_NOTIFY(NM_DBLCLK, IDC_TREE, OnDblclkTree)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_CLOSE, OnButtonClose)
|
|
||||||
//}}AFX_MSG_MAP
|
|
||||||
END_MESSAGE_MAP()
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// EditMetricsDlg message handlers
|
|
||||||
|
|
||||||
BOOL EditMetricsDlg::OnInitDialog()
|
|
||||||
{
|
|
||||||
CDialog::OnInitDialog();
|
|
||||||
|
|
||||||
// TODO: Add extra initialization here
|
|
||||||
|
|
||||||
RefreshTree();
|
|
||||||
|
|
||||||
return TRUE; // return TRUE unless you set the focus to a control
|
|
||||||
// EXCEPTION: OCX Property Pages should return FALSE
|
|
||||||
}
|
|
||||||
|
|
||||||
IniFile iniBase;
|
|
||||||
IniFile iniTheme;
|
|
||||||
|
|
||||||
void EditMetricsDlg::RefreshTree()
|
|
||||||
{
|
|
||||||
m_tree.DeleteAllItems();
|
|
||||||
|
|
||||||
iniBase.Reset();
|
|
||||||
iniBase.SetPath( "Themes\\default\\metrics.ini" );
|
|
||||||
iniBase.ReadFile();
|
|
||||||
|
|
||||||
iniTheme.Reset();
|
|
||||||
iniTheme.SetPath( "Themes\\"+m_sTheme+"\\metrics.ini" );
|
|
||||||
iniTheme.ReadFile();
|
|
||||||
|
|
||||||
IniFile iniCombined;
|
|
||||||
iniCombined.SetPath( "Themes\\default\\metrics.ini" );
|
|
||||||
iniCombined.ReadFile();
|
|
||||||
iniCombined.SetPath( "Themes\\"+m_sTheme+"\\metrics.ini" );
|
|
||||||
iniCombined.ReadFile();
|
|
||||||
|
|
||||||
CStringArray asKeys;
|
|
||||||
IniFile::const_iterator it;
|
|
||||||
for( it = iniCombined.begin(); it != iniCombined.end(); ++it )
|
|
||||||
asKeys.push_back( it->first );
|
|
||||||
SortCStringArray( asKeys );
|
|
||||||
|
|
||||||
for( unsigned i=0; i<asKeys.size(); i++ )
|
|
||||||
{
|
|
||||||
CString sKey = asKeys[i];
|
|
||||||
bool bInBase = iniBase.GetKey(sKey) != NULL;
|
|
||||||
bool bInTheme = iniTheme.GetKey(sKey) != NULL;
|
|
||||||
|
|
||||||
HTREEITEM item1 = m_tree.InsertItem( sKey );
|
|
||||||
SET_ITEM_STYLE( item1, bInBase, bInTheme );
|
|
||||||
|
|
||||||
const IniFile::key* pKey = iniCombined.GetKey( sKey );
|
|
||||||
CStringArray asNames;
|
|
||||||
for( IniFile::key::const_iterator val = pKey->begin(); val != pKey->end(); ++val )
|
|
||||||
{
|
|
||||||
CString sName = val->first, sValue = val->second;
|
|
||||||
asNames.push_back( sName );
|
|
||||||
}
|
|
||||||
|
|
||||||
SortCStringArray( asNames );
|
|
||||||
|
|
||||||
for( unsigned j=0; j<asNames.size(); j++ )
|
|
||||||
{
|
|
||||||
CString sName = asNames[j];
|
|
||||||
CString sValue;
|
|
||||||
iniCombined.GetValue( sKey, sName, sValue );
|
|
||||||
|
|
||||||
CString sThrowAway;
|
|
||||||
bool bInBase = !!iniBase.GetValue( sKey, sName, sThrowAway );
|
|
||||||
bool bInTheme = !!iniTheme.GetValue( sKey, sName, sThrowAway );
|
|
||||||
|
|
||||||
HTREEITEM item2 = m_tree.InsertItem( sName, item1 );
|
|
||||||
SET_ITEM_STYLE( item2, bInBase, bInTheme );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::GetSelectedKeyAndName( CString& sKeyOut, CString& sNameOut )
|
|
||||||
{
|
|
||||||
sKeyOut = "";
|
|
||||||
sNameOut = "";
|
|
||||||
|
|
||||||
HTREEITEM itemSel = m_tree.GetSelectedItem();
|
|
||||||
if( itemSel == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
HTREEITEM itemParent = m_tree.GetParentItem( itemSel );
|
|
||||||
if( itemParent == NULL )
|
|
||||||
{
|
|
||||||
sKeyOut = m_tree.GetItemText( itemSel );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sKeyOut = m_tree.GetItemText( itemParent );
|
|
||||||
sNameOut = m_tree.GetItemText( itemSel );
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult)
|
|
||||||
{
|
|
||||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
|
|
||||||
CString sKey, sName;
|
|
||||||
GetSelectedKeyAndName( sKey, sName );
|
|
||||||
|
|
||||||
if( sName == "" )
|
|
||||||
{
|
|
||||||
m_buttonOverride.EnableWindow( false );
|
|
||||||
m_buttonRemove.EnableWindow( false );
|
|
||||||
m_editValue.EnableWindow( false );
|
|
||||||
m_editValue.SetWindowText( "" );
|
|
||||||
m_editDefault.SetWindowText( "" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CString sThrowAway;
|
|
||||||
bool bInBase = !!iniBase.GetValue( sKey, sName, sThrowAway );
|
|
||||||
bool bInTheme = !!iniTheme.GetValue( sKey, sName, sThrowAway );
|
|
||||||
|
|
||||||
m_buttonOverride.EnableWindow( bInBase && !bInTheme );
|
|
||||||
m_buttonRemove.EnableWindow( bInTheme );
|
|
||||||
m_editValue.EnableWindow( bInTheme );
|
|
||||||
if( bInTheme )
|
|
||||||
{
|
|
||||||
CString n;
|
|
||||||
iniTheme.GetValue(sKey,sName, n);
|
|
||||||
m_editValue.SetWindowText( n );
|
|
||||||
m_editDefault.SetWindowText( n );
|
|
||||||
} else {
|
|
||||||
m_editValue.SetWindowText( "" );
|
|
||||||
m_editDefault.SetWindowText( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
*pResult = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnButtonOverride()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
CString sKey, sName;
|
|
||||||
GetSelectedKeyAndName( sKey, sName );
|
|
||||||
|
|
||||||
HTREEITEM itemSel = m_tree.GetSelectedItem();
|
|
||||||
HTREEITEM itemParent = m_tree.GetParentItem( itemSel );
|
|
||||||
|
|
||||||
SET_ITEM_STYLE( itemSel, true, true );
|
|
||||||
m_tree.RedrawWindow();
|
|
||||||
|
|
||||||
m_editValue.EnableWindow( true );
|
|
||||||
m_editValue.SetFocus();
|
|
||||||
m_buttonOverride.EnableWindow( false );
|
|
||||||
m_buttonRemove.EnableWindow( true );
|
|
||||||
|
|
||||||
iniTheme.SetValue( sKey, sName, "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnButtonRemove()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
CString sKey, sName;
|
|
||||||
GetSelectedKeyAndName( sKey, sName );
|
|
||||||
|
|
||||||
HTREEITEM itemSel = m_tree.GetSelectedItem();
|
|
||||||
|
|
||||||
CString sThrowAway;
|
|
||||||
bool bInBase = !!iniBase.GetValue( sKey, sName, sThrowAway );
|
|
||||||
|
|
||||||
if( bInBase )
|
|
||||||
{
|
|
||||||
m_tree.SetItemColor( itemSel, BLACK );
|
|
||||||
m_tree.SetItemBold( itemSel, false );
|
|
||||||
m_tree.RedrawWindow();
|
|
||||||
m_buttonOverride.EnableWindow( true );
|
|
||||||
m_buttonRemove.EnableWindow( false );
|
|
||||||
m_editValue.EnableWindow( false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_tree.DeleteItem( itemSel );
|
|
||||||
|
|
||||||
iniTheme.DeleteValue( sKey, sName );
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnButtonSave()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
iniTheme.WriteFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnChangeEditValue()
|
|
||||||
{
|
|
||||||
// TODO: If this is a RICHEDIT control, the control will not
|
|
||||||
// send this notification unless you override the CDialog::OnInitDialog()
|
|
||||||
// function and call CRichEditCtrl().SetEventMask()
|
|
||||||
// with the ENM_CHANGE flag ORed into the mask.
|
|
||||||
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
CString sKey, sName;
|
|
||||||
GetSelectedKeyAndName( sKey, sName );
|
|
||||||
|
|
||||||
CString sText;
|
|
||||||
m_editValue.GetWindowText( sText );
|
|
||||||
iniTheme.SetValue( sKey, sName, sText );
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnButtonHelp()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
AfxMessageBox(
|
|
||||||
"Bold = A metric that is overridden by the current theme (exists in both the base theme, and the current theme)\n\n"
|
|
||||||
"Not Bold = A metric that is not overridden by the current theme (exists in the base theme but not in the current theme)\n\n"
|
|
||||||
"Red = A metric that exists in the current theme but not in the base theme (check to see if the metric name is misspelled)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnDblclkTree(NMHDR* pNMHDR, LRESULT* pResult)
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
|
|
||||||
OnButtonOverride();
|
|
||||||
|
|
||||||
*pResult = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditMetricsDlg::OnButtonClose()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
EndDialog( IDOK );
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#if !defined(AFX_EDITMETRICSDLG_H__39D944CD_BCE4_4C30_876E_0B5A0CE42931__INCLUDED_)
|
|
||||||
#define AFX_EDITMETRICSDLG_H__39D944CD_BCE4_4C30_876E_0B5A0CE42931__INCLUDED_
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif // _MSC_VER > 1000
|
|
||||||
// EditMetricsDlg.h : header file
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "TreeCtrlEx.h"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// EditMetricsDlg dialog
|
|
||||||
|
|
||||||
class EditMetricsDlg : public CDialog
|
|
||||||
{
|
|
||||||
// Construction
|
|
||||||
public:
|
|
||||||
EditMetricsDlg(CWnd* pParent = NULL); // standard constructor
|
|
||||||
|
|
||||||
// Dialog Data
|
|
||||||
//{{AFX_DATA(EditMetricsDlg)
|
|
||||||
enum { IDD = IDD_EDIT_METRICS };
|
|
||||||
CEdit m_editValue;
|
|
||||||
CEdit m_editDefault;
|
|
||||||
CButton m_buttonRemove;
|
|
||||||
CButton m_buttonOverride;
|
|
||||||
CTreeCtrlEx m_tree;
|
|
||||||
//}}AFX_DATA
|
|
||||||
|
|
||||||
CString m_sTheme;
|
|
||||||
|
|
||||||
// Overrides
|
|
||||||
// ClassWizard generated virtual function overrides
|
|
||||||
//{{AFX_VIRTUAL(EditMetricsDlg)
|
|
||||||
protected:
|
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
||||||
//}}AFX_VIRTUAL
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Generated message map functions
|
|
||||||
//{{AFX_MSG(EditMetricsDlg)
|
|
||||||
virtual BOOL OnInitDialog();
|
|
||||||
afx_msg void OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult);
|
|
||||||
afx_msg void OnButtonOverride();
|
|
||||||
afx_msg void OnButtonRemove();
|
|
||||||
afx_msg void OnButtonNew();
|
|
||||||
afx_msg void OnButtonSave();
|
|
||||||
afx_msg void OnChangeEditValue();
|
|
||||||
afx_msg void OnButtonHelp();
|
|
||||||
afx_msg void OnDblclkTree(NMHDR* pNMHDR, LRESULT* pResult);
|
|
||||||
afx_msg void OnButtonClose();
|
|
||||||
//}}AFX_MSG
|
|
||||||
DECLARE_MESSAGE_MAP()
|
|
||||||
|
|
||||||
void RefreshTree();
|
|
||||||
void GetSelectedKeyAndName( CString& sKeyOut, CString& sNameOut );
|
|
||||||
};
|
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
||||||
|
|
||||||
#endif // !defined(AFX_EDITMETRICSDLG_H__39D944CD_BCE4_4C30_876E_0B5A0CE42931__INCLUDED_)
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
@@ -1,348 +0,0 @@
|
|||||||
// onvertThemeDlg.cpp : implementation file
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "smpackage.h"
|
|
||||||
#include "onvertThemeDlg.h"
|
|
||||||
#include "smpackageUtil.h"
|
|
||||||
#include "EditMetricsDlg.h"
|
|
||||||
#include "EditMetricsDlg.h"
|
|
||||||
#include "IniFile.h"
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define new DEBUG_NEW
|
|
||||||
#undef THIS_FILE
|
|
||||||
static char THIS_FILE[] = __FILE__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ConvertThemeDlg dialog
|
|
||||||
|
|
||||||
|
|
||||||
ConvertThemeDlg::ConvertThemeDlg(CWnd* pParent /*=NULL*/)
|
|
||||||
: CDialog(ConvertThemeDlg::IDD, pParent)
|
|
||||||
{
|
|
||||||
//{{AFX_DATA_INIT(ConvertThemeDlg)
|
|
||||||
// NOTE: the ClassWizard will add member initialization here
|
|
||||||
//}}AFX_DATA_INIT
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConvertThemeDlg::DoDataExchange(CDataExchange* pDX)
|
|
||||||
{
|
|
||||||
CDialog::DoDataExchange(pDX);
|
|
||||||
//{{AFX_DATA_MAP(ConvertThemeDlg)
|
|
||||||
DDX_Control(pDX, IDC_BUTTON_ANALYZE_METRICS, m_buttonAnalyzeMetrics);
|
|
||||||
DDX_Control(pDX, IDC_BUTTON_EDIT_METRICS, m_buttonEditMetrics);
|
|
||||||
DDX_Control(pDX, IDC_BUTTON_ANALYZE, m_buttonAnalyze);
|
|
||||||
DDX_Control(pDX, IDC_LIST_THEMES, m_listThemes);
|
|
||||||
//}}AFX_DATA_MAP
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(ConvertThemeDlg, CDialog)
|
|
||||||
//{{AFX_MSG_MAP(ConvertThemeDlg)
|
|
||||||
ON_LBN_SELCHANGE(IDC_LIST_THEMES, OnSelchangeListThemes)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_ANALYZE, OnButtonAnalyze)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_EDIT_METRICS, OnButtonEditMetrics)
|
|
||||||
ON_BN_CLICKED(IDC_BUTTON_ANALYZE_METRICS, OnButtonAnalyzeMetrics)
|
|
||||||
//}}AFX_MSG_MAP
|
|
||||||
END_MESSAGE_MAP()
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ConvertThemeDlg message handlers
|
|
||||||
|
|
||||||
BOOL ConvertThemeDlg::OnInitDialog()
|
|
||||||
{
|
|
||||||
CDialog::OnInitDialog();
|
|
||||||
|
|
||||||
// TODO: Add extra initialization here
|
|
||||||
|
|
||||||
CStringArray asThemes;
|
|
||||||
GetDirListing( "Themes\\*.*", asThemes, true, false );
|
|
||||||
for( unsigned i=0; i<asThemes.size(); i++ )
|
|
||||||
// if( asThemes[i] != "default" ) // allow editing of default
|
|
||||||
m_listThemes.AddString( asThemes[i] );
|
|
||||||
|
|
||||||
return TRUE; // return TRUE unless you set the focus to a control
|
|
||||||
// EXCEPTION: OCX Property Pages should return FALSE
|
|
||||||
}
|
|
||||||
|
|
||||||
// renames files and directories recursively
|
|
||||||
void RecursiveRename( CString sDirStart, CString sOld, CString sNew )
|
|
||||||
{
|
|
||||||
if( sDirStart.Right(1) != "\\" )
|
|
||||||
sDirStart += "\\";
|
|
||||||
|
|
||||||
CStringArray asFilesAndDirs;
|
|
||||||
GetDirListing( sDirStart+"*.*", asFilesAndDirs, false, false );
|
|
||||||
for( unsigned i=0; i<asFilesAndDirs.size(); i++ )
|
|
||||||
{
|
|
||||||
CString sOldFilePath = sDirStart+asFilesAndDirs[i];
|
|
||||||
CString sNewFilePath = sOldFilePath;
|
|
||||||
sNewFilePath.MakeLower();
|
|
||||||
sOld.MakeLower();
|
|
||||||
sNewFilePath.Replace( sOld, sNew );
|
|
||||||
if( sOldFilePath.CompareNoCase(sNewFilePath) != 0 )
|
|
||||||
MoveFile( sOldFilePath, sNewFilePath );
|
|
||||||
}
|
|
||||||
|
|
||||||
CStringArray asDirs;
|
|
||||||
GetDirListing( sDirStart+"*.*", asDirs, true, false );
|
|
||||||
for( i=0; i<asDirs.size(); i++ )
|
|
||||||
RecursiveRename( sDirStart+asDirs[i], sOld, sNew );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertThemeDlg::OnSelchangeListThemes()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
BOOL bSomethingSelected = m_listThemes.GetCurSel() != LB_ERR;
|
|
||||||
m_buttonAnalyze.EnableWindow( bSomethingSelected );
|
|
||||||
m_buttonEditMetrics.EnableWindow( bSomethingSelected );
|
|
||||||
m_buttonAnalyzeMetrics.EnableWindow( bSomethingSelected );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilesAreIdentical( CString sPath1, CString sPath2 )
|
|
||||||
{
|
|
||||||
if( IsADirectory(sPath1) || IsADirectory(sPath2) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
FILE* fp1 = fopen( sPath1, "r" );
|
|
||||||
FILE* fp2 = fopen( sPath2, "r" );
|
|
||||||
|
|
||||||
bool bReturn;
|
|
||||||
|
|
||||||
if( GetFileSizeInBytes(sPath1) != GetFileSizeInBytes(sPath2) )
|
|
||||||
{
|
|
||||||
bReturn = false;
|
|
||||||
goto clean_up;
|
|
||||||
}
|
|
||||||
|
|
||||||
char buffer1[1024], buffer2[1024];
|
|
||||||
ZERO( buffer1 );
|
|
||||||
ZERO( buffer2 );
|
|
||||||
while( !feof(fp1) )
|
|
||||||
{
|
|
||||||
int size1 = fread( buffer1, 1, sizeof(buffer1), fp1 );
|
|
||||||
int size2 = fread( buffer2, 1, sizeof(buffer2), fp2 );
|
|
||||||
if( size1 != size2 )
|
|
||||||
{
|
|
||||||
bReturn = false;
|
|
||||||
goto clean_up;
|
|
||||||
}
|
|
||||||
if( memcmp( buffer1, buffer2, sizeof(size1) ) != 0 )
|
|
||||||
{
|
|
||||||
bReturn = false;
|
|
||||||
goto clean_up;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bReturn = true;
|
|
||||||
goto clean_up;
|
|
||||||
|
|
||||||
clean_up:
|
|
||||||
fclose( fp1 );
|
|
||||||
fclose( fp2 );
|
|
||||||
return bReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
CString StripExtension( CString sPath )
|
|
||||||
{
|
|
||||||
CString sDir, sFName, sExt;
|
|
||||||
splitrelpath( sPath, sDir, sFName, sExt );
|
|
||||||
return sDir + sFName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaunchNotepad( CString sPathToOpen )
|
|
||||||
{
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
STARTUPINFO si;
|
|
||||||
ZeroMemory( &si, sizeof(si) );
|
|
||||||
|
|
||||||
char szCommand[MAX_PATH] = "notepad.exe ";
|
|
||||||
strcat( szCommand, sPathToOpen );
|
|
||||||
CreateProcess(
|
|
||||||
NULL, // pointer to name of executable module
|
|
||||||
szCommand, // pointer to command line string
|
|
||||||
NULL, // process security attributes
|
|
||||||
NULL, // thread security attributes
|
|
||||||
false, // handle inheritance flag
|
|
||||||
0, // creation flags
|
|
||||||
NULL, // pointer to new environment block
|
|
||||||
NULL, // pointer to current directory name
|
|
||||||
&si, // pointer to STARTUPINFO
|
|
||||||
&pi // pointer to PROCESS_INFORMATION
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertThemeDlg::OnButtonAnalyze()
|
|
||||||
{
|
|
||||||
CString sBaseDir = "Themes\\default\\";
|
|
||||||
int iSel = m_listThemes.GetCurSel();
|
|
||||||
CString sThemeName;
|
|
||||||
m_listThemes.GetText( iSel, sThemeName );
|
|
||||||
CString sThemeDir = "Themes\\"+sThemeName+"\\";
|
|
||||||
|
|
||||||
CStringArray asBaseFilePaths;
|
|
||||||
GetDirListing( sBaseDir+"BGAnimations\\*.*", asBaseFilePaths, false, true );
|
|
||||||
GetDirListing( sBaseDir+"Fonts\\*.*", asBaseFilePaths, false, true );
|
|
||||||
GetDirListing( sBaseDir+"Graphics\\*.*", asBaseFilePaths, false, true );
|
|
||||||
GetDirListing( sBaseDir+"Numbers\\*.*", asBaseFilePaths, false, true );
|
|
||||||
GetDirListing( sBaseDir+"Sounds\\*.*", asBaseFilePaths, false, true );
|
|
||||||
|
|
||||||
CStringArray asThemeFilePaths;
|
|
||||||
GetDirListing( sThemeDir+"BGAnimations\\*.*", asThemeFilePaths, false, true );
|
|
||||||
GetDirListing( sThemeDir+"Fonts\\*.*", asThemeFilePaths, false, true );
|
|
||||||
GetDirListing( sThemeDir+"Graphics\\*.*", asThemeFilePaths, false, true );
|
|
||||||
GetDirListing( sThemeDir+"Numbers\\*.*", asThemeFilePaths, false, true );
|
|
||||||
GetDirListing( sThemeDir+"Sounds\\*.*", asThemeFilePaths, false, true );
|
|
||||||
|
|
||||||
CStringArray asRedundant;
|
|
||||||
CStringArray asWarning;
|
|
||||||
unsigned i;
|
|
||||||
for( i=0; i<asThemeFilePaths.size(); i++ )
|
|
||||||
{
|
|
||||||
CString sThemeElement = asThemeFilePaths[i];
|
|
||||||
sThemeElement.Replace( sThemeDir, "" );
|
|
||||||
sThemeElement = StripExtension( sThemeElement );
|
|
||||||
bool bFoundMatch = false;
|
|
||||||
|
|
||||||
for( unsigned j=0; j<asBaseFilePaths.size(); j++ )
|
|
||||||
{
|
|
||||||
CString sBaseElement = asBaseFilePaths[j];
|
|
||||||
sBaseElement.Replace( sBaseDir, "" );
|
|
||||||
sBaseElement = StripExtension( sBaseElement );
|
|
||||||
|
|
||||||
if( sThemeElement.CompareNoCase(sBaseElement)==0 ) // file names match
|
|
||||||
{
|
|
||||||
bFoundMatch = true;
|
|
||||||
if( FilesAreIdentical( asThemeFilePaths[i], asBaseFilePaths[j] ) )
|
|
||||||
asRedundant.push_back( asThemeFilePaths[i] );
|
|
||||||
break; // skip to next file in asThemeFilePaths
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( !bFoundMatch )
|
|
||||||
asWarning.push_back( asThemeFilePaths[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
SortCStringArray( asRedundant );
|
|
||||||
SortCStringArray( asWarning );
|
|
||||||
|
|
||||||
FILE* fp = fopen( "elements_report.txt", "w" );
|
|
||||||
ASSERT( fp );
|
|
||||||
fprintf( fp, "Theme elements report for '"+sThemeName+"'.\n\n" );
|
|
||||||
fprintf( fp, "The following elements are REDUNDANT.\n"
|
|
||||||
" (These elements are identical to the elements in the base theme.\n"
|
|
||||||
" They are unnecessary and should be deleted.)\n" );
|
|
||||||
for( i=0; i<asRedundant.size(); i++ )
|
|
||||||
fprintf( fp, asRedundant[i] + "\n" );
|
|
||||||
fprintf( fp, "\n" );
|
|
||||||
fprintf( fp, "The following elements are possibly MISNAMED.\n"
|
|
||||||
" (These files do not have a corresponding element in the base theme.\n"
|
|
||||||
" This likely means that there is an error in the file name.)\n" );
|
|
||||||
for( i=0; i<asWarning.size(); i++ )
|
|
||||||
fprintf( fp, asWarning[i] + "\n" );
|
|
||||||
fclose( fp );
|
|
||||||
|
|
||||||
LaunchNotepad( "elements_report.txt" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertThemeDlg::OnButtonEditMetrics()
|
|
||||||
{
|
|
||||||
// TODO: Add your control notification handler code here
|
|
||||||
EditMetricsDlg dlg;
|
|
||||||
int iSel = m_listThemes.GetCurSel();
|
|
||||||
CString sThemeName;
|
|
||||||
m_listThemes.GetText( iSel, sThemeName );
|
|
||||||
dlg.m_sTheme = sThemeName;
|
|
||||||
int nResponse = dlg.DoModal();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertThemeDlg::OnButtonAnalyzeMetrics()
|
|
||||||
{
|
|
||||||
int iSel = m_listThemes.GetCurSel();
|
|
||||||
CString sThemeName;
|
|
||||||
m_listThemes.GetText( iSel, sThemeName );
|
|
||||||
|
|
||||||
IniFile iniBase;
|
|
||||||
iniBase.SetPath( "Themes\\default\\metrics.ini" );
|
|
||||||
iniBase.ReadFile();
|
|
||||||
|
|
||||||
IniFile iniTheme;
|
|
||||||
iniTheme.SetPath( "Themes\\"+sThemeName+"\\metrics.ini" );
|
|
||||||
iniTheme.ReadFile();
|
|
||||||
|
|
||||||
CMapStringToString mapBaseClassPlusNameToValue;
|
|
||||||
unsigned i;
|
|
||||||
IniFile::const_iterator it;
|
|
||||||
for( it = iniBase.begin(); it != iniBase.end(); ++it )
|
|
||||||
{
|
|
||||||
CString sKey = it->first;
|
|
||||||
const IniFile::key &Key = it->second;
|
|
||||||
for( IniFile::key::const_iterator val = Key.begin(); val != Key.end(); ++val )
|
|
||||||
{
|
|
||||||
CString sName = val->first, sValue = val->second;
|
|
||||||
mapBaseClassPlusNameToValue[sKey+"-"+sName] = sValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CMapStringToString mapThemeClassPlusNameToValue;
|
|
||||||
for( it = iniTheme.begin(); it != iniTheme.end(); ++it )
|
|
||||||
{
|
|
||||||
CString sKey = it->first;
|
|
||||||
const IniFile::key &Key = it->second;
|
|
||||||
for( IniFile::key::const_iterator val = Key.begin(); val != Key.end(); ++val )
|
|
||||||
{
|
|
||||||
CString sName = val->first, sValue = val->second;
|
|
||||||
mapThemeClassPlusNameToValue[sKey+"-"+sName] = sValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CStringArray asRedundant;
|
|
||||||
CStringArray asWarning;
|
|
||||||
for( POSITION pos1=mapThemeClassPlusNameToValue.GetStartPosition(); pos1!=NULL; )
|
|
||||||
{
|
|
||||||
CString sThemeKey, sThemeValue;
|
|
||||||
mapThemeClassPlusNameToValue.GetNextAssoc( pos1, sThemeKey, sThemeValue );
|
|
||||||
bool bFoundMatch = false;
|
|
||||||
|
|
||||||
for( POSITION pos2=mapBaseClassPlusNameToValue.GetStartPosition(); pos2!=NULL; )
|
|
||||||
{
|
|
||||||
CString sBaseKey, sBaseValue;
|
|
||||||
mapBaseClassPlusNameToValue.GetNextAssoc( pos2, sBaseKey, sBaseValue );
|
|
||||||
|
|
||||||
if( sThemeKey == sBaseKey ) // match
|
|
||||||
{
|
|
||||||
bFoundMatch = true;
|
|
||||||
if( sThemeValue == sBaseValue )
|
|
||||||
asRedundant.push_back( sThemeKey );
|
|
||||||
break; // skip to next file in asThemeFilePaths
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( !bFoundMatch )
|
|
||||||
asWarning.push_back( sThemeKey );
|
|
||||||
}
|
|
||||||
|
|
||||||
SortCStringArray( asRedundant );
|
|
||||||
SortCStringArray( asWarning );
|
|
||||||
|
|
||||||
FILE* fp = fopen( "metrics_report.txt", "w" );
|
|
||||||
ASSERT( fp );
|
|
||||||
fprintf( fp, "Theme metrics report for '"+sThemeName+"'.\n\n" );
|
|
||||||
fprintf( fp, "The following metrics are REDUNDANT.\n"
|
|
||||||
" (These metrics are identical to the metrics in the base theme.\n"
|
|
||||||
" They are unnecessary and should be deleted.)\n" );
|
|
||||||
for( i=0; i<asRedundant.size(); i++ )
|
|
||||||
fprintf( fp, asRedundant[i] + "\n" );
|
|
||||||
fprintf( fp, "\n" );
|
|
||||||
fprintf( fp, "The following elements are possibly MISNAMED.\n"
|
|
||||||
" (These metrics do not have a corresponding metric in\n"
|
|
||||||
" the base theme. This likely means that there is an error in the metric name.)\n" );
|
|
||||||
for( i=0; i<asWarning.size(); i++ )
|
|
||||||
fprintf( fp, asWarning[i] + "\n" );
|
|
||||||
fclose( fp );
|
|
||||||
|
|
||||||
LaunchNotepad( "metrics_report.txt" );
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#if !defined(AFX_ONVERTTHEMEDLG_H__4A6650E2_F5C6_4914_8610_2118AB81455F__INCLUDED_)
|
|
||||||
#define AFX_ONVERTTHEMEDLG_H__4A6650E2_F5C6_4914_8610_2118AB81455F__INCLUDED_
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif // _MSC_VER > 1000
|
|
||||||
// onvertThemeDlg.h : header file
|
|
||||||
//
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ConvertThemeDlg dialog
|
|
||||||
|
|
||||||
class ConvertThemeDlg : public CDialog
|
|
||||||
{
|
|
||||||
// Construction
|
|
||||||
public:
|
|
||||||
ConvertThemeDlg(CWnd* pParent = NULL); // standard constructor
|
|
||||||
|
|
||||||
// Dialog Data
|
|
||||||
//{{AFX_DATA(ConvertThemeDlg)
|
|
||||||
enum { IDD = IDD_CONVERT_THEME };
|
|
||||||
CButton m_buttonAnalyzeMetrics;
|
|
||||||
CButton m_buttonEditMetrics;
|
|
||||||
CButton m_buttonAnalyze;
|
|
||||||
CListBox m_listThemes;
|
|
||||||
//}}AFX_DATA
|
|
||||||
|
|
||||||
|
|
||||||
// Overrides
|
|
||||||
// ClassWizard generated virtual function overrides
|
|
||||||
//{{AFX_VIRTUAL(ConvertThemeDlg)
|
|
||||||
protected:
|
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
||||||
//}}AFX_VIRTUAL
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Generated message map functions
|
|
||||||
//{{AFX_MSG(ConvertThemeDlg)
|
|
||||||
virtual BOOL OnInitDialog();
|
|
||||||
afx_msg void OnSelchangeListThemes();
|
|
||||||
afx_msg void OnButtonAnalyze();
|
|
||||||
afx_msg void OnButtonEditMetrics();
|
|
||||||
afx_msg void OnButtonAnalyzeMetrics();
|
|
||||||
//}}AFX_MSG
|
|
||||||
DECLARE_MESSAGE_MAP()
|
|
||||||
};
|
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
||||||
|
|
||||||
#endif // !defined(AFX_ONVERTTHEMEDLG_H__4A6650E2_F5C6_4914_8610_2118AB81455F__INCLUDED_)
|
|
||||||
Reference in New Issue
Block a user