wxgui: Added more functionality to configuration dialogs and more options are saved to ini.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1544 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-20 00:39:38 +00:00
parent 6e894deb67
commit aaf1acf58d
18 changed files with 528 additions and 161 deletions

View File

@ -40,14 +40,14 @@ namespace Exception
m_message( msg_xlt ), m_message( msg_xlt ),
m_stacktrace( wxEmptyString ) // unsupported yet m_stacktrace( wxEmptyString ) // unsupported yet
{ {
// Major hack. After a couple of tries, I'm still not managing to get Linux to catch these exceptions, so that the user actually // Linux/GCC exception handling is still suspect (this is likely to do with GCC more
// gets the messages. Since Console is unavailable at this level, I'm using a simple printf, which of course, means it doesn't get // than linux), and fails to propagate exceptions up the stack from EErec code. This
// logged. But at least the user sees it. // could likely be because of the EErec using EBP. So to ensure the user at least
// // gets a log of the error, we output to console here in the constructor.
// I'll rip this out once I get Linux to actually catch these exceptions. Say, in BeginExecution or StartGui, like I would expect.
// -- arcum42
#ifdef __LINUX__ #ifdef __LINUX__
wxLogError( msg_eng.c_str() ); //wxLogError( msg_eng.c_str() );
Console::Error( msg_eng );
#endif #endif
} }
@ -58,7 +58,10 @@ namespace Exception
m_message( GetTranslation( msg_eng ) ), m_message( GetTranslation( msg_eng ) ),
m_stacktrace( wxEmptyString ) // unsupported yet m_stacktrace( wxEmptyString ) // unsupported yet
{ {
wxLogError( m_message_eng.c_str() ); #ifdef __LINUX__
//wxLogError( m_message_eng.c_str() );
Console::Error( msg_eng );
#endif
} }
wxString BaseException::LogMessage() const wxString BaseException::LogMessage() const

View File

@ -58,17 +58,33 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
struct FolderOptions struct FolderOptions
{ {
wxDirName Plugins; wxDirName
wxDirName Settings; Plugins,
wxDirName Bios; Settings,
wxDirName Snapshots; Bios,
wxDirName Savestates; Snapshots,
wxDirName MemoryCards; Savestates,
wxDirName Logs; MemoryCards,
Logs;
wxDirName RunIso; // last used location for Iso loading. wxDirName RunIso; // last used location for Iso loading.
bool
UseDefaultPlugins:1,
UseDefaultSettings:1,
UseDefaultBios:1,
UseDefaultSnapshots:1,
UseDefaultSavestates:1,
UseDefaultMemoryCards:1,
UseDefaultLogs:1;
void LoadSave( IniInterface& conf ); void LoadSave( IniInterface& conf );
void ApplyDefaults();
void Set( FoldersEnum_t folderidx, const wxString& src, bool useDefault );
const wxDirName& operator[]( FoldersEnum_t folderidx ) const;
const bool IsDefault( FoldersEnum_t folderidx ) const;
}; };
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -167,19 +183,7 @@ public:
void LoadSave( IniInterface& conf ); void LoadSave( IniInterface& conf );
}; };
public: public:
AppConfig() :
Listbook_ImageSize( 32 )
, Toolbar_ImageSize( 24 )
{
}
wxString FullpathToBios() const;
wxString FullpathToMcd( uint mcdidx ) const;
wxString FullpathTo( PluginsEnum_t pluginId ) const;
bool UseAdminMode; // dictates if the program uses /home/user or /cwd for the program data bool UseAdminMode; // dictates if the program uses /home/user or /cwd for the program data
wxPoint MainGuiPosition; wxPoint MainGuiPosition;
bool CdvdVerboseReads; // enables cdvd read activity verbosely dumped to the console bool CdvdVerboseReads; // enables cdvd read activity verbosely dumped to the console
@ -213,7 +217,23 @@ public:
FilenameOptions BaseFilenames; FilenameOptions BaseFilenames;
McdSysOptions MemoryCards; McdSysOptions MemoryCards;
protected:
// indicates if the main AppConfig settings are valid (excludes the status of UseAdminMode,
// which is a special value that's initialized independently of the rest of the config)
bool m_IsLoaded;
public: public:
AppConfig() :
Listbook_ImageSize( 32 )
, Toolbar_ImageSize( 24 )
, m_IsLoaded( false )
{
}
wxString FullpathToBios() const;
wxString FullpathToMcd( uint mcdidx ) const;
wxString FullpathTo( PluginsEnum_t pluginId ) const;
void Load(); void Load();
void Save(); void Save();
void Apply(); void Apply();

View File

@ -134,6 +134,18 @@ namespace Path
extern void RemoveDirectory( const wxString& src ); extern void RemoveDirectory( const wxString& src );
} }
enum FoldersEnum_t
{
FolderId_Plugins = 0,
FolderId_Settings,
FolderId_Bios,
FolderId_Snapshots,
FolderId_Savestates,
FolderId_MemoryCards,
FolderId_Logs,
FolderId_COUNT
};
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// PathDefs Namespace -- contains default values for various pcsx2 path names and locations. // PathDefs Namespace -- contains default values for various pcsx2 path names and locations.
// //
@ -157,6 +169,8 @@ namespace PathDefs
extern wxDirName GetLogs(); extern wxDirName GetLogs();
extern wxDirName GetThemes(); extern wxDirName GetThemes();
extern wxDirName Get( FoldersEnum_t folderidx );
// Base folder names used to extend out the documents/approot folder base into a complete // Base folder names used to extend out the documents/approot folder base into a complete
// path. These are typically for internal AppConfig use only, barring a few special cases. // path. These are typically for internal AppConfig use only, barring a few special cases.
namespace Base namespace Base

View File

@ -66,7 +66,7 @@ protected:
public: public:
// ctor & dtor // ctor & dtor
ConsoleLogFrame(MainEmuFrame *pParent, const wxString& szTitle); ConsoleLogFrame( MainEmuFrame *pParent, const wxString& szTitle, const AppConfig::ConsoleLogOptions& options );
virtual ~ConsoleLogFrame(); virtual ~ConsoleLogFrame();
virtual void Write( const wxString& text ); virtual void Write( const wxString& text );

View File

@ -80,7 +80,6 @@ namespace PathDefs
static const wxDirName retval( L"themes" ); static const wxDirName retval( L"themes" );
return retval; return retval;
} }
}; };
// Specifies the root folder for the application install. // Specifies the root folder for the application install.
@ -141,8 +140,103 @@ namespace PathDefs
{ {
return GetDocuments() + Base::Logs(); return GetDocuments() + Base::Logs();
} }
wxDirName Get( FoldersEnum_t folderidx )
{
switch( folderidx )
{
case FolderId_Plugins: return GetPlugins();
case FolderId_Settings: return GetSettings();
case FolderId_Bios: return GetBios();
case FolderId_Snapshots: return GetSnapshots();
case FolderId_Savestates: return GetSavestates();
case FolderId_MemoryCards: return GetMemoryCards();
case FolderId_Logs: return GetLogs();
jNO_DEFAULT
}
return wxDirName();
}
}; };
const wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx ) const
{
switch( folderidx )
{
case FolderId_Plugins: return Plugins;
case FolderId_Settings: return Settings;
case FolderId_Bios: return Bios;
case FolderId_Snapshots: return Snapshots;
case FolderId_Savestates: return Savestates;
case FolderId_MemoryCards: return MemoryCards;
case FolderId_Logs: return Logs;
jNO_DEFAULT
}
return Plugins; // unreachable, but supresses warnings.
}
const bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const
{
switch( folderidx )
{
case FolderId_Plugins: return UseDefaultPlugins;
case FolderId_Settings: return UseDefaultSettings;
case FolderId_Bios: return UseDefaultBios;
case FolderId_Snapshots: return UseDefaultSnapshots;
case FolderId_Savestates: return UseDefaultSavestates;
case FolderId_MemoryCards: return UseDefaultMemoryCards;
case FolderId_Logs: return UseDefaultLogs;
jNO_DEFAULT
}
return false;
}
void AppConfig::FolderOptions::Set( FoldersEnum_t folderidx, const wxString& src, bool useDefault )
{
switch( folderidx )
{
case FolderId_Plugins:
Plugins = src;
UseDefaultPlugins = useDefault;
break;
case FolderId_Settings:
Settings = src;
UseDefaultSettings = useDefault;
break;
case FolderId_Bios:
Bios = src;
UseDefaultBios = useDefault;
break;
case FolderId_Snapshots:
Snapshots = src;
UseDefaultSnapshots = useDefault;
break;
case FolderId_Savestates:
Savestates = src;
UseDefaultSavestates = useDefault;
break;
case FolderId_MemoryCards:
MemoryCards = src;
UseDefaultMemoryCards = useDefault;
break;
case FolderId_Logs:
Logs = src;
UseDefaultLogs = useDefault;
break;
jNO_DEFAULT
}
}
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// //
namespace FilenameDefs namespace FilenameDefs
@ -256,6 +350,7 @@ wxString AppConfig::FullpathToMcd( uint mcdidx ) const { return Path::Combine( F
// syntax errors. >_< // syntax errors. >_<
// //
#define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval ) #define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval )
#define IniEntryBitfield( varname, defval ) varname = ini.EntryBitfield( wxT(#varname), defval )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void AppConfig::LoadSaveUserMode( IniInterface& ini ) void AppConfig::LoadSaveUserMode( IniInterface& ini )
@ -297,6 +392,8 @@ void AppConfig::LoadSave( IniInterface& ini )
// //
void AppConfig::Apply() void AppConfig::Apply()
{ {
if( !m_IsLoaded ) return;
// Ensure existence of necessary documents folders. Plugins and other parts // Ensure existence of necessary documents folders. Plugins and other parts
// of PCSX2 rely on them. // of PCSX2 rely on them.
@ -336,6 +433,8 @@ void AppConfig::Apply()
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void AppConfig::Load() void AppConfig::Load()
{ {
m_IsLoaded = true;
// Note: Extra parenthesis resolves "I think this is a function" issues with C++. // Note: Extra parenthesis resolves "I think this is a function" issues with C++.
IniLoader loader( (IniLoader()) ); IniLoader loader( (IniLoader()) );
LoadSave( loader ); LoadSave( loader );
@ -343,6 +442,8 @@ void AppConfig::Load()
void AppConfig::Save() void AppConfig::Save()
{ {
if( !m_IsLoaded ) return;
IniSaver saver( (IniSaver()) ); IniSaver saver( (IniSaver()) );
LoadSave( saver ); LoadSave( saver );
} }
@ -368,11 +469,25 @@ void AppConfig::SpeedhackOptions::LoadSave( IniInterface& ini )
ini.SetPath( L".." ); ini.SetPath( L".." );
} }
void AppConfig::FolderOptions::ApplyDefaults()
{
if( UseDefaultPlugins ) Plugins = PathDefs::GetPlugins();
if( UseDefaultSettings ) Settings = PathDefs::GetSettings();
if( UseDefaultBios ) Bios = PathDefs::GetBios();
if( UseDefaultSnapshots ) Snapshots = PathDefs::GetSnapshots();
if( UseDefaultSavestates ) Savestates = PathDefs::GetSavestates();
if( UseDefaultMemoryCards ) MemoryCards = PathDefs::GetMemoryCards();
if( UseDefaultLogs ) Logs = PathDefs::GetLogs();
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void AppConfig::FolderOptions::LoadSave( IniInterface& ini ) void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
{ {
ini.SetPath( L"Folders" ); ini.SetPath( L"Folders" );
if( ini.IsSaving() )
ApplyDefaults();
IniEntry( Plugins, PathDefs::GetPlugins() ); IniEntry( Plugins, PathDefs::GetPlugins() );
IniEntry( Settings, PathDefs::GetSettings() ); IniEntry( Settings, PathDefs::GetSettings() );
IniEntry( Bios, PathDefs::GetBios() ); IniEntry( Bios, PathDefs::GetBios() );
@ -380,9 +495,20 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
IniEntry( Savestates, PathDefs::GetSavestates() ); IniEntry( Savestates, PathDefs::GetSavestates() );
IniEntry( MemoryCards, PathDefs::GetMemoryCards() ); IniEntry( MemoryCards, PathDefs::GetMemoryCards() );
IniEntry( Logs, PathDefs::GetLogs() ); IniEntry( Logs, PathDefs::GetLogs() );
IniEntry( RunIso, PathDefs::GetDocuments() ); // raw default is always the Documents folder. IniEntry( RunIso, PathDefs::GetDocuments() ); // raw default is always the Documents folder.
IniEntryBitfield( UseDefaultPlugins, true );
IniEntryBitfield( UseDefaultSettings, true );
IniEntryBitfield( UseDefaultBios, true );
IniEntryBitfield( UseDefaultSnapshots, true );
IniEntryBitfield( UseDefaultSavestates, true );
IniEntryBitfield( UseDefaultMemoryCards, true );
IniEntryBitfield( UseDefaultLogs, true );
if( ini.IsLoading() )
ApplyDefaults();
ini.SetPath( L".." ); ini.SetPath( L".." );
} }

View File

@ -116,7 +116,7 @@ void ConsoleLogFrame::ColorArray::SetFont( const wxFont& font )
static const Console::Colors DefaultConsoleColor = Color_White; static const Console::Colors DefaultConsoleColor = Color_White;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
ConsoleLogFrame::ConsoleLogFrame(MainEmuFrame *parent, const wxString& title) : ConsoleLogFrame::ConsoleLogFrame( MainEmuFrame *parent, const wxString& title, const AppConfig::ConsoleLogOptions& options ) :
wxFrame(parent, wxID_ANY, title) wxFrame(parent, wxID_ANY, title)
, m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, , m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxHSCROLL | wxTE_READONLY | wxTE_RICH2 ) ) wxTE_MULTILINE | wxHSCROLL | wxTE_READONLY | wxTE_RICH2 ) )
@ -141,14 +141,8 @@ ConsoleLogFrame::ConsoleLogFrame(MainEmuFrame *parent, const wxString& title) :
CreateStatusBar(); CreateStatusBar();
ClearColor(); ClearColor();
// Sync with configuration settings: SetSize( wxRect( options.DisplayPosition, options.DisplaySize ) );
Show( options.Visible );
wxASSERT_MSG( g_Conf != NULL, L"Console Log Frames must be created AFTER the configuration has been loaded" );
if( g_Conf != NULL )
{
SetSize( wxRect( g_Conf->ConLogBox.DisplayPosition, g_Conf->ConLogBox.DisplaySize ) );
Show( g_Conf->ConLogBox.Visible );
}
// Bind Events: // Bind Events:

View File

@ -24,7 +24,6 @@
#include "ConfigurationDialog.h" #include "ConfigurationDialog.h"
#include "Panels/ConfigurationPanels.h" #include "Panels/ConfigurationPanels.h"
#include <wx/bookctrl.h>
#include <wx/artprov.h> #include <wx/artprov.h>
using namespace wxHelpers; using namespace wxHelpers;
@ -48,9 +47,18 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
m_listbook.SetImageList( &wxGetApp().GetImgList_Config() ); m_listbook.SetImageList( &wxGetApp().GetImgList_Config() );
const AppImageIds::ConfigIds& cfgid( wxGetApp().GetImgId().Config ); const AppImageIds::ConfigIds& cfgid( wxGetApp().GetImgId().Config );
g_ApplyState.StartBook( &m_listbook );
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
m_listbook.AddPage( new PathsPanel( m_listbook ), _("Folders"), false, cfgid.Paths ); m_listbook.AddPage( new PathsPanel( m_listbook ), _("Folders"), false, cfgid.Paths );
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
m_listbook.AddPage( new PluginSelectorPanel( m_listbook ), _("Plugins"), false, cfgid.Plugins ); m_listbook.AddPage( new PluginSelectorPanel( m_listbook ), _("Plugins"), false, cfgid.Plugins );
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
m_listbook.AddPage( new SpeedHacksPanel( m_listbook ), _("Speedhacks"), false, cfgid.Speedhacks ); m_listbook.AddPage( new SpeedHacksPanel( m_listbook ), _("Speedhacks"), false, cfgid.Speedhacks );
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
m_listbook.AddPage( new GameFixesPanel( m_listbook ), _("Game Fixes"), false, cfgid.Gamefixes ); m_listbook.AddPage( new GameFixesPanel( m_listbook ), _("Game Fixes"), false, cfgid.Gamefixes );
mainSizer.Add( &m_listbook ); mainSizer.Add( &m_listbook );
@ -66,43 +74,20 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
Dialogs::ConfigurationDialog::~ConfigurationDialog() Dialogs::ConfigurationDialog::~ConfigurationDialog()
{ {
} g_ApplyState.DoCleanup();
bool Dialogs::ConfigurationDialog::ApplySettings()
{
AppConfig confcopy( *g_Conf );
try
{
int pagecount = m_listbook.GetPageCount();
for( int i=0; i<pagecount; ++i )
{
BaseApplicableConfigPanel* panel = (BaseApplicableConfigPanel*)m_listbook.GetPage(i);
panel->Apply( confcopy );
}
*g_Conf = confcopy;
g_Conf->Apply();
g_Conf->Save();
}
catch( Exception::CannotApplySettings& ex )
{
wxMessageBox( ex.DisplayMessage(), _("Cannot apply settings...") );
// TODO : Automatically switch focus to the panel that failed.
return false;
}
return true;
} }
void Dialogs::ConfigurationDialog::OnOk_Click( wxCommandEvent& evt ) void Dialogs::ConfigurationDialog::OnOk_Click( wxCommandEvent& evt )
{ {
evt.Skip(); if( g_ApplyState.ApplyAll() )
if( ApplySettings() ) Close(); {
Close();
evt.Skip();
}
} }
void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt ) void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
{ {
evt.Skip(); evt.Skip();
ApplySettings(); g_ApplyState.ApplyAll();
} }

View File

@ -37,7 +37,6 @@ namespace Dialogs
ConfigurationDialog(wxWindow* parent, int id=wxID_ANY); ConfigurationDialog(wxWindow* parent, int id=wxID_ANY);
protected: protected:
bool ApplySettings();
void OnOk_Click( wxCommandEvent& evt ); void OnOk_Click( wxCommandEvent& evt );
void OnApply_Click( wxCommandEvent& evt ); void OnApply_Click( wxCommandEvent& evt );
}; };

View File

@ -23,33 +23,6 @@
using namespace wxHelpers; using namespace wxHelpers;
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent ) :
BaseApplicableConfigPanel( parent )
, m_radio_user( NULL )
, m_radio_cwd( NULL )
{
wxStaticBoxSizer& s_boxer = *new wxStaticBoxSizer( wxVERTICAL, this, _( "Usermode Selection" ) );
AddStaticText( s_boxer,
L"Please select your preferred default location for PCSX2 user-level documents below "
L"(includes memory cards, screenshots, settings, and savestates). "
L"These folder locations can be overridden at any time using the Core Settings panel.",
480, wxALIGN_CENTRE );
m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() );
m_radio_cwd = &AddRadioButton( s_boxer, _("Current working folder (intended for developer use only)"), _("Location: ") + wxGetCwd() );
s_boxer.AddSpacer( 4 );
SetSizerAndFit( &s_boxer );
}
void Panels::UsermodeSelectionPanel::Apply( AppConfig& conf )
{
if( !m_radio_cwd->GetValue() && !m_radio_user->GetValue() )
throw Exception::CannotApplySettings( wxLt( "You must select one of the available user modes before proceeding." ) );
conf.UseAdminMode = m_radio_cwd->GetValue();
}
Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) : Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false ) wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
, m_panel_usersel( new Panels::UsermodeSelectionPanel( this ) ) , m_panel_usersel( new Panels::UsermodeSelectionPanel( this ) )
@ -58,10 +31,7 @@ Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) :
AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured."), AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured."),
0, wxALIGN_CENTRE ); 0, wxALIGN_CENTRE );
s_main.AddSpacer( 8 ); s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) );
s_main.Add( m_panel_usersel, SizerFlags::StdGroupie() );
//new wxListCt
AddOkCancel( s_main ); AddOkCancel( s_main );
SetSizerAndFit( &s_main ); SetSizerAndFit( &s_main );
@ -76,10 +46,8 @@ void Dialogs::PickUserModeDialog::OnOk_Click( wxCommandEvent& evt )
try try
{ {
m_panel_usersel->Apply( confcopy ); m_panel_usersel->Apply( confcopy );
*g_Conf = confcopy; *g_Conf = confcopy;
g_Conf->Apply(); g_Conf->Apply();
g_Conf->Save();
Close(); Close();
evt.Skip(); evt.Skip();

View File

@ -66,7 +66,7 @@ void IniLoader::Entry( const wxString& var, wxString& value, const wxString& def
void IniLoader::Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue ) void IniLoader::Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue )
{ {
wxString dest; wxString dest;
m_Config.Read( var, &dest, wxString() ); m_Config.Read( var, &dest, wxEmptyString );
if( dest.IsEmpty() ) if( dest.IsEmpty() )
value = defvalue; value = defvalue;
@ -93,9 +93,18 @@ void IniLoader::Entry( const wxString& var, uint& value, const uint defvalue )
void IniLoader::Entry( const wxString& var, bool& value, const bool defvalue ) void IniLoader::Entry( const wxString& var, bool& value, const bool defvalue )
{ {
// TODO : Stricter value checking on enabled/disabled?
wxString dest; wxString dest;
m_Config.Read( var, &dest, defvalue ? L"enabled" : L"disabled" ); m_Config.Read( var, &dest, defvalue ? L"enabled" : L"disabled" );
value = (dest == L"enabled") || (dest == L"1"); value = (dest == L"enabled") || (dest != L"0");
}
bool IniLoader::EntryBitfield( const wxString& var, bool value, const bool defvalue )
{
// Note: 'value' param is used by inisaver only.
bool result;
Entry( var, result, defvalue );
return result;
} }
void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue ) void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue )
@ -175,6 +184,12 @@ void IniSaver::Entry( const wxString& var, bool& value, const bool defvalue )
m_Config.Write( var, value ? L"enabled" : L"disabled" ); m_Config.Write( var, value ? L"enabled" : L"disabled" );
} }
bool IniSaver::EntryBitfield( const wxString& var, bool value, const bool defvalue )
{
m_Config.Write( var, value ? L"enabled" : L"disabled" );
return value;
}
void IniSaver::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue ) void IniSaver::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue )
{ {
m_Config.Write( var, ToString( value ) ); m_Config.Write( var, ToString( value ) );

View File

@ -52,7 +52,10 @@ public:
virtual void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() )=0; virtual void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() )=0;
virtual void Entry( const wxString& var, int& value, const int defvalue=0 )=0; virtual void Entry( const wxString& var, int& value, const int defvalue=0 )=0;
virtual void Entry( const wxString& var, uint& value, const uint defvalue=0 )=0; virtual void Entry( const wxString& var, uint& value, const uint defvalue=0 )=0;
virtual void Entry( const wxString& var, bool& value, const bool defvalue=0 )=0; virtual void Entry( const wxString& var, bool& value, const bool defvalue=false )=0;
// This special form of Entry is provided for bitfields, which cannot be passed by reference.
virtual bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false )=0;
virtual void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition )=0; virtual void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition )=0;
virtual void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize )=0; virtual void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize )=0;
@ -78,13 +81,15 @@ public:
bool IsLoading() const { return true; } bool IsLoading() const { return true; }
void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() ); void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxEmptyString );
void Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue=wxDirName() ); void Entry( const wxString& var, wxDirName& value, const wxDirName& defvalue=wxDirName() );
void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() ); void Entry( const wxString& var, wxFileName& value, const wxFileName& defvalue=wxFileName() );
void Entry( const wxString& var, int& value, const int defvalue=0 ); void Entry( const wxString& var, int& value, const int defvalue=0 );
void Entry( const wxString& var, uint& value, const uint defvalue=0 ); void Entry( const wxString& var, uint& value, const uint defvalue=0 );
void Entry( const wxString& var, bool& value, const bool defvalue=false ); void Entry( const wxString& var, bool& value, const bool defvalue=false );
bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false );
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition ); void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition );
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize ); void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize );
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect ); void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect );
@ -116,6 +121,8 @@ public:
void Entry( const wxString& var, uint& value, const uint defvalue=0 ); void Entry( const wxString& var, uint& value, const uint defvalue=0 );
void Entry( const wxString& var, bool& value, const bool defvalue=false ); void Entry( const wxString& var, bool& value, const bool defvalue=false );
bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false );
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition ); void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition );
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize ); void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize );
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect ); void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect );

View File

@ -269,14 +269,15 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
m_menuRun.Append(Menu_BootIso, _("Run ISO"), MakeIsoMenu(), _("Performs a complete bootup sequence (recommended for best compat)")); m_menuRun.Append(Menu_RunIso, _("Run ISO"), MakeIsoMenu() );
m_menuRun.Append(Menu_BootIsoFast, _("Run ISO (skip Bios)"), MakeIsoMenu(), _("Skips PS2 startup screens when booting; may cause compat issues")); m_menuRun.Append(Menu_BootCDVD, _("Run CDVD"), MakeCdvdMenu() );
m_menuRun.Append(Menu_BootQuickCDVD,_("Run CDVD"), MakeCdvdMenu(), _("Skips PS2 init screens when running cdvd images")); m_menuRun.Append(Menu_RunWithoutDisc,_("Run without Disc"), _("Use this to access the PS2 system configuration menu"));
m_menuRun.Append(Menu_BootFullCDVD, _("Run CDVD (skip Bios)"), MakeCdvdMenu(), _("Skips PS2 startup screens when booting; may cause compat issues")); m_menuRun.Append(Menu_RunELF, _("Run ELF File..."), _("For running raw PS2 binaries."));
m_menuRun.Append(Menu_RunWithoutDisc,_("Run without Disc"), _("Use this to access the PS2 system configuration menu"));
m_menuRun.Append(Menu_RunELF, _("Run ELF File..."), wxEmptyString);
m_menuRun.AppendSeparator();
m_menuRun.AppendSeparator();
m_menuRun.Append(Menu_SkipBiosToggle,_("Skip Bios on Boot"), _("Enable this to skip PS2 bootup screens (may hurt compat)"));
m_menuRun.AppendSeparator();
m_menuRun.Append(Menu_SuspendExec, _("Suspend"), _T("Stops emulation dead in its tracks")); m_menuRun.Append(Menu_SuspendExec, _("Suspend"), _T("Stops emulation dead in its tracks"));
m_menuRun.Append(Menu_ResumeExec, _("Resume"), _T("Resumes suspended emulation")); m_menuRun.Append(Menu_ResumeExec, _("Resume"), _T("Resumes suspended emulation"));
m_menuRun.Append(Menu_States, _("States"), MakeStatesMenu(), wxEmptyString); m_menuRun.Append(Menu_States, _("States"), MakeStatesMenu(), wxEmptyString);

View File

@ -45,13 +45,13 @@ protected:
Menu_Misc, // Misc options and help! Menu_Misc, // Misc options and help!
// Run SubSection // Run SubSection
Menu_BootIsoFast = 20, // Opens Recent Files sub-menu, and boots selected iso using QuickBoot Menu_RunIso = 20, // Opens submenu with Iso browser, and recent isos.
Menu_BootIso, // Opens Recent Files sub-menu, and boots selected iso using FullBoot Menu_IsoBrowse, // Open dialog, runs selected iso.
Menu_IsoBrowse, // sub-menu opened up by BootIso Menu_BootCDVD, // opens a submenu filled by CDVD plugin (usually list of drives)
Menu_BootQuickCDVD, // opens a submenu filled by CDVD plugin (usually list of drives)
Menu_BootFullCDVD, // opens a submenu filled by CDVD plugin (usually list of drives)
Menu_RunWithoutDisc, // used to enter the bios (subs in cdvdnull) Menu_RunWithoutDisc, // used to enter the bios (subs in cdvdnull)
Menu_RunELF, Menu_RunELF,
Menu_SkipBiosToggle, // enables the Bios Skip speedhack
Menu_EnableSkipBios, // check marked menu that toggles Skip Bios boot feature.
Menu_SuspendExec, // suspends active emulation Menu_SuspendExec, // suspends active emulation
Menu_ResumeExec, // restores active emulation Menu_ResumeExec, // restores active emulation
Menu_Reset, // Issues a complete reset. Menu_Reset, // Issues a complete reset.

View File

@ -26,11 +26,20 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/bookctrl.h>
#include <list>
#include "wxHelpers.h" #include "wxHelpers.h"
#include "Utilities/SafeArray.h" #include "Utilities/SafeArray.h"
#include "Utilities/Threading.h" #include "Utilities/Threading.h"
// Annoyances of C++ forward declarations. Having to type in this red tape mess
// is keeping me form eating a good sandwich right now... >_<
namespace Panels
{
class BaseApplicableConfigPanel;
}
namespace Exception namespace Exception
{ {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -41,31 +50,111 @@ namespace Exception
// //
class CannotApplySettings : public BaseException class CannotApplySettings : public BaseException
{ {
protected:
Panels::BaseApplicableConfigPanel* m_Panel;
public: public:
virtual ~CannotApplySettings() throw() {} virtual ~CannotApplySettings() throw() {}
CannotApplySettings( const CannotApplySettings& src ) : BaseException( src ) {} CannotApplySettings( const CannotApplySettings& src ) :
BaseException( src )
, m_Panel( src.m_Panel ) {}
explicit CannotApplySettings( const char* msg=wxLt("Cannot apply new settings, one of the settings is invalid.") ) : explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const char* msg=wxLt("Cannot apply new settings, one of the settings is invalid.") ) :
BaseException( msg ) {} BaseException( msg )
, m_Panel( thispanel )
{}
explicit CannotApplySettings( const wxString& msg_eng, const wxString& msg_xlt ) : explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const wxString& msg_eng, const wxString& msg_xlt ) :
BaseException( msg_eng, msg_xlt ) { } BaseException( msg_eng, msg_xlt )
, m_Panel( thispanel )
{}
Panels::BaseApplicableConfigPanel* GetPanel()
{
return m_Panel;
}
}; };
} }
namespace Panels namespace Panels
{ {
typedef std::list<BaseApplicableConfigPanel*> PanelApplyList_t;
struct StaticApplyState
{
// Static collection of ApplicableConfigPanels currently available to the user.
PanelApplyList_t PanelList;
// Current book page being initialized. Any apply objects created will use
// this page as their "go here on error" page. (used to take the user to the
// page with the option that failed apply validation).
int CurOwnerPage;
// TODO : Rename me to CurOwnerBook, or rename the one above to ParentPage.
wxBookCtrlBase* ParentBook;
StaticApplyState() :
PanelList()
, CurOwnerPage( wxID_NONE )
, ParentBook( NULL )
{
}
void SetCurrentPage( int page )
{
CurOwnerPage = page;
}
void ClearCurrentPage()
{
CurOwnerPage = wxID_NONE;
}
void StartBook( wxBookCtrlBase* book );
bool ApplyAll();
void DoCleanup();
};
extern StaticApplyState g_ApplyState;
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Extends the Panel class to add an Apply() method, which is invoked from the parent // Extends the Panel class to add an Apply() method, which is invoked from the parent
// window (usually the ConfigurationDialog) when either Ok or Apply is clicked. // window (usually the ConfigurationDialog) when either Ok or Apply is clicked.
// //
// Thread Safety: None. This class is only safe when used from the GUI thread, as it uses
// static vars and assumes that only one Applicableconfig system is available to the
// use rate any time (ie, a singular modal dialog).
//
class BaseApplicableConfigPanel : public wxPanelWithHelpers class BaseApplicableConfigPanel : public wxPanelWithHelpers
{ {
protected:
int m_OwnerPage;
wxBookCtrlBase* m_OwnerBook;
public: public:
virtual ~BaseApplicableConfigPanel() { } virtual ~BaseApplicableConfigPanel()
{
g_ApplyState.PanelList.remove( this );
}
BaseApplicableConfigPanel( wxWindow* parent ) : BaseApplicableConfigPanel( wxWindow* parent ) :
wxPanelWithHelpers( parent, wxID_ANY ) { } wxPanelWithHelpers( parent, wxID_ANY )
, m_OwnerPage( g_ApplyState.CurOwnerPage )
, m_OwnerBook( g_ApplyState.ParentBook )
{
g_ApplyState.PanelList.push_back( this );
}
int GetOwnerPage() const { return m_OwnerPage; }
wxBookCtrlBase* GetOwnerBook() { return m_OwnerBook; }
void SetFocusToMe()
{
if( (m_OwnerBook == NULL) || (m_OwnerPage == wxID_NONE) ) return;
m_OwnerBook->SetSelection( m_OwnerPage );
}
// This method attempts to assign the settings for the panel into the given // This method attempts to assign the settings for the panel into the given
// configuration structure (which is typically a copy of g_Conf). If validation // configuration structure (which is typically a copy of g_Conf). If validation
// of form contents fails, the function should throw Exception::CannotApplySettings. // of form contents fails, the function should throw Exception::CannotApplySettings.
@ -124,18 +213,20 @@ namespace Panels
class PathsPanel : public BaseApplicableConfigPanel class PathsPanel : public BaseApplicableConfigPanel
{ {
protected: protected:
class DirPickerPanel : public wxPanelWithHelpers class DirPickerPanel : public BaseApplicableConfigPanel
{ {
protected: protected:
wxDirName (*m_GetDefaultFunc)(); FoldersEnum_t m_FolderId;
wxDirPickerCtrl* m_pickerCtrl; wxDirPickerCtrl* m_pickerCtrl;
wxCheckBox* m_checkCtrl; wxCheckBox* m_checkCtrl;
public: public:
DirPickerPanel( wxWindow* parent, const wxDirName& initPath, wxDirName (*getDefault)(), const wxString& label, const wxString& dialogLabel ); DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& label, const wxString& dialogLabel );
void Apply( AppConfig& conf );
protected: protected:
void UseDefaultPath_Click(wxCommandEvent &event); void UseDefaultPath_Click(wxCommandEvent &event);
void UpdateCheckStatus( bool someNoteworthyBoolean );
}; };
class MyBasePanel : public wxPanelWithHelpers class MyBasePanel : public wxPanelWithHelpers
@ -147,8 +238,8 @@ namespace Panels
MyBasePanel(wxWindow& parent, int id=wxID_ANY); MyBasePanel(wxWindow& parent, int id=wxID_ANY);
protected: protected:
void AddDirPicker( wxBoxSizer& sizer, const wxDirName& initPath, wxDirName (*getDefaultFunc)(), void AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid, const wxString& label,
const wxString& label, const wxString& popupLabel, enum ExpandedMsgEnum tooltip ); const wxString& popupLabel, enum ExpandedMsgEnum tooltip );
}; };
class StandardPanel : public MyBasePanel class StandardPanel : public MyBasePanel

View File

@ -0,0 +1,110 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "PrecompiledHeader.h"
#include "ConfigurationPanels.h"
#include <wx/stdpaths.h>
Panels::StaticApplyState Panels::g_ApplyState;
// -----------------------------------------------------------------------
// This method should be called by the parent dalog box of a configuration
// on dialog destruction. It asserts if the ApplyList hasn't been cleaned up
// and then cleans it up forcefully.
//
void Panels::StaticApplyState::DoCleanup()
{
wxASSERT_MSG( PanelList.size() != 0, L"PanelList list hasn't been cleaned up." );
PanelList.clear();
ParentBook = NULL;
}
void Panels::StaticApplyState::StartBook( wxBookCtrlBase* book )
{
DevAssert( ParentBook == NULL, "An ApplicableConfig session is already in progress." );
ParentBook = book;
}
// -----------------------------------------------------------------------
// Returns false if one of the panels fails input validation (in which case dialogs
// should not be closed, etc).
//
bool Panels::StaticApplyState::ApplyAll()
{
bool retval = true;
try
{
AppConfig confcopy( *g_Conf );
PanelApplyList_t::iterator yay = PanelList.begin();
while( yay != PanelList.end() )
{
//DbgCon::Status( L"Writing settings for: " + (*yay)->GetLabel() );
(*yay)->Apply( confcopy );
yay++;
}
// If an exception is thrown above, this code below won't get run.
// (conveniently skipping any option application! :D)
*g_Conf = confcopy;
g_Conf->Apply();
g_Conf->Save();
}
catch( Exception::CannotApplySettings& ex )
{
wxMessageBox( ex.DisplayMessage(), _("Cannot apply settings...") );
if( ex.GetPanel() != NULL )
ex.GetPanel()->SetFocusToMe();
retval = false;
}
return retval;
}
// -----------------------------------------------------------------------
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent ) :
BaseApplicableConfigPanel( parent )
, m_radio_user( NULL )
, m_radio_cwd( NULL )
{
wxStaticBoxSizer& s_boxer = *new wxStaticBoxSizer( wxVERTICAL, this, _( "Usermode Selection" ) );
AddStaticText( s_boxer,
L"Please select your preferred default location for PCSX2 user-level documents below "
L"(includes memory cards, screenshots, settings, and savestates). "
L"These folder locations can be overridden at any time using the Core Settings panel.",
480, wxALIGN_CENTRE );
m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() );
m_radio_cwd = &AddRadioButton( s_boxer, _("Current working folder (intended for developer use only)"), _("Location: ") + wxGetCwd() );
s_boxer.AddSpacer( 4 );
SetSizerAndFit( &s_boxer );
}
void Panels::UsermodeSelectionPanel::Apply( AppConfig& conf )
{
if( !m_radio_cwd->GetValue() && !m_radio_user->GetValue() )
throw Exception::CannotApplySettings( this, wxLt( "You must select one of the available user modes before proceeding." ) );
conf.UseAdminMode = m_radio_cwd->GetValue();
}

View File

@ -25,20 +25,31 @@
using namespace wxHelpers; using namespace wxHelpers;
static const int BetweenFolderSpace = 5; static const int BetweenFolderSpace = 5;
// Pass me TRUE if the default path is to be used, and the DirPcikerCtrl disabled from use.
void Panels::PathsPanel::DirPickerPanel::UpdateCheckStatus( bool someNoteworthyBoolean )
{
m_pickerCtrl->Enable( !someNoteworthyBoolean );
if( someNoteworthyBoolean )
m_pickerCtrl->SetPath( PathDefs::Get( m_FolderId ).ToString() );
}
void Panels::PathsPanel::DirPickerPanel::UseDefaultPath_Click(wxCommandEvent &event) void Panels::PathsPanel::DirPickerPanel::UseDefaultPath_Click(wxCommandEvent &event)
{ {
wxASSERT( m_pickerCtrl != NULL && m_checkCtrl != NULL ); wxASSERT( m_pickerCtrl != NULL && m_checkCtrl != NULL );
m_pickerCtrl->Enable( !m_checkCtrl->IsChecked() ); UpdateCheckStatus( m_checkCtrl->IsChecked() );
m_pickerCtrl->SetPath( m_GetDefaultFunc().ToString() );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, const wxDirName& initPath, wxDirName (*getDefault)(), // If initPath is NULL, then it's assumed the default folder is to be used, which is
// obtained from invoking the specified getDefault() function.
//
Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid,
const wxString& label, const wxString& dialogLabel ) : const wxString& label, const wxString& dialogLabel ) :
wxPanelWithHelpers( parent, wxID_ANY ) BaseApplicableConfigPanel( parent )
, m_GetDefaultFunc( getDefault ) , m_FolderId( folderid )
{ {
wxDirName normalized( initPath ); const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId );
wxDirName normalized( isDefault ? g_Conf->Folders[m_FolderId] : PathDefs::Get(m_FolderId) );
normalized.Normalize(); normalized.Normalize();
wxStaticBoxSizer& s_box = *new wxStaticBoxSizer( wxVERTICAL, this, label ); wxStaticBoxSizer& s_box = *new wxStaticBoxSizer( wxVERTICAL, this, label );
@ -51,13 +62,21 @@ Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, const wxDi
); );
s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() ); s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() );
m_checkCtrl = &AddCheckBox( s_box, _("Use operating system default settings") ); m_checkCtrl = &AddCheckBox( s_box, _("Use installation default setting") );
m_checkCtrl->SetValue( isDefault );
UpdateCheckStatus( isDefault );
SetSizerAndFit( &s_box ); SetSizerAndFit( &s_box );
Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PathsPanel::DirPickerPanel::UseDefaultPath_Click ) ); Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PathsPanel::DirPickerPanel::UseDefaultPath_Click ) );
} }
void Panels::PathsPanel::DirPickerPanel::Apply( AppConfig& conf )
{
throw Exception::CannotApplySettings( this );
conf.Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() );
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int id ) : Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int id ) :
wxPanelWithHelpers( &parent, id ) wxPanelWithHelpers( &parent, id )
@ -65,9 +84,9 @@ Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int id ) :
{ {
} }
void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, const wxDirName& initPath, wxDirName (*getDefaultFunc)(), const wxString& label, const wxString& popupLabel, ExpandedMsgEnum tooltip ) void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel, ExpandedMsgEnum tooltip )
{ {
DirPickerPanel* dpan = new DirPickerPanel( this, initPath, getDefaultFunc, label, popupLabel ); DirPickerPanel* dpan = new DirPickerPanel( this, folderid, label, popupLabel );
dpan->SetToolTip( pxE(tooltip) ); dpan->SetToolTip( pxE(tooltip) );
sizer.Add( dpan, SizerFlags::StdGroupie() ); sizer.Add( dpan, SizerFlags::StdGroupie() );
} }
@ -76,24 +95,31 @@ void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, const wxD
Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) : Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) :
MyBasePanel( parent, id ) MyBasePanel( parent, id )
{ {
AddDirPicker( s_main, g_Conf->Folders.Bios, PathDefs::GetBios, // TODO : Replace the callback mess here with the new FolderId enumeration setup. :)
_("Bios:"), _("Select folder with PS2 Bios"), Msg_Tooltips_Bios );
AddDirPicker( s_main, FolderId_Bios,
_("Bios:"),
_("Select folder with PS2 Bios"), Msg_Tooltips_Bios );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf->Folders.Savestates, PathDefs::GetSavestates, AddDirPicker( s_main, FolderId_Savestates,
_("Savestates:"), _("Select folder for Savestates"), Msg_Tooltips_Savestates ); _("Savestates:"),
_("Select folder for Savestates"), Msg_Tooltips_Savestates );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf->Folders.Snapshots, PathDefs::GetSnapshots, AddDirPicker( s_main, FolderId_Snapshots,
_("Snapshots:"), _("Select a folder for Snapshots"), Msg_Tooltips_Snapshots ); _("Snapshots:"),
_("Select a folder for Snapshots"), Msg_Tooltips_Snapshots );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf->Folders.Logs, PathDefs::GetLogs, AddDirPicker( s_main, FolderId_Logs,
_("Logs/Dumps:" ), _("Select a folder for logs/dumps"), Msg_Tooltips_Logs ); _("Logs/Dumps:" ),
_("Select a folder for logs/dumps"), Msg_Tooltips_Logs );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf->Folders.MemoryCards, PathDefs::GetMemoryCards, AddDirPicker( s_main, FolderId_MemoryCards,
_("Memorycards:"), _("Select a default Memorycards folder"), Msg_Tooltips_Memorycards ); _("Memorycards:"),
_("Select a default Memorycards folder"), Msg_Tooltips_Memorycards );
s_main.AddSpacer( 5 ); s_main.AddSpacer( 5 );
SetSizerAndFit( &s_main ); SetSizerAndFit( &s_main );
@ -107,12 +133,14 @@ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int id ) :
wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") ); wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") );
AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE ); AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE );
AddDirPicker( advanced, g_Conf->Folders.Plugins, PathDefs::GetPlugins, AddDirPicker( advanced, FolderId_Plugins,
_("Plugins:"), _("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath ); _("Plugins:"),
_("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath );
advanced.AddSpacer( BetweenFolderSpace ); advanced.AddSpacer( BetweenFolderSpace );
AddDirPicker( advanced, g_Conf->Folders.Settings, PathDefs::GetSettings, AddDirPicker( advanced, FolderId_Settings,
_("Settings:"), _("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath ); _("Settings:"),
_("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath );
advanced.AddSpacer( 4 ); advanced.AddSpacer( 4 );
advanced.Add( new UsermodeSelectionPanel( this ), SizerFlags::StdGroupie() ); advanced.Add( new UsermodeSelectionPanel( this ), SizerFlags::StdGroupie() );

View File

@ -219,9 +219,8 @@ bool Pcsx2App::OnInit()
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log" ); m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ConLogBox );
m_Ps2ConLogBox = m_ProgramLogBox; // just use a single logger for now. m_Ps2ConLogBox = m_ProgramLogBox; // just use a single logger for now.
m_ProgramLogBox->Hide();
//m_Ps2ConLogBox = new ConsoleLogFrame( NULL, L"PS2 Console Log" ); //m_Ps2ConLogBox = new ConsoleLogFrame( NULL, L"PS2 Console Log" );
SysInit(); SysInit();
@ -264,6 +263,9 @@ bool Pcsx2App::OnInit()
int Pcsx2App::OnExit() int Pcsx2App::OnExit()
{ {
g_Conf->Save(); g_Conf->Save();
safe_delete( g_RecentIsoList );
safe_delete( m_Bitmap_Logo );
safe_delete( g_Conf );
return wxApp::OnExit(); return wxApp::OnExit();
} }

View File

@ -2089,6 +2089,10 @@
RelativePath="..\..\gui\Panels\GameFixesPanel.cpp" RelativePath="..\..\gui\Panels\GameFixesPanel.cpp"
> >
</File> </File>
<File
RelativePath="..\..\gui\Panels\MiscPanelStuff.cpp"
>
</File>
<File <File
RelativePath="..\..\gui\Panels\PathsPanel.cpp" RelativePath="..\..\gui\Panels\PathsPanel.cpp"
> >