User Interfacing:

* Added bold text to indicate default options on CPU settings panels.
 * Hitting 'Restore Defaults' activates the Apply button.
 * Fixed some missing confirmation dialog text.
 * More conversions of interface code to use the new += and | operators.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2251 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-25 03:54:57 +00:00
parent ae42481315
commit cf05172691
14 changed files with 173 additions and 104 deletions

View File

@ -57,6 +57,7 @@ protected:
};
extern void operator+=( wxSizer& target, pxCheckBox* src );
extern void operator+=( wxSizer& target, pxCheckBox& src );
template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxCheckBox>& src )

View File

@ -84,6 +84,7 @@ protected:
wxSize m_padding;
int m_Indentation;
int m_DefaultIdx; // index of the default option (gets specific color/font treatment)
public:
template< int size >
@ -110,6 +111,7 @@ public:
pxRadioPanel& SetToolTip( int idx, const wxString& tip );
pxRadioPanel& SetSelection( int idx );
pxRadioPanel& SetDefault( int idx );
int GetSelection() const;
wxWindowID GetSelectionId() const;
@ -146,4 +148,5 @@ public:
protected:
void Init( const RadioPanelItem* srcArray=NULL, int arrsize=0 );
void _setToolTipImmediate( int idx, const wxString &tip );
void _RealizeDefaultOption();
};

View File

@ -85,6 +85,7 @@ protected:
};
extern void operator+=( wxSizer& target, pxStaticText* src );
extern void operator+=( wxSizer& target, pxStaticText& src );
template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxStaticText>& src )

View File

@ -173,6 +173,9 @@ pxWindowAndFlags<WinType> operator | ( const wxSizerFlags& _flgs, WinType& _win
extern void operator+=( wxSizer& target, wxWindow* src );
extern void operator+=( wxSizer& target, wxSizer* src );
extern void operator+=( wxSizer& target, wxWindow& src );
extern void operator+=( wxSizer& target, wxSizer& src );
extern void operator+=( wxSizer& target, int spacer );
extern void operator+=( wxWindow& target, int spacer );
@ -186,6 +189,12 @@ void operator+=( wxWindow& target, WinType* src )
*target.GetSizer() += src;
}
template< typename WinType >
void operator+=( wxWindow& target, WinType& src )
{
*target.GetSizer() += src;
}
template< typename WinType >
void operator+=( wxSizer& target, const pxWindowAndFlags<WinType>& src )
{

View File

@ -76,3 +76,8 @@ void operator+=( wxSizer& target, pxCheckBox* src )
if( !pxAssert( src != NULL ) ) return;
target.Add( src, wxSF.Expand() );
}
void operator+=( wxSizer& target, pxCheckBox& src )
{
target.Add( &src, wxSF.Expand() );
}

View File

@ -26,6 +26,7 @@
void pxRadioPanel::Init( const RadioPanelItem* srcArray, int arrsize )
{
m_DefaultIdx = -1;
m_IsRealized = false;
// FIXME: This probably needs to be platform-dependent, and/or based on font size.
@ -101,6 +102,7 @@ void pxRadioPanel::Realize()
_setToolTipImmediate( i, m_buttonStrings[i].ToolTip );
}
_RealizeDefaultOption();
}
void pxRadioPanel::_setToolTipImmediate( int idx, const wxString &tip )
@ -135,6 +137,35 @@ pxRadioPanel& pxRadioPanel::SetSelection( int idx )
return *this;
}
void pxRadioPanel::_RealizeDefaultOption()
{
if( m_IsRealized && m_DefaultIdx != -1 )
{
wxFont def( GetFont() );
def.SetWeight( wxBOLD );
//def.SetStyle( wxITALIC );
m_objects[m_DefaultIdx].LabelObj->SetFont( def );
m_objects[m_DefaultIdx].LabelObj->SetForegroundColour( wxColour( 20, 128, 40 ) );
}
}
pxRadioPanel& pxRadioPanel::SetDefault( int idx )
{
if( idx == m_DefaultIdx ) return *this;
if( m_IsRealized && m_DefaultIdx != -1 )
{
wxFont def( GetFont() );
m_objects[m_DefaultIdx].LabelObj->SetFont( def );
m_objects[m_DefaultIdx].LabelObj->SetForegroundColour( GetForegroundColour() );
}
m_DefaultIdx = idx;
_RealizeDefaultOption();
return *this;
}
int pxRadioPanel::GetSelection() const
{
if( !VerifyRealizedState() ) return 0;

View File

@ -127,3 +127,7 @@ void operator+=( wxSizer& target, pxStaticText* src )
src->AddTo( target );
}
void operator+=( wxSizer& target, pxStaticText& src )
{
src.AddTo( target );
}

View File

@ -120,6 +120,16 @@ void operator+=( wxSizer& target, wxSizer* src )
target.Add( src );
}
void operator+=( wxSizer& target, wxWindow& src )
{
target.Add( &src );
}
void operator+=( wxSizer& target, wxSizer& src )
{
target.Add( &src );
}
void operator+=( wxSizer& target, int spacer )
{
target.AddSpacer( spacer );

View File

@ -174,7 +174,7 @@ wxPanelWithHelpers* wxPanelWithHelpers::AddFrame( const wxString& label, wxOrien
Init();
if( oldSizer )
GetSizer()->Add( oldSizer );
*this += oldSizer | pxExpand;
return this;
}

View File

@ -154,15 +154,7 @@ Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const
{
m_idealWidth = 500;
wxBoxSizer& mainsizer( *new wxBoxSizer(wxVERTICAL) );
// Add the message padded some (StdCenter gives us a 5 pt padding). Helps emphasize it a bit.
wxBoxSizer& msgPadSizer( *new wxBoxSizer(wxVERTICAL) );
msgPadSizer.Add( new pxStaticHeading( this, msg ) );
mainsizer.Add( &msgPadSizer, pxSizerFlags::StdCenter() );
mainsizer.Add( &m_ExtensibleSizer, wxSizerFlags().Centre() );
SetSizer( new wxBoxSizer(wxVERTICAL) );
// Populate the Button Sizer.
// We prefer this over the built-in wxWidgets ButtonSizer stuff used for other types of
@ -217,9 +209,19 @@ Dialogs::ExtensibleConfirmation::ExtensibleConfirmation( wxWindow* parent, const
AddActionButton( wxID_CANCEL );
#endif
mainsizer.Add( &m_ButtonSizer, pxSizerFlags::StdCenter() );
// --------------------------------
// Finalize Sizers and Layout
// --------------------------------
SetSizerAndFit( &mainsizer, true );
// Add the message padded some (StdCenter gives us a 5 pt padding). Helps emphasize it a bit.
wxBoxSizer& msgPadSizer( *new wxBoxSizer(wxVERTICAL) );
msgPadSizer += Heading( msg );
*this += msgPadSizer | pxSizerFlags::StdCenter();
*this += m_ExtensibleSizer | pxCentre;
*this += m_ButtonSizer | pxSizerFlags::StdCenter();
Fit();
CenterOnScreen();
}

View File

@ -119,7 +119,6 @@ namespace Panels
class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel
{
protected:
wxStaticBoxSizer& s_adv;
//wxStaticBoxSizer& s_round;
//wxStaticBoxSizer& s_clamp;

View File

@ -20,7 +20,6 @@ using namespace pxSizerFlags;
Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent )
: BaseApplicableConfigPanel( parent )
, s_adv( *new wxStaticBoxSizer( wxVERTICAL, this ) )
{
wxStaticBoxSizer* s_round( new wxStaticBoxSizer( wxVERTICAL, this, _("Round Mode") ) );
wxStaticBoxSizer* s_clamp( new wxStaticBoxSizer( wxVERTICAL, this, _("Clamping Mode") ) );
@ -45,7 +44,14 @@ Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent )
m_RoundModePanel = new pxRadioPanel( this, RoundModeChoices );
m_ClampModePanel = new pxRadioPanel( this, ClampModeChoices );
// ====== The Fitting And Sizing Area ======
// Highlight Default Options:
m_RoundModePanel->SetDefault( 3 );
m_ClampModePanel->SetDefault( 1 );
// ---------------------------------
// The Fitting And Sizing Area
// ---------------------------------
wxFlexGridSizer& grid = *new wxFlexGridSizer( 4 );
@ -58,24 +64,22 @@ Panels::BaseAdvancedCpuOptions::BaseAdvancedCpuOptions( wxWindow* parent )
grid.AddGrowableCol( 3, 19 );
wxBoxSizer& s_daz( *new wxBoxSizer( wxVERTICAL ) );
s_daz.AddSpacer( 12 );
s_daz.Add( m_Option_FTZ );
s_daz.Add( m_Option_DAZ );
s_daz.AddSpacer( 4 );
s_daz.AddSpacer( 22 );
s_daz.Add( new wxButton( this, wxID_DEFAULT, _("Restore Defaults") ), wxSizerFlags().Align( wxALIGN_CENTRE ) );
s_daz += 12;
s_daz += m_Option_FTZ;
s_daz += m_Option_DAZ;
s_daz += 4;
s_daz += 22;
s_daz += new wxButton( this, wxID_DEFAULT, _("Restore Defaults") ) | pxCenter;
s_round->Add( m_RoundModePanel, StdExpand() );
s_clamp->Add( m_ClampModePanel, StdExpand() );
*s_round+= m_RoundModePanel | StdExpand();
*s_clamp+= m_ClampModePanel | StdExpand();
grid.Add( s_round, SubGroup() );
grid.Add( s_clamp, SubGroup() );
grid.Add( new wxBoxSizer( wxVERTICAL ) ); // spacer column!
grid.Add( &s_daz, wxSizerFlags().Expand() );
grid += s_round | SubGroup();
grid += s_clamp | SubGroup();
grid += new wxBoxSizer( wxVERTICAL ); // spacer column!
grid += &s_daz | pxExpand;
s_adv.Add( &grid, StdExpand() );
SetSizer( &s_adv );
*this += grid | StdExpand();
Connect( wxID_DEFAULT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseAdvancedCpuOptions::OnRestoreDefaults ) );
}
@ -87,15 +91,17 @@ void Panels::BaseAdvancedCpuOptions::OnRestoreDefaults(wxCommandEvent &evt)
m_Option_DAZ->SetValue(true);
m_Option_FTZ->SetValue(true);
evt.Skip();
}
Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
: BaseAdvancedCpuOptions( parent )
{
s_adv.GetStaticBox()->SetLabel(_("EE/FPU Advanced Recompiler Options"));
AddFrame(_("EE/FPU Advanced Recompiler Options"));
m_ClampModePanel->Append( _("Extra + Preserve Sign") );
m_ClampModePanel->Append( _("Full") );
m_ClampModePanel->Append(_("Extra + Preserve Sign"));
m_ClampModePanel->Append(_("Full"));
m_RoundModePanel->Realize();
m_ClampModePanel->Realize();
@ -120,10 +126,10 @@ Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent )
: BaseAdvancedCpuOptions( parent )
{
s_adv.GetStaticBox()->SetLabel(_("VU0 / VU1 Advanced Recompiler Options"));
AddFrame(_("VU0 / VU1 Advanced Recompiler Options"));
m_ClampModePanel->Append( _("Extra") );
m_ClampModePanel->Append( _("Extra + Preserve Sign") );
m_ClampModePanel->Append(_("Extra"));
m_ClampModePanel->Append(_("Extra + Preserve Sign"));
m_RoundModePanel->Realize();
m_ClampModePanel->Realize();
@ -147,16 +153,12 @@ Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent )
Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
: BaseApplicableConfigPanel( parent )
{
// i18n: No point in translating PS2 CPU names :)
wxStaticBoxSizer* s_ee = new wxStaticBoxSizer( wxVERTICAL, this, L"EmotionEngine" );
wxStaticBoxSizer* s_iop = new wxStaticBoxSizer( wxVERTICAL, this, L"IOP" );
const RadioPanelItem tbl_CpuTypes_EE[] =
{
RadioPanelItem(_("Interpreter"))
.SetToolTip(_("Quite possibly the slowest thing in the universe.")),
RadioPanelItem(_("Recompiler [Default]"))
RadioPanelItem(_("Recompiler"))
.SetToolTip(_("Performs just-in-time binary translation of 64-bit MIPS-IV machine code to x86."))
};
@ -165,36 +167,39 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
RadioPanelItem(_("Interpreter"))
.SetToolTip(_("Pretty slow; provided for diagnostic purposes only.")),
RadioPanelItem(_("Recompiler [Default]"))
RadioPanelItem(_("Recompiler"))
.SetToolTip(_("Performs just-in-time binary translation of 32-bit MIPS-I machine code to x86."))
};
m_panel_RecEE = new pxRadioPanel( this, tbl_CpuTypes_EE );
m_panel_RecIOP = new pxRadioPanel( this, tbl_CpuTypes_IOP );
m_panel_RecEE = &(new pxRadioPanel( this, tbl_CpuTypes_EE ))->SetDefault( 1 );
m_panel_RecIOP = &(new pxRadioPanel( this, tbl_CpuTypes_IOP ))->SetDefault( 1 );
m_panel_RecEE->Realize();
m_panel_RecIOP->Realize();
// ====== Begin Sizer Layout ======
// ---------------------------------
// The Fitting And Sizing Area
// ---------------------------------
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer& s_recs = *new wxFlexGridSizer( 2 );
wxFlexGridSizer& s_recs( *new wxFlexGridSizer( 2 ) );
s_recs.AddGrowableCol( 0, 1 );
s_recs.AddGrowableCol( 1, 1 );
s_ee->Add( m_panel_RecEE, StdExpand() );
s_iop->Add( m_panel_RecIOP, StdExpand() );
// i18n: No point in translating PS2 CPU names :)
wxStaticBoxSizer& s_ee ( *new wxStaticBoxSizer( wxVERTICAL, this, L"EmotionEngine" ) );
wxStaticBoxSizer& s_iop ( *new wxStaticBoxSizer( wxVERTICAL, this, L"IOP" ) );
s_recs.Add( s_ee, SubGroup() );
s_recs.Add( s_iop, SubGroup() );
s_ee += m_panel_RecEE | StdExpand();
s_iop += m_panel_RecIOP | StdExpand();
s_main.Add( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() );
s_main.Add( new AdvancedOptionsFPU( this ), StdExpand() );
s_recs += s_ee | SubGroup();
s_recs += s_iop | SubGroup();
SetSizer( &s_main );
*this += &s_recs | StdExpand();
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand();
*this += new AdvancedOptionsFPU( this ) | StdExpand();
// ====== Apply Current Configuration ======
@ -207,46 +212,45 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
: BaseApplicableConfigPanel( parent )
{
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer& s_recs = *new wxFlexGridSizer( 2 );
s_recs.AddGrowableCol( 0, 1 );
s_recs.AddGrowableCol( 1, 1 );
wxStaticBoxSizer* s_vu0 = new wxStaticBoxSizer( wxVERTICAL, this, L"VU0" );
wxStaticBoxSizer* s_vu1 = new wxStaticBoxSizer( wxVERTICAL, this, L"VU1" );
const RadioPanelItem tbl_CpuTypes_VU[] =
{
RadioPanelItem(_("Interpreter"))
.SetToolTip(_("Vector Unit Interpreter. Slow and not very compatible. Only use for diagnostics.")),
RadioPanelItem(_("microVU Recompiler [Default]"))
RadioPanelItem(_("microVU Recompiler"))
.SetToolTip(_("New Vector Unit recompiler with much improved compatibility. Recommended.")),
RadioPanelItem(_("superVU Recompiler [legacy]"))
.SetToolTip(_("Useful for diagnosing bugs or clamping issues in the new mVU recompiler."))
};
m_panel_VU0 = new pxRadioPanel( this, tbl_CpuTypes_VU );
m_panel_VU1 = new pxRadioPanel( this, tbl_CpuTypes_VU );
m_panel_VU0 = &(new pxRadioPanel( this, tbl_CpuTypes_VU )) ->SetDefault( 1 );
m_panel_VU1 = &(new pxRadioPanel( this, tbl_CpuTypes_VU )) ->SetDefault( 1 );
m_panel_VU0->Realize();
m_panel_VU1->Realize();
// ====== Begin Sizer Layout ======
// ---------------------------------
// The Fitting And Sizing Area
// ---------------------------------
s_vu0->Add( m_panel_VU0, StdExpand() );
s_vu1->Add( m_panel_VU1, StdExpand() );
wxFlexGridSizer& s_recs( *new wxFlexGridSizer( 2 ) );
s_recs.Add( s_vu0, SubGroup() );
s_recs.Add( s_vu1, SubGroup() );
s_recs.AddGrowableCol( 0, 1 );
s_recs.AddGrowableCol( 1, 1 );
s_main.Add( &s_recs, StdExpand() );
s_main.Add( new wxStaticLine( this ), wxSizerFlags().Border(wxALL, 24).Expand() );
s_main.Add( new AdvancedOptionsVU( this ), StdExpand() );
wxStaticBoxSizer& s_vu0( *new wxStaticBoxSizer( wxVERTICAL, this, L"VU0" ) );
wxStaticBoxSizer& s_vu1( *new wxStaticBoxSizer( wxVERTICAL, this, L"VU1" ) );
SetSizer( &s_main );
s_vu0 += m_panel_VU0 | StdExpand();
s_vu1 += m_panel_VU1 | StdExpand();
s_recs += s_vu0 | SubGroup();
s_recs += s_vu1 | SubGroup();
*this += &s_recs | StdExpand();
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand();
*this += new AdvancedOptionsVU( this ) | StdExpand();
// ====== Apply Current Configuration ======

View File

@ -193,34 +193,34 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent )
, m_eeSection ( *new eeLogOptionsPanel( this ) )
, m_iopSection ( *new iopLogOptionsPanel( this ) )
{
wxSizer& s_main( *GetSizer() );
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" );
m_masterEnabler = new pxCheckBox( this, _("Enable Trace Logging"),
_("Trace logs are all written to emulog.txt. Warning: Enabling trace logs is typically very slow, and is a leading cause of 'What happened to my FPS?' problems. :)") );
m_masterEnabler->SetToolTip( _("On-the-fly hotkey support: Toggle trace logging at any time using F10.") );
s_misc.Add( m_SIF = new pxCheckBox( this, L"SIF (EE<->IOP)" ));
s_misc.Add( m_VIFunpack = new pxCheckBox( this, L"VIFunpack" ));
s_misc.Add( m_GIFtag = new pxCheckBox( this, L"GIFtag" ));
m_SIF = new pxCheckBox( this, L"SIF (EE<->IOP)" );
m_VIFunpack = new pxCheckBox( this, L"VIFunpack" );
m_GIFtag = new pxCheckBox( this, L"GIFtag" );
m_SIF->SetToolTip(_("Enables logging of both SIF DMAs and SIF Register activity.") );
m_VIFunpack->SetToolTip(_("Special detailed logs of VIF packed data handling (does not include VIF control, status, or hwRegs)"));
m_GIFtag->SetToolTip(_("(not implemented yet)"));
m_SIF ->SetToolTip(_("Enables logging of both SIF DMAs and SIF Register activity.") );
m_VIFunpack ->SetToolTip(_("Special detailed logs of VIF packed data handling (does not include VIF control, status, or hwRegs)"));
m_GIFtag ->SetToolTip(_("(not implemented yet)"));
//s_head.Add( &s_misc, SizerFlags::SubGroup() );
topSizer.Add( &m_eeSection, StdSpace() );
topSizer.Add( &m_iopSection, StdSpace() );
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" );
s_main.Add( m_masterEnabler, StdSpace() );
s_main.Add( new wxStaticLine( this, wxID_ANY ), StdExpand().Border(wxLEFT | wxRIGHT, 20) );
s_main.AddSpacer( 5 );
s_main.Add( &topSizer );
s_main.Add( &s_misc, StdSpace().Centre() );
topSizer += m_eeSection | StdSpace();
topSizer += m_iopSection | StdSpace();
s_misc += m_SIF;
s_misc += m_VIFunpack;
s_misc += m_GIFtag;
*this += m_masterEnabler | StdSpace();
*this += new wxStaticLine( this, wxID_ANY ) | StdExpand().Border(wxLEFT | wxRIGHT, 20);
*this += 5;
*this += topSizer;
*this += s_misc | StdSpace().Centre();
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) );

View File

@ -96,8 +96,8 @@ void Panels::SpeedHacksPanel::SetVUcycleSliderMsg()
m_msg_vustealer->SetLabel( GetVUcycleSliderMsg(m_slider_vustealer->GetValue()) );
}
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) :
BaseApplicableConfigPanel( parent )
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent )
{
const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
@ -244,12 +244,12 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent ) :
s_table = new wxFlexGridSizer( 2 );
s_table->AddGrowableCol( 0 );
s_table->AddGrowableCol( 1 );
*s_table+= left | wxSF.Expand();
*s_table+= right | wxSF.Expand();
*s_table+= left | pxExpand;
*s_table+= right | pxExpand;
*this += heading;
*this += s_table | wxSF.Expand();
*this += DefEnableSizer | wxSF.Expand();
*this += s_table | pxExpand;
*this += DefEnableSizer | pxExpand;
// ------------------------------------------------------------------------