Merge pull request #5217 from lioncash/cheats
Frame: Make cheat dialog private
This commit is contained in:
commit
96e70ad5a3
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "DolphinWX/Cheats/CheatsWindow.h"
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -9,19 +11,16 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/checklst.h>
|
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/listbox.h>
|
|
||||||
#include <wx/msgdlg.h>
|
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/statbox.h>
|
|
||||||
#include <wx/stattext.h>
|
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
#include <wx/utils.h>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
@ -34,12 +33,9 @@
|
||||||
#include "Core/GeckoCodeConfig.h"
|
#include "Core/GeckoCodeConfig.h"
|
||||||
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
|
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
|
||||||
#include "DolphinWX/Cheats/CheatSearchTab.h"
|
#include "DolphinWX/Cheats/CheatSearchTab.h"
|
||||||
#include "DolphinWX/Cheats/CheatsWindow.h"
|
|
||||||
#include "DolphinWX/Cheats/CreateCodeDialog.h"
|
|
||||||
#include "DolphinWX/Cheats/GeckoCodeDiag.h"
|
#include "DolphinWX/Cheats/GeckoCodeDiag.h"
|
||||||
#include "DolphinWX/Frame.h"
|
#include "DolphinWX/Frame.h"
|
||||||
#include "DolphinWX/Globals.h"
|
#include "DolphinWX/Globals.h"
|
||||||
#include "DolphinWX/Main.h"
|
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
|
||||||
wxDEFINE_EVENT(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, wxCommandEvent);
|
wxDEFINE_EVENT(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, wxCommandEvent);
|
||||||
|
@ -65,13 +61,9 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
|
||||||
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
|
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
|
||||||
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
|
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
|
||||||
Center();
|
Center();
|
||||||
Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCheatsWindow::~wxCheatsWindow()
|
wxCheatsWindow::~wxCheatsWindow() = default;
|
||||||
{
|
|
||||||
main_frame->g_CheatsWindow = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheatsWindow::CreateGUI()
|
void wxCheatsWindow::CreateGUI()
|
||||||
{
|
{
|
||||||
|
@ -139,8 +131,7 @@ void wxCheatsWindow::CreateGUI()
|
||||||
m_notebook_main->AddPage(m_tab_log, _("Logging"));
|
m_notebook_main->AddPage(m_tab_log, _("Logging"));
|
||||||
|
|
||||||
Bind(wxEVT_BUTTON, &wxCheatsWindow::OnEvent_ApplyChanges_Press, this, wxID_APPLY);
|
Bind(wxEVT_BUTTON, &wxCheatsWindow::OnEvent_ApplyChanges_Press, this, wxID_APPLY);
|
||||||
Bind(wxEVT_BUTTON, &wxCheatsWindow::OnEvent_ButtonClose_Press, this, wxID_CANCEL);
|
Bind(wxEVT_CLOSE_WINDOW, &wxCheatsWindow::OnClose, this);
|
||||||
Bind(wxEVT_CLOSE_WINDOW, &wxCheatsWindow::OnEvent_Close, this);
|
|
||||||
Bind(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, &wxCheatsWindow::OnNewARCodeCreated, this);
|
Bind(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, &wxCheatsWindow::OnNewARCodeCreated, this);
|
||||||
|
|
||||||
wxStdDialogButtonSizer* const sButtons = CreateStdDialogButtonSizer(wxAPPLY | wxCANCEL);
|
wxStdDialogButtonSizer* const sButtons = CreateStdDialogButtonSizer(wxAPPLY | wxCANCEL);
|
||||||
|
@ -158,15 +149,9 @@ void wxCheatsWindow::CreateGUI()
|
||||||
SetSizerAndFit(sMain);
|
SetSizerAndFit(sMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent&)
|
void wxCheatsWindow::OnClose(wxCloseEvent&)
|
||||||
{
|
{
|
||||||
Close();
|
Hide();
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheatsWindow::OnEvent_Close(wxCloseEvent&)
|
|
||||||
{
|
|
||||||
// This dialog is created on the heap instead of the stack so we have to destroy ourself.
|
|
||||||
Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load codes for a new ISO ID
|
// load codes for a new ISO ID
|
||||||
|
|
|
@ -67,9 +67,8 @@ private:
|
||||||
// Cheat Search
|
// Cheat Search
|
||||||
void OnNewARCodeCreated(wxCommandEvent& ev);
|
void OnNewARCodeCreated(wxCommandEvent& ev);
|
||||||
|
|
||||||
// Close Button
|
// Dialog close event
|
||||||
void OnEvent_ButtonClose_Press(wxCommandEvent& event);
|
void OnClose(wxCloseEvent&);
|
||||||
void OnEvent_Close(wxCloseEvent& ev);
|
|
||||||
|
|
||||||
// Changes to the INI (affects cheat listings)
|
// Changes to the INI (affects cheat listings)
|
||||||
void OnLocalGameIniModified(wxCommandEvent& event);
|
void OnLocalGameIniModified(wxCommandEvent& event);
|
||||||
|
|
|
@ -86,7 +86,6 @@ public:
|
||||||
// These have to be public
|
// These have to be public
|
||||||
CCodeWindow* g_pCodeWindow = nullptr;
|
CCodeWindow* g_pCodeWindow = nullptr;
|
||||||
NetPlaySetupFrame* g_NetPlaySetupDiag = nullptr;
|
NetPlaySetupFrame* g_NetPlaySetupDiag = nullptr;
|
||||||
wxCheatsWindow* g_CheatsWindow = nullptr;
|
|
||||||
|
|
||||||
void DoStop();
|
void DoStop();
|
||||||
void UpdateGUI();
|
void UpdateGUI();
|
||||||
|
@ -139,6 +138,7 @@ private:
|
||||||
LogConfigWindow* m_LogConfigWindow = nullptr;
|
LogConfigWindow* m_LogConfigWindow = nullptr;
|
||||||
FifoPlayerDlg* m_FifoPlayerDlg = nullptr;
|
FifoPlayerDlg* m_FifoPlayerDlg = nullptr;
|
||||||
std::array<TASInputDlg*, 8> m_tas_input_dialogs{};
|
std::array<TASInputDlg*, 8> m_tas_input_dialogs{};
|
||||||
|
wxCheatsWindow* m_cheats_window = nullptr;
|
||||||
bool UseDebugger = false;
|
bool UseDebugger = false;
|
||||||
bool m_bBatchMode = false;
|
bool m_bBatchMode = false;
|
||||||
bool m_bEdit = false;
|
bool m_bEdit = false;
|
||||||
|
|
|
@ -1169,10 +1169,11 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED(event))
|
||||||
|
|
||||||
void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event))
|
void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (!g_CheatsWindow)
|
if (!m_cheats_window)
|
||||||
g_CheatsWindow = new wxCheatsWindow(this);
|
m_cheats_window = new wxCheatsWindow(this);
|
||||||
else
|
|
||||||
g_CheatsWindow->Raise();
|
m_cheats_window->Show();
|
||||||
|
m_cheats_window->Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
|
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@ -1514,12 +1515,12 @@ void CFrame::UpdateGUI()
|
||||||
m_Mgr->Update();
|
m_Mgr->Update();
|
||||||
|
|
||||||
// Update non-modal windows
|
// Update non-modal windows
|
||||||
if (g_CheatsWindow)
|
if (m_cheats_window)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().bEnableCheats)
|
if (SConfig::GetInstance().bEnableCheats)
|
||||||
g_CheatsWindow->UpdateGUI();
|
m_cheats_window->UpdateGUI();
|
||||||
else
|
else
|
||||||
g_CheatsWindow->Close();
|
m_cheats_window->Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue