From f219b79ad4a7f609fadb5b89b967684253428c2c Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Fri, 4 Jun 2010 19:50:31 +0000 Subject: [PATCH] UI: Fixed a few minor layout bugs in the logging options, and introduced pxDialogCreationFlags to get rid of some Constructor Parameter Hell(tm) on dialog creation. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3155 96395faa-99c1-11dd-bbfe-3dabce05a288 --- .../wxWidgets/include/wx/msw/HeapAllocator.h | 2 +- common/include/Utilities/wxGuiTools.h | 235 ++++++++++++++++-- common/src/Utilities/ThreadingDialogs.cpp | 2 +- common/src/Utilities/wxGuiTools.cpp | 6 +- common/src/Utilities/wxHelpers.cpp | 30 +-- pcsx2/gui/AppInit.cpp | 16 +- pcsx2/gui/AppMain.cpp | 2 +- pcsx2/gui/ApplyState.h | 3 +- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 26 +- pcsx2/gui/Dialogs/AssertionDialog.cpp | 2 +- pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp | 15 +- pcsx2/gui/Dialogs/BiosSelectorDialog.cpp | 2 +- pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp | 2 +- pcsx2/gui/Dialogs/FirstTimeWizard.cpp | 2 +- pcsx2/gui/Dialogs/ImportSettingsDialog.cpp | 2 +- pcsx2/gui/Dialogs/LogOptionsDialog.cpp | 6 +- pcsx2/gui/Dialogs/PickUserModeDialog.cpp | 2 +- pcsx2/gui/Dialogs/StuckThreadDialog.cpp | 2 +- pcsx2/gui/ExecutorThread.cpp | 2 +- pcsx2/gui/IsoDropTarget.cpp | 4 +- pcsx2/gui/MainMenuClicks.cpp | 8 +- pcsx2/gui/MessageBoxes.cpp | 2 +- pcsx2/gui/Panels/DirPickerPanel.cpp | 4 +- pcsx2/gui/Panels/LogOptionsPanels.cpp | 85 ++++--- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 2 +- 25 files changed, 319 insertions(+), 145 deletions(-) diff --git a/3rdparty/wxWidgets/include/wx/msw/HeapAllocator.h b/3rdparty/wxWidgets/include/wx/msw/HeapAllocator.h index 01728ad742..e156b2b0b2 100644 --- a/3rdparty/wxWidgets/include/wx/msw/HeapAllocator.h +++ b/3rdparty/wxWidgets/include/wx/msw/HeapAllocator.h @@ -26,7 +26,7 @@ template inline void _pxDestroy_(T* _Ptr) { #ifdef _MSC_VER - _Destroy( _Ptr ); + std::_Destroy( _Ptr ); #else (_Ptr)->~T(); #endif diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index af0bb01266..014ab12466 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -15,6 +15,16 @@ #pragma once +// ---------------------------------------------------------------------------- +// wxGuiTools.h +// +// This file is meant to contain utility classes for users of the wxWidgets library. +// All classes in this file are dependent on wxBase and wxCore libraries! Meaning +// you will have to use wxCore header files and link against wxCore (GUI) to build +// them. For tools which require only wxBase, see wxBaseTools.h +// ---------------------------------------------------------------------------- + + #if wxUSE_GUI #include "Dependencies.h" @@ -28,6 +38,19 @@ class pxStaticHeading; class pxCheckBox; class wxSpinCtrl; +namespace pxSizerFlags +{ + static const int StdPadding = 4; + + extern wxSizerFlags StdSpace(); + extern wxSizerFlags StdCenter(); + extern wxSizerFlags StdExpand(); + extern wxSizerFlags TopLevelBox(); + extern wxSizerFlags SubGroup(); + extern wxSizerFlags StdButton(); + extern wxSizerFlags Checkbox(); +}; + #define wxSF wxSizerFlags() // -------------------------------------------------------------------------------------- @@ -120,7 +143,7 @@ static __forceinline wxSizerFlags pxProportion( int prop ) return wxSizerFlags( prop ); } -static __forceinline wxSizerFlags pxBorder( int dir, int pad ) +static __forceinline wxSizerFlags pxBorder( int dir=wxALL, int pad=pxSizerFlags::StdPadding ) { return wxSizerFlags().Border( dir, pad ); } @@ -274,33 +297,197 @@ void operator+=( wxSizer* target, const pxWindowAndFlags& src ) target->Add( src.window, src.flags ); } -// ---------------------------------------------------------------------------- -// wxGuiTools.h -// -// This file is meant to contain utility classes for users of the wxWidgets library. -// All classes in this file are dependent on wxBase and wxCore libraries! Meaning -// you will have to use wxCore header files and link against wxCore (GUI) to build -// them. For tools which require only wxBase, see wxBaseTools.h -// ---------------------------------------------------------------------------- - -namespace pxSizerFlags -{ - static const int StdPadding = 4; - - extern wxSizerFlags StdSpace(); - extern wxSizerFlags StdCenter(); - extern wxSizerFlags StdExpand(); - extern wxSizerFlags TopLevelBox(); - extern wxSizerFlags SubGroup(); - extern wxSizerFlags StdButton(); - extern wxSizerFlags Checkbox(); -}; BEGIN_DECLARE_EVENT_TYPES() // Added to the event queue by pxDialogWithHelpers DECLARE_EVENT_TYPE( pxEvt_OnDialogCreated, -1 ) END_DECLARE_EVENT_TYPES() + +// -------------------------------------------------------------------------------------- +// pxDialogCreationFlags +// -------------------------------------------------------------------------------------- +class pxDialogCreationFlags +{ +public: + int MinimumWidth; + wxOrientation BoxSizerOrient; + + bool isResizable; + bool hasContextHelp; + bool hasCaption; + bool hasMinimizeBox; + bool hasMaximizeBox; + bool hasSystemMenu; + bool hasCloseBox; + +public: + virtual ~pxDialogCreationFlags() throw() {} + + pxDialogCreationFlags() + { + MinimumWidth = wxDefaultCoord; + BoxSizerOrient = wxVERTICAL; + isResizable = false; + hasContextHelp = false; + + hasCloseBox = true; + hasSystemMenu = true; + hasMinimizeBox = false; + hasMaximizeBox = false; + hasCaption = true; + } + + pxDialogCreationFlags& SetSizerOrient( wxOrientation orient ) + { + BoxSizerOrient = orient; + return *this; + } + + pxDialogCreationFlags& SetResize( bool enable=true ) + { + isResizable = enable; + return *this; + } + + pxDialogCreationFlags& SetMinimize( bool enable=true ) + { + hasMinimizeBox = enable; + return *this; + } + + pxDialogCreationFlags& SetMaximize( bool enable=true ) + { + hasMaximizeBox = enable; + return *this; + } + + pxDialogCreationFlags& SetSystemMenu( bool enable=true ) + { + hasSystemMenu = enable; + return *this; + } + + pxDialogCreationFlags& SetCaption( bool enable=true ) + { + hasCaption = enable; + return *this; + } + + pxDialogCreationFlags& SetCloseBox( bool enable=true ) + { + hasCloseBox = enable; + return *this; + } + + pxDialogCreationFlags SetContextHelp( bool enabled=true ) + { + hasContextHelp = enabled; + return *this; + } + + pxDialogCreationFlags& SetMinWidth( int width ) + { + if( width > MinimumWidth ) MinimumWidth = width; + return *this; + } + + + + pxDialogCreationFlags Horizontal() const + { + return pxDialogCreationFlags(*this).SetSizerOrient( wxHORIZONTAL ); + } + + pxDialogCreationFlags Vertical() const + { + return pxDialogCreationFlags(*this).SetSizerOrient( wxVERTICAL ); + } + + pxDialogCreationFlags NoSizer() const + { + return pxDialogCreationFlags(*this).SetSizerOrient( (wxOrientation)0 ); + } + + pxDialogCreationFlags Resize( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetResize( enable ); + } + + pxDialogCreationFlags Minimize( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetMinimize( enable ); + } + + pxDialogCreationFlags Maximize( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetMaximize( enable ); + } + + pxDialogCreationFlags SystemMenu( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetSystemMenu( false ); + } + + pxDialogCreationFlags Caption( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetCaption( enable ); + } + + pxDialogCreationFlags CloseBox( bool enable=true ) const + { + return pxDialogCreationFlags(*this).SetCloseBox( enable ); + } + + pxDialogCreationFlags NoResize() const + { + return pxDialogCreationFlags(*this).SetResize( false ); + } + + pxDialogCreationFlags NoMinimize() const + { + return pxDialogCreationFlags(*this).SetMinimize( false ); + } + + pxDialogCreationFlags NoMaximize() const + { + return pxDialogCreationFlags(*this).SetMaximize( false ); + } + + pxDialogCreationFlags NoSystemMenu() const + { + return pxDialogCreationFlags(*this).SetSystemMenu( false ); + } + + pxDialogCreationFlags NoCaption() const + { + return pxDialogCreationFlags(*this).SetCaption( false ); + } + + pxDialogCreationFlags NoCloseBox() const + { + return pxDialogCreationFlags(*this).SetCloseBox( false ); + } + + pxDialogCreationFlags MinWidth( int width ) const + { + return pxDialogCreationFlags(*this).SetMinWidth( width ); + } + + int GetWxWindowFlags() const + { + int retval = 0; + if( isResizable ) retval |= wxRESIZE_BORDER; + if( hasCaption ) retval |= wxCAPTION; + if( hasMaximizeBox ) retval |= wxMAXIMIZE_BOX; + if( hasMinimizeBox ) retval |= wxMINIMIZE_BOX; + if( hasSystemMenu ) retval |= wxSYSTEM_MENU; + if( hasCloseBox ) retval |= wxCLOSE_BOX; + + return retval; + } +}; + // -------------------------------------------------------------------------------------- // wxDialogWithHelpers // -------------------------------------------------------------------------------------- @@ -314,8 +501,7 @@ protected: public: wxDialogWithHelpers(); - wxDialogWithHelpers(wxWindow* parent, const wxString& title, bool hasContextHelp=false, bool resizable=false ); - wxDialogWithHelpers(wxWindow* parent, const wxString& title, wxOrientation orient); + wxDialogWithHelpers(wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags = pxDialogCreationFlags() ); virtual ~wxDialogWithHelpers() throw(); void Init(); @@ -591,5 +777,6 @@ extern void pxSetToolTip( wxWindow* wind, const wxString& src ); extern void pxSetToolTip( wxWindow& wind, const wxString& src ); extern wxFont pxGetFixedFont( int ptsize=8, int weight=wxNORMAL ); +extern pxDialogCreationFlags pxDialogFlags(); #endif diff --git a/common/src/Utilities/ThreadingDialogs.cpp b/common/src/Utilities/ThreadingDialogs.cpp index c519e8eb7d..952f649c80 100644 --- a/common/src/Utilities/ThreadingDialogs.cpp +++ b/common/src/Utilities/ThreadingDialogs.cpp @@ -27,7 +27,7 @@ DEFINE_EVENT_TYPE(pxEvt_ThreadedTaskComplete); IMPLEMENT_DYNAMIC_CLASS(WaitForTaskDialog, wxDialogWithHelpers) Threading::WaitForTaskDialog::WaitForTaskDialog( const wxString& title, const wxString& heading ) - : wxDialogWithHelpers( NULL, _("Waiting for tasks..."), wxVERTICAL ) + : wxDialogWithHelpers( NULL, _("Waiting for tasks...") ) //, m_Timer(this) { //m_sem = sem; diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index 789c92fbed..25ba14a0f3 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -236,7 +236,7 @@ wxSizerFlags pxSizerFlags::StdExpand() // manually by using a spacer. wxSizerFlags pxSizerFlags::TopLevelBox() { - return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding ).Expand(); + return pxBorder( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding ).Expand(); } // Flags intended for use on grouped StaticBox controls. These flags are ideal for @@ -247,7 +247,7 @@ wxSizerFlags pxSizerFlags::SubGroup() { // Groups look better with a slightly smaller margin than standard. // (basically this accounts for the group's frame) - return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding-2 ).Expand(); + return pxBorder( wxLEFT | wxBOTTOM | wxRIGHT, StdPadding-2 ).Expand(); } // This force-aligns the std button sizer to the right, where (at least) us win32 platform @@ -255,7 +255,7 @@ wxSizerFlags pxSizerFlags::SubGroup() // just because it's *not* where win32 sticks it. Too bad! wxSizerFlags pxSizerFlags::StdButton() { - return wxSizerFlags().Align( wxALIGN_RIGHT ).Border(); + return pxBorder().Align( wxALIGN_RIGHT ); } wxSizerFlags pxSizerFlags::Checkbox() diff --git a/common/src/Utilities/wxHelpers.cpp b/common/src/Utilities/wxHelpers.cpp index cbc7c91233..0e2ff22cd9 100644 --- a/common/src/Utilities/wxHelpers.cpp +++ b/common/src/Utilities/wxHelpers.cpp @@ -25,6 +25,12 @@ using namespace pxSizerFlags; +pxDialogCreationFlags pxDialogFlags() +{ + return pxDialogCreationFlags().CloseBox().SystemMenu().Caption().Vertical(); +} + + // -------------------------------------------------------------------------------------- // BaseDeletableObject Implementation // -------------------------------------------------------------------------------------- @@ -113,24 +119,18 @@ wxDialogWithHelpers::wxDialogWithHelpers() Init(); } -wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, const wxString& title, bool hasContextHelp, bool resizable ) - : wxDialog( parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | (resizable ? wxRESIZE_BORDER : 0) - ) +wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags ) + : wxDialog( parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, cflags.GetWxWindowFlags() ) { - m_hasContextHelp = hasContextHelp; - Init(); -} + m_hasContextHelp = cflags.hasContextHelp; + if( (int)cflags.BoxSizerOrient != 0 ) + { + SetSizer( new wxBoxSizer( cflags.BoxSizerOrient ) ); + *this += StdPadding; + } -wxDialogWithHelpers::wxDialogWithHelpers(wxWindow* parent, const wxString& title, wxOrientation orient) - : wxDialog( parent, wxID_ANY, title ) -{ - m_hasContextHelp = false; - SetSizer( new wxBoxSizer( orient ) ); Init(); - - SetMinWidth( 500 ); - *this += StdPadding; + SetMinWidth( cflags.MinimumWidth ); } wxDialogWithHelpers::~wxDialogWithHelpers() throw() diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 307372c482..0f0646b847 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -37,7 +37,7 @@ static void CpuCheckSSE2() if( checked ) return; checked = true; - wxDialogWithHelpers exconf( NULL, _("PCSX2 - SSE2 Recommended"), wxVERTICAL ); + wxDialogWithHelpers exconf( NULL, _("PCSX2 - SSE2 Recommended") ); exconf += exconf.Heading( pxE( ".Popup:Startup:NoSSE2", L"Warning: Your computer does not support SSE2, which is required by many PCSX2 recompilers and plugins. " @@ -99,13 +99,12 @@ void Pcsx2App::ReadUserModeSettings() if (IOP_ENABLE_SIF_HACK == 1) { - wxDialogWithHelpers hackedVersion( NULL, _("It will devour your young! - PCSX2 Shub-Niggurath edition"), wxVERTICAL ); - - hackedVersion.SetSizer( new wxBoxSizer( wxVERTICAL ) ); - hackedVersion += new pxStaticText( &hackedVersion, + wxDialogWithHelpers hackedVersion( NULL, _("It will devour your young! - PCSX2 Shub-Niggurath edition") ); + hackedVersion.SetMinWidth( 520 ); + hackedVersion += hackedVersion.Text( L"NOTICE!! This is a version of Pcsx2 with hacks enabled meant for developers only. " L"It will likely crash on all games, devour your young, and make you an object of shame and disgrace among your family and friends. " - L"Do not report any bugs with this version if you received this popup. \n\nYou have been warned. ", wxALIGN_CENTER + L"Do not report any bugs with this version if you received this popup. \n\nYou have been warned. " ); hackedVersion += new wxButton( &hackedVersion, wxID_OK ) | pxSizerFlags::StdCenter(); @@ -128,9 +127,8 @@ void Pcsx2App::ReadUserModeSettings() if( !hasGroup ) { - wxDialogWithHelpers beta( NULL, _("PCSX2 0.9.7 Beta"), wxVERTICAL ); + wxDialogWithHelpers beta( NULL, _("PCSX2 0.9.7 Beta") ); - beta.SetSizer( new wxBoxSizer( wxVERTICAL ) ); beta += new pxStaticText( &beta, L"This is a *Beta* build of PCSX2 0.9.7. We are in the middle of major rewrites of the " L"user interface, and some parts of the program have *NOT* been implemented yet. Options will be missing. " @@ -254,7 +252,7 @@ void Pcsx2App::AllocateCoreStuffs() // the user already has all interps configured, for example, then no point in // popping up this dialog. - wxDialogWithHelpers exconf( NULL, _("PCSX2 Recompiler Error(s)"), wxVERTICAL ); + wxDialogWithHelpers exconf( NULL, _("PCSX2 Recompiler Error(s)") ); exconf += 12; exconf += exconf.Heading( pxE( ".Popup:RecompilerInit", diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index a1f88f6e28..df2c04567e 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -391,7 +391,7 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& // ---------------------------------------------------------------------------- catch( Exception::BiosLoadFailed& ex ) { - wxDialogWithHelpers dialog( NULL, _("PS2 BIOS Error"), wxVERTICAL ); + wxDialogWithHelpers dialog( NULL, _("PS2 BIOS Error") ); dialog += dialog.Heading( ex.FormatDisplayMessage() + BIOS_GetMsg_Required() + _("\nPress Ok to go to the BIOS Configuration Panel.") ); dialog += new ModalButtonPanel( &dialog, MsgButtons().OKCancel() ); diff --git a/pcsx2/gui/ApplyState.h b/pcsx2/gui/ApplyState.h index 144c6590e6..5e21e8d23d 100644 --- a/pcsx2/gui/ApplyState.h +++ b/pcsx2/gui/ApplyState.h @@ -133,8 +133,7 @@ public: protected: void Init(); - BaseApplicableDialog(wxWindow* parent, const wxString& title ); - BaseApplicableDialog(wxWindow* parent, const wxString& title, wxOrientation sizerOrient ); + BaseApplicableDialog(wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags = pxDialogCreationFlags() ); virtual void OnSettingsApplied( wxCommandEvent& evt ); diff --git a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp index d81d04eb1f..3272a20a9e 100644 --- a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp +++ b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp @@ -27,28 +27,12 @@ using namespace pxSizerFlags; -namespace Dialogs -{ - // Helper class for creating wxStaticText labels which are aligned to center. - // (automates the passing of wxDefaultSize and wxDefaultPosition) - // - class StaticTextCentered : public wxStaticText - { - public: - StaticTextCentered( wxWindow* parent, const wxString& text, int id=wxID_ANY ) : - wxStaticText( parent, id, text, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER ) - { - } - }; - -} - // -------------------------------------------------------------------------------------- // AboutBoxDialog Implementation // -------------------------------------------------------------------------------------- Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent ) - : wxDialogWithHelpers( parent, _("About PCSX2"), wxVERTICAL ) + : wxDialogWithHelpers( parent, _("About PCSX2") ) , m_bitmap_dualshock( this, wxID_ANY, wxBitmap( EmbeddedImage().Get() ), wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN ) @@ -92,11 +76,11 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent ) wxStaticBoxSizer& aboutUs = *new wxStaticBoxSizer( wxVERTICAL, this ); wxStaticBoxSizer& contribs = *new wxStaticBoxSizer( wxVERTICAL, this ); - StaticTextCentered* label_auth = new StaticTextCentered( this, LabelAuthors ); - StaticTextCentered* label_greets = new StaticTextCentered( this, LabelGreets ); + pxStaticText& label_auth = Text( LabelAuthors ); + pxStaticText& label_greets = Text( LabelGreets ); - label_auth->Wrap( 340 ); - label_greets->Wrap( 200 ); + //label_auth->Wrap( 340 ); + //label_greets->Wrap( 200 ); aboutUs += label_auth | StdExpand(); contribs += label_greets | StdExpand(); diff --git a/pcsx2/gui/Dialogs/AssertionDialog.cpp b/pcsx2/gui/Dialogs/AssertionDialog.cpp index d47101a356..31c58a2de1 100644 --- a/pcsx2/gui/Dialogs/AssertionDialog.cpp +++ b/pcsx2/gui/Dialogs/AssertionDialog.cpp @@ -20,7 +20,7 @@ using namespace pxSizerFlags; Dialogs::AssertionDialog::AssertionDialog( const wxString& text, const wxString& stacktrace ) - : wxDialogWithHelpers( NULL, _("PCSX2 Assertion Failure"), false, !stacktrace.IsEmpty() ) + : wxDialogWithHelpers( NULL, _("PCSX2 Assertion Failure"), pxDialogFlags().Resize(!stacktrace.IsEmpty()) ) { SetMinWidth( 720 ); diff --git a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp index 9a23c96cd2..87a94c1b79 100644 --- a/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp +++ b/pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp @@ -44,14 +44,8 @@ using namespace Panels; IMPLEMENT_DYNAMIC_CLASS(BaseApplicableDialog, wxDialogWithHelpers) -BaseApplicableDialog::BaseApplicableDialog( wxWindow* parent, const wxString& title ) - : wxDialogWithHelpers( parent, title, false ) -{ - Init(); -} - -BaseApplicableDialog::BaseApplicableDialog( wxWindow* parent, const wxString& title, wxOrientation sizerOrient ) - : wxDialogWithHelpers( parent, title, sizerOrient ) +BaseApplicableDialog::BaseApplicableDialog( wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags ) + : wxDialogWithHelpers( parent, title, cflags.MinWidth(425).Minimize() ) { Init(); } @@ -70,7 +64,8 @@ wxString BaseApplicableDialog::GetDialogName() const void BaseApplicableDialog::Init() { - SetExtraStyle(GetExtraStyle() | wxMINIMIZE_BOX ); + // This fixes it so that the dialogs show up in the task bar in Vista: + // (otherwise they go stupid iconized mode if the user minimizes them) SetExtraStyle(GetExtraStyle() & ~wxTOPLEVEL_EX_DIALOG); Connect( pxEvt_ApplySettings, wxCommandEventHandler (BaseApplicableDialog::OnSettingsApplied) ); @@ -91,7 +86,7 @@ void BaseApplicableDialog::OnSettingsApplied( wxCommandEvent& evt ) // BaseConfigurationDialog Implementations // -------------------------------------------------------------------------------------- Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, const wxString& title, int idealWidth ) - : _parent( parent, title, wxVERTICAL ) + : _parent( parent, title ) { SetMinWidth( idealWidth ); m_listbook = NULL; diff --git a/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp b/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp index 247c6bfb52..9723a0a859 100644 --- a/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp +++ b/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp @@ -28,7 +28,7 @@ using namespace pxSizerFlags; // ---------------------------------------------------------------------------- Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent ) - : BaseApplicableDialog( parent, _("BIOS Selector"), wxVERTICAL ) + : BaseApplicableDialog( parent, _("BIOS Selector") ) { m_selpan = new Panels::BiosSelectorPanel( this ); diff --git a/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp b/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp index db4f02fc33..64bb58d243 100644 --- a/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp +++ b/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp @@ -38,7 +38,7 @@ wxFilePickerCtrl* CreateMemoryCardFilePicker( wxWindow* parent, uint portidx, ui } Dialogs::CreateMemoryCardDialog::CreateMemoryCardDialog( wxWindow* parent, uint slot, const wxDirName& mcdpath, const wxString& mcdfile ) - : wxDialogWithHelpers( parent, _("Create new memory card"), wxVERTICAL ) + : wxDialogWithHelpers( parent, _("Create new memory card") ) , m_mcdpath( mcdpath.IsOk() ? mcdpath : (wxDirName)g_Conf->Mcd[slot].Filename.GetPath() ) , m_mcdfile( mcdfile.IsEmpty() ? g_Conf->Mcd[slot].Filename.GetFullName() : mcdfile ) { diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index 2a4a328452..43461ddb56 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -116,7 +116,7 @@ bool FirstTimeWizard::UsermodePage::PrepForApply() if( !path.Exists() ) { - wxDialogWithHelpers dialog( NULL, _("Create folder?"), wxVERTICAL ); + wxDialogWithHelpers dialog( NULL, _("Create folder?") ); dialog += dialog.Heading( _("PCSX2 will create the following folder for documents. You can change this setting later, at any time.") ); dialog += 12; dialog += dialog.Heading( path.ToString() ); diff --git a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp index 0a75af5c57..958581eb1f 100644 --- a/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp +++ b/pcsx2/gui/Dialogs/ImportSettingsDialog.cpp @@ -21,7 +21,7 @@ using namespace pxSizerFlags; Dialogs::ImportSettingsDialog::ImportSettingsDialog( wxWindow* parent ) - : wxDialogWithHelpers( parent, _("Import Existing Settings?"), wxVERTICAL ) + : wxDialogWithHelpers( parent, _("Import Existing Settings?") ) { SetMinWidth( 440 ); diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp index 18d301933d..cae40abc5a 100644 --- a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp +++ b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp @@ -20,11 +20,13 @@ #include using namespace Panels; +using namespace pxSizerFlags; + Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent ) - : BaseApplicableDialog( parent, _("Trace Logging"), wxVERTICAL ) + : BaseApplicableDialog( parent, _("Trace Logging"), pxDialogFlags().Resize() ) { - *this += new LogOptionsPanel( this ); + *this += new LogOptionsPanel( this ) | StdExpand(); AddOkCancel( *GetSizer(), true ); FindWindow( wxID_APPLY )->Disable(); diff --git a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp index eca4a92c1c..df34edc6ec 100644 --- a/pcsx2/gui/Dialogs/PickUserModeDialog.cpp +++ b/pcsx2/gui/Dialogs/PickUserModeDialog.cpp @@ -21,7 +21,7 @@ using namespace Panels; Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent ) - : BaseApplicableDialog( parent, _("PCSX2 First Time configuration"), wxVERTICAL ) + : BaseApplicableDialog( parent, _("PCSX2 First Time configuration") ) { m_panel_usersel = new DocsFolderPickerPanel( this, false ); m_panel_langsel = new LanguageSelectionPanel( this ); diff --git a/pcsx2/gui/Dialogs/StuckThreadDialog.cpp b/pcsx2/gui/Dialogs/StuckThreadDialog.cpp index 923a4a7b94..74699ce59f 100644 --- a/pcsx2/gui/Dialogs/StuckThreadDialog.cpp +++ b/pcsx2/gui/Dialogs/StuckThreadDialog.cpp @@ -25,7 +25,7 @@ using namespace Threading; Dialogs::StuckThreadDialog::StuckThreadDialog( wxWindow* parent, StuckThreadActionType action, PersistentThread& stuck_thread ) - : wxDialogWithHelpers( parent, _("PCSX2 Thread is not responding"), wxVERTICAL ) + : wxDialogWithHelpers( parent, _("PCSX2 Thread is not responding") ) { stuck_thread.AddListener( this ); diff --git a/pcsx2/gui/ExecutorThread.cpp b/pcsx2/gui/ExecutorThread.cpp index 583d18253e..ddbf4aab48 100644 --- a/pcsx2/gui/ExecutorThread.cpp +++ b/pcsx2/gui/ExecutorThread.cpp @@ -372,7 +372,7 @@ protected: // WaitingForThreadedTaskDialog Implementations // -------------------------------------------------------------------------------------- WaitingForThreadedTaskDialog::WaitingForThreadedTaskDialog( PersistentThread* thr, wxWindow* parent, const wxString& title, const wxString& content ) - : wxDialogWithHelpers( parent, title, wxVERTICAL ) + : wxDialogWithHelpers( parent, title ) { SetMinWidth( 500 ); diff --git a/pcsx2/gui/IsoDropTarget.cpp b/pcsx2/gui/IsoDropTarget.cpp index 6a921f9b14..c0b8ced57d 100644 --- a/pcsx2/gui/IsoDropTarget.cpp +++ b/pcsx2/gui/IsoDropTarget.cpp @@ -39,7 +39,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen if( filenames.GetCount() > 1 ) { - wxDialogWithHelpers dialog( m_WindowBound, _("Drag and Drop Error"), wxVERTICAL ); + wxDialogWithHelpers dialog( m_WindowBound, _("Drag and Drop Error") ); dialog += dialog.Heading( _("It is an error to drop multiple files onto a PCSX2 window. One at a time please, thank you.") ); pxIssueConfirmation( dialog, MsgButtons().Cancel() ); return false; @@ -69,7 +69,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen bool confirmed = true; if( SysHasValidState() ) { - wxDialogWithHelpers dialog( m_WindowBound, _("Confirm PS2 Reset"), wxVERTICAL ); + wxDialogWithHelpers dialog( m_WindowBound, _("Confirm PS2 Reset") ); dialog += dialog.Heading( _("You have dropped the following ELF binary into PCSX2:\n\n") + diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 269d1627e4..12245ab274 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -134,7 +134,7 @@ wxWindowID SwapOrReset_Iso( wxWindow* owner, IScopedCoreThread& core_control, co if( SysHasValidState() ) { core_control.DisallowResume(); - wxDialogWithHelpers dialog( owner, _("Confirm ISO image change"), wxVERTICAL ); + wxDialogWithHelpers dialog( owner, _("Confirm ISO image change") ); dialog += dialog.Heading(descpart1 + isoFilename + L"\n\n" + @@ -174,7 +174,7 @@ wxWindowID SwapOrReset_CdvdSrc( wxWindow* owner, CDVD_SourceType newsrc ) if( SysHasValidState() ) { - wxDialogWithHelpers dialog( owner, _("Confirm CDVD source change"), wxVERTICAL ); + wxDialogWithHelpers dialog( owner, _("Confirm CDVD source change") ); wxString changeMsg; changeMsg.Printf(_("You've selected to switch the CDVD source from %s to %s."), @@ -267,7 +267,7 @@ void MainEmuFrame::_DoBootCdvd() // User has an iso selected from a previous run, but it doesn't exist anymore. // Issue a courtesy popup and then an Iso Selector to choose a new one. - wxDialogWithHelpers dialog( this, _("ISO file not found!"), wxVERTICAL ); + wxDialogWithHelpers dialog( this, _("ISO file not found!") ); dialog += dialog.Heading( _("An error occurred while trying to open the file:\n\n") + g_Conf->CurrentIso + L"\n\n" + _("Error: The configured ISO file does not exist. Click OK to select a new ISO source for CDVD.") @@ -293,7 +293,7 @@ void MainEmuFrame::_DoBootCdvd() if( SysHasValidState() ) { - wxDialogWithHelpers dialog( this, _("Confirm PS2 Reset"), wxVERTICAL ); + wxDialogWithHelpers dialog( this, _("Confirm PS2 Reset") ); dialog += dialog.Heading( GetMsg_ConfirmSysReset() ); bool confirmed = (pxIssueConfirmation( dialog, MsgButtons().Yes().Cancel(), L"BootCdvd:ConfirmReset" ) != wxID_CANCEL); diff --git a/pcsx2/gui/MessageBoxes.cpp b/pcsx2/gui/MessageBoxes.cpp index 70e5546e99..e6c419e68c 100644 --- a/pcsx2/gui/MessageBoxes.cpp +++ b/pcsx2/gui/MessageBoxes.cpp @@ -35,7 +35,7 @@ static int pxMessageDialog( const wxString& caption, const wxString& content, co // // And in either case the emulation should be paused/suspended for the user. - wxDialogWithHelpers dialog( NULL, caption, wxVERTICAL ); + wxDialogWithHelpers dialog( NULL, caption ); dialog += dialog.Heading( content ); return pxIssueConfirmation( dialog, buttons ); } diff --git a/pcsx2/gui/Panels/DirPickerPanel.cpp b/pcsx2/gui/Panels/DirPickerPanel.cpp index 098273aae6..4a5c0c5e07 100644 --- a/pcsx2/gui/Panels/DirPickerPanel.cpp +++ b/pcsx2/gui/Panels/DirPickerPanel.cpp @@ -55,7 +55,7 @@ void Panels::DirPickerPanel::Explore_Click( wxCommandEvent &evt ) wxString path( m_pickerCtrl->GetPath() ); if( !wxDirExists(path) ) { - wxDialogWithHelpers createPathDlg( NULL, _("Path does not exist"), wxVERTICAL ); + wxDialogWithHelpers createPathDlg( NULL, _("Path does not exist") ); createPathDlg.SetMinWidth( 600 ); createPathDlg += createPathDlg.Text( path ) | StdCenter(); @@ -220,7 +220,7 @@ void Panels::DirPickerPanel::Apply() if( !wxDir::Exists( path ) ) { - wxDialogWithHelpers dialog( NULL, _("Create folder?"), wxVERTICAL ); + wxDialogWithHelpers dialog( NULL, _("Create folder?") ); dialog += dialog.Heading( _("A configured folder does not exist. Should PCSX2 try to create it?") ); dialog += 12; dialog += dialog.Heading( path ); diff --git a/pcsx2/gui/Panels/LogOptionsPanels.cpp b/pcsx2/gui/Panels/LogOptionsPanels.cpp index 6f10a0fcf1..fa626ac888 100644 --- a/pcsx2/gui/Panels/LogOptionsPanels.cpp +++ b/pcsx2/gui/Panels/LogOptionsPanels.cpp @@ -25,6 +25,8 @@ using namespace pxSizerFlags; Panels::eeLogOptionsPanel::eeLogOptionsPanel( LogOptionsPanel* parent ) : CheckedStaticBox( parent, wxVERTICAL, L"EE Logs" ) { + SetMinWidth( 260 ); + m_disasmPanel = new CheckedStaticBox( this, wxVERTICAL, L"Disasm" ); m_hwPanel = new CheckedStaticBox( this, wxVERTICAL, L"Hardware" ); m_evtPanel = new CheckedStaticBox( this, wxVERTICAL, L"Events" ); @@ -62,13 +64,16 @@ Panels::eeLogOptionsPanel::eeLogOptionsPanel( LogOptionsPanel* parent ) wxFlexGridSizer& eeTable( *new wxFlexGridSizer( 2, 5 ) ); - eeTable.Add( &s_misc, SubGroup() ); - eeTable.Add( m_hwPanel, SubGroup() ); - eeTable.Add( m_evtPanel, SubGroup() ); - eeTable.Add( m_disasmPanel, SubGroup() ); + eeTable.AddGrowableCol(0); + eeTable.AddGrowableCol(1); - ThisSizer.AddSpacer( 4 ); - ThisSizer.Add( &eeTable ); + eeTable += s_misc | SubGroup(); + eeTable += m_hwPanel | SubGroup(); + eeTable += m_evtPanel | SubGroup(); + eeTable += m_disasmPanel | SubGroup(); + + ThisSizer += 4; + ThisSizer += eeTable | pxExpand; SetValue( true ); } @@ -76,6 +81,8 @@ Panels::eeLogOptionsPanel::eeLogOptionsPanel( LogOptionsPanel* parent ) Panels::iopLogOptionsPanel::iopLogOptionsPanel( LogOptionsPanel* parent ) : CheckedStaticBox( parent, wxVERTICAL, L"IOP Logs" ) { + SetMinWidth( 260 ); + m_disasmPanel = new CheckedStaticBox( this, wxVERTICAL, L"Disasm" ); m_hwPanel = new CheckedStaticBox( this, wxVERTICAL, L"Hardware" ); m_evtPanel = new CheckedStaticBox( this, wxVERTICAL, L"Events" ); @@ -87,34 +94,37 @@ Panels::iopLogOptionsPanel::iopLogOptionsPanel( LogOptionsPanel* parent ) wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxVERTICAL, this, L"General" ); wxPanelWithHelpers* m_miscPanel = this; // helper for our newCheckBox macro. - s_misc.Add( m_Bios = new pxCheckBox( m_miscPanel, L"Bios" )); - s_misc.Add( m_Memory = new pxCheckBox( m_miscPanel, L"Memory" )); - s_misc.Add( m_GPU = new pxCheckBox( m_miscPanel, L"GPU (PS1 only)", L"(Not implemented yet)" )); + s_misc += m_Bios = new pxCheckBox( m_miscPanel, L"Bios" ); + s_misc += m_Memory = new pxCheckBox( m_miscPanel, L"Memory" ); + s_misc += m_GPU = new pxCheckBox( m_miscPanel, L"GPU (PS1 only)", L"(Not implemented yet)" ); - s_disasm.Add( m_R3000A = new pxCheckBox( m_disasmPanel, L"R3000A" )); - s_disasm.Add( m_COP2 = new pxCheckBox( m_disasmPanel, L"COP2 (Geometry)" )); + s_disasm += m_R3000A = new pxCheckBox( m_disasmPanel, L"R3000A" ); + s_disasm += m_COP2 = new pxCheckBox( m_disasmPanel, L"COP2 (Geometry)" ); - s_hw.Add( m_KnownHw = new pxCheckBox( m_hwPanel, L"Registers" )); - s_hw.Add( m_UnknownHw = new pxCheckBox( m_hwPanel, L"UnknownRegs" )); - s_hw.Add( m_DMA = new pxCheckBox( m_hwPanel, L"DMA" )); + s_hw += m_KnownHw = new pxCheckBox( m_hwPanel, L"Registers" ); + s_hw += m_UnknownHw = new pxCheckBox( m_hwPanel, L"UnknownRegs" ); + s_hw += m_DMA = new pxCheckBox( m_hwPanel, L"DMA" ); - s_evt.Add( m_Counters = new pxCheckBox( m_evtPanel, L"Counters" )); - s_evt.Add( m_Memcards = new pxCheckBox( m_evtPanel, L"Memcards" )); - s_evt.Add( m_PAD = new pxCheckBox( m_evtPanel, L"Pad" )); - s_evt.Add( m_SPU2 = new pxCheckBox( m_evtPanel, L"SPU2" )); - s_evt.Add( m_CDVD = new pxCheckBox( m_evtPanel, L"CDVD" )); - s_evt.Add( m_USB = new pxCheckBox( m_evtPanel, L"USB" )); - s_evt.Add( m_FW = new pxCheckBox( m_evtPanel, L"FW" )); + s_evt += m_Counters = new pxCheckBox( m_evtPanel, L"Counters" ); + s_evt += m_Memcards = new pxCheckBox( m_evtPanel, L"Memcards" ); + s_evt += m_PAD = new pxCheckBox( m_evtPanel, L"Pad" ); + s_evt += m_SPU2 = new pxCheckBox( m_evtPanel, L"SPU2" ); + s_evt += m_CDVD = new pxCheckBox( m_evtPanel, L"CDVD" ); + s_evt += m_USB = new pxCheckBox( m_evtPanel, L"USB" ); + s_evt += m_FW = new pxCheckBox( m_evtPanel, L"FW" ); wxFlexGridSizer& iopTable( *new wxFlexGridSizer( 2, 5 ) ); - iopTable.Add( &s_misc, SubGroup() ); - iopTable.Add( m_hwPanel, SubGroup() ); - iopTable.Add( m_evtPanel, SubGroup() ); - iopTable.Add( m_disasmPanel, SubGroup() ); + iopTable.AddGrowableCol(0); + iopTable.AddGrowableCol(1); - ThisSizer.AddSpacer( 4 ); - ThisSizer.Add( &iopTable ); + iopTable += s_misc | SubGroup(); + iopTable += m_hwPanel | SubGroup(); + iopTable += m_evtPanel | SubGroup(); + iopTable += m_disasmPanel | SubGroup(); + + ThisSizer += 4; + ThisSizer += iopTable | pxExpand; SetValue( true ); } @@ -124,8 +134,6 @@ Panels::iopLogOptionsPanel::iopLogOptionsPanel( LogOptionsPanel* parent ) void Panels::eeLogOptionsPanel::OnSettingsChanged() { - SetMinWidth( 230 ); - const TraceLogFilters& conf( g_Conf->EmuOptions.Trace ); SetValue( conf.EE.m_EnableAll ); @@ -160,8 +168,6 @@ void Panels::eeLogOptionsPanel::OnSettingsChanged() void Panels::iopLogOptionsPanel::OnSettingsChanged() { - SetMinWidth( 230 ); - const TraceLogFilters& conf( g_Conf->EmuOptions.Trace ); SetValue( conf.IOP.m_EnableAll ); @@ -198,8 +204,8 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent ) , m_iopSection ( *new iopLogOptionsPanel( this ) ) { 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.") ); + _("Trace logs are all written to emulog.txt. Toggle trace logging at any time using F10.") ); + m_masterEnabler->SetToolTip( _("Warning: Enabling trace logs is typically very slow, and is a leading cause of 'What happened to my FPS?' problems. :)") ); m_SIF = new pxCheckBox( this, L"SIF (EE<->IOP)" ); m_VIFunpack = new pxCheckBox( this, L"VIFunpack" ); @@ -212,21 +218,24 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent ) m_Elf ->SetToolTip(_("Logging of Elf headers.")); - wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL ); + wxFlexGridSizer& topSizer = *new wxFlexGridSizer( 2 ); wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" ); - topSizer += m_eeSection | StdSpace(); - topSizer += m_iopSection | StdSpace(); + topSizer.AddGrowableCol(0); + topSizer.AddGrowableCol(1); + + topSizer += m_eeSection | StdExpand(); + topSizer += m_iopSection | StdExpand(); s_misc += m_SIF; s_misc += m_VIFunpack; s_misc += m_GIFtag; s_misc += m_Elf; - *this += m_masterEnabler | StdSpace(); + *this += m_masterEnabler | StdExpand(); *this += new wxStaticLine( this, wxID_ANY ) | StdExpand().Border(wxLEFT | wxRIGHT, 20); *this += 5; - *this += topSizer; + *this += topSizer | StdExpand(); *this += s_misc | StdSpace().Centre(); Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) ); diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 1bcca92958..e47e33b384 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -228,7 +228,7 @@ ApplyPluginsDialog::ApplyPluginsDialog( BaseApplicableConfigPanel* panel ) // -------------------------------------------------------------------------------------- void ApplyOverValidStateEvent::InvokeEvent() { - wxDialogWithHelpers dialog( m_owner, _("Shutdown PS2 virtual machine?"), wxVERTICAL ); + wxDialogWithHelpers dialog( m_owner, _("Shutdown PS2 virtual machine?") ); dialog += dialog.Heading( pxE( ".Popup:PluginSelector:ConfirmShutdown", L"Warning! Changing plugins requires a complete shutdown and reset of the PS2 virtual machine. "