mirror of https://github.com/PCSX2/pcsx2.git
Small bugfixes to settings handling at startup, fixed a memleak when opening multiple dialog boxes, and some other minor interface code cleanups.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2079 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
eae4643a40
commit
581e8a30a7
|
@ -203,6 +203,10 @@
|
||||||
RelativePath="..\..\src\Utilities\Console.cpp"
|
RelativePath="..\..\src\Utilities\Console.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\Utilities\EventSource.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\Utilities\Exceptions.cpp"
|
RelativePath="..\..\src\Utilities\Exceptions.cpp"
|
||||||
>
|
>
|
||||||
|
@ -429,6 +433,10 @@
|
||||||
RelativePath="..\..\include\Utilities\EventSource.h"
|
RelativePath="..\..\include\Utilities\EventSource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Utilities\EventSource.inl"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Utilities\Exceptions.h"
|
RelativePath="..\..\include\Utilities\Exceptions.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -112,10 +112,6 @@ public:
|
||||||
return m_listeners.begin();
|
return m_listeners.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks for duplicates before adding the event.
|
|
||||||
virtual inline void Add( const ListenerType& listener );
|
|
||||||
virtual inline void RemoveObject( const void* object );
|
|
||||||
|
|
||||||
void Add( void* objhandle, typename ListenerType::FuncType* fnptr )
|
void Add( void* objhandle, typename ListenerType::FuncType* fnptr )
|
||||||
{
|
{
|
||||||
Add( ListenerType( objhandle, fnptr ) );
|
Add( ListenerType( objhandle, fnptr ) );
|
||||||
|
@ -126,43 +122,17 @@ public:
|
||||||
Remove( ListenerType( objhandle, fnptr ) );
|
Remove( ListenerType( objhandle, fnptr ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dispatch( EvtType& evt )
|
// Checks for duplicates before adding the event.
|
||||||
{
|
virtual void Add( const ListenerType& listener );
|
||||||
if( !m_cache_valid )
|
virtual void RemoveObject( const void* object );
|
||||||
{
|
void Dispatch( EvtType& evt );
|
||||||
m_cache_copy = m_listeners;
|
|
||||||
m_cache_valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_DispatchRaw( m_cache_copy.begin(), m_cache_copy.end(), evt );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
__forceinline void _DispatchRaw( ConstIterator iter, const ConstIterator& iend, EvtType& evt )
|
inline void _DispatchRaw( ConstIterator iter, const ConstIterator& iend, EvtType& evt );
|
||||||
{
|
|
||||||
while( iter != iend )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
iter->OnEvent( iter->object, evt );
|
|
||||||
}
|
|
||||||
catch( Exception::RuntimeError& ex )
|
|
||||||
{
|
|
||||||
Console.Error( L"Ignoring runtime error thrown from event listener: " + ex.FormatDiagnosticMessage() );
|
|
||||||
}
|
|
||||||
catch( Exception::BaseException& ex )
|
|
||||||
{
|
|
||||||
if( IsDevBuild ) throw;
|
|
||||||
Console.Error( L"Ignoring non-runtime BaseException thrown from event listener: " + ex.FormatDiagnosticMessage() );
|
|
||||||
}
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// EventListenerBinding< typename EvtType ?
|
// EventListenerBinding< typename EvtType >
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// Encapsulated event listener binding, provides the "benefits" of object unwinding.
|
// Encapsulated event listener binding, provides the "benefits" of object unwinding.
|
||||||
//
|
//
|
||||||
|
@ -215,44 +185,9 @@ typedef EventSource<wxCommandEvent> CmdEvt_Source;
|
||||||
typedef EventListener<wxCommandEvent> CmdEvt_Listener;
|
typedef EventListener<wxCommandEvent> CmdEvt_Listener;
|
||||||
typedef EventListenerBinding<wxCommandEvent> CmdEvt_ListenerBinding;
|
typedef EventListenerBinding<wxCommandEvent> CmdEvt_ListenerBinding;
|
||||||
|
|
||||||
|
#define EventSource_ImplementType( tname ) \
|
||||||
// Checks for duplicates before adding the event.
|
template void EventSource<tname>::Add(const EventSource<tname>::ListenerType &listener); \
|
||||||
template< typename EvtType >
|
template void EventSource<tname>::RemoveObject(const void* object); \
|
||||||
void EventSource<EvtType>::Add( const ListenerType& listener )
|
template void EventSource<tname>::Add(const EventSource<tname>::ListenerType &listener); \
|
||||||
{
|
template void EventSource<tname>::Dispatch(tname& evt); \
|
||||||
if( !pxAssertDev( listener.OnEvent != NULL, "NULL listener callback function." ) ) return;
|
template void EventSource<tname>::_DispatchRaw( EventSource<tname>::ConstIterator iter, const EventSource<tname>::ConstIterator& iend, tname& evt );
|
||||||
|
|
||||||
Handle iter = m_listeners.begin();
|
|
||||||
while( iter != m_listeners.end() )
|
|
||||||
{
|
|
||||||
if( *iter == listener ) return;
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
AddFast( listener );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename EvtType >
|
|
||||||
class PredicatesAreTheThingsOfNightmares
|
|
||||||
{
|
|
||||||
typedef EventListener< EvtType > ListenerType;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const void* const m_object_match;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PredicatesAreTheThingsOfNightmares( const void* objmatch ) : m_object_match( objmatch ) { }
|
|
||||||
|
|
||||||
bool operator()( const ListenerType& src ) const
|
|
||||||
{
|
|
||||||
return src.object == m_object_match;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// removes all listeners which reference the given object. Use for assuring object deletion.
|
|
||||||
template< typename EvtType >
|
|
||||||
void EventSource<EvtType>::RemoveObject( const void* object )
|
|
||||||
{
|
|
||||||
m_cache_valid = false;
|
|
||||||
m_listeners.remove_if( PredicatesAreTheThingsOfNightmares<EvtType>( object ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||||
|
*
|
||||||
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Checks for duplicates before adding the event.
|
||||||
|
template< typename EvtType >
|
||||||
|
void EventSource<EvtType>::Add( const ListenerType& listener )
|
||||||
|
{
|
||||||
|
if( !pxAssertDev( listener.OnEvent != NULL, "NULL listener callback function." ) ) return;
|
||||||
|
|
||||||
|
Handle iter = m_listeners.begin();
|
||||||
|
while( iter != m_listeners.end() )
|
||||||
|
{
|
||||||
|
if( *iter == listener ) return;
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
AddFast( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename EvtType >
|
||||||
|
class PredicatesAreTheThingsOfNightmares
|
||||||
|
{
|
||||||
|
typedef EventListener< EvtType > ListenerType;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const void* const m_object_match;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PredicatesAreTheThingsOfNightmares( const void* objmatch ) : m_object_match( objmatch ) { }
|
||||||
|
|
||||||
|
bool operator()( const ListenerType& src ) const
|
||||||
|
{
|
||||||
|
return src.object == m_object_match;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// removes all listeners which reference the given object. Use for assuring object deletion.
|
||||||
|
template< typename EvtType >
|
||||||
|
void EventSource<EvtType>::RemoveObject( const void* object )
|
||||||
|
{
|
||||||
|
m_cache_valid = false;
|
||||||
|
m_listeners.remove_if( PredicatesAreTheThingsOfNightmares<EvtType>( object ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename EvtType >
|
||||||
|
__forceinline void EventSource<EvtType>::_DispatchRaw( ConstIterator iter, const ConstIterator& iend, EvtType& evt )
|
||||||
|
{
|
||||||
|
while( iter != iend )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
iter->OnEvent( iter->object, evt );
|
||||||
|
}
|
||||||
|
catch( Exception::RuntimeError& ex )
|
||||||
|
{
|
||||||
|
Console.Error( L"Ignoring runtime error thrown from event listener: " + ex.FormatDiagnosticMessage() );
|
||||||
|
}
|
||||||
|
catch( Exception::BaseException& ex )
|
||||||
|
{
|
||||||
|
if( IsDevBuild ) throw;
|
||||||
|
Console.Error( L"Ignoring non-runtime BaseException thrown from event listener: " + ex.FormatDiagnosticMessage() );
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename EvtType >
|
||||||
|
void EventSource<EvtType>::Dispatch( EvtType& evt )
|
||||||
|
{
|
||||||
|
if( !m_cache_valid )
|
||||||
|
{
|
||||||
|
m_cache_copy = m_listeners;
|
||||||
|
m_cache_valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_DispatchRaw( m_cache_copy.begin(), m_cache_copy.end(), evt );
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||||
|
*
|
||||||
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "EventSource.h"
|
||||||
|
#include "EventSource.inl"
|
||||||
|
|
||||||
|
#include <wx/event.h>
|
||||||
|
|
||||||
|
EventSource_ImplementType( wxCommandEvent );
|
||||||
|
EventSource_ImplementType( int );
|
|
@ -28,6 +28,9 @@
|
||||||
#include "CDVD/CDVD.h"
|
#include "CDVD/CDVD.h"
|
||||||
#include "System/PageFaultSource.h"
|
#include "System/PageFaultSource.h"
|
||||||
|
|
||||||
|
#include "Utilities/EventSource.inl"
|
||||||
|
EventSource_ImplementType( PageFaultInfo );
|
||||||
|
|
||||||
SrcType_PageFault Source_PageFault;
|
SrcType_PageFault Source_PageFault;
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
|
|
|
@ -531,6 +531,11 @@ DECLARE_APP(Pcsx2App)
|
||||||
#define sMainFrame \
|
#define sMainFrame \
|
||||||
if( MainEmuFrame* __frame_ = GetMainFramePtr() ) (*__frame_)
|
if( MainEmuFrame* __frame_ = GetMainFramePtr() ) (*__frame_)
|
||||||
|
|
||||||
|
// Use this within the scope of a wxWindow (wxDialog or wxFrame). If the window has a valid menu
|
||||||
|
// bar, the command will run, otherwise it will be silently ignored. :)
|
||||||
|
#define sMenuBar \
|
||||||
|
if( wxMenuBar* __menubar_ = GetMenuBar() ) (*__menubar_)
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// External App-related Globals and Shortcuts
|
// External App-related Globals and Shortcuts
|
||||||
|
|
|
@ -520,7 +520,7 @@ void RelocateLogfile()
|
||||||
|
|
||||||
if( (emuLog != NULL) && (emuLogName != newlogname) )
|
if( (emuLog != NULL) && (emuLogName != newlogname) )
|
||||||
{
|
{
|
||||||
Console.Status( "\nRelocating Logfile...\n\tFrom: %s\n\tTo : %s\n", emuLogName.c_str(), newlogname.c_str() );
|
Console.Status( wxsFormat(L"\nRelocating Logfile...\n\tFrom: %s\n\tTo : %s\n", emuLogName.c_str(), newlogname.c_str()) );
|
||||||
wxGetApp().DisableDiskLogging();
|
wxGetApp().DisableDiskLogging();
|
||||||
|
|
||||||
fclose( emuLog );
|
fclose( emuLog );
|
||||||
|
|
|
@ -447,6 +447,6 @@ struct CrtDebugBreak
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//CrtDebugBreak breakAt( 8890 );
|
//CrtDebugBreak breakAt( 7586 );
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -39,6 +39,10 @@ DEFINE_EVENT_TYPE( pxEVT_LoadPluginsComplete );
|
||||||
DEFINE_EVENT_TYPE( pxEVT_CoreThreadStatus );
|
DEFINE_EVENT_TYPE( pxEVT_CoreThreadStatus );
|
||||||
DEFINE_EVENT_TYPE( pxEVT_FreezeThreadFinished );
|
DEFINE_EVENT_TYPE( pxEVT_FreezeThreadFinished );
|
||||||
|
|
||||||
|
#include "Utilities/EventSource.inl"
|
||||||
|
EventSource_ImplementType( IniInterface );
|
||||||
|
EventSource_ImplementType( AppEventType );
|
||||||
|
|
||||||
bool UseAdminMode = false;
|
bool UseAdminMode = false;
|
||||||
wxDirName SettingsFolder;
|
wxDirName SettingsFolder;
|
||||||
bool UseDefaultSettingsFolder = true;
|
bool UseDefaultSettingsFolder = true;
|
||||||
|
|
|
@ -168,8 +168,6 @@ void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt )
|
||||||
evt.Veto();
|
evt.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_panel_PluginSel.ReloadSettings();
|
|
||||||
m_panel_BiosSel.ReloadSettings();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,7 @@ void MainEmuFrame::UpdateIsoSrcSelection()
|
||||||
|
|
||||||
jNO_DEFAULT
|
jNO_DEFAULT
|
||||||
}
|
}
|
||||||
|
sMenuBar.Check( cdsrc, true );
|
||||||
GetMenuBar()->Check( cdsrc, true );
|
|
||||||
m_statusbar.SetStatusText( CDVD_SourceLabels[g_Conf->CdvdSource], 1 );
|
m_statusbar.SetStatusText( CDVD_SourceLabels[g_Conf->CdvdSource], 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ void MainEmuFrame::UpdateIsoSrcFile()
|
||||||
label.Printf( L"%s -> %s", _("Iso"),
|
label.Printf( L"%s -> %s", _("Iso"),
|
||||||
exists ? g_Conf->CurrentIso.c_str() : _("Empty")
|
exists ? g_Conf->CurrentIso.c_str() : _("Empty")
|
||||||
);
|
);
|
||||||
GetMenuBar()->SetLabel( MenuId_Src_Iso, label );
|
sMenuBar.SetLabel( MenuId_Src_Iso, label );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainEmuFrame::LoadSaveRecentIsoList( IniInterface& conf )
|
void MainEmuFrame::LoadSaveRecentIsoList( IniInterface& conf )
|
||||||
|
@ -321,13 +320,13 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
|
||||||
// Initial menubar setup. This needs to be done first so that the menu bar's visible size
|
// Initial menubar setup. This needs to be done first so that the menu bar's visible size
|
||||||
// can be factored into the window size (which ends up being background+status+menus)
|
// can be factored into the window size (which ends up being background+status+menus)
|
||||||
|
|
||||||
m_menubar.Append( &m_menuBoot, _("Boot") );
|
m_menubar.Append( &m_menuBoot, _("&Boot") );
|
||||||
m_menubar.Append( &m_menuEmu, _("Emulation") );
|
m_menubar.Append( &m_menuEmu, _("&System") );
|
||||||
m_menubar.Append( &m_menuConfig, _("Config") );
|
m_menubar.Append( &m_menuConfig, _("&Config") );
|
||||||
m_menubar.Append( &m_menuVideo, _("Video") );
|
m_menubar.Append( &m_menuVideo, _("&Video") );
|
||||||
m_menubar.Append( &m_menuAudio, _("Audio") );
|
m_menubar.Append( &m_menuAudio, _("&Audio") );
|
||||||
m_menubar.Append( &m_menuMisc, _("Misc") );
|
m_menubar.Append( &m_menuMisc, _("&Misc") );
|
||||||
m_menubar.Append( &m_menuDebug, _("Debug") );
|
m_menubar.Append( &m_menuDebug, _("&Debug") );
|
||||||
SetMenuBar( &m_menubar );
|
SetMenuBar( &m_menubar );
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -407,8 +406,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
|
||||||
_("Closing PCSX2 may be hazardous to your health"));
|
_("Closing PCSX2 may be hazardous to your health"));
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
m_menuEmu.Append(MenuId_Sys_SuspendResume, _("Suspend"),
|
m_menuEmu.Append(MenuId_Sys_SuspendResume, _("Suspend") )->Enable( SysHasValidState() );
|
||||||
_("Stops emulation dead in its tracks") )->Enable( SysHasValidState() );
|
|
||||||
|
|
||||||
m_menuEmu.AppendSeparator();
|
m_menuEmu.AppendSeparator();
|
||||||
|
|
||||||
|
@ -428,7 +426,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
m_menuConfig.Append(MenuId_Config_Settings, _("General Settings") );
|
m_menuConfig.Append(MenuId_Config_Settings, _("General &Settings") );
|
||||||
m_menuConfig.AppendSeparator();
|
m_menuConfig.AppendSeparator();
|
||||||
|
|
||||||
m_menuConfig.Append(MenuId_Config_PAD, _("PAD"), &m_menuPad );
|
m_menuConfig.Append(MenuId_Config_PAD, _("PAD"), &m_menuPad );
|
||||||
|
@ -517,20 +515,44 @@ void MainEmuFrame::ReloadRecentLists()
|
||||||
|
|
||||||
void MainEmuFrame::ApplyCoreStatus()
|
void MainEmuFrame::ApplyCoreStatus()
|
||||||
{
|
{
|
||||||
bool valstate = SysHasValidState();
|
wxMenuBar& menubar( *GetMenuBar() );
|
||||||
|
if( !pxAssertMsg( &menubar!=NULL, "Mainframe menu bar is NULL!" ) ) return;
|
||||||
|
|
||||||
GetMenuBar()->Enable( MenuId_Sys_SuspendResume, SysHasValidState() );
|
wxMenuItem& susres( *menubar.FindItem( MenuId_Sys_SuspendResume ) );
|
||||||
GetMenuBar()->Enable( MenuId_Sys_Reset, SysHasValidState() || (g_plugins!=NULL) );
|
if( !pxAssertMsg( &susres!=NULL, "Suspend/Resume Menubar Item is NULL!" ) ) return;
|
||||||
|
|
||||||
GetMenuBar()->SetLabel( MenuId_Sys_SuspendResume, CoreThread.IsOpen() ? _("Suspend") : _("Resume") );
|
if( SysHasValidState() )
|
||||||
|
{
|
||||||
|
susres.Enable();
|
||||||
|
if( CoreThread.IsOpen() )
|
||||||
|
{
|
||||||
|
susres.SetHelp( _("Safely pauses emulation and preserves the PS2 state.") );
|
||||||
|
susres.SetText( _("Suspend") );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
susres.SetHelp( _("Resumes the suspended emulation state.") );
|
||||||
|
susres.SetText( _("Resume") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
susres.Enable( false );
|
||||||
|
susres.SetHelp( _("No emulation state is active; cannot suspend or resume.") );
|
||||||
|
}
|
||||||
|
|
||||||
|
menubar.Enable( MenuId_Sys_Reset, SysHasValidState() || (g_plugins!=NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainEmuFrame::ApplySettings()
|
void MainEmuFrame::ApplySettings()
|
||||||
{
|
{
|
||||||
GetMenuBar()->Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash );
|
wxMenuBar& menubar( *GetMenuBar() );
|
||||||
|
if( !pxAssertMsg( &menubar!=NULL, "Mainframe menu bar is NULL!" ) ) return;
|
||||||
|
|
||||||
GetMenuBar()->Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled );
|
menubar.Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash );
|
||||||
GetMenuBar()->Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled );
|
|
||||||
|
menubar.Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled );
|
||||||
|
menubar.Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled );
|
||||||
|
|
||||||
if( m_RecentIsoList )
|
if( m_RecentIsoList )
|
||||||
{
|
{
|
||||||
|
|
|
@ -186,17 +186,16 @@ void MainEmuFrame::Menu_SuspendResume_Click(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
if( !SysHasValidState() ) return;
|
if( !SysHasValidState() ) return;
|
||||||
|
|
||||||
// Note: We manually update the menu here, even though it'll be updated again
|
if( !CoreThread.Suspend() )
|
||||||
// when the thread "officially" suspends or resumes (via listener callback), because
|
|
||||||
// the callback is tied to the actual thread status
|
|
||||||
|
|
||||||
if( CoreThread.Suspend() )
|
|
||||||
GetMenuBar()->SetLabel( MenuId_Sys_SuspendResume, _("Resume") );
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sApp.SysExecute();
|
sApp.SysExecute();
|
||||||
GetMenuBar()->SetLabel( MenuId_Sys_SuspendResume, _("Suspend") );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable the menu item. The state of the menu is indeterminate until the core thread
|
||||||
|
// has responded (it updates status after the plugins are loaded and emulation has
|
||||||
|
// engaged successfully).
|
||||||
|
|
||||||
|
GetMenuBar()->Enable( MenuId_Sys_SuspendResume, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainEmuFrame::Menu_SysReset_Click(wxCommandEvent &event)
|
void MainEmuFrame::Menu_SysReset_Click(wxCommandEvent &event)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "App.h"
|
||||||
#include "ConfigurationPanels.h"
|
#include "ConfigurationPanels.h"
|
||||||
|
|
||||||
#include "Utilities/ScopedPtr.h"
|
#include "Utilities/ScopedPtr.h"
|
||||||
|
@ -27,6 +28,7 @@ using namespace wxHelpers;
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow& parent, int idealWidth ) :
|
Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow& parent, int idealWidth ) :
|
||||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||||
|
, m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnAppliedSettings ) )
|
||||||
{
|
{
|
||||||
Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this );
|
Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this );
|
||||||
}
|
}
|
||||||
|
@ -61,6 +63,11 @@ void Panels::BaseSelectorPanel::OnFolderChanged( wxFileDirPickerEvent& evt )
|
||||||
OnShown();
|
OnShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panels::BaseSelectorPanel::OnAppliedSettings( void* me, int& )
|
||||||
|
{
|
||||||
|
if( me == NULL ) return;
|
||||||
|
((BaseSelectorPanel*)me)->ReloadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow& parent, int idealWidth ) :
|
Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow& parent, int idealWidth ) :
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "wxHelpers.h"
|
#include "wxHelpers.h"
|
||||||
#include "Utilities/SafeArray.h"
|
#include "Utilities/SafeArray.h"
|
||||||
#include "Utilities/Threading.h"
|
#include "Utilities/Threading.h"
|
||||||
|
#include "Utilities/EventSource.h"
|
||||||
|
|
||||||
class wxListBox;
|
class wxListBox;
|
||||||
|
|
||||||
|
@ -336,9 +337,10 @@ namespace Panels
|
||||||
class BaseSelectorPanel: public BaseApplicableConfigPanel
|
class BaseSelectorPanel: public BaseApplicableConfigPanel
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
EventListenerBinding<int> m_ReloadSettingsBinding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BaseSelectorPanel();
|
virtual ~BaseSelectorPanel() throw();
|
||||||
BaseSelectorPanel( wxWindow& parent, int idealWidth );
|
BaseSelectorPanel( wxWindow& parent, int idealWidth );
|
||||||
|
|
||||||
virtual bool Show( bool visible=true );
|
virtual bool Show( bool visible=true );
|
||||||
|
@ -349,6 +351,9 @@ namespace Panels
|
||||||
protected:
|
protected:
|
||||||
virtual void DoRefresh()=0;
|
virtual void DoRefresh()=0;
|
||||||
virtual bool ValidateEnumerationStatus()=0;
|
virtual bool ValidateEnumerationStatus()=0;
|
||||||
|
virtual void ReloadSettings()=0;
|
||||||
|
|
||||||
|
static void __evt_fastcall OnAppliedSettings( void* me, int& whatever );
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -363,12 +368,13 @@ namespace Panels
|
||||||
public:
|
public:
|
||||||
BiosSelectorPanel( wxWindow& parent, int idealWidth );
|
BiosSelectorPanel( wxWindow& parent, int idealWidth );
|
||||||
virtual ~BiosSelectorPanel();
|
virtual ~BiosSelectorPanel();
|
||||||
void ReloadSettings();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Apply();
|
virtual void Apply();
|
||||||
virtual void DoRefresh();
|
virtual void DoRefresh();
|
||||||
virtual bool ValidateEnumerationStatus();
|
virtual bool ValidateEnumerationStatus();
|
||||||
|
|
||||||
|
virtual void ReloadSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -468,7 +474,6 @@ namespace Panels
|
||||||
|
|
||||||
void CancelRefresh(); // used from destructor, stays non-virtual
|
void CancelRefresh(); // used from destructor, stays non-virtual
|
||||||
void Apply();
|
void Apply();
|
||||||
void ReloadSettings();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnConfigure_Clicked( wxCommandEvent& evt );
|
void OnConfigure_Clicked( wxCommandEvent& evt );
|
||||||
|
@ -476,11 +481,14 @@ namespace Panels
|
||||||
virtual void OnProgress( wxCommandEvent& evt );
|
virtual void OnProgress( wxCommandEvent& evt );
|
||||||
virtual void OnEnumComplete( wxCommandEvent& evt );
|
virtual void OnEnumComplete( wxCommandEvent& evt );
|
||||||
|
|
||||||
|
virtual void ReloadSettings();
|
||||||
|
|
||||||
virtual void DoRefresh();
|
virtual void DoRefresh();
|
||||||
virtual bool ValidateEnumerationStatus();
|
virtual bool ValidateEnumerationStatus();
|
||||||
|
|
||||||
int FileCount() const { return m_FileList->Count(); }
|
int FileCount() const { return m_FileList->Count(); }
|
||||||
const wxString& GetFilename( int i ) const { return (*m_FileList)[i]; }
|
const wxString& GetFilename( int i ) const { return (*m_FileList)[i]; }
|
||||||
|
|
||||||
friend class EnumThread;
|
friend class EnumThread;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxStr
|
||||||
++m_DialogIdents[GetId()];
|
++m_DialogIdents[GetId()];
|
||||||
|
|
||||||
if( hasContextHelp )
|
if( hasContextHelp )
|
||||||
wxHelpProvider::Set( new wxSimpleHelpProvider() );
|
delete wxHelpProvider::Set( new wxSimpleHelpProvider() );
|
||||||
|
|
||||||
// Note: currently the Close (X) button doesn't appear to work in dialogs. Docs indicate
|
// Note: currently the Close (X) button doesn't appear to work in dialogs. Docs indicate
|
||||||
// that it should, so I presume the problem is in wxWidgets and that (hopefully!) an updated
|
// that it should, so I presume the problem is in wxWidgets and that (hopefully!) an updated
|
||||||
|
|
Loading…
Reference in New Issue