Merge pull request #4427 from lioncash/config-update

DolphinWX: Enable/disable config UI options based on core state
This commit is contained in:
Mat M 2016-11-06 08:21:02 -05:00 committed by GitHub
commit 136a10482f
25 changed files with 292 additions and 186 deletions

View File

@ -61,6 +61,7 @@ set(GUI_SRCS
SoftwareVideoConfigDialog.cpp
TASInputDlg.cpp
VideoConfigDiag.cpp
WxEventUtils.cpp
WXInputBase.cpp
WxUtils.cpp)

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/AdvancedConfigPane.h"
#include <cmath>
#include <wx/checkbox.h>
@ -14,14 +16,14 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinWX/Config/AdvancedConfigPane.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/WxEventUtils.h"
AdvancedConfigPane::AdvancedConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void AdvancedConfigPane::InitializeGUI()
@ -31,22 +33,10 @@ void AdvancedConfigPane::InitializeGUI()
new DolphinSlider(this, wxID_ANY, 100, 0, 150, wxDefaultPosition, FromDIP(wxSize(200, -1)));
m_clock_override_text = new wxStaticText(this, wxID_ANY, "");
m_clock_override_checkbox->Bind(wxEVT_CHECKBOX,
&AdvancedConfigPane::OnClockOverrideCheckBoxChanged, this);
m_clock_override_slider->Bind(wxEVT_SLIDER, &AdvancedConfigPane::OnClockOverrideSliderChanged,
this);
m_custom_rtc_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Custom RTC"));
m_custom_rtc_date_picker = new wxDatePickerCtrl(this, wxID_ANY);
m_custom_rtc_time_picker = new wxTimePickerCtrl(this, wxID_ANY);
m_custom_rtc_checkbox->Bind(wxEVT_CHECKBOX, &AdvancedConfigPane::OnCustomRTCCheckBoxChanged,
this);
m_custom_rtc_date_picker->Bind(wxEVT_DATE_CHANGED, &AdvancedConfigPane::OnCustomRTCDateChanged,
this);
m_custom_rtc_time_picker->Bind(wxEVT_TIME_CHANGED, &AdvancedConfigPane::OnCustomRTCTimeChanged,
this);
wxStaticText* const clock_override_description =
new wxStaticText(this, wxID_ANY, _("Higher values can make variable-framerate games "
"run at a higher framerate, at the expense of CPU. "
@ -122,6 +112,33 @@ void AdvancedConfigPane::LoadGUIValues()
LoadCustomRTC();
}
void AdvancedConfigPane::BindEvents()
{
m_clock_override_checkbox->Bind(wxEVT_CHECKBOX,
&AdvancedConfigPane::OnClockOverrideCheckBoxChanged, this);
m_clock_override_checkbox->Bind(wxEVT_UPDATE_UI, &AdvancedConfigPane::OnUpdateCPUClockControls,
this);
m_clock_override_slider->Bind(wxEVT_SLIDER, &AdvancedConfigPane::OnClockOverrideSliderChanged,
this);
m_clock_override_slider->Bind(wxEVT_UPDATE_UI, &AdvancedConfigPane::OnUpdateCPUClockControls,
this);
m_custom_rtc_checkbox->Bind(wxEVT_CHECKBOX, &AdvancedConfigPane::OnCustomRTCCheckBoxChanged,
this);
m_custom_rtc_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_custom_rtc_date_picker->Bind(wxEVT_DATE_CHANGED, &AdvancedConfigPane::OnCustomRTCDateChanged,
this);
m_custom_rtc_date_picker->Bind(wxEVT_UPDATE_UI, &AdvancedConfigPane::OnUpdateRTCDateTimeEntries,
this);
m_custom_rtc_time_picker->Bind(wxEVT_TIME_CHANGED, &AdvancedConfigPane::OnCustomRTCTimeChanged,
this);
m_custom_rtc_time_picker->Bind(wxEVT_UPDATE_UI, &AdvancedConfigPane::OnUpdateRTCDateTimeEntries,
this);
}
void AdvancedConfigPane::OnClockOverrideCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_OCEnable = m_clock_override_checkbox->IsChecked();
@ -188,17 +205,6 @@ void AdvancedConfigPane::LoadCustomRTC()
// Limit dates to a valid range (Jan 1/2000 to Dec 31/2099)
m_custom_rtc_date_picker->SetRange(wxDateTime(1, wxDateTime::Jan, 2000),
wxDateTime(31, wxDateTime::Dec, 2099));
if (Core::IsRunning())
{
m_custom_rtc_checkbox->Enable(false);
m_custom_rtc_date_picker->Enable(false);
m_custom_rtc_time_picker->Enable(false);
}
else
{
m_custom_rtc_date_picker->Enable(custom_rtc_enabled);
m_custom_rtc_time_picker->Enable(custom_rtc_enabled);
}
}
void AdvancedConfigPane::UpdateCustomRTC(time_t date, time_t time)
@ -209,19 +215,18 @@ void AdvancedConfigPane::UpdateCustomRTC(time_t date, time_t time)
m_custom_rtc_time_picker->SetValue(custom_rtc);
}
void AdvancedConfigPane::RefreshGUI()
void AdvancedConfigPane::OnUpdateCPUClockControls(wxUpdateUIEvent& event)
{
// Don't allow users to edit the RTC while the game is running
if (Core::IsRunning())
if (!Core::IsRunning())
{
m_custom_rtc_checkbox->Disable();
m_custom_rtc_date_picker->Disable();
m_custom_rtc_time_picker->Disable();
}
// Allow users to edit CPU clock speed in game, but not while needing determinism
if (Core::IsRunning() && Core::g_want_determinism)
{
m_clock_override_checkbox->Disable();
m_clock_override_slider->Disable();
event.Enable(true);
return;
}
event.Enable(!Core::g_want_determinism);
}
void AdvancedConfigPane::OnUpdateRTCDateTimeEntries(wxUpdateUIEvent& event)
{
event.Enable(!Core::IsRunning() && m_custom_rtc_checkbox->IsChecked());
}

View File

@ -23,7 +23,10 @@ public:
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void OnUpdateCPUClockControls(wxUpdateUIEvent&);
void OnUpdateRTCDateTimeEntries(wxUpdateUIEvent&);
void OnClockOverrideCheckBoxChanged(wxCommandEvent&);
void OnClockOverrideSliderChanged(wxCommandEvent&);

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/AudioConfigPane.h"
#include <string>
#include <wx/checkbox.h>
@ -16,15 +18,15 @@
#include "Common/Common.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinWX/Config/AudioConfigPane.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/WxEventUtils.h"
#include "DolphinWX/WxUtils.h"
AudioConfigPane::AudioConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void AudioConfigPane::InitializeGUI()
@ -46,13 +48,6 @@ void AudioConfigPane::InitializeGUI()
new wxSpinCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30);
m_audio_latency_label = new wxStaticText(this, wxID_ANY, _("Latency:"));
m_dsp_engine_radiobox->Bind(wxEVT_RADIOBOX, &AudioConfigPane::OnDSPEngineRadioBoxChanged, this);
m_dpl2_decoder_checkbox->Bind(wxEVT_CHECKBOX, &AudioConfigPane::OnDPL2DecoderCheckBoxChanged,
this);
m_volume_slider->Bind(wxEVT_SLIDER, &AudioConfigPane::OnVolumeSliderChanged, this);
m_audio_backend_choice->Bind(wxEVT_CHOICE, &AudioConfigPane::OnAudioBackendChanged, this);
m_audio_latency_spinctrl->Bind(wxEVT_SPINCTRL, &AudioConfigPane::OnLatencySpinCtrlChanged, this);
m_audio_backend_choice->SetToolTip(
_("Changing this will have no effect while the emulator is running."));
m_audio_latency_spinctrl->SetToolTip(_("Sets the latency (in ms). Higher values may reduce audio "
@ -139,15 +134,22 @@ void AudioConfigPane::ToggleBackendSpecificControls(const std::string& backend)
m_volume_text->Enable(supports_volume_changes);
}
void AudioConfigPane::RefreshGUI()
void AudioConfigPane::BindEvents()
{
if (Core::IsRunning())
{
m_audio_latency_spinctrl->Disable();
m_audio_backend_choice->Disable();
m_dpl2_decoder_checkbox->Disable();
m_dsp_engine_radiobox->Disable();
}
m_dsp_engine_radiobox->Bind(wxEVT_RADIOBOX, &AudioConfigPane::OnDSPEngineRadioBoxChanged, this);
m_dsp_engine_radiobox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_dpl2_decoder_checkbox->Bind(wxEVT_CHECKBOX, &AudioConfigPane::OnDPL2DecoderCheckBoxChanged,
this);
m_dpl2_decoder_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_volume_slider->Bind(wxEVT_SLIDER, &AudioConfigPane::OnVolumeSliderChanged, this);
m_audio_backend_choice->Bind(wxEVT_CHOICE, &AudioConfigPane::OnAudioBackendChanged, this);
m_audio_backend_choice->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_audio_latency_spinctrl->Bind(wxEVT_SPINCTRL, &AudioConfigPane::OnLatencySpinCtrlChanged, this);
m_audio_latency_spinctrl->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
}
void AudioConfigPane::OnDSPEngineRadioBoxChanged(wxCommandEvent& event)

View File

@ -23,7 +23,7 @@ public:
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void PopulateBackendChoiceBox();
void ToggleBackendSpecificControls(const std::string& backend);

View File

@ -2,6 +2,9 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/ConfigMain.h"
#include <wx/debug.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
@ -10,16 +13,15 @@
#include "Common/CommonTypes.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "DolphinWX/Config/AdvancedConfigPane.h"
#include "DolphinWX/Config/AudioConfigPane.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/GameCubeConfigPane.h"
#include "DolphinWX/Config/GeneralConfigPane.h"
#include "DolphinWX/Config/InterfaceConfigPane.h"
#include "DolphinWX/Config/PathConfigPane.h"
#include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/GameListCtrl.h"
#include "DolphinWX/WxUtils.h"
// Sent by child panes to signify that the game list should
@ -35,6 +37,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
Bind(wxEVT_CLOSE_WINDOW, &CConfigMain::OnClose, this);
Bind(wxEVT_BUTTON, &CConfigMain::OnCloseButton, this, wxID_CLOSE);
Bind(wxEVT_SHOW, &CConfigMain::OnShow, this);
Bind(wxDOLPHIN_CFG_REFRESH_LIST, &CConfigMain::OnSetRefreshGameListOnClose, this);
wxDialog::SetExtraStyle(GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS);
@ -46,14 +49,22 @@ CConfigMain::~CConfigMain()
{
}
void CConfigMain::SetSelectedTab(int tab)
void CConfigMain::SetSelectedTab(wxWindowID tab_id)
{
// TODO : this is just a quick and dirty way to do it, possible cleanup
switch (tab)
switch (tab_id)
{
case ID_GENERALPAGE:
case ID_DISPLAYPAGE:
case ID_AUDIOPAGE:
Notebook->SetSelection(2);
case ID_GAMECUBEPAGE:
case ID_WIIPAGE:
case ID_PATHSPAGE:
case ID_ADVANCEDPAGE:
Notebook->SetSelection(Notebook->FindPage(Notebook->FindWindowById(tab_id)));
break;
default:
wxASSERT_MSG(false, wxString::Format("Invalid tab page ID specified (%d)", tab_id));
break;
}
}
@ -96,16 +107,22 @@ void CConfigMain::CreateGUIControls()
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
SetSizerAndFit(main_sizer);
Center();
SetFocus();
}
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED(event))
{
EndModal((m_refresh_game_list_on_close) ? wxID_OK : wxID_CANCEL);
Hide();
// Save the config. Dolphin crashes too often to only save the settings on closing
SConfig::GetInstance().SaveSettings();
if (m_refresh_game_list_on_close)
AddPendingEvent(wxCommandEvent{DOLPHIN_EVT_RELOAD_GAMELIST});
}
void CConfigMain::OnShow(wxShowEvent& event)
{
if (event.IsShown())
CenterOnParent();
}
void CConfigMain::OnCloseButton(wxCommandEvent& WXUNUSED(event))

View File

@ -21,7 +21,7 @@ public:
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain();
void SetSelectedTab(int tab);
void SetSelectedTab(wxWindowID tab_id);
enum
{
@ -39,6 +39,7 @@ private:
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
void OnShow(wxShowEvent& event);
void OnSetRefreshGameListOnClose(wxCommandEvent& event);
wxNotebook* Notebook;

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/GameCubeConfigPane.h"
#include <string>
#include <wx/button.h>
@ -22,7 +24,7 @@
#include "Core/HW/GCMemcard.h"
#include "Core/NetPlayProto.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/GameCubeConfigPane.h"
#include "DolphinWX/WxEventUtils.h"
#include "DolphinWX/WxUtils.h"
#define DEV_NONE_STR _trans("<Nothing>")
@ -39,7 +41,7 @@ GameCubeConfigPane::GameCubeConfigPane(wxWindow* parent, wxWindowID id) : wxPane
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void GameCubeConfigPane::InitializeGUI()
@ -54,17 +56,13 @@ void GameCubeConfigPane::InitializeGUI()
m_system_lang_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ipl_language_strings);
m_system_lang_choice->SetToolTip(_("Sets the GameCube system language."));
m_system_lang_choice->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSystemLanguageChange, this);
m_override_lang_checkbox = new wxCheckBox(this, wxID_ANY, _("Override Language on NTSC Games"));
m_override_lang_checkbox->SetToolTip(_(
"Lets the system language be set to values that games were not designed for. This can allow "
"the use of extra translations for a few games, but can also lead to text display issues."));
m_override_lang_checkbox->Bind(wxEVT_CHECKBOX,
&GameCubeConfigPane::OnOverrideLanguageCheckBoxChanged, this);
m_skip_bios_checkbox = new wxCheckBox(this, wxID_ANY, _("Skip BIOS"));
m_skip_bios_checkbox->Bind(wxEVT_CHECKBOX, &GameCubeConfigPane::OnSkipBiosCheckBoxChanged, this);
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
@ -85,20 +83,15 @@ void GameCubeConfigPane::InitializeGUI()
};
m_exi_devices[0] = new wxChoice(this, wxID_ANY);
m_exi_devices[0]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotAChanged, this);
m_exi_devices[1] = new wxChoice(this, wxID_ANY);
m_exi_devices[1]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotBChanged, this);
m_exi_devices[2] = new wxChoice(this, wxID_ANY);
m_exi_devices[2]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSP1Changed, this);
m_exi_devices[2]->SetToolTip(
_("Serial Port 1 - This is the port which devices such as the net adapter use."));
m_memcard_path[0] =
new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[0]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotAButtonClick, this);
m_memcard_path[1] =
new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[1]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotBButtonClick, this);
const int space5 = FromDIP(5);
const int space10 = FromDIP(10);
@ -131,9 +124,6 @@ void GameCubeConfigPane::InitializeGUI()
if (i < 2)
gamecube_EXIDev_sizer->Add(m_memcard_path[i], wxGBPosition(i, 2), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL);
if (NetPlay::IsNetPlayRunning())
m_exi_devices[i]->Disable();
}
sbGamecubeDeviceSettings->AddSpacer(space5);
sbGamecubeDeviceSettings->Add(gamecube_EXIDev_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
@ -218,14 +208,27 @@ void GameCubeConfigPane::LoadGUIValues()
}
}
void GameCubeConfigPane::RefreshGUI()
void GameCubeConfigPane::BindEvents()
{
if (Core::IsRunning())
{
m_system_lang_choice->Disable();
m_override_lang_checkbox->Disable();
m_skip_bios_checkbox->Disable();
}
m_system_lang_choice->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSystemLanguageChange, this);
m_system_lang_choice->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_override_lang_checkbox->Bind(wxEVT_CHECKBOX,
&GameCubeConfigPane::OnOverrideLanguageCheckBoxChanged, this);
m_override_lang_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_skip_bios_checkbox->Bind(wxEVT_CHECKBOX, &GameCubeConfigPane::OnSkipBiosCheckBoxChanged, this);
m_skip_bios_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_exi_devices[0]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotAChanged, this);
m_exi_devices[0]->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfNetplayNotRunning);
m_exi_devices[1]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotBChanged, this);
m_exi_devices[1]->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfNetplayNotRunning);
m_exi_devices[2]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSP1Changed, this);
m_exi_devices[2]->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfNetplayNotRunning);
m_memcard_path[0]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotAButtonClick, this);
m_memcard_path[1]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotBButtonClick, this);
}
void GameCubeConfigPane::OnSystemLanguageChange(wxCommandEvent& event)

View File

@ -22,7 +22,7 @@ public:
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void OnSystemLanguageChange(wxCommandEvent&);
void OnOverrideLanguageCheckBoxChanged(wxCommandEvent&);

View File

@ -18,6 +18,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinWX/WxEventUtils.h"
GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
@ -34,7 +35,7 @@ GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void GeneralConfigPane::InitializeGUI()
@ -86,15 +87,6 @@ void GeneralConfigPane::InitializeGUI()
"that raising or lowering the emulation speed will also raise "
"or lower the audio pitch to prevent audio from stuttering."));
m_dual_core_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnDualCoreCheckBoxChanged, this);
m_cheats_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnCheatCheckBoxChanged, this);
m_force_ntscj_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnForceNTSCJCheckBoxChanged,
this);
m_analytics_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnAnalyticsCheckBoxChanged, this);
m_analytics_new_id->Bind(wxEVT_BUTTON, &GeneralConfigPane::OnAnalyticsNewIdButtonClick, this);
m_throttler_choice->Bind(wxEVT_CHOICE, &GeneralConfigPane::OnThrottlerChoiceChanged, this);
m_cpu_engine_radiobox->Bind(wxEVT_RADIOBOX, &GeneralConfigPane::OnCPUEngineRadioBoxChanged, this);
const int space5 = FromDIP(5);
wxBoxSizer* const throttler_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -161,15 +153,26 @@ void GeneralConfigPane::LoadGUIValues()
}
}
void GeneralConfigPane::RefreshGUI()
void GeneralConfigPane::BindEvents()
{
if (Core::IsRunning())
{
m_dual_core_checkbox->Disable();
m_cheats_checkbox->Disable();
m_force_ntscj_checkbox->Disable();
m_cpu_engine_radiobox->Disable();
}
m_dual_core_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnDualCoreCheckBoxChanged, this);
m_dual_core_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_cheats_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnCheatCheckBoxChanged, this);
m_cheats_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_force_ntscj_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnForceNTSCJCheckBoxChanged,
this);
m_force_ntscj_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_analytics_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnAnalyticsCheckBoxChanged, this);
m_analytics_new_id->Bind(wxEVT_BUTTON, &GeneralConfigPane::OnAnalyticsNewIdButtonClick, this);
m_throttler_choice->Bind(wxEVT_CHOICE, &GeneralConfigPane::OnThrottlerChoiceChanged, this);
m_cpu_engine_radiobox->Bind(wxEVT_RADIOBOX, &GeneralConfigPane::OnCPUEngineRadioBoxChanged, this);
m_cpu_engine_radiobox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
}
void GeneralConfigPane::OnDualCoreCheckBoxChanged(wxCommandEvent& event)

View File

@ -27,7 +27,7 @@ private:
std::vector<CPUCore> m_cpu_cores;
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void OnDualCoreCheckBoxChanged(wxCommandEvent&);
void OnCheatCheckBoxChanged(wxCommandEvent&);

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/PathConfigPane.h"
#include <string>
#include <wx/button.h>
@ -18,16 +20,16 @@
#include "Core/Core.h"
#include "DiscIO/NANDContentLoader.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/PathConfigPane.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/WxEventUtils.h"
#include "DolphinWX/WxUtils.h"
PathConfigPane::PathConfigPane(wxWindow* panel, wxWindowID id) : wxPanel(panel, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void PathConfigPane::InitializeGUI()
@ -62,21 +64,6 @@ void PathConfigPane::InitializeGUI()
this, wxID_ANY, wxEmptyString, _("Choose an SD Card file:"), wxFileSelectorDefaultWildcardStr,
wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL);
m_iso_paths_listbox->Bind(wxEVT_LISTBOX, &PathConfigPane::OnISOPathSelectionChanged, this);
m_recursive_iso_paths_checkbox->Bind(wxEVT_CHECKBOX,
&PathConfigPane::OnRecursiveISOCheckBoxChanged, this);
m_add_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnAddISOPath, this);
m_remove_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnRemoveISOPath, this);
m_default_iso_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnDefaultISOChanged,
this);
m_dvd_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDVDRootChanged, this);
m_apploader_path_filepicker->Bind(wxEVT_FILEPICKER_CHANGED,
&PathConfigPane::OnApploaderPathChanged, this);
m_nand_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnNANDRootChanged, this);
m_dump_path_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDumpPathChanged, this);
m_wii_sdcard_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnSdCardPathChanged,
this);
const int space5 = FromDIP(5);
wxBoxSizer* const iso_button_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -141,10 +128,24 @@ void PathConfigPane::LoadGUIValues()
m_iso_paths_listbox->Append(StrToWxStr(folder));
}
void PathConfigPane::RefreshGUI()
void PathConfigPane::BindEvents()
{
if (Core::IsRunning())
Disable();
m_iso_paths_listbox->Bind(wxEVT_LISTBOX, &PathConfigPane::OnISOPathSelectionChanged, this);
m_recursive_iso_paths_checkbox->Bind(wxEVT_CHECKBOX,
&PathConfigPane::OnRecursiveISOCheckBoxChanged, this);
m_add_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnAddISOPath, this);
m_remove_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnRemoveISOPath, this);
m_default_iso_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnDefaultISOChanged,
this);
m_dvd_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDVDRootChanged, this);
m_apploader_path_filepicker->Bind(wxEVT_FILEPICKER_CHANGED,
&PathConfigPane::OnApploaderPathChanged, this);
m_nand_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnNANDRootChanged, this);
m_dump_path_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDumpPathChanged, this);
m_wii_sdcard_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnSdCardPathChanged,
this);
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
}
void PathConfigPane::OnISOPathSelectionChanged(wxCommandEvent& event)

View File

@ -20,7 +20,7 @@ public:
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void OnISOPathSelectionChanged(wxCommandEvent&);
void OnRecursiveISOCheckBoxChanged(wxCommandEvent&);

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Config/WiiConfigPane.h"
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/gbsizer.h>
@ -12,15 +14,15 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/WxEventUtils.h"
#include "DolphinWX/WxUtils.h"
WiiConfigPane::WiiConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
BindEvents();
}
void WiiConfigPane::InitializeGUI()
@ -56,18 +58,6 @@ void WiiConfigPane::InitializeGUI()
m_bt_speaker_volume = new DolphinSlider(this, wxID_ANY, 0, 0, 127);
m_bt_wiimote_motor = new wxCheckBox(this, wxID_ANY, _("Wii Remote Motor"));
m_screensaver_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnScreenSaverCheckBoxChanged, this);
m_pal60_mode_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnPAL60CheckBoxChanged, this);
m_aspect_ratio_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnAspectRatioChoiceChanged, this);
m_system_language_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSystemLanguageChoiceChanged, this);
m_sd_card_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnSDCardCheckBoxChanged, this);
m_connect_keyboard_checkbox->Bind(wxEVT_CHECKBOX,
&WiiConfigPane::OnConnectKeyboardCheckBoxChanged, this);
m_bt_sensor_bar_pos->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSensorBarPosChanged, this);
m_bt_sensor_bar_sens->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSensorBarSensChanged, this);
m_bt_speaker_volume->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSpeakerVolumeChanged, this);
m_bt_wiimote_motor->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnWiimoteMotorChanged, this);
m_screensaver_checkbox->SetToolTip(_("Dims the screen after five minutes of inactivity."));
m_pal60_mode_checkbox->SetToolTip(_("Sets the Wii display mode to 60Hz (480i) instead of 50Hz "
"(576i) for PAL games.\nMay not work for all games."));
@ -167,20 +157,35 @@ void WiiConfigPane::LoadGUIValues()
m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_wiimote_motor);
}
void WiiConfigPane::RefreshGUI()
void WiiConfigPane::BindEvents()
{
if (Core::IsRunning())
{
m_screensaver_checkbox->Disable();
m_pal60_mode_checkbox->Disable();
m_aspect_ratio_choice->Disable();
m_system_language_choice->Disable();
m_screensaver_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnScreenSaverCheckBoxChanged, this);
m_screensaver_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_bt_sensor_bar_pos->Disable();
m_bt_sensor_bar_sens->Disable();
m_bt_speaker_volume->Disable();
m_bt_wiimote_motor->Disable();
}
m_pal60_mode_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnPAL60CheckBoxChanged, this);
m_pal60_mode_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_aspect_ratio_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnAspectRatioChoiceChanged, this);
m_aspect_ratio_choice->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_system_language_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSystemLanguageChoiceChanged, this);
m_system_language_choice->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_sd_card_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnSDCardCheckBoxChanged, this);
m_connect_keyboard_checkbox->Bind(wxEVT_CHECKBOX,
&WiiConfigPane::OnConnectKeyboardCheckBoxChanged, this);
m_bt_sensor_bar_pos->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSensorBarPosChanged, this);
m_bt_sensor_bar_pos->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_bt_sensor_bar_sens->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSensorBarSensChanged, this);
m_bt_sensor_bar_sens->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_bt_speaker_volume->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSpeakerVolumeChanged, this);
m_bt_speaker_volume->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
m_bt_wiimote_motor->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnWiimoteMotorChanged, this);
m_bt_wiimote_motor->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning);
}
void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event)

View File

@ -21,7 +21,7 @@ public:
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void BindEvents();
void OnScreenSaverCheckBoxChanged(wxCommandEvent&);
void OnPAL60CheckBoxChanged(wxCommandEvent&);

View File

@ -120,6 +120,7 @@
<ClCompile Include="VideoConfigDiag.cpp" />
<ClCompile Include="PostProcessingConfigDiag.cpp" />
<ClCompile Include="ControllerConfigDiag.cpp" />
<ClCompile Include="WxEventUtils.cpp" />
<ClCompile Include="WXInputBase.cpp" />
<ClCompile Include="WxUtils.cpp" />
</ItemGroup>
@ -184,6 +185,7 @@
<ClInclude Include="VideoConfigDiag.h" />
<ClInclude Include="PostProcessingConfigDiag.h" />
<ClInclude Include="ControllerConfigDiag.h" />
<ClInclude Include="WxEventUtils.h" />
<ClInclude Include="WXInputBase.h" />
<ClInclude Include="WxUtils.h" />
</ItemGroup>

View File

@ -35,6 +35,7 @@
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainNoGUI.cpp" />
<ClCompile Include="WxEventUtils.cpp" />
<ClCompile Include="WXInputBase.cpp" />
<ClCompile Include="WxUtils.cpp" />
<ClCompile Include="Cheats\CheatsWindow.cpp">
@ -223,6 +224,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="Main.h" />
<ClInclude Include="WxEventUtils.h" />
<ClInclude Include="WXInputBase.h" />
<ClInclude Include="WxUtils.h" />
<ClInclude Include="Cheats\CheatSearchTab.h">

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Frame.h"
#include <atomic>
#include <cstddef>
#include <fstream>
@ -49,8 +51,8 @@
#include "Core/Movie.h"
#include "Core/State.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/GameListCtrl.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/LogWindow.h"
@ -310,6 +312,8 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
{
BindEvents();
m_main_config_dialog = new CConfigMain(this);
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
bFloatWindow[i] = false;
@ -488,6 +492,7 @@ void CFrame::BindEvents()
BindMenuBarEvents();
Bind(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, &CFrame::OnReloadThemeBitmaps, this);
Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &CFrame::OnReloadGameList, this);
}
bool CFrame::RendererIsFullscreen()

View File

@ -27,6 +27,7 @@
// Class declarations
class CGameListCtrl;
class CCodeWindow;
class CConfigMain;
class CLogWindow;
class FifoPlayerDlg;
class LogConfigWindow;
@ -108,7 +109,7 @@ public:
void UpdateWiiMenuChoice(wxMenuItem* WiiMenuItem = nullptr);
static void ConnectWiimote(int wm_idx, bool connect);
void UpdateTitle(const std::string& str);
void OpenGeneralConfiguration(int tab = -1);
void OpenGeneralConfiguration(wxWindowID tab_id = wxID_ANY);
const CGameListCtrl* GetGameListCtrl() const;
wxMenuBar* GetMenuBar() const override;
@ -143,6 +144,7 @@ public:
private:
CGameListCtrl* m_GameListCtrl = nullptr;
CConfigMain* m_main_config_dialog = nullptr;
wxPanel* m_Panel = nullptr;
CRenderFrame* m_RenderFrame = nullptr;
wxWindow* m_RenderParent = nullptr;
@ -236,6 +238,7 @@ private:
void OnHelp(wxCommandEvent& event);
void OnReloadThemeBitmaps(wxCommandEvent& event);
void OnReloadGameList(wxCommandEvent& event);
void OnEnableMenuItemIfCoreInitialized(wxUpdateUIEvent& event);
void OnEnableMenuItemIfCoreUninitialized(wxUpdateUIEvent& event);

View File

@ -256,18 +256,13 @@ wxToolBar* CFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& na
return new MainToolBar{type, this, id, wxDefaultPosition, wxDefaultSize, style};
}
void CFrame::OpenGeneralConfiguration(int tab)
void CFrame::OpenGeneralConfiguration(wxWindowID tab_id)
{
CConfigMain config_main(this);
if (tab > -1)
config_main.SetSelectedTab(tab);
if (tab_id > wxID_ANY)
m_main_config_dialog->SetSelectedTab(tab_id);
HotkeyManagerEmu::Enable(false);
if (config_main.ShowModal() == wxID_OK)
UpdateGameList();
HotkeyManagerEmu::Enable(true);
UpdateGUI();
m_main_config_dialog->Show();
m_main_config_dialog->SetFocus();
}
// Menu items
@ -734,13 +729,11 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
BootGame(drives[event.GetId() - IDM_DRIVE1]);
}
// Refresh the file list and browse for a favorites directory
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED(event))
{
UpdateGameList();
}
// Create screenshot
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED(event))
{
Core::SaveScreenShot();
@ -1067,6 +1060,11 @@ void CFrame::OnReloadThemeBitmaps(wxCommandEvent& WXUNUSED(event))
UpdateGameList();
}
void CFrame::OnReloadGameList(wxCommandEvent& WXUNUSED(event))
{
UpdateGameList();
}
void CFrame::OnEnableMenuItemIfCoreInitialized(wxUpdateUIEvent& event)
{
event.Enable(Core::GetState() != Core::CORE_UNINITIALIZED);
@ -1531,8 +1529,9 @@ void CFrame::UpdateGUI()
void CFrame::UpdateGameList()
{
if (m_GameListCtrl)
m_GameListCtrl->ReloadList();
wxCommandEvent event{DOLPHIN_EVT_RELOAD_GAMELIST, GetId()};
event.SetEventObject(this);
wxPostEvent(m_GameListCtrl, event);
}
void CFrame::GameListChanged(wxCommandEvent& event)

View File

@ -155,6 +155,8 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
return 0;
}
wxDEFINE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent);
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos,
const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style), toolTip(nullptr)
@ -180,6 +182,8 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin
Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC);
Bind(wxEVT_MENU, &CGameListCtrl::OnNetPlayHost, this, IDM_START_NETPLAY);
Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &CGameListCtrl::OnReloadGameList, this);
wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this);
}
@ -708,6 +712,11 @@ void CGameListCtrl::ScanForISOs()
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
}
void CGameListCtrl::OnReloadGameList(wxCommandEvent& WXUNUSED(event))
{
ReloadList();
}
void CGameListCtrl::OnLocalIniModified(wxCommandEvent& ev)
{
ev.Skip();

View File

@ -31,6 +31,8 @@ public:
}
};
wxDECLARE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent);
class CGameListCtrl : public wxListCtrl
{
public:
@ -38,8 +40,6 @@ public:
long style);
~CGameListCtrl();
void ReloadList();
void BrowseForDirectory();
const GameListItem* GetISO(size_t index) const;
const GameListItem* GetSelectedISO() const;
@ -67,17 +67,9 @@ public:
#endif
private:
std::vector<int> m_FlagImageIndex;
std::vector<int> m_PlatformImageIndex;
std::vector<int> m_EmuStateImageIndex;
std::vector<int> m_utility_game_banners;
std::vector<std::unique_ptr<GameListItem>> m_ISOFiles;
void ReloadList();
void ClearIsoFiles() { m_ISOFiles.clear(); }
int last_column;
int last_sort;
wxSize lastpos;
wxEmuStateTip* toolTip;
void InitBitmaps();
void UpdateItemAtColumn(long _Index, int column);
void InsertItemInReportView(long _Index);
@ -85,6 +77,7 @@ private:
void ScanForISOs();
// events
void OnReloadGameList(wxCommandEvent& event);
void OnLeftClick(wxMouseEvent& event);
void OnRightClick(wxMouseEvent& event);
void OnMouseMotion(wxMouseEvent& event);
@ -113,4 +106,15 @@ private:
static bool CompressCB(const std::string& text, float percent, void* arg);
static bool MultiCompressCB(const std::string& text, float percent, void* arg);
static bool WiiCompressWarning();
std::vector<int> m_FlagImageIndex;
std::vector<int> m_PlatformImageIndex;
std::vector<int> m_EmuStateImageIndex;
std::vector<int> m_utility_game_banners;
std::vector<std::unique_ptr<GameListItem>> m_ISOFiles;
int last_column;
int last_sort;
wxSize lastpos;
wxEmuStateTip* toolTip;
};

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/ISOProperties.h"
#include <array>
#include <cinttypes>
#include <cstddef>
@ -63,11 +65,11 @@
#include "DiscIO/VolumeCreator.h"
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
#include "DolphinWX/Cheats/GeckoCodeDiag.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/ISOProperties.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/PatchAddEdit.h"
#include "DolphinWX/WxUtils.h"
@ -133,7 +135,7 @@ private:
void OnConfigureClicked(wxCommandEvent&)
{
main_frame->OpenGeneralConfiguration();
main_frame->OpenGeneralConfiguration(CConfigMain::ID_GENERALPAGE);
UpdateState();
}

View File

@ -0,0 +1,22 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/WxEventUtils.h"
#include <wx/event.h>
#include "Core/Core.h"
#include "Core/NetPlayProto.h"
namespace WxEventUtils
{
void OnEnableIfCoreNotRunning(wxUpdateUIEvent& event)
{
event.Enable(!Core::IsRunning());
}
void OnEnableIfNetplayNotRunning(wxUpdateUIEvent& event)
{
event.Enable(!NetPlay::IsNetPlayRunning());
}
} // namespace WxEventUtils

View File

@ -0,0 +1,17 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
// Intended for containing event functions that are bound to
// different window controls through wxEvtHandler's Bind()
// function.
class wxUpdateUIEvent;
namespace WxEventUtils
{
void OnEnableIfCoreNotRunning(wxUpdateUIEvent&);
void OnEnableIfNetplayNotRunning(wxUpdateUIEvent&);
} // namespace WxEventUtils