diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 6421662c08..81e8eef885 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -478,13 +478,13 @@ void CCodeWindow::Save() ini.Set("ShowOnStart", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE)); // Save windows settings - ini.Set("ShowOnStart", "Code", GetMenuBar()->IsChecked(IDM_CODEWINDOW)); + //ini.Set("ShowOnStart", "Code", GetMenuBar()->IsChecked(IDM_CODEWINDOW)); ini.Set("ShowOnStart", "Registers", GetMenuBar()->IsChecked(IDM_REGISTERWINDOW)); ini.Set("ShowOnStart", "Breakpoints", GetMenuBar()->IsChecked(IDM_BREAKPOINTWINDOW)); ini.Set("ShowOnStart", "Memory", GetMenuBar()->IsChecked(IDM_MEMORYWINDOW)); ini.Set("ShowOnStart", "JIT", GetMenuBar()->IsChecked(IDM_JITWINDOW)); ini.Set("ShowOnStart", "Sound", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW)); - ini.Set("ShowOnStart", "Video", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW)); + ini.Set("ShowOnStart", "Video", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW)); ini.Set("Notebook", "Log", iLogWindow); ini.Set("Notebook", "Console", iConsoleWindow); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index ead86617db..858ecd4f72 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -102,8 +102,8 @@ class CCodeWindow // Settings bool bAutomaticStart; bool bBootToPause; - bool bLogWindow; bool iLogWindow; - bool bConsoleWindow; bool iConsoleWindow; + bool bLogWindow; int iLogWindow; + bool bConsoleWindow; int iConsoleWindow; bool bCodeWindow; int iCodeWindow; bool bRegisterWindow; int iRegisterWindow; bool bBreakpointWindow; int iBreakpointWindow; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 9980970238..7a8c8bc1e2 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -82,22 +82,6 @@ extern "C" { }; -////////////////////////////////////////////////////////////////////////////////////////// -// Empty wxPanel -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -BEGIN_EVENT_TABLE(CEmptyPanel, wxPanel) -END_EVENT_TABLE() - -CEmptyPanel::CEmptyPanel( - wxWindow *parent, - wxWindowID id - ) - : wxPanel(parent, id) -{ -} -////////////////////////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////////////////////////////////////// /* Windows functions. Setting the cursor with wxSetCursor() did not work in this instance. Probably because it's somehow reset from the WndProc() in the child window */ @@ -513,9 +497,10 @@ CFrame::CFrame(bool showLogWindow, CPluginManager::GetInstance().ScanForPlugins(); // Open notebook pages + //if (UseDebugger) AddBlankPage(); if (UseDebugger) g_pCodeWindow->OpenPages(); - if (m_bLogWindow) ToggleLogWindow(true, UseDebugger ? 1 : 0); - if (SConfig::GetInstance().m_InterfaceConsole) ToggleConsole(true, UseDebugger ? 1 : 0); + if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true); + if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true); if (!UseDebugger) SetSimplePaneSize(); //if we are ever going back to optional iso caching: @@ -596,6 +581,12 @@ void CFrame::OnClose(wxCloseEvent& event) } } +wxPanel* CFrame::CreateEmptyPanel() +{ + wxPanel* Panel = new wxPanel(this, wxID_ANY); + return Panel; +} + void CFrame::DoFullscreen(bool _F) { ShowFullScreen(_F); diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index f2ae784865..e0f502b404 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -110,6 +110,7 @@ class CFrame : public wxFrame wxWindow * GetWxWindowHwnd(HWND); #endif wxWindow * GetNootebookPage(wxString); + void AddRemoveBlankPage(); void OnNotebookPageClose(wxAuiNotebookEvent& event); void OnAllowNotebookDnD(wxAuiNotebookEvent& event); void OnNotebookPageChanged(wxAuiNotebookEvent& event); @@ -181,6 +182,7 @@ class CFrame : public wxFrame void PopulateToolbarAui(wxAuiToolBar* toolBar); void RecreateToolbar(); void CreateMenu(); + wxPanel *CreateEmptyPanel(); #ifdef _WIN32 // Override window proc for tricks like screensaver disabling @@ -277,16 +279,4 @@ class CFrame : public wxFrame }; -class CEmptyPanel : public wxPanel -{ - public: - CEmptyPanel( - wxWindow* parent, - wxWindowID id = wxID_ANY - ); - - private: - DECLARE_EVENT_TABLE(); -}; - #endif // __FRAME_H_ diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 52a593b244..1003df7a60 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -936,18 +936,6 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) ///////////////////////////////////////////////////////////////////////////////////////////////////////// // Notebooks // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -wxWindow * CFrame::GetNootebookPage(wxString Name) -{ - for (int i = 0; i < m_NB.size(); i++) - { - if (!m_NB[i]) return NULL; - for(u32 j = 0; j <= m_NB[j]->GetPageCount(); j++) - { - if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return m_NB[i]->GetPage(j); - } - } - return NULL; -} #ifdef _WIN32 wxWindow * CFrame::GetWxWindowHwnd(HWND hWnd) { @@ -985,12 +973,36 @@ wxWindow * CFrame::GetWxWindow(wxString Name) else return NULL; } +wxWindow * CFrame::GetNootebookPage(wxString Name) +{ + for (int i = 0; i < m_NB.size(); i++) + { + if (!m_NB[i]) continue; + for(u32 j = 0; j < m_NB[j]->GetPageCount(); j++) + { + if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return m_NB[i]->GetPage(j); + } + } + return NULL; +} +void CFrame::AddRemoveBlankPage() +{ + for (int i = 0; i < m_NB.size(); i++) + { + if (!m_NB[i]) continue; + for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++) + { + if (m_NB[i]->GetPageText(j).IsSameAs(wxT("<>")) && m_NB[i]->GetPageCount() > 1) m_NB[i]->DeletePage(j); + } + if (m_NB[i]->GetPageCount() == 0) m_NB[i]->AddPage(CreateEmptyPanel(), wxT("<>"), true); + } +} int CFrame::GetNootebookAffiliation(wxString Name) { for (int i = 0; i < m_NB.size(); i++) { if (!m_NB[i]) continue; - for(u32 j = 0; j <= m_NB[i]->GetPageCount(); j++) + for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++) { if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return i; } @@ -999,6 +1011,7 @@ int CFrame::GetNootebookAffiliation(wxString Name) } void CFrame::DoToggleWindow(int Id, bool Show) { + switch (Id) { case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break; @@ -1016,9 +1029,12 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event) event.Skip(); if (!UseDebugger) return; + // Remove the blank page if any + AddRemoveBlankPage(); + // Update the notebook affiliation if(GetNootebookAffiliation(wxT("Log")) >= 0) g_pCodeWindow->iLogWindow = GetNootebookAffiliation(wxT("Log")); - if(GetNootebookAffiliation(wxT("Console")) >= 0) g_pCodeWindow->iLogWindow = GetNootebookAffiliation(wxT("Console")); + if(GetNootebookAffiliation(wxT("Console")) >= 0) g_pCodeWindow->iConsoleWindow = GetNootebookAffiliation(wxT("Console")); if(GetNootebookAffiliation(wxT("Code")) >= 0) g_pCodeWindow->iCodeWindow = GetNootebookAffiliation(wxT("Code")); if(GetNootebookAffiliation(wxT("Registers")) >= 0) g_pCodeWindow->iRegisterWindow = GetNootebookAffiliation(wxT("Registers")); if(GetNootebookAffiliation(wxT("Breakpoints")) >= 0) g_pCodeWindow->iBreakpointWindow = GetNootebookAffiliation(wxT("Breakpoints")); @@ -1046,9 +1062,10 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) { event.Skip(); - wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); + event.Allow(); + wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); // If we drag away the last one the tab bar goes away and we can't add any panes to it - if (Ctrl->GetPageCount() > 1) event.Allow(); + //if (Ctrl->GetPageCount() == 1) Ctrl->AddPage(CreateEmptyPanel(), wxT("<>"), true); } void CFrame::HidePane() { @@ -1161,7 +1178,6 @@ void CFrame::ToggleLogWindow(bool Show, int i) void CFrame::OnToggleConsole(wxCommandEvent& event) { DoToggleWindow(event.GetId(), event.IsChecked()); - //ToggleConsole(event.IsChecked()); } void CFrame::ToggleConsole(bool Show, int i) { @@ -1175,20 +1191,19 @@ void CFrame::ToggleConsole(bool Show, int i) wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow()); if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return; { - #else - Console->Open(); - #endif + #else + Console->Open(); + #endif - if(!GetConsoleWindow()) Console->Open(); - - #ifdef _WIN32 + #ifdef _WIN32 + if(!GetConsoleWindow()) Console->Open(); else ShowWindow(GetConsoleWindow(),SW_SHOW); } Win = GetWxWindowHwnd(GetConsoleWindow()); // Can we remove the border? //Win->SetWindowStyleFlag(wxNO_BORDER); //SetWindowLong(GetConsoleWindow(), GWL_STYLE, WS_VISIBLE); // Create parent window - CEmptyPanel * ConsoleParent = new CEmptyPanel(this); + wxPanel * ConsoleParent = CreateEmptyPanel(); ::SetParent(GetConsoleWindow(), (HWND)ConsoleParent->GetHWND()); //Win->SetParent(ConsoleParent); //if (Win) m_NB[i]->AddPage(Win, wxT("Console"), true, aNormalFile );