* 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
This commit is contained in:
Jake.Stine 2009-11-19 05:08:24 +00:00
parent 787d39c8bc
commit 4ba3fd07dc
22 changed files with 410 additions and 267 deletions

View File

@ -416,7 +416,7 @@
// Default is 1. // Default is 1.
// //
// Recommended setting: 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. // Compile in classes for run-time DLL loading and function calling.
// Required by wxUSE_DIALUP_MANAGER. // Required by wxUSE_DIALUP_MANAGER.
@ -429,7 +429,7 @@
#define wxUSE_DYNLIB_CLASS 1 #define wxUSE_DYNLIB_CLASS 1
// experimental, don't use for now // experimental, don't use for now
#define wxUSE_DYNAMIC_LOADER 1 #define wxUSE_DYNAMIC_LOADER 0
// Set to 1 to use socket classes // Set to 1 to use socket classes
#define wxUSE_SOCKETS 1 #define wxUSE_SOCKETS 1
@ -526,7 +526,7 @@
#define wxUSE_SYSTEM_OPTIONS 1 #define wxUSE_SYSTEM_OPTIONS 1
// wxSound class // wxSound class
#define wxUSE_SOUND 1 #define wxUSE_SOUND 0
// Use wxMediaCtrl // Use wxMediaCtrl
// //
@ -547,7 +547,7 @@
// Default is 1 // Default is 1
// //
// Recommended setting: 1 (requires wxUSE_XML) // 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 // XML parsing classes. Note that their API will change in the future, so
// using wxXmlDocument and wxXmlNode in your app is not recommended. // using wxXmlDocument and wxXmlNode in your app is not recommended.
@ -1072,7 +1072,7 @@
#define wxUSE_RESOURCES 0 #define wxUSE_RESOURCES 0
// 0 for no wxGetResource/wxWriteResource // 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1 #define wxUSE_CONSTRAINTS 0
// 0 for no window layout constraint system // 0 for no window layout constraint system
#define wxUSE_SPLINES 1 #define wxUSE_SPLINES 1

View File

@ -416,7 +416,7 @@
// Default is 1. // Default is 1.
// //
// Recommended setting: 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. // Compile in classes for run-time DLL loading and function calling.
// Required by wxUSE_DIALUP_MANAGER. // Required by wxUSE_DIALUP_MANAGER.
@ -429,7 +429,7 @@
#define wxUSE_DYNLIB_CLASS 1 #define wxUSE_DYNLIB_CLASS 1
// experimental, don't use for now // experimental, don't use for now
#define wxUSE_DYNAMIC_LOADER 1 #define wxUSE_DYNAMIC_LOADER 0
// Set to 1 to use socket classes // Set to 1 to use socket classes
#define wxUSE_SOCKETS 1 #define wxUSE_SOCKETS 1
@ -526,7 +526,7 @@
#define wxUSE_SYSTEM_OPTIONS 1 #define wxUSE_SYSTEM_OPTIONS 1
// wxSound class // wxSound class
#define wxUSE_SOUND 1 #define wxUSE_SOUND 0
// Use wxMediaCtrl // Use wxMediaCtrl
// //
@ -547,7 +547,7 @@
// Default is 1 // Default is 1
// //
// Recommended setting: 1 (requires wxUSE_XML) // 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 // XML parsing classes. Note that their API will change in the future, so
// using wxXmlDocument and wxXmlNode in your app is not recommended. // using wxXmlDocument and wxXmlNode in your app is not recommended.
@ -1072,7 +1072,7 @@
#define wxUSE_RESOURCES 0 #define wxUSE_RESOURCES 0
// 0 for no wxGetResource/wxWriteResource // 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1 #define wxUSE_CONSTRAINTS 0
// 0 for no window layout constraint system // 0 for no window layout constraint system
#define wxUSE_SPLINES 1 #define wxUSE_SPLINES 1

View File

@ -443,7 +443,7 @@
#define wxUSE_DYNLIB_CLASS 1 #define wxUSE_DYNLIB_CLASS 1
// experimental, don't use for now // experimental, don't use for now
#define wxUSE_DYNAMIC_LOADER 1 #define wxUSE_DYNAMIC_LOADER 0
// Set to 1 to use socket classes // Set to 1 to use socket classes
#define wxUSE_SOCKETS 1 #define wxUSE_SOCKETS 1
@ -540,7 +540,7 @@
#define wxUSE_SYSTEM_OPTIONS 1 #define wxUSE_SYSTEM_OPTIONS 1
// wxSound class // wxSound class
#define wxUSE_SOUND 1 #define wxUSE_SOUND 0
// Use wxMediaCtrl // Use wxMediaCtrl
// //
@ -561,7 +561,7 @@
// Default is 1 // Default is 1
// //
// Recommended setting: 1 (requires wxUSE_XML) // 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 // XML parsing classes. Note that their API will change in the future, so
// using wxXmlDocument and wxXmlNode in your app is not recommended. // using wxXmlDocument and wxXmlNode in your app is not recommended.
@ -1086,7 +1086,7 @@
#define wxUSE_RESOURCES 1 #define wxUSE_RESOURCES 1
// 0 for no wxGetResource/wxWriteResource // 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1 #define wxUSE_CONSTRAINTS 0
// 0 for no window layout constraint system // 0 for no window layout constraint system
#define wxUSE_SPLINES 1 #define wxUSE_SPLINES 1

View File

@ -438,7 +438,7 @@
// experimental, don't use for now // experimental, don't use for now
#if defined(__WIN32__) #if defined(__WIN32__)
#define wxUSE_DYNAMIC_LOADER 1 #define wxUSE_DYNAMIC_LOADER 0
#else #else
#define wxUSE_DYNAMIC_LOADER 0 #define wxUSE_DYNAMIC_LOADER 0
#endif #endif
@ -532,7 +532,7 @@
#define wxUSE_SYSTEM_OPTIONS 1 #define wxUSE_SYSTEM_OPTIONS 1
// wxSound class // wxSound class
#define wxUSE_SOUND 1 #define wxUSE_SOUND 0
// Use wxMediaCtrl // Use wxMediaCtrl
// //
@ -560,7 +560,7 @@
// Default is 1 // Default is 1
// //
// Recommended setting: 1 (requires wxUSE_XML) // 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 // XML parsing classes. Note that their API will change in the future, so
// using wxXmlDocument and wxXmlNode in your app is not recommended. // using wxXmlDocument and wxXmlNode in your app is not recommended.
@ -1134,7 +1134,7 @@
#define wxUSE_RESOURCES 0 #define wxUSE_RESOURCES 0
// Window layout constraint system // Window layout constraint system
#define wxUSE_CONSTRAINTS 1 #define wxUSE_CONSTRAINTS 0
// Splines // Splines
#define wxUSE_SPLINES 1 #define wxUSE_SPLINES 1

View File

@ -55,3 +55,15 @@ public:
protected: protected:
void Init( const wxString& label, const wxString& subtext ); 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<pxCheckBox>& src )
{
target.Add( src.window, src.flags );
}

View File

@ -61,18 +61,16 @@ struct RadioPanelObjects
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// pxRadioPanel // pxRadioPanel
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
//
// Rationale:
// Radio buttons work best when they are created consecutively, and then their subtext // 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 // 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 // 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 // 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 // design. This makes a few other things nicer as well, such as binding a single message
// handler to all radio buttons in the panel. // 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 class pxRadioPanel : public wxPanelWithHelpers
{ {
protected: protected:

View File

@ -21,6 +21,35 @@
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// pxStaticText // 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 class pxStaticText : public wxStaticText
{ {
typedef wxStaticText _parent; typedef wxStaticText _parent;
@ -45,14 +74,38 @@ public:
wxSize GetMinSize() const; wxSize GetMinSize() const;
//void DoMoveWindow(int x, int y, int width, int height); //void DoMoveWindow(int x, int y, int width, int height);
void AddTo( wxSizer& sizer ); void AddTo( wxSizer& sizer, wxSizerFlags flags=pxSizerFlags::StdSpace() );
void InsertAt( wxSizer& sizer, int position ); 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; int GetIdealWidth() const;
protected: protected:
void _setLabel(); 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<pxStaticText>& 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 class pxStaticHeading : public pxStaticText
{ {
public: public:

View File

@ -26,6 +26,130 @@
class pxStaticText; class pxStaticText;
class pxCheckBox; 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<WinType> operator | ( WinType* _win, const wxSizerFlags& _flgs )
{
pxWindowAndFlags<WinType> result = { _win, _flgs };
return result;
}
template< typename WinType >
static pxWindowAndFlags<WinType> operator | ( WinType& _win, const wxSizerFlags& _flgs )
{
pxWindowAndFlags<WinType> result = { &_win, _flgs };
return result;
}
template< typename WinType >
static pxWindowAndFlags<WinType> operator | ( const wxSizerFlags& _flgs, WinType* _win )
{
pxWindowAndFlags<WinType> result = { _win, _flgs };
return result;
}
template< typename WinType >
static pxWindowAndFlags<WinType> operator | ( const wxSizerFlags& _flgs, WinType& _win )
{
pxWindowAndFlags<WinType> 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<WinType>& 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<WinType>& 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<WinType>& 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 // 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 ); wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
virtual ~wxDialogWithHelpers() throw(); virtual ~wxDialogWithHelpers() throw();
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE );
void AddOkCancel( wxSizer& sizer, bool hasApply=false ); void AddOkCancel( wxSizer& sizer, bool hasApply=false );
wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; } wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; }
@ -78,6 +201,20 @@ protected:
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// wxPanelWithHelpers // 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 class wxPanelWithHelpers : public wxPanel
{ {
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers) DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers)
@ -92,7 +229,6 @@ public:
explicit wxPanelWithHelpers( wxWindow* parent=NULL ); explicit wxPanelWithHelpers( wxWindow* parent=NULL );
wxPanelWithHelpers* AddStaticBox( const wxString& label, wxOrientation orient=wxVERTICAL ); wxPanelWithHelpers* AddStaticBox( const wxString& label, wxOrientation orient=wxVERTICAL );
pxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE );
// TODO : Propagate to children? // TODO : Propagate to children?
wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; } wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; }

View File

@ -20,8 +20,6 @@
namespace wxHelpers 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 ); extern pxStaticText& InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags=wxALIGN_CENTRE );
} }

View File

@ -31,7 +31,8 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext)
{ {
m_subtext = NULL; m_subtext = NULL;
m_checkbox = new wxCheckBox( this, wxID_ANY, label ); m_checkbox = new wxCheckBox( this, wxID_ANY, label );
GetSizer()->Add( m_checkbox, pxSizerFlags::StdExpand() );
*this += m_checkbox | pxSizerFlags::StdExpand();
static const int Indentation = 23; static const int Indentation = 23;
if( !subtext.IsEmpty() ) if( !subtext.IsEmpty() )
@ -40,11 +41,12 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext)
if( HasIdealWidth() ) if( HasIdealWidth() )
m_subtext->SetWrapWidth( m_idealWidth - Indentation ); m_subtext->SetWrapWidth( m_idealWidth - Indentation );
wxBoxSizer& spaced = *new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer& spaced( *new wxBoxSizer( wxHORIZONTAL ) );
spaced.AddSpacer( Indentation ); spaced += Indentation;
spaced.Add( m_subtext, wxSizerFlags().Border( wxBOTTOM, 9 ) ); spaced += m_subtext | wxSF.Border( wxBOTTOM, 9 );
spaced.AddSpacer( pxSizerFlags::StdPadding ); spaced += pxSizerFlags::StdPadding;
GetSizer()->Add( &spaced );
*this += &spaced;
} }
} }

View File

@ -113,6 +113,9 @@ void pxRadioPanel::_setToolTipImmediate( int idx, const wxString &tip )
woot->SetToolTip( wrapped ); 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) pxRadioPanel& pxRadioPanel::SetToolTip(int idx, const wxString &tip)
{ {
m_buttonStrings[idx].SetToolTip( tip ); m_buttonStrings[idx].SetToolTip( tip );

View File

@ -19,8 +19,6 @@
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// pxStaticText Implementations // 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 ) pxStaticText::pxStaticText( wxWindow* parent, const wxString& label, int style )
: wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style ) : wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style )
@ -63,15 +61,15 @@ pxStaticText& pxStaticText::SetToolTip( const wxString& tip )
return *this; 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(); _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(); _setLabel();
} }
@ -114,15 +112,9 @@ wxSize pxStaticText::GetMinSize() const
return wxSize( std::min( ideal, minSize.x ), minSize.y ); return wxSize( std::min( ideal, minSize.x ), minSize.y );
} }
/*pxStaticText::operator wxSizerFlags() const
{
return pxSizerFlags::StdSpace().Align( m_alignflags );
}*/
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// pxStaticHeading Implementations // pxStaticHeading Implementations
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
pxStaticHeading::pxStaticHeading( wxWindow* parent, const wxString& label, int style ) pxStaticHeading::pxStaticHeading( wxWindow* parent, const wxString& label, int style )
: pxStaticText( parent, label, style ) : pxStaticText( parent, label, style )
{ {

View File

@ -22,25 +22,6 @@
#include <wx/tooltip.h> #include <wx/tooltip.h>
// ------------------------------------------------------------------------
// 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& wxHelpers::InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags )
{ {
pxStaticText& temp( *new pxStaticText(parent, label, alignFlags ) ); pxStaticText& temp( *new pxStaticText(parent, label, alignFlags ) );
@ -102,11 +83,6 @@ void wxDialogWithHelpers::OnActivate(wxActivateEvent& evt)
//evt.Skip(); //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 ) void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
{ {
wxSizer* buttonSizer = &sizer; wxSizer* buttonSizer = &sizer;
@ -221,20 +197,3 @@ wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, co
{ {
Init(); 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 );
}

View File

@ -86,16 +86,16 @@ void Pcsx2App::ReadUserModeSettings()
wxDialogWithHelpers preAlpha( NULL, wxID_ANY, _("It might devour your kittens! - PCSX2 0.9.7 Pre-Alpha"), false ); wxDialogWithHelpers preAlpha( NULL, wxID_ANY, _("It might devour your kittens! - PCSX2 0.9.7 Pre-Alpha"), false );
preAlpha.SetIdealWidth( 575 ); preAlpha.SetIdealWidth( 575 );
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); preAlpha.SetSizer( new wxBoxSizer( wxVERTICAL ) );
preAlpha.AddStaticText( s_main, 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"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"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"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 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 += new wxButton( &preAlpha, wxID_OK ) | pxSizerFlags::StdCenter();
preAlpha.SetSizerAndFit( &s_main ); preAlpha.Fit();
preAlpha.CentreOnScreen(); preAlpha.CentreOnScreen();
preAlpha.ShowModal(); preAlpha.ShowModal();

View File

@ -82,9 +82,9 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ):
"F|RES, MrBrown, razorblade, Seta-san, Skarmeth, feal87" "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! // This sizer holds text of the authors and a logo!
wxBoxSizer& AuthLogoSizer = *new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer& AuthLogoSizer = *new wxBoxSizer( wxHORIZONTAL );
@ -112,19 +112,20 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ):
ContribSizer.Add( &m_bitmap_dualshock, pxSizerFlags::StdSpace() ); ContribSizer.Add( &m_bitmap_dualshock, pxSizerFlags::StdSpace() );
ContribSizer.AddStretchSpacer( 1 ); ContribSizer.AddStretchSpacer( 1 );
mainSizer.Add( &AuthLogoSizer, pxSizerFlags::StdSpace() ); *this += AuthLogoSizer | pxSizerFlags::StdSpace();
mainSizer.Add( new wxHyperlinkCtrl( *this += new wxHyperlinkCtrl( this, wxID_ANY,
this, wxID_ANY, L"Pcsx2 Official Website and Forums" , L"http://www.pcsx2.net" ), _("Pcsx2 Official Website and Forums"), L"http://www.pcsx2.net"
wxSizerFlags(1).Center().Border( wxALL, 3 ) ); ) | 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 ) );
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() ); *this += ContribSizer | pxSizerFlags::StdExpand();
SetSizerAndFit( &mainSizer );
*this += new wxButton( this, wxID_OK, L"I've seen enough") | pxSizerFlags::StdCenter();
Fit();
CenterOnScreen(); CenterOnScreen();
} }

View File

@ -27,15 +27,14 @@ Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id )
m_panel_usersel = new UsermodeSelectionPanel( this, false ); m_panel_usersel = new UsermodeSelectionPanel( this, false );
m_panel_langsel = new LanguageSelectionPanel( this ); 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() ); AddOkCancel( *GetSizer() );
s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) ); Fit();
AddOkCancel( s_main );
SetSizerAndFit( &s_main );
CenterOnScreen(); CenterOnScreen();
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PickUserModeDialog::OnOk_Click ) ); Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PickUserModeDialog::OnOk_Click ) );

View File

@ -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.") ); m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") );
wxSizer& sizer( *GetSizer() ); *this += new pxStaticText( this, _("Select a BIOS rom:") );
AddStaticText( sizer, _("Select a BIOS rom:"), wxALIGN_LEFT ); *this += m_ComboBox | pxSizerFlags::StdExpand();
sizer.Add( &m_ComboBox, pxSizerFlags::StdExpand() ); *this += 6;
sizer.AddSpacer( 6 ); *this += m_FolderPicker | pxSizerFlags::StdExpand();
sizer.Add( &m_FolderPicker, pxSizerFlags::StdExpand() );
} }
Panels::BiosSelectorPanel::~BiosSelectorPanel() throw () Panels::BiosSelectorPanel::~BiosSelectorPanel() throw ()

View File

@ -21,19 +21,18 @@ using namespace wxHelpers;
Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) :
BaseApplicableConfigPanel( parent ) BaseApplicableConfigPanel( parent )
{ {
wxSizer& mainSizer( *GetSizer() ); *this += new pxStaticHeading( this, _("Some games need special settings.\nEnable them here."));
AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") );
wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") );
// NOTE: Order of checkboxes must match the order of the bits in the GamefixOptions structure! // 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 :) // NOTE2: Don't make this static, because translations can change at run-time :)
struct CheckTextMess struct CheckTextMess
{ {
wxString label, tooltip; wxString label, tooltip;
}; };
const CheckTextMess check_text[NUM_OF_GAME_FIXES] = 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 ); const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes );
for( int i=0; i<NUM_OF_GAME_FIXES; ++i ) for( int i=0; i<NUM_OF_GAME_FIXES; ++i )
{ {
groupSizer.Add( m_checkbox[i] = new pxCheckBox( this, check_text[i].label ) ); groupSizer += (m_checkbox[i] = new pxCheckBox( this, check_text[i].label ));
m_checkbox[i]->SetToolTip( check_text[i].tooltip ); m_checkbox[i]->SetToolTip( check_text[i].tooltip );
m_checkbox[i]->SetValue( !!(opts.bitset & (1 << i)) ); 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"Enabling game fixes can cause compatibility or performance issues in other games. You "
L"will need to turn off fixes manually when changing games." L"will need to turn off fixes manually when changing games."
)); ));

View File

@ -167,10 +167,9 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool i
m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 ); m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 );
m_radio_UserMode->Realize(); m_radio_UserMode->Realize();
wxSizer& s_main( *GetSizer() ); *this += new pxStaticText( this, isFirstTime ? usermodeExplained : usermodeWarning );
AddStaticText( s_main, isFirstTime ? usermodeExplained : usermodeWarning ); *this += m_radio_UserMode | pxSizerFlags::StdExpand();
s_main.Add( m_radio_UserMode, pxSizerFlags::StdExpand() ); *this += 4;
s_main.AddSpacer( 4 );
} }
void Panels::UsermodeSelectionPanel::Apply() void Panels::UsermodeSelectionPanel::Apply()
@ -180,7 +179,7 @@ void Panels::UsermodeSelectionPanel::Apply()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent ) : BaseApplicableConfigPanel( parent, wxHORIZONTAL )
, m_langs() , m_langs()
{ {
m_picker = NULL; m_picker = NULL;
@ -202,12 +201,9 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT ); size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT );
m_picker->SetSelection( cursel ); m_picker->SetSelection( cursel );
wxBoxSizer& s_lang = *new wxBoxSizer( wxHORIZONTAL ); *this += new pxStaticText( this, _("Select a language: "), wxALIGN_CENTRE_VERTICAL );
AddStaticText( s_lang, _("Select a language: "), wxALIGN_CENTRE_VERTICAL ); *this += 5;
s_lang.AddSpacer( 5 ); *this += m_picker | pxSizerFlags::StdSpace();
s_lang.Add( m_picker, pxSizerFlags::StdSpace() );
SetSizer( &s_lang );
} }
void Panels::LanguageSelectionPanel::Apply() void Panels::LanguageSelectionPanel::Apply()

View File

@ -32,6 +32,7 @@ static const bool DisableThreading =
#endif #endif
using namespace wxHelpers; using namespace wxHelpers;
using namespace pxSizerFlags;
using namespace Threading; using namespace Threading;
BEGIN_DECLARE_EVENT_TYPES() BEGIN_DECLARE_EVENT_TYPES()
@ -149,14 +150,13 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent )
{ {
m_progress = 0; 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..." ) ); *this += new pxStaticHeading( this, _( "Enumerating available plugins..." ) );
s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) ); *this += m_gauge | wxSF.Expand().Border( wxLEFT | wxRIGHT, 32 );
s_main.Add( &m_label, pxSizerFlags::StdExpand() ); *this += m_label | StdExpand();
// The status bar only looks right if I use SetSizerAndFit() here. Fit();
Fit(); // &s_main );
} }
void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len ) void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len )
@ -187,31 +187,29 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel*
_("Select a folder with PCSX2 plugins") ) _("Select a folder with PCSX2 plugins") )
) )
{ {
wxSizer& s_main( *GetSizer() );
wxFlexGridSizer& s_plugin( *new wxFlexGridSizer( NumPluginTypes, 3, 16, 10 ) ); wxFlexGridSizer& s_plugin( *new wxFlexGridSizer( NumPluginTypes, 3, 16, 10 ) );
s_plugin.SetFlexibleDirection( wxHORIZONTAL ); s_plugin.SetFlexibleDirection( wxHORIZONTAL );
s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width. s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width.
for( int i=0; i<NumPluginTypes; ++i ) for( int i=0; i<NumPluginTypes; ++i )
{ {
s_plugin.Add( wxStaticText* text = new wxStaticText( this, wxID_ANY, tbl_PluginInfo[i].GetShortname() );
new wxStaticText( this, wxID_ANY, tbl_PluginInfo[i].GetShortname() ),
wxSizerFlags().Border( wxTOP | wxLEFT, 2 ) m_combobox[i] = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
);
s_plugin.Add( wxButton* confButton = new wxButton( this, ButtonId_Configure, L"Configure..." );
m_combobox[i] = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ), confButton->SetClientData( (void*)(int)tbl_PluginInfo[i].id );
wxSizerFlags().Expand()
); s_plugin += text | wxSF.Border( wxTOP | wxLEFT, 2 );
wxButton* bleh = new wxButton( this, ButtonId_Configure, L"Configure..." ); s_plugin += m_combobox[i] | wxSF.Expand();
bleh->SetClientData( (void*)(int)tbl_PluginInfo[i].id ); s_plugin += confButton;
s_plugin.Add( bleh );
} }
m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") ); m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") );
s_main.Add( &s_plugin, wxSizerFlags().Expand() ); *this += s_plugin | wxSF.Expand();
s_main.AddSpacer( 6 ); *this += 6;
s_main.Add( &m_FolderPicker, pxSizerFlags::StdExpand() ); *this += m_FolderPicker | StdExpand();
} }
void Panels::PluginSelectorPanel::ComboBoxPanel::Reset() 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 // 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. // center of the dialog after it's been fitted to the contents.
wxSizer& s_main( *GetSizer() ); *this += m_ComponentBoxes | StdExpand().ReserveSpaceEvenIfHidden();
s_main.Add( m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
m_StatusPanel->Hide(); m_StatusPanel->Hide();
m_ComponentBoxes->Hide(); m_ComponentBoxes->Hide();

View File

@ -218,41 +218,39 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) :
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Layout and Size ---> (!!) // Layout and Size ---> (!!)
eeSliderPanel->GetSizer()->Add( m_slider_eecycle, sliderFlags ); wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 2, 0, 12 ) );
m_msg_eecycle->AddTo( *eeSliderPanel->GetSizer() ); 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 ); *eeSliderPanel += m_slider_eecycle | sliderFlags;
m_msg_vustealer->AddTo( *vuSliderPanel->GetSizer() ); *eeSliderPanel += m_msg_eecycle;
vuHacksPanel->GetSizer()->Add( m_check_vuFlagHack, StdExpand() ); *vuSliderPanel += m_slider_vustealer | sliderFlags;
vuHacksPanel->GetSizer()->Add( m_check_vuMinMax, StdExpand() ); *vuSliderPanel += m_msg_vustealer;
miscHacksPanel->GetSizer()->Add( m_check_intc ); *vuHacksPanel += m_check_vuFlagHack;
miscHacksPanel->GetSizer()->Add( m_check_b1fc0 ); *vuHacksPanel += m_check_vuMinMax;
miscHacksPanel->GetSizer()->Add( m_check_IOPx2 );
left->GetSizer()->Add( eeSliderPanel, StdExpand() ); *miscHacksPanel += m_check_intc;
left->GetSizer()->Add( miscHacksPanel, StdExpand() ); *miscHacksPanel += m_check_b1fc0;
*miscHacksPanel += m_check_IOPx2;
right->GetSizer()->Add( vuSliderPanel, StdExpand() ); *left += eeSliderPanel | StdExpand();
right->GetSizer()->Add( vuHacksPanel, StdExpand() ); *left += miscHacksPanel | StdExpand();
*right += vuSliderPanel | StdExpand();
*right += vuHacksPanel | StdExpand();
s_table = new wxFlexGridSizer( 2 ); s_table = new wxFlexGridSizer( 2 );
s_table->AddGrowableCol( 0 ); s_table->AddGrowableCol( 0 );
s_table->AddGrowableCol( 1 ); s_table->AddGrowableCol( 1 );
s_table->Add( left, wxSizerFlags().Expand() ); *s_table+= left | wxSF.Expand();
s_table->Add( right, wxSizerFlags().Expand() ); *s_table+= right | wxSF.Expand();
wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 2, 0, 12 ) ); *this += heading;
DefEnableSizer.AddGrowableCol( 1, 1 ); *this += s_table | wxSF.Expand();
DefEnableSizer.Add( m_button_Defaults, StdSpace().Align( wxALIGN_LEFT ) ); *this += DefEnableSizer | wxSF.Expand();
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 );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -294,19 +292,19 @@ void Panels::SpeedHacksPanel::OnSettingsChanged( const Pcsx2Config::SpeedhackOpt
{ {
const bool enabled = g_Conf->EnableSpeedHacks; 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_eecycle ->SetValue( opts.EECycleRate + 1 );
m_slider_vustealer->SetValue( opts.VUCycleSteal ); m_slider_vustealer ->SetValue( opts.VUCycleSteal );
SetEEcycleSliderMsg(); SetEEcycleSliderMsg();
SetVUcycleSliderMsg(); SetVUcycleSliderMsg();
m_check_vuFlagHack->SetValue(opts.vuFlagHack); m_check_vuFlagHack ->SetValue(opts.vuFlagHack);
m_check_vuMinMax->SetValue(opts.vuMinMax); m_check_vuMinMax ->SetValue(opts.vuMinMax);
m_check_intc->SetValue(opts.IntcStat); m_check_intc ->SetValue(opts.IntcStat);
m_check_b1fc0->SetValue(opts.BIFC0); m_check_b1fc0 ->SetValue(opts.BIFC0);
m_check_IOPx2->SetValue(opts.IopCycleRate_X2); m_check_IOPx2 ->SetValue(opts.IopCycleRate_X2);
EnableStuff(); EnableStuff();
@ -316,7 +314,10 @@ void Panels::SpeedHacksPanel::OnSettingsChanged( const Pcsx2Config::SpeedhackOpt
void Panels::SpeedHacksPanel::Apply() void Panels::SpeedHacksPanel::Apply()
{ {
g_Conf->EnableSpeedHacks = m_check_Enable->GetValue();
Pcsx2Config::SpeedhackOptions& opts( g_Conf->EmuOptions.Speedhacks ); Pcsx2Config::SpeedhackOptions& opts( g_Conf->EmuOptions.Speedhacks );
opts.EECycleRate = m_slider_eecycle->GetValue()-1; opts.EECycleRate = m_slider_eecycle->GetValue()-1;
opts.VUCycleSteal = m_slider_vustealer->GetValue(); opts.VUCycleSteal = m_slider_vustealer->GetValue();

View File

@ -57,8 +57,6 @@ wxTextCtrl* CreateNumericalTextCtrl( wxWindow* parent, int digits )
Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent ) : BaseApplicableConfigPanel( parent )
{ {
wxSizer& s_main( *GetSizer() );
m_check_LimiterDisable = new pxCheckBox( this, _("Disable Framelimiting"), m_check_LimiterDisable = new pxCheckBox( this, _("Disable Framelimiting"),
_("Useful for running benchmarks. Toggle this option in-game by pressing F4.") ); _("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." 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_NominalPct = FitToDigits( new wxSpinCtrl( this ), 6 );
m_spin_SlomoPct = FitToDigits( new wxSpinCtrl( this ), 6 ); m_spin_SlomoPct = FitToDigits( new wxSpinCtrl( this ), 6 );
m_spin_TurboPct = 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_BaseNtsc = CreateNumericalTextCtrl( this, 7 );
m_text_BasePal = 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 ); *this += new pxStaticHeading( this, pxE( ".Framelimiter:Heading",
s_spins.AddSpacer( 5 ); L"The internal framelimiter regulates the speed of the virtual machine. Adjustment values below are in "
s_spins.Add( m_spin_NominalPct, wxSizerFlags().Border(wxTOP, 3) ); L"percentages of the default region-based framerate, which can also be configured below." )
s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), StdSpace() ); );
s_spins.AddSpacer( 5 );
AddStaticText( s_spins, _("Slow Motion Adjust:"), wxALIGN_LEFT ); *this += m_check_LimiterDisable;
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 );
AddStaticText( s_spins, _("Turbo Adjust:"), wxALIGN_LEFT ); wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 5 ) );
s_spins.AddSpacer( 5 ); s_spins.AddGrowableCol( 0 );
s_spins.Add( m_spin_TurboPct, wxSizerFlags().Border(wxTOP, 3) );
s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), StdSpace() );
s_spins.AddSpacer( 5 );
s_spins.AddSpacer( 15 ); s_spins += new pxStaticText( this, _("Base Framerate Adjust:") );
s_spins.AddSpacer( 15 ); s_spins += 5;
s_spins.AddSpacer( 15 ); s_spins += m_spin_NominalPct | wxSF.Border(wxTOP, 3);
s_spins.AddSpacer( 15 ); s_spins += new pxStaticText( this, L"%" );
s_spins.AddSpacer( 15 ); s_spins += 5;
AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT ); s_spins += new pxStaticText( this, _("Slow Motion Adjust:") );
s_spins.AddSpacer( 5 ); s_spins += 5;
s_spins.Add( m_text_BaseNtsc, wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxTOP, 3) ); s_spins += m_spin_SlomoPct | wxSF.Border(wxTOP, 3);
s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() ); s_spins += new pxStaticText( this, L"%" );
s_spins.AddSpacer( 5 ); s_spins += 5;
AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT ); s_spins += new pxStaticText( this, _("Turbo Adjust:") );
s_spins.AddSpacer( 5 ); s_spins += 5;
s_spins.Add( m_text_BasePal, wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxTOP, 3) ); s_spins += m_spin_TurboPct | wxSF.Border(wxTOP, 3);
s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() ); s_spins += new pxStaticText( this, L"%" );
s_spins.AddSpacer( 5 ); 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 );
m_spin_NominalPct->SetValue( 100 ); s_fps += new pxStaticText( this, _("NTSC Framerate:") );
m_spin_SlomoPct->SetValue( 50 ); s_fps += 5;
m_spin_TurboPct->SetValue( 100 ); s_fps += m_text_BaseNtsc | wxSF.Align(wxALIGN_RIGHT).Border(wxTOP, 3);
s_fps += new pxStaticText( this, _("FPS") );
s_fps += 5;
m_text_BaseNtsc->SetValue( L"59.94" ); s_fps += new pxStaticText( this, _("PAL Framerate:") );
m_text_BasePal->SetValue( L"50.00" ); 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_text_BaseNtsc ->SetValue( L"59.94" );
m_text_BasePal ->SetValue( L"50.00" );
} }
void Panels::FramelimiterPanel::Apply() void Panels::FramelimiterPanel::Apply()
@ -177,33 +182,27 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
// Layout and Positioning // Layout and Positioning
wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) ); wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) );
s_customsize.Add( m_text_WindowWidth ); s_customsize += m_text_WindowWidth;
AddStaticText( s_customsize, _("x") ); s_customsize += new pxStaticText( this, L"x" );
s_customsize.Add( m_text_WindowHeight ); s_customsize += m_text_WindowHeight;
//wxFlexGridSizer& s_winsize( *new wxFlexGridSizer( 2 ) ); //wxFlexGridSizer& s_winsize( *new wxFlexGridSizer( 2 ) );
//s_winsize.AddGrowableCol( 0 ); //s_winsize.AddGrowableCol( 0 );
wxStaticBoxSizer& s_winsize( *new wxStaticBoxSizer( wxVERTICAL, this, _("Window Size:") ) ); wxStaticBoxSizer& s_winsize( *new wxStaticBoxSizer( wxVERTICAL, this, _("Custom Window Size:") ) );
//AddStaticText( s_winsize, _("Window Size:") ); s_winsize += s_customsize | StdSpace().Border( wxLEFT | wxRIGHT | wxBOTTOM);
AddStaticText( s_winsize, _("Custom Window Size: "), wxALIGN_LEFT );
s_winsize.Add( &s_customsize, StdSpace().Border( wxLEFT | wxRIGHT | wxBOTTOM) );
*this += s_winsize | StdSpace();
wxSizer& s_main( *GetSizer() ); *this += m_check_SizeLock;
*this += m_check_AspectLock;
*this += m_check_Fullscreen;
*this += m_check_CloseGS;
*this += m_check_VsyncEnable;
s_main.Add( &s_winsize, StdSpace() ); m_text_WindowWidth ->SetValue( L"640" );
m_text_WindowHeight ->SetValue( L"480" );
s_main.Add( m_check_SizeLock ); m_check_CloseGS ->SetValue( g_Conf->CloseGSonEsc );
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 );
} }
@ -225,16 +224,15 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) :
FramelimiterPanel* fpan = new FramelimiterPanel( right ); FramelimiterPanel* fpan = new FramelimiterPanel( right );
fpan->AddStaticBox(_("Framelimiter")); fpan->AddStaticBox(_("Framelimiter"));
wxSizer& s_main( *GetSizer() );
wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 ); wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 );
left->GetSizer()->Add( winpan, wxSizerFlags().Expand() ); *left += winpan | wxSizerFlags().Expand();
right->GetSizer()->Add( fpan, wxSizerFlags().Expand() ); *right += fpan | wxSizerFlags().Expand();
s_table->Add( left, StdExpand() ); *s_table += left | StdExpand();
s_table->Add( right, StdExpand() ); *s_table += right | StdExpand();
s_main.Add( s_table ); *this += s_table;
// TODO: // TODO:
// Framelimiting / Frameskipping / Vsync // Framelimiting / Frameskipping / Vsync