* Added a 'master' toggle to the Speedhacks panel.

* ... more WIP stuff on the Video options panel.
 * Spent 12 hrs working on crap text wrapping and window sizing issues.
 * Moved several UI classes to utilities (lots of project changes, breaks linux)
 * Fixed stilly bug in SPU2-X that prevented it from working (at all).
 * Lots of code cleanups, and 1 or 2 bugfixes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2212 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-18 07:53:02 +00:00
parent 0cac04b028
commit 4f9cd96e50
45 changed files with 1173 additions and 605 deletions

View File

@ -199,6 +199,10 @@
RelativePath="..\..\src\Utilities\AlignedMalloc.cpp" RelativePath="..\..\src\Utilities\AlignedMalloc.cpp"
> >
</File> </File>
<File
RelativePath="..\..\src\Utilities\CheckedStaticBox.cpp"
>
</File>
<File <File
RelativePath="..\..\src\Utilities\Console.cpp" RelativePath="..\..\src\Utilities\Console.cpp"
> >
@ -255,10 +259,18 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\src\Utilities\pxCheckBox.cpp"
>
</File>
<File <File
RelativePath="..\..\src\Utilities\pxRadioPanel.cpp" RelativePath="..\..\src\Utilities\pxRadioPanel.cpp"
> >
</File> </File>
<File
RelativePath="..\..\src\Utilities\pxStaticText.cpp"
>
</File>
<File <File
RelativePath="..\..\src\Utilities\Semaphore.cpp" RelativePath="..\..\src\Utilities\Semaphore.cpp"
> >
@ -283,6 +295,10 @@
RelativePath="..\..\src\Utilities\wxGuiTools.cpp" RelativePath="..\..\src\Utilities\wxGuiTools.cpp"
> >
</File> </File>
<File
RelativePath="..\..\src\Utilities\wxHelpers.cpp"
>
</File>
<Filter <Filter
Name="Linux" Name="Linux"
> >
@ -425,6 +441,10 @@
RelativePath="..\..\include\Utilities\Assertions.h" RelativePath="..\..\include\Utilities\Assertions.h"
> >
</File> </File>
<File
RelativePath="..\..\include\Utilities\CheckedStaticBox.h"
>
</File>
<File <File
RelativePath="..\..\include\Utilities\Console.h" RelativePath="..\..\include\Utilities\Console.h"
> >
@ -473,10 +493,18 @@
RelativePath="..\..\src\Utilities\PrecompiledHeader.h" RelativePath="..\..\src\Utilities\PrecompiledHeader.h"
> >
</File> </File>
<File
RelativePath="..\..\include\Utilities\pxCheckBox.h"
>
</File>
<File <File
RelativePath="..\..\include\Utilities\pxRadioPanel.h" RelativePath="..\..\include\Utilities\pxRadioPanel.h"
> >
</File> </File>
<File
RelativePath="..\..\include\Utilities\pxStaticText.h"
>
</File>
<File <File
RelativePath="..\..\include\Utilities\RedtapeWindows.h" RelativePath="..\..\include\Utilities\RedtapeWindows.h"
> >
@ -513,6 +541,10 @@
RelativePath="..\..\include\Utilities\wxGuiTools.h" RelativePath="..\..\include\Utilities\wxGuiTools.h"
> >
</File> </File>
<File
RelativePath="..\..\include\Utilities\wxHelpers.h"
>
</File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>

View File

@ -19,9 +19,6 @@
class CheckedStaticBox : public wxPanelWithHelpers class CheckedStaticBox : public wxPanelWithHelpers
{ {
protected:
wxBoxSizer& m_MasterSizer;
public: public:
wxBoxSizer& ThisSizer; // Boxsizer which holds all child items. wxBoxSizer& ThisSizer; // Boxsizer which holds all child items.
wxCheckBox& ThisToggle; // toggle which can enable/disable all child controls wxCheckBox& ThisToggle; // toggle which can enable/disable all child controls

View File

@ -16,18 +16,9 @@
#pragma once #pragma once
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/filepicker.h> #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 // pxCheckBox
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// The checkbox panel created uses the default spacer setting for adding checkboxes (see // 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 // both the checkbox and it's static subtext (if present), and performs word wrapping on
// platforms that need it (eg mswindows). // platforms that need it (eg mswindows).
// //
class pxCheckBox : public wxPanel class pxCheckBox : public wxPanelWithHelpers
{ {
protected: protected:
wxCheckBox* m_checkbox; wxCheckBox* m_checkbox;
wxStaticText* m_subtext; pxStaticText* m_subtext;
int m_idealWidth;
public: public:
pxCheckBox( wxPanelWithHelpers* parent, const wxString& label, const wxString& subtext=wxEmptyString ); pxCheckBox( wxWindow* parent, const wxString& label, const wxString& subtext=wxEmptyString );
pxCheckBox( wxDialogWithHelpers* parent, const wxString& label, const wxString& subtext=wxEmptyString );
virtual ~pxCheckBox() throw() {} virtual ~pxCheckBox() throw() {}
bool HasSubText() const { return m_subtext != NULL; } 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& SetToolTip( const wxString& tip );
pxCheckBox& SetValue( bool val ); pxCheckBox& SetValue( bool val );
@ -66,6 +55,3 @@ public:
protected: protected:
void Init( const wxString& label, const wxString& subtext ); void Init( const wxString& label, const wxString& subtext );
}; };
extern bool pxDialogExists( wxWindowID id );

View File

@ -18,7 +18,6 @@
#include <wx/wx.h> #include <wx/wx.h>
#include "SafeArray.h" #include "SafeArray.h"
#include "wxGuiTools.h" #include "wxGuiTools.h"
#include <vector>
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// RadioPanelItem // RadioPanelItem
@ -90,40 +89,14 @@ protected:
public: public:
template< int size > template< int size >
pxRadioPanel( wxPanelWithHelpers* parent, const RadioPanelItem (&src)[size] ) pxRadioPanel( wxWindow* parent, const RadioPanelItem (&src)[size] )
: wxPanelWithHelpers( parent, parent->GetIdealWidth()-24 ) : wxPanelWithHelpers( parent, wxVERTICAL )
{ {
Init( src, size ); Init( src, size );
} }
template< int size > pxRadioPanel( wxWindow* parent )
pxRadioPanel( wxDialogWithHelpers* parent, const RadioPanelItem (&src)[size] ) : wxPanelWithHelpers( parent, wxVERTICAL )
: 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 )
{ {
Init(); Init();
} }

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/wx.h>
#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;
};

View File

@ -23,6 +23,9 @@
#include <wx/wx.h> #include <wx/wx.h>
class pxStaticText;
class pxCheckBox;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGuiTools.h // wxGuiTools.h
// //
@ -34,6 +37,8 @@
namespace pxSizerFlags namespace pxSizerFlags
{ {
static const int StdPadding = 6;
extern wxSizerFlags StdSpace(); extern wxSizerFlags StdSpace();
extern wxSizerFlags StdCenter(); extern wxSizerFlags StdCenter();
extern wxSizerFlags StdExpand(); extern wxSizerFlags StdExpand();
@ -48,15 +53,18 @@ namespace pxSizerFlags
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
class wxDialogWithHelpers : public wxDialog class wxDialogWithHelpers : public wxDialog
{ {
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDialogWithHelpers)
protected: protected:
bool m_hasContextHelp; bool m_hasContextHelp;
int m_idealWidth; int m_idealWidth;
public: public:
wxDialogWithHelpers();
wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize ); wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
virtual ~wxDialogWithHelpers() throw(); virtual ~wxDialogWithHelpers() throw();
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int size=wxDefaultCoord ); wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE );
void AddOkCancel( wxSizer& sizer, bool hasApply=false ); void AddOkCancel( wxSizer& sizer, bool hasApply=false );
wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; } wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; }
@ -72,26 +80,27 @@ protected:
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
class wxPanelWithHelpers : public wxPanel class wxPanelWithHelpers : public wxPanel
{ {
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers)
protected: protected:
int m_idealWidth; int m_idealWidth;
bool m_StartNewRadioGroup;
public: 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 ); 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 ); // TODO : Propagate to children?
wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; }
//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; }
int GetIdealWidth() const { return m_idealWidth; } int GetIdealWidth() const { return m_idealWidth; }
bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; } bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; }
void StartRadioGroup() { m_StartNewRadioGroup = true; }
protected: protected:
void Init();
}; };
@ -217,6 +226,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
extern bool pxDialogExists( wxWindowID id );
extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos ); extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos );
extern wxRect wxGetDisplayArea(); extern wxRect wxGetDisplayArea();

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/wx.h>
#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 );
}

View File

@ -16,19 +16,16 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "CheckedStaticBox.h" #include "CheckedStaticBox.h"
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id ) : CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id )
wxPanelWithHelpers( parent, wxDefaultCoord ) : wxPanelWithHelpers( parent, wxVERTICAL )
, m_MasterSizer( *new wxBoxSizer( wxVERTICAL ) ) , ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) )
, ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) ) , ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
, ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
{ {
m_MasterSizer.Add( &ThisToggle ); GetSizer()->Add( &ThisToggle );
m_MasterSizer.Add( &ThisSizer, wxSizerFlags().Expand() ); GetSizer()->Add( &ThisSizer, wxSizerFlags().Expand() );
// Ensure that the right-side of the static group box isn't too cozy: // Ensure that the right-side of the static group box isn't too cozy:
m_MasterSizer.SetMinSize( ThisToggle.GetSize() + wxSize( 32, 0 ) ); GetSizer()->SetMinSize( ThisToggle.GetSize() + wxSize( 32, 0 ) );
SetSizer( &m_MasterSizer );
Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) ); Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) );
} }

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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();
}

View File

@ -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. // FIXME: This probably needs to be platform-dependent, and/or based on font size.
m_Indentation = 23; m_Indentation = 23;
SetSizer( new wxBoxSizer(wxVERTICAL) );
for( int i=0; i<arrsize; ++i ) for( int i=0; i<arrsize; ++i )
Append( srcArray[i] ); Append( srcArray[i] );
} }

View File

@ -0,0 +1,130 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#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;
}

View File

@ -53,7 +53,7 @@ wxRect wxGetDisplayArea()
// //
wxSizerFlags pxSizerFlags::StdSpace() wxSizerFlags pxSizerFlags::StdSpace()
{ {
return wxSizerFlags().Border( wxALL, 6 ); return wxSizerFlags().Border( wxALL, StdPadding );
} }
wxSizerFlags pxSizerFlags::StdCenter() wxSizerFlags pxSizerFlags::StdCenter()
@ -71,7 +71,7 @@ wxSizerFlags pxSizerFlags::StdExpand()
// manually by using a spacer. // manually by using a spacer.
wxSizerFlags pxSizerFlags::TopLevelBox() 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 // 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. // Groups look better with a slightly smaller margin than standard.
// (basically this accounts for the group's frame) // (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 // 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 ) pxTextWrapperBase& pxTextWrapperBase::Wrap( const wxWindow& win, const wxString& text, int widthMax )
{ {
if( text.IsEmpty() ) return *this;
const wxChar *lastSpace = NULL; const wxChar *lastSpace = NULL;
wxString line; wxString line;
line.Alloc( widthMax+12 ); line.Alloc( text.Length()+12 );
const wxChar *lineStart = text.c_str(); const wxChar *lineStart = text.c_str();
for ( const wxChar *p = lineStart; ; p++ ) for ( const wxChar *p = lineStart; ; p++ )

View File

@ -14,78 +14,13 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Utilities/HashMap.h" #include "HashMap.h"
#include "wxHelpers.h" #include "wxHelpers.h"
#include "pxStaticText.h"
#include <wx/cshelp.h> #include <wx/cshelp.h>
#include <wx/tooltip.h>
#if wxUSE_TOOLTIPS
# include <wx/tooltip.h>
#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 // 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 // alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
// or overridden. [default is left alignment] // 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. pxStaticText& temp( *new pxStaticText( parent, label, alignFlags ) );
alignFlags |= wxST_NO_AUTORESIZE; temp.AddTo( sizer );
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 ) );
return temp; 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. pxStaticText& temp( *new pxStaticText(parent, label, alignFlags ) );
alignFlags |= wxST_NO_AUTORESIZE; temp.InsertAt( sizer, position );
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 ) );
return temp; return temp;
} }
@ -134,6 +61,17 @@ bool pxDialogExists( wxWindowID id )
return (dest > 0); 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 ) 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. : 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(); //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 ) void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
@ -201,20 +139,87 @@ void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
buttonSizer->Add( &s_buttons, pxSizerFlags::StdButton() ); buttonSizer->Add( &s_buttons, pxSizerFlags::StdButton() );
} }
////////////////////////////////////////////////////////////////////////////////////////// // --------------------------------------------------------------------------------------
// // wxPanelWithHelpers Implementations
wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, int idealWidth ) : // --------------------------------------------------------------------------------------
wxPanel( parent )
IMPLEMENT_DYNAMIC_CLASS(wxPanelWithHelpers, wxPanel)
void wxPanelWithHelpers::Init()
{ {
m_idealWidth = idealWidth; m_idealWidth = wxDefaultCoord;
m_StartNewRadioGroup = true;
// 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 ) : wxPanelWithHelpers* wxPanelWithHelpers::AddStaticBox( const wxString& label, wxOrientation orient )
wxPanel( parent, wxID_ANY, pos, size )
{ {
m_idealWidth = wxDefaultCoord; wxSizer* oldSizer = GetSizer();
m_StartNewRadioGroup = true;
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 // alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
// or overridden. [default is left alignment] // 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;
}*/

30
pcsx2/gui/AppCommon.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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"

View File

@ -306,29 +306,23 @@ wxString AppConfig::FullpathToMcd( uint port, uint slot ) const
return Path::Combine( Folders.MemoryCards, Mcd[port][slot].Filename ); return Path::Combine( Folders.MemoryCards, Mcd[port][slot].Filename );
} }
AppConfig::AppConfig() : AppConfig::AppConfig()
MainGuiPosition( wxDefaultPosition ) : MainGuiPosition( wxDefaultPosition )
, SettingsTabName( L"Cpu" ) , SettingsTabName( L"Cpu" )
, LanguageId( wxLANGUAGE_DEFAULT ) , DeskTheme( L"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()
{ {
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 port=0; port<2; ++port )
{ {
for( uint slot=0; slot<4; ++slot ) for( uint slot=0; slot<4; ++slot )
@ -393,6 +387,9 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( CurrentIso ); IniEntry( CurrentIso );
IniEntry( CurrentELF ); IniEntry( CurrentELF );
IniEntry( CloseGSonEsc );
IniEntry( EnableSpeedHacks );
ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource ); ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource );
} }

View File

@ -141,6 +141,10 @@ public:
// Closes the GS/Video port on escape (good for fullscreen activity) // Closes the GS/Video port on escape (good for fullscreen activity)
bool CloseGSonEsc; 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 CurrentIso;
wxString CurrentELF; wxString CurrentELF;

View File

@ -198,7 +198,12 @@ void AppCoreThread::StateCheckInThread()
void AppCoreThread::ApplySettings( const Pcsx2Config& src ) void AppCoreThread::ApplySettings( const Pcsx2Config& src )
{ {
if( m_ExecMode != ExecMode_Closed ) return; 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 // 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 // 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; static int localc = 0;
RecursionGuard guard( localc ); RecursionGuard guard( localc );
if(guard.IsReentrant()) return; if(guard.IsReentrant()) return;
SysCoreThread::ApplySettings( src ); _parent::ApplySettings( fixup );
} }
void AppCoreThread::ExecuteTaskInThread() void AppCoreThread::ExecuteTaskInThread()

View File

@ -84,13 +84,14 @@ void Pcsx2App::ReadUserModeSettings()
// Pre-Alpha Warning! Why didn't I think to add this sooner?! // 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 ); 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 ); wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
preAlpha.AddStaticText( s_main, 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"NOTICE!! This is a *PRE-ALPHA* developer build of PCSX2 0.9.7. We are in the middle of major rewrites of the "
L"user interface, and many parts of the program have *NOT* been implemented yet. Options will be missing. " L"user interface, and many parts of the program have *NOT* been implemented yet. Options will be missing. "
L"Some things may crash or hang without warning. Other things will seem plainly stupid and the product of incompetent " L"Some things may crash or hang without warning. Other things will seem plainly stupid and the product of incompetent "
L"programmers. This is normal. We're working on it.\n\nYou have been warned!", wxALIGN_CENTER, 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() ); s_main.Add( new wxButton( &preAlpha, wxID_OK ), pxSizerFlags::StdCenter() );

View File

@ -422,7 +422,6 @@ void AppApplySettings( const AppConfig* oldconf, bool saveOnSuccess )
int toSend = 0; int toSend = 0;
sApp.Source_SettingsApplied().Dispatch( toSend ); sApp.Source_SettingsApplied().Dispatch( toSend );
CoreThread.ApplySettings( g_Conf->EmuOptions );
if( resume ) if( resume )
CoreThread.Resume(); CoreThread.Resume();

View File

@ -15,8 +15,9 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "App.h" #include "App.h"
#include "AppCommon.h"
#include "Dialogs/ModalPopups.h" #include "Dialogs/ModalPopups.h"
#include "wxHelpers.h"
#include "Resources/EmbeddedImage.h" #include "Resources/EmbeddedImage.h"
#include "Resources/Dualshock.h" #include "Resources/Dualshock.h"

View File

@ -23,6 +23,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/listbook.h> #include <wx/listbook.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/filepicker.h>
#ifdef __WXMSW__ #ifdef __WXMSW__
# include <wx/msw/wrapwin.h> // needed for Vista icon spacing fix. # include <wx/msw/wrapwin.h> // needed for Vista icon spacing fix.
@ -40,15 +41,13 @@ using namespace Panels;
static const int s_orient = wxBK_LEFT; static const int s_orient = wxBK_LEFT;
#endif #endif
static const int IdealWidth = 580;
template< typename T > template< typename T >
void Dialogs::ConfigurationDialog::AddPage( const char* label, int iconid ) void Dialogs::ConfigurationDialog::AddPage( const char* label, int iconid )
{ {
const wxString labelstr( fromUTF8( label ) ); const wxString labelstr( fromUTF8( label ) );
const int curidx = m_labels.Add( labelstr ); const int curidx = m_labels.Add( labelstr );
g_ApplyState.SetCurrentPage( curidx ); 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 ); ( labelstr == g_Conf->SettingsTabName ), iconid );
} }
@ -56,6 +55,8 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("PCSX2 Configuration"), true ) wxDialogWithHelpers( parent, id, _("PCSX2 Configuration"), true )
, m_listbook( *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, s_orient ) ) , m_listbook( *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, s_orient ) )
{ {
m_idealWidth = 600;
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
m_listbook.SetImageList( &wxGetApp().GetImgList_Config() ); 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. // to the size of the frame's ideal width.
ListView_SetIconSpacing( (HWND)m_listbook.GetListView()->GetHWND(), 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 #endif
@ -149,9 +150,10 @@ void Dialogs::ConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent, int id ) : Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("BIOS Selector"), false ) 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() ); bleh.Add( selpan, pxSizerFlags::StdExpand() );
AddOkCancel( bleh, false ); AddOkCancel( bleh, false );

View File

@ -19,7 +19,7 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/propdlg.h> #include <wx/propdlg.h>
#include "wxHelpers.h" #include "AppCommon.h"
class wxListbook; class wxListbook;

View File

@ -149,16 +149,19 @@ wxWindowID Dialogs::IssueConfirmation( wxWindow* parent, const wxString& disable
return modalResult; return modalResult;
} }
Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const ConfButtons& type, const wxString& title, const wxString& msg ) : Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const ConfButtons& type, const wxString& title, const wxString& msg )
wxDialogWithHelpers( parent, wxID_ANY, title, false ) : wxDialogWithHelpers( parent, wxID_ANY, title, false )
, m_ExtensibleSizer( *new wxBoxSizer( wxVERTICAL ) ) , m_ExtensibleSizer( *new wxBoxSizer( wxVERTICAL ) )
, m_ButtonSizer( *new wxBoxSizer( wxHORIZONTAL ) ) , m_ButtonSizer( *new wxBoxSizer( wxHORIZONTAL ) )
{ {
m_idealWidth = 500;
wxBoxSizer& mainsizer( *new wxBoxSizer(wxVERTICAL) ); wxBoxSizer& mainsizer( *new wxBoxSizer(wxVERTICAL) );
// Add the message padded some (StdCenter gives us a 5 pt padding). Helps emphasize it a bit. // Add the message padded some (StdCenter gives us a 5 pt padding). Helps emphasize it a bit.
wxBoxSizer& msgPadSizer( *new wxBoxSizer(wxVERTICAL) ); wxBoxSizer& msgPadSizer( *new wxBoxSizer(wxVERTICAL) );
AddStaticText( msgPadSizer, msg, wxALIGN_CENTRE, 444 );
msgPadSizer.Add( new pxStaticHeading( this, msg ) );
mainsizer.Add( &msgPadSizer, pxSizerFlags::StdCenter() ); mainsizer.Add( &msgPadSizer, pxSizerFlags::StdCenter() );
mainsizer.Add( &m_ExtensibleSizer, wxSizerFlags().Centre() ); mainsizer.Add( &m_ExtensibleSizer, wxSizerFlags().Centre() );

View File

@ -25,10 +25,10 @@ using namespace wxHelpers;
using namespace Panels; using namespace Panels;
template< typename T > template< typename T >
static T& MakeWizWidget( int pageid, wxWizardPage& src ) static T& MakeWizWidget( int pageid, wxWizardPage* src )
{ {
g_ApplyState.SetCurrentPage( pageid ); 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 ) : FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) :
wxWizardPageSimple( (g_ApplyState.SetCurrentPage( 0 ), 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 ) ); SetSizer( new wxBoxSizer( wxVERTICAL ) );
AddStaticTextTo( this, usermodeSizer, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") );
usermodeSizer.Add( &m_panel_LangSel, pxSizerFlags::StdCenter() ); wxPanelWithHelpers* panel = new wxPanelWithHelpers( this, wxVERTICAL );
usermodeSizer.Add( &m_panel_UserSel, wxSizerFlags().Expand().Border( wxALL, 8 ) ); panel->SetIdealWidth( 640 );
wxSizer& s_panel( *panel->GetSizer() );
usermodeSizer.AddSpacer( 6 ); m_dirpick_settings = new SettingsDirPickerPanel( panel );
usermodeSizer.Add( &m_dirpick_settings, pxSizerFlags::SubGroup() ); m_panel_LangSel = new LanguageSelectionPanel( panel );
SetSizer( &usermodeSizer ); 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) ); Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(FirstTimeWizard::UsermodePage::OnUsermodeChanged) );
} }
void FirstTimeWizard::UsermodePage::OnUsermodeChanged( wxCommandEvent& evt ) void FirstTimeWizard::UsermodePage::OnUsermodeChanged( wxCommandEvent& evt )
{ {
m_panel_UserSel.Apply(); m_panel_UserSel->Apply();
g_Conf->Folders.ApplyDefaults(); g_Conf->Folders.ApplyDefaults();
m_dirpick_settings.Reset(); m_dirpick_settings->Reset();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
FirstTimeWizard::FirstTimeWizard( wxWindow* parent ) : FirstTimeWizard::FirstTimeWizard( wxWindow* parent )
wxWizard( (g_ApplyState.StartWizard(), parent), wxID_ANY, _("PCSX2 First Time Configuration") ) : wxWizard( (g_ApplyState.StartWizard(), parent), wxID_ANY, _("PCSX2 First Time Configuration") )
, m_page_usermode( *new UsermodePage( this ) ) , m_page_usermode( *new UsermodePage( this ) )
, m_page_plugins( *new wxWizardPageSimple( this, &m_page_usermode ) ) , m_page_plugins( *new wxWizardPageSimple( this, &m_page_usermode ) )
, m_page_bios( *new wxWizardPageSimple( this, &m_page_plugins ) ) , m_page_bios( *new wxWizardPageSimple( this, &m_page_plugins ) )
, m_panel_PluginSel( MakeWizWidget<PluginSelectorPanel>( 1, m_page_plugins ) ) , m_panel_PluginSel ( MakeWizWidget<PluginSelectorPanel>( 1, &m_page_plugins ) )
, m_panel_BiosSel( MakeWizWidget<BiosSelectorPanel>( 2, m_page_bios ) ) , m_panel_BiosSel ( MakeWizWidget<BiosSelectorPanel>( 2, &m_page_bios ) )
{ {
// Page 2 - Plugins Panel // Page 2 - Plugins Panel
wxBoxSizer& pluginSizer( *new wxBoxSizer( wxVERTICAL ) ); wxBoxSizer& pluginSizer( *new wxBoxSizer( wxVERTICAL ) );

View File

@ -21,30 +21,35 @@
using namespace wxHelpers; using namespace wxHelpers;
Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) : Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent )
wxDialogWithHelpers( parent, wxID_ANY, L"Import Existing Settings?", false ) : wxDialogWithHelpers( parent, wxID_ANY, _("Import Existing Settings?"), false )
{ {
wxBoxSizer& sizer( *new wxBoxSizer( wxVERTICAL ) ); m_idealWidth = 440;
AddStaticText( sizer, pxStaticText* heading = new pxStaticHeading( this, pxE( ".Popup:ImportExistingSettings",
pxE( ".Popup:ImportExistingSettings", L"Existing PCSX2 settings have been found in the configured settings folder. "
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"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)" )
L"\n\n(or press Cancel to select a different settings folder)"
),
wxALIGN_CENTRE, 400
); );
heading->SetMinSize( wxSize( m_idealWidth-8, wxDefaultCoord ) );
wxBoxSizer& s_buttons = *new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer& s_buttons = *new wxBoxSizer( wxHORIZONTAL );
wxButton* b_import = new wxButton( this, wxID_ANY, _("Import") ); wxButton* b_import = new wxButton( this, wxID_ANY, _("Import") );
wxButton* b_over = new wxButton( this, wxID_ANY, _("Overwrite") ); 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.Add( b_import,pxSizerFlags::StdButton() );
s_buttons.AddSpacer( 16 ); s_buttons.AddSpacer( 16 );
s_buttons.Add( b_over, pxSizerFlags::StdButton() ); s_buttons.Add( b_over, pxSizerFlags::StdButton() );
s_buttons.AddSpacer( 16 ); s_buttons.AddSpacer( 16 );
s_buttons.Add( new wxButton( this, wxID_CANCEL ), pxSizerFlags::StdButton() ); s_buttons.Add( new wxButton( this, wxID_CANCEL ), pxSizerFlags::StdButton() );
sizer.AddSpacer( 4 );
heading->AddTo( sizer );
sizer.AddSpacer( 12 ); sizer.AddSpacer( 12 );
sizer.Add( &s_buttons, pxSizerFlags::StdCenter() ); sizer.Add( &s_buttons, pxSizerFlags::StdCenter() );
SetSizerAndFit( &sizer ); SetSizerAndFit( &sizer );

View File

@ -25,9 +25,10 @@ using namespace Panels;
Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent, int id ) Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent, int id )
: wxDialogWithHelpers( parent, id, _("High Volume Logging"), true ) : wxDialogWithHelpers( parent, id, _("High Volume Logging"), true )
{ {
m_idealWidth = 480;
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
mainsizer.Add( new LogOptionsPanel( this ) );
mainsizer.Add( new LogOptionsPanel( this, 480 ) );
AddOkCancel( mainsizer, true ); AddOkCancel( mainsizer, true );
FindWindow( wxID_APPLY )->Disable(); FindWindow( wxID_APPLY )->Disable();

View File

@ -17,9 +17,8 @@
#include "App.h" #include "App.h"
#include "wxHelpers.h" #include "Utilities/wxHelpers.h"
#include "CheckedStaticBox.h" #include "Utilities/CheckedStaticBox.h"
#include "Utilities/HashMap.h" #include "Utilities/HashMap.h"
using namespace HashTools; using namespace HashTools;

View File

@ -29,9 +29,9 @@ protected:
class UsermodePage : public wxWizardPageSimple class UsermodePage : public wxWizardPageSimple
{ {
protected: protected:
Panels::DirPickerPanel& m_dirpick_settings; Panels::DirPickerPanel* m_dirpick_settings;
Panels::LanguageSelectionPanel& m_panel_LangSel; Panels::LanguageSelectionPanel* m_panel_LangSel;
Panels::UsermodeSelectionPanel& m_panel_UserSel; Panels::UsermodeSelectionPanel* m_panel_UserSel;
public: public:
UsermodePage( wxWizard* parent ); UsermodePage( wxWizard* parent );

View File

@ -21,11 +21,12 @@
using namespace wxHelpers; using namespace wxHelpers;
using namespace Panels; using namespace Panels;
Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) : Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id )
wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false ) : wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
, m_panel_usersel( new UsermodeSelectionPanel( *this, 620, false ) )
, m_panel_langsel( new LanguageSelectionPanel( *this, 620 ) )
{ {
m_panel_usersel = new UsermodeSelectionPanel( this, false );
m_panel_langsel = new LanguageSelectionPanel( this );
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") ); AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") );

View File

@ -17,13 +17,6 @@
#include <list> #include <list>
#include "AppConfig.h"
#include "wxHelpers.h"
#include "Utilities/SafeArray.h"
#include "Utilities/EventSource.h"
#include "Utilities/wxGuiTools.h"
class wxListBox; class wxListBox;
class wxBookCtrlBase; class wxBookCtrlBase;
@ -138,13 +131,16 @@ namespace Panels
g_ApplyState.PanelList.remove( this ); g_ApplyState.PanelList.remove( this );
} }
BaseApplicableConfigPanel( wxWindow* parent, int idealWidth ) BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL )
: wxPanelWithHelpers( parent, idealWidth ) : wxPanelWithHelpers( parent, orient )
{ {
m_OwnerPage = g_ApplyState.CurOwnerPage; Init();
m_OwnerBook = g_ApplyState.ParentBook; }
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; } int GetOwnerPage() const { return m_OwnerPage; }
@ -161,5 +157,13 @@ namespace Panels
// of form contents fails, the function should throw Exception::CannotApplySettings. // of form contents fails, the function should throw Exception::CannotApplySettings.
// If no exceptions are thrown, then the operation is assumed a success. :) // If no exceptions are thrown, then the operation is assumed a success. :)
virtual void Apply()=0; virtual void Apply()=0;
protected:
void Init()
{
m_OwnerPage = g_ApplyState.CurOwnerPage;
m_OwnerBook = g_ApplyState.ParentBook;
g_ApplyState.PanelList.push_back( this );
}
}; };
} }

View File

@ -21,14 +21,15 @@
#include "ps2/BiosTools.h" #include "ps2/BiosTools.h"
#include <wx/dir.h> #include <wx/dir.h>
#include <wx/filepicker.h>
#include <wx/listbox.h> #include <wx/listbox.h>
using namespace wxHelpers; using namespace wxHelpers;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow& parent, int idealWidth ) : Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow* parent )
BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent, wxVERTICAL )
, m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnAppliedSettings ) ) , m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnAppliedSettings ) )
{ {
Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this ); 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 ) : Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent, int idealWidth )
BaseSelectorPanel( parent, idealWidth-12 ) : BaseSelectorPanel( parent )
, m_ComboBox( *new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT | wxLB_NEEDED_SB ) ) , 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, , m_FolderPicker( *new DirPickerPanel( this, FolderId_Bios,
_("BIOS Search Path:"), // static box label _("BIOS Search Path:"), // static box label
_("Select folder with PS2 BIOS roms") // dir picker popup 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.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_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.") ); 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 ); AddStaticText( sizer, _("Select a BIOS rom:"), wxALIGN_LEFT );
sizer.Add( &m_ComboBox, pxSizerFlags::StdExpand() ); sizer.Add( &m_ComboBox, pxSizerFlags::StdExpand() );
sizer.AddSpacer( 6 ); sizer.AddSpacer( 6 );

View File

@ -25,11 +25,42 @@
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include "BaseConfigPanel.h" #include "AppCommon.h"
#include "Utilities/Threading.h" class wxDirPickerCtrl;
#include "Utilities/pxRadioPanel.h" 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<wxPanelWithHelpers*> 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 namespace Panels
{ {
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -41,7 +72,7 @@ namespace Panels
public: public:
virtual ~UsermodeSelectionPanel() { } virtual ~UsermodeSelectionPanel() { }
UsermodeSelectionPanel( wxWindow& parent, int idealWidth=wxDefaultCoord, bool isFirstTime = true ); UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime = true );
void Apply(); void Apply();
}; };
@ -56,7 +87,7 @@ namespace Panels
public: public:
virtual ~LanguageSelectionPanel() { } virtual ~LanguageSelectionPanel() { }
LanguageSelectionPanel( wxWindow& parent, int idealWidth=wxDefaultCoord ); LanguageSelectionPanel( wxWindow* parent );
void Apply(); void Apply();
}; };
@ -70,7 +101,7 @@ namespace Panels
pxRadioPanel* m_panel_RecIOP; pxRadioPanel* m_panel_RecIOP;
public: public:
CpuPanelEE( wxWindow& parent, int idealWidth ); CpuPanelEE( wxWindow* parent );
void Apply(); void Apply();
}; };
@ -81,7 +112,7 @@ namespace Panels
pxRadioPanel* m_panel_VU1; pxRadioPanel* m_panel_VU1;
public: public:
CpuPanelVU( wxWindow& parent, int idealWidth ); CpuPanelVU( wxWindow* parent );
void Apply(); void Apply();
}; };
@ -99,7 +130,7 @@ namespace Panels
pxCheckBox* m_Option_DAZ; pxCheckBox* m_Option_DAZ;
public: public:
BaseAdvancedCpuOptions( wxWindow& parent, int idealWidth ); BaseAdvancedCpuOptions( wxWindow* parent );
virtual ~BaseAdvancedCpuOptions() throw() { } virtual ~BaseAdvancedCpuOptions() throw() { }
protected: protected:
@ -110,7 +141,7 @@ namespace Panels
class AdvancedOptionsFPU : public BaseAdvancedCpuOptions class AdvancedOptionsFPU : public BaseAdvancedCpuOptions
{ {
public: public:
AdvancedOptionsFPU( wxWindow& parent, int idealWidth ); AdvancedOptionsFPU( wxWindow* parent );
virtual ~AdvancedOptionsFPU() throw() { } virtual ~AdvancedOptionsFPU() throw() { }
void Apply(); void Apply();
}; };
@ -118,7 +149,7 @@ namespace Panels
class AdvancedOptionsVU : public BaseAdvancedCpuOptions class AdvancedOptionsVU : public BaseAdvancedCpuOptions
{ {
public: public:
AdvancedOptionsVU( wxWindow& parent, int idealWidth ); AdvancedOptionsVU( wxWindow* parent );
virtual ~AdvancedOptionsVU() throw() { } virtual ~AdvancedOptionsVU() throw() { }
void Apply(); void Apply();
}; };
@ -145,20 +176,36 @@ namespace Panels
wxSpinCtrl* m_spin_FramesToDraw; wxSpinCtrl* m_spin_FramesToDraw;
public: public:
FramelimiterPanel( wxWindow& parent, int idealWidth ); FramelimiterPanel( wxWindow* parent );
virtual ~FramelimiterPanel() throw() {} virtual ~FramelimiterPanel() throw() {}
void Apply(); 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 class VideoPanel : public BaseApplicableConfigPanel
{ {
protected: protected:
pxCheckBox* m_check_CloseGS;
//wxCheckBox* m_check_CloseGS;
//wxCheckBox* m_;
public: public:
VideoPanel( wxWindow& parent, int idealWidth ); VideoPanel( wxWindow* parent );
virtual ~VideoPanel() throw() {} virtual ~VideoPanel() throw() {}
void Apply(); void Apply();
}; };
@ -168,25 +215,37 @@ namespace Panels
class SpeedHacksPanel : public BaseApplicableConfigPanel class SpeedHacksPanel : public BaseApplicableConfigPanel
{ {
protected: protected:
wxSlider* m_slider_eecycle; wxFlexGridSizer* s_table;
wxSlider* m_slider_vustealer;
wxStaticText* m_msg_eecycle;
wxStaticText* m_msg_vustealer;
pxCheckBox* m_check_intc; pxCheckBox* m_check_Enable;
pxCheckBox* m_check_b1fc0; wxButton* m_button_Defaults;
pxCheckBox* m_check_IOPx2;
pxCheckBox* m_check_vuFlagHack; wxSlider* m_slider_eecycle;
pxCheckBox* m_check_vuMinMax; 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: public:
SpeedHacksPanel( wxWindow& parent, int idealWidth ); SpeedHacksPanel( wxWindow* parent );
void Apply(); void Apply();
void EnableStuff();
void OnSettingsChanged();
void OnSettingsChanged( const Pcsx2Config::SpeedhackOptions& opt );
protected: protected:
const wxChar* GetEEcycleSliderMsg( int val ); const wxChar* GetEEcycleSliderMsg( int val );
const wxChar* GetVUcycleSliderMsg( 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 Slider_Click(wxScrollEvent &event);
void EECycleRate_Scroll(wxScrollEvent &event); void EECycleRate_Scroll(wxScrollEvent &event);
void VUCycleRate_Scroll(wxScrollEvent &event); void VUCycleRate_Scroll(wxScrollEvent &event);
@ -200,7 +259,7 @@ namespace Panels
pxCheckBox* m_checkbox[NUM_OF_GAME_FIXES]; pxCheckBox* m_checkbox[NUM_OF_GAME_FIXES];
public: public:
GameFixesPanel( wxWindow& parent, int idealWidth ); GameFixesPanel( wxWindow* parent );
void Apply(); void Apply();
}; };
@ -222,7 +281,7 @@ namespace Panels
void Apply(); void Apply();
void Reset(); void Reset();
wxDirName GetPath() const { return wxDirName( m_pickerCtrl->GetPath() ); } wxDirName GetPath() const;
DirPickerPanel& SetStaticDesc( const wxString& msg ); DirPickerPanel& SetStaticDesc( const wxString& msg );
DirPickerPanel& SetToolTip( const wxString& tip ); DirPickerPanel& SetToolTip( const wxString& tip );
@ -245,14 +304,11 @@ namespace Panels
// //
class BasePathsPanel : public wxPanelWithHelpers class BasePathsPanel : public wxPanelWithHelpers
{ {
protected:
wxBoxSizer& s_main;
public: public:
BasePathsPanel( wxWindow& parent, int idealWidth=wxDefaultCoord ); BasePathsPanel( wxWindow* parent );
protected: protected:
DirPickerPanel& AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid, DirPickerPanel& AddDirPicker( wxSizer& sizer, FoldersEnum_t folderid,
const wxString& label, const wxString& popupLabel ); const wxString& label, const wxString& popupLabel );
}; };
@ -261,7 +317,7 @@ namespace Panels
class StandardPathsPanel : public BasePathsPanel class StandardPathsPanel : public BasePathsPanel
{ {
public: public:
StandardPathsPanel( wxWindow& parent, int idealWidth ); StandardPathsPanel( wxWindow* parent );
}; };
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -273,7 +329,7 @@ namespace Panels
public: public:
virtual ~BaseSelectorPanel() throw(); virtual ~BaseSelectorPanel() throw();
BaseSelectorPanel( wxWindow& parent, int idealWidth ); BaseSelectorPanel( wxWindow* parent );
virtual bool Show( bool visible=true ); virtual bool Show( bool visible=true );
virtual void OnRefresh( wxCommandEvent& evt ); virtual void OnRefresh( wxCommandEvent& evt );
@ -294,11 +350,11 @@ namespace Panels
{ {
protected: protected:
ScopedPtr<wxArrayString> m_BiosList; ScopedPtr<wxArrayString> m_BiosList;
wxListBox& m_ComboBox; wxListBox& m_ComboBox;
DirPickerPanel& m_FolderPicker; DirPickerPanel& m_FolderPicker;
public: public:
BiosSelectorPanel( wxWindow& parent, int idealWidth ); BiosSelectorPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
virtual ~BiosSelectorPanel() throw(); virtual ~BiosSelectorPanel() throw();
protected: protected:
@ -393,8 +449,8 @@ namespace Panels
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
protected: protected:
StatusPanel& m_StatusPanel; StatusPanel* m_StatusPanel;
ComboBoxPanel& m_ComponentBoxes; ComboBoxPanel* m_ComponentBoxes;
bool m_Canceled; bool m_Canceled;
ScopedPtr<wxArrayString> m_FileList; // list of potential plugin files ScopedPtr<wxArrayString> m_FileList; // list of potential plugin files
@ -402,7 +458,7 @@ namespace Panels
public: public:
virtual ~PluginSelectorPanel() throw(); virtual ~PluginSelectorPanel() throw();
PluginSelectorPanel( wxWindow& parent, int idealWidth ); PluginSelectorPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
void CancelRefresh(); // used from destructor, stays non-virtual void CancelRefresh(); // used from destructor, stays non-virtual
void Apply(); void Apply();

View File

@ -18,8 +18,8 @@
using namespace pxSizerFlags; using namespace pxSizerFlags;
Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow& parent, int idealWidth ) Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent )
: BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent )
, s_adv( *new wxStaticBoxSizer( wxVERTICAL, this ) ) , s_adv( *new wxStaticBoxSizer( wxVERTICAL, this ) )
{ {
wxStaticBoxSizer* s_round( new wxStaticBoxSizer( wxVERTICAL, this, _("Round Mode") ) ); wxStaticBoxSizer* s_round( new wxStaticBoxSizer( wxVERTICAL, this, _("Round Mode") ) );
@ -89,8 +89,8 @@ void Panels::BaseAdvancedCpuOptions::OnRestoreDefaults(wxCommandEvent &evt)
m_Option_FTZ->SetValue(true); m_Option_FTZ->SetValue(true);
} }
Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow& parent, int idealWidth ) Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
: BaseAdvancedCpuOptions( parent, idealWidth ) : BaseAdvancedCpuOptions( parent )
{ {
s_adv.GetStaticBox()->SetLabel(_("EE/FPU Advanced Recompiler Options")); 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 ) Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent )
: BaseAdvancedCpuOptions( parent, idealWidth ) : BaseAdvancedCpuOptions( parent )
{ {
s_adv.GetStaticBox()->SetLabel(_("VU0 / VU1 Advanced Recompiler Options")); 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 ); else m_ClampModePanel->SetSelection( 0 );
} }
Panels::CpuPanelEE::CpuPanelEE( wxWindow& parent, int idealWidth ) Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
: BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent )
{ {
// i18n: No point in translating PS2 CPU names :) // i18n: No point in translating PS2 CPU names :)
wxStaticBoxSizer* s_ee = new wxStaticBoxSizer( wxVERTICAL, this, L"EmotionEngine" ); 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( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() ); 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 ); SetSizer( &s_main );
@ -204,8 +204,8 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow& parent, int idealWidth )
m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP ); m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP );
} }
Panels::CpuPanelVU::CpuPanelVU( wxWindow& parent, int idealWidth ) Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
: BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent )
{ {
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer& s_recs = *new wxFlexGridSizer( 2 ); 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( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() ); 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 ); SetSizer( &s_main );

View File

@ -19,6 +19,7 @@
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/file.h> #include <wx/file.h>
#include <wx/dir.h> #include <wx/dir.h>
#include <wx/filepicker.h>
using namespace wxHelpers; using namespace wxHelpers;
@ -62,14 +63,14 @@ void Panels::DirPickerPanel::Explore_Click( wxCommandEvent &evt )
// obtained from invoking the specified getDefault() function. // obtained from invoking the specified getDefault() function.
// //
Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& label, const wxString& dialogLabel ) Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& label, const wxString& dialogLabel )
: BaseApplicableConfigPanel( parent, wxDefaultCoord ) : BaseApplicableConfigPanel( parent, wxVERTICAL, label )
, m_FolderId( folderid )
, m_pickerCtrl( NULL )
, m_checkCtrl( NULL )
{ {
m_FolderId = folderid;
m_pickerCtrl = NULL;
m_checkCtrl = NULL;
m_checkCtrl = new pxCheckBox( this, _("Use default setting") ); m_checkCtrl = new pxCheckBox( this, _("Use default setting") );
wxStaticBoxSizer& s_box( *new wxStaticBoxSizer( wxVERTICAL, this, label ) );
wxFlexGridSizer& s_lower( *new wxFlexGridSizer( 2, 0, 4 ) ); wxFlexGridSizer& s_lower( *new wxFlexGridSizer( 2, 0, 4 ) );
s_lower.AddGrowableCol( 1 ); 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 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 ); s_lower.Add( m_checkCtrl );
pxSetToolTip( m_checkCtrl, pxE( ".Tooltip:DirPicker:UseDefault", 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 ) ); Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) );
#endif #endif
s_box.Add( &s_lower, wxSizerFlags().Expand() ); GetSizer()->Add( &s_lower, wxSizerFlags().Expand() );
SetSizer( &s_box );
Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DirPickerPanel::UseDefaultPath_Click ) ); 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() ); g_Conf->Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() );
} }
wxDirName Panels::DirPickerPanel::GetPath() const
{
return wxDirName( m_pickerCtrl->GetPath() );
}

View File

@ -18,10 +18,10 @@
using namespace wxHelpers; using namespace wxHelpers;
Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) :
BaseApplicableConfigPanel( &parent, idealWidth) BaseApplicableConfigPanel( parent )
{ {
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); wxSizer& mainSizer( *GetSizer() );
AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") ); AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") );
wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") );
@ -81,8 +81,6 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
L"will need to turn off fixes manually when changing games." 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. // I could still probably get rid of the for loop, but I think this is clearer.

View File

@ -188,12 +188,13 @@ void Panels::iopLogOptionsPanel::OnSettingsChanged()
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// LogOptionsPanel Implementations // LogOptionsPanel Implementations
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent, int idealWidth ) Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent )
: BaseApplicableConfigPanel( parent, idealWidth ) : BaseApplicableConfigPanel( parent )
, m_eeSection ( *new eeLogOptionsPanel( this ) ) , m_eeSection ( *new eeLogOptionsPanel( this ) )
, m_iopSection ( *new iopLogOptionsPanel( this ) ) , m_iopSection ( *new iopLogOptionsPanel( this ) )
{ {
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL ); wxSizer& s_main( *GetSizer() );
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" ); 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_eeSection, StdSpace() );
topSizer.Add( &m_iopSection, StdSpace() ); topSizer.Add( &m_iopSection, StdSpace() );
mainsizer.Add( m_masterEnabler, StdSpace() ); s_main.Add( m_masterEnabler, StdSpace() );
mainsizer.Add( new wxStaticLine( this, wxID_ANY ), StdExpand().Border(wxLEFT | wxRIGHT, 20) ); s_main.Add( new wxStaticLine( this, wxID_ANY ), StdExpand().Border(wxLEFT | wxRIGHT, 20) );
mainsizer.AddSpacer( 5 ); s_main.AddSpacer( 5 );
mainsizer.Add( &topSizer ); s_main.Add( &topSizer );
mainsizer.Add( &s_misc, StdSpace().Centre() ); s_main.Add( &s_misc, StdSpace().Centre() );
SetSizer( &mainsizer );
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) ); Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) );
OnSettingsChanged(); OnSettingsChanged();

View File

@ -15,9 +15,7 @@
#pragma once #pragma once
#include "AppCommon.h"
#include "BaseConfigPanel.h"
#include "CheckedStaticBox.h"
namespace Panels namespace Panels
{ {
@ -108,7 +106,7 @@ namespace Panels
pxCheckBox* m_GIFtag; pxCheckBox* m_GIFtag;
public: public:
LogOptionsPanel( wxWindow* parent, int idealWidth ); LogOptionsPanel( wxWindow* parent );
virtual ~LogOptionsPanel() throw() {} virtual ~LogOptionsPanel() throw() {}
void OnSettingsChanged(); void OnSettingsChanged();

View File

@ -134,8 +134,8 @@ void Panels::BaseApplicableConfigPanel::SetFocusToMe()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int idealWidth, bool isFirstTime ) Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime )
: BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent, wxVERTICAL, _("Usermode Selection") )
{ {
const wxString usermodeExplained( pxE( ".Panels:Usermode:Explained", const wxString usermodeExplained( pxE( ".Panels:Usermode:Explained",
L"Please select your preferred default location for PCSX2 user-level documents below " 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 = new pxRadioPanel( this, UsermodeOptions );
m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 ); m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 );
m_radio_UserMode->Realize(); m_radio_UserMode->Realize();
AddStaticText( *s_boxer, isFirstTime ? usermodeExplained : usermodeWarning ); wxSizer& s_main( *GetSizer() );
s_boxer->Add( m_radio_UserMode, pxSizerFlags::StdExpand() ); AddStaticText( s_main, isFirstTime ? usermodeExplained : usermodeWarning );
s_boxer->AddSpacer( 4 ); s_main.Add( m_radio_UserMode, pxSizerFlags::StdExpand() );
SetSizer( s_boxer ); s_main.AddSpacer( 4 );
} }
void Panels::UsermodeSelectionPanel::Apply() void Panels::UsermodeSelectionPanel::Apply()
@ -180,8 +179,8 @@ void Panels::UsermodeSelectionPanel::Apply()
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow& parent, int idealWidth ) Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
: BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent )
, m_langs() , m_langs()
{ {
m_picker = NULL; m_picker = NULL;

View File

@ -22,13 +22,12 @@ using namespace wxHelpers;
static const int BetweenFolderSpace = 5; static const int BetweenFolderSpace = 5;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::BasePathsPanel::BasePathsPanel( wxWindow& parent, int idealWidth ) : Panels::BasePathsPanel::BasePathsPanel( wxWindow* parent )
wxPanelWithHelpers( &parent, idealWidth-12 ) : wxPanelWithHelpers( parent, wxVERTICAL )
, s_main( *new wxBoxSizer( wxVERTICAL ) )
{ {
} }
Panels::DirPickerPanel& Panels::BasePathsPanel::AddDirPicker( wxBoxSizer& sizer, Panels::DirPickerPanel& Panels::BasePathsPanel::AddDirPicker( wxSizer& sizer,
FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel ) FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel )
{ {
DirPickerPanel* dpan = new DirPickerPanel( this, folderid, label, 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 ) BasePathsPanel( parent )
{ {
wxSizer& s_main( *GetSizer() );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, FolderId_Savestates, AddDirPicker( s_main, FolderId_Savestates,
_("Savestates:"), _("Savestates:"),

View File

@ -142,20 +142,21 @@ static const wxString failed_separator( L"-------- Unsupported Plugins ------
// PluginSelectorPanel implementations // PluginSelectorPanel implementations
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent ) : Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent )
wxPanelWithHelpers( parent ) : wxPanelWithHelpers( parent, wxVERTICAL )
, m_gauge( *new wxGauge( this, wxID_ANY, 10 ) ) , m_gauge( *new wxGauge( this, wxID_ANY, 10 ) )
, m_label( *new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE ) ) , m_label( *new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE ) )
, m_progress( 0 )
{ {
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); m_progress = 0;
wxSizer& s_main( *GetSizer() );
AddStaticText( s_main, _( "Enumerating available plugins..." ) ); AddStaticText( s_main, _( "Enumerating available plugins..." ) );
s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) ); s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) );
s_main.Add( &m_label, pxSizerFlags::StdExpand() ); s_main.Add( &m_label, pxSizerFlags::StdExpand() );
// The status bar only looks right if I use SetSizerAndFit() here. // The status bar only looks right if I use SetSizerAndFit() here.
SetSizerAndFit( &s_main ); Fit(); // &s_main );
} }
void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len ) void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len )
@ -179,14 +180,14 @@ void Panels::PluginSelectorPanel::StatusPanel::Reset()
static const int ButtonId_Configure = 51; static const int ButtonId_Configure = 51;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* parent ) : Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* parent )
wxPanelWithHelpers( parent ) : wxPanelWithHelpers( parent, wxVERTICAL )
, m_FolderPicker( *new DirPickerPanel( this, FolderId_Plugins, , m_FolderPicker( *new DirPickerPanel( this, FolderId_Plugins,
_("Plugins Search Path:"), _("Plugins Search Path:"),
_("Select a folder with PCSX2 plugins") ) _("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 ) ); wxFlexGridSizer& s_plugin( *new wxFlexGridSizer( NumPluginTypes, 3, 16, 10 ) );
s_plugin.SetFlexibleDirection( wxHORIZONTAL ); s_plugin.SetFlexibleDirection( wxHORIZONTAL );
s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width. s_plugin.AddGrowableCol( 1 ); // expands combo boxes to full width.
@ -226,27 +227,28 @@ void Panels::PluginSelectorPanel::ComboBoxPanel::Reset()
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWidth ) : Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWidth )
BaseSelectorPanel( parent, idealWidth ) : BaseSelectorPanel( parent )
, m_StatusPanel( *new StatusPanel( this ) )
, m_ComponentBoxes( *new ComboBoxPanel( this ) )
{ {
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 // note: the status panel is a floating window, so that it can be positioned in the
// center of the dialog after it's been fitted to the contents. // center of the dialog after it's been fitted to the contents.
wxBoxSizer& s_main( *new wxBoxSizer( wxVERTICAL ) ); wxSizer& s_main( *GetSizer() );
s_main.Add( &m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() ); s_main.Add( m_ComponentBoxes, pxSizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
m_StatusPanel.Hide(); m_StatusPanel->Hide();
m_ComponentBoxes.Hide(); m_ComponentBoxes->Hide();
// refresh button used for diagnostics... (don't think there's a point to having one otherwise) --air // 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" ); //wxButton* refresh = new wxButton( this, wxID_ANY, L"Refresh" );
//s_main.Add( refresh ); //s_main.Add( refresh );
//Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) ); //Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) );
SetSizer( &s_main );
Connect( pxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) ); Connect( pxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) );
Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) ); Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) );
Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) ); Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) );
@ -260,7 +262,7 @@ Panels::PluginSelectorPanel::~PluginSelectorPanel() throw()
void Panels::PluginSelectorPanel::ReloadSettings() void Panels::PluginSelectorPanel::ReloadSettings()
{ {
m_ComponentBoxes.GetDirPicker().Reset(); m_ComponentBoxes->GetDirPicker().Reset();
} }
static wxString GetApplyFailedMsg() static wxString GetApplyFailedMsg()
@ -281,7 +283,7 @@ void Panels::PluginSelectorPanel::Apply()
for( int i=0; i<NumPluginTypes; ++i ) for( int i=0; i<NumPluginTypes; ++i )
{ {
int sel = m_ComponentBoxes.Get(i).GetSelection(); int sel = m_ComponentBoxes->Get(i).GetSelection();
if( sel == wxNOT_FOUND ) if( sel == wxNOT_FOUND )
{ {
wxString plugname( tbl_PluginInfo[i].GetShortname() ); 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!) // thread!)
void Panels::PluginSelectorPanel::DoRefresh() void Panels::PluginSelectorPanel::DoRefresh()
{ {
m_ComponentBoxes.Reset(); m_ComponentBoxes->Reset();
if( !m_FileList ) if( !m_FileList )
{ {
wxCommandEvent evt; wxCommandEvent evt;
@ -379,7 +381,7 @@ void Panels::PluginSelectorPanel::DoRefresh()
} }
// Disable all controls until enumeration is complete // Disable all controls until enumeration is complete
m_ComponentBoxes.Hide(); m_ComponentBoxes->Hide();
// (including next button if it's a Wizard) // (including next button if it's a Wizard)
wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD ); wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD );
@ -413,7 +415,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus()
// occurs during file enumeration. // occurs during file enumeration.
ScopedPtr<wxArrayString> pluginlist( new wxArrayString() ); ScopedPtr<wxArrayString> pluginlist( new wxArrayString() );
int pluggers = EnumeratePluginsInFolder( m_ComponentBoxes.GetPluginsPath(), pluginlist ); int pluggers = EnumeratePluginsInFolder( m_ComponentBoxes->GetPluginsPath(), pluginlist );
if( !m_FileList || (*pluginlist != *m_FileList) ) if( !m_FileList || (*pluginlist != *m_FileList) )
validated = false; validated = false;
@ -426,7 +428,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus()
m_FileList.SwapPtr( pluginlist ); m_FileList.SwapPtr( pluginlist );
m_StatusPanel.SetGaugeLength( pluggers ); m_StatusPanel->SetGaugeLength( pluggers );
return validated; return validated;
} }
@ -435,9 +437,9 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
{ {
PluginsEnum_t pid = (PluginsEnum_t)(int)((wxEvtHandler*)evt.GetEventObject())->GetClientData(); 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; 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" ) ) if( PluginConfigureFnptr configfunc = (PluginConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
{ {
bool resume = CoreThread.Suspend(); bool resume = CoreThread.Suspend();
@ -449,9 +451,9 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
void Panels::PluginSelectorPanel::OnShowStatusBar( wxCommandEvent& evt ) void Panels::PluginSelectorPanel::OnShowStatusBar( wxCommandEvent& evt )
{ {
m_StatusPanel.SetSize( m_ComponentBoxes.GetSize().GetWidth() - 8, wxDefaultCoord ); m_StatusPanel->SetSize( m_ComponentBoxes->GetSize().GetWidth() - 8, wxDefaultCoord );
m_StatusPanel.CentreOnParent(); m_StatusPanel->CentreOnParent();
m_StatusPanel.Show(); m_StatusPanel->Show();
} }
void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
@ -464,16 +466,16 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
int emptyBoxes = 0; int emptyBoxes = 0;
for( int i=0; i<NumPluginTypes; ++i ) for( int i=0; i<NumPluginTypes; ++i )
{ {
if( m_ComponentBoxes.Get(i).GetCount() <= 0 ) if( m_ComponentBoxes->Get(i).GetCount() <= 0 )
emptyBoxes++; emptyBoxes++;
else if( m_ComponentBoxes.Get(i).GetSelection() == wxNOT_FOUND ) else if( m_ComponentBoxes->Get(i).GetSelection() == wxNOT_FOUND )
m_ComponentBoxes.Get(i).SetSelection( 0 ); m_ComponentBoxes->Get(i).SetSelection( 0 );
} }
m_ComponentBoxes.Show(); m_ComponentBoxes->Show();
m_StatusPanel.Hide(); m_StatusPanel->Hide();
m_StatusPanel.Reset(); m_StatusPanel->Reset();
wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD ); wxWindow* forwardButton = GetGrandParent()->FindWindow( wxID_FORWARD );
if( forwardButton != NULL ) if( forwardButton != NULL )
@ -503,7 +505,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
m_EnumeratorThread->DoNextPlugin( nextidx ); 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...")) (*m_FileList)[evtidx + 1] : wxString(_("Completing tasks..."))
); );
@ -520,7 +522,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
{ {
if( result.PassedTest & tbl_PluginInfo[i].typemask ) 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() ), result.Name.c_str(), result.Version[i].c_str(), Path::GetFilenameWithoutExt( (*m_FileList)[evtidx] ).c_str() ),
(void*)evtidx (void*)evtidx
); );
@ -532,7 +534,7 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
right.MakeAbsolute(); right.MakeAbsolute();
if( left == right ) if( left == right )
m_ComponentBoxes.Get(i).SetSelection( sel ); m_ComponentBoxes->Get(i).SetSelection( sel );
} }
} }
} }

View File

@ -19,6 +19,7 @@
#include "System.h" #include "System.h"
using namespace wxHelpers; using namespace wxHelpers;
using namespace pxSizerFlags;
static int pxGetTextHeight( const wxWindow* wind, int rows ) static int pxGetTextHeight( const wxWindow* wind, int rows )
{ {
@ -86,164 +87,231 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
return L"Unreachable Warning Suppressor!!"; return L"Unreachable Warning Suppressor!!";
} }
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) : void Panels::SpeedHacksPanel::SetEEcycleSliderMsg()
BaseApplicableConfigPanel( &parent, idealWidth )
{ {
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: // 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...") ); _("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", 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"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." 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", 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"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: // 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]") ); _("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", 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"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." 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", 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"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"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." 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", 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"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." 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, eeSliderPanel->GetSizer()->Add( m_slider_eecycle, sliderFlags );
wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS ); m_msg_eecycle->AddTo( *eeSliderPanel->GetSizer() );
tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider", vuSliderPanel->GetSizer()->Add( m_slider_vustealer, sliderFlags );
L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's " m_msg_vustealer->AddTo( *vuSliderPanel->GetSizer() );
L"R5900 core cpu, and typically brings big speedups to games that fail to utilize "
L"the full potential of the real PS2 hardware."
);
cyclerateSizer.Add( m_slider_eecycle, sliderFlags ); vuHacksPanel->GetSizer()->Add( m_check_vuFlagHack, StdExpand() );
m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( opts.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 ); vuHacksPanel->GetSizer()->Add( m_check_vuMinMax, StdExpand() );
m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
pxSetToolTip( m_slider_eecycle, tooltip ); miscHacksPanel->GetSizer()->Add( m_check_intc );
pxSetToolTip( m_msg_eecycle, tooltip ); miscHacksPanel->GetSizer()->Add( m_check_b1fc0 );
miscHacksPanel->GetSizer()->Add( m_check_IOPx2 );
// ------------------------------------------------------------------------ left->GetSizer()->Add( eeSliderPanel, StdExpand() );
// VU Cycle Stealing Hack Section: left->GetSizer()->Add( miscHacksPanel, StdExpand() );
// ------------------------------------------------------------------------
m_slider_vustealer = new wxSlider( this, wxID_ANY, opts.VUCycleSteal, 0, 3, wxDefaultPosition, wxDefaultSize, right->GetSizer()->Add( vuSliderPanel, StdExpand() );
wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS ); right->GetSizer()->Add( vuHacksPanel, StdExpand() );
tooltip = pxE( ".Tooltips:Speedhacks:VUCycleStealing Slider", s_table = new wxFlexGridSizer( 2 );
L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of " s_table->AddGrowableCol( 0 );
L"cycles stolen from the EE for each VU microprogram the game runs." s_table->AddGrowableCol( 1 );
); s_table->Add( left, wxSizerFlags().Expand() );
// Misc help text that I might find a home for later: s_table->Add( right, wxSizerFlags().Expand() );
// 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.
stealerSizer.Add( m_slider_vustealer, wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() ); wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 2, 0, 12 ) );
m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( opts.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 ); DefEnableSizer.AddGrowableCol( 1, 1 );
m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) ); DefEnableSizer.Add( m_button_Defaults, StdSpace().Align( wxALIGN_LEFT ) );
m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) ); DefEnableSizer.Add( m_check_Enable, StdSpace().Align( wxALIGN_RIGHT ) );
pxSetToolTip( m_slider_vustealer, tooltip ); wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
pxSetToolTip( m_msg_vustealer, tooltip ); heading->AddTo( mainSizer );
mainSizer.Add( s_table, wxSizerFlags().Expand() );
mainSizer.Add( &DefEnableSizer, wxSizerFlags().Expand() );
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( &microVUSizer, pxSizerFlags::TopLevelBox() );
mainSizer.Add( &miscSizer, pxSizerFlags::TopLevelBox() );
SetSizer( &mainSizer ); 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( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) ); Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) ); Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_LINEUP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) ); Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) ); Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_TOP, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) ); Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
Connect( ids[i], wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( SpeedHacksPanel::Slider_Click ) );
}
Connect( m_slider_eecycle->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::EECycleRate_Scroll ) ); 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_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() void Panels::SpeedHacksPanel::Apply()
@ -259,6 +327,18 @@ void Panels::SpeedHacksPanel::Apply()
opts.vuMinMax = m_check_vuMinMax->GetValue(); 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) { void Panels::SpeedHacksPanel::Slider_Click(wxScrollEvent &event) {
wxSlider* slider = (wxSlider*) event.GetEventObject(); wxSlider* slider = (wxSlider*) event.GetEventObject();
int value = slider->GetValue(); int value = slider->GetValue();
@ -279,16 +359,18 @@ void Panels::SpeedHacksPanel::Slider_Click(wxScrollEvent &event) {
else if (eventType == wxEVT_SCROLL_BOTTOM) { else if (eventType == wxEVT_SCROLL_BOTTOM) {
slider->SetValue(slider->GetMax()); slider->SetValue(slider->GetMax());
} }
event.Skip();
} }
void Panels::SpeedHacksPanel::EECycleRate_Scroll(wxScrollEvent &event) void Panels::SpeedHacksPanel::EECycleRate_Scroll(wxScrollEvent &event)
{ {
m_msg_eecycle->SetLabel(GetEEcycleSliderMsg(m_slider_eecycle->GetValue())); SetEEcycleSliderMsg();
event.Skip(); event.Skip();
} }
void Panels::SpeedHacksPanel::VUCycleRate_Scroll(wxScrollEvent &event) void Panels::SpeedHacksPanel::VUCycleRate_Scroll(wxScrollEvent &event)
{ {
m_msg_vustealer->SetLabel(GetVUcycleSliderMsg(m_slider_vustealer->GetValue())); SetVUcycleSliderMsg();
event.Skip(); event.Skip();
} }

View File

@ -20,10 +20,44 @@
using namespace pxSizerFlags; using namespace pxSizerFlags;
Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth ) : template< typename WinType >
BaseApplicableConfigPanel( &parent, idealWidth ) 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>( 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"), m_check_LimiterDisable = new pxCheckBox( this, _("Disable Framelimiting"),
_("Useful for running benchmarks. Toggle this option in-game by pressing F4.") ); _("Useful for running benchmarks. Toggle this option in-game by pressing F4.") );
@ -33,26 +67,19 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth )
L"be available either." 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"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." 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_NominalPct = FitToDigits( new wxSpinCtrl( this ), 6 );
m_spin_SlomoPct = new wxSpinCtrl( this ); m_spin_SlomoPct = FitToDigits( new wxSpinCtrl( this ), 6 );
m_spin_TurboPct = new wxSpinCtrl( this ); m_spin_TurboPct = FitToDigits( new wxSpinCtrl( this ), 6 );
(m_text_BaseNtsc = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT ); m_text_BaseNtsc = CreateNumericalTextCtrl( this, 7 );
(m_text_BasePal = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT ); m_text_BasePal = CreateNumericalTextCtrl( this, 7 );
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" );
wxFlexGridSizer& s_spins = *new wxFlexGridSizer( 5 ); wxFlexGridSizer& s_spins = *new wxFlexGridSizer( 5 );
@ -85,19 +112,25 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth )
AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT ); AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT );
s_spins.AddSpacer( 5 ); 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.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() );
s_spins.AddSpacer( 5 ); s_spins.AddSpacer( 5 );
AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT ); AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT );
s_spins.AddSpacer( 5 ); 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.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), StdSpace() );
s_spins.AddSpacer( 5 ); 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 ) : Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
BaseApplicableConfigPanel( &parent, idealWidth ) : BaseApplicableConfigPanel( parent )
{ {
m_check_CloseGS = new pxCheckBox( this, _("Hide GS window on Suspend") ); m_text_WindowWidth = CreateNumericalTextCtrl( this, 5 );
m_text_WindowHeight = CreateNumericalTextCtrl( this, 5 );
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!"
) );
/*&AddCheckBox( mainSizer, _(""), m_check_CloseGS = new pxCheckBox( this, _("Hide GS window") );
wxEmptyString, // subtext
pxE( ".Tooltip:Video:HideGS", m_check_AspectLock = new pxCheckBox( this, _("Lock Aspect Ratio") );
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_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 ); 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 ); s_main.Add( s_table );
mainSizer.Add( &limitSizer );
SetSizer( &mainSizer );
// TODO: // TODO:
// Framelimiting / Frameskipping / Vsync // Framelimiting / Frameskipping / Vsync

View File

@ -557,6 +557,10 @@
RelativePath="..\..\FiFo.cpp" RelativePath="..\..\FiFo.cpp"
> >
</File> </File>
<File
RelativePath="..\..\Hardware.h"
>
</File>
<File <File
RelativePath="..\..\Hw.cpp" RelativePath="..\..\Hw.cpp"
> >
@ -565,10 +569,6 @@
RelativePath="..\..\Hw.h" RelativePath="..\..\Hw.h"
> >
</File> </File>
<File
RelativePath="..\..\Hardware.h"
>
</File>
<File <File
RelativePath="..\..\HwRead.cpp" RelativePath="..\..\HwRead.cpp"
> >
@ -1828,10 +1828,6 @@
RelativePath="..\..\gui\AppRes.cpp" RelativePath="..\..\gui\AppRes.cpp"
> >
</File> </File>
<File
RelativePath="..\..\gui\CheckedStaticBox.cpp"
>
</File>
<File <File
RelativePath="..\..\gui\ConsoleLogger.cpp" RelativePath="..\..\gui\ConsoleLogger.cpp"
> >
@ -1884,10 +1880,6 @@
RelativePath="..\..\gui\Saveslots.cpp" RelativePath="..\..\gui\Saveslots.cpp"
> >
</File> </File>
<File
RelativePath="..\..\gui\wxHelpers.cpp"
>
</File>
<Filter <Filter
Name="Dialogs" Name="Dialogs"
> >
@ -2434,11 +2426,11 @@
> >
</File> </File>
<File <File
RelativePath="..\..\gui\AppConfig.h" RelativePath="..\..\gui\AppCommon.h"
> >
</File> </File>
<File <File
RelativePath="..\..\gui\CheckedStaticBox.h" RelativePath="..\..\gui\AppConfig.h"
> >
</File> </File>
<File <File
@ -2469,10 +2461,6 @@
RelativePath="..\..\gui\RecentIsoList.h" RelativePath="..\..\gui\RecentIsoList.h"
> >
</File> </File>
<File
RelativePath="..\..\gui\wxHelpers.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Win32" Name="Win32"

View File

@ -141,10 +141,11 @@ EXPORT_C_(s32) SPU2test()
} }
ReadSettings(); ReadSettings();
if( SndBuffer::Test() == 0 ) if( SndBuffer::Test() != 0 )
{ {
// TODO : Implement a proper dialog that allows the user to test different audio out drivers. // TODO : Implement a proper dialog that allows the user to test different audio out drivers.
SysMessage( L"The '%s' driver test failed. Please configure\ndifferent SoundOut module and try again.", mods[OutputModule]->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; return -1;
} }

View File

@ -25,7 +25,7 @@ void SysMessage(const char *fmt, ...)
wchar_t wtmp[512]; wchar_t wtmp[512];
va_start(list,fmt); va_start(list,fmt);
sprintf_s(tmp,fmt,list); vsprintf_s(tmp,fmt,list);
va_end(list); va_end(list);
swprintf_s(wtmp, L"%S", tmp); swprintf_s(wtmp, L"%S", tmp);
MessageBox( GetActiveWindow(), wtmp, L"SPU2-X System Message", MB_OK | MB_SETFOREGROUND); 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]; wchar_t wtmp[512];
va_start(list,fmt); va_start(list,fmt);
swprintf_s(wtmp,fmt,list); vswprintf_s(wtmp,fmt,list);
va_end(list); va_end(list);
MessageBox( GetActiveWindow(), wtmp, L"SPU2-X System Message", MB_OK | MB_SETFOREGROUND); MessageBox( GetActiveWindow(), wtmp, L"SPU2-X System Message", MB_OK | MB_SETFOREGROUND);
} }