From 4ba3fd07dc044cd55868c45b736e3886c4adc09b Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 19 Nov 2009 05:08:24 +0000 Subject: [PATCH] * Speedhacks master toggle saves now. DevStuff: * Added a handful of operator+= overloads for working with wxSizers -- moderately reduces code clutter. :) * Commented some of the wxHelpers classes (pxStaticText, wxPanelWithHelpers, etc). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2221 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/wxWidgets/include/wx/msw/setup.h | 10 +- 3rdparty/wxWidgets/include/wx/msw/setup0.h | 10 +- 3rdparty/wxWidgets/include/wx/setup.h | 8 +- 3rdparty/wxWidgets/include/wx/univ/setup.h | 8 +- common/include/Utilities/pxCheckBox.h | 12 ++ common/include/Utilities/pxRadioPanel.h | 8 +- common/include/Utilities/pxStaticText.h | 59 +++++++- common/include/Utilities/wxGuiTools.h | 140 ++++++++++++++++++- common/include/Utilities/wxHelpers.h | 2 - common/src/Utilities/pxCheckBox.cpp | 14 +- common/src/Utilities/pxRadioPanel.cpp | 3 + common/src/Utilities/pxStaticText.cpp | 16 +-- common/src/Utilities/wxHelpers.cpp | 41 ------ pcsx2/gui/AppInit.cpp | 8 +- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 25 ++-- pcsx2/gui/Dialogs/PickUserModeDialog.cpp | 13 +- pcsx2/gui/Panels/BiosSelectorPanel.cpp | 9 +- pcsx2/gui/Panels/GameFixesPanel.cpp | 11 +- pcsx2/gui/Panels/MiscPanelStuff.cpp | 18 +-- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 43 +++--- pcsx2/gui/Panels/SpeedhacksPanel.cpp | 67 ++++----- pcsx2/gui/Panels/VideoPanel.cpp | 152 ++++++++++----------- 22 files changed, 410 insertions(+), 267 deletions(-) diff --git a/3rdparty/wxWidgets/include/wx/msw/setup.h b/3rdparty/wxWidgets/include/wx/msw/setup.h index 55e33ad5ca..826d0f287e 100644 --- a/3rdparty/wxWidgets/include/wx/msw/setup.h +++ b/3rdparty/wxWidgets/include/wx/msw/setup.h @@ -416,7 +416,7 @@ // Default is 1. // // Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 +#define wxUSE_DIALUP_MANAGER 0 // Compile in classes for run-time DLL loading and function calling. // Required by wxUSE_DIALUP_MANAGER. @@ -429,7 +429,7 @@ #define wxUSE_DYNLIB_CLASS 1 // experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 +#define wxUSE_DYNAMIC_LOADER 0 // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 @@ -526,7 +526,7 @@ #define wxUSE_SYSTEM_OPTIONS 1 // wxSound class -#define wxUSE_SOUND 1 +#define wxUSE_SOUND 0 // Use wxMediaCtrl // @@ -547,7 +547,7 @@ // Default is 1 // // Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 +#define wxUSE_XRC 0 // XML parsing classes. Note that their API will change in the future, so // using wxXmlDocument and wxXmlNode in your app is not recommended. @@ -1072,7 +1072,7 @@ #define wxUSE_RESOURCES 0 // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 +#define wxUSE_CONSTRAINTS 0 // 0 for no window layout constraint system #define wxUSE_SPLINES 1 diff --git a/3rdparty/wxWidgets/include/wx/msw/setup0.h b/3rdparty/wxWidgets/include/wx/msw/setup0.h index 9c1c3cf197..37a404c3ed 100644 --- a/3rdparty/wxWidgets/include/wx/msw/setup0.h +++ b/3rdparty/wxWidgets/include/wx/msw/setup0.h @@ -416,7 +416,7 @@ // Default is 1. // // Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 +#define wxUSE_DIALUP_MANAGER 0 // Compile in classes for run-time DLL loading and function calling. // Required by wxUSE_DIALUP_MANAGER. @@ -429,7 +429,7 @@ #define wxUSE_DYNLIB_CLASS 1 // experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 +#define wxUSE_DYNAMIC_LOADER 0 // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 @@ -526,7 +526,7 @@ #define wxUSE_SYSTEM_OPTIONS 1 // wxSound class -#define wxUSE_SOUND 1 +#define wxUSE_SOUND 0 // Use wxMediaCtrl // @@ -547,7 +547,7 @@ // Default is 1 // // Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 +#define wxUSE_XRC 0 // XML parsing classes. Note that their API will change in the future, so // using wxXmlDocument and wxXmlNode in your app is not recommended. @@ -1072,7 +1072,7 @@ #define wxUSE_RESOURCES 0 // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 +#define wxUSE_CONSTRAINTS 0 // 0 for no window layout constraint system #define wxUSE_SPLINES 1 diff --git a/3rdparty/wxWidgets/include/wx/setup.h b/3rdparty/wxWidgets/include/wx/setup.h index a6b1929685..e13dc72045 100644 --- a/3rdparty/wxWidgets/include/wx/setup.h +++ b/3rdparty/wxWidgets/include/wx/setup.h @@ -443,7 +443,7 @@ #define wxUSE_DYNLIB_CLASS 1 // experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 +#define wxUSE_DYNAMIC_LOADER 0 // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 @@ -540,7 +540,7 @@ #define wxUSE_SYSTEM_OPTIONS 1 // wxSound class -#define wxUSE_SOUND 1 +#define wxUSE_SOUND 0 // Use wxMediaCtrl // @@ -561,7 +561,7 @@ // Default is 1 // // Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 +#define wxUSE_XRC 0 // XML parsing classes. Note that their API will change in the future, so // using wxXmlDocument and wxXmlNode in your app is not recommended. @@ -1086,7 +1086,7 @@ #define wxUSE_RESOURCES 1 // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 +#define wxUSE_CONSTRAINTS 0 // 0 for no window layout constraint system #define wxUSE_SPLINES 1 diff --git a/3rdparty/wxWidgets/include/wx/univ/setup.h b/3rdparty/wxWidgets/include/wx/univ/setup.h index 708dd0934c..23ff0aaa28 100644 --- a/3rdparty/wxWidgets/include/wx/univ/setup.h +++ b/3rdparty/wxWidgets/include/wx/univ/setup.h @@ -438,7 +438,7 @@ // experimental, don't use for now #if defined(__WIN32__) - #define wxUSE_DYNAMIC_LOADER 1 + #define wxUSE_DYNAMIC_LOADER 0 #else #define wxUSE_DYNAMIC_LOADER 0 #endif @@ -532,7 +532,7 @@ #define wxUSE_SYSTEM_OPTIONS 1 // wxSound class -#define wxUSE_SOUND 1 +#define wxUSE_SOUND 0 // Use wxMediaCtrl // @@ -560,7 +560,7 @@ // Default is 1 // // Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 +#define wxUSE_XRC 0 // XML parsing classes. Note that their API will change in the future, so // using wxXmlDocument and wxXmlNode in your app is not recommended. @@ -1134,7 +1134,7 @@ #define wxUSE_RESOURCES 0 // Window layout constraint system -#define wxUSE_CONSTRAINTS 1 +#define wxUSE_CONSTRAINTS 0 // Splines #define wxUSE_SPLINES 1 diff --git a/common/include/Utilities/pxCheckBox.h b/common/include/Utilities/pxCheckBox.h index 54774b46ab..e8a9c39848 100644 --- a/common/include/Utilities/pxCheckBox.h +++ b/common/include/Utilities/pxCheckBox.h @@ -55,3 +55,15 @@ public: protected: void Init( const wxString& label, const wxString& subtext ); }; + +static void operator+=( wxSizer& target, pxCheckBox* src ) +{ + if( !pxAssert( src != NULL ) ) return; + target.Add( src, wxSF.Expand() ); +} + +template<> +static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) +{ + target.Add( src.window, src.flags ); +} diff --git a/common/include/Utilities/pxRadioPanel.h b/common/include/Utilities/pxRadioPanel.h index 22d59284bd..b1671d81fd 100644 --- a/common/include/Utilities/pxRadioPanel.h +++ b/common/include/Utilities/pxRadioPanel.h @@ -61,18 +61,16 @@ struct RadioPanelObjects // -------------------------------------------------------------------------------------- // pxRadioPanel // -------------------------------------------------------------------------------------- +// +// Rationale: // Radio buttons work best when they are created consecutively, and then their subtext // created in a second sweep (this keeps the radio buttons together in the parent window's // child list, and avoids potentially unwanted behavior with radio buttons failing to // group expectedly). Because of this, our radio button helper is shaped as a panel of -// a group of radio butons only, instead of bothering with the lower level per-button +// a group of radio buttons only, instead of bothering with the lower level per-button // design. This makes a few other things nicer as well, such as binding a single message // handler to all radio buttons in the panel. // -// The SetToolTip API provided by this function applies the tooltip to both both the radio -// button and it's static subtext (if present), and performs word wrapping on platforms -// that need it (eg mswindows). -// class pxRadioPanel : public wxPanelWithHelpers { protected: diff --git a/common/include/Utilities/pxStaticText.h b/common/include/Utilities/pxStaticText.h index 9a3d33bb9b..b2eaca3068 100644 --- a/common/include/Utilities/pxStaticText.h +++ b/common/include/Utilities/pxStaticText.h @@ -21,6 +21,35 @@ // -------------------------------------------------------------------------------------- // pxStaticText // -------------------------------------------------------------------------------------- +// Important: +// Proper use of this class requires using it's custom AddTo( wxSizer& ) method, in the +// place of wxSizer.Add(). You can also use the += operator (recommended): +// +// mySizer += new pxStaticText( this, _("omg translate me?") ); +// +// This class's purpose is to overcome two fundamental annoyances in wxWidgets design: +// +// * An inability to wrap text to conform to a fitted window (a limitation imposed by +// wxWidgets inability to fit individual directions, ie fit widths and then fit heights, +// which would allow a textbox to wrap text to a sizer-determined width, and then grow +// the sizers vertically to fit the calcuated text-wrapped height). +// +// * Textbox alignment requires aligning both the textbox contents, and aligning the text +// control within it's containing sizer. If both alignment flags do not match the result +// is typically undesirable. +// +// The first one is very hard to fix properly. Currently this class employs a hack where it +// grabs the "ideal" fitting width from it's containing panel/window, and then wraps text to +// fit within those confines. Under this design, pxStaticText controls will typically be the +// "regulators" of the window's display size, since they cannot really participate in the +// normal sizer system (since their minimum height is unknown until width-based sizes are +// determined). +// +// Note that if another control in the window has extends that blow the window size larger +// than the "ideal" width, then the pxStaticText will remain consistent in it's size. It +// will not attempt to grow to fit the expanded area. That might be fixable behavior, but +// it was hard enough for m to get this much working. ;) +// class pxStaticText : public wxStaticText { typedef wxStaticText _parent; @@ -41,18 +70,42 @@ public: void SetLabel( const wxString& label ); pxStaticText& SetWrapWidth( int newwidth ); pxStaticText& SetToolTip( const wxString& tip ); - + wxSize GetMinSize() const; //void DoMoveWindow(int x, int y, int width, int height); - void AddTo( wxSizer& sizer ); - void InsertAt( wxSizer& sizer, int position ); + void AddTo( wxSizer& sizer, wxSizerFlags flags=pxSizerFlags::StdSpace() ); + void AddTo( wxSizer* sizer, const wxSizerFlags& flags=pxSizerFlags::StdSpace() ) { AddTo( *sizer, flags ); } + + void InsertAt( wxSizer& sizer, int position, wxSizerFlags flags=pxSizerFlags::StdSpace() ); int GetIdealWidth() const; protected: void _setLabel(); }; +static void operator+=( wxSizer& target, pxStaticText* src ) +{ + if( !pxAssert( src != NULL ) ) return; + src->AddTo( target ); +} + +template<> +static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) +{ + target.Add( src.window, src.flags ); +} + +// -------------------------------------------------------------------------------------- +// pxStaticHeading +// -------------------------------------------------------------------------------------- +// Basically like a pxStaticText, except it defaults to wxALIGN_CENTRE, and it has expanded +// left and right side padding. +// +// The padding is not an exact science and, if there isn't any other controls in the form +// that are equal to or exceeding the IdealWidth, the control will end up fitting tightly +// to the heading (padding will be nullified). +// class pxStaticHeading : public pxStaticText { public: diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index da87292fcf..9da15e8874 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -26,6 +26,130 @@ class pxStaticText; class pxCheckBox; +#define wxSF wxSizerFlags() + +// -------------------------------------------------------------------------------------- +// pxWindowAndFlags +// -------------------------------------------------------------------------------------- +// This struct is a go-between for combining windows and sizer flags in "neat" fashion. +// To create the struct, use the | operator, like so: +// +// myPanel | wxSizerFlags().Expand() +// +// Implementation Note: This struct is a template as it allows us to use a special +// version of the += operator that retains the type information of the window, in case +// the window implements its own += overloads (one example is pxStaticText). Without the +// template, the type of the window would only be known as "wxWindow" when it's added to the +// sizer, and would thus fail to invoke the correct operator overload. +// +template< typename WinType > +struct pxWindowAndFlags +{ + WinType* window; + wxSizerFlags flags; +}; + +template< typename WinType > +static pxWindowAndFlags operator | ( WinType* _win, const wxSizerFlags& _flgs ) +{ + pxWindowAndFlags result = { _win, _flgs }; + return result; +} + +template< typename WinType > +static pxWindowAndFlags operator | ( WinType& _win, const wxSizerFlags& _flgs ) +{ + pxWindowAndFlags result = { &_win, _flgs }; + return result; +} + +template< typename WinType > +static pxWindowAndFlags operator | ( const wxSizerFlags& _flgs, WinType* _win ) +{ + pxWindowAndFlags result = { _win, _flgs }; + return result; +} + +template< typename WinType > +static pxWindowAndFlags operator | ( const wxSizerFlags& _flgs, WinType& _win ) +{ + pxWindowAndFlags result = { &_win, _flgs }; + return result; +} + +// -------------------------------------------------------------------------------------- +// wxSizer Operator += .. a wxSizer.Add() Substitute +// -------------------------------------------------------------------------------------- +// This set of operators is the *recommended* method for adding windows to sizers, not just +// because it's a lot prettier but also because it allows controls like pxStaticText to over- +// ride default sizerflags behavior. +// +// += operator works on either sizers, wxDialogs or wxPanels. In the latter case, the window +// is added to the dialog/panel's toplevel sizer (wxPanel.GetSizer() is used). If the panel +// has no sizer set via SetSizer(), an assertion is generated. +// +template< typename WinType > +static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) +{ + target.Add( src.window, src.flags ); +} + +static void operator+=( wxSizer& target, wxWindow* src ) +{ + target.Add( src ); +} + +static void operator+=( wxSizer& target, wxSizer* src ) +{ + target.Add( src ); +} + +static void operator+=( wxSizer& target, int spacer ) +{ + target.AddSpacer( spacer ); +} + +template< typename WinType > +static void operator+=( wxPanel& target, const pxWindowAndFlags& src ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + *target.GetSizer() += src; +} + +template< typename WinType > +static void operator+=( wxPanel& target, WinType* src ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + *target.GetSizer() += src; +} + +static void operator+=( wxPanel& target, int spacer ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + target.GetSizer()->AddSpacer( spacer ); +} + +template< typename WinType > +static void operator+=( wxDialog& target, const pxWindowAndFlags& src ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + *target.GetSizer() += src; +} + +template< typename WinType > +static void operator+=( wxDialog& target, WinType* src ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + *target.GetSizer() += src; +} + +static void operator+=( wxDialog& target, int spacer ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + target.GetSizer()->AddSpacer( spacer ); +} + + // ---------------------------------------------------------------------------- // wxGuiTools.h // @@ -64,7 +188,6 @@ public: wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize ); virtual ~wxDialogWithHelpers() throw(); - wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE ); void AddOkCancel( wxSizer& sizer, bool hasApply=false ); wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; } @@ -78,6 +201,20 @@ protected: // -------------------------------------------------------------------------------------- // wxPanelWithHelpers // -------------------------------------------------------------------------------------- +// Overview of Helpers provided by this class: +// * Simpler constructors that have wxID, position, and size parameters removed (We never +// use them in pcsx2) +// +// * Automatic 'primary box sizer' creation, assigned via SetSizer() -- use GetSizer() +// to retrieve it, or use the "*this += window;" syntax to add windows directly to it. +// +// * Built-in support for StaticBoxes (aka groupboxes). Create one at construction with +// a wxString label, or add one "after the fact" using AddStaticBox. +// +// * Propagates IdealWidth settings from parenting wxPanelWithHelpers classes, and auto- +// matically adjusts the width based on the sizer type (groupsizers get truncated to +// account for borders). +// class wxPanelWithHelpers : public wxPanel { DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers) @@ -92,7 +229,6 @@ public: explicit wxPanelWithHelpers( wxWindow* parent=NULL ); wxPanelWithHelpers* AddStaticBox( const wxString& label, wxOrientation orient=wxVERTICAL ); - pxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE ); // TODO : Propagate to children? wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; } diff --git a/common/include/Utilities/wxHelpers.h b/common/include/Utilities/wxHelpers.h index e31de03152..ee10e125c8 100644 --- a/common/include/Utilities/wxHelpers.h +++ b/common/include/Utilities/wxHelpers.h @@ -20,8 +20,6 @@ namespace wxHelpers { - //extern wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord, bool isFirst = false ); - extern pxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE ); extern pxStaticText& InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags=wxALIGN_CENTRE ); } diff --git a/common/src/Utilities/pxCheckBox.cpp b/common/src/Utilities/pxCheckBox.cpp index d9e982607a..0796670210 100644 --- a/common/src/Utilities/pxCheckBox.cpp +++ b/common/src/Utilities/pxCheckBox.cpp @@ -31,7 +31,8 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext) { m_subtext = NULL; m_checkbox = new wxCheckBox( this, wxID_ANY, label ); - GetSizer()->Add( m_checkbox, pxSizerFlags::StdExpand() ); + + *this += m_checkbox | pxSizerFlags::StdExpand(); static const int Indentation = 23; if( !subtext.IsEmpty() ) @@ -40,11 +41,12 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext) if( HasIdealWidth() ) m_subtext->SetWrapWidth( m_idealWidth - Indentation ); - wxBoxSizer& spaced = *new wxBoxSizer( wxHORIZONTAL ); - spaced.AddSpacer( Indentation ); - spaced.Add( m_subtext, wxSizerFlags().Border( wxBOTTOM, 9 ) ); - spaced.AddSpacer( pxSizerFlags::StdPadding ); - GetSizer()->Add( &spaced ); + wxBoxSizer& spaced( *new wxBoxSizer( wxHORIZONTAL ) ); + spaced += Indentation; + spaced += m_subtext | wxSF.Border( wxBOTTOM, 9 ); + spaced += pxSizerFlags::StdPadding; + + *this += &spaced; } } diff --git a/common/src/Utilities/pxRadioPanel.cpp b/common/src/Utilities/pxRadioPanel.cpp index 1792b5b515..edcb1f9660 100644 --- a/common/src/Utilities/pxRadioPanel.cpp +++ b/common/src/Utilities/pxRadioPanel.cpp @@ -113,6 +113,9 @@ void pxRadioPanel::_setToolTipImmediate( int idx, const wxString &tip ) woot->SetToolTip( wrapped ); } +// The SetToolTip API provided by this function applies the tooltip to both the radio +// button and it's static subtext (if present), and performs word wrapping on platforms +// that need it (eg mswindows). pxRadioPanel& pxRadioPanel::SetToolTip(int idx, const wxString &tip) { m_buttonStrings[idx].SetToolTip( tip ); diff --git a/common/src/Utilities/pxStaticText.cpp b/common/src/Utilities/pxStaticText.cpp index 45aa125318..28abe4d39c 100644 --- a/common/src/Utilities/pxStaticText.cpp +++ b/common/src/Utilities/pxStaticText.cpp @@ -19,8 +19,6 @@ // -------------------------------------------------------------------------------------- // pxStaticText Implementations // -------------------------------------------------------------------------------------- -// Implementation Notes: -// * No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems. pxStaticText::pxStaticText( wxWindow* parent, const wxString& label, int style ) : wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style ) @@ -63,15 +61,15 @@ pxStaticText& pxStaticText::SetToolTip( const wxString& tip ) return *this; } -void pxStaticText::AddTo( wxSizer& sizer ) +void pxStaticText::AddTo( wxSizer& sizer, wxSizerFlags flags ) { - sizer.Add( this, pxSizerFlags::StdSpace().Align( m_alignflags ) ); + sizer.Add( this, flags.Align( m_alignflags ) ); _setLabel(); } -void pxStaticText::InsertAt( wxSizer& sizer, int position ) +void pxStaticText::InsertAt( wxSizer& sizer, int position, wxSizerFlags flags ) { - sizer.Insert( position, this, pxSizerFlags::StdSpace().Align( m_alignflags ) ); + sizer.Insert( position, this, flags.Align( m_alignflags ) ); _setLabel(); } @@ -114,15 +112,9 @@ wxSize pxStaticText::GetMinSize() const return wxSize( std::min( ideal, minSize.x ), minSize.y ); } -/*pxStaticText::operator wxSizerFlags() const -{ - return pxSizerFlags::StdSpace().Align( m_alignflags ); -}*/ - // -------------------------------------------------------------------------------------- // pxStaticHeading Implementations // -------------------------------------------------------------------------------------- - pxStaticHeading::pxStaticHeading( wxWindow* parent, const wxString& label, int style ) : pxStaticText( parent, label, style ) { diff --git a/common/src/Utilities/wxHelpers.cpp b/common/src/Utilities/wxHelpers.cpp index 344cde7d18..e4bfb9f868 100644 --- a/common/src/Utilities/wxHelpers.cpp +++ b/common/src/Utilities/wxHelpers.cpp @@ -22,25 +22,6 @@ #include -// ------------------------------------------------------------------------ -// Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this -// ensures that that auto resizing is disabled, and that the sizer flags match the alignment specified -// for the textbox. -// -// Parameters: -// Size - allows forcing the control to wrap text at a specific pre-defined pixel width; -// or specify zero to let wxWidgets layout the text as it deems appropriate (recommended) -// -// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored -// or overridden. [default is left alignment] -// -pxStaticText& wxHelpers::AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags ) -{ - pxStaticText& temp( *new pxStaticText( parent, label, alignFlags ) ); - temp.AddTo( sizer ); - return temp; -} - pxStaticText& wxHelpers::InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags ) { pxStaticText& temp( *new pxStaticText(parent, label, alignFlags ) ); @@ -102,11 +83,6 @@ void wxDialogWithHelpers::OnActivate(wxActivateEvent& evt) //evt.Skip(); } -wxStaticText& wxDialogWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags ) -{ - return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags ); -} - void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply ) { wxSizer* buttonSizer = &sizer; @@ -221,20 +197,3 @@ wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, co { Init(); } - -// ------------------------------------------------------------------------ -// Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this -// ensures that that auto resizing is disabled, and that the sizer flags match the alignment specified -// for the textbox. -// -// Parameters: -// Size - allows forcing the control to wrap text at a specific pre-defined pixel width; -// or specify zero to let wxWidgets layout the text as it deems appropriate (recommended) -// -// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored -// or overridden. [default is left alignment] -// -pxStaticText& wxPanelWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags ) -{ - return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags ); -} diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 13e6fcafbb..4eb76146e8 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -86,16 +86,16 @@ void Pcsx2App::ReadUserModeSettings() wxDialogWithHelpers preAlpha( NULL, wxID_ANY, _("It might devour your kittens! - PCSX2 0.9.7 Pre-Alpha"), false ); preAlpha.SetIdealWidth( 575 ); - wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); - preAlpha.AddStaticText( s_main, + preAlpha.SetSizer( new wxBoxSizer( wxVERTICAL ) ); + preAlpha += new pxStaticText( &preAlpha, L"NOTICE!! This is a *PRE-ALPHA* developer build of PCSX2 0.9.7. We are in the middle of major rewrites of the " L"user interface, and many parts of the program have *NOT* been implemented yet. Options will be missing. " L"Some things may crash or hang without warning. Other things will seem plainly stupid and the product of incompetent " L"programmers. This is normal. We're working on it.\n\nYou have been warned!", wxALIGN_CENTER ); - s_main.Add( new wxButton( &preAlpha, wxID_OK ), pxSizerFlags::StdCenter() ); - preAlpha.SetSizerAndFit( &s_main ); + preAlpha += new wxButton( &preAlpha, wxID_OK ) | pxSizerFlags::StdCenter(); + preAlpha.Fit(); preAlpha.CentreOnScreen(); preAlpha.ShowModal(); diff --git a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp index 59916aa421..735eb3d40d 100644 --- a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp +++ b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp @@ -82,9 +82,9 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ): "F|RES, MrBrown, razorblade, Seta-san, Skarmeth, feal87" ); - wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); + SetSizer( new wxBoxSizer( wxVERTICAL ) ); - AddStaticText( mainSizer, _("PCSX2 - Playstation 2 Emulator") ); + *this += new pxStaticText( this, _("PCSX2 - Playstation 2 Emulator") ); // This sizer holds text of the authors and a logo! wxBoxSizer& AuthLogoSizer = *new wxBoxSizer( wxHORIZONTAL ); @@ -112,19 +112,20 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ): ContribSizer.Add( &m_bitmap_dualshock, pxSizerFlags::StdSpace() ); ContribSizer.AddStretchSpacer( 1 ); - mainSizer.Add( &AuthLogoSizer, pxSizerFlags::StdSpace() ); + *this += AuthLogoSizer | pxSizerFlags::StdSpace(); - mainSizer.Add( new wxHyperlinkCtrl( - this, wxID_ANY, L"Pcsx2 Official Website and Forums" , L"http://www.pcsx2.net" ), - wxSizerFlags(1).Center().Border( wxALL, 3 ) ); - mainSizer.Add( new wxHyperlinkCtrl( - this, wxID_ANY, L"Pcsx2 Official Svn Repository at Googlecode" , L"http://code.google.com/p/pcsx2" ), - wxSizerFlags(1).Center().Border( wxALL, 3 ) ); + *this += new wxHyperlinkCtrl( this, wxID_ANY, + _("Pcsx2 Official Website and Forums"), L"http://www.pcsx2.net" + ) | wxSizerFlags(1).Center().Border( wxALL, 3 ); - mainSizer.Add( &ContribSizer, pxSizerFlags::StdExpand() ); + *this += new wxHyperlinkCtrl( this, wxID_ANY, + _("Pcsx2 Official Svn Repository at Googlecode"), L"http://code.google.com/p/pcsx2" + ) | wxSizerFlags(1).Center().Border( wxALL, 3 ); - mainSizer.Add( new wxButton( this, wxID_OK, L"I've seen enough"), pxSizerFlags::StdCenter() ); - SetSizerAndFit( &mainSizer ); + *this += ContribSizer | pxSizerFlags::StdExpand(); + *this += new wxButton( this, wxID_OK, L"I've seen enough") | pxSizerFlags::StdCenter(); + + Fit(); CenterOnScreen(); } diff --git a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp index 5e2d463d4d..9b7515f4dc 100644 --- a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp +++ b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp @@ -27,15 +27,14 @@ Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) m_panel_usersel = new UsermodeSelectionPanel( this, false ); m_panel_langsel = new LanguageSelectionPanel( this ); - wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); + SetSizer( new wxBoxSizer( wxVERTICAL ) ); - AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") ); + *this += new pxStaticHeading( this, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") ); + *this += m_panel_langsel | pxSizerFlags::StdCenter(); + *this += m_panel_usersel | wxSizerFlags().Expand().Border( wxALL, 8 ); - s_main.Add( m_panel_langsel, pxSizerFlags::StdCenter() ); - s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) ); - - AddOkCancel( s_main ); - SetSizerAndFit( &s_main ); + AddOkCancel( *GetSizer() ); + Fit(); CenterOnScreen(); Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PickUserModeDialog::OnOk_Click ) ); diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index 03860fb18a..e38a08ce78 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -86,11 +86,10 @@ Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent, int idealWidth ) m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") ); - wxSizer& sizer( *GetSizer() ); - AddStaticText( sizer, _("Select a BIOS rom:"), wxALIGN_LEFT ); - sizer.Add( &m_ComboBox, pxSizerFlags::StdExpand() ); - sizer.AddSpacer( 6 ); - sizer.Add( &m_FolderPicker, pxSizerFlags::StdExpand() ); + *this += new pxStaticText( this, _("Select a BIOS rom:") ); + *this += m_ComboBox | pxSizerFlags::StdExpand(); + *this += 6; + *this += m_FolderPicker | pxSizerFlags::StdExpand(); } Panels::BiosSelectorPanel::~BiosSelectorPanel() throw () diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index 10c091ce4e..2bb90bfd2a 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -21,19 +21,18 @@ using namespace wxHelpers; Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : BaseApplicableConfigPanel( parent ) { - wxSizer& mainSizer( *GetSizer() ); - AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") ); + *this += new pxStaticHeading( this, _("Some games need special settings.\nEnable them here.")); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); // NOTE: Order of checkboxes must match the order of the bits in the GamefixOptions structure! // NOTE2: Don't make this static, because translations can change at run-time :) - struct CheckTextMess { wxString label, tooltip; }; + const CheckTextMess check_text[NUM_OF_GAME_FIXES] = { { @@ -69,14 +68,14 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); for( int i=0; iSetToolTip( check_text[i].tooltip ); m_checkbox[i]->SetValue( !!(opts.bitset & (1 << i)) ); } - mainSizer.Add( &groupSizer, wxSizerFlags().Centre() ); + *this += groupSizer | wxSF.Centre(); - AddStaticText( mainSizer, pxE( ".Panels:Gamefixes:Compat Warning", + *this += new pxStaticHeading( this, pxE( ".Panels:Gamefixes:Compat Warning", L"Enabling game fixes can cause compatibility or performance issues in other games. You " L"will need to turn off fixes manually when changing games." )); diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index f0514d33d4..31e644d990 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -167,10 +167,9 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool i m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 ); m_radio_UserMode->Realize(); - wxSizer& s_main( *GetSizer() ); - AddStaticText( s_main, isFirstTime ? usermodeExplained : usermodeWarning ); - s_main.Add( m_radio_UserMode, pxSizerFlags::StdExpand() ); - s_main.AddSpacer( 4 ); + *this += new pxStaticText( this, isFirstTime ? usermodeExplained : usermodeWarning ); + *this += m_radio_UserMode | pxSizerFlags::StdExpand(); + *this += 4; } void Panels::UsermodeSelectionPanel::Apply() @@ -180,7 +179,7 @@ void Panels::UsermodeSelectionPanel::Apply() // ----------------------------------------------------------------------- Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) - : BaseApplicableConfigPanel( parent ) + : BaseApplicableConfigPanel( parent, wxHORIZONTAL ) , m_langs() { m_picker = NULL; @@ -202,12 +201,9 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT ); m_picker->SetSelection( cursel ); - wxBoxSizer& s_lang = *new wxBoxSizer( wxHORIZONTAL ); - AddStaticText( s_lang, _("Select a language: "), wxALIGN_CENTRE_VERTICAL ); - s_lang.AddSpacer( 5 ); - s_lang.Add( m_picker, pxSizerFlags::StdSpace() ); - - SetSizer( &s_lang ); + *this += new pxStaticText( this, _("Select a language: "), wxALIGN_CENTRE_VERTICAL ); + *this += 5; + *this += m_picker | pxSizerFlags::StdSpace(); } void Panels::LanguageSelectionPanel::Apply() diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 461215970c..cd4217aa5a 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -32,6 +32,7 @@ static const bool DisableThreading = #endif using namespace wxHelpers; +using namespace pxSizerFlags; using namespace Threading; BEGIN_DECLARE_EVENT_TYPES() @@ -149,14 +150,13 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent ) { m_progress = 0; - wxSizer& s_main( *GetSizer() ); + m_gauge.SetToolTip( _("I'm givin' her all she's got, Captain!") ); - AddStaticText( s_main, _( "Enumerating available plugins..." ) ); - s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) ); - s_main.Add( &m_label, pxSizerFlags::StdExpand() ); + *this += new pxStaticHeading( this, _( "Enumerating available plugins..." ) ); + *this += m_gauge | wxSF.Expand().Border( wxLEFT | wxRIGHT, 32 ); + *this += m_label | StdExpand(); - // The status bar only looks right if I use SetSizerAndFit() here. - Fit(); // &s_main ); + Fit(); } void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len ) @@ -187,31 +187,29 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* _("Select a folder with PCSX2 plugins") ) ) { - wxSizer& s_main( *GetSizer() ); wxFlexGridSizer& s_plugin( *new wxFlexGridSizer( NumPluginTypes, 3, 16, 10 ) ); s_plugin.SetFlexibleDirection( wxHORIZONTAL ); s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width. for( int i=0; iSetClientData( (void*)(int)tbl_PluginInfo[i].id ); - s_plugin.Add( bleh ); + wxStaticText* text = new wxStaticText( this, wxID_ANY, tbl_PluginInfo[i].GetShortname() ); + + m_combobox[i] = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + + wxButton* confButton = new wxButton( this, ButtonId_Configure, L"Configure..." ); + confButton->SetClientData( (void*)(int)tbl_PluginInfo[i].id ); + + s_plugin += text | wxSF.Border( wxTOP | wxLEFT, 2 ); + s_plugin += m_combobox[i] | wxSF.Expand(); + s_plugin += confButton; } m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") ); - s_main.Add( &s_plugin, wxSizerFlags().Expand() ); - s_main.AddSpacer( 6 ); - s_main.Add( &m_FolderPicker, pxSizerFlags::StdExpand() ); + *this += s_plugin | wxSF.Expand(); + *this += 6; + *this += m_FolderPicker | StdExpand(); } void Panels::PluginSelectorPanel::ComboBoxPanel::Reset() @@ -236,8 +234,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWid // note: the status panel is a floating window, so that it can be positioned in the // center of the dialog after it's been fitted to the contents. - wxSizer& s_main( *GetSizer() ); - s_main.Add( m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() ); + *this += m_ComponentBoxes | StdExpand().ReserveSpaceEvenIfHidden(); m_StatusPanel->Hide(); m_ComponentBoxes->Hide(); diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index 4a7f6a71db..04a786bdd0 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -218,41 +218,39 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) : // ------------------------------------------------------------------------ // Layout and Size ---> (!!) - eeSliderPanel->GetSizer()->Add( m_slider_eecycle, sliderFlags ); - m_msg_eecycle->AddTo( *eeSliderPanel->GetSizer() ); + wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 2, 0, 12 ) ); + DefEnableSizer.AddGrowableCol( 1, 1 ); + DefEnableSizer += m_button_Defaults | StdSpace().Align( wxALIGN_LEFT ); + DefEnableSizer += m_check_Enable | StdSpace().Align( wxALIGN_RIGHT ); - vuSliderPanel->GetSizer()->Add( m_slider_vustealer, sliderFlags ); - m_msg_vustealer->AddTo( *vuSliderPanel->GetSizer() ); + *eeSliderPanel += m_slider_eecycle | sliderFlags; + *eeSliderPanel += m_msg_eecycle; - vuHacksPanel->GetSizer()->Add( m_check_vuFlagHack, StdExpand() ); - vuHacksPanel->GetSizer()->Add( m_check_vuMinMax, StdExpand() ); + *vuSliderPanel += m_slider_vustealer | sliderFlags; + *vuSliderPanel += m_msg_vustealer; - miscHacksPanel->GetSizer()->Add( m_check_intc ); - miscHacksPanel->GetSizer()->Add( m_check_b1fc0 ); - miscHacksPanel->GetSizer()->Add( m_check_IOPx2 ); + *vuHacksPanel += m_check_vuFlagHack; + *vuHacksPanel += m_check_vuMinMax; - left->GetSizer()->Add( eeSliderPanel, StdExpand() ); - left->GetSizer()->Add( miscHacksPanel, StdExpand() ); + *miscHacksPanel += m_check_intc; + *miscHacksPanel += m_check_b1fc0; + *miscHacksPanel += m_check_IOPx2; - right->GetSizer()->Add( vuSliderPanel, StdExpand() ); - right->GetSizer()->Add( vuHacksPanel, StdExpand() ); + *left += eeSliderPanel | StdExpand(); + *left += miscHacksPanel | StdExpand(); + + *right += vuSliderPanel | StdExpand(); + *right += vuHacksPanel | StdExpand(); s_table = new wxFlexGridSizer( 2 ); s_table->AddGrowableCol( 0 ); s_table->AddGrowableCol( 1 ); - s_table->Add( left, wxSizerFlags().Expand() ); - s_table->Add( right, wxSizerFlags().Expand() ); + *s_table+= left | wxSF.Expand(); + *s_table+= right | wxSF.Expand(); - wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 2, 0, 12 ) ); - DefEnableSizer.AddGrowableCol( 1, 1 ); - DefEnableSizer.Add( m_button_Defaults, StdSpace().Align( wxALIGN_LEFT ) ); - DefEnableSizer.Add( m_check_Enable, StdSpace().Align( wxALIGN_RIGHT ) ); - - wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); - heading->AddTo( mainSizer ); - mainSizer.Add( s_table, wxSizerFlags().Expand() ); - mainSizer.Add( &DefEnableSizer, wxSizerFlags().Expand() ); - SetSizer( &mainSizer ); + *this += heading; + *this += s_table | wxSF.Expand(); + *this += DefEnableSizer | wxSF.Expand(); // ------------------------------------------------------------------------ @@ -294,19 +292,19 @@ void Panels::SpeedHacksPanel::OnSettingsChanged( const Pcsx2Config::SpeedhackOpt { const bool enabled = g_Conf->EnableSpeedHacks; - m_check_Enable->SetValue( !!enabled ); + m_check_Enable ->SetValue( !!enabled ); - m_slider_eecycle->SetValue( opts.EECycleRate + 1 ); - m_slider_vustealer->SetValue( opts.VUCycleSteal ); + m_slider_eecycle ->SetValue( opts.EECycleRate + 1 ); + m_slider_vustealer ->SetValue( opts.VUCycleSteal ); SetEEcycleSliderMsg(); SetVUcycleSliderMsg(); - m_check_vuFlagHack->SetValue(opts.vuFlagHack); - m_check_vuMinMax->SetValue(opts.vuMinMax); - m_check_intc->SetValue(opts.IntcStat); - m_check_b1fc0->SetValue(opts.BIFC0); - m_check_IOPx2->SetValue(opts.IopCycleRate_X2); + m_check_vuFlagHack ->SetValue(opts.vuFlagHack); + m_check_vuMinMax ->SetValue(opts.vuMinMax); + m_check_intc ->SetValue(opts.IntcStat); + m_check_b1fc0 ->SetValue(opts.BIFC0); + m_check_IOPx2 ->SetValue(opts.IopCycleRate_X2); EnableStuff(); @@ -316,7 +314,10 @@ void Panels::SpeedHacksPanel::OnSettingsChanged( const Pcsx2Config::SpeedhackOpt void Panels::SpeedHacksPanel::Apply() { + g_Conf->EnableSpeedHacks = m_check_Enable->GetValue(); + Pcsx2Config::SpeedhackOptions& opts( g_Conf->EmuOptions.Speedhacks ); + opts.EECycleRate = m_slider_eecycle->GetValue()-1; opts.VUCycleSteal = m_slider_vustealer->GetValue(); diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp index 73f3d75d77..d239c1db51 100644 --- a/pcsx2/gui/Panels/VideoPanel.cpp +++ b/pcsx2/gui/Panels/VideoPanel.cpp @@ -57,8 +57,6 @@ wxTextCtrl* CreateNumericalTextCtrl( wxWindow* parent, int digits ) Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) : BaseApplicableConfigPanel( parent ) { - wxSizer& s_main( *GetSizer() ); - m_check_LimiterDisable = new pxCheckBox( this, _("Disable Framelimiting"), _("Useful for running benchmarks. Toggle this option in-game by pressing F4.") ); @@ -67,13 +65,6 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) L"be available either." ) ); - AddStaticText( s_main, pxE( ".Framelimiter:Heading", - L"The internal framelimiter regulates the speed of the virtual machine. Adjustment values below are in " - L"percentages of the default region-based framerate, which can also be configured below." - ) ); - - s_main.Add( m_check_LimiterDisable ); - m_spin_NominalPct = FitToDigits( new wxSpinCtrl( this ), 6 ); m_spin_SlomoPct = FitToDigits( new wxSpinCtrl( this ), 6 ); m_spin_TurboPct = FitToDigits( new wxSpinCtrl( this ), 6 ); @@ -81,57 +72,71 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) m_text_BaseNtsc = CreateNumericalTextCtrl( this, 7 ); m_text_BasePal = CreateNumericalTextCtrl( this, 7 ); - wxFlexGridSizer& s_spins = *new wxFlexGridSizer( 5 ); + m_spin_NominalPct ->SetRange( 10, 1000 ); + m_spin_SlomoPct ->SetRange( 1, 1000 ); + m_spin_TurboPct ->SetRange( 10, 1000 ); - //s_spins.AddGrowableCol( 0, 1 ); - //s_spins.AddGrowableCol( 1, 1 ); + // ------------------------------------------------------------ + // Sizers and Layouts - AddStaticText( s_spins, _("Base Framerate Adjust:"), wxALIGN_LEFT ); - s_spins.AddSpacer( 5 ); - s_spins.Add( m_spin_NominalPct, wxSizerFlags().Border(wxTOP, 3) ); - s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), StdSpace() ); - s_spins.AddSpacer( 5 ); + *this += new pxStaticHeading( this, pxE( ".Framelimiter:Heading", + L"The internal framelimiter regulates the speed of the virtual machine. Adjustment values below are in " + L"percentages of the default region-based framerate, which can also be configured below." ) + ); - AddStaticText( s_spins, _("Slow Motion Adjust:"), wxALIGN_LEFT ); - s_spins.AddSpacer( 5 ); - s_spins.Add( m_spin_SlomoPct, wxSizerFlags().Border(wxTOP, 3) ); - s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), StdSpace() ); - s_spins.AddSpacer( 5 ); + *this += m_check_LimiterDisable; - AddStaticText( s_spins, _("Turbo Adjust:"), wxALIGN_LEFT ); - s_spins.AddSpacer( 5 ); - s_spins.Add( m_spin_TurboPct, wxSizerFlags().Border(wxTOP, 3) ); - s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), StdSpace() ); - s_spins.AddSpacer( 5 ); + wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 5 ) ); + s_spins.AddGrowableCol( 0 ); - s_spins.AddSpacer( 15 ); - s_spins.AddSpacer( 15 ); - s_spins.AddSpacer( 15 ); - s_spins.AddSpacer( 15 ); - s_spins.AddSpacer( 15 ); + s_spins += new pxStaticText( this, _("Base Framerate Adjust:") ); + s_spins += 5; + s_spins += m_spin_NominalPct | wxSF.Border(wxTOP, 3); + s_spins += new pxStaticText( this, L"%" ); + s_spins += 5; - AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT ); - s_spins.AddSpacer( 5 ); - s_spins.Add( m_text_BaseNtsc, wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxTOP, 3) ); - s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() ); - s_spins.AddSpacer( 5 ); + s_spins += new pxStaticText( this, _("Slow Motion Adjust:") ); + s_spins += 5; + s_spins += m_spin_SlomoPct | wxSF.Border(wxTOP, 3); + s_spins += new pxStaticText( this, L"%" ); + s_spins += 5; - AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT ); - s_spins.AddSpacer( 5 ); - s_spins.Add( m_text_BasePal, wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxTOP, 3) ); - s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() ); - s_spins.AddSpacer( 5 ); + s_spins += new pxStaticText( this, _("Turbo Adjust:") ); + s_spins += 5; + s_spins += m_spin_TurboPct | wxSF.Border(wxTOP, 3); + s_spins += new pxStaticText( this, L"%" ); + s_spins += 5; - s_main.Add( &s_spins ); + s_spins += 15; + s_spins += 15; + s_spins += 15; + s_spins += 15; + s_spins += 15; + + wxFlexGridSizer& s_fps( *new wxFlexGridSizer( 5 ) ); + s_fps.AddGrowableCol( 0 ); + + s_fps += new pxStaticText( this, _("NTSC Framerate:") ); + s_fps += 5; + s_fps += m_text_BaseNtsc | wxSF.Align(wxALIGN_RIGHT).Border(wxTOP, 3); + s_fps += new pxStaticText( this, _("FPS") ); + s_fps += 5; + + s_fps += new pxStaticText( this, _("PAL Framerate:") ); + s_fps += 5; + s_fps += m_text_BasePal | wxSF.Align(wxALIGN_RIGHT).Border(wxTOP, 3); + s_fps += new pxStaticText( this, _("FPS") ); + s_fps += 5; + + *this += s_spins | wxSizerFlags().Expand(); + *this += s_fps | wxSizerFlags().Expand(); + m_spin_NominalPct ->SetValue( 100 ); + m_spin_SlomoPct ->SetValue( 50 ); + m_spin_TurboPct ->SetValue( 100 ); - m_spin_NominalPct->SetValue( 100 ); - m_spin_SlomoPct->SetValue( 50 ); - m_spin_TurboPct->SetValue( 100 ); - - m_text_BaseNtsc->SetValue( L"59.94" ); - m_text_BasePal->SetValue( L"50.00" ); - + m_text_BaseNtsc ->SetValue( L"59.94" ); + m_text_BasePal ->SetValue( L"50.00" ); } void Panels::FramelimiterPanel::Apply() @@ -177,33 +182,27 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) // Layout and Positioning wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) ); - s_customsize.Add( m_text_WindowWidth ); - AddStaticText( s_customsize, _("x") ); - s_customsize.Add( m_text_WindowHeight ); + s_customsize += m_text_WindowWidth; + s_customsize += new pxStaticText( this, L"x" ); + s_customsize += m_text_WindowHeight; //wxFlexGridSizer& s_winsize( *new wxFlexGridSizer( 2 ) ); //s_winsize.AddGrowableCol( 0 ); - wxStaticBoxSizer& s_winsize( *new wxStaticBoxSizer( wxVERTICAL, this, _("Window Size:") ) ); - //AddStaticText( s_winsize, _("Window Size:") ); - AddStaticText( s_winsize, _("Custom Window Size: "), wxALIGN_LEFT ); - s_winsize.Add( &s_customsize, StdSpace().Border( wxLEFT | wxRIGHT | wxBOTTOM) ); + wxStaticBoxSizer& s_winsize( *new wxStaticBoxSizer( wxVERTICAL, this, _("Custom Window Size:") ) ); + s_winsize += s_customsize | StdSpace().Border( wxLEFT | wxRIGHT | wxBOTTOM); + *this += s_winsize | StdSpace(); + + *this += m_check_SizeLock; + *this += m_check_AspectLock; + *this += m_check_Fullscreen; + *this += m_check_CloseGS; + *this += m_check_VsyncEnable; - wxSizer& s_main( *GetSizer() ); - - s_main.Add( &s_winsize, StdSpace() ); - - s_main.Add( m_check_SizeLock ); - s_main.Add( m_check_AspectLock ); - s_main.Add( m_check_Fullscreen ); - s_main.Add( m_check_CloseGS ); - s_main.Add( m_check_VsyncEnable ); - - - m_text_WindowWidth->SetValue( L"640" ); - m_text_WindowHeight->SetValue( L"480" ); - m_check_CloseGS->SetValue( g_Conf->CloseGSonEsc ); + m_text_WindowWidth ->SetValue( L"640" ); + m_text_WindowHeight ->SetValue( L"480" ); + m_check_CloseGS ->SetValue( g_Conf->CloseGSonEsc ); } @@ -225,16 +224,15 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) : FramelimiterPanel* fpan = new FramelimiterPanel( right ); fpan->AddStaticBox(_("Framelimiter")); - wxSizer& s_main( *GetSizer() ); wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 ); - left->GetSizer()->Add( winpan, wxSizerFlags().Expand() ); - right->GetSizer()->Add( fpan, wxSizerFlags().Expand() ); + *left += winpan | wxSizerFlags().Expand(); + *right += fpan | wxSizerFlags().Expand(); - s_table->Add( left, StdExpand() ); - s_table->Add( right, StdExpand() ); + *s_table += left | StdExpand(); + *s_table += right | StdExpand(); - s_main.Add( s_table ); + *this += s_table; // TODO: // Framelimiting / Frameskipping / Vsync