summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2016-11-08 20:52:45 -0500
committerLioncash <mathew1800@gmail.com>2016-11-08 21:19:24 -0500
commit2acf3570e00b370fd6f09a6794a1dcd7ee02829e (patch)
treebc6ebd45ba2591f18db14f7989c7f99c1b358aec /Source
parente05553acfc23896b710314434535e4e006373885 (diff)
PathConfigPane: Eliminate main frame global usage
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Config/PathConfigPane.cpp5
-rw-r--r--Source/Core/DolphinWX/Frame.cpp2
-rw-r--r--Source/Core/DolphinWX/Frame.h5
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp14
4 files changed, 17 insertions, 9 deletions
diff --git a/Source/Core/DolphinWX/Config/PathConfigPane.cpp b/Source/Core/DolphinWX/Config/PathConfigPane.cpp
index acd56b7747..cb4943f9bf 100644
--- a/Source/Core/DolphinWX/Config/PathConfigPane.cpp
+++ b/Source/Core/DolphinWX/Config/PathConfigPane.cpp
@@ -21,7 +21,6 @@
#include "DiscIO/NANDContentLoader.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Frame.h"
-#include "DolphinWX/Main.h"
#include "DolphinWX/WxEventUtils.h"
#include "DolphinWX/WxUtils.h"
@@ -226,7 +225,9 @@ void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event)
DiscIO::CNANDContentManager::Access().ClearCache();
- main_frame->UpdateWiiMenuChoice();
+ wxCommandEvent update_event{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, GetId()};
+ update_event.SetEventObject(this);
+ AddPendingEvent(update_event);
}
void PathConfigPane::OnDumpPathChanged(wxCommandEvent& event)
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 147e2a47b6..7e50d93026 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -226,6 +226,7 @@ bool CRenderFrame::ShowFullScreen(bool show, long style)
wxDEFINE_EVENT(wxEVT_HOST_COMMAND, wxCommandEvent);
wxDEFINE_EVENT(DOLPHIN_EVT_LOCAL_INI_CHANGED, wxCommandEvent);
wxDEFINE_EVENT(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, wxCommandEvent);
+wxDEFINE_EVENT(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, wxCommandEvent);
// Event tables
BEGIN_EVENT_TABLE(CFrame, CRenderFrame)
@@ -493,6 +494,7 @@ void CFrame::BindEvents()
Bind(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, &CFrame::OnReloadThemeBitmaps, this);
Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &CFrame::OnReloadGameList, this);
+ Bind(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, &CFrame::OnUpdateLoadWiiMenuItem, this);
}
bool CFrame::RendererIsFullscreen()
diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h
index ba4e0b3a61..2025ce56e4 100644
--- a/Source/Core/DolphinWX/Frame.h
+++ b/Source/Core/DolphinWX/Frame.h
@@ -61,6 +61,7 @@ private:
};
wxDECLARE_EVENT(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, wxCommandEvent);
+wxDECLARE_EVENT(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, wxCommandEvent);
class CFrame : public CRenderFrame
{
@@ -106,7 +107,6 @@ public:
bool RendererIsFullscreen();
void DoFullscreen(bool bF);
void ToggleDisplayMode(bool bFullscreen);
- void UpdateWiiMenuChoice(wxMenuItem* WiiMenuItem = nullptr);
static void ConnectWiimote(int wm_idx, bool connect);
void UpdateTitle(const std::string& str);
void OpenGeneralConfiguration(wxWindowID tab_id = wxID_ANY);
@@ -242,6 +242,9 @@ private:
void OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event);
+ void OnUpdateLoadWiiMenuItem(wxCommandEvent&);
+ void UpdateLoadWiiMenuItem() const;
+
void OnOpen(wxCommandEvent& event); // File menu
void DoOpen(bool Boot);
void OnRefresh(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 00bc54917d..e68c2a27f9 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1072,6 +1072,11 @@ void CFrame::OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event)
event.Check(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
}
+void CFrame::OnUpdateLoadWiiMenuItem(wxCommandEvent& WXUNUSED(event))
+{
+ UpdateLoadWiiMenuItem();
+}
+
void CFrame::ClearStatusBar()
{
if (this->GetStatusBar()->IsEnabled())
@@ -1184,16 +1189,13 @@ void CFrame::OnInstallWAD(wxCommandEvent& event)
u64 titleID = DiscIO::CNANDContentManager::Access().Install_WiiWAD(fileName);
if (titleID == TITLEID_SYSMENU)
{
- UpdateWiiMenuChoice();
+ UpdateLoadWiiMenuItem();
}
}
-void CFrame::UpdateWiiMenuChoice(wxMenuItem* WiiMenuItem)
+void CFrame::UpdateLoadWiiMenuItem() const
{
- if (!WiiMenuItem)
- {
- WiiMenuItem = GetMenuBar()->FindItem(IDM_LOAD_WII_MENU);
- }
+ auto* const WiiMenuItem = GetMenuBar()->FindItem(IDM_LOAD_WII_MENU);
const DiscIO::CNANDContentLoader& SysMenu_Loader =
DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU,