From 91454bfb12a17c1b07575b87a8af6cce9613ef6b Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Tue, 8 Jun 2010 12:09:28 +0000 Subject: [PATCH] * UI: Many small fixes for badly sized popups and confirmations. * Includes possible fix for Issue 743 (AMD cpu core counts). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3184 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/build/x86emitter/x86emitter.vcproj | 6 ------ common/include/Utilities/pxStaticText.h | 21 ++++++++++++++++++--- common/include/Utilities/wxGuiTools.h | 2 ++ common/src/Utilities/pxCheckBox.cpp | 11 +++++------ common/src/Utilities/pxStaticText.cpp | 17 ++++++++++++++++- common/src/Utilities/wxHelpers.cpp | 5 +++++ common/src/x86emitter/cpudetect.cpp | 6 ++++++ pcsx2/Hw.cpp | 4 +++- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 6 +++--- pcsx2/gui/Dialogs/ConfirmationDialogs.cpp | 2 ++ pcsx2/gui/Dialogs/FirstTimeWizard.cpp | 2 +- pcsx2/gui/Dialogs/McdConfigDialog.cpp | 6 +++--- pcsx2/gui/ExecutorThread.cpp | 4 ++-- pcsx2/gui/IsoDropTarget.cpp | 2 +- pcsx2/gui/MainMenuClicks.cpp | 9 +++++---- pcsx2/gui/Panels/MiscPanelStuff.cpp | 2 +- 16 files changed, 73 insertions(+), 32 deletions(-) diff --git a/common/build/x86emitter/x86emitter.vcproj b/common/build/x86emitter/x86emitter.vcproj index df3f89d807..e6d5399c9c 100644 --- a/common/build/x86emitter/x86emitter.vcproj +++ b/common/build/x86emitter/x86emitter.vcproj @@ -405,12 +405,6 @@ - - diff --git a/common/include/Utilities/pxStaticText.h b/common/include/Utilities/pxStaticText.h index dada22a012..6b641d43c3 100644 --- a/common/include/Utilities/pxStaticText.h +++ b/common/include/Utilities/pxStaticText.h @@ -32,9 +32,9 @@ // control within it's containing sizer. If both alignment flags do not match the result // is typically undesirable. // -class pxStaticText : public wxWindow +class pxStaticText : public wxControl { - typedef wxWindow _parent; + typedef wxControl _parent; protected: wxString m_label; @@ -66,7 +66,6 @@ public: wxFont GetFontOk() const; bool Enable( bool enabled=true ); - virtual void SetLabel(const wxString& label); virtual wxString GetLabel() const { return m_label; } @@ -115,3 +114,19 @@ public: protected: void SetPaddingDefaults(); }; + +extern void operator+=( wxSizer& target, pxStaticText* src ); +extern void operator+=( wxSizer& target, pxStaticText& src ); +extern void operator+=( wxSizer* target, pxStaticText& src ); + +template<> +inline void operator+=( wxSizer& target, const pxWindowAndFlags& src ) +{ + target.Add( src.window, src.flags ); +} + +template<> +inline void operator+=( wxSizer* target, const pxWindowAndFlags& src ) +{ + target->Add( src.window, src.flags ); +} diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 4d2cdb9aa2..56b4925cf8 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -554,6 +554,8 @@ public: wxDialogWithHelpers& SetMinWidth( int newWidth ); wxDialogWithHelpers& SetMinHeight( int newHeight ); + + int GetCharHeight() const; protected: void OnDialogCreated( wxCommandEvent& evt ); diff --git a/common/src/Utilities/pxCheckBox.cpp b/common/src/Utilities/pxCheckBox.cpp index 39ac1afb3d..48a97e6ba6 100644 --- a/common/src/Utilities/pxCheckBox.cpp +++ b/common/src/Utilities/pxCheckBox.cpp @@ -86,12 +86,6 @@ bool pxCheckBox::GetValue() const return m_checkbox->GetValue(); } -void operator+=( wxSizer& target, pxCheckBox* src ) -{ - if( !pxAssert( src != NULL ) ) return; - target.Add( src, pxExpand ); -} - // Forwards checkbox actions on the internal checkbox (called 'checkpart') to listeners // bound to the pxCheckBox "parent" panel. This helps the pxCheckBox behave more like a // traditional checkbox. @@ -112,6 +106,11 @@ void pxCheckBox::OnSubtextClicked( wxCommandEvent& evt ) // the checkmark. Not sure if that's desirable. } +void operator+=( wxSizer& target, pxCheckBox* src ) +{ + if( src ) target.Add( src, pxExpand ); +} + void operator+=( wxSizer& target, pxCheckBox& src ) { target.Add( &src, pxExpand ); diff --git a/common/src/Utilities/pxStaticText.cpp b/common/src/Utilities/pxStaticText.cpp index 843beeecb6..08d84de8f7 100644 --- a/common/src/Utilities/pxStaticText.cpp +++ b/common/src/Utilities/pxStaticText.cpp @@ -257,6 +257,7 @@ void pxStaticText::SetLabel(const wxString& label) // Always update wrapping, in case window width or something else also changed. UpdateWrapping( labelChanged ); + InvalidateBestSize(); } wxFont pxStaticText::GetFontOk() const @@ -321,7 +322,7 @@ wxSize pxStaticText::DoGetBestSize() const if( m_autowrap ) { best = GetBestWrappedSize(dc); - best.x = wxDefaultCoord; + //best.x = wxDefaultCoord; } else { @@ -357,3 +358,17 @@ void pxStaticHeading::SetPaddingDefaults() m_paddingPct_vert = 0.0f; } +void operator+=( wxSizer& target, pxStaticText* src ) +{ + if( src ) target.Add( src, pxExpand ); +} + +void operator+=( wxSizer& target, pxStaticText& src ) +{ + target.Add( &src, pxExpand ); +} + +void operator+=( wxSizer* target, pxStaticText& src ) +{ + target->Add( &src, pxExpand ); +} diff --git a/common/src/Utilities/wxHelpers.cpp b/common/src/Utilities/wxHelpers.cpp index bb2a7f2d16..018be9819f 100644 --- a/common/src/Utilities/wxHelpers.cpp +++ b/common/src/Utilities/wxHelpers.cpp @@ -370,6 +370,11 @@ wxDialogWithHelpers& wxDialogWithHelpers::SetMinHeight( int newHeight ) return *this; } +int wxDialogWithHelpers::GetCharHeight() const +{ + return wxClientDC( const_cast(this) ).GetCharHeight(); +} + // -------------------------------------------------------------------------------------- // wxPanelWithHelpers Implementations // -------------------------------------------------------------------------------------- diff --git a/common/src/x86emitter/cpudetect.cpp b/common/src/x86emitter/cpudetect.cpp index e01e049e70..7fd0bf46d7 100644 --- a/common/src/x86emitter/cpudetect.cpp +++ b/common/src/x86emitter/cpudetect.cpp @@ -159,6 +159,12 @@ void x86capabilities::CountCores() { __cpuid( regs, 0x80000008 ); PhysicalCoresPerPhysicalCPU += ( regs[2] ) & 0xff; + + // AMD note: they don't support hyperthreading, but they like to flag this true + // anyway. Let's force-unflag it until we come up with a better solution. + // (note: seems to affect some Phenom II's only? -- Athlon X2's and PhenomI's do + // not seem to do this) --air + hasMultiThreading = 0; } if( !hasMultiThreading || LogicalCoresPerPhysicalCPU == 0 ) diff --git a/pcsx2/Hw.cpp b/pcsx2/Hw.cpp index 0623634bcd..d21e0d3a6e 100644 --- a/pcsx2/Hw.cpp +++ b/pcsx2/Hw.cpp @@ -32,7 +32,9 @@ void hwInit() { // [TODO] / FIXME: PCSX2 no longer works on an Init system. It assumes that the // static global vars for the process will be initialized when the process is created, and - // then issues *resets only* from then on. All PCSX2 + // then issues *resets only* from then on. (reset code for various S2 components should do + // NULL checks and allocate memory and such if the pointers are NULL only). + if( hwInitialized ) return; VifUnpackSSE_Init(); diff --git a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp index 93e85ae544..9bb9609e40 100644 --- a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp +++ b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp @@ -91,9 +91,9 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent ) // Main (top-level) layout *this += StdPadding; - *this += Text(_("PCSX2")).Bold() | pxExpand; - *this += Text(_("A Playstation 2 Emulator")) | pxExpand; - *this += AuthLogoSizer | StdExpand(); + *this += Text(_("PCSX2")).Bold(); + *this += Text(_("A Playstation 2 Emulator")); + *this += AuthLogoSizer | StdExpand(); *this += new wxHyperlinkCtrl( this, wxID_ANY, _("PCSX2 Official Website and Forums"), L"http://www.pcsx2.net" diff --git a/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp b/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp index e37e7e7385..9a664d4043 100644 --- a/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp +++ b/pcsx2/gui/Dialogs/ConfirmationDialogs.cpp @@ -143,6 +143,8 @@ void MsgButtons::SetBestFocus( wxWindow* dialog ) const wxWindowID pxIssueConfirmation( wxDialogWithHelpers& confirmDlg, const MsgButtons& buttons ) { + if( confirmDlg.GetMinWidth() <= 0 ) confirmDlg.SetMinWidth( 400 ); + confirmDlg += new ModalButtonPanel( &confirmDlg, buttons ) | pxCenter.Border( wxTOP, 8 ); buttons.SetBestFocus( confirmDlg ); return confirmDlg.ShowModal(); diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index 43461ddb56..334e1c854e 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -69,7 +69,7 @@ FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) : m_panel_LangSel = new LanguageSelectionPanel( &panel ); m_panel_UserSel = new DocsFolderPickerPanel( &panel ); - panel += panel.Heading(_("PCSX2 is starting from a new or unknown folder and needs to be configured.")).Bold() | pxExpand; + panel += panel.Heading(_("PCSX2 is starting from a new or unknown folder and needs to be configured.")).Bold(); panel += m_panel_LangSel | StdCenter(); panel += m_panel_UserSel | pxExpand.Border( wxALL, 8 ); diff --git a/pcsx2/gui/Dialogs/McdConfigDialog.cpp b/pcsx2/gui/Dialogs/McdConfigDialog.cpp index 96832f6178..97e387891c 100644 --- a/pcsx2/gui/Dialogs/McdConfigDialog.cpp +++ b/pcsx2/gui/Dialogs/McdConfigDialog.cpp @@ -63,13 +63,13 @@ Panels::McdConfigPanel_Toggles::McdConfigPanel_Toggles(wxWindow *parent) // ------------------------------ for( uint i=0; i<2; ++i ) - *this += m_check_Multitap[i]| pxExpand; + *this += m_check_Multitap[i]; *this += 4; - *this += m_check_Ejection | pxExpand; + *this += m_check_Ejection; #ifdef __WXMSW__ - *this += m_check_CompressNTFS | pxExpand; + *this += m_check_CompressNTFS; #endif } diff --git a/pcsx2/gui/ExecutorThread.cpp b/pcsx2/gui/ExecutorThread.cpp index ddbf4aab48..101bb478fd 100644 --- a/pcsx2/gui/ExecutorThread.cpp +++ b/pcsx2/gui/ExecutorThread.cpp @@ -380,8 +380,8 @@ WaitingForThreadedTaskDialog::WaitingForThreadedTaskDialog( PersistentThread* th *this += Text( content ) | StdExpand(); *this += 15; - *this += Heading( _("Press Cancel to attempt to cancel the action.") ) | pxExpand; - *this += Heading( _("Press Terminate to kill PCSX2 immediately.") ) | pxExpand; + *this += Heading( _("Press Cancel to attempt to cancel the action.") ); + *this += Heading( _("Press Terminate to kill PCSX2 immediately.") ); *this += new wxButton( this, wxID_CANCEL ); *this += new wxButton( this, wxID_ANY, _("Terminate App") ); diff --git a/pcsx2/gui/IsoDropTarget.cpp b/pcsx2/gui/IsoDropTarget.cpp index c0b8ced57d..a5b69c0cde 100644 --- a/pcsx2/gui/IsoDropTarget.cpp +++ b/pcsx2/gui/IsoDropTarget.cpp @@ -109,7 +109,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen if (isoDetect(&iso)) { Console.WriteLn( L"(Drag&Drop) Found valid ISO file type!" ); - SwapOrReset_Iso(m_WindowBound, stopped_core, filenames[0], _("You have dropped the following ISO image into PCSX2:\n\n")); + SwapOrReset_Iso(m_WindowBound, stopped_core, filenames[0], _("You have dropped the following ISO image into PCSX2:")); } _closefile( iso.handle ); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 194a27e670..bffb47baff 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -136,10 +136,11 @@ wxWindowID SwapOrReset_Iso( wxWindow* owner, IScopedCoreThread& core_control, co core_control.DisallowResume(); wxDialogWithHelpers dialog( owner, _("Confirm ISO image change") ); - dialog += dialog.Heading(descpart1 + - isoFilename + L"\n\n" + - _("Do you want to swap discs or boot the new image (via system reset)?") - ); + dialog += dialog.Heading(descpart1); + dialog += dialog.GetCharHeight(); + dialog += dialog.Text(isoFilename); + dialog += dialog.GetCharHeight(); + dialog += dialog.Heading(_("Do you want to swap discs or boot the new image (via system reset)?")); result = pxIssueConfirmation( dialog, MsgButtons().Reset().Cancel().Custom(_("Swap Disc")), L"DragDrop:BootSwapIso" ); if( result == wxID_CANCEL ) diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index f8a1add691..6f39041e5b 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -65,7 +65,7 @@ Panels::DocsFolderPickerPanel::DocsFolderPickerPanel( wxWindow* parent, bool isF m_dirpicker_custom = new DirPickerPanel( this, FolderId_Documents, _("Select a document root for PCSX2") ); - *this += Heading( isFirstTime ? usermodeExplained : usermodeWarning ) | pxExpand; + *this += Heading( isFirstTime ? usermodeExplained : usermodeWarning ); *this += m_radio_UserMode | StdExpand(); *this += m_dirpicker_custom | pxExpand.Border( wxLEFT, StdPadding + m_radio_UserMode->GetIndentation() ); *this += 4;