From 34d6384d550067d47317e7badb62aeb49c403a13 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 5 Jun 2010 14:25:41 +0000 Subject: [PATCH] UI: Reorganized the Speedhack panel a bit, and added graying out of the new static text labels. Todo note: The plan is to make the Gamefixes dialog match the new way the speedhacks dialog is laid out, with the disable checkbox at the top (in case someone wants to try their hand at it!). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3171 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/pxCheckBox.h | 5 +++ common/include/Utilities/pxStaticText.h | 2 ++ common/src/Utilities/pxCheckBox.cpp | 18 +++++++++-- common/src/Utilities/pxStaticText.cpp | 20 ++++++++++-- pcsx2/gui/Dialogs/SysConfigDialog.cpp | 2 +- pcsx2/gui/Panels/GSWindowPanel.cpp | 2 +- pcsx2/gui/Panels/LogOptionsPanels.cpp | 8 ++--- pcsx2/gui/Panels/SpeedhacksPanel.cpp | 43 ++++++++++++++----------- 8 files changed, 70 insertions(+), 30 deletions(-) diff --git a/common/include/Utilities/pxCheckBox.h b/common/include/Utilities/pxCheckBox.h index 05d7f5c5d7..a45c223f7d 100644 --- a/common/include/Utilities/pxCheckBox.h +++ b/common/include/Utilities/pxCheckBox.h @@ -32,6 +32,10 @@ protected: wxCheckBox* m_checkbox; pxStaticText* m_subtext; + // padding below the subtext (if there's subtext). If there's no subtext, this value is unused. + int m_subPadding; + + wxSizerItem* m_sizerItem_subtext; public: pxCheckBox( wxWindow* parent, const wxString& label, const wxString& subtext=wxEmptyString ); virtual ~pxCheckBox() throw() {} @@ -39,6 +43,7 @@ public: bool HasSubText() const { return m_subtext != NULL; } const pxStaticText* GetSubText() const { return m_subtext; } + pxCheckBox& SetSubPadding( int pad ); pxCheckBox& SetToolTip( const wxString& tip ); pxCheckBox& SetValue( bool val ); bool GetValue() const; diff --git a/common/include/Utilities/pxStaticText.h b/common/include/Utilities/pxStaticText.h index 9470413ec5..086d37250a 100644 --- a/common/include/Utilities/pxStaticText.h +++ b/common/include/Utilities/pxStaticText.h @@ -57,6 +57,8 @@ public: virtual ~pxStaticText() throw() {} wxFont GetFontOk() const; + bool Enable( bool enabled=true ); + virtual void SetLabel(const wxString& label); pxStaticText& SetHeight( int lines ); diff --git a/common/src/Utilities/pxCheckBox.cpp b/common/src/Utilities/pxCheckBox.cpp index 672aefeaae..39ac1afb3d 100644 --- a/common/src/Utilities/pxCheckBox.cpp +++ b/common/src/Utilities/pxCheckBox.cpp @@ -17,6 +17,8 @@ #include "pxCheckBox.h" #include "pxStaticText.h" +using namespace pxSizerFlags; + // -------------------------------------------------------------------------------------- // pxCheckBox Implementations // -------------------------------------------------------------------------------------- @@ -30,6 +32,7 @@ pxCheckBox::pxCheckBox(wxWindow* parent, const wxString& label, const wxString& void pxCheckBox::Init(const wxString& label, const wxString& subtext) { m_subtext = NULL; + m_subPadding= StdPadding*2; m_checkbox = new wxCheckBox( this, wxID_ANY, label ); *this += m_checkbox | pxSizerFlags::StdExpand(); @@ -42,8 +45,8 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext) wxFlexGridSizer& spaced( *new wxFlexGridSizer(3) ); spaced.AddGrowableCol( 1 ); spaced += Indentation; - spaced += m_subtext | pxBorder( wxBOTTOM, 9 ).Expand(); - spaced += pxSizerFlags::StdPadding; + m_sizerItem_subtext = spaced.Add( m_subtext, pxBorder( wxBOTTOM, m_subPadding ).Expand() ); + //spaced += pxSizerFlags::StdPadding; *this += &spaced | pxExpand; } @@ -51,6 +54,17 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext) Connect( m_checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(pxCheckBox::OnCheckpartCommand) ); } +pxCheckBox& pxCheckBox::SetSubPadding( int pad ) +{ + m_subPadding = pad; + if( m_sizerItem_subtext ) + { + m_sizerItem_subtext->SetBorder( m_subPadding ); + Fit(); + } + return *this; +} + // applies the tooltip to both both the checkbox and it's static subtext (if present), and // performs word wrapping on platforms that need it (eg mswindows). pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip ) diff --git a/common/src/Utilities/pxStaticText.cpp b/common/src/Utilities/pxStaticText.cpp index 0ddb774af1..f4b9ae09d6 100644 --- a/common/src/Utilities/pxStaticText.cpp +++ b/common/src/Utilities/pxStaticText.cpp @@ -136,6 +136,7 @@ wxSize pxStaticText::GetBestWrappedSize( const wxClientDC& dc ) const int idealWidth = wxDefaultCoord; int parentalAdjust = 0; + double parentalFactor = 1.0; const wxWindow* millrun = this; while( millrun ) @@ -145,8 +146,8 @@ wxSize pxStaticText::GetBestWrappedSize( const wxClientDC& dc ) const // Anyway, this fixes it -- ignore min size specifier on wxWizard! if( wxIsKindOf( millrun, wxWizard ) ) break; - int min = millrun->GetMinWidth() - parentalAdjust; - + int min = (int)((millrun->GetMinWidth() - parentalAdjust) * parentalFactor); + if( min > 0 && ((idealWidth < 0 ) || (min < idealWidth)) ) { idealWidth = min; @@ -253,6 +254,16 @@ wxFont pxStaticText::GetFontOk() const return font; } +bool pxStaticText::Enable( bool enabled ) +{ + if( _parent::Enable(enabled)) + { + Refresh(); + return true; + } + return false; +} + void pxStaticText::paintEvent(wxPaintEvent& evt) { wxPaintDC dc( this ); @@ -261,7 +272,10 @@ void pxStaticText::paintEvent(wxPaintEvent& evt) if( dcWidth < 1 ) return; dc.SetFont( GetFontOk() ); - dc.SetTextForeground(GetForegroundColour()); + if( IsEnabled() ) + dc.SetTextForeground(GetForegroundColour()); + else + dc.SetTextForeground(*wxLIGHT_GREY); pxWindowTextWriter writer( dc ); writer.Align( m_align ); diff --git a/pcsx2/gui/Dialogs/SysConfigDialog.cpp b/pcsx2/gui/Dialogs/SysConfigDialog.cpp index 032db58016..dd0820a079 100644 --- a/pcsx2/gui/Dialogs/SysConfigDialog.cpp +++ b/pcsx2/gui/Dialogs/SysConfigDialog.cpp @@ -33,7 +33,7 @@ Dialogs::SysConfigDialog::SysConfigDialog(wxWindow* parent) AddPage ( wxLt("EE/IOP"), cfgid.Cpu ); AddPage ( wxLt("VUs"), cfgid.Cpu ); AddPage ( wxLt("GS"), cfgid.Cpu ); - AddPage ( wxLt("Window"), cfgid.Video ); + AddPage ( wxLt("GS Window"), cfgid.Video ); AddPage ( wxLt("Speedhacks"), cfgid.Speedhacks ); AddPage ( wxLt("Game Fixes"), cfgid.Gamefixes ); AddPage ( wxLt("Game Database"),cfgid.Plugins ); diff --git a/pcsx2/gui/Panels/GSWindowPanel.cpp b/pcsx2/gui/Panels/GSWindowPanel.cpp index 9da6df6ce6..5a9e9ce0d5 100644 --- a/pcsx2/gui/Panels/GSWindowPanel.cpp +++ b/pcsx2/gui/Panels/GSWindowPanel.cpp @@ -88,7 +88,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) s_AspectRatio += Label(_("Aspect Ratio:")) | pxMiddle; s_AspectRatio += m_combo_AspectRatio | pxExpand; - s_AspectRatio += Label(_("Custom Window Size:")) | pxMiddle; + s_AspectRatio += Label(_("Custom Window Size:"))| pxMiddle; s_AspectRatio += s_customsize | pxAlignRight; *this += s_AspectRatio | StdExpand(); diff --git a/pcsx2/gui/Panels/LogOptionsPanels.cpp b/pcsx2/gui/Panels/LogOptionsPanels.cpp index fa626ac888..294be9fa4b 100644 --- a/pcsx2/gui/Panels/LogOptionsPanels.cpp +++ b/pcsx2/gui/Panels/LogOptionsPanels.cpp @@ -232,11 +232,11 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent ) s_misc += m_GIFtag; s_misc += m_Elf; - *this += m_masterEnabler | StdExpand(); - *this += new wxStaticLine( this, wxID_ANY ) | StdExpand().Border(wxLEFT | wxRIGHT, 20); + *this += m_masterEnabler | StdExpand(); + *this += new wxStaticLine( this ) | StdExpand().Border(wxLEFT | wxRIGHT, 20); *this += 5; - *this += topSizer | StdExpand(); - *this += s_misc | StdSpace().Centre(); + *this += topSizer | StdExpand(); + *this += s_misc | StdSpace().Centre(); Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) ); diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index b4707a023c..58cbfeb117 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -101,21 +101,23 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) { const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() ); - pxStaticText* heading = new pxStaticHeading( this, pxE( ".Panel:Speedhacks:Overview", - L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. " - L"If you have issues, always try disabling these hacks first." - ) ); - m_check_Enable = new pxCheckBox( this, _("Enable speedhacks"), - _("(Warning! Speedhacks can cause false FPS readings, choppy audio, and many other bugs!)")); - m_check_Enable->SetToolTip(_("The safest way to make sure that all speedhacks are completely disabled.")); - - m_button_Defaults = new wxButton( this, wxID_DEFAULT, _("Restore Defaults") ); - pxSetToolTip( m_button_Defaults, _("Resets all speedhack options to their defaults, which consequently turns them all OFF.") ); + pxE( ".Panel:Speedhacks:Overview", + L"Speedhacks usually improve emulation speed, but can cause glitches, broken audio, and " + L"false FPS readings. When having emulation problems, disable this panel first." + ) + ); + m_check_Enable->SetToolTip(_("A safe and easy way to make sure that all speedhacks are completely disabled.")).SetSubPadding( 1 ); wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL ); wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL ); + left->SetMinWidth( 300 ); + right->SetMinWidth( 300 ); + + m_button_Defaults = new wxButton( right, wxID_DEFAULT, _("Restore Defaults") ); + pxSetToolTip( m_button_Defaults, _("Resets all speedhack options to their defaults, which consequently turns them all OFF.") ); + // ------------------------------------------------------------------------ // EE Cyclerate Hack Section: @@ -217,13 +219,13 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) // ------------------------------------------------------------------------ // Layout and Size ---> (!!) - wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 3, 0, 12 ) ); - DefEnableSizer.AddGrowableCol( 1, 1 ); - DefEnableSizer.AddGrowableCol( 2, 10 ); + //wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 3, 0, 12 ) ); //DefEnableSizer.AddGrowableCol( 1, 1 ); - DefEnableSizer += m_button_Defaults | StdSpace().Align( wxALIGN_LEFT ); - DefEnableSizer += pxStretchSpacer(1); - DefEnableSizer += m_check_Enable | StdExpand().Align( wxALIGN_RIGHT ); + //DefEnableSizer.AddGrowableCol( 2, 10 ); + //DefEnableSizer.AddGrowableCol( 1, 1 ); + //DefEnableSizer += m_button_Defaults | StdSpace().Align( wxALIGN_LEFT ); + //DefEnableSizer += pxStretchSpacer(1); + //DefEnableSizer += m_check_Enable | StdExpand().Align( wxALIGN_RIGHT ); *eeSliderPanel += m_slider_eecycle | sliderFlags; *eeSliderPanel += m_msg_eecycle | sliderFlags; @@ -243,6 +245,8 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) *right += vuSliderPanel | StdExpand(); *right += vuHacksPanel | StdExpand(); + *right += StdPadding; + *right += m_button_Defaults| StdButton(); s_table = new wxFlexGridSizer( 2 ); s_table->AddGrowableCol( 0, 1 ); @@ -250,9 +254,10 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) *s_table+= left | pxExpand; *s_table+= right | pxExpand; - *this += heading->Bold() | pxExpand; - *this += s_table | pxExpand; - *this += DefEnableSizer | pxExpand; + *this += m_check_Enable; + *this += new wxStaticLine( this ) | pxExpand.Border(wxLEFT | wxRIGHT, 20); + *this += StdPadding; + *this += s_table | pxExpand; // ------------------------------------------------------------------------