Frame: Normalize member names

This commit is contained in:
Lioncash 2017-04-30 20:11:01 -04:00
parent 1bad3bef4b
commit 9e71031e23
12 changed files with 403 additions and 398 deletions

View File

@ -83,8 +83,8 @@ void CCodeWindow::Load()
ini.GetOrCreateSection("ShowOnStart")->Get(SettingName[i], &bShowOnStart[i], false); ini.GetOrCreateSection("ShowOnStart")->Get(SettingName[i], &bShowOnStart[i], false);
// Get notebook affiliation // Get notebook affiliation
std::string section = "P - " + ((Parent->ActivePerspective < Parent->Perspectives.size()) ? std::string section = "P - " + ((Parent->m_active_perspective < Parent->m_perspectives.size()) ?
Parent->Perspectives[Parent->ActivePerspective].Name : Parent->m_perspectives[Parent->m_active_perspective].name :
"Perspective 1"); "Perspective 1");
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++) for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
@ -92,7 +92,7 @@ void CCodeWindow::Load()
// Get floating setting // Get floating setting
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++) for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
ini.GetOrCreateSection("Float")->Get(SettingName[i], &Parent->bFloatWindow[i], false); ini.GetOrCreateSection("Float")->Get(SettingName[i], &Parent->m_float_window[i], false);
} }
void CCodeWindow::Save() void CCodeWindow::Save()
@ -114,7 +114,7 @@ void CCodeWindow::Save()
->Set(SettingName[i - IDM_LOG_WINDOW], GetParentMenuBar()->IsChecked(i)); ->Set(SettingName[i - IDM_LOG_WINDOW], GetParentMenuBar()->IsChecked(i));
// Save notebook affiliations // Save notebook affiliations
std::string section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name; std::string section = "P - " + Parent->m_perspectives[Parent->m_active_perspective].name;
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++) for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
ini.GetOrCreateSection(section)->Set(SettingName[i], iNbAffiliation[i]); ini.GetOrCreateSection(section)->Set(SettingName[i], iNbAffiliation[i]);
@ -536,7 +536,7 @@ void CCodeWindow::TogglePanel(int id, bool show)
panel = CreateSiblingPanel(id); panel = CreateSiblingPanel(id);
} }
Parent->DoAddPage(panel, iNbAffiliation[id - IDM_DEBUG_WINDOW_LIST_START], Parent->DoAddPage(panel, iNbAffiliation[id - IDM_DEBUG_WINDOW_LIST_START],
Parent->bFloatWindow[id - IDM_DEBUG_WINDOW_LIST_START]); Parent->m_float_window[id - IDM_DEBUG_WINDOW_LIST_START]);
} }
else if (panel) // Close else if (panel) // Close
{ {

View File

@ -250,7 +250,7 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
{ {
// FIXME: This is terrible. Generate events instead. // FIXME: This is terrible. Generate events instead.
CFrame* cframe = wxGetApp().GetCFrame(); CFrame* cframe = wxGetApp().GetCFrame();
CCodeWindow* code_window = cframe->g_pCodeWindow; CCodeWindow* code_window = cframe->m_code_window;
CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>(); CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>();
switch (event.GetId()) switch (event.GetId())

View File

@ -514,7 +514,7 @@ void CRegisterView::OnPopupMenu(wxCommandEvent& event)
{ {
// FIXME: This is terrible. Generate events instead. // FIXME: This is terrible. Generate events instead.
CFrame* cframe = wxGetApp().GetCFrame(); CFrame* cframe = wxGetApp().GetCFrame();
CCodeWindow* code_window = cframe->g_pCodeWindow; CCodeWindow* code_window = cframe->m_code_window;
CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>(); CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>();
CMemoryWindow* memory_window = code_window->GetPanel<CMemoryWindow>(); CMemoryWindow* memory_window = code_window->GetPanel<CMemoryWindow>();

View File

@ -277,7 +277,7 @@ void CWatchView::OnPopupMenu(wxCommandEvent& event)
{ {
// FIXME: This is terrible. Generate events instead. // FIXME: This is terrible. Generate events instead.
CFrame* cframe = wxGetApp().GetCFrame(); CFrame* cframe = wxGetApp().GetCFrame();
CCodeWindow* code_window = cframe->g_pCodeWindow; CCodeWindow* code_window = cframe->m_code_window;
CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>(); CWatchWindow* watch_window = code_window->GetPanel<CWatchWindow>();
CMemoryWindow* memory_window = code_window->GetPanel<CMemoryWindow>(); CMemoryWindow* memory_window = code_window->GetPanel<CMemoryWindow>();
CBreakPointWindow* breakpoint_window = code_window->GetPanel<CBreakPointWindow>(); CBreakPointWindow* breakpoint_window = code_window->GetPanel<CBreakPointWindow>();

View File

@ -318,22 +318,19 @@ static void SignalHandler(int)
CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geometry, CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geometry,
bool use_debugger, bool batch_mode, bool show_log_window, long style) bool use_debugger, bool batch_mode, bool show_log_window, long style)
: CRenderFrame(parent, id, title, wxDefaultPosition, wxSize(800, 600), style), : CRenderFrame(parent, id, title, wxDefaultPosition, wxSize(800, 600), style),
UseDebugger(use_debugger), m_bBatchMode(batch_mode) m_use_debugger(use_debugger), m_batch_mode(batch_mode)
{ {
BindEvents(); BindEvents();
for (int i = 0; i <= IDM_CODE_WINDOW - IDM_LOG_WINDOW; i++)
bFloatWindow[i] = false;
if (show_log_window) if (show_log_window)
SConfig::GetInstance().m_InterfaceLogWindow = true; SConfig::GetInstance().m_InterfaceLogWindow = true;
// Debugger class // Debugger class
if (UseDebugger) if (m_use_debugger)
{ {
g_pCodeWindow = new CCodeWindow(this, IDM_CODE_WINDOW); m_code_window = new CCodeWindow(this, IDM_CODE_WINDOW);
LoadIniPerspectives(); LoadIniPerspectives();
g_pCodeWindow->Load(); m_code_window->Load();
} }
wxFrame::CreateToolBar(wxTB_DEFAULT_STYLE | wxTB_TEXT | wxTB_FLAT)->Realize(); wxFrame::CreateToolBar(wxTB_DEFAULT_STYLE | wxTB_TEXT | wxTB_FLAT)->Realize();
@ -351,21 +348,21 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
// --------------- // ---------------
// Main panel // Main panel
// This panel is the parent for rendering and it holds the gamelistctrl // This panel is the parent for rendering and it holds the gamelistctrl
m_Panel = new wxPanel(this, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0); m_panel = new wxPanel(this, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0);
m_GameListCtrl = new CGameListCtrl(m_Panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_game_list_ctrl = new CGameListCtrl(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
m_GameListCtrl->Bind(wxEVT_LIST_ITEM_ACTIVATED, &CFrame::OnGameListCtrlItemActivated, this); m_game_list_ctrl->Bind(wxEVT_LIST_ITEM_ACTIVATED, &CFrame::OnGameListCtrlItemActivated, this);
wxBoxSizer* sizerPanel = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sizerPanel = new wxBoxSizer(wxHORIZONTAL);
sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL); sizerPanel->Add(m_game_list_ctrl, 1, wxEXPAND | wxALL);
m_Panel->SetSizer(sizerPanel); m_panel->SetSizer(sizerPanel);
// --------------- // ---------------
// Manager // Manager
m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); m_mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo() m_mgr->AddPane(m_panel, wxAuiPaneInfo()
.Name("Pane 0") .Name("Pane 0")
.Caption("Pane 0") .Caption("Pane 0")
.PaneBorder(false) .PaneBorder(false)
@ -373,8 +370,8 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
.Layer(0) .Layer(0)
.Center() .Center()
.Show()); .Show());
if (!g_pCodeWindow) if (!m_code_window)
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo() m_mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
.Name("Pane 1") .Name("Pane 1")
.Caption(_("Logging")) .Caption(_("Logging"))
.CaptionVisible(true) .CaptionVisible(true)
@ -382,20 +379,20 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
.FloatingSize(wxSize(600, 350)) .FloatingSize(wxSize(600, 350))
.CloseButton(true) .CloseButton(true)
.Hide()); .Hide());
AuiFullscreen = m_Mgr->SavePerspective(); m_aui_fullscreen_perspective = m_mgr->SavePerspective();
if (!SConfig::GetInstance().m_InterfaceToolbar) if (!SConfig::GetInstance().m_InterfaceToolbar)
DoToggleToolbar(false); DoToggleToolbar(false);
m_LogWindow = new CLogWindow(this, IDM_LOG_WINDOW); m_log_window = new CLogWindow(this, IDM_LOG_WINDOW);
m_LogWindow->Hide(); m_log_window->Hide();
m_LogWindow->Disable(); m_log_window->Disable();
InitializeTASDialogs(); InitializeTASDialogs();
InitializeCoreCallbacks(); InitializeCoreCallbacks();
// Setup perspectives // Setup perspectives
if (g_pCodeWindow) if (m_code_window)
{ {
// Load perspective // Load perspective
DoLoadPerspective(); DoLoadPerspective();
@ -415,13 +412,13 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
FromDIP(wxSize(800, 600))); FromDIP(wxSize(800, 600)));
// Start debugging maximized (Must be after the window has been positioned) // Start debugging maximized (Must be after the window has been positioned)
if (UseDebugger) if (m_use_debugger)
Maximize(true); Maximize(true);
// Commit // Commit
m_Mgr->Update(); m_mgr->Update();
// The window must be shown for m_XRRConfig to be created (wxGTK will not allocate X11 // The window must be shown for m_xrr_config to be created (wxGTK will not allocate X11
// resources until the window is shown for the first time). // resources until the window is shown for the first time).
Show(); Show();
@ -431,12 +428,12 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
#endif #endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()), m_xrr_config = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle())); X11Utils::XWindowFromHandle(GetHandle()));
#endif #endif
// Connect event handlers // Connect event handlers
m_Mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this); m_mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this);
// Update controls // Update controls
UpdateGUI(); UpdateGUI();
@ -475,12 +472,12 @@ CFrame::~CFrame()
g_controller_interface.Shutdown(); g_controller_interface.Shutdown();
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
delete m_XRRConfig; delete m_xrr_config;
#endif #endif
ClosePages(); ClosePages();
delete m_Mgr; delete m_mgr;
// This object is owned by us, not wxw // This object is owned by us, not wxw
m_menubar_shadow->Destroy(); m_menubar_shadow->Destroy();
@ -533,7 +530,7 @@ bool CFrame::RendererIsFullscreen()
if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused) if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused)
{ {
fullscreen = m_RenderFrame->IsFullScreen(); fullscreen = m_render_frame->IsFullScreen();
} }
return fullscreen; return fullscreen;
@ -548,13 +545,13 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
// Events // Events
void CFrame::OnActive(wxActivateEvent& event) void CFrame::OnActive(wxActivateEvent& event)
{ {
m_bRendererHasFocus = (event.GetActive() && event.GetEventObject() == m_RenderFrame); m_renderer_has_focus = (event.GetActive() && event.GetEventObject() == m_render_frame);
if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused) if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused)
{ {
if (m_bRendererHasFocus) if (m_renderer_has_focus)
{ {
if (SConfig::GetInstance().bRenderToMain) if (SConfig::GetInstance().bRenderToMain)
m_RenderParent->SetFocus(); m_render_parent->SetFocus();
else if (RendererIsFullscreen() && g_ActiveConfig.ExclusiveFullscreenEnabled()) else if (RendererIsFullscreen() && g_ActiveConfig.ExclusiveFullscreenEnabled())
DoExclusiveFullscreen(true); // Regain exclusive mode DoExclusiveFullscreen(true); // Regain exclusive mode
@ -562,7 +559,7 @@ void CFrame::OnActive(wxActivateEvent& event)
DoPause(); DoPause();
if (SConfig::GetInstance().bHideCursor && Core::GetState() == Core::State::Running) if (SConfig::GetInstance().bHideCursor && Core::GetState() == Core::State::Running)
m_RenderParent->SetCursor(wxCURSOR_BLANK); m_render_parent->SetCursor(wxCURSOR_BLANK);
} }
else else
{ {
@ -570,7 +567,7 @@ void CFrame::OnActive(wxActivateEvent& event)
DoPause(); DoPause();
if (SConfig::GetInstance().bHideCursor) if (SConfig::GetInstance().bHideCursor)
m_RenderParent->SetCursor(wxNullCursor); m_render_parent->SetCursor(wxNullCursor);
} }
} }
event.Skip(); event.Skip();
@ -588,7 +585,7 @@ void CFrame::OnClose(wxCloseEvent& event)
event.Veto(); event.Veto();
} }
// Tell OnStopped to resubmit the Close event // Tell OnStopped to resubmit the Close event
m_bClosing = true; m_is_closing = true;
return; return;
} }
@ -600,19 +597,19 @@ void CFrame::OnClose(wxCloseEvent& event)
event.Skip(); event.Skip();
// Save GUI settings // Save GUI settings
if (g_pCodeWindow) if (m_code_window)
{ {
SaveIniPerspectives(); SaveIniPerspectives();
} }
else else
{ {
m_LogWindow->SaveSettings(); m_log_window->SaveSettings();
} }
if (m_LogWindow) if (m_log_window)
m_LogWindow->RemoveAllListeners(); m_log_window->RemoveAllListeners();
// Uninit // Uninit
m_Mgr->UnInit(); m_mgr->UnInit();
} }
// Post events // Post events
@ -620,10 +617,10 @@ void CFrame::OnClose(wxCloseEvent& event)
// Warning: This may cause an endless loop if the event is propagated back to its parent // Warning: This may cause an endless loop if the event is propagated back to its parent
void CFrame::PostEvent(wxCommandEvent& event) void CFrame::PostEvent(wxCommandEvent& event)
{ {
if (g_pCodeWindow && event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX) if (m_code_window && event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX)
{ {
event.StopPropagation(); event.StopPropagation();
g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); m_code_window->GetEventHandler()->AddPendingEvent(event);
} }
else else
{ {
@ -656,10 +653,12 @@ void CFrame::OnResize(wxSizeEvent& event)
} }
// Make sure the logger pane is a sane size // Make sure the logger pane is a sane size
if (!g_pCodeWindow && m_LogWindow && m_Mgr->GetPane("Pane 1").IsShown() && if (!m_code_window && m_log_window && m_mgr->GetPane("Pane 1").IsShown() &&
!m_Mgr->GetPane("Pane 1").IsFloating() && !m_mgr->GetPane("Pane 1").IsFloating() && (m_log_window->x > GetClientRect().GetWidth() ||
(m_LogWindow->x > GetClientRect().GetWidth() || m_LogWindow->y > GetClientRect().GetHeight())) m_log_window->y > GetClientRect().GetHeight()))
{
ShowResizePane(); ShowResizePane();
}
} }
// Host messages // Host messages
@ -694,12 +693,12 @@ void CFrame::UpdateTitle(const std::string& str)
if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().m_InterfaceStatusbar) if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().m_InterfaceStatusbar)
{ {
GetStatusBar()->SetStatusText(str, 0); GetStatusBar()->SetStatusText(str, 0);
m_RenderFrame->SetTitle(scm_rev_str); m_render_frame->SetTitle(scm_rev_str);
} }
else else
{ {
std::string titleStr = StringFromFormat("%s | %s", scm_rev_str.c_str(), str.c_str()); std::string titleStr = StringFromFormat("%s | %s", scm_rev_str.c_str(), str.c_str());
m_RenderFrame->SetTitle(titleStr); m_render_frame->SetTitle(titleStr);
} }
} }
@ -708,7 +707,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_UPDATE_DISASM_DIALOG: // For breakpoints causing pausing case IDM_UPDATE_DISASM_DIALOG: // For breakpoints causing pausing
if (!g_pCodeWindow || Core::GetState() != Core::State::Paused) if (!m_code_window || Core::GetState() != Core::State::Paused)
return; return;
// fallthrough // fallthrough
@ -735,17 +734,17 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
case WM_USER_CREATE: case WM_USER_CREATE:
if (SConfig::GetInstance().bHideCursor) if (SConfig::GetInstance().bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK); m_render_parent->SetCursor(wxCURSOR_BLANK);
break; break;
case IDM_PANIC: case IDM_PANIC:
{ {
wxString caption = event.GetString().BeforeFirst(':'); wxString caption = event.GetString().BeforeFirst(':');
wxString text = event.GetString().AfterFirst(':'); wxString text = event.GetString().AfterFirst(':');
bPanicResult = m_panic_result =
(wxYES == wxMessageBox(text, caption, wxSTAY_ON_TOP | (event.GetInt() ? wxYES_NO : wxOK), (wxYES == wxMessageBox(text, caption, wxSTAY_ON_TOP | (event.GetInt() ? wxYES_NO : wxOK),
wxWindow::FindFocus())); wxWindow::FindFocus()));
panic_event.Set(); m_panic_event.Set();
} }
break; break;
@ -778,35 +777,35 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
void CFrame::OnRenderWindowSizeRequest(int width, int height) void CFrame::OnRenderWindowSizeRequest(int width, int height)
{ {
if (!SConfig::GetInstance().bRenderWindowAutoSize || !Core::IsRunning() || if (!SConfig::GetInstance().bRenderWindowAutoSize || !Core::IsRunning() ||
RendererIsFullscreen() || m_RenderFrame->IsMaximized()) RendererIsFullscreen() || m_render_frame->IsMaximized())
return; return;
wxSize requested_size(width, height); wxSize requested_size(width, height);
// Convert to window pixels, since the size is from the backend it will be in framebuffer px. // Convert to window pixels, since the size is from the backend it will be in framebuffer px.
requested_size *= 1.0 / m_RenderFrame->GetContentScaleFactor(); requested_size *= 1.0 / m_render_frame->GetContentScaleFactor();
wxSize old_size; wxSize old_size;
if (!SConfig::GetInstance().bRenderToMain) if (!SConfig::GetInstance().bRenderToMain)
{ {
old_size = m_RenderFrame->GetClientSize(); old_size = m_render_frame->GetClientSize();
} }
else else
{ {
// Resize for the render panel only, this implicitly retains space for everything else // Resize for the render panel only, this implicitly retains space for everything else
// (i.e. log panel, toolbar, statusbar, etc) without needing to compute for them. // (i.e. log panel, toolbar, statusbar, etc) without needing to compute for them.
old_size = m_RenderParent->GetSize(); old_size = m_render_parent->GetSize();
} }
wxSize diff = requested_size - old_size; wxSize diff = requested_size - old_size;
if (diff != wxSize()) if (diff != wxSize())
m_RenderFrame->SetSize(m_RenderFrame->GetSize() + diff); m_render_frame->SetSize(m_render_frame->GetSize() + diff);
} }
bool CFrame::RendererHasFocus() bool CFrame::RendererHasFocus()
{ {
if (m_RenderParent == nullptr) if (m_render_parent == nullptr)
return false; return false;
return m_bRendererHasFocus; return m_renderer_has_focus;
} }
void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event)) void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event))
@ -818,7 +817,7 @@ void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event))
// 1. Boot the selected iso // 1. Boot the selected iso
// 2. Boot the default or last loaded iso. // 2. Boot the default or last loaded iso.
// 3. Call BrowseForDirectory if the gamelist is empty // 3. Call BrowseForDirectory if the gamelist is empty
if (!m_GameListCtrl->GetISO(0) && CGameListCtrl::IsHidingItems()) if (!m_game_list_ctrl->GetISO(0) && CGameListCtrl::IsHidingItems())
{ {
SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii = SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListElfDol = SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListElfDol =
@ -853,9 +852,9 @@ void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event))
UpdateGameList(); UpdateGameList();
} }
else if (!m_GameListCtrl->GetISO(0)) else if (!m_game_list_ctrl->GetISO(0))
{ {
m_GameListCtrl->BrowseForDirectory(); m_game_list_ctrl->BrowseForDirectory();
} }
else else
{ {
@ -1045,7 +1044,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
// the system beep for unhandled key events when // the system beep for unhandled key events when
// receiving pad/Wiimote keypresses which take an // receiving pad/Wiimote keypresses which take an
// entirely different path through the HID subsystem. // entirely different path through the HID subsystem.
if (!m_bRendererHasFocus) if (!m_renderer_has_focus)
{ {
// We do however want to pass events on when the // We do however want to pass events on when the
// render window is out of focus: this allows use // render window is out of focus: this allows use
@ -1122,13 +1121,13 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
if (SConfig::GetInstance().bRenderToMain) if (SConfig::GetInstance().bRenderToMain)
{ {
m_RenderFrame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL); m_render_frame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL);
if (enable_fullscreen) if (enable_fullscreen)
{ {
// Save the current mode before going to fullscreen // Save the current mode before going to fullscreen
AuiCurrent = m_Mgr->SavePerspective(); m_aui_current_perspective = m_mgr->SavePerspective();
m_Mgr->LoadPerspective(AuiFullscreen, true); m_mgr->LoadPerspective(m_aui_fullscreen_perspective, true);
// Hide toolbar // Hide toolbar
DoToggleToolbar(false); DoToggleToolbar(false);
@ -1146,7 +1145,7 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
else else
{ {
// Restore saved perspective // Restore saved perspective
m_Mgr->LoadPerspective(AuiCurrent, true); m_mgr->LoadPerspective(m_aui_current_perspective, true);
// Restore toolbar to the status it was at before going fullscreen. // Restore toolbar to the status it was at before going fullscreen.
DoToggleToolbar(SConfig::GetInstance().m_InterfaceToolbar); DoToggleToolbar(SConfig::GetInstance().m_InterfaceToolbar);
@ -1170,16 +1169,16 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
if (!enable_fullscreen) if (!enable_fullscreen)
DoExclusiveFullscreen(false); DoExclusiveFullscreen(false);
m_RenderFrame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL); m_render_frame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL);
m_RenderFrame->Raise(); m_render_frame->Raise();
if (enable_fullscreen) if (enable_fullscreen)
DoExclusiveFullscreen(true); DoExclusiveFullscreen(true);
} }
else else
{ {
m_RenderFrame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL); m_render_frame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL);
m_RenderFrame->Raise(); m_render_frame->Raise();
} }
} }
@ -1285,7 +1284,7 @@ void CFrame::ParseHotkeys()
IsHotkey(HK_TRIGGER_SYNC_BUTTON, true)); IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));
} }
if (UseDebugger) if (m_use_debugger)
{ {
if (IsHotkey(HK_STEP)) if (IsHotkey(HK_STEP))
{ {
@ -1328,7 +1327,7 @@ void CFrame::ParseHotkeys()
if (bpDlg.ShowModal() == wxID_OK) if (bpDlg.ShowModal() == wxID_OK)
{ {
wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS); wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS);
g_pCodeWindow->GetEventHandler()->AddPendingEvent(evt); m_code_window->GetEventHandler()->AddPendingEvent(evt);
} }
} }
if (IsHotkey(HK_MBP_ADD)) if (IsHotkey(HK_MBP_ADD))
@ -1337,7 +1336,7 @@ void CFrame::ParseHotkeys()
if (memDlg.ShowModal() == wxID_OK) if (memDlg.ShowModal() == wxID_OK)
{ {
wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS); wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS);
g_pCodeWindow->GetEventHandler()->AddPendingEvent(evt); m_code_window->GetEventHandler()->AddPendingEvent(evt);
} }
} }
} }
@ -1430,11 +1429,11 @@ void CFrame::ParseHotkeys()
} }
if (IsHotkey(HK_SAVE_STATE_SLOT_SELECTED)) if (IsHotkey(HK_SAVE_STATE_SLOT_SELECTED))
{ {
State::Save(m_saveSlot); State::Save(m_save_slot);
} }
if (IsHotkey(HK_LOAD_STATE_SLOT_SELECTED)) if (IsHotkey(HK_LOAD_STATE_SLOT_SELECTED))
{ {
State::Load(m_saveSlot); State::Load(m_save_slot);
} }
if (IsHotkey(HK_TOGGLE_STEREO_SBS)) if (IsHotkey(HK_TOGGLE_STEREO_SBS))
@ -1639,6 +1638,6 @@ void CFrame::HandleSignal(wxTimerEvent& event)
{ {
if (!s_shutdown_signal_received.TestAndClear()) if (!s_shutdown_signal_received.TestAndClear())
return; return;
m_bClosing = true; m_is_closing = true;
Close(); Close();
} }

View File

@ -77,15 +77,15 @@ public:
void* GetRenderHandle() void* GetRenderHandle()
{ {
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
return reinterpret_cast<void*>(X11Utils::XWindowFromHandle(m_RenderParent->GetHandle())); return reinterpret_cast<void*>(X11Utils::XWindowFromHandle(m_render_parent->GetHandle()));
#else #else
return reinterpret_cast<void*>(m_RenderParent->GetHandle()); return reinterpret_cast<void*>(m_render_parent->GetHandle());
#endif #endif
} }
// These have to be public // These have to be public
CCodeWindow* g_pCodeWindow = nullptr; CCodeWindow* m_code_window = nullptr;
NetPlaySetupFrame* g_NetPlaySetupDiag = nullptr; NetPlaySetupFrame* m_netplay_setup_frame = nullptr;
void DoStop(); void DoStop();
void UpdateGUI(); void UpdateGUI();
@ -101,56 +101,30 @@ public:
wxMenuBar* GetMenuBar() const override; wxMenuBar* GetMenuBar() const override;
Common::Event panic_event; Common::Event m_panic_event;
bool bPanicResult; bool m_panic_result;
#ifdef __WXGTK__
std::recursive_mutex keystate_lock;
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration* m_XRRConfig; X11Utils::XRRConfiguration* m_xrr_config;
#endif #endif
// AUI // AUI
wxAuiManager* m_Mgr = nullptr; wxAuiManager* m_mgr = nullptr;
bool bFloatWindow[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START] = {}; bool m_float_window[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START] = {};
// Perspectives (Should find a way to make all of this private) // Perspectives (Should find a way to make all of this private)
void DoAddPage(wxWindow* Win, int i, bool Float); void DoAddPage(wxWindow* Win, int i, bool Float);
void DoRemovePage(wxWindow*, bool bHide = true); void DoRemovePage(wxWindow*, bool bHide = true);
struct SPerspectives struct SPerspectives
{ {
std::string Name; std::string name;
wxString Perspective; wxString perspective;
std::vector<int> Width, Height; std::vector<int> width, height;
}; };
std::vector<SPerspectives> Perspectives; std::vector<SPerspectives> m_perspectives;
u32 ActivePerspective; u32 m_active_perspective;
private: private:
CGameListCtrl* m_GameListCtrl = nullptr;
CConfigMain* m_main_config_dialog = nullptr;
wxPanel* m_Panel = nullptr;
CRenderFrame* m_RenderFrame = nullptr;
wxWindow* m_RenderParent = nullptr;
CLogWindow* m_LogWindow = nullptr;
LogConfigWindow* m_LogConfigWindow = nullptr;
FifoPlayerDlg* m_FifoPlayerDlg = nullptr;
std::array<TASInputDlg*, 8> m_tas_input_dialogs{};
wxCheatsWindow* m_cheats_window = nullptr;
bool UseDebugger = false;
bool m_bBatchMode = false;
bool m_bEdit = false;
bool m_bTabSplit = false;
bool m_bNoDocking = false;
bool m_bGameLoading = false;
bool m_bClosing = false;
bool m_bRendererHasFocus = false;
bool m_confirmStop = false;
bool m_tried_graceful_shutdown = false;
int m_saveSlot = 1;
enum enum
{ {
ADD_PANE_TOP, ADD_PANE_TOP,
@ -160,11 +134,40 @@ private:
ADD_PANE_CENTER ADD_PANE_CENTER
}; };
CGameListCtrl* m_game_list_ctrl = nullptr;
CConfigMain* m_main_config_dialog = nullptr;
wxPanel* m_panel = nullptr;
CRenderFrame* m_render_frame = nullptr;
wxWindow* m_render_parent = nullptr;
CLogWindow* m_log_window = nullptr;
LogConfigWindow* m_log_config_window = nullptr;
FifoPlayerDlg* m_fifo_player_dialog = nullptr;
std::array<TASInputDlg*, 8> m_tas_input_dialogs{};
wxCheatsWindow* m_cheats_window = nullptr;
bool m_use_debugger = false;
bool m_batch_mode = false;
bool m_editing_perspectives = false;
bool m_is_split_tab_notebook = false;
bool m_no_panel_docking = false;
bool m_is_game_loading = false;
bool m_is_closing = false;
bool m_renderer_has_focus = false;
bool m_confirm_stop = false;
bool m_tried_graceful_shutdown = false;
int m_save_slot = 1;
wxTimer m_poll_hotkey_timer; wxTimer m_poll_hotkey_timer;
wxTimer m_handle_signal_timer; wxTimer m_handle_signal_timer;
wxMenuBar* m_menubar_shadow = nullptr; wxMenuBar* m_menubar_shadow = nullptr;
wxString m_aui_fullscreen_perspective;
wxString m_aui_current_perspective;
#ifdef __WXGTK__
std::recursive_mutex m_keystate_lock;
#endif
void BindEvents(); void BindEvents();
void BindMenuBarEvents(); void BindMenuBarEvents();
void BindDebuggerMenuBarEvents(); void BindDebuggerMenuBarEvents();
@ -207,7 +210,7 @@ private:
void DoFloatNotebookPage(wxWindowID Id); void DoFloatNotebookPage(wxWindowID Id);
wxFrame* CreateParentFrame(wxWindowID Id = wxID_ANY, const wxString& title = "", wxFrame* CreateParentFrame(wxWindowID Id = wxID_ANY, const wxString& title = "",
wxWindow* = nullptr); wxWindow* = nullptr);
wxString AuiFullscreen, AuiCurrent;
void AddPane(int dir); void AddPane(int dir);
void UpdateCurrentPerspective(); void UpdateCurrentPerspective();
void SaveIniPerspectives(); void SaveIniPerspectives();

View File

@ -46,12 +46,12 @@
void CFrame::OnManagerResize(wxAuiManagerEvent& event) void CFrame::OnManagerResize(wxAuiManagerEvent& event)
{ {
if (!g_pCodeWindow && m_LogWindow && m_Mgr->GetPane("Pane 1").IsShown() && if (!m_code_window && m_log_window && m_mgr->GetPane("Pane 1").IsShown() &&
!m_Mgr->GetPane("Pane 1").IsFloating()) !m_mgr->GetPane("Pane 1").IsFloating())
{ {
m_LogWindow->x = m_Mgr->GetPane("Pane 1").rect.GetWidth(); m_log_window->x = m_mgr->GetPane("Pane 1").rect.GetWidth();
m_LogWindow->y = m_Mgr->GetPane("Pane 1").rect.GetHeight(); m_log_window->y = m_mgr->GetPane("Pane 1").rect.GetHeight();
m_LogWindow->winpos = m_Mgr->GetPane("Pane 1").dock_direction; m_log_window->winpos = m_mgr->GetPane("Pane 1").dock_direction;
} }
event.Skip(); event.Skip();
} }
@ -64,7 +64,7 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
if (!nb) if (!nb)
return; return;
if (!g_pCodeWindow) if (!m_code_window)
{ {
if (nb->GetPage(0)->GetId() == IDM_LOG_WINDOW || if (nb->GetPage(0)->GetId() == IDM_LOG_WINDOW ||
nb->GetPage(0)->GetId() == IDM_LOG_CONFIG_WINDOW) nb->GetPage(0)->GetId() == IDM_LOG_CONFIG_WINDOW)
@ -89,16 +89,16 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
{ {
// Detach and delete the empty notebook // Detach and delete the empty notebook
event.pane->DestroyOnClose(true); event.pane->DestroyOnClose(true);
m_Mgr->ClosePane(*event.pane); m_mgr->ClosePane(*event.pane);
} }
} }
m_Mgr->Update(); m_mgr->Update();
} }
void CFrame::ToggleLogWindow(bool bShow) void CFrame::ToggleLogWindow(bool bShow)
{ {
if (!m_LogWindow) if (!m_log_window)
return; return;
GetMenuBar()->FindItem(IDM_LOG_WINDOW)->Check(bShow); GetMenuBar()->FindItem(IDM_LOG_WINDOW)->Check(bShow);
@ -106,25 +106,25 @@ void CFrame::ToggleLogWindow(bool bShow)
if (bShow) if (bShow)
{ {
// Create a new log window if it doesn't exist. // Create a new log window if it doesn't exist.
if (!m_LogWindow) if (!m_log_window)
{ {
m_LogWindow = new CLogWindow(this, IDM_LOG_WINDOW); m_log_window = new CLogWindow(this, IDM_LOG_WINDOW);
} }
m_LogWindow->Enable(); m_log_window->Enable();
DoAddPage(m_LogWindow, g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[0] : 0, DoAddPage(m_log_window, m_code_window ? m_code_window->iNbAffiliation[0] : 0,
g_pCodeWindow ? bFloatWindow[0] : false); m_code_window ? m_float_window[0] : false);
} }
else else
{ {
// Hiding the log window, so disable it and remove it. // Hiding the log window, so disable it and remove it.
m_LogWindow->Disable(); m_log_window->Disable();
DoRemovePage(m_LogWindow, true); DoRemovePage(m_log_window, true);
} }
// Hide or Show the pane // Hide or Show the pane
if (!g_pCodeWindow) if (!m_code_window)
TogglePane(); TogglePane();
} }
@ -134,21 +134,21 @@ void CFrame::ToggleLogConfigWindow(bool bShow)
if (bShow) if (bShow)
{ {
if (!m_LogConfigWindow) if (!m_log_config_window)
m_LogConfigWindow = new LogConfigWindow(this, IDM_LOG_CONFIG_WINDOW); m_log_config_window = new LogConfigWindow(this, IDM_LOG_CONFIG_WINDOW);
const int nbIndex = IDM_LOG_CONFIG_WINDOW - IDM_LOG_WINDOW; const int nbIndex = IDM_LOG_CONFIG_WINDOW - IDM_LOG_WINDOW;
DoAddPage(m_LogConfigWindow, g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0, DoAddPage(m_log_config_window, m_code_window ? m_code_window->iNbAffiliation[nbIndex] : 0,
g_pCodeWindow ? bFloatWindow[nbIndex] : false); m_code_window ? m_float_window[nbIndex] : false);
} }
else else
{ {
DoRemovePage(m_LogConfigWindow, false); DoRemovePage(m_log_config_window, false);
m_LogConfigWindow = nullptr; m_log_config_window = nullptr;
} }
// Hide or Show the pane // Hide or Show the pane
if (!g_pCodeWindow) if (!m_code_window)
TogglePane(); TogglePane();
} }
@ -159,17 +159,17 @@ void CFrame::OnToggleWindow(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_LOG_WINDOW: case IDM_LOG_WINDOW:
if (!g_pCodeWindow) if (!m_code_window)
SConfig::GetInstance().m_InterfaceLogWindow = show; SConfig::GetInstance().m_InterfaceLogWindow = show;
ToggleLogWindow(show); ToggleLogWindow(show);
break; break;
case IDM_LOG_CONFIG_WINDOW: case IDM_LOG_CONFIG_WINDOW:
if (!g_pCodeWindow) if (!m_code_window)
SConfig::GetInstance().m_InterfaceLogConfigWindow = show; SConfig::GetInstance().m_InterfaceLogConfigWindow = show;
ToggleLogConfigWindow(show); ToggleLogConfigWindow(show);
break; break;
default: default:
g_pCodeWindow->TogglePanel(event.GetId(), show); m_code_window->TogglePanel(event.GetId(), show);
} }
} }
@ -180,11 +180,11 @@ void CFrame::ClosePages()
ToggleLogWindow(false); ToggleLogWindow(false);
ToggleLogConfigWindow(false); ToggleLogConfigWindow(false);
if (g_pCodeWindow) if (m_code_window)
{ {
for (int i = IDM_REGISTER_WINDOW; i < IDM_DEBUG_WINDOW_LIST_END; ++i) for (int i = IDM_REGISTER_WINDOW; i < IDM_DEBUG_WINDOW_LIST_END; ++i)
{ {
g_pCodeWindow->TogglePanel(i, false); m_code_window->TogglePanel(i, false);
} }
} }
} }
@ -198,7 +198,7 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
return; return;
} }
if (!g_pCodeWindow) if (!m_code_window)
return; return;
// Remove the blank page if any // Remove the blank page if any
@ -208,7 +208,7 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
for (int i = IDM_LOG_WINDOW; i <= IDM_CODE_WINDOW; i++) for (int i = IDM_LOG_WINDOW; i <= IDM_CODE_WINDOW; i++)
{ {
if (GetNotebookAffiliation(i) >= 0) if (GetNotebookAffiliation(i) >= 0)
g_pCodeWindow->iNbAffiliation[i - IDM_LOG_WINDOW] = GetNotebookAffiliation(i); m_code_window->iNbAffiliation[i - IDM_LOG_WINDOW] = GetNotebookAffiliation(i);
} }
} }
@ -244,7 +244,7 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
if (nb->GetPageText(event.GetSelection()).IsSameAs("<>")) if (nb->GetPageText(event.GetSelection()).IsSameAs("<>"))
break; break;
g_pCodeWindow->TogglePanel(page_id, false); m_code_window->TogglePanel(page_id, false);
} }
} }
@ -266,13 +266,13 @@ void CFrame::ToggleFloatWindow(int Id)
if (GetNotebookPageFromId(WinId)) if (GetNotebookPageFromId(WinId))
{ {
DoFloatNotebookPage(WinId); DoFloatNotebookPage(WinId);
bFloatWindow[WinId - IDM_LOG_WINDOW] = true; m_float_window[WinId - IDM_LOG_WINDOW] = true;
} }
else else
{ {
if (FindWindowById(WinId)) if (FindWindowById(WinId))
DoUnfloatPage(WinId - IDM_LOG_WINDOW + IDM_LOG_WINDOW_PARENT); DoUnfloatPage(WinId - IDM_LOG_WINDOW + IDM_LOG_WINDOW_PARENT);
bFloatWindow[WinId - IDM_LOG_WINDOW] = false; m_float_window[WinId - IDM_LOG_WINDOW] = false;
} }
} }
@ -306,7 +306,7 @@ void CFrame::DoUnfloatPage(int Id)
wxWindow* Child = Win->GetChildren().Item(0)->GetData(); wxWindow* Child = Win->GetChildren().Item(0)->GetData();
Child->Reparent(this); Child->Reparent(this);
DoAddPage(Child, g_pCodeWindow->iNbAffiliation[Child->GetId() - IDM_LOG_WINDOW], false); DoAddPage(Child, m_code_window->iNbAffiliation[Child->GetId() - IDM_LOG_WINDOW], false);
Win->Destroy(); Win->Destroy();
} }
@ -319,7 +319,7 @@ void CFrame::OnNotebookTabRightUp(wxAuiNotebookEvent& event)
return; return;
} }
if (!g_pCodeWindow) if (!m_code_window)
return; return;
// Create the popup menu // Create the popup menu
@ -363,36 +363,36 @@ void CFrame::OnNotebookAllowDnD(wxAuiNotebookEvent& event)
} }
// Since the destination is one of our own notebooks, make sure the source is as well. // Since the destination is one of our own notebooks, make sure the source is as well.
// If the source is some other panel, leave the event in the default reject state. // If the source is some other panel, leave the event in the default reject state.
if (m_Mgr->GetPane(event.GetDragSource()).window) if (m_mgr->GetPane(event.GetDragSource()).window)
event.Allow(); event.Allow();
} }
void CFrame::ShowResizePane() void CFrame::ShowResizePane()
{ {
if (!m_LogWindow) if (!m_log_window)
return; return;
// Make sure the size is sane // Make sure the size is sane
if (m_LogWindow->x > GetClientRect().GetWidth()) if (m_log_window->x > GetClientRect().GetWidth())
m_LogWindow->x = GetClientRect().GetWidth() / 2; m_log_window->x = GetClientRect().GetWidth() / 2;
if (m_LogWindow->y > GetClientRect().GetHeight()) if (m_log_window->y > GetClientRect().GetHeight())
m_LogWindow->y = GetClientRect().GetHeight() / 2; m_log_window->y = GetClientRect().GetHeight() / 2;
wxAuiPaneInfo& pane = m_Mgr->GetPane("Pane 1"); wxAuiPaneInfo& pane = m_mgr->GetPane("Pane 1");
// Hide first otherwise a resize doesn't work // Hide first otherwise a resize doesn't work
pane.Hide(); pane.Hide();
m_Mgr->Update(); m_mgr->Update();
pane.BestSize(m_LogWindow->x, m_LogWindow->y) pane.BestSize(m_log_window->x, m_log_window->y)
.MinSize(m_LogWindow->x, m_LogWindow->y) .MinSize(m_log_window->x, m_log_window->y)
.Direction(m_LogWindow->winpos) .Direction(m_log_window->winpos)
.Show(); .Show();
m_Mgr->Update(); m_mgr->Update();
// Reset the minimum size of the pane // Reset the minimum size of the pane
pane.MinSize(-1, -1); pane.MinSize(-1, -1);
m_Mgr->Update(); m_mgr->Update();
} }
void CFrame::TogglePane() void CFrame::TogglePane()
@ -404,8 +404,8 @@ void CFrame::TogglePane()
{ {
if (NB->GetPageCount() == 0) if (NB->GetPageCount() == 0)
{ {
m_Mgr->GetPane("Pane 1").Hide(); m_mgr->GetPane("Pane 1").Hide();
m_Mgr->Update(); m_mgr->Update();
} }
else else
{ {
@ -457,7 +457,7 @@ void CFrame::DoRemovePage(wxWindow* Win, bool bHide)
} }
} }
if (g_pCodeWindow) if (m_code_window)
AddRemoveBlankPage(); AddRemoveBlankPage();
} }
@ -486,14 +486,14 @@ void CFrame::DoAddPage(wxWindow* Win, int i, bool Float)
void CFrame::PopulateSavedPerspectives() void CFrame::PopulateSavedPerspectives()
{ {
std::vector<std::string> perspective_names(Perspectives.size()); std::vector<std::string> perspective_names(m_perspectives.size());
std::transform(Perspectives.begin(), Perspectives.end(), perspective_names.begin(), std::transform(m_perspectives.begin(), m_perspectives.end(), perspective_names.begin(),
[](const auto& perspective) { return perspective.Name; }); [](const auto& perspective) { return perspective.name; });
MainMenuBar::PopulatePerspectivesEvent event{GetId(), EVT_POPULATE_PERSPECTIVES_MENU, MainMenuBar::PopulatePerspectivesEvent event{GetId(), EVT_POPULATE_PERSPECTIVES_MENU,
std::move(perspective_names), std::move(perspective_names),
static_cast<int>(ActivePerspective)}; static_cast<int>(m_active_perspective)};
wxPostEvent(GetMenuBar(), event); wxPostEvent(GetMenuBar(), event);
} }
@ -505,14 +505,14 @@ void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_SAVE_PERSPECTIVE: case IDM_SAVE_PERSPECTIVE:
if (Perspectives.size() == 0) if (m_perspectives.size() == 0)
{ {
wxMessageBox(_("Please create a perspective before saving"), _("Notice"), wxOK, this); wxMessageBox(_("Please create a perspective before saving"), _("Notice"), wxOK, this);
return; return;
} }
SaveIniPerspectives(); SaveIniPerspectives();
GetStatusBar()->SetStatusText( GetStatusBar()->SetStatusText(
StrToWxStr(std::string("Saved " + Perspectives[ActivePerspective].Name)), 0); StrToWxStr(std::string("Saved " + m_perspectives[m_active_perspective].name)), 0);
break; break;
case IDM_PERSPECTIVES_ADD_PANE_TOP: case IDM_PERSPECTIVES_ADD_PANE_TOP:
AddPane(ADD_PANE_TOP); AddPane(ADD_PANE_TOP);
@ -530,14 +530,14 @@ void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
AddPane(ADD_PANE_CENTER); AddPane(ADD_PANE_CENTER);
break; break;
case IDM_EDIT_PERSPECTIVES: case IDM_EDIT_PERSPECTIVES:
m_bEdit = event.IsChecked(); m_editing_perspectives = event.IsChecked();
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES); TogglePaneStyle(m_editing_perspectives, IDM_EDIT_PERSPECTIVES);
break; break;
case IDM_ADD_PERSPECTIVE: case IDM_ADD_PERSPECTIVE:
{ {
wxTextEntryDialog dlg(this, _("Enter a name for the new perspective:"), wxTextEntryDialog dlg(this, _("Enter a name for the new perspective:"),
_("Create new perspective")); _("Create new perspective"));
wxString DefaultValue = wxString::Format(_("Perspective %d"), (int)(Perspectives.size() + 1)); wxString DefaultValue = wxString::Format(_("Perspective %d"), (int)(m_perspectives.size() + 1));
dlg.SetValue(DefaultValue); dlg.SetValue(DefaultValue);
int Return = 0; int Return = 0;
@ -569,30 +569,30 @@ void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
} }
SPerspectives Tmp; SPerspectives Tmp;
Tmp.Name = WxStrToStr(dlg.GetValue()); Tmp.name = WxStrToStr(dlg.GetValue());
Tmp.Perspective = m_Mgr->SavePerspective(); Tmp.perspective = m_mgr->SavePerspective();
ActivePerspective = (u32)Perspectives.size(); m_active_perspective = (u32)m_perspectives.size();
Perspectives.push_back(Tmp); m_perspectives.push_back(Tmp);
UpdateCurrentPerspective(); UpdateCurrentPerspective();
PopulateSavedPerspectives(); PopulateSavedPerspectives();
} }
break; break;
case IDM_TAB_SPLIT: case IDM_TAB_SPLIT:
m_bTabSplit = event.IsChecked(); m_is_split_tab_notebook = event.IsChecked();
ToggleNotebookStyle(m_bTabSplit, wxAUI_NB_TAB_SPLIT); ToggleNotebookStyle(m_is_split_tab_notebook, wxAUI_NB_TAB_SPLIT);
break; break;
case IDM_NO_DOCKING: case IDM_NO_DOCKING:
m_bNoDocking = event.IsChecked(); m_no_panel_docking = event.IsChecked();
TogglePaneStyle(m_bNoDocking, IDM_NO_DOCKING); TogglePaneStyle(m_no_panel_docking, IDM_NO_DOCKING);
break; break;
} }
} }
void CFrame::TogglePaneStyle(bool On, int EventId) void CFrame::TogglePaneStyle(bool On, int EventId)
{ {
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray& AllPanes = m_mgr->GetAllPanes();
for (u32 i = 0; i < AllPanes.GetCount(); ++i) for (u32 i = 0; i < AllPanes.GetCount(); ++i)
{ {
wxAuiPaneInfo& Pane = AllPanes[i]; wxAuiPaneInfo& Pane = AllPanes[i];
@ -614,16 +614,16 @@ void CFrame::TogglePaneStyle(bool On, int EventId)
Pane.Dockable(On); Pane.Dockable(On);
break; break;
} }
Pane.Dockable(!m_bNoDocking); Pane.Dockable(!m_no_panel_docking);
} }
} }
m_Mgr->GetArtProvider()->SetFont(wxAUI_DOCKART_CAPTION_FONT, DebuggerFont); m_mgr->GetArtProvider()->SetFont(wxAUI_DOCKART_CAPTION_FONT, DebuggerFont);
m_Mgr->Update(); m_mgr->Update();
} }
void CFrame::ToggleNotebookStyle(bool On, long Style) void CFrame::ToggleNotebookStyle(bool On, long Style)
{ {
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray& AllPanes = m_mgr->GetAllPanes();
for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i) for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
{ {
wxAuiPaneInfo& Pane = AllPanes[i]; wxAuiPaneInfo& Pane = AllPanes[i];
@ -644,33 +644,35 @@ void CFrame::ToggleNotebookStyle(bool On, long Style)
void CFrame::OnSelectPerspective(wxCommandEvent& event) void CFrame::OnSelectPerspective(wxCommandEvent& event)
{ {
u32 _Selection = event.GetId() - IDM_PERSPECTIVES_0; u32 _Selection = event.GetId() - IDM_PERSPECTIVES_0;
if (Perspectives.size() <= _Selection) if (m_perspectives.size() <= _Selection)
_Selection = 0; _Selection = 0;
ActivePerspective = _Selection; m_active_perspective = _Selection;
DoLoadPerspective(); DoLoadPerspective();
} }
void CFrame::SetPaneSize() void CFrame::SetPaneSize()
{ {
if (Perspectives.size() <= ActivePerspective) if (m_perspectives.size() <= m_active_perspective)
return; return;
wxSize client_size = GetClientSize(); wxSize client_size = GetClientSize();
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
if (!m_Mgr->GetAllPanes()[i].IsOk()) if (!m_mgr->GetAllPanes()[i].IsOk())
return; return;
if (Perspectives[ActivePerspective].Width.size() <= j || if (m_perspectives[m_active_perspective].width.size() <= j ||
Perspectives[ActivePerspective].Height.size() <= j) m_perspectives[m_active_perspective].height.size() <= j)
{
continue; continue;
}
// Width and height of the active perspective // Width and height of the active perspective
u32 W = Perspectives[ActivePerspective].Width[j], u32 W = m_perspectives[m_active_perspective].width[j];
H = Perspectives[ActivePerspective].Height[j]; u32 H = m_perspectives[m_active_perspective].height[j];
// Check limits // Check limits
W = MathUtil::Clamp<u32>(W, 5, 95); W = MathUtil::Clamp<u32>(W, 5, 95);
@ -679,18 +681,18 @@ void CFrame::SetPaneSize()
// Convert percentages to pixel lengths // Convert percentages to pixel lengths
W = (W * client_size.GetWidth()) / 100; W = (W * client_size.GetWidth()) / 100;
H = (H * client_size.GetHeight()) / 100; H = (H * client_size.GetHeight()) / 100;
m_Mgr->GetAllPanes()[i].BestSize(W, H).MinSize(W, H); m_mgr->GetAllPanes()[i].BestSize(W, H).MinSize(W, H);
j++; j++;
} }
} }
m_Mgr->Update(); m_mgr->Update();
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
m_Mgr->GetAllPanes()[i].MinSize(-1, -1); m_mgr->GetAllPanes()[i].MinSize(-1, -1);
} }
} }
} }
@ -703,29 +705,29 @@ void CFrame::ReloadPanes()
CloseAllNotebooks(); CloseAllNotebooks();
// Create new panes with notebooks // Create new panes with notebooks
for (u32 i = 0; i < Perspectives[ActivePerspective].Width.size() - 1; i++) for (u32 i = 0; i < m_perspectives[m_active_perspective].width.size() - 1; i++)
{ {
wxString PaneName = wxString::Format("Pane %i", i + 1); wxString PaneName = wxString::Format("Pane %i", i + 1);
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo() m_mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
.Hide() .Hide()
.CaptionVisible(m_bEdit) .CaptionVisible(m_editing_perspectives)
.Dockable(!m_bNoDocking) .Dockable(!m_no_panel_docking)
.Position(i) .Position(i)
.Name(PaneName) .Name(PaneName)
.Caption(PaneName)); .Caption(PaneName));
} }
// Perspectives // Perspectives
m_Mgr->LoadPerspective(Perspectives[ActivePerspective].Perspective, false); m_mgr->LoadPerspective(m_perspectives[m_active_perspective].perspective, false);
// Restore settings // Restore settings
TogglePaneStyle(m_bNoDocking, IDM_NO_DOCKING); TogglePaneStyle(m_no_panel_docking, IDM_NO_DOCKING);
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES); TogglePaneStyle(m_editing_perspectives, IDM_EDIT_PERSPECTIVES);
// Load GUI settings // Load GUI settings
g_pCodeWindow->Load(); m_code_window->Load();
// Open notebook pages // Open notebook pages
AddRemoveBlankPage(); AddRemoveBlankPage();
g_pCodeWindow->OpenPages(); m_code_window->OpenPages();
// Repopulate perspectives // Repopulate perspectives
PopulateSavedPerspectives(); PopulateSavedPerspectives();
@ -737,13 +739,13 @@ void CFrame::DoLoadPerspective()
// Restore the exact window sizes, which LoadPerspective doesn't always do // Restore the exact window sizes, which LoadPerspective doesn't always do
SetPaneSize(); SetPaneSize();
m_Mgr->Update(); m_mgr->Update();
} }
// Update the local perspectives array // Update the local perspectives array
void CFrame::LoadIniPerspectives() void CFrame::LoadIniPerspectives()
{ {
Perspectives.clear(); m_perspectives.clear();
std::vector<std::string> VPerspectives; std::vector<std::string> VPerspectives;
std::string _Perspectives; std::string _Perspectives;
@ -752,7 +754,7 @@ void CFrame::LoadIniPerspectives()
IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives"); IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives");
perspectives->Get("Perspectives", &_Perspectives, "Perspective 1"); perspectives->Get("Perspectives", &_Perspectives, "Perspective 1");
perspectives->Get("Active", &ActivePerspective, 0); perspectives->Get("Active", &m_active_perspective, 0);
SplitString(_Perspectives, ',', VPerspectives); SplitString(_Perspectives, ',', VPerspectives);
for (auto& VPerspective : VPerspectives) for (auto& VPerspective : VPerspectives)
@ -760,15 +762,15 @@ void CFrame::LoadIniPerspectives()
SPerspectives Tmp; SPerspectives Tmp;
std::string _Section, _Perspective, _Widths, _Heights; std::string _Section, _Perspective, _Widths, _Heights;
std::vector<std::string> _SWidth, _SHeight; std::vector<std::string> _SWidth, _SHeight;
Tmp.Name = VPerspective; Tmp.name = VPerspective;
// Don't save a blank perspective // Don't save a blank perspective
if (Tmp.Name.empty()) if (Tmp.name.empty())
{ {
continue; continue;
} }
_Section = StringFromFormat("P - %s", Tmp.Name.c_str()); _Section = StringFromFormat("P - %s", Tmp.name.c_str());
IniFile::Section* perspec_section = ini.GetOrCreateSection(_Section); IniFile::Section* perspec_section = ini.GetOrCreateSection(_Section);
perspec_section->Get("Perspective", &_Perspective, perspec_section->Get("Perspective", &_Perspective,
@ -779,7 +781,7 @@ void CFrame::LoadIniPerspectives()
perspec_section->Get("Width", &_Widths, "70,25"); perspec_section->Get("Width", &_Widths, "70,25");
perspec_section->Get("Height", &_Heights, "80,80"); perspec_section->Get("Height", &_Heights, "80,80");
Tmp.Perspective = StrToWxStr(_Perspective); Tmp.perspective = StrToWxStr(_Perspective);
SplitString(_Widths, ',', _SWidth); SplitString(_Widths, ',', _SWidth);
SplitString(_Heights, ',', _SHeight); SplitString(_Heights, ',', _SHeight);
@ -787,35 +789,35 @@ void CFrame::LoadIniPerspectives()
{ {
int _Tmp; int _Tmp;
if (TryParse(Width, &_Tmp)) if (TryParse(Width, &_Tmp))
Tmp.Width.push_back(_Tmp); Tmp.width.push_back(_Tmp);
} }
for (auto& Height : _SHeight) for (auto& Height : _SHeight)
{ {
int _Tmp; int _Tmp;
if (TryParse(Height, &_Tmp)) if (TryParse(Height, &_Tmp))
Tmp.Height.push_back(_Tmp); Tmp.height.push_back(_Tmp);
} }
Perspectives.push_back(Tmp); m_perspectives.push_back(Tmp);
} }
} }
void CFrame::UpdateCurrentPerspective() void CFrame::UpdateCurrentPerspective()
{ {
SPerspectives* current = &Perspectives[ActivePerspective]; SPerspectives* current = &m_perspectives[m_active_perspective];
current->Perspective = m_Mgr->SavePerspective(); current->perspective = m_mgr->SavePerspective();
// Get client size // Get client size
wxSize client_size = GetClientSize(); wxSize client_size = GetClientSize();
current->Width.clear(); current->width.clear();
current->Height.clear(); current->height.clear();
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
// Save width and height as a percentage of the client width and height // Save width and height as a percentage of the client width and height
current->Width.push_back((m_Mgr->GetAllPanes()[i].window->GetSize().GetX() * 100) / current->width.push_back((m_mgr->GetAllPanes()[i].window->GetSize().GetX() * 100) /
client_size.GetWidth()); client_size.GetWidth());
current->Height.push_back((m_Mgr->GetAllPanes()[i].window->GetSize().GetY() * 100) / current->height.push_back((m_mgr->GetAllPanes()[i].window->GetSize().GetY() * 100) /
client_size.GetHeight()); client_size.GetHeight());
} }
} }
@ -823,10 +825,10 @@ void CFrame::UpdateCurrentPerspective()
void CFrame::SaveIniPerspectives() void CFrame::SaveIniPerspectives()
{ {
if (Perspectives.size() == 0) if (m_perspectives.size() == 0)
return; return;
if (ActivePerspective >= Perspectives.size()) if (m_active_perspective >= m_perspectives.size())
ActivePerspective = 0; m_active_perspective = 0;
// Turn off edit before saving // Turn off edit before saving
TogglePaneStyle(false, IDM_EDIT_PERSPECTIVES); TogglePaneStyle(false, IDM_EDIT_PERSPECTIVES);
@ -838,28 +840,28 @@ void CFrame::SaveIniPerspectives()
// Save perspective names // Save perspective names
std::string STmp = ""; std::string STmp = "";
for (auto& Perspective : Perspectives) for (auto& Perspective : m_perspectives)
{ {
STmp += Perspective.Name + ","; STmp += Perspective.name + ",";
} }
STmp = STmp.substr(0, STmp.length() - 1); STmp = STmp.substr(0, STmp.length() - 1);
IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives"); IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives");
perspectives->Set("Perspectives", STmp); perspectives->Set("Perspectives", STmp);
perspectives->Set("Active", ActivePerspective); perspectives->Set("Active", m_active_perspective);
// Save the perspectives // Save the perspectives
for (auto& Perspective : Perspectives) for (auto& Perspective : m_perspectives)
{ {
std::string _Section = "P - " + Perspective.Name; std::string _Section = "P - " + Perspective.name;
IniFile::Section* perspec_section = ini.GetOrCreateSection(_Section); IniFile::Section* perspec_section = ini.GetOrCreateSection(_Section);
perspec_section->Set("Perspective", WxStrToStr(Perspective.Perspective)); perspec_section->Set("Perspective", WxStrToStr(Perspective.perspective));
std::string SWidth = "", SHeight = ""; std::string SWidth = "", SHeight = "";
for (u32 j = 0; j < Perspective.Width.size(); j++) for (u32 j = 0; j < Perspective.width.size(); j++)
{ {
SWidth += StringFromFormat("%i,", Perspective.Width[j]); SWidth += StringFromFormat("%i,", Perspective.width[j]);
SHeight += StringFromFormat("%i,", Perspective.Height[j]); SHeight += StringFromFormat("%i,", Perspective.height[j]);
} }
// Remove the ending "," // Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length() - 1); SWidth = SWidth.substr(0, SWidth.length() - 1);
@ -872,9 +874,9 @@ void CFrame::SaveIniPerspectives()
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// Save notebook affiliations // Save notebook affiliations
g_pCodeWindow->Save(); m_code_window->Save();
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES); TogglePaneStyle(m_editing_perspectives, IDM_EDIT_PERSPECTIVES);
} }
void CFrame::AddPane(int dir) void CFrame::AddPane(int dir)
@ -882,8 +884,8 @@ void CFrame::AddPane(int dir)
int PaneNum = GetNotebookCount() + 1; int PaneNum = GetNotebookCount() + 1;
wxString PaneName = wxString::Format("Pane %i", PaneNum); wxString PaneName = wxString::Format("Pane %i", PaneNum);
wxAuiPaneInfo PaneInfo = wxAuiPaneInfo() wxAuiPaneInfo PaneInfo = wxAuiPaneInfo()
.CaptionVisible(m_bEdit) .CaptionVisible(m_editing_perspectives)
.Dockable(!m_bNoDocking) .Dockable(!m_no_panel_docking)
.Name(PaneName) .Name(PaneName)
.Caption(PaneName) .Caption(PaneName)
.Position(GetNotebookCount()); .Position(GetNotebookCount());
@ -909,20 +911,20 @@ void CFrame::AddPane(int dir)
break; break;
} }
m_Mgr->AddPane(CreateEmptyNotebook(), PaneInfo); m_mgr->AddPane(CreateEmptyNotebook(), PaneInfo);
AddRemoveBlankPage(); AddRemoveBlankPage();
m_Mgr->Update(); m_mgr->Update();
} }
wxWindow* CFrame::GetNotebookPageFromId(wxWindowID Id) wxWindow* CFrame::GetNotebookPageFromId(wxWindowID Id)
{ {
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook* NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook* NB = (wxAuiNotebook*)m_mgr->GetAllPanes()[i].window;
for (u32 j = 0; j < NB->GetPageCount(); j++) for (u32 j = 0; j < NB->GetPageCount(); j++)
{ {
if (NB->GetPage(j)->GetId() == Id) if (NB->GetPage(j)->GetId() == Id)
@ -980,12 +982,12 @@ wxAuiNotebook* CFrame::CreateEmptyNotebook()
void CFrame::AddRemoveBlankPage() void CFrame::AddRemoveBlankPage()
{ {
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook* NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook* NB = (wxAuiNotebook*)m_mgr->GetAllPanes()[i].window;
for (u32 j = 0; j < NB->GetPageCount(); j++) for (u32 j = 0; j < NB->GetPageCount(); j++)
{ {
if (NB->GetPageText(j).IsSameAs("<>") && NB->GetPageCount() > 1) if (NB->GetPageText(j).IsSameAs("<>") && NB->GetPageCount() > 1)
@ -999,12 +1001,12 @@ void CFrame::AddRemoveBlankPage()
int CFrame::GetNotebookAffiliation(wxWindowID Id) int CFrame::GetNotebookAffiliation(wxWindowID Id)
{ {
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook* NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook* NB = (wxAuiNotebook*)m_mgr->GetAllPanes()[i].window;
for (u32 k = 0; k < NB->GetPageCount(); k++) for (u32 k = 0; k < NB->GetPageCount(); k++)
{ {
if (NB->GetPage(k)->GetId() == Id) if (NB->GetPage(k)->GetId() == Id)
@ -1018,13 +1020,13 @@ int CFrame::GetNotebookAffiliation(wxWindowID Id)
// Close all panes with notebooks // Close all panes with notebooks
void CFrame::CloseAllNotebooks() void CFrame::CloseAllNotebooks()
{ {
wxAuiPaneInfoArray AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray AllPanes = m_mgr->GetAllPanes();
for (u32 i = 0; i < AllPanes.GetCount(); i++) for (u32 i = 0; i < AllPanes.GetCount(); i++)
{ {
if (AllPanes[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (AllPanes[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{ {
AllPanes[i].DestroyOnClose(true); AllPanes[i].DestroyOnClose(true);
m_Mgr->ClosePane(AllPanes[i]); m_mgr->ClosePane(AllPanes[i]);
} }
} }
} }
@ -1032,9 +1034,9 @@ void CFrame::CloseAllNotebooks()
int CFrame::GetNotebookCount() int CFrame::GetNotebookCount()
{ {
int Ret = 0; int Ret = 0;
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
Ret++; Ret++;
} }
return Ret; return Ret;
@ -1042,12 +1044,12 @@ int CFrame::GetNotebookCount()
wxAuiNotebook* CFrame::GetNotebookFromId(u32 NBId) wxAuiNotebook* CFrame::GetNotebookFromId(u32 NBId)
{ {
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
if (j == NBId) if (j == NBId)
return (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; return (wxAuiNotebook*)m_mgr->GetAllPanes()[i].window;
j++; j++;
} }
return nullptr; return nullptr;

View File

@ -107,7 +107,7 @@ wxMenuBar* CFrame::GetMenuBar() const
wxMenuBar* CFrame::CreateMenuBar() const wxMenuBar* CFrame::CreateMenuBar() const
{ {
const auto menu_type = const auto menu_type =
UseDebugger ? MainMenuBar::MenuType::Debug : MainMenuBar::MenuType::Regular; m_use_debugger ? MainMenuBar::MenuType::Debug : MainMenuBar::MenuType::Regular;
return new MainMenuBar{menu_type}; return new MainMenuBar{menu_type};
} }
@ -189,7 +189,7 @@ void CFrame::BindMenuBarEvents()
Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_GITHUB); Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_GITHUB);
Bind(wxEVT_MENU, &CFrame::OnHelp, this, wxID_ABOUT); Bind(wxEVT_MENU, &CFrame::OnHelp, this, wxID_ABOUT);
if (UseDebugger) if (m_use_debugger)
BindDebuggerMenuBarEvents(); BindDebuggerMenuBarEvents();
} }
@ -257,7 +257,7 @@ void CFrame::BindDebuggerMenuBarUpdateEvents()
wxToolBar* CFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name) wxToolBar* CFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
{ {
const auto type = const auto type =
UseDebugger ? MainToolBar::ToolBarType::Debug : MainToolBar::ToolBarType::Regular; m_use_debugger ? MainToolBar::ToolBarType::Debug : MainToolBar::ToolBarType::Regular;
return new MainToolBar{type, this, id, wxDefaultPosition, wxDefaultSize, style}; return new MainToolBar{type, this, id, wxDefaultPosition, wxDefaultSize, style};
} }
@ -293,10 +293,10 @@ void CFrame::BootGame(const std::string& filename)
// If all that fails, ask to add a dir and don't boot // If all that fails, ask to add a dir and don't boot
if (bootfile.empty()) if (bootfile.empty())
{ {
if (m_GameListCtrl->GetSelectedISO() != nullptr) if (m_game_list_ctrl->GetSelectedISO() != nullptr)
{ {
if (m_GameListCtrl->GetSelectedISO()->IsValid()) if (m_game_list_ctrl->GetSelectedISO()->IsValid())
bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName(); bootfile = m_game_list_ctrl->GetSelectedISO()->GetFileName();
} }
else if (!StartUp.m_strDefaultISO.empty() && File::Exists(StartUp.m_strDefaultISO)) else if (!StartUp.m_strDefaultISO.empty() && File::Exists(StartUp.m_strDefaultISO))
{ {
@ -311,7 +311,7 @@ void CFrame::BootGame(const std::string& filename)
} }
else else
{ {
m_GameListCtrl->BrowseForDirectory(); m_game_list_ctrl->BrowseForDirectory();
return; return;
} }
} }
@ -527,7 +527,7 @@ void CFrame::OnPlay(wxCommandEvent& event)
if (Core::IsRunning()) if (Core::IsRunning())
{ {
// Core is initialized and emulator is running // Core is initialized and emulator is running
if (UseDebugger) if (m_use_debugger)
{ {
bool was_stopped = CPU::IsStepping(); bool was_stopped = CPU::IsStepping();
CPU::EnableStepping(!was_stopped); CPU::EnableStepping(!was_stopped);
@ -535,7 +535,7 @@ void CFrame::OnPlay(wxCommandEvent& event)
// the UI, the UI only needs to be refreshed manually when unpausing. // the UI, the UI only needs to be refreshed manually when unpausing.
if (was_stopped) if (was_stopped)
{ {
g_pCodeWindow->Repopulate(); m_code_window->Repopulate();
UpdateGUI(); UpdateGUI();
} }
} }
@ -571,10 +571,10 @@ void CFrame::OnRenderParentClose(wxCloseEvent& event)
void CFrame::OnRenderParentMove(wxMoveEvent& event) void CFrame::OnRenderParentMove(wxMoveEvent& event)
{ {
if (Core::GetState() != Core::State::Uninitialized && !RendererIsFullscreen() && if (Core::GetState() != Core::State::Uninitialized && !RendererIsFullscreen() &&
!m_RenderFrame->IsMaximized() && !m_RenderFrame->IsIconized()) !m_render_frame->IsMaximized() && !m_render_frame->IsIconized())
{ {
SConfig::GetInstance().iRenderWindowXPos = m_RenderFrame->GetPosition().x; SConfig::GetInstance().iRenderWindowXPos = m_render_frame->GetPosition().x;
SConfig::GetInstance().iRenderWindowYPos = m_RenderFrame->GetPosition().y; SConfig::GetInstance().iRenderWindowYPos = m_render_frame->GetPosition().y;
} }
event.Skip(); event.Skip();
} }
@ -585,14 +585,14 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
{ {
int width, height; int width, height;
if (!SConfig::GetInstance().bRenderToMain && !RendererIsFullscreen() && if (!SConfig::GetInstance().bRenderToMain && !RendererIsFullscreen() &&
!m_RenderFrame->IsMaximized() && !m_RenderFrame->IsIconized()) !m_render_frame->IsMaximized() && !m_render_frame->IsIconized())
{ {
m_RenderFrame->GetClientSize(&width, &height); m_render_frame->GetClientSize(&width, &height);
SConfig::GetInstance().iRenderWindowWidth = width; SConfig::GetInstance().iRenderWindowWidth = width;
SConfig::GetInstance().iRenderWindowHeight = height; SConfig::GetInstance().iRenderWindowHeight = height;
} }
m_LogWindow->Refresh(); m_log_window->Refresh();
m_LogWindow->Update(); m_log_window->Update();
// We call Renderer::ChangeSurface here to indicate the size has changed, // We call Renderer::ChangeSurface here to indicate the size has changed,
// but pass the same window handle. This is needed for the Vulkan backend, // but pass the same window handle. This is needed for the Vulkan backend,
@ -626,16 +626,16 @@ void CFrame::ToggleDisplayMode(bool bFullscreen)
} }
#elif defined(HAVE_XRANDR) && HAVE_XRANDR #elif defined(HAVE_XRANDR) && HAVE_XRANDR
if (SConfig::GetInstance().strFullscreenResolution != "Auto") if (SConfig::GetInstance().strFullscreenResolution != "Auto")
m_XRRConfig->ToggleDisplayMode(bFullscreen); m_xrr_config->ToggleDisplayMode(bFullscreen);
#endif #endif
} }
// Prepare the GUI to start the game. // Prepare the GUI to start the game.
void CFrame::StartGame(const std::string& filename) void CFrame::StartGame(const std::string& filename)
{ {
if (m_bGameLoading) if (m_is_game_loading)
return; return;
m_bGameLoading = true; m_is_game_loading = true;
GetToolBar()->EnableTool(IDM_PLAY, false); GetToolBar()->EnableTool(IDM_PLAY, false);
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false); GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
@ -643,21 +643,21 @@ void CFrame::StartGame(const std::string& filename)
if (SConfig::GetInstance().bRenderToMain) if (SConfig::GetInstance().bRenderToMain)
{ {
// Game has been started, hide the game list // Game has been started, hide the game list
m_GameListCtrl->Disable(); m_game_list_ctrl->Disable();
m_GameListCtrl->Hide(); m_game_list_ctrl->Hide();
m_RenderParent = m_Panel; m_render_parent = m_panel;
m_RenderFrame = this; m_render_frame = this;
if (SConfig::GetInstance().bKeepWindowOnTop) if (SConfig::GetInstance().bKeepWindowOnTop)
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() | wxSTAY_ON_TOP); m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() | wxSTAY_ON_TOP);
else else
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
// No, I really don't want TAB_TRAVERSAL being set behind my back, // No, I really don't want TAB_TRAVERSAL being set behind my back,
// thanks. (Note that calling DisableSelfFocus would prevent this flag // thanks. (Note that calling DisableSelfFocus would prevent this flag
// from being set for new children, but wouldn't reset the existing // from being set for new children, but wouldn't reset the existing
// flag.) // flag.)
m_RenderParent->SetWindowStyle(m_RenderParent->GetWindowStyle() & ~wxTAB_TRAVERSAL); m_render_parent->SetWindowStyle(m_render_parent->GetWindowStyle() & ~wxTAB_TRAVERSAL);
} }
else else
{ {
@ -667,40 +667,40 @@ void CFrame::StartGame(const std::string& filename)
// Set window size in framebuffer pixels since the 3D rendering will be operating at // Set window size in framebuffer pixels since the 3D rendering will be operating at
// that level. // that level.
wxSize default_size{wxSize(640, 480) * (1.0 / GetContentScaleFactor())}; wxSize default_size{wxSize(640, 480) * (1.0 / GetContentScaleFactor())};
m_RenderFrame = m_render_frame =
new CRenderFrame(nullptr, wxID_ANY, _("Dolphin"), wxDefaultPosition, default_size); new CRenderFrame(nullptr, wxID_ANY, _("Dolphin"), wxDefaultPosition, default_size);
// Convert ClientSize coordinates to frame sizes. // Convert ClientSize coordinates to frame sizes.
wxSize decoration_fudge = m_RenderFrame->GetSize() - m_RenderFrame->GetClientSize(); wxSize decoration_fudge = m_render_frame->GetSize() - m_render_frame->GetClientSize();
default_size += decoration_fudge; default_size += decoration_fudge;
if (!window_geometry.IsEmpty()) if (!window_geometry.IsEmpty())
window_geometry.SetSize(window_geometry.GetSize() + decoration_fudge); window_geometry.SetSize(window_geometry.GetSize() + decoration_fudge);
WxUtils::SetWindowSizeAndFitToScreen(m_RenderFrame, window_geometry.GetPosition(), WxUtils::SetWindowSizeAndFitToScreen(m_render_frame, window_geometry.GetPosition(),
window_geometry.GetSize(), default_size); window_geometry.GetSize(), default_size);
if (SConfig::GetInstance().bKeepWindowOnTop) if (SConfig::GetInstance().bKeepWindowOnTop)
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() | wxSTAY_ON_TOP); m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() | wxSTAY_ON_TOP);
else else
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
m_RenderFrame->SetBackgroundColour(*wxBLACK); m_render_frame->SetBackgroundColour(*wxBLACK);
m_RenderFrame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this); m_render_frame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this);
m_RenderFrame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this); m_render_frame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this);
m_RenderFrame->Bind(wxEVT_MOVE, &CFrame::OnRenderParentMove, this); m_render_frame->Bind(wxEVT_MOVE, &CFrame::OnRenderParentMove, this);
#ifdef _WIN32 #ifdef _WIN32
// The renderer should use a top-level window for exclusive fullscreen support. // The renderer should use a top-level window for exclusive fullscreen support.
m_RenderParent = m_RenderFrame; m_render_parent = m_render_frame;
#else #else
// To capture key events on Linux and Mac OS X the frame needs at least one child. // To capture key events on Linux and Mac OS X the frame needs at least one child.
m_RenderParent = new wxPanel(m_RenderFrame, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0); m_render_parent = new wxPanel(m_render_frame, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0);
#endif #endif
m_RenderFrame->Show(); m_render_frame->Show();
} }
#if defined(__APPLE__) #if defined(__APPLE__)
m_RenderFrame->EnableFullScreenView(true); m_render_frame->EnableFullScreenView(true);
#endif #endif
wxBusyCursor hourglass; wxBusyCursor hourglass;
@ -710,12 +710,14 @@ void CFrame::StartGame(const std::string& filename)
if (!BootManager::BootCore(filename)) if (!BootManager::BootCore(filename))
{ {
DoFullscreen(false); DoFullscreen(false);
// Destroy the renderer frame when not rendering to main // Destroy the renderer frame when not rendering to main
if (!SConfig::GetInstance().bRenderToMain) if (!SConfig::GetInstance().bRenderToMain)
m_RenderFrame->Destroy(); m_render_frame->Destroy();
m_RenderFrame = nullptr;
m_RenderParent = nullptr; m_render_frame = nullptr;
m_bGameLoading = false; m_render_parent = nullptr;
m_is_game_loading = false;
UpdateGUI(); UpdateGUI();
} }
else else
@ -735,13 +737,13 @@ void CFrame::StartGame(const std::string& filename)
// We need this specifically to support setting the focus properly when using // We need this specifically to support setting the focus properly when using
// the 'render to main window' feature on Windows // the 'render to main window' feature on Windows
if (auto panel = wxDynamicCast(m_RenderParent, wxPanel)) if (auto panel = wxDynamicCast(m_render_parent, wxPanel))
{ {
panel->SetFocusIgnoringChildren(); panel->SetFocusIgnoringChildren();
} }
else else
{ {
m_RenderParent->SetFocus(); m_render_parent->SetFocus();
} }
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this); wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
@ -750,7 +752,7 @@ void CFrame::StartGame(const std::string& filename)
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this); m_render_parent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
} }
} }
@ -777,14 +779,14 @@ void CFrame::DoPause()
{ {
Core::SetState(Core::State::Paused); Core::SetState(Core::State::Paused);
if (SConfig::GetInstance().bHideCursor) if (SConfig::GetInstance().bHideCursor)
m_RenderParent->SetCursor(wxNullCursor); m_render_parent->SetCursor(wxNullCursor);
Core::UpdateTitle(); Core::UpdateTitle();
} }
else else
{ {
Core::SetState(Core::State::Running); Core::SetState(Core::State::Running);
if (SConfig::GetInstance().bHideCursor && RendererHasFocus()) if (SConfig::GetInstance().bHideCursor && RendererHasFocus())
m_RenderParent->SetCursor(wxCURSOR_BLANK); m_render_parent->SetCursor(wxCURSOR_BLANK);
} }
UpdateGUI(); UpdateGUI();
} }
@ -794,18 +796,18 @@ void CFrame::DoStop()
{ {
if (!Core::IsRunningAndStarted()) if (!Core::IsRunningAndStarted())
return; return;
if (m_confirmStop) if (m_confirm_stop)
return; return;
// don't let this function run again until it finishes, or is aborted. // don't let this function run again until it finishes, or is aborted.
m_confirmStop = true; m_confirm_stop = true;
m_bGameLoading = false; m_is_game_loading = false;
if (Core::GetState() != Core::State::Uninitialized || m_RenderParent != nullptr) if (Core::GetState() != Core::State::Uninitialized || m_render_parent != nullptr)
{ {
#if defined __WXGTK__ #if defined __WXGTK__
wxMutexGuiLeave(); wxMutexGuiLeave();
std::lock_guard<std::recursive_mutex> lk(keystate_lock); std::lock_guard<std::recursive_mutex> lk(m_keystate_lock);
wxMutexGuiEnter(); wxMutexGuiEnter();
#endif #endif
@ -842,18 +844,18 @@ void CFrame::DoStop()
if (should_pause) if (should_pause)
Core::SetState(state); Core::SetState(state);
m_confirmStop = false; m_confirm_stop = false;
return; return;
} }
} }
if (UseDebugger && g_pCodeWindow) if (m_use_debugger && m_code_window)
{ {
PowerPC::watches.Clear(); PowerPC::watches.Clear();
PowerPC::breakpoints.Clear(); PowerPC::breakpoints.Clear();
PowerPC::memchecks.Clear(); PowerPC::memchecks.Clear();
if (g_pCodeWindow->HasPanel<CBreakPointWindow>()) if (m_code_window->HasPanel<CBreakPointWindow>())
g_pCodeWindow->GetPanel<CBreakPointWindow>()->NotifyUpdate(); m_code_window->GetPanel<CBreakPointWindow>()->NotifyUpdate();
g_symbolDB.Clear(); g_symbolDB.Clear();
Host_NotifyMapLoaded(); Host_NotifyMapLoaded();
Core::SetState(state); Core::SetState(state);
@ -891,16 +893,16 @@ bool CFrame::TriggerSTMPowerEvent()
Core::DisplayMessage("Shutting down", 30000); Core::DisplayMessage("Shutting down", 30000);
// Unpause because gracefully shutting down needs the game to actually request a shutdown. // Unpause because gracefully shutting down needs the game to actually request a shutdown.
// Do not unpause in debug mode to allow debugging until the complete shutdown. // Do not unpause in debug mode to allow debugging until the complete shutdown.
if (Core::GetState() == Core::State::Paused && !UseDebugger) if (Core::GetState() == Core::State::Paused && !m_use_debugger)
DoPause(); DoPause();
ProcessorInterface::PowerButton_Tap(); ProcessorInterface::PowerButton_Tap();
m_confirmStop = false; m_confirm_stop = false;
return true; return true;
} }
void CFrame::OnStopped() void CFrame::OnStopped()
{ {
m_confirmStop = false; m_confirm_stop = false;
m_tried_graceful_shutdown = false; m_tried_graceful_shutdown = false;
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
@ -914,10 +916,10 @@ void CFrame::OnStopped()
SetThreadExecutionState(ES_CONTINUOUS); SetThreadExecutionState(ES_CONTINUOUS);
#endif #endif
m_RenderFrame->SetTitle(StrToWxStr(scm_rev_str)); m_render_frame->SetTitle(StrToWxStr(scm_rev_str));
// Destroy the renderer frame when not rendering to main // Destroy the renderer frame when not rendering to main
m_RenderParent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this); m_render_parent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
// Keyboard // Keyboard
wxTheApp->Unbind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this); wxTheApp->Unbind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
@ -929,25 +931,25 @@ void CFrame::OnStopped()
wxTheApp->Unbind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this); wxTheApp->Unbind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
wxTheApp->Unbind(wxEVT_MOTION, &CFrame::OnMouse, this); wxTheApp->Unbind(wxEVT_MOTION, &CFrame::OnMouse, this);
if (SConfig::GetInstance().bHideCursor) if (SConfig::GetInstance().bHideCursor)
m_RenderParent->SetCursor(wxNullCursor); m_render_parent->SetCursor(wxNullCursor);
DoFullscreen(false); DoFullscreen(false);
if (!SConfig::GetInstance().bRenderToMain) if (!SConfig::GetInstance().bRenderToMain)
{ {
m_RenderFrame->Destroy(); m_render_frame->Destroy();
} }
else else
{ {
#if defined(__APPLE__) #if defined(__APPLE__)
// Disable the full screen button when not in a game. // Disable the full screen button when not in a game.
m_RenderFrame->EnableFullScreenView(false); m_render_frame->EnableFullScreenView(false);
#endif #endif
// Make sure the window is not longer set to stay on top // Make sure the window is not longer set to stay on top
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
} }
m_RenderParent = nullptr; m_render_parent = nullptr;
m_bRendererHasFocus = false; m_renderer_has_focus = false;
m_RenderFrame = nullptr; m_render_frame = nullptr;
// Clean framerate indications from the status bar. // Clean framerate indications from the status bar.
GetStatusBar()->SetStatusText(" ", 0); GetStatusBar()->SetStatusText(" ", 0);
@ -956,16 +958,16 @@ void CFrame::OnStopped()
GetStatusBar()->SetStatusText(" ", 1); GetStatusBar()->SetStatusText(" ", 1);
// If batch mode was specified on the command-line or we were already closing, exit now. // If batch mode was specified on the command-line or we were already closing, exit now.
if (m_bBatchMode || m_bClosing) if (m_batch_mode || m_is_closing)
Close(true); Close(true);
// If using auto size with render to main, reset the application size. // If using auto size with render to main, reset the application size.
if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().bRenderWindowAutoSize) if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().bRenderWindowAutoSize)
SetSize(SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight); SetSize(SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight);
m_GameListCtrl->Enable(); m_game_list_ctrl->Enable();
m_GameListCtrl->Show(); m_game_list_ctrl->Show();
m_GameListCtrl->SetFocus(); m_game_list_ctrl->SetFocus();
UpdateGUI(); UpdateGUI();
} }
@ -1043,7 +1045,7 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
HotkeyManagerEmu::Enable(false); HotkeyManagerEmu::Enable(false);
HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), UseDebugger); HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), m_use_debugger);
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
// Update references in case controllers were refreshed // Update references in case controllers were refreshed
@ -1145,16 +1147,16 @@ void CFrame::StatusBarMessage(const char* Text, ...)
// NetPlay stuff // NetPlay stuff
void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED(event)) void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED(event))
{ {
if (!g_NetPlaySetupDiag) if (!m_netplay_setup_frame)
{ {
if (NetPlayDialog::GetInstance() != nullptr) if (NetPlayDialog::GetInstance() != nullptr)
NetPlayDialog::GetInstance()->Raise(); NetPlayDialog::GetInstance()->Raise();
else else
g_NetPlaySetupDiag = new NetPlaySetupFrame(this, m_GameListCtrl); m_netplay_setup_frame = new NetPlaySetupFrame(this, m_game_list_ctrl);
} }
else else
{ {
g_NetPlaySetupDiag->Raise(); m_netplay_setup_frame->Raise();
} }
} }
@ -1204,7 +1206,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event)
{ {
case IDM_LIST_INSTALL_WAD: case IDM_LIST_INSTALL_WAD:
{ {
const GameListItem* iso = m_GameListCtrl->GetSelectedISO(); const GameListItem* iso = m_game_list_ctrl->GetSelectedISO();
if (!iso) if (!iso)
return; return;
fileName = iso->GetFileName(); fileName = iso->GetFileName();
@ -1236,7 +1238,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event)
void CFrame::OnUninstallWAD(wxCommandEvent&) void CFrame::OnUninstallWAD(wxCommandEvent&)
{ {
const GameListItem* file = m_GameListCtrl->GetSelectedISO(); const GameListItem* file = m_game_list_ctrl->GetSelectedISO();
if (!file) if (!file)
return; return;
@ -1297,14 +1299,14 @@ void CFrame::UpdateLoadWiiMenuItem() const
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event)) void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event))
{ {
if (m_FifoPlayerDlg) if (m_fifo_player_dialog)
{ {
m_FifoPlayerDlg->Show(); m_fifo_player_dialog->Show();
m_FifoPlayerDlg->SetFocus(); m_fifo_player_dialog->SetFocus();
} }
else else
{ {
m_FifoPlayerDlg = new FifoPlayerDlg(this); m_fifo_player_dialog = new FifoPlayerDlg(this);
} }
} }
@ -1343,9 +1345,8 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event)
Core::PauseAndLock(false, was_unpaused); Core::PauseAndLock(false, was_unpaused);
} }
// Toggle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to // Toggle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_panel to
// cover // cover the entire screen (when we render to the main window).
// the entire screen (when we render to the main window).
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED(event)) void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED(event))
{ {
DoFullscreen(!RendererIsFullscreen()); DoFullscreen(!RendererIsFullscreen());
@ -1431,9 +1432,9 @@ void CFrame::OnSaveState(wxCommandEvent& event)
void CFrame::OnSelectSlot(wxCommandEvent& event) void CFrame::OnSelectSlot(wxCommandEvent& event)
{ {
m_saveSlot = event.GetId() - IDM_SELECT_SLOT_1 + 1; m_save_slot = event.GetId() - IDM_SELECT_SLOT_1 + 1;
Core::DisplayMessage(StringFromFormat("Selected slot %d - %s", m_saveSlot, Core::DisplayMessage(StringFromFormat("Selected slot %d - %s", m_save_slot,
State::GetInfoStringOfSlot(m_saveSlot, false).c_str()), State::GetInfoStringOfSlot(m_save_slot, false).c_str()),
2500); 2500);
} }
@ -1441,7 +1442,7 @@ void CFrame::OnLoadCurrentSlot(wxCommandEvent& event)
{ {
if (Core::IsRunningAndStarted()) if (Core::IsRunningAndStarted())
{ {
State::Load(m_saveSlot); State::Load(m_save_slot);
} }
} }
@ -1449,7 +1450,7 @@ void CFrame::OnSaveCurrentSlot(wxCommandEvent& event)
{ {
if (Core::IsRunningAndStarted()) if (Core::IsRunningAndStarted())
{ {
State::Save(m_saveSlot); State::Save(m_save_slot);
} }
} }
@ -1520,9 +1521,9 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Enable(Running || Paused); GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Enable(Running || Paused);
if (!Initialized && !m_bGameLoading) if (!Initialized && !m_is_game_loading)
{ {
if (m_GameListCtrl->IsEnabled()) if (m_game_list_ctrl->IsEnabled())
{ {
// Prepare to load Default ISO, enable play button // Prepare to load Default ISO, enable play button
if (!SConfig::GetInstance().m_strDefaultISO.empty()) if (!SConfig::GetInstance().m_strDefaultISO.empty())
@ -1552,13 +1553,13 @@ void CFrame::UpdateGUI()
} }
// Game has not started, show game list // Game has not started, show game list
if (!m_GameListCtrl->IsShown()) if (!m_game_list_ctrl->IsShown())
{ {
m_GameListCtrl->Enable(); m_game_list_ctrl->Enable();
m_GameListCtrl->Show(); m_game_list_ctrl->Show();
} }
// Game has been selected but not started, enable play button // Game has been selected but not started, enable play button
if (m_GameListCtrl->GetSelectedISO() != nullptr && m_GameListCtrl->IsEnabled()) if (m_game_list_ctrl->GetSelectedISO() != nullptr && m_game_list_ctrl->IsEnabled())
{ {
GetToolBar()->EnableTool(IDM_PLAY, true); GetToolBar()->EnableTool(IDM_PLAY, true);
GetMenuBar()->FindItem(IDM_PLAY)->Enable(); GetMenuBar()->FindItem(IDM_PLAY)->Enable();
@ -1576,7 +1577,7 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_PLAY)->Enable(!Stopping); GetMenuBar()->FindItem(IDM_PLAY)->Enable(!Stopping);
// Reset game loading flag // Reset game loading flag
m_bGameLoading = false; m_is_game_loading = false;
// Rename the stop playing/recording menu item depending on current movie state // Rename the stop playing/recording menu item depending on current movie state
if (Movie::IsRecordingInput()) if (Movie::IsRecordingInput())
@ -1590,7 +1591,7 @@ void CFrame::UpdateGUI()
GetToolBar()->Refresh(false); GetToolBar()->Refresh(false);
// Commit changes to manager // Commit changes to manager
m_Mgr->Update(); m_mgr->Update();
// Update non-modal windows // Update non-modal windows
if (m_cheats_window) if (m_cheats_window)
@ -1606,7 +1607,7 @@ void CFrame::UpdateGameList()
{ {
wxCommandEvent event{DOLPHIN_EVT_RELOAD_GAMELIST, GetId()}; wxCommandEvent event{DOLPHIN_EVT_RELOAD_GAMELIST, GetId()};
event.SetEventObject(this); event.SetEventObject(this);
wxPostEvent(m_GameListCtrl, event); wxPostEvent(m_game_list_ctrl, event);
} }
void CFrame::GameListChanged(wxCommandEvent& event) void CFrame::GameListChanged(wxCommandEvent& event)
@ -1693,7 +1694,7 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
void CFrame::DoToggleToolbar(bool _show) void CFrame::DoToggleToolbar(bool _show)
{ {
GetToolBar()->Show(_show); GetToolBar()->Show(_show);
m_Mgr->Update(); m_mgr->Update();
} }
// Enable and disable the status bar // Enable and disable the status bar

View File

@ -174,7 +174,7 @@ void CLogWindow::SaveSettings()
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
if (!Parent->g_pCodeWindow) if (!Parent->m_code_window)
{ {
IniFile::Section* log_window = ini.GetOrCreateSection("LogWindow"); IniFile::Section* log_window = ini.GetOrCreateSection("LogWindow");
log_window->Set("x", x); log_window->Set("x", x);

View File

@ -254,9 +254,9 @@ void DolphinApp::AfterInit()
} }
// If we have selected Automatic Start, start the default ISO, // If we have selected Automatic Start, start the default ISO,
// or if no default ISO exists, start the last loaded ISO // or if no default ISO exists, start the last loaded ISO
else if (main_frame->g_pCodeWindow) else if (main_frame->m_code_window)
{ {
if (main_frame->g_pCodeWindow->AutomaticStart()) if (main_frame->m_code_window->AutomaticStart())
{ {
main_frame->BootGame(""); main_frame->BootGame("");
} }
@ -372,8 +372,8 @@ bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*
event.SetString(StrToWxStr(caption) + ":" + StrToWxStr(text)); event.SetString(StrToWxStr(caption) + ":" + StrToWxStr(text));
event.SetInt(yes_no); event.SetInt(yes_no);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
main_frame->panic_event.Wait(); main_frame->m_panic_event.Wait();
return main_frame->bPanicResult; return main_frame->m_panic_result;
} }
} }
@ -412,9 +412,9 @@ void Host_NotifyMapLoaded()
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_NOTIFY_MAP_LOADED); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_NOTIFY_MAP_LOADED);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
if (main_frame->g_pCodeWindow) if (main_frame->m_code_window)
{ {
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); main_frame->m_code_window->GetEventHandler()->AddPendingEvent(event);
} }
} }
@ -423,9 +423,9 @@ void Host_UpdateDisasmDialog()
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATE_DISASM_DIALOG); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATE_DISASM_DIALOG);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
if (main_frame->g_pCodeWindow) if (main_frame->m_code_window)
{ {
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); main_frame->m_code_window->GetEventHandler()->AddPendingEvent(event);
} }
} }
@ -434,9 +434,9 @@ void Host_UpdateMainFrame()
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATE_GUI); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATE_GUI);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
if (main_frame->g_pCodeWindow) if (main_frame->m_code_window)
{ {
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); main_frame->m_code_window->GetEventHandler()->AddPendingEvent(event);
} }
} }
@ -457,18 +457,18 @@ void Host_RequestRenderWindowSize(int width, int height)
void Host_SetStartupDebuggingParameters() void Host_SetStartupDebuggingParameters()
{ {
SConfig& StartUp = SConfig::GetInstance(); SConfig& StartUp = SConfig::GetInstance();
if (main_frame->g_pCodeWindow) if (main_frame->m_code_window)
{ {
StartUp.bBootToPause = main_frame->g_pCodeWindow->BootToPause(); StartUp.bBootToPause = main_frame->m_code_window->BootToPause();
StartUp.bAutomaticStart = main_frame->g_pCodeWindow->AutomaticStart(); StartUp.bAutomaticStart = main_frame->m_code_window->AutomaticStart();
StartUp.bJITNoBlockCache = main_frame->g_pCodeWindow->JITNoBlockCache(); StartUp.bJITNoBlockCache = main_frame->m_code_window->JITNoBlockCache();
StartUp.bJITNoBlockLinking = main_frame->g_pCodeWindow->JITNoBlockLinking(); StartUp.bJITNoBlockLinking = main_frame->m_code_window->JITNoBlockLinking();
} }
else else
{ {
StartUp.bBootToPause = false; StartUp.bBootToPause = false;
} }
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG StartUp.bEnableDebugging = main_frame->m_code_window ? true : false; // RUNNING_DEBUG
} }
void Host_SetWiiMoteConnectionState(int _State) void Host_SetWiiMoteConnectionState(int _State)

View File

@ -312,7 +312,7 @@ NetPlaySetupFrame::~NetPlaySetupFrame()
#endif #endif
inifile.Save(dolphin_ini); inifile.Save(dolphin_ini);
main_frame->g_NetPlaySetupDiag = nullptr; main_frame->m_netplay_setup_frame = nullptr;
} }
void NetPlaySetupFrame::OnHost(wxCommandEvent&) void NetPlaySetupFrame::OnHost(wxCommandEvent&)

View File

@ -319,7 +319,7 @@ static wxArrayString GetListOfResolutions()
} }
#elif defined(HAVE_XRANDR) && HAVE_XRANDR #elif defined(HAVE_XRANDR) && HAVE_XRANDR
std::vector<std::string> resos; std::vector<std::string> resos;
main_frame->m_XRRConfig->AddResolutions(resos); main_frame->m_xrr_config->AddResolutions(resos);
for (auto res : resos) for (auto res : resos)
retlist.Add(StrToWxStr(res)); retlist.Add(StrToWxStr(res));
#elif defined(__APPLE__) #elif defined(__APPLE__)
@ -1026,7 +1026,7 @@ void VideoConfigDiag::Event_DisplayResolution(wxCommandEvent& ev)
WxStrToStr(choice_display_resolution->GetStringSelection()); WxStrToStr(choice_display_resolution->GetStringSelection());
} }
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame->m_XRRConfig->Update(); main_frame->m_xrr_config->Update();
#endif #endif
ev.Skip(); ev.Skip();
} }