From 0b42db11bd3aabbe21dce316b8c0a0847cd0a726 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Fri, 26 Jun 2015 02:04:39 +0100 Subject: [PATCH 1/2] gui: Fix Console close behaviour When the Console is closed (except through Misc -> Show Console), PCSX2 does not remember that you closed the Console and will reopen it the next time. You also have to press Show Console twice if you want to reopen the Console after closing it. This is caused by the Console looking for its "parent" main emulator window, when secretly, they're siblings :) Make the console properly register when it is closed. --- pcsx2/gui/ConsoleLogger.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index a276f66a23..3caa666a95 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -764,10 +764,9 @@ void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& event) // instead of closing just hide the window to be able to Show() it later Show( false ); - // Can't do this via a Connect() on the MainFrame because Close events are not commands, - // and thus do not propagate up/down the event chain. - if( wxWindow* main = GetParent() ) - wxStaticCast( main, MainEmuFrame )->OnLogBoxHidden(); + // In the nogui case there might not be a Main frame window. + if (MainEmuFrame* mainframe = GetMainFramePtr()) + mainframe->OnLogBoxHidden(); } else { From f9ea013b601edc3794b972ce1d3bf460ffbb9bf2 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Fri, 26 Jun 2015 21:09:57 +0100 Subject: [PATCH 2/2] gui: Fix/improve plugin/BIOS error dialog handling If the user encounters a plugin/BIOS error and the plugin/BIOS dialog is already open, make the dialog switch to the panel that corresponds with the error. Also, fix the open dialog detection and provide a slightly different messagebox if the plugin/BIOS dialog is already open - for these cases it won't say "Click Ok to go to the x configuration panel" anymore. --- pcsx2/gui/AppMain.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index e4e48b6dca..136a77a060 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -60,17 +60,21 @@ DEFINE_EVENT_TYPE( pxEvt_ThreadTaskTimeout_SysExec ); ScopedPtr g_Conf; template -int AppOpenModalDialog( wxWindow* parent=NULL ) +int AppOpenModalDialog( wxString panel_name, wxWindow* parent=NULL ) { if( wxWindow* window = wxFindWindowByName( L"Dialog:" + DialogType::GetNameStatic() ) ) { window->SetFocus(); if( wxDialog* dialog = wxDynamicCast( window, wxDialog ) ) { + // Switch to the requested panel. + wxCommandEvent evt(pxEvt_SetSettingsPage); + evt.SetString(panel_name); + dialog->GetEventHandler()->ProcessEvent(evt); + // It's legal to call ShowModal on a non-modal dialog, therefore making // it modal in nature for the needs of whatever other thread of action wants // to block against it: - if( !dialog->IsModal() ) { int result = dialog->ShowModal(); @@ -87,19 +91,23 @@ int AppOpenModalDialog( wxWindow* parent=NULL ) static bool HandlePluginError( BaseException& ex ) { - if( !pxDialogExists( L"CoreSettings" ) ) + if (!pxDialogExists(L"Dialog:" + Dialogs::ComponentsConfigDialog::GetNameStatic())) { if( !Msgbox::OkCancel( ex.FormatDisplayMessage() + _("\n\nPress Ok to go to the Plugin Configuration Panel.") ) ) return false; } + else + { + Msgbox::Alert(ex.FormatDisplayMessage()); + } g_Conf->ComponentsTabName = L"Plugins"; // TODO: Send a message to the panel to select the failed plugin. - return AppOpenModalDialog() != wxID_CANCEL; + return AppOpenModalDialog(L"Plugins") != wxID_CANCEL; } class PluginErrorEvent : public pxExceptionEvent @@ -188,16 +196,20 @@ protected: static bool HandleBIOSError(BaseException& ex) { - if (!pxDialogExists(L"CoreSettings")) + if (!pxDialogExists(L"Dialog:" + Dialogs::ComponentsConfigDialog::GetNameStatic())) { if (!Msgbox::OkCancel(ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required() + L"\n\n" + _("Press Ok to go to the BIOS Configuration Panel."), _("PS2 BIOS Error"))) return false; } + else + { + Msgbox::Alert(ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required(), _("PS2 BIOS Error")); + } g_Conf->ComponentsTabName = L"BIOS"; - return AppOpenModalDialog() != wxID_CANCEL; + return AppOpenModalDialog(L"BIOS") != wxID_CANCEL; } void BIOSLoadErrorEvent::InvokeEvent()