diff --git a/common/build/Utilities/utilities.vcproj b/common/build/Utilities/utilities.vcproj
index 2a009cca43..30994b4527 100644
--- a/common/build/Utilities/utilities.vcproj
+++ b/common/build/Utilities/utilities.vcproj
@@ -199,6 +199,10 @@
RelativePath="..\..\src\Utilities\AlignedMalloc.cpp"
>
+
+
@@ -255,10 +259,18 @@
/>
+
+
+
+
@@ -283,6 +295,10 @@
RelativePath="..\..\src\Utilities\wxGuiTools.cpp"
>
+
+
@@ -425,6 +441,10 @@
RelativePath="..\..\include\Utilities\Assertions.h"
>
+
+
@@ -473,10 +493,18 @@
RelativePath="..\..\src\Utilities\PrecompiledHeader.h"
>
+
+
+
+
@@ -513,6 +541,10 @@
RelativePath="..\..\include\Utilities\wxGuiTools.h"
>
+
+
diff --git a/pcsx2/gui/CheckedStaticBox.h b/common/include/Utilities/CheckedStaticBox.h
similarity index 97%
rename from pcsx2/gui/CheckedStaticBox.h
rename to common/include/Utilities/CheckedStaticBox.h
index f20710e285..85a8b7fad1 100644
--- a/pcsx2/gui/CheckedStaticBox.h
+++ b/common/include/Utilities/CheckedStaticBox.h
@@ -19,9 +19,6 @@
class CheckedStaticBox : public wxPanelWithHelpers
{
-protected:
- wxBoxSizer& m_MasterSizer;
-
public:
wxBoxSizer& ThisSizer; // Boxsizer which holds all child items.
wxCheckBox& ThisToggle; // toggle which can enable/disable all child controls
diff --git a/pcsx2/gui/wxHelpers.h b/common/include/Utilities/pxCheckBox.h
similarity index 65%
rename from pcsx2/gui/wxHelpers.h
rename to common/include/Utilities/pxCheckBox.h
index 92a7107148..54774b46ab 100644
--- a/pcsx2/gui/wxHelpers.h
+++ b/common/include/Utilities/pxCheckBox.h
@@ -16,18 +16,9 @@
#pragma once
#include
-#include
+#include "wxGuiTools.h"
-#include "Utilities/wxGuiTools.h"
-
-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 wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int wrapLen=wxDefaultCoord );
- extern wxStaticText& InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags=wxALIGN_CENTRE, int wrapLen=wxDefaultCoord );
-}
-
-// --------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------
// pxCheckBox
// --------------------------------------------------------------------------------------
// The checkbox panel created uses the default spacer setting for adding checkboxes (see
@@ -35,20 +26,18 @@ namespace wxHelpers
// both the checkbox and it's static subtext (if present), and performs word wrapping on
// platforms that need it (eg mswindows).
//
-class pxCheckBox : public wxPanel
+class pxCheckBox : public wxPanelWithHelpers
{
protected:
wxCheckBox* m_checkbox;
- wxStaticText* m_subtext;
- int m_idealWidth;
+ pxStaticText* m_subtext;
public:
- pxCheckBox( wxPanelWithHelpers* parent, const wxString& label, const wxString& subtext=wxEmptyString );
- pxCheckBox( wxDialogWithHelpers* parent, const wxString& label, const wxString& subtext=wxEmptyString );
+ pxCheckBox( wxWindow* parent, const wxString& label, const wxString& subtext=wxEmptyString );
virtual ~pxCheckBox() throw() {}
bool HasSubText() const { return m_subtext != NULL; }
- const wxStaticText* GetSubText() const { return m_subtext; }
+ const pxStaticText* GetSubText() const { return m_subtext; }
pxCheckBox& SetToolTip( const wxString& tip );
pxCheckBox& SetValue( bool val );
@@ -66,6 +55,3 @@ public:
protected:
void Init( const wxString& label, const wxString& subtext );
};
-
-extern bool pxDialogExists( wxWindowID id );
-
diff --git a/common/include/Utilities/pxRadioPanel.h b/common/include/Utilities/pxRadioPanel.h
index 582db0dda8..22d59284bd 100644
--- a/common/include/Utilities/pxRadioPanel.h
+++ b/common/include/Utilities/pxRadioPanel.h
@@ -18,7 +18,6 @@
#include
#include "SafeArray.h"
#include "wxGuiTools.h"
-#include
// --------------------------------------------------------------------------------------
// RadioPanelItem
@@ -90,40 +89,14 @@ protected:
public:
template< int size >
- pxRadioPanel( wxPanelWithHelpers* parent, const RadioPanelItem (&src)[size] )
- : wxPanelWithHelpers( parent, parent->GetIdealWidth()-24 )
+ pxRadioPanel( wxWindow* parent, const RadioPanelItem (&src)[size] )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
{
Init( src, size );
}
- template< int size >
- pxRadioPanel( wxDialogWithHelpers* parent, const RadioPanelItem (&src)[size] )
- : wxDialogWithHelpers( parent, parent->GetIdealWidth()-24 )
- {
- Init( src, size );
- }
-
- template< int size >
- pxRadioPanel( int idealWidth, wxWindow* parent, const RadioPanelItem (&src)[size] )
- : wxPanelWithHelpers( parent, idealWidth )
- {
- Init( src, size );
- }
-
- pxRadioPanel( wxPanelWithHelpers* parent )
- : wxPanelWithHelpers( parent, parent->GetIdealWidth()-24 )
- {
- Init();
- }
-
- pxRadioPanel( wxDialogWithHelpers* parent )
- : wxPanelWithHelpers( parent, parent->GetIdealWidth()-24 )
- {
- Init();
- }
-
- pxRadioPanel( int idealWidth, wxPanelWithHelpers* parent )
- : wxPanelWithHelpers( parent, idealWidth )
+ pxRadioPanel( wxWindow* parent )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
{
Init();
}
diff --git a/common/include/Utilities/pxStaticText.h b/common/include/Utilities/pxStaticText.h
new file mode 100644
index 0000000000..9a3d33bb9b
--- /dev/null
+++ b/common/include/Utilities/pxStaticText.h
@@ -0,0 +1,63 @@
+/* PCSX2 - PS2 Emulator for PCs
+ * Copyright (C) 2002-2009 PCSX2 Dev Team
+ *
+ * PCSX2 is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with PCSX2.
+ * If not, see .
+ */
+
+#pragma once
+
+#include
+#include "wxGuiTools.h"
+
+// --------------------------------------------------------------------------------------
+// pxStaticText
+// --------------------------------------------------------------------------------------
+class pxStaticText : public wxStaticText
+{
+ typedef wxStaticText _parent;
+
+protected:
+ wxString m_message;
+ int m_wrapwidth;
+ int m_alignflags;
+ bool m_unsetLabel;
+ double m_centerPadding;
+
+public:
+ explicit pxStaticText( wxWindow* parent, const wxString& label=wxEmptyString, int style=wxALIGN_LEFT );
+ explicit pxStaticText( wxWindow* parent, int style );
+
+ virtual ~pxStaticText() throw() {}
+
+ 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 );
+ int GetIdealWidth() const;
+
+protected:
+ void _setLabel();
+};
+
+class pxStaticHeading : public pxStaticText
+{
+public:
+ pxStaticHeading( wxWindow* parent, const wxString& label=wxEmptyString, int style=wxALIGN_CENTRE );
+ virtual ~pxStaticHeading() throw() {}
+
+ //using pxStaticText::operator wxSizerFlags;
+};
diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h
index eb22f75d35..da87292fcf 100644
--- a/common/include/Utilities/wxGuiTools.h
+++ b/common/include/Utilities/wxGuiTools.h
@@ -23,6 +23,9 @@
#include
+class pxStaticText;
+class pxCheckBox;
+
// ----------------------------------------------------------------------------
// wxGuiTools.h
//
@@ -34,6 +37,8 @@
namespace pxSizerFlags
{
+ static const int StdPadding = 6;
+
extern wxSizerFlags StdSpace();
extern wxSizerFlags StdCenter();
extern wxSizerFlags StdExpand();
@@ -48,15 +53,18 @@ namespace pxSizerFlags
// --------------------------------------------------------------------------------------
class wxDialogWithHelpers : public wxDialog
{
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDialogWithHelpers)
+
protected:
bool m_hasContextHelp;
int m_idealWidth;
public:
+ wxDialogWithHelpers();
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, int size=wxDefaultCoord );
+ 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; }
@@ -72,26 +80,27 @@ protected:
// --------------------------------------------------------------------------------------
class wxPanelWithHelpers : public wxPanel
{
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers)
+
protected:
int m_idealWidth;
- bool m_StartNewRadioGroup;
public:
- wxPanelWithHelpers( wxWindow* parent, int idealWidth=wxDefaultCoord );
+ wxPanelWithHelpers( wxWindow* parent, wxOrientation orient, const wxString& staticBoxLabel );
+ wxPanelWithHelpers( wxWindow* parent, wxOrientation orient );
wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size=wxDefaultSize );
+ explicit wxPanelWithHelpers( wxWindow* parent=NULL );
+
+ wxPanelWithHelpers* AddStaticBox( const wxString& label, wxOrientation orient=wxVERTICAL );
+ pxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE );
- //wxRadioButton& NewSpinCtrl( const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
-
- //wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
- wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int size=wxDefaultCoord );
-
- wxPanelWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; }
+ // TODO : Propagate to children?
+ wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; }
int GetIdealWidth() const { return m_idealWidth; }
bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; }
-
- void StartRadioGroup() { m_StartNewRadioGroup = true; }
protected:
+ void Init();
};
@@ -217,6 +226,7 @@ public:
//////////////////////////////////////////////////////////////////////////////////////////////
+extern bool pxDialogExists( wxWindowID id );
extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos );
extern wxRect wxGetDisplayArea();
diff --git a/common/include/Utilities/wxHelpers.h b/common/include/Utilities/wxHelpers.h
new file mode 100644
index 0000000000..e31de03152
--- /dev/null
+++ b/common/include/Utilities/wxHelpers.h
@@ -0,0 +1,28 @@
+/* PCSX2 - PS2 Emulator for PCs
+ * Copyright (C) 2002-2009 PCSX2 Dev Team
+ *
+ * PCSX2 is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with PCSX2.
+ * If not, see .
+ */
+
+#pragma once
+
+#include
+#include "wxGuiTools.h"
+
+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/pcsx2/gui/CheckedStaticBox.cpp b/common/src/Utilities/CheckedStaticBox.cpp
similarity index 78%
rename from pcsx2/gui/CheckedStaticBox.cpp
rename to common/src/Utilities/CheckedStaticBox.cpp
index 0974c9fdfa..6fd2290327 100644
--- a/pcsx2/gui/CheckedStaticBox.cpp
+++ b/common/src/Utilities/CheckedStaticBox.cpp
@@ -16,19 +16,16 @@
#include "PrecompiledHeader.h"
#include "CheckedStaticBox.h"
-CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id ) :
- wxPanelWithHelpers( parent, wxDefaultCoord )
-, m_MasterSizer( *new wxBoxSizer( wxVERTICAL ) )
-, ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) )
-, ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
+CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
+ , ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) )
+ , ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
{
- m_MasterSizer.Add( &ThisToggle );
- m_MasterSizer.Add( &ThisSizer, wxSizerFlags().Expand() );
+ GetSizer()->Add( &ThisToggle );
+ GetSizer()->Add( &ThisSizer, wxSizerFlags().Expand() );
// Ensure that the right-side of the static group box isn't too cozy:
- m_MasterSizer.SetMinSize( ThisToggle.GetSize() + wxSize( 32, 0 ) );
-
- SetSizer( &m_MasterSizer );
+ GetSizer()->SetMinSize( ThisToggle.GetSize() + wxSize( 32, 0 ) );
Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) );
}
diff --git a/common/src/Utilities/pxCheckBox.cpp b/common/src/Utilities/pxCheckBox.cpp
new file mode 100644
index 0000000000..d9e982607a
--- /dev/null
+++ b/common/src/Utilities/pxCheckBox.cpp
@@ -0,0 +1,70 @@
+/* PCSX2 - PS2 Emulator for PCs
+ * Copyright (C) 2002-2009 PCSX2 Dev Team
+ *
+ * PCSX2 is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with PCSX2.
+ * If not, see .
+ */
+
+#include "PrecompiledHeader.h"
+#include "pxCheckBox.h"
+#include "pxStaticText.h"
+
+// --------------------------------------------------------------------------------------
+// pxCheckBox Implementations
+// --------------------------------------------------------------------------------------
+
+pxCheckBox::pxCheckBox(wxWindow* parent, const wxString& label, const wxString& subtext)
+ : wxPanelWithHelpers( parent, wxVERTICAL )
+{
+ Init( label, subtext );
+}
+
+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() );
+
+ static const int Indentation = 23;
+ if( !subtext.IsEmpty() )
+ {
+ m_subtext = new pxStaticText( this, 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 );
+ }
+}
+
+// applies the tooltip to both both the checkbox and it's static subtext (if present), and
+// performs word wrapping on platforms that need it (eg mswindows).
+pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )
+{
+ const wxString wrapped( pxFormatToolTipText(this, tip) );
+ pxSetToolTip( m_checkbox, wrapped );
+ pxSetToolTip( m_subtext, wrapped );
+ return *this;
+}
+
+pxCheckBox& pxCheckBox::SetValue( bool val )
+{
+ m_checkbox->SetValue( val );
+ return *this;
+}
+
+bool pxCheckBox::GetValue() const
+{
+ return m_checkbox->GetValue();
+}
diff --git a/common/src/Utilities/pxRadioPanel.cpp b/common/src/Utilities/pxRadioPanel.cpp
index d784eba8bf..1792b5b515 100644
--- a/common/src/Utilities/pxRadioPanel.cpp
+++ b/common/src/Utilities/pxRadioPanel.cpp
@@ -31,8 +31,6 @@ void pxRadioPanel::Init( const RadioPanelItem* srcArray, int arrsize )
// FIXME: This probably needs to be platform-dependent, and/or based on font size.
m_Indentation = 23;
- SetSizer( new wxBoxSizer(wxVERTICAL) );
-
for( int i=0; i.
+ */
+
+#include "PrecompiledHeader.h"
+#include "pxStaticText.h"
+
+// --------------------------------------------------------------------------------------
+// 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 )
+ , m_message( label )
+{
+ m_alignflags = style & wxALIGN_MASK;
+ m_wrapwidth = wxDefaultCoord;
+ m_centerPadding = 0.08;
+}
+
+pxStaticText::pxStaticText( wxWindow* parent, int style )
+ : wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style )
+{
+ m_alignflags = style & wxALIGN_MASK;
+ m_wrapwidth = wxDefaultCoord;
+ m_centerPadding = 0.08;
+}
+
+pxStaticText& pxStaticText::SetWrapWidth( int newwidth )
+{
+ m_wrapwidth = newwidth;
+ SetLabel( m_message );
+ return *this;
+}
+
+void pxStaticText::SetLabel( const wxString& label )
+{
+ m_message = label;
+ _setLabel();
+}
+
+void pxStaticText::_setLabel()
+{
+ _parent::SetLabel( pxTextWrapper().Wrap( *this, m_message, GetIdealWidth() ).GetResult() );
+}
+
+pxStaticText& pxStaticText::SetToolTip( const wxString& tip )
+{
+ pxSetToolTip( this, tip );
+ return *this;
+}
+
+void pxStaticText::AddTo( wxSizer& sizer )
+{
+ sizer.Add( this, pxSizerFlags::StdSpace().Align( m_alignflags ) );
+ _setLabel();
+}
+
+void pxStaticText::InsertAt( wxSizer& sizer, int position )
+{
+ sizer.Insert( position, this, pxSizerFlags::StdSpace().Align( m_alignflags ) );
+ _setLabel();
+}
+
+int pxStaticText::GetIdealWidth() const
+{
+ if( m_wrapwidth != wxDefaultCoord ) return m_wrapwidth;
+
+ //pxAssertDev( GetContainingSizer() != NULL, "The Static Text must first belong to a Sizer!!" );
+ int idealWidth = wxDefaultCoord;
+
+ // Find the first parent with a fixed width:
+ wxWindow* millrun = this->GetParent();
+ while( (idealWidth == wxDefaultCoord) && millrun != NULL )
+ {
+ if( wxIsKindOf( millrun, wxPanelWithHelpers ) )
+ idealWidth = ((wxPanelWithHelpers*)millrun)->GetIdealWidth();
+
+ else if( wxIsKindOf( millrun, wxDialogWithHelpers ) )
+ idealWidth = ((wxDialogWithHelpers*)millrun)->GetIdealWidth();
+
+ millrun = millrun->GetParent();
+ }
+
+ if( idealWidth != wxDefaultCoord )
+ {
+ idealWidth -= 6;
+
+ if( GetWindowStyle() & wxALIGN_CENTRE )
+ idealWidth *= (1.0 - m_centerPadding);
+ }
+
+ return idealWidth;
+}
+
+wxSize pxStaticText::GetMinSize() const
+{
+ int ideal = GetIdealWidth();
+ wxSize minSize( _parent::GetMinSize() );
+ if( ideal == wxDefaultCoord ) return minSize;
+ 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 )
+{
+ m_centerPadding = 0.18;
+}
diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp
index 05288faf66..d59d78b36a 100644
--- a/common/src/Utilities/wxGuiTools.cpp
+++ b/common/src/Utilities/wxGuiTools.cpp
@@ -53,7 +53,7 @@ wxRect wxGetDisplayArea()
//
wxSizerFlags pxSizerFlags::StdSpace()
{
- return wxSizerFlags().Border( wxALL, 6 );
+ return wxSizerFlags().Border( wxALL, StdPadding );
}
wxSizerFlags pxSizerFlags::StdCenter()
@@ -71,7 +71,7 @@ wxSizerFlags pxSizerFlags::StdExpand()
// manually by using a spacer.
wxSizerFlags pxSizerFlags::TopLevelBox()
{
- return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 6 ).Expand();
+ return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding ).Expand();
}
// Flags intended for use on grouped StaticBox controls. These flags are ideal for
@@ -82,7 +82,7 @@ wxSizerFlags pxSizerFlags::SubGroup()
{
// Groups look better with a slightly smaller margin than standard.
// (basically this accounts for the group's frame)
- return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 4 ).Expand();
+ return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding-2 ).Expand();
}
// This force-aligns the std button sizer to the right, where (at least) us win32 platform
@@ -104,9 +104,11 @@ wxSizerFlags pxSizerFlags::Checkbox()
pxTextWrapperBase& pxTextWrapperBase::Wrap( const wxWindow& win, const wxString& text, int widthMax )
{
+ if( text.IsEmpty() ) return *this;
+
const wxChar *lastSpace = NULL;
wxString line;
- line.Alloc( widthMax+12 );
+ line.Alloc( text.Length()+12 );
const wxChar *lineStart = text.c_str();
for ( const wxChar *p = lineStart; ; p++ )
diff --git a/pcsx2/gui/wxHelpers.cpp b/common/src/Utilities/wxHelpers.cpp
similarity index 55%
rename from pcsx2/gui/wxHelpers.cpp
rename to common/src/Utilities/wxHelpers.cpp
index 1f73eab654..344cde7d18 100644
--- a/pcsx2/gui/wxHelpers.cpp
+++ b/common/src/Utilities/wxHelpers.cpp
@@ -14,78 +14,13 @@
*/
#include "PrecompiledHeader.h"
-#include "Utilities/HashMap.h"
+#include "HashMap.h"
#include "wxHelpers.h"
+#include "pxStaticText.h"
#include
+#include
-#if wxUSE_TOOLTIPS
-# include
-#endif
-
-
-// This method is used internally to create multi line checkboxes and radio buttons.
-static wxStaticText* _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen )
-{
- static const int Indentation = 23;
-
- if( subtext.IsEmpty() ) return NULL;
-
- wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext );
- if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation );
- if( !tooltip.IsEmpty() )
- pxSetToolTip( joe, tooltip );
- sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) );
- sizer.AddSpacer( 9 );
-
- return joe;
-}
-
-pxCheckBox::pxCheckBox(wxPanelWithHelpers* parent, const wxString& label, const wxString& subtext)
- : wxPanel( parent )
-{
- m_idealWidth = parent->GetIdealWidth() - 24;
- Init( label, subtext );
-}
-
-pxCheckBox::pxCheckBox(wxDialogWithHelpers* parent, const wxString& label, const wxString& subtext)
- : wxPanel( parent )
-{
- m_idealWidth = parent->GetIdealWidth() - 24;
- Init( label, subtext );
-}
-
-void pxCheckBox::Init(const wxString& label, const wxString& subtext)
-{
- m_checkbox = new wxCheckBox( this, wxID_ANY, label );
-
- wxBoxSizer& mySizer( *new wxBoxSizer(wxVERTICAL) );
- mySizer.Add( m_checkbox, pxSizerFlags::StdExpand() );
- m_subtext = _appendStaticSubtext( this, mySizer, subtext, wxEmptyString, m_idealWidth );
-
- SetSizer( &mySizer );
-}
-
-// applies the tooltip to both both the checkbox and it's static subtext (if present), and
-// performs word wrapping on platforms that need it (eg mswindows).
-pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )
-{
- const wxString wrapped( pxFormatToolTipText(this, tip) );
- pxSetToolTip( m_checkbox, wrapped );
- pxSetToolTip( m_subtext, wrapped );
- return *this;
-}
-
-pxCheckBox& pxCheckBox::SetValue( bool val )
-{
- m_checkbox->SetValue( val );
- return *this;
-}
-
-bool pxCheckBox::GetValue() const
-{
- return m_checkbox->GetValue();
-}
// ------------------------------------------------------------------------
// Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this
@@ -99,25 +34,17 @@ bool pxCheckBox::GetValue() const
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
// or overridden. [default is left alignment]
//
-wxStaticText& wxHelpers::AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags, int size )
+pxStaticText& wxHelpers::AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags )
{
- // No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
- alignFlags |= wxST_NO_AUTORESIZE;
- wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) );
- if( size > 0 ) temp.Wrap( size );
-
- sizer.Add( &temp, pxSizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) );
+ pxStaticText& temp( *new pxStaticText( parent, label, alignFlags ) );
+ temp.AddTo( sizer );
return temp;
}
-wxStaticText& wxHelpers::InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags, int size )
+pxStaticText& wxHelpers::InsertStaticTextAt(wxWindow* parent, wxSizer& sizer, int position, const wxString& label, int alignFlags )
{
- // No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
- alignFlags |= wxST_NO_AUTORESIZE;
- wxStaticText& temp( *new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags ) );
- if( size > 0 ) temp.Wrap( size );
-
- sizer.Insert( position, &temp, pxSizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) );
+ pxStaticText& temp( *new pxStaticText(parent, label, alignFlags ) );
+ temp.InsertAt( sizer, position );
return temp;
}
@@ -134,6 +61,17 @@ bool pxDialogExists( wxWindowID id )
return (dest > 0);
}
+// --------------------------------------------------------------------------------------
+// wxDialogWithHelpers Implementation
+// --------------------------------------------------------------------------------------
+IMPLEMENT_DYNAMIC_CLASS(wxDialogWithHelpers, wxDialog)
+
+wxDialogWithHelpers::wxDialogWithHelpers()
+{
+ m_idealWidth = wxDefaultCoord;
+ m_hasContextHelp = false;
+}
+
wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos, const wxSize& size )
: wxDialog( parent, id, title, pos, size , wxDEFAULT_DIALOG_STYLE) //, (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxRESIZE_BORDER) ), // flags for resizable dialogs, currently unused.
{
@@ -164,9 +102,9 @@ void wxDialogWithHelpers::OnActivate(wxActivateEvent& evt)
//evt.Skip();
}
-wxStaticText& wxDialogWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int size, int alignFlags )
+wxStaticText& wxDialogWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags )
{
- return wxHelpers::AddStaticTextTo( this, sizer, label, size, alignFlags );
+ return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags );
}
void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
@@ -201,20 +139,87 @@ void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
buttonSizer->Add( &s_buttons, pxSizerFlags::StdButton() );
}
-//////////////////////////////////////////////////////////////////////////////////////////
-//
-wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, int idealWidth ) :
- wxPanel( parent )
+// --------------------------------------------------------------------------------------
+// wxPanelWithHelpers Implementations
+// --------------------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxPanelWithHelpers, wxPanel)
+
+void wxPanelWithHelpers::Init()
{
- m_idealWidth = idealWidth;
- m_StartNewRadioGroup = true;
+ m_idealWidth = wxDefaultCoord;
+
+ // Find the first parent with a fixed width:
+ wxWindow* millrun = this->GetParent();
+ while( (m_idealWidth == wxDefaultCoord) && millrun != NULL )
+ {
+ if( wxIsKindOf( millrun, wxPanelWithHelpers ) )
+ m_idealWidth = ((wxPanelWithHelpers*)millrun)->GetIdealWidth();
+
+ else if( wxIsKindOf( millrun, wxDialogWithHelpers ) )
+ m_idealWidth = ((wxDialogWithHelpers*)millrun)->GetIdealWidth();
+
+ millrun = millrun->GetParent();
+ }
+
+ if( m_idealWidth == wxDefaultCoord || GetParent() == NULL )
+ return;
+
+ // Check for a StaticBox -- if we belong to one then we'll want to "downgrade" the
+ // inherited textbox width automatically.
+
+ wxSizer* guess = GetSizer();
+ if( guess == NULL ) guess = GetParent()->GetSizer();
+ if( guess == NULL ) guess = GetParent()->GetContainingSizer();
+
+ if( guess != NULL )
+ {
+ int top=0, others=0;
+ if( wxIsKindOf( guess, wxStaticBoxSizer ) )
+ ((wxStaticBoxSizer*)guess)->GetStaticBox()->GetBordersForSizer( &top, &others );
+
+ m_idealWidth -= (others*2);
+ m_idealWidth -= 2; // generic padding compensation (no exact sciences to be found here)
+ }
}
-wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size ) :
- wxPanel( parent, wxID_ANY, pos, size )
+wxPanelWithHelpers* wxPanelWithHelpers::AddStaticBox( const wxString& label, wxOrientation orient )
{
- m_idealWidth = wxDefaultCoord;
- m_StartNewRadioGroup = true;
+ wxSizer* oldSizer = GetSizer();
+
+ SetSizer( new wxStaticBoxSizer( orient, this, label ), false );
+ Init();
+
+ if( oldSizer )
+ GetSizer()->Add( oldSizer );
+
+ return this;
+}
+
+wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, wxOrientation orient, const wxString& staticBoxLabel )
+ : wxPanel( parent )
+{
+ SetSizer( new wxStaticBoxSizer( orient, this, staticBoxLabel ) );
+ Init();
+}
+
+wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, wxOrientation orient )
+ : wxPanel( parent )
+{
+ SetSizer( new wxBoxSizer( orient ) );
+ Init();
+}
+
+wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent )
+ : wxPanel( parent )
+{
+ Init();
+}
+
+wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size )
+ : wxPanel( parent, wxID_ANY, pos, size )
+{
+ Init();
}
// ------------------------------------------------------------------------
@@ -229,22 +234,7 @@ wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, co
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
// or overridden. [default is left alignment]
//
-wxStaticText& wxPanelWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags, int size )
+pxStaticText& wxPanelWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags )
{
- return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags, (size > 0) ? size : GetIdealWidth()-24 );
+ return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags );
}
-
-// ------------------------------------------------------------------------
-// Creates a new Radio button and adds it to the specified sizer, with optional tooltip. Uses the
-// default spacer setting for adding checkboxes, and the tooltip (if specified) is applied to both
-// the radio button and it's static subtext (if present).
-//
-// Static subtext, if specified, is displayed below the checkbox and is indented accordingly.
-// The first item in a group should pass True for the isFirst parameter.
-//
-/*wxRadioButton& wxPanelWithHelpers::AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip )
-{
- wxRadioButton& result = wxHelpers::AddRadioButtonTo( this, sizer, label, subtext, tooltip, GetIdealWidth()-8, m_StartNewRadioGroup );
- m_StartNewRadioGroup = false;
- return result;
-}*/
diff --git a/pcsx2/gui/AppCommon.h b/pcsx2/gui/AppCommon.h
new file mode 100644
index 0000000000..83e8a91687
--- /dev/null
+++ b/pcsx2/gui/AppCommon.h
@@ -0,0 +1,30 @@
+/* PCSX2 - PS2 Emulator for PCs
+ * Copyright (C) 2002-2009 PCSX2 Dev Team
+ *
+ * PCSX2 is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with PCSX2.
+ * If not, see .
+ */
+
+#pragma once
+
+#include "Utilities/SafeArray.h"
+#include "Utilities/EventSource.h"
+#include "Utilities/Threading.h"
+
+#include "Utilities/wxGuiTools.h"
+#include "Utilities/wxHelpers.h"
+#include "Utilities/pxRadioPanel.h"
+#include "Utilities/pxCheckBox.h"
+#include "Utilities/pxStaticText.h"
+#include "Utilities/CheckedStaticBox.h"
+
+#include "AppConfig.h"
+#include "Panels/BaseConfigPanel.h"
diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp
index 670e213d6e..e366cba932 100644
--- a/pcsx2/gui/AppConfig.cpp
+++ b/pcsx2/gui/AppConfig.cpp
@@ -306,29 +306,23 @@ wxString AppConfig::FullpathToMcd( uint port, uint slot ) const
return Path::Combine( Folders.MemoryCards, Mcd[port][slot].Filename );
}
-AppConfig::AppConfig() :
- MainGuiPosition( wxDefaultPosition )
-, SettingsTabName( L"Cpu" )
-, LanguageId( wxLANGUAGE_DEFAULT )
-, RecentFileCount( 6 )
-, DeskTheme( L"default" )
-, Listbook_ImageSize( 32 )
-, Toolbar_ImageSize( 24 )
-, Toolbar_ShowLabels( true )
-
-, McdEnableNTFS( true )
-, CloseGSonEsc( true )
-
-, CurrentIso()
-, CurrentELF()
-, CdvdSource( CDVDsrc_Iso )
-
-, ProgLogBox()
-, Ps2ConBox()
-, Folders()
-, BaseFilenames()
-, EmuOptions()
+AppConfig::AppConfig()
+ : MainGuiPosition( wxDefaultPosition )
+ , SettingsTabName( L"Cpu" )
+ , DeskTheme( L"default" )
{
+ LanguageId = wxLANGUAGE_DEFAULT;
+ RecentFileCount = 6;
+ Listbook_ImageSize = 32;
+ Toolbar_ImageSize = 24;
+ Toolbar_ShowLabels = true;
+
+ McdEnableNTFS = true;
+ CloseGSonEsc = true;
+ EnableSpeedHacks = false;
+
+ CdvdSource = CDVDsrc_Iso;
+
for( uint port=0; port<2; ++port )
{
for( uint slot=0; slot<4; ++slot )
@@ -393,6 +387,9 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( CurrentIso );
IniEntry( CurrentELF );
+
+ IniEntry( CloseGSonEsc );
+ IniEntry( EnableSpeedHacks );
ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource );
}
diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h
index 8b9eef4e91..7fb49169d1 100644
--- a/pcsx2/gui/AppConfig.h
+++ b/pcsx2/gui/AppConfig.h
@@ -141,6 +141,10 @@ public:
// Closes the GS/Video port on escape (good for fullscreen activity)
bool CloseGSonEsc;
+
+ // Master toggle for enabling or disabling all speedhacks in one fail-free swoop.
+ // (the toggle is applied when a new EmuConfig is sent through AppCoreThread::ApplySettings)
+ bool EnableSpeedHacks;
wxString CurrentIso;
wxString CurrentELF;
diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp
index ee2abc1877..b52887b721 100644
--- a/pcsx2/gui/AppCoreThread.cpp
+++ b/pcsx2/gui/AppCoreThread.cpp
@@ -198,7 +198,12 @@ void AppCoreThread::StateCheckInThread()
void AppCoreThread::ApplySettings( const Pcsx2Config& src )
{
if( m_ExecMode != ExecMode_Closed ) return;
- if( src == EmuConfig ) return;
+
+ Pcsx2Config fixup( src );
+ if( !g_Conf->EnableSpeedHacks )
+ fixup.Speedhacks = Pcsx2Config::SpeedhackOptions();
+
+ if( fixup == EmuConfig ) return;
// Re-entry guard protects against cases where code wants to manually set core settings
// which are not part of g_Conf. The subsequent call to apply g_Conf settings (which is
@@ -207,7 +212,7 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
static int localc = 0;
RecursionGuard guard( localc );
if(guard.IsReentrant()) return;
- SysCoreThread::ApplySettings( src );
+ _parent::ApplySettings( fixup );
}
void AppCoreThread::ExecuteTaskInThread()
diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp
index 44295eeb70..13e6fcafbb 100644
--- a/pcsx2/gui/AppInit.cpp
+++ b/pcsx2/gui/AppInit.cpp
@@ -84,13 +84,14 @@ void Pcsx2App::ReadUserModeSettings()
// Pre-Alpha Warning! Why didn't I think to add this sooner?!
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,
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, 600
+ 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() );
diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp
index 49e4e844a9..0b82807aee 100644
--- a/pcsx2/gui/AppMain.cpp
+++ b/pcsx2/gui/AppMain.cpp
@@ -422,7 +422,6 @@ void AppApplySettings( const AppConfig* oldconf, bool saveOnSuccess )
int toSend = 0;
sApp.Source_SettingsApplied().Dispatch( toSend );
- CoreThread.ApplySettings( g_Conf->EmuOptions );
if( resume )
CoreThread.Resume();
diff --git a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp
index 06c65053e3..59916aa421 100644
--- a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp
+++ b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp
@@ -15,8 +15,9 @@
#include "PrecompiledHeader.h"
#include "App.h"
+#include "AppCommon.h"
+
#include "Dialogs/ModalPopups.h"
-#include "wxHelpers.h"
#include "Resources/EmbeddedImage.h"
#include "Resources/Dualshock.h"
diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
index 0aeecb7b43..753e093e9e 100644
--- a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
+++ b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#ifdef __WXMSW__
# include // needed for Vista icon spacing fix.
@@ -40,15 +41,13 @@ using namespace Panels;
static const int s_orient = wxBK_LEFT;
#endif
-static const int IdealWidth = 580;
-
template< typename T >
void Dialogs::ConfigurationDialog::AddPage( const char* label, int iconid )
{
const wxString labelstr( fromUTF8( label ) );
const int curidx = m_labels.Add( labelstr );
g_ApplyState.SetCurrentPage( curidx );
- m_listbook.AddPage( new T( m_listbook, IdealWidth ), wxGetTranslation( labelstr ),
+ m_listbook.AddPage( new T( &m_listbook ), wxGetTranslation( labelstr ),
( labelstr == g_Conf->SettingsTabName ), iconid );
}
@@ -56,6 +55,8 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("PCSX2 Configuration"), true )
, m_listbook( *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, s_orient ) )
{
+ m_idealWidth = 600;
+
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
m_listbook.SetImageList( &wxGetApp().GetImgList_Config() );
@@ -85,7 +86,7 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
// to the size of the frame's ideal width.
ListView_SetIconSpacing( (HWND)m_listbook.GetListView()->GetHWND(),
- (IdealWidth-6) / m_listbook.GetPageCount(), g_Conf->Listbook_ImageSize+32 // y component appears to be ignored
+ (m_idealWidth-6) / m_listbook.GetPageCount(), g_Conf->Listbook_ImageSize+32 // y component appears to be ignored
);
#endif
@@ -149,9 +150,10 @@ void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("BIOS Selector"), false )
{
- wxBoxSizer& bleh( *new wxBoxSizer( wxVERTICAL ) );
+ m_idealWidth = 500;
- Panels::BaseSelectorPanel* selpan = new Panels::BiosSelectorPanel( *this, 500 );
+ wxBoxSizer& bleh( *new wxBoxSizer( wxVERTICAL ) );
+ Panels::BaseSelectorPanel* selpan = new Panels::BiosSelectorPanel( this );
bleh.Add( selpan, pxSizerFlags::StdExpand() );
AddOkCancel( bleh, false );
diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.h b/pcsx2/gui/Dialogs/ConfigurationDialog.h
index 7cd5e3965f..62d10962ff 100644
--- a/pcsx2/gui/Dialogs/ConfigurationDialog.h
+++ b/pcsx2/gui/Dialogs/ConfigurationDialog.h
@@ -19,7 +19,7 @@
#include
#include
-#include "wxHelpers.h"
+#include "AppCommon.h"
class wxListbook;
diff --git a/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp b/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp
index 4cf0bf70d3..11181457f2 100644
--- a/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp
+++ b/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp
@@ -149,16 +149,19 @@ wxWindowID Dialogs::IssueConfirmation( wxWindow* parent, const wxString& disable
return modalResult;
}
-Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const ConfButtons& type, const wxString& title, const wxString& msg ) :
- wxDialogWithHelpers( parent, wxID_ANY, title, false )
-, m_ExtensibleSizer( *new wxBoxSizer( wxVERTICAL ) )
-, m_ButtonSizer( *new wxBoxSizer( wxHORIZONTAL ) )
+Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const ConfButtons& type, const wxString& title, const wxString& msg )
+ : wxDialogWithHelpers( parent, wxID_ANY, title, false )
+ , m_ExtensibleSizer( *new wxBoxSizer( wxVERTICAL ) )
+ , m_ButtonSizer( *new wxBoxSizer( wxHORIZONTAL ) )
{
+ m_idealWidth = 500;
+
wxBoxSizer& mainsizer( *new wxBoxSizer(wxVERTICAL) );
// Add the message padded some (StdCenter gives us a 5 pt padding). Helps emphasize it a bit.
wxBoxSizer& msgPadSizer( *new wxBoxSizer(wxVERTICAL) );
- AddStaticText( msgPadSizer, msg, wxALIGN_CENTRE, 444 );
+
+ msgPadSizer.Add( new pxStaticHeading( this, msg ) );
mainsizer.Add( &msgPadSizer, pxSizerFlags::StdCenter() );
mainsizer.Add( &m_ExtensibleSizer, wxSizerFlags().Centre() );
diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp
index c4e46ff45f..ce2c3f21d9 100644
--- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp
+++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp
@@ -25,10 +25,10 @@ using namespace wxHelpers;
using namespace Panels;
template< typename T >
-static T& MakeWizWidget( int pageid, wxWizardPage& src )
+static T& MakeWizWidget( int pageid, wxWizardPage* src )
{
g_ApplyState.SetCurrentPage( pageid );
- return *new T( src, 620 );
+ return *new T( src, 640 );
}
// ----------------------------------------------------------------------------
@@ -56,40 +56,47 @@ Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) :
// ----------------------------------------------------------------------------
FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) :
wxWizardPageSimple( (g_ApplyState.SetCurrentPage( 0 ), parent) )
-
-, m_dirpick_settings( *new SettingsDirPickerPanel( this ) )
-, m_panel_LangSel( *new LanguageSelectionPanel( *this, 608 ) )
-, m_panel_UserSel( *new UsermodeSelectionPanel( *this, 608 ) )
{
- wxBoxSizer& usermodeSizer( *new wxBoxSizer( wxVERTICAL ) );
- AddStaticTextTo( this, usermodeSizer, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") );
+ SetSizer( new wxBoxSizer( wxVERTICAL ) );
- usermodeSizer.Add( &m_panel_LangSel, pxSizerFlags::StdCenter() );
- usermodeSizer.Add( &m_panel_UserSel, wxSizerFlags().Expand().Border( wxALL, 8 ) );
+ wxPanelWithHelpers* panel = new wxPanelWithHelpers( this, wxVERTICAL );
+ panel->SetIdealWidth( 640 );
+ wxSizer& s_panel( *panel->GetSizer() );
- usermodeSizer.AddSpacer( 6 );
- usermodeSizer.Add( &m_dirpick_settings, pxSizerFlags::SubGroup() );
- SetSizer( &usermodeSizer );
+ m_dirpick_settings = new SettingsDirPickerPanel( panel );
+ m_panel_LangSel = new LanguageSelectionPanel( panel );
+ m_panel_UserSel = new UsermodeSelectionPanel( panel );
+
+ (new pxStaticHeading( panel, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") ))
+ ->AddTo( s_panel );
+
+ s_panel.Add( m_panel_LangSel, pxSizerFlags::StdCenter() );
+ s_panel.Add( m_panel_UserSel, wxSizerFlags().Expand().Border( wxALL, 8 ) );
+
+ s_panel.AddSpacer( 6 );
+ s_panel.Add( m_dirpick_settings, pxSizerFlags::SubGroup() );
+
+ GetSizer()->Add( panel, wxSizerFlags().Expand() );
Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(FirstTimeWizard::UsermodePage::OnUsermodeChanged) );
}
void FirstTimeWizard::UsermodePage::OnUsermodeChanged( wxCommandEvent& evt )
{
- m_panel_UserSel.Apply();
+ m_panel_UserSel->Apply();
g_Conf->Folders.ApplyDefaults();
- m_dirpick_settings.Reset();
+ m_dirpick_settings->Reset();
}
// ----------------------------------------------------------------------------
-FirstTimeWizard::FirstTimeWizard( wxWindow* parent ) :
- wxWizard( (g_ApplyState.StartWizard(), parent), wxID_ANY, _("PCSX2 First Time Configuration") )
-, m_page_usermode( *new UsermodePage( this ) )
-, m_page_plugins( *new wxWizardPageSimple( this, &m_page_usermode ) )
-, m_page_bios( *new wxWizardPageSimple( this, &m_page_plugins ) )
+FirstTimeWizard::FirstTimeWizard( wxWindow* parent )
+ : wxWizard( (g_ApplyState.StartWizard(), parent), wxID_ANY, _("PCSX2 First Time Configuration") )
+ , m_page_usermode( *new UsermodePage( this ) )
+ , m_page_plugins( *new wxWizardPageSimple( this, &m_page_usermode ) )
+ , m_page_bios( *new wxWizardPageSimple( this, &m_page_plugins ) )
-, m_panel_PluginSel( MakeWizWidget( 1, m_page_plugins ) )
-, m_panel_BiosSel( MakeWizWidget( 2, m_page_bios ) )
+ , m_panel_PluginSel ( MakeWizWidget( 1, &m_page_plugins ) )
+ , m_panel_BiosSel ( MakeWizWidget( 2, &m_page_bios ) )
{
// Page 2 - Plugins Panel
wxBoxSizer& pluginSizer( *new wxBoxSizer( wxVERTICAL ) );
diff --git a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp
index 9da250ca03..8571ceb1e4 100644
--- a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp
+++ b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp
@@ -21,30 +21,35 @@
using namespace wxHelpers;
-Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) :
- wxDialogWithHelpers( parent, wxID_ANY, L"Import Existing Settings?", false )
+Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent )
+ : wxDialogWithHelpers( parent, wxID_ANY, _("Import Existing Settings?"), false )
{
- wxBoxSizer& sizer( *new wxBoxSizer( wxVERTICAL ) );
+ m_idealWidth = 440;
- AddStaticText( sizer,
- pxE( ".Popup:ImportExistingSettings",
- L"Existing PCSX2 settings have been found in the configured settings folder. "
- L"Would you like to import these settings or overwrite them with PCSX2 default values?"
- L"\n\n(or press Cancel to select a different settings folder)"
- ),
- wxALIGN_CENTRE, 400
+ pxStaticText* heading = new pxStaticHeading( this, pxE( ".Popup:ImportExistingSettings",
+ L"Existing PCSX2 settings have been found in the configured settings folder. "
+ L"Would you like to import these settings or overwrite them with PCSX2 default values?"
+ L"\n\n(or press Cancel to select a different settings folder)" )
);
-
+ heading->SetMinSize( wxSize( m_idealWidth-8, wxDefaultCoord ) );
+
wxBoxSizer& s_buttons = *new wxBoxSizer( wxHORIZONTAL );
wxButton* b_import = new wxButton( this, wxID_ANY, _("Import") );
wxButton* b_over = new wxButton( this, wxID_ANY, _("Overwrite") );
+ // --------------------------------------------------------------------
+ // Layout Some Shizat...
+
+ wxBoxSizer& sizer( *new wxBoxSizer( wxVERTICAL ) );
+
s_buttons.Add( b_import,pxSizerFlags::StdButton() );
s_buttons.AddSpacer( 16 );
s_buttons.Add( b_over, pxSizerFlags::StdButton() );
s_buttons.AddSpacer( 16 );
s_buttons.Add( new wxButton( this, wxID_CANCEL ), pxSizerFlags::StdButton() );
+ sizer.AddSpacer( 4 );
+ heading->AddTo( sizer );
sizer.AddSpacer( 12 );
sizer.Add( &s_buttons, pxSizerFlags::StdCenter() );
SetSizerAndFit( &sizer );
diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp
index b6e184aafc..020829f9f5 100644
--- a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp
+++ b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp
@@ -25,9 +25,10 @@ using namespace Panels;
Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent, int id )
: wxDialogWithHelpers( parent, id, _("High Volume Logging"), true )
{
+ m_idealWidth = 480;
+
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
-
- mainsizer.Add( new LogOptionsPanel( this, 480 ) );
+ mainsizer.Add( new LogOptionsPanel( this ) );
AddOkCancel( mainsizer, true );
FindWindow( wxID_APPLY )->Disable();
diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.h b/pcsx2/gui/Dialogs/LogOptionsDialog.h
index e5a0bd1be5..857bf5d9a2 100644
--- a/pcsx2/gui/Dialogs/LogOptionsDialog.h
+++ b/pcsx2/gui/Dialogs/LogOptionsDialog.h
@@ -17,9 +17,8 @@
#include "App.h"
-#include "wxHelpers.h"
-#include "CheckedStaticBox.h"
-
+#include "Utilities/wxHelpers.h"
+#include "Utilities/CheckedStaticBox.h"
#include "Utilities/HashMap.h"
using namespace HashTools;
diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h
index a56df53596..16b0631518 100644
--- a/pcsx2/gui/Dialogs/ModalPopups.h
+++ b/pcsx2/gui/Dialogs/ModalPopups.h
@@ -29,9 +29,9 @@ protected:
class UsermodePage : public wxWizardPageSimple
{
protected:
- Panels::DirPickerPanel& m_dirpick_settings;
- Panels::LanguageSelectionPanel& m_panel_LangSel;
- Panels::UsermodeSelectionPanel& m_panel_UserSel;
+ Panels::DirPickerPanel* m_dirpick_settings;
+ Panels::LanguageSelectionPanel* m_panel_LangSel;
+ Panels::UsermodeSelectionPanel* m_panel_UserSel;
public:
UsermodePage( wxWizard* parent );
diff --git a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp
index 0515b95401..5e2d463d4d 100644
--- a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp
+++ b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp
@@ -21,11 +21,12 @@
using namespace wxHelpers;
using namespace Panels;
-Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) :
- wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
-, m_panel_usersel( new UsermodeSelectionPanel( *this, 620, false ) )
-, m_panel_langsel( new LanguageSelectionPanel( *this, 620 ) )
+Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id )
+ : wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
{
+ m_panel_usersel = new UsermodeSelectionPanel( this, false );
+ m_panel_langsel = new LanguageSelectionPanel( this );
+
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") );
diff --git a/pcsx2/gui/Panels/BaseConfigPanel.h b/pcsx2/gui/Panels/BaseConfigPanel.h
index 7f40e86d09..800454473a 100644
--- a/pcsx2/gui/Panels/BaseConfigPanel.h
+++ b/pcsx2/gui/Panels/BaseConfigPanel.h
@@ -17,13 +17,6 @@
#include
-#include "AppConfig.h"
-#include "wxHelpers.h"
-
-#include "Utilities/SafeArray.h"
-#include "Utilities/EventSource.h"
-#include "Utilities/wxGuiTools.h"
-
class wxListBox;
class wxBookCtrlBase;
@@ -138,13 +131,16 @@ namespace Panels
g_ApplyState.PanelList.remove( this );
}
- BaseApplicableConfigPanel( wxWindow* parent, int idealWidth )
- : wxPanelWithHelpers( parent, idealWidth )
+ BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL )
+ : wxPanelWithHelpers( parent, orient )
{
- m_OwnerPage = g_ApplyState.CurOwnerPage;
- m_OwnerBook = g_ApplyState.ParentBook;
+ Init();
+ }
- g_ApplyState.PanelList.push_back( this );
+ BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel )
+ : wxPanelWithHelpers( parent, orient, staticLabel )
+ {
+ Init();
}
int GetOwnerPage() const { return m_OwnerPage; }
@@ -161,5 +157,13 @@ namespace Panels
// of form contents fails, the function should throw Exception::CannotApplySettings.
// If no exceptions are thrown, then the operation is assumed a success. :)
virtual void Apply()=0;
+
+ protected:
+ void Init()
+ {
+ m_OwnerPage = g_ApplyState.CurOwnerPage;
+ m_OwnerBook = g_ApplyState.ParentBook;
+ g_ApplyState.PanelList.push_back( this );
+ }
};
}
diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp
index d15026efe2..1353f1daad 100644
--- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp
+++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp
@@ -21,14 +21,15 @@
#include "ps2/BiosTools.h"
#include
+#include
#include
using namespace wxHelpers;
// ------------------------------------------------------------------------
-Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow& parent, int idealWidth ) :
- BaseApplicableConfigPanel( &parent, idealWidth )
-, m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener( this, OnAppliedSettings ) )
+Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent, wxVERTICAL )
+ , m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener( this, OnAppliedSettings ) )
{
Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this );
}
@@ -70,20 +71,22 @@ void Panels::BaseSelectorPanel::OnAppliedSettings( void* me, int& )
}
// ----------------------------------------------------------------------------
-Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow& parent, int idealWidth ) :
- BaseSelectorPanel( parent, idealWidth-12 )
-, m_ComboBox( *new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT | wxLB_NEEDED_SB ) )
-, m_FolderPicker( *new DirPickerPanel( this, FolderId_Bios,
+Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent, int idealWidth )
+ : BaseSelectorPanel( parent )
+ , m_ComboBox( *new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT | wxLB_NEEDED_SB ) )
+ , m_FolderPicker( *new DirPickerPanel( this, FolderId_Bios,
_("BIOS Search Path:"), // static box label
_("Select folder with PS2 BIOS roms") // dir picker popup label
) )
{
+ if( idealWidth != wxDefaultCoord ) m_idealWidth = idealWidth;
+
m_ComboBox.SetFont( wxFont( m_ComboBox.GetFont().GetPointSize()+1, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL, false, L"Lucida Console" ) );
m_ComboBox.SetMinSize( wxSize( wxDefaultCoord, std::max( m_ComboBox.GetMinSize().GetHeight(), 96 ) ) );
m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") );
- wxBoxSizer& sizer( *new wxBoxSizer( wxVERTICAL ) );
+ wxSizer& sizer( *GetSizer() );
AddStaticText( sizer, _("Select a BIOS rom:"), wxALIGN_LEFT );
sizer.Add( &m_ComboBox, pxSizerFlags::StdExpand() );
sizer.AddSpacer( 6 );
diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h
index 6481e3484c..c54c28b3dd 100644
--- a/pcsx2/gui/Panels/ConfigurationPanels.h
+++ b/pcsx2/gui/Panels/ConfigurationPanels.h
@@ -25,11 +25,42 @@
#include
#include
-#include "BaseConfigPanel.h"
+#include "AppCommon.h"
-#include "Utilities/Threading.h"
-#include "Utilities/pxRadioPanel.h"
+class wxDirPickerCtrl;
+class wxFileDirPickerEvent;
+// --------------------------------------------------------------------------------------
+// pxUniformTable
+// --------------------------------------------------------------------------------------
+// TODO : Move this class to the common Utilities lib, if it proves useful. :)
+/*
+class pxUniformTable : public wxFlexGridSizer
+{
+protected:
+ int m_curcell;
+ SafeArray m_panels;
+
+public:
+ pxUniformTable( wxWindow* parent, int numcols, int numrows, const wxString* staticBoxLabels=NULL );
+ virtual ~pxUniformTable() throw() {}
+
+ int GetCellCount() const
+ {
+ return m_panels.GetLength();
+ }
+
+ wxPanelWithHelpers* operator()( int col, int row )
+ {
+ return m_panels[(col*GetCols()) + row];
+ }
+
+ wxPanelWithHelpers* operator[]( int cellidx )
+ {
+ return m_panels[cellidx];
+ }
+};
+*/
namespace Panels
{
//////////////////////////////////////////////////////////////////////////////////////////
@@ -41,7 +72,7 @@ namespace Panels
public:
virtual ~UsermodeSelectionPanel() { }
- UsermodeSelectionPanel( wxWindow& parent, int idealWidth=wxDefaultCoord, bool isFirstTime = true );
+ UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime = true );
void Apply();
};
@@ -56,7 +87,7 @@ namespace Panels
public:
virtual ~LanguageSelectionPanel() { }
- LanguageSelectionPanel( wxWindow& parent, int idealWidth=wxDefaultCoord );
+ LanguageSelectionPanel( wxWindow* parent );
void Apply();
};
@@ -70,7 +101,7 @@ namespace Panels
pxRadioPanel* m_panel_RecIOP;
public:
- CpuPanelEE( wxWindow& parent, int idealWidth );
+ CpuPanelEE( wxWindow* parent );
void Apply();
};
@@ -81,7 +112,7 @@ namespace Panels
pxRadioPanel* m_panel_VU1;
public:
- CpuPanelVU( wxWindow& parent, int idealWidth );
+ CpuPanelVU( wxWindow* parent );
void Apply();
};
@@ -99,7 +130,7 @@ namespace Panels
pxCheckBox* m_Option_DAZ;
public:
- BaseAdvancedCpuOptions( wxWindow& parent, int idealWidth );
+ BaseAdvancedCpuOptions( wxWindow* parent );
virtual ~BaseAdvancedCpuOptions() throw() { }
protected:
@@ -110,7 +141,7 @@ namespace Panels
class AdvancedOptionsFPU : public BaseAdvancedCpuOptions
{
public:
- AdvancedOptionsFPU( wxWindow& parent, int idealWidth );
+ AdvancedOptionsFPU( wxWindow* parent );
virtual ~AdvancedOptionsFPU() throw() { }
void Apply();
};
@@ -118,7 +149,7 @@ namespace Panels
class AdvancedOptionsVU : public BaseAdvancedCpuOptions
{
public:
- AdvancedOptionsVU( wxWindow& parent, int idealWidth );
+ AdvancedOptionsVU( wxWindow* parent );
virtual ~AdvancedOptionsVU() throw() { }
void Apply();
};
@@ -145,20 +176,36 @@ namespace Panels
wxSpinCtrl* m_spin_FramesToDraw;
public:
- FramelimiterPanel( wxWindow& parent, int idealWidth );
+ FramelimiterPanel( wxWindow* parent );
virtual ~FramelimiterPanel() throw() {}
void Apply();
+ void OnSettingsChanged();
+ };
+
+ class GSWindowSettingsPanel : public BaseApplicableConfigPanel
+ {
+ protected:
+ pxCheckBox* m_check_CloseGS;
+ pxCheckBox* m_check_SizeLock;
+ pxCheckBox* m_check_AspectLock;
+ pxCheckBox* m_check_VsyncEnable;
+ pxCheckBox* m_check_Fullscreen;
+
+ wxTextCtrl* m_text_WindowWidth;
+ wxTextCtrl* m_text_WindowHeight;
+
+ public:
+ GSWindowSettingsPanel( wxWindow* parent );
+ virtual ~GSWindowSettingsPanel() throw() {}
+ void Apply();
+ void OnSettingsChanged();
};
class VideoPanel : public BaseApplicableConfigPanel
{
protected:
- pxCheckBox* m_check_CloseGS;
- //wxCheckBox* m_check_CloseGS;
- //wxCheckBox* m_;
-
public:
- VideoPanel( wxWindow& parent, int idealWidth );
+ VideoPanel( wxWindow* parent );
virtual ~VideoPanel() throw() {}
void Apply();
};
@@ -168,25 +215,37 @@ namespace Panels
class SpeedHacksPanel : public BaseApplicableConfigPanel
{
protected:
- wxSlider* m_slider_eecycle;
- wxSlider* m_slider_vustealer;
- wxStaticText* m_msg_eecycle;
- wxStaticText* m_msg_vustealer;
+ wxFlexGridSizer* s_table;
- pxCheckBox* m_check_intc;
- pxCheckBox* m_check_b1fc0;
- pxCheckBox* m_check_IOPx2;
- pxCheckBox* m_check_vuFlagHack;
- pxCheckBox* m_check_vuMinMax;
+ pxCheckBox* m_check_Enable;
+ wxButton* m_button_Defaults;
+
+ wxSlider* m_slider_eecycle;
+ wxSlider* m_slider_vustealer;
+ pxStaticText* m_msg_eecycle;
+ pxStaticText* m_msg_vustealer;
+
+ pxCheckBox* m_check_intc;
+ pxCheckBox* m_check_b1fc0;
+ pxCheckBox* m_check_IOPx2;
+ pxCheckBox* m_check_vuFlagHack;
+ pxCheckBox* m_check_vuMinMax;
public:
- SpeedHacksPanel( wxWindow& parent, int idealWidth );
+ SpeedHacksPanel( wxWindow* parent );
void Apply();
+ void EnableStuff();
+ void OnSettingsChanged();
+ void OnSettingsChanged( const Pcsx2Config::SpeedhackOptions& opt );
protected:
const wxChar* GetEEcycleSliderMsg( int val );
const wxChar* GetVUcycleSliderMsg( int val );
+ void SetEEcycleSliderMsg();
+ void SetVUcycleSliderMsg();
+ void OnEnable_Toggled( wxCommandEvent& evt );
+ void Defaults_Click( wxCommandEvent& evt );
void Slider_Click(wxScrollEvent &event);
void EECycleRate_Scroll(wxScrollEvent &event);
void VUCycleRate_Scroll(wxScrollEvent &event);
@@ -200,7 +259,7 @@ namespace Panels
pxCheckBox* m_checkbox[NUM_OF_GAME_FIXES];
public:
- GameFixesPanel( wxWindow& parent, int idealWidth );
+ GameFixesPanel( wxWindow* parent );
void Apply();
};
@@ -222,7 +281,7 @@ namespace Panels
void Apply();
void Reset();
- wxDirName GetPath() const { return wxDirName( m_pickerCtrl->GetPath() ); }
+ wxDirName GetPath() const;
DirPickerPanel& SetStaticDesc( const wxString& msg );
DirPickerPanel& SetToolTip( const wxString& tip );
@@ -245,14 +304,11 @@ namespace Panels
//
class BasePathsPanel : public wxPanelWithHelpers
{
- protected:
- wxBoxSizer& s_main;
-
public:
- BasePathsPanel( wxWindow& parent, int idealWidth=wxDefaultCoord );
+ BasePathsPanel( wxWindow* parent );
protected:
- DirPickerPanel& AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid,
+ DirPickerPanel& AddDirPicker( wxSizer& sizer, FoldersEnum_t folderid,
const wxString& label, const wxString& popupLabel );
};
@@ -261,7 +317,7 @@ namespace Panels
class StandardPathsPanel : public BasePathsPanel
{
public:
- StandardPathsPanel( wxWindow& parent, int idealWidth );
+ StandardPathsPanel( wxWindow* parent );
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -273,7 +329,7 @@ namespace Panels
public:
virtual ~BaseSelectorPanel() throw();
- BaseSelectorPanel( wxWindow& parent, int idealWidth );
+ BaseSelectorPanel( wxWindow* parent );
virtual bool Show( bool visible=true );
virtual void OnRefresh( wxCommandEvent& evt );
@@ -294,11 +350,11 @@ namespace Panels
{
protected:
ScopedPtr m_BiosList;
- wxListBox& m_ComboBox;
- DirPickerPanel& m_FolderPicker;
+ wxListBox& m_ComboBox;
+ DirPickerPanel& m_FolderPicker;
public:
- BiosSelectorPanel( wxWindow& parent, int idealWidth );
+ BiosSelectorPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
virtual ~BiosSelectorPanel() throw();
protected:
@@ -393,8 +449,8 @@ namespace Panels
// ------------------------------------------------------------------------
protected:
- StatusPanel& m_StatusPanel;
- ComboBoxPanel& m_ComponentBoxes;
+ StatusPanel* m_StatusPanel;
+ ComboBoxPanel* m_ComponentBoxes;
bool m_Canceled;
ScopedPtr m_FileList; // list of potential plugin files
@@ -402,7 +458,7 @@ namespace Panels
public:
virtual ~PluginSelectorPanel() throw();
- PluginSelectorPanel( wxWindow& parent, int idealWidth );
+ PluginSelectorPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
void CancelRefresh(); // used from destructor, stays non-virtual
void Apply();
diff --git a/pcsx2/gui/Panels/CpuPanel.cpp b/pcsx2/gui/Panels/CpuPanel.cpp
index ca8fe463cd..dbaac44bba 100644
--- a/pcsx2/gui/Panels/CpuPanel.cpp
+++ b/pcsx2/gui/Panels/CpuPanel.cpp
@@ -18,8 +18,8 @@
using namespace pxSizerFlags;
-Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow& parent, int idealWidth )
- : BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
, s_adv( *new wxStaticBoxSizer( wxVERTICAL, this ) )
{
wxStaticBoxSizer* s_round( new wxStaticBoxSizer( wxVERTICAL, this, _("Round Mode") ) );
@@ -89,8 +89,8 @@ void Panels::BaseAdvancedCpuOptions::OnRestoreDefaults(wxCommandEvent &evt)
m_Option_FTZ->SetValue(true);
}
-Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow& parent, int idealWidth )
- : BaseAdvancedCpuOptions( parent, idealWidth )
+Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
+ : BaseAdvancedCpuOptions( parent )
{
s_adv.GetStaticBox()->SetLabel(_("EE/FPU Advanced Recompiler Options"));
@@ -117,8 +117,8 @@ Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow& parent, int idealWidth
}
-Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow& parent, int idealWidth )
- : BaseAdvancedCpuOptions( parent, idealWidth )
+Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent )
+ : BaseAdvancedCpuOptions( parent )
{
s_adv.GetStaticBox()->SetLabel(_("VU0 / VU1 Advanced Recompiler Options"));
@@ -144,8 +144,8 @@ Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow& parent, int idealWidth )
else m_ClampModePanel->SetSelection( 0 );
}
-Panels::CpuPanelEE::CpuPanelEE( wxWindow& parent, int idealWidth )
- : BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
{
// i18n: No point in translating PS2 CPU names :)
wxStaticBoxSizer* s_ee = new wxStaticBoxSizer( wxVERTICAL, this, L"EmotionEngine" );
@@ -192,7 +192,7 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow& parent, int idealWidth )
s_main.Add( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() );
- s_main.Add( new AdvancedOptionsFPU( *this, idealWidth ), StdExpand() );
+ s_main.Add( new AdvancedOptionsFPU( this ), StdExpand() );
SetSizer( &s_main );
@@ -204,8 +204,8 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow& parent, int idealWidth )
m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP );
}
-Panels::CpuPanelVU::CpuPanelVU( wxWindow& parent, int idealWidth )
- : BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
{
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer& s_recs = *new wxFlexGridSizer( 2 );
@@ -244,7 +244,7 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow& parent, int idealWidth )
s_main.Add( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() );
- s_main.Add( new AdvancedOptionsVU( *this, idealWidth ), StdExpand() );
+ s_main.Add( new AdvancedOptionsVU( this ), StdExpand() );
SetSizer( &s_main );
diff --git a/pcsx2/gui/Panels/DirPickerPanel.cpp b/pcsx2/gui/Panels/DirPickerPanel.cpp
index bec63b284b..443cbe6e05 100644
--- a/pcsx2/gui/Panels/DirPickerPanel.cpp
+++ b/pcsx2/gui/Panels/DirPickerPanel.cpp
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
using namespace wxHelpers;
@@ -62,14 +63,14 @@ void Panels::DirPickerPanel::Explore_Click( wxCommandEvent &evt )
// obtained from invoking the specified getDefault() function.
//
Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& label, const wxString& dialogLabel )
- : BaseApplicableConfigPanel( parent, wxDefaultCoord )
- , m_FolderId( folderid )
- , m_pickerCtrl( NULL )
- , m_checkCtrl( NULL )
+ : BaseApplicableConfigPanel( parent, wxVERTICAL, label )
{
+ m_FolderId = folderid;
+ m_pickerCtrl = NULL;
+ m_checkCtrl = NULL;
+
m_checkCtrl = new pxCheckBox( this, _("Use default setting") );
- wxStaticBoxSizer& s_box( *new wxStaticBoxSizer( wxVERTICAL, this, label ) );
wxFlexGridSizer& s_lower( *new wxFlexGridSizer( 2, 0, 4 ) );
s_lower.AddGrowableCol( 1 );
@@ -91,7 +92,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST
);
- s_box.Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() );
+ GetSizer()->Add( m_pickerCtrl, wxSizerFlags().Border(wxLEFT | wxRIGHT | wxTOP, 5).Expand() );
s_lower.Add( m_checkCtrl );
pxSetToolTip( m_checkCtrl, pxE( ".Tooltip:DirPicker:UseDefault",
@@ -108,9 +109,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) );
#endif
- s_box.Add( &s_lower, wxSizerFlags().Expand() );
-
- SetSizer( &s_box );
+ GetSizer()->Add( &s_lower, wxSizerFlags().Expand() );
Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DirPickerPanel::UseDefaultPath_Click ) );
@@ -145,3 +144,8 @@ void Panels::DirPickerPanel::Apply()
{
g_Conf->Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() );
}
+
+wxDirName Panels::DirPickerPanel::GetPath() const
+{
+ return wxDirName( m_pickerCtrl->GetPath() );
+}
diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp
index 11d9584ee5..10c091ce4e 100644
--- a/pcsx2/gui/Panels/GameFixesPanel.cpp
+++ b/pcsx2/gui/Panels/GameFixesPanel.cpp
@@ -18,10 +18,10 @@
using namespace wxHelpers;
-Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
- BaseApplicableConfigPanel( &parent, idealWidth)
+Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) :
+ BaseApplicableConfigPanel( parent )
{
- wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
+ wxSizer& mainSizer( *GetSizer() );
AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") );
wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") );
@@ -81,8 +81,6 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
L"will need to turn off fixes manually when changing games."
));
- SetSizer( &mainSizer );
-
}
// I could still probably get rid of the for loop, but I think this is clearer.
diff --git a/pcsx2/gui/Panels/LogOptionsPanels.cpp b/pcsx2/gui/Panels/LogOptionsPanels.cpp
index bd97ff2a17..698a5635a5 100644
--- a/pcsx2/gui/Panels/LogOptionsPanels.cpp
+++ b/pcsx2/gui/Panels/LogOptionsPanels.cpp
@@ -188,12 +188,13 @@ void Panels::iopLogOptionsPanel::OnSettingsChanged()
// --------------------------------------------------------------------------------------
// LogOptionsPanel Implementations
// --------------------------------------------------------------------------------------
-Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent, int idealWidth )
- : BaseApplicableConfigPanel( parent, idealWidth )
+Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
, m_eeSection ( *new eeLogOptionsPanel( this ) )
, m_iopSection ( *new iopLogOptionsPanel( this ) )
{
- wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
+ wxSizer& s_main( *GetSizer() );
+
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" );
@@ -215,13 +216,12 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent, int idealWidth )
topSizer.Add( &m_eeSection, StdSpace() );
topSizer.Add( &m_iopSection, StdSpace() );
- mainsizer.Add( m_masterEnabler, StdSpace() );
- mainsizer.Add( new wxStaticLine( this, wxID_ANY ), StdExpand().Border(wxLEFT | wxRIGHT, 20) );
- mainsizer.AddSpacer( 5 );
- mainsizer.Add( &topSizer );
- mainsizer.Add( &s_misc, StdSpace().Centre() );
+ s_main.Add( m_masterEnabler, StdSpace() );
+ s_main.Add( new wxStaticLine( this, wxID_ANY ), StdExpand().Border(wxLEFT | wxRIGHT, 20) );
+ s_main.AddSpacer( 5 );
+ s_main.Add( &topSizer );
+ s_main.Add( &s_misc, StdSpace().Centre() );
- SetSizer( &mainsizer );
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) );
OnSettingsChanged();
diff --git a/pcsx2/gui/Panels/LogOptionsPanels.h b/pcsx2/gui/Panels/LogOptionsPanels.h
index 0a1dc9bc1c..2035556a0a 100644
--- a/pcsx2/gui/Panels/LogOptionsPanels.h
+++ b/pcsx2/gui/Panels/LogOptionsPanels.h
@@ -15,9 +15,7 @@
#pragma once
-
-#include "BaseConfigPanel.h"
-#include "CheckedStaticBox.h"
+#include "AppCommon.h"
namespace Panels
{
@@ -108,7 +106,7 @@ namespace Panels
pxCheckBox* m_GIFtag;
public:
- LogOptionsPanel( wxWindow* parent, int idealWidth );
+ LogOptionsPanel( wxWindow* parent );
virtual ~LogOptionsPanel() throw() {}
void OnSettingsChanged();
diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp
index 0b78ed6cdf..f0514d33d4 100644
--- a/pcsx2/gui/Panels/MiscPanelStuff.cpp
+++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp
@@ -134,8 +134,8 @@ void Panels::BaseApplicableConfigPanel::SetFocusToMe()
// -----------------------------------------------------------------------
-Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int idealWidth, bool isFirstTime )
- : BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime )
+ : BaseApplicableConfigPanel( parent, wxVERTICAL, _("Usermode Selection") )
{
const wxString usermodeExplained( pxE( ".Panels:Usermode:Explained",
L"Please select your preferred default location for PCSX2 user-level documents below "
@@ -163,15 +163,14 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int id
),
};
- wxStaticBoxSizer* s_boxer = new wxStaticBoxSizer( wxVERTICAL, this, _( "Usermode Selection" ) );
m_radio_UserMode = new pxRadioPanel( this, UsermodeOptions );
m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 );
m_radio_UserMode->Realize();
- AddStaticText( *s_boxer, isFirstTime ? usermodeExplained : usermodeWarning );
- s_boxer->Add( m_radio_UserMode, pxSizerFlags::StdExpand() );
- s_boxer->AddSpacer( 4 );
- SetSizer( s_boxer );
+ wxSizer& s_main( *GetSizer() );
+ AddStaticText( s_main, isFirstTime ? usermodeExplained : usermodeWarning );
+ s_main.Add( m_radio_UserMode, pxSizerFlags::StdExpand() );
+ s_main.AddSpacer( 4 );
}
void Panels::UsermodeSelectionPanel::Apply()
@@ -180,8 +179,8 @@ void Panels::UsermodeSelectionPanel::Apply()
}
// -----------------------------------------------------------------------
-Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow& parent, int idealWidth )
- : BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
, m_langs()
{
m_picker = NULL;
diff --git a/pcsx2/gui/Panels/PathsPanel.cpp b/pcsx2/gui/Panels/PathsPanel.cpp
index 8365c50f46..61c5e961d2 100644
--- a/pcsx2/gui/Panels/PathsPanel.cpp
+++ b/pcsx2/gui/Panels/PathsPanel.cpp
@@ -22,13 +22,12 @@ using namespace wxHelpers;
static const int BetweenFolderSpace = 5;
// ------------------------------------------------------------------------
-Panels::BasePathsPanel::BasePathsPanel( wxWindow& parent, int idealWidth ) :
- wxPanelWithHelpers( &parent, idealWidth-12 )
-, s_main( *new wxBoxSizer( wxVERTICAL ) )
+Panels::BasePathsPanel::BasePathsPanel( wxWindow* parent )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
{
}
-Panels::DirPickerPanel& Panels::BasePathsPanel::AddDirPicker( wxBoxSizer& sizer,
+Panels::DirPickerPanel& Panels::BasePathsPanel::AddDirPicker( wxSizer& sizer,
FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel )
{
DirPickerPanel* dpan = new DirPickerPanel( this, folderid, label, popupLabel );
@@ -37,9 +36,11 @@ Panels::DirPickerPanel& Panels::BasePathsPanel::AddDirPicker( wxBoxSizer& sizer,
}
// ------------------------------------------------------------------------
-Panels::StandardPathsPanel::StandardPathsPanel( wxWindow& parent, int /* idealWidth */ ) :
+Panels::StandardPathsPanel::StandardPathsPanel( wxWindow* parent ) :
BasePathsPanel( parent )
{
+ wxSizer& s_main( *GetSizer() );
+
s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, FolderId_Savestates,
_("Savestates:"),
diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp
index eaa623d1e7..9e011ae807 100644
--- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp
+++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp
@@ -142,20 +142,21 @@ static const wxString failed_separator( L"-------- Unsupported Plugins ------
// PluginSelectorPanel implementations
// --------------------------------------------------------------------------------------
-Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent ) :
- wxPanelWithHelpers( parent )
-, m_gauge( *new wxGauge( this, wxID_ANY, 10 ) )
-, m_label( *new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE ) )
-, m_progress( 0 )
+Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
+ , m_gauge( *new wxGauge( this, wxID_ANY, 10 ) )
+ , m_label( *new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE ) )
{
- wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
+ m_progress = 0;
+
+ wxSizer& s_main( *GetSizer() );
AddStaticText( s_main, _( "Enumerating available plugins..." ) );
s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) );
s_main.Add( &m_label, pxSizerFlags::StdExpand() );
// The status bar only looks right if I use SetSizerAndFit() here.
- SetSizerAndFit( &s_main );
+ Fit(); // &s_main );
}
void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len )
@@ -179,14 +180,14 @@ void Panels::PluginSelectorPanel::StatusPanel::Reset()
static const int ButtonId_Configure = 51;
// ------------------------------------------------------------------------
-Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* parent ) :
- wxPanelWithHelpers( parent )
-, m_FolderPicker( *new DirPickerPanel( this, FolderId_Plugins,
+Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* parent )
+ : wxPanelWithHelpers( parent, wxVERTICAL )
+ , m_FolderPicker( *new DirPickerPanel( this, FolderId_Plugins,
_("Plugins Search Path:"),
_("Select a folder with PCSX2 plugins") )
)
{
- wxBoxSizer& s_main( *new wxBoxSizer( wxVERTICAL ) );
+ 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.
@@ -226,27 +227,28 @@ void Panels::PluginSelectorPanel::ComboBoxPanel::Reset()
}
// ------------------------------------------------------------------------
-Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWidth ) :
- BaseSelectorPanel( parent, idealWidth )
-, m_StatusPanel( *new StatusPanel( this ) )
-, m_ComponentBoxes( *new ComboBoxPanel( this ) )
+Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWidth )
+ : BaseSelectorPanel( parent )
{
+ if( idealWidth != wxDefaultCoord ) m_idealWidth = idealWidth;
+
+ m_StatusPanel = new StatusPanel( this );
+ m_ComponentBoxes = new ComboBoxPanel( this );
+
// 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.
- wxBoxSizer& s_main( *new wxBoxSizer( wxVERTICAL ) );
- s_main.Add( &m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
+ wxSizer& s_main( *GetSizer() );
+ s_main.Add( m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
- m_StatusPanel.Hide();
- m_ComponentBoxes.Hide();
+ m_StatusPanel->Hide();
+ m_ComponentBoxes->Hide();
// refresh button used for diagnostics... (don't think there's a point to having one otherwise) --air
//wxButton* refresh = new wxButton( this, wxID_ANY, L"Refresh" );
//s_main.Add( refresh );
//Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) );
- SetSizer( &s_main );
-
Connect( pxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) );
Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) );
Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) );
@@ -260,7 +262,7 @@ Panels::PluginSelectorPanel::~PluginSelectorPanel() throw()
void Panels::PluginSelectorPanel::ReloadSettings()
{
- m_ComponentBoxes.GetDirPicker().Reset();
+ m_ComponentBoxes->GetDirPicker().Reset();
}
static wxString GetApplyFailedMsg()
@@ -281,7 +283,7 @@ void Panels::PluginSelectorPanel::Apply()
for( int i=0; iGet(i).GetSelection();
if( sel == wxNOT_FOUND )
{
wxString plugname( tbl_PluginInfo[i].GetShortname() );
@@ -295,7 +297,7 @@ void Panels::PluginSelectorPanel::Apply()
);
}
- g_Conf->BaseFilenames.Plugins[tbl_PluginInfo[i].id] = GetFilename((int)m_ComponentBoxes.Get(i).GetClientData(sel));
+ g_Conf->BaseFilenames.Plugins[tbl_PluginInfo[i].id] = GetFilename((int)m_ComponentBoxes->Get(i).GetClientData(sel));
}
// ----------------------------------------------------------------------------
@@ -370,7 +372,7 @@ void Panels::PluginSelectorPanel::CancelRefresh()
// thread!)
void Panels::PluginSelectorPanel::DoRefresh()
{
- m_ComponentBoxes.Reset();
+ m_ComponentBoxes->Reset();
if( !m_FileList )
{
wxCommandEvent evt;
@@ -379,7 +381,7 @@ void Panels::PluginSelectorPanel::DoRefresh()
}
// Disable all controls until enumeration is complete
- m_ComponentBoxes.Hide();
+ m_ComponentBoxes->Hide();
// (including next button if it's a Wizard)
wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD );
@@ -413,7 +415,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus()
// occurs during file enumeration.
ScopedPtr pluginlist( new wxArrayString() );
- int pluggers = EnumeratePluginsInFolder( m_ComponentBoxes.GetPluginsPath(), pluginlist );
+ int pluggers = EnumeratePluginsInFolder( m_ComponentBoxes->GetPluginsPath(), pluginlist );
if( !m_FileList || (*pluginlist != *m_FileList) )
validated = false;
@@ -426,7 +428,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus()
m_FileList.SwapPtr( pluginlist );
- m_StatusPanel.SetGaugeLength( pluggers );
+ m_StatusPanel->SetGaugeLength( pluggers );
return validated;
}
@@ -435,9 +437,9 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
{
PluginsEnum_t pid = (PluginsEnum_t)(int)((wxEvtHandler*)evt.GetEventObject())->GetClientData();
- int sel = m_ComponentBoxes.Get(pid).GetSelection();
+ int sel = m_ComponentBoxes->Get(pid).GetSelection();
if( sel == wxNOT_FOUND ) return;
- wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes.Get(pid).GetClientData(sel)] );
+ wxDynamicLibrary dynlib( (*m_FileList)[(int)m_ComponentBoxes->Get(pid).GetClientData(sel)] );
if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
{
bool resume = CoreThread.Suspend();
@@ -449,9 +451,9 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
void Panels::PluginSelectorPanel::OnShowStatusBar( wxCommandEvent& evt )
{
- m_StatusPanel.SetSize( m_ComponentBoxes.GetSize().GetWidth() - 8, wxDefaultCoord );
- m_StatusPanel.CentreOnParent();
- m_StatusPanel.Show();
+ m_StatusPanel->SetSize( m_ComponentBoxes->GetSize().GetWidth() - 8, wxDefaultCoord );
+ m_StatusPanel->CentreOnParent();
+ m_StatusPanel->Show();
}
void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
@@ -464,16 +466,16 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
int emptyBoxes = 0;
for( int i=0; iGet(i).GetCount() <= 0 )
emptyBoxes++;
- else if( m_ComponentBoxes.Get(i).GetSelection() == wxNOT_FOUND )
- m_ComponentBoxes.Get(i).SetSelection( 0 );
+ else if( m_ComponentBoxes->Get(i).GetSelection() == wxNOT_FOUND )
+ m_ComponentBoxes->Get(i).SetSelection( 0 );
}
- m_ComponentBoxes.Show();
- m_StatusPanel.Hide();
- m_StatusPanel.Reset();
+ m_ComponentBoxes->Show();
+ m_StatusPanel->Hide();
+ m_StatusPanel->Reset();
wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD );
if( forwardButton != NULL )
@@ -503,7 +505,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
m_EnumeratorThread->DoNextPlugin( nextidx );
}
- m_StatusPanel.AdvanceProgress( (evtidx < m_FileList->Count()-1) ?
+ m_StatusPanel->AdvanceProgress( (evtidx < m_FileList->Count()-1) ?
(*m_FileList)[evtidx + 1] : wxString(_("Completing tasks..."))
);
@@ -520,7 +522,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
{
if( result.PassedTest & tbl_PluginInfo[i].typemask )
{
- int sel = m_ComponentBoxes.Get(i).Append( wxsFormat( L"%s %s [%s]",
+ int sel = m_ComponentBoxes->Get(i).Append( wxsFormat( L"%s %s [%s]",
result.Name.c_str(), result.Version[i].c_str(), Path::GetFilenameWithoutExt( (*m_FileList)[evtidx] ).c_str() ),
(void*)evtidx
);
@@ -532,7 +534,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
right.MakeAbsolute();
if( left == right )
- m_ComponentBoxes.Get(i).SetSelection( sel );
+ m_ComponentBoxes->Get(i).SetSelection( sel );
}
}
}
diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp
index 31a990ffd1..4a7f6a71db 100644
--- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp
+++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp
@@ -19,6 +19,7 @@
#include "System.h"
using namespace wxHelpers;
+using namespace pxSizerFlags;
static int pxGetTextHeight( const wxWindow* wind, int rows )
{
@@ -86,164 +87,231 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
return L"Unreachable Warning Suppressor!!";
}
-Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
- BaseApplicableConfigPanel( &parent, idealWidth )
+void Panels::SpeedHacksPanel::SetEEcycleSliderMsg()
{
- const Pcsx2Config::SpeedhackOptions& opts( g_Conf->EmuOptions.Speedhacks );
+ m_msg_eecycle->SetLabel( GetEEcycleSliderMsg(m_slider_eecycle->GetValue()) );
+}
+
+void Panels::SpeedHacksPanel::SetVUcycleSliderMsg()
+{
+ m_msg_vustealer->SetLabel( GetVUcycleSliderMsg(m_slider_vustealer->GetValue()) );
+}
+
+Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) :
+ BaseApplicableConfigPanel( parent )
+{
+ const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
+
+ pxStaticText* heading = new pxStaticHeading( this, pxE( ".Panels:Speedhacks:Overview",
+ L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. "
+ L"If you have issues, always try disabling these hacks first."
+ ) );
+
+ m_check_Enable = new pxCheckBox( this, _("Enable speedhacks") );
+ m_check_Enable->SetToolTip(_("The safest way to make sure that all speedhacks are completely disabled."));
+
+ m_button_Defaults = new wxButton( this, wxID_DEFAULT, _("Restore Defaults") );
+ pxSetToolTip( m_button_Defaults, _("Resets all speedhack options to their defaults, which consequently turns them all OFF.") );
+
+ wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL );
+ wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL );
+ left->SetIdealWidth( (left->GetIdealWidth() - 16) / 2 );
+ right->SetIdealWidth( (right->GetIdealWidth() - 16) / 2 );
+
+ // ------------------------------------------------------------------------
+ // EE Cyclerate Hack Section:
+
+ // Misc help text that I might find a home for later:
+ // Cycle stealing works by 'fast-forwarding' the EE by an arbitrary number of cycles whenever VU1 micro-programs
+ // are run, which works as a rough-guess skipping of what would normally be idle time spent running on the EE.
+
+ wxPanelWithHelpers* eeSliderPanel = new wxPanelWithHelpers( left, wxVERTICAL, _("EE Cyclerate") );
+
+ m_slider_eecycle = new wxSlider( eeSliderPanel, wxID_ANY, 1, 1, 3,
+ wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
+
+ m_msg_eecycle = new pxStaticHeading( eeSliderPanel ) ;//, GetEEcycleSliderMsg( 1 ) );
+ m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
+ m_msg_eecycle->SetMinSize( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 3) ) );
+
+ const wxChar* ee_tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider",
+ L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's "
+ L"R5900 core cpu, and typically brings big speedups to games that fail to utilize "
+ L"the full potential of the real PS2 hardware."
+ );
+
+ pxSetToolTip( m_slider_eecycle, ee_tooltip );
+ pxSetToolTip( m_msg_eecycle, ee_tooltip );
+
+ // ------------------------------------------------------------------------
+ // VU Cycle Stealing Hack Section:
+
+ wxPanelWithHelpers* vuSliderPanel = new wxPanelWithHelpers( right, wxVERTICAL, _("VU Cycle Stealing") );
+
+ m_slider_vustealer = new wxSlider( vuSliderPanel, wxID_ANY, 0, 0, 3, wxDefaultPosition, wxDefaultSize,
+ wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
+
+ m_msg_vustealer = new pxStaticHeading( vuSliderPanel ); //, GetVUcycleSliderMsg( 0 ) );
+ m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) );
+ m_msg_vustealer->SetMinSize( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 3) ) );
+
+ const wxChar* vu_tooltip = pxE( ".Tooltips:Speedhacks:VUCycleStealing Slider",
+ L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of "
+ L"cycles stolen from the EE for each VU microprogram the game runs."
+ );
+
+ pxSetToolTip( m_slider_vustealer, vu_tooltip );
+ pxSetToolTip( m_msg_vustealer, vu_tooltip );
// ------------------------------------------------------------------------
// microVU Hacks Section:
- // ------------------------------------------------------------------------
+
+ wxPanelWithHelpers* vuHacksPanel = new wxPanelWithHelpers( right, wxVERTICAL, _("microVU Hacks") );
- m_check_vuFlagHack = new pxCheckBox( this, _("mVU Flag Hack"),
+ m_check_vuFlagHack = new pxCheckBox( vuHacksPanel, _("mVU Flag Hack"),
_("Large Speedup and High Compatibility; may cause garbage graphics, SPS, etc...") );
+ m_check_vuMinMax = new pxCheckBox( vuHacksPanel, _("mVU Min/Max Hack"),
+ _("Small Speedup; may cause black screens, garbage graphics, SPS, etc...") );
+
m_check_vuFlagHack->SetToolTip( pxE( ".Tooltips:Speedhacks:vuFlagHack",
L"Updates Status Flags only on blocks which will read them, instead of all the time. "
L"This is safe most of the time, and Super VU does something similar by default."
) );
- m_check_vuMinMax = new pxCheckBox( this, _("mVU Min/Max Hack"),
- _("Small Speedup; may cause black screens, garbage graphics, SPS, etc...") );
-
m_check_vuMinMax->SetToolTip( pxE( ".Tooltips:Speedhacks:vuMinMax",
L"Uses SSE's Min/Max Floating Point Operations instead of custom logical Min/Max routines. "
- L"Known to break Gran Tourismo 4, Tekken 5."
+ L"Known to break Gran Turismo 4, Tekken 5."
) );
-
- m_check_vuFlagHack->SetValue(opts.vuFlagHack);
- m_check_vuMinMax->SetValue(opts.vuMinMax);
-
// ------------------------------------------------------------------------
// All other hacks Section:
- // ------------------------------------------------------------------------
- m_check_intc = new pxCheckBox( this, _("Enable INTC Spin Detection"),
+ wxPanelWithHelpers* miscHacksPanel = new wxPanelWithHelpers( left, wxVERTICAL, _("Other Hacks") );
+
+ m_check_intc = new pxCheckBox( miscHacksPanel, _("Enable INTC Spin Detection"),
_("Huge speedup for some games, with almost no compatibility side effects. [Recommended]") );
+ m_check_b1fc0 = new pxCheckBox( miscHacksPanel, _("Enable BIFC0 Spin Detection"),
+ _("Moderate speedup for some games, with no known side effects. [Recommended]" ) );
+
+ m_check_IOPx2 = new pxCheckBox( miscHacksPanel, _("IOP x2 cycle rate hack"),
+ _("Small Speedup and works well with most games; may cause some games to hang during startup.") );
+
+
m_check_intc->SetToolTip( pxE( ".Tooltips:Speedhacks:INTC",
L"This hack works best for games that use the INTC Status register to wait for vsyncs, which includes primarily non-3D "
L"RPG titles. Games that do not use this method of vsync will see little or no speeup from this hack."
) );
- m_check_b1fc0 = new pxCheckBox( this, _("Enable BIFC0 Spin Detection"),
- _("Moderate speedup for some games, with no known side effects. [Recommended]" ) );
-
m_check_b1fc0->SetToolTip( pxE( ".Tooltips:Speedhacks:BIFC0",
L"This hack works especially well for Final Fantasy X and Kingdom Hearts. BIFC0 is the address of a specific block of "
L"code in the EE kernel that's run repeatedly when the EE is waiting for the IOP to complete a task. This hack detects "
L"that and responds by fast-forwarding the EE until the IOP signals that the task is complete."
) );
- m_check_IOPx2 = new pxCheckBox( this, _("IOP x2 cycle rate hack"),
- _("Small Speedup and works well with most games; may cause some games to hang during startup.") );
-
m_check_IOPx2->SetToolTip( pxE( ".Tooltips:Speedhacks:IOPx2",
L"Halves the cycle rate of the IOP, giving it an effective emulated speed of roughly 18 MHz. "
L"The speedup is very minor, so this hack is generally not recommended."
) );
- m_check_intc->SetValue(opts.IntcStat);
- m_check_b1fc0->SetValue(opts.BIFC0);
- m_check_IOPx2->SetValue(opts.IopCycleRate_X2);
-
- // ----------------------------------------------------------------------------
- // Layout Section (Sizers Bindings)
- // ----------------------------------------------------------------------------
-
- wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
- wxFlexGridSizer& cycleHacksSizer = *new wxFlexGridSizer( 2 );
-
- cycleHacksSizer.AddGrowableCol( 0, 1 );
- cycleHacksSizer.AddGrowableCol( 1, 1 );
-
- wxStaticBoxSizer& cyclerateSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("EE Cyclerate") );
- wxStaticBoxSizer& stealerSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("VU Cycle Stealing") );
- wxStaticBoxSizer& microVUSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("microVU Hacks") );
- wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Other Hacks") );
-
- AddStaticText( mainSizer, pxE( ".Panels:Speedhacks:Overview",
- L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. "
- L"If you have issues, always try disabling these hacks first."
- ) );
-
- const wxChar* tooltip; // needed because we duplicate tooltips across multiple controls.
- const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
-
- // ------------------------------------------------------------------------
- // EE Cyclerate Hack Section:
// ------------------------------------------------------------------------
+ // Layout and Size ---> (!!)
- m_slider_eecycle = new wxSlider( this, wxID_ANY, opts.EECycleRate+1, 1, 3,
- wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
+ eeSliderPanel->GetSizer()->Add( m_slider_eecycle, sliderFlags );
+ m_msg_eecycle->AddTo( *eeSliderPanel->GetSizer() );
- tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider",
- L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's "
- L"R5900 core cpu, and typically brings big speedups to games that fail to utilize "
- L"the full potential of the real PS2 hardware."
- );
+ vuSliderPanel->GetSizer()->Add( m_slider_vustealer, sliderFlags );
+ m_msg_vustealer->AddTo( *vuSliderPanel->GetSizer() );
- cyclerateSizer.Add( m_slider_eecycle, sliderFlags );
- m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( opts.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
- m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
- m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
+ vuHacksPanel->GetSizer()->Add( m_check_vuFlagHack, StdExpand() );
+ vuHacksPanel->GetSizer()->Add( m_check_vuMinMax, StdExpand() );
- pxSetToolTip( m_slider_eecycle, tooltip );
- pxSetToolTip( m_msg_eecycle, tooltip );
+ miscHacksPanel->GetSizer()->Add( m_check_intc );
+ miscHacksPanel->GetSizer()->Add( m_check_b1fc0 );
+ miscHacksPanel->GetSizer()->Add( m_check_IOPx2 );
- // ------------------------------------------------------------------------
- // VU Cycle Stealing Hack Section:
- // ------------------------------------------------------------------------
+ left->GetSizer()->Add( eeSliderPanel, StdExpand() );
+ left->GetSizer()->Add( miscHacksPanel, StdExpand() );
- m_slider_vustealer = new wxSlider( this, wxID_ANY, opts.VUCycleSteal, 0, 3, wxDefaultPosition, wxDefaultSize,
- wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
+ right->GetSizer()->Add( vuSliderPanel, StdExpand() );
+ right->GetSizer()->Add( vuHacksPanel, StdExpand() );
- tooltip = pxE( ".Tooltips:Speedhacks:VUCycleStealing Slider",
- L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of "
- L"cycles stolen from the EE for each VU microprogram the game runs."
- );
- // Misc help text that I might find a home for later:
- // Cycle stealing works by 'fast-forwarding' the EE by an arbitrary number of cycles whenever VU1 micro-programs
- // are run, which works as a rough-guess skipping of what would normally be idle time spent running on the EE.
+ 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() );
- stealerSizer.Add( m_slider_vustealer, wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
- m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( opts.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
- m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) );
- m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) );
+ 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 ) );
- pxSetToolTip( m_slider_vustealer, tooltip );
- pxSetToolTip( m_msg_vustealer, tooltip );
-
-
- microVUSizer.Add( m_check_vuFlagHack );
- microVUSizer.Add( m_check_vuMinMax );
-
- miscSizer.Add( m_check_intc );
- miscSizer.Add( m_check_b1fc0 );
- miscSizer.Add( m_check_IOPx2 );
-
- cycleHacksSizer.Add( &cyclerateSizer, pxSizerFlags::TopLevelBox() );
- cycleHacksSizer.Add( &stealerSizer, pxSizerFlags::TopLevelBox() );
-
- mainSizer.Add( &cycleHacksSizer, wxSizerFlags().Expand() );
- mainSizer.Add( µVUSizer, pxSizerFlags::TopLevelBox() );
- mainSizer.Add( &miscSizer, pxSizerFlags::TopLevelBox() );
+ wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
+ heading->AddTo( mainSizer );
+ mainSizer.Add( s_table, wxSizerFlags().Expand() );
+ mainSizer.Add( &DefEnableSizer, wxSizerFlags().Expand() );
SetSizer( &mainSizer );
- // There has to be a cleaner way to do this...
- int ids[2] = {m_slider_eecycle->GetId(), m_slider_vustealer->GetId()};
- for (int i=0; i<2; i++) {
- Connect( ids[i], wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- Connect( ids[i], wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- Connect( ids[i], wxEVT_SCROLL_LINEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- Connect( ids[i], wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- Connect( ids[i], wxEVT_SCROLL_TOP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- Connect( ids[i], wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
- }
+ // ------------------------------------------------------------------------
+
+ Connect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
+ Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
+ Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
+ Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
+ Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
+ Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( m_slider_eecycle->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::EECycleRate_Scroll ) );
Connect( m_slider_vustealer->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::VUCycleRate_Scroll ) );
+ Connect( m_check_Enable->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SpeedHacksPanel::OnEnable_Toggled ) );
+ Connect( wxID_DEFAULT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SpeedHacksPanel::Defaults_Click ) );
+
+ OnSettingsChanged();
+}
+
+void Panels::SpeedHacksPanel::EnableStuff()
+{
+ wxSizerItemList& items( s_table->GetChildren() );
+
+ wxSizerItemList::iterator it = items.begin();
+ wxSizerItemList::iterator end = items.end();
+
+ while( it != end )
+ {
+ (*it)->GetWindow()->Enable( m_check_Enable->GetValue() );
+ ++it;
+ }
+}
+
+void Panels::SpeedHacksPanel::OnSettingsChanged()
+{
+ OnSettingsChanged( g_Conf->EmuOptions.Speedhacks );
+}
+
+void Panels::SpeedHacksPanel::OnSettingsChanged( const Pcsx2Config::SpeedhackOptions& opts )
+{
+ const bool enabled = g_Conf->EnableSpeedHacks;
+
+ m_check_Enable->SetValue( !!enabled );
+
+ 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);
+
+ EnableStuff();
+
+ // Layout necessary to ensure changed slider text gets re-aligned properly
+ Layout();
}
void Panels::SpeedHacksPanel::Apply()
@@ -259,6 +327,18 @@ void Panels::SpeedHacksPanel::Apply()
opts.vuMinMax = m_check_vuMinMax->GetValue();
}
+void Panels::SpeedHacksPanel::OnEnable_Toggled( wxCommandEvent& evt )
+{
+ EnableStuff();
+ evt.Skip();
+}
+
+void Panels::SpeedHacksPanel::Defaults_Click( wxCommandEvent& evt )
+{
+ OnSettingsChanged( Pcsx2Config::SpeedhackOptions() );
+ evt.Skip();
+}
+
void Panels::SpeedHacksPanel::Slider_Click(wxScrollEvent &event) {
wxSlider* slider = (wxSlider*) event.GetEventObject();
int value = slider->GetValue();
@@ -279,16 +359,18 @@ void Panels::SpeedHacksPanel::Slider_Click(wxScrollEvent &event) {
else if (eventType == wxEVT_SCROLL_BOTTOM) {
slider->SetValue(slider->GetMax());
}
+
+ event.Skip();
}
void Panels::SpeedHacksPanel::EECycleRate_Scroll(wxScrollEvent &event)
{
- m_msg_eecycle->SetLabel(GetEEcycleSliderMsg(m_slider_eecycle->GetValue()));
+ SetEEcycleSliderMsg();
event.Skip();
}
void Panels::SpeedHacksPanel::VUCycleRate_Scroll(wxScrollEvent &event)
{
- m_msg_vustealer->SetLabel(GetVUcycleSliderMsg(m_slider_vustealer->GetValue()));
+ SetVUcycleSliderMsg();
event.Skip();
}
diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp
index b663b6c7da..a8602ef087 100644
--- a/pcsx2/gui/Panels/VideoPanel.cpp
+++ b/pcsx2/gui/Panels/VideoPanel.cpp
@@ -20,10 +20,44 @@
using namespace pxSizerFlags;
-Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth ) :
- BaseApplicableConfigPanel( &parent, idealWidth )
+template< typename WinType >
+WinType* FitToDigits( WinType* win, int digits )
{
- wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
+ int ex;
+ win->GetTextExtent( wxString( L'0', digits+1 ), &ex, NULL );
+ win->SetMinSize( wxSize( ex+10, wxDefaultCoord ) ); // +10 for text control borders/insets and junk.
+ return win;
+}
+
+template<>
+wxSpinCtrl* FitToDigits( wxSpinCtrl* win, int digits )
+{
+ // HACK!! The better way would be to create a pxSpinCtrl class that extends wxSpinCtrl and thus
+ // have access to wxSpinButton::DoGetBestSize(). But since I don't want to do that, we'll just
+ // make/fake it with a value it's pretty common to Win32/GTK/Mac:
+
+ static const int MagicSpinnerSize = 18;
+
+ int ex;
+ win->GetTextExtent( wxString( L'0', digits+1 ), &ex, NULL );
+ win->SetMinSize( wxSize( ex+10+MagicSpinnerSize, wxDefaultCoord ) ); // +10 for text control borders/insets and junk.
+ return win;
+}
+
+// Creates a text control which is right-justified and has it's minimum width configured to suit the
+// number of digits requested.
+wxTextCtrl* CreateNumericalTextCtrl( wxWindow* parent, int digits )
+{
+ wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY );
+ ctrl->SetWindowStyleFlag( wxTE_RIGHT );
+ FitToDigits( ctrl, digits );
+ return ctrl;
+}
+
+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.") );
@@ -33,26 +67,19 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth )
L"be available either."
) );
- AddStaticText( mainSizer, pxE( ".Framelimiter:Heading",
+ 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."
) );
- mainSizer.Add( m_check_LimiterDisable );
+ s_main.Add( m_check_LimiterDisable );
- m_spin_NominalPct = new wxSpinCtrl( this );
- m_spin_SlomoPct = new wxSpinCtrl( this );
- m_spin_TurboPct = new wxSpinCtrl( this );
+ m_spin_NominalPct = FitToDigits( new wxSpinCtrl( this ), 6 );
+ m_spin_SlomoPct = FitToDigits( new wxSpinCtrl( this ), 6 );
+ m_spin_TurboPct = FitToDigits( new wxSpinCtrl( this ), 6 );
- (m_text_BaseNtsc = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT );
- (m_text_BasePal = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT );
-
- 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 = CreateNumericalTextCtrl( this, 7 );
+ m_text_BasePal = CreateNumericalTextCtrl( this, 7 );
wxFlexGridSizer& s_spins = *new wxFlexGridSizer( 5 );
@@ -85,19 +112,25 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth )
AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT );
s_spins.AddSpacer( 5 );
- s_spins.Add( m_text_BaseNtsc, wxSizerFlags().Border(wxTOP, 3) );
+ 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 );
AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT );
s_spins.AddSpacer( 5 );
- s_spins.Add( m_text_BasePal, wxSizerFlags().Border(wxTOP, 3) );
+ 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 );
- mainSizer.Add( &s_spins );
+ s_main.Add( &s_spins );
- SetSizer( &mainSizer );
+
+ 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" );
}
@@ -106,35 +139,103 @@ void Panels::FramelimiterPanel::Apply()
}
-Panels::VideoPanel::VideoPanel( wxWindow& parent, int idealWidth ) :
- BaseApplicableConfigPanel( &parent, idealWidth )
+Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
+ : BaseApplicableConfigPanel( parent )
{
- m_check_CloseGS = new pxCheckBox( this, _("Hide GS window on Suspend") );
-
- m_check_CloseGS->SetToolTip( pxE( ".Tooltip:Video:HideGS",
- L"Completely closes the often large and bulky GS window when pressing "
- L"ESC or suspending the emulator. That way it won't get *in* the way!"
- ) );
+ m_text_WindowWidth = CreateNumericalTextCtrl( this, 5 );
+ m_text_WindowHeight = CreateNumericalTextCtrl( this, 5 );
- /*&AddCheckBox( mainSizer, _(""),
- wxEmptyString, // subtext
- pxE( ".Tooltip:Video:HideGS",
- L"Completely closes the often large and bulky GS window when pressing "
- L"ESC or suspending the emulator. That way it won't get *in* the way!"
+ m_check_CloseGS = new pxCheckBox( this, _("Hide GS window") );
+
+ m_check_AspectLock = new pxCheckBox( this, _("Lock Aspect Ratio") );
+
+ m_check_SizeLock = new pxCheckBox( this, _("Lock Size"),
+ pxE( ".Tooltips:Video:LockSize",
+ L"Disables the resize border for the GS window."
)
- );*/
+ );
+ m_check_VsyncEnable = new pxCheckBox( this, _("Wait for Vsync"),
+ pxE( ".Tooltips:Video:Vsync",
+ L"This reduces screen/refresh tearing but typically has a big performance hit. "
+ L"It may not work in windowed modes, and may not be supported by all GS plugins."
+ )
+ );
+
+ m_check_Fullscreen = new pxCheckBox( this, _("Force Fullscreen at Startup"),
+ pxE( ".Panels:Video:Fullscreen",
+ L"Enables automatic modeswitch to fullscreen when starting or resuming emulation."
+ )
+ );
+
+ m_check_CloseGS->SetToolTip( pxE( ".Tooltips:Video:HideGS",
+ L"Completely closes the often large and bulky GS window when pressing "
+ L"ESC or suspending the emulator. Might prevent memory leaks too, if you use DX10."
+ ) );
+
+ // ----------------------------------------------------------------------------
+ // 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 );
+
+ //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) );
+
+
+ wxBoxSizer& s_main( *new wxBoxSizer( wxVERTICAL ) );
+ SetSizer( &s_main );
+
+ 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 );
- wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
- wxStaticBoxSizer& limitSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Framelimiter") );
+}
+
+void Panels::GSWindowSettingsPanel::Apply()
+{
+}
+
+Panels::VideoPanel::VideoPanel( wxWindow* parent ) :
+ BaseApplicableConfigPanel( parent )
+{
+ wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL );
+ wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL );
+ left->SetIdealWidth( (left->GetIdealWidth()-16) / 2 );
+ right->SetIdealWidth( (right->GetIdealWidth()-16) / 2 );
+
+ GSWindowSettingsPanel* winpan = new GSWindowSettingsPanel( left );
+ winpan->AddStaticBox(_("Display/Window"));
+
+ 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() );
- limitSizer.Add( new FramelimiterPanel( *this, idealWidth - 32 ) );
+ s_table->Add( left, StdExpand() );
+ s_table->Add( right, StdExpand() );
- mainSizer.Add( m_check_CloseGS );
- mainSizer.Add( &limitSizer );
-
- SetSizer( &mainSizer );
+ s_main.Add( s_table );
// TODO:
// Framelimiting / Frameskipping / Vsync
diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj
index 1f0337dd3b..35b531f58b 100644
--- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj
+++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj
@@ -557,6 +557,10 @@
RelativePath="..\..\FiFo.cpp"
>
+
+
@@ -565,10 +569,6 @@
RelativePath="..\..\Hw.h"
>
-
-
@@ -1828,10 +1828,6 @@
RelativePath="..\..\gui\AppRes.cpp"
>
-
-
@@ -1884,10 +1880,6 @@
RelativePath="..\..\gui\Saveslots.cpp"
>
-
-
@@ -2434,11 +2426,11 @@
>
-
-
GetIdent() );
+ const wchar_t* wtf = mods[OutputModule]->GetIdent();
+ SysMessage( L"The '%s' driver test failed. Please configure\na different SoundOut module and try again.", wtf );
return -1;
}
diff --git a/plugins/spu2-x/src/Windows/CfgHelpers.cpp b/plugins/spu2-x/src/Windows/CfgHelpers.cpp
index 8e180c6a72..cb38b463ba 100644
--- a/plugins/spu2-x/src/Windows/CfgHelpers.cpp
+++ b/plugins/spu2-x/src/Windows/CfgHelpers.cpp
@@ -25,7 +25,7 @@ void SysMessage(const char *fmt, ...)
wchar_t wtmp[512];
va_start(list,fmt);
- sprintf_s(tmp,fmt,list);
+ vsprintf_s(tmp,fmt,list);
va_end(list);
swprintf_s(wtmp, L"%S", tmp);
MessageBox( GetActiveWindow(), wtmp, L"SPU2-X System Message", MB_OK | MB_SETFOREGROUND);
@@ -37,7 +37,7 @@ void SysMessage(const wchar_t *fmt, ...)
wchar_t wtmp[512];
va_start(list,fmt);
- swprintf_s(wtmp,fmt,list);
+ vswprintf_s(wtmp,fmt,list);
va_end(list);
MessageBox( GetActiveWindow(), wtmp, L"SPU2-X System Message", MB_OK | MB_SETFOREGROUND);
}