UI: Reorganized the Speedhack panel a bit, and added graying out of the new static text labels.

Todo note: The plan is to make the Gamefixes dialog match the new way the speedhacks dialog is laid out, with the disable checkbox at the top (in case someone wants to try their hand at it!).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3171 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-06-05 14:25:41 +00:00
parent 45c19c0a18
commit 34d6384d55
8 changed files with 70 additions and 30 deletions

View File

@ -32,6 +32,10 @@ protected:
wxCheckBox* m_checkbox;
pxStaticText* m_subtext;
// padding below the subtext (if there's subtext). If there's no subtext, this value is unused.
int m_subPadding;
wxSizerItem* m_sizerItem_subtext;
public:
pxCheckBox( wxWindow* parent, const wxString& label, const wxString& subtext=wxEmptyString );
virtual ~pxCheckBox() throw() {}
@ -39,6 +43,7 @@ public:
bool HasSubText() const { return m_subtext != NULL; }
const pxStaticText* GetSubText() const { return m_subtext; }
pxCheckBox& SetSubPadding( int pad );
pxCheckBox& SetToolTip( const wxString& tip );
pxCheckBox& SetValue( bool val );
bool GetValue() const;

View File

@ -57,6 +57,8 @@ public:
virtual ~pxStaticText() throw() {}
wxFont GetFontOk() const;
bool Enable( bool enabled=true );
virtual void SetLabel(const wxString& label);
pxStaticText& SetHeight( int lines );

View File

@ -17,6 +17,8 @@
#include "pxCheckBox.h"
#include "pxStaticText.h"
using namespace pxSizerFlags;
// --------------------------------------------------------------------------------------
// pxCheckBox Implementations
// --------------------------------------------------------------------------------------
@ -30,6 +32,7 @@ pxCheckBox::pxCheckBox(wxWindow* parent, const wxString& label, const wxString&
void pxCheckBox::Init(const wxString& label, const wxString& subtext)
{
m_subtext = NULL;
m_subPadding= StdPadding*2;
m_checkbox = new wxCheckBox( this, wxID_ANY, label );
*this += m_checkbox | pxSizerFlags::StdExpand();
@ -42,8 +45,8 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext)
wxFlexGridSizer& spaced( *new wxFlexGridSizer(3) );
spaced.AddGrowableCol( 1 );
spaced += Indentation;
spaced += m_subtext | pxBorder( wxBOTTOM, 9 ).Expand();
spaced += pxSizerFlags::StdPadding;
m_sizerItem_subtext = spaced.Add( m_subtext, pxBorder( wxBOTTOM, m_subPadding ).Expand() );
//spaced += pxSizerFlags::StdPadding;
*this += &spaced | pxExpand;
}
@ -51,6 +54,17 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext)
Connect( m_checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(pxCheckBox::OnCheckpartCommand) );
}
pxCheckBox& pxCheckBox::SetSubPadding( int pad )
{
m_subPadding = pad;
if( m_sizerItem_subtext )
{
m_sizerItem_subtext->SetBorder( m_subPadding );
Fit();
}
return *this;
}
// applies the tooltip to both both the checkbox and it's static subtext (if present), and
// performs word wrapping on platforms that need it (eg mswindows).
pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )

View File

@ -136,6 +136,7 @@ wxSize pxStaticText::GetBestWrappedSize( const wxClientDC& dc ) const
int idealWidth = wxDefaultCoord;
int parentalAdjust = 0;
double parentalFactor = 1.0;
const wxWindow* millrun = this;
while( millrun )
@ -145,8 +146,8 @@ wxSize pxStaticText::GetBestWrappedSize( const wxClientDC& dc ) const
// Anyway, this fixes it -- ignore min size specifier on wxWizard!
if( wxIsKindOf( millrun, wxWizard ) ) break;
int min = millrun->GetMinWidth() - parentalAdjust;
int min = (int)((millrun->GetMinWidth() - parentalAdjust) * parentalFactor);
if( min > 0 && ((idealWidth < 0 ) || (min < idealWidth)) )
{
idealWidth = min;
@ -253,6 +254,16 @@ wxFont pxStaticText::GetFontOk() const
return font;
}
bool pxStaticText::Enable( bool enabled )
{
if( _parent::Enable(enabled))
{
Refresh();
return true;
}
return false;
}
void pxStaticText::paintEvent(wxPaintEvent& evt)
{
wxPaintDC dc( this );
@ -261,7 +272,10 @@ void pxStaticText::paintEvent(wxPaintEvent& evt)
if( dcWidth < 1 ) return;
dc.SetFont( GetFontOk() );
dc.SetTextForeground(GetForegroundColour());
if( IsEnabled() )
dc.SetTextForeground(GetForegroundColour());
else
dc.SetTextForeground(*wxLIGHT_GREY);
pxWindowTextWriter writer( dc );
writer.Align( m_align );

View File

@ -33,7 +33,7 @@ Dialogs::SysConfigDialog::SysConfigDialog(wxWindow* parent)
AddPage<CpuPanelEE> ( wxLt("EE/IOP"), cfgid.Cpu );
AddPage<CpuPanelVU> ( wxLt("VUs"), cfgid.Cpu );
AddPage<VideoPanel> ( wxLt("GS"), cfgid.Cpu );
AddPage<GSWindowSettingsPanel> ( wxLt("Window"), cfgid.Video );
AddPage<GSWindowSettingsPanel> ( wxLt("GS Window"), cfgid.Video );
AddPage<SpeedHacksPanel> ( wxLt("Speedhacks"), cfgid.Speedhacks );
AddPage<GameFixesPanel> ( wxLt("Game Fixes"), cfgid.Gamefixes );
AddPage<GameDatabasePanel> ( wxLt("Game Database"),cfgid.Plugins );

View File

@ -88,7 +88,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
s_AspectRatio += Label(_("Aspect Ratio:")) | pxMiddle;
s_AspectRatio += m_combo_AspectRatio | pxExpand;
s_AspectRatio += Label(_("Custom Window Size:")) | pxMiddle;
s_AspectRatio += Label(_("Custom Window Size:"))| pxMiddle;
s_AspectRatio += s_customsize | pxAlignRight;
*this += s_AspectRatio | StdExpand();

View File

@ -232,11 +232,11 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent )
s_misc += m_GIFtag;
s_misc += m_Elf;
*this += m_masterEnabler | StdExpand();
*this += new wxStaticLine( this, wxID_ANY ) | StdExpand().Border(wxLEFT | wxRIGHT, 20);
*this += m_masterEnabler | StdExpand();
*this += new wxStaticLine( this ) | StdExpand().Border(wxLEFT | wxRIGHT, 20);
*this += 5;
*this += topSizer | StdExpand();
*this += s_misc | StdSpace().Centre();
*this += topSizer | StdExpand();
*this += s_misc | StdSpace().Centre();
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) );

View File

@ -101,21 +101,23 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
{
const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
pxStaticText* heading = new pxStaticHeading( this, pxE( ".Panel:Speedhacks:Overview",
L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. "
L"If you have issues, always try disabling these hacks first."
) );
m_check_Enable = new pxCheckBox( this, _("Enable speedhacks"),
_("(Warning! Speedhacks can cause false FPS readings, choppy audio, and many other bugs!)"));
m_check_Enable->SetToolTip(_("The safest way to make sure that all speedhacks are completely disabled."));
m_button_Defaults = new wxButton( this, wxID_DEFAULT, _("Restore Defaults") );
pxSetToolTip( m_button_Defaults, _("Resets all speedhack options to their defaults, which consequently turns them all OFF.") );
pxE( ".Panel:Speedhacks:Overview",
L"Speedhacks usually improve emulation speed, but can cause glitches, broken audio, and "
L"false FPS readings. When having emulation problems, disable this panel first."
)
);
m_check_Enable->SetToolTip(_("A safe and easy way to make sure that all speedhacks are completely disabled.")).SetSubPadding( 1 );
wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL );
wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL );
left->SetMinWidth( 300 );
right->SetMinWidth( 300 );
m_button_Defaults = new wxButton( right, wxID_DEFAULT, _("Restore Defaults") );
pxSetToolTip( m_button_Defaults, _("Resets all speedhack options to their defaults, which consequently turns them all OFF.") );
// ------------------------------------------------------------------------
// EE Cyclerate Hack Section:
@ -217,13 +219,13 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
// ------------------------------------------------------------------------
// Layout and Size ---> (!!)
wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 3, 0, 12 ) );
DefEnableSizer.AddGrowableCol( 1, 1 );
DefEnableSizer.AddGrowableCol( 2, 10 );
//wxFlexGridSizer& DefEnableSizer( *new wxFlexGridSizer( 3, 0, 12 ) );
//DefEnableSizer.AddGrowableCol( 1, 1 );
DefEnableSizer += m_button_Defaults | StdSpace().Align( wxALIGN_LEFT );
DefEnableSizer += pxStretchSpacer(1);
DefEnableSizer += m_check_Enable | StdExpand().Align( wxALIGN_RIGHT );
//DefEnableSizer.AddGrowableCol( 2, 10 );
//DefEnableSizer.AddGrowableCol( 1, 1 );
//DefEnableSizer += m_button_Defaults | StdSpace().Align( wxALIGN_LEFT );
//DefEnableSizer += pxStretchSpacer(1);
//DefEnableSizer += m_check_Enable | StdExpand().Align( wxALIGN_RIGHT );
*eeSliderPanel += m_slider_eecycle | sliderFlags;
*eeSliderPanel += m_msg_eecycle | sliderFlags;
@ -243,6 +245,8 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
*right += vuSliderPanel | StdExpand();
*right += vuHacksPanel | StdExpand();
*right += StdPadding;
*right += m_button_Defaults| StdButton();
s_table = new wxFlexGridSizer( 2 );
s_table->AddGrowableCol( 0, 1 );
@ -250,9 +254,10 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
*s_table+= left | pxExpand;
*s_table+= right | pxExpand;
*this += heading->Bold() | pxExpand;
*this += s_table | pxExpand;
*this += DefEnableSizer | pxExpand;
*this += m_check_Enable;
*this += new wxStaticLine( this ) | pxExpand.Border(wxLEFT | wxRIGHT, 20);
*this += StdPadding;
*this += s_table | pxExpand;
// ------------------------------------------------------------------------