From 32233c15092ef1426ebe51e8af3d8e20478491ec Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sun, 12 Jul 2009 01:02:50 +0000 Subject: [PATCH] wxgui: missing file updates from my previous commit. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1492 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/Panels/ConfigurationPanels.h | 32 +++++++++- pcsx2/gui/Panels/PathsPanel.cpp | 84 ++++++++++++++++---------- pcsx2/gui/Panels/SpeedhacksPanel.cpp | 1 - 3 files changed, 80 insertions(+), 37 deletions(-) diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index b7b4746b15..cfde7dae2f 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -// All of the options screens in PCSX2 are implemented as panels which can be bound to +// All of the options screens in PCSX2 are implemented as panels which can be bound to // either their own dialog boxes, or made into children of a paged Properties box. The // paged Properties box is generally superior design, and there's a good chance we'll not // want to deviate form that design anytime soon. But there's no harm in keeping nice @@ -28,6 +28,7 @@ #include #include "wxHelpers.h" +#include "Utilities/SafeArray.h" namespace Panels { @@ -46,7 +47,7 @@ namespace Panels void INTCSTATSlow_Click(wxCommandEvent &event); void IdleLoopFF_Click(wxCommandEvent &event); }; - + ////////////////////////////////////////////////////////////////////////////////////////// // class GameFixesPanel: public wxPanelWithHelpers @@ -70,19 +71,44 @@ namespace Panels class PathsPanel: public wxPanelWithHelpers { protected: + class DirPickerPanel : public wxPanelWithHelpers + { + protected: + wxDirName (*m_GetDefaultFunc)(); + wxDirPickerCtrl* m_pickerCtrl; + wxCheckBox* m_checkCtrl; + + public: + DirPickerPanel( wxWindow* parent, const wxDirName& initPath, wxDirName (*getDefault)(), const wxString& label, const wxString& dialogLabel ); + + protected: + void UseDefaultPath_Click(wxCommandEvent &event); + }; + class MyBasePanel : public wxPanelWithHelpers { + protected: + wxBoxSizer& s_main; + public: MyBasePanel(wxWindow& parent, int id=wxID_ANY); protected: - wxDirPickerCtrl& AddDirPicker( wxBoxSizer& sizer, int id, const wxDirName& defaultPath, const wxString& label, const wxString& dialogLabel, bool pathMustExist=true ); + void AddDirPicker( wxBoxSizer& sizer, const wxDirName& initPath, wxDirName (*getDefaultFunc)(), + const wxString& label, const wxString& popupLabel, enum ExpandedMsgEnum tooltip ); }; class StandardPanel : public MyBasePanel { public: StandardPanel(wxWindow& parent, int id=wxID_ANY); + + protected: + //DirPickerInfo m_BiosPicker; + //DirPickerInfo m_SavestatesPicker; + //DirPickerInfo m_SnapshotsPicker; + //DirPickerInfo m_MemorycardsPicker; + //DirPickerInfo m_LogsPicker; }; class AdvancedPanel : public MyBasePanel diff --git a/pcsx2/gui/Panels/PathsPanel.cpp b/pcsx2/gui/Panels/PathsPanel.cpp index 3056c96e98..ba60a29554 100644 --- a/pcsx2/gui/Panels/PathsPanel.cpp +++ b/pcsx2/gui/Panels/PathsPanel.cpp @@ -25,79 +25,97 @@ using namespace wxHelpers; static const int BetweenFolderSpace = 5; -// ------------------------------------------------------------------------ -wxDirPickerCtrl& Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, int id, const wxDirName& defaultPath, const wxString& label, const wxString& dialogLabel, bool pathMustExist ) +void Panels::PathsPanel::DirPickerPanel::UseDefaultPath_Click(wxCommandEvent &event) { - // fixme: Should wxGTK (linux) force-enable the wxDIRP_USE_TEXTCTRL? It's not "standard" on that platform - // but it might still be preferred. - air + wxASSERT( m_pickerCtrl != NULL && m_checkCtrl != NULL ); + m_pickerCtrl->Enable( !m_checkCtrl->IsChecked() ); + m_pickerCtrl->SetPath( m_GetDefaultFunc().ToString() ); +} - wxDirName normalized( defaultPath ); +// ------------------------------------------------------------------------ +Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, const wxDirName& initPath, wxDirName (*getDefault)(), + const wxString& label, const wxString& dialogLabel ) : + wxPanelWithHelpers( parent, wxID_ANY ) +, m_GetDefaultFunc( getDefault ) +{ + wxDirName normalized( initPath ); normalized.Normalize(); - wxDirPickerCtrl* jobe = new wxDirPickerCtrl( this, id, normalized.ToString(), dialogLabel ); wxStaticBoxSizer& s_box = *new wxStaticBoxSizer( wxVERTICAL, this, label ); - - s_box.Add( jobe, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() ); - AddCheckBox( s_box, _("Use operating system default settings") ); - sizer.Add( &s_box, SizerFlags::StdGroupie() ); - return *jobe; + + // Force the Dir Picker to use a text control. This isn't standard on Linux/GTK but it's much + // more usable, so to hell with standards. + + m_pickerCtrl = new wxDirPickerCtrl( this, wxID_ANY, normalized.ToString(), dialogLabel, + wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST + ); + + s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() ); + m_checkCtrl = &AddCheckBox( s_box, _("Use operating system default settings") ); + + SetSizerAndFit( &s_box ); + + Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PathsPanel::DirPickerPanel::UseDefaultPath_Click ) ); } // ------------------------------------------------------------------------ Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int id ) : wxPanelWithHelpers( &parent, id ) +, s_main( *new wxBoxSizer( wxVERTICAL ) ) { +} +void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, const wxDirName& initPath, wxDirName (*getDefaultFunc)(), const wxString& label, const wxString& popupLabel, ExpandedMsgEnum tooltip ) +{ + DirPickerPanel* dpan = new DirPickerPanel( this, initPath, getDefaultFunc, label, popupLabel ); + dpan->SetToolTip( pxE(tooltip) ); + sizer.Add( dpan, SizerFlags::StdGroupie() ); } // ------------------------------------------------------------------------ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) : MyBasePanel( parent, id ) { - wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); - - AddDirPicker( s_main, wxID_ANY, g_Conf.Folders.Bios, _("Bios:"), _("Select folder with PS2 Bios") ) - .SetToolTip( pxE(Msg_Tooltips_Bios) ); + AddDirPicker( s_main, g_Conf.Folders.Bios, PathDefs::GetBios, + _("Bios:"), _("Select folder with PS2 Bios"), Msg_Tooltips_Bios ); s_main.AddSpacer( BetweenFolderSpace ); - AddDirPicker( s_main, wxID_ANY, g_Conf.Folders.Savestates, _("Savestates:"), _("Select folder for Savestates") ) - .SetToolTip( pxE(Msg_Tooltips_Savestates) ); + AddDirPicker( s_main, g_Conf.Folders.Savestates, PathDefs::GetSavestates, + _("Savestates:"), _("Select folder for Savestates"), Msg_Tooltips_Savestates ); s_main.AddSpacer( BetweenFolderSpace ); - AddDirPicker( s_main, wxID_ANY, g_Conf.Folders.Snapshots, _("Snapshots:"), _("Select a folder for Snapshots") ) - .SetToolTip( pxE(Msg_Tooltips_Snapshots) ); + AddDirPicker( s_main, g_Conf.Folders.Snapshots, PathDefs::GetSnapshots, + _("Snapshots:"), _("Select a folder for Snapshots"), Msg_Tooltips_Snapshots ); s_main.AddSpacer( BetweenFolderSpace ); - AddDirPicker( s_main, wxID_ANY, g_Conf.Folders.Logs, _("Log/Dumps:" ), _("Select a folder for logs/dumps") ) - .SetToolTip( pxE(Msg_Tooltips_Logs) ); + AddDirPicker( s_main, g_Conf.Folders.Logs, PathDefs::GetLogs, + _("Logs/Dumps:" ), _("Select a folder for logs/dumps"), Msg_Tooltips_Logs ); s_main.AddSpacer( BetweenFolderSpace ); - AddDirPicker( s_main, wxID_ANY, g_Conf.Folders.MemoryCards, _("Memorycards:"), _("Select a default Memorycards folder") ) - .SetToolTip( pxE(Msg_Tooltips_Memorycards) ); + AddDirPicker( s_main, g_Conf.Folders.MemoryCards, PathDefs::GetMemoryCards, + _("Memorycards:"), _("Select a default Memorycards folder"), Msg_Tooltips_Memorycards ); s_main.AddSpacer( 5 ); - SetSizerAndFit( &s_main ); + } // ------------------------------------------------------------------------ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int id ) : MyBasePanel( parent, id ) { - wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") ); AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE ); - AddDirPicker( advanced, wxID_ANY, g_Conf.Folders.Plugins, _("Plugins:"), _("Select folder for PCSX2 plugins") ) - .SetToolTip( pxE(Msg_Tooltips_PluginsPath) ); + AddDirPicker( advanced, g_Conf.Folders.Plugins, PathDefs::GetPlugins, + _("Plugins:"), _("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath ); advanced.AddSpacer( BetweenFolderSpace ); - AddDirPicker( advanced, wxID_ANY, g_Conf.Folders.Settings, _("Settings:"), _("Select a folder for PCSX2 settings/inis") ) - .SetToolTip( pxE(Msg_Tooltips_SettingsPath) ); + AddDirPicker( advanced, g_Conf.Folders.Settings, PathDefs::GetSettings, + _("Settings:"), _("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath ); wxStaticBoxSizer& s_diag = *new wxStaticBoxSizer( wxVERTICAL, this, _("Default folder mode") ); - + AddStaticText( s_diag, L"This setting only affects folders which are set to use the default folder configurations for your " L"operating system. Any folders which are configured manually will override this option. ", @@ -110,7 +128,7 @@ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int id ) : advanced.AddSpacer( 4 ); advanced.Add( &s_diag, SizerFlags::StdGroupie() ); - + s_main.Add( &advanced, SizerFlags::StdGroupie() ); s_main.AddSpacer( 5 ); @@ -123,7 +141,7 @@ Panels::PathsPanel::PathsPanel( wxWindow& parent, int id ) : { wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); wxNotebook& notebook = *new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM | wxNB_FIXEDWIDTH ); - + notebook.AddPage( new StandardPanel( notebook ), _("Standard") ); notebook.AddPage( new AdvancedPanel( notebook ), _("Advanced") ); diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index a776746bf3..24af57601b 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -28,7 +28,6 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int id ) : wxPanelWithHelpers( &parent, id ) { wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); - wxBoxSizer& secondarySizer = *new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer& sliderSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Cycle Hacks") ); wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Misc Speed Hacks") );