From 586f24645ac913071ca8c8415f16f531f3353972 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 27 Jul 2010 02:39:12 +0000 Subject: [PATCH] Fix an issue using render to main in combination with the log window or console window, in which the renderer was not resized when the panes were resized. Also refresh the log window at that time so artifacts are cleared. A little more code cleanup of the debugger windows. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5983 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/DebuggerWX/Src/BreakpointWindow.cpp | 4 ++- Source/Core/DebuggerWX/Src/BreakpointWindow.h | 10 ++++-- Source/Core/DebuggerWX/Src/CodeWindow.h | 2 +- .../DebuggerWX/Src/CodeWindowFunctions.cpp | 4 +-- Source/Core/DebuggerWX/Src/JitWindow.h | 4 +-- Source/Core/DebuggerWX/Src/MemoryWindow.h | 2 +- Source/Core/DebuggerWX/Src/RegisterWindow.cpp | 6 ++-- Source/Core/DebuggerWX/Src/RegisterWindow.h | 5 ++- Source/Core/DolphinWX/Src/Frame.cpp | 20 +++++------ Source/Core/DolphinWX/Src/FrameAui.cpp | 36 +++++++++---------- Source/Core/DolphinWX/Src/FrameTools.cpp | 6 ++-- 11 files changed, 53 insertions(+), 46 deletions(-) diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp index e966d8b9b9..d8a1c3b43b 100644 --- a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp +++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp @@ -30,7 +30,9 @@ BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel) EVT_LIST_ITEM_SELECTED(ID_TOOLBAR, CBreakPointWindow::OnSelectItem) END_EVENT_TABLE() -CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) +CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, + wxWindowID id, const wxString& title, const wxPoint& position, + const wxSize& size, long style) : wxPanel(parent, id, position, size, style, title) , m_BreakPointListView(NULL) , m_pCodeWindow(_pCodeWindow) diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.h b/Source/Core/DebuggerWX/Src/BreakpointWindow.h index 055fe3a2ec..635a7ff4ce 100644 --- a/Source/Core/DebuggerWX/Src/BreakpointWindow.h +++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.h @@ -45,9 +45,13 @@ class CBreakPointWindow public: - CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Breakpoints"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 250), - long style = wxNO_BORDER); + CBreakPointWindow(CCodeWindow* _pCodeWindow, + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& title = wxT("Breakpoints"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxBORDER_NONE); void NotifyUpdate(); void OnDelete(); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index 23eb66de6a..b4f6fe526f 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -48,7 +48,7 @@ class CCodeWindow wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL, + long style = wxTAB_TRAVERSAL | wxBORDER_NONE, const wxString& name = wxT("Code") ); diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index 78da3fce65..c636541c9c 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -107,7 +107,7 @@ void CCodeWindow::Load() // Get notebook affiliation std::string _Section = "P - " + ((Parent->ActivePerspective < Parent->Perspectives.size()) - ? Parent->Perspectives.at(Parent->ActivePerspective).Name : "Perspective 1"); + ? Parent->Perspectives[Parent->ActivePerspective].Name : "Perspective 1"); for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++) ini.Get(_Section.c_str(), SettingName[i], &iNbAffiliation[i], 0); @@ -146,7 +146,7 @@ void CCodeWindow::Save() ini.Set("ShowOnStart", SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i)); // Save notebook affiliations - std::string _Section = "P - " + Parent->Perspectives.at(Parent->ActivePerspective).Name; + std::string _Section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name; for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++) ini.Set(_Section.c_str(), SettingName[i], iNbAffiliation[i]); diff --git a/Source/Core/DebuggerWX/Src/JitWindow.h b/Source/Core/DebuggerWX/Src/JitWindow.h index 3e75180cea..b8b2443f62 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.h +++ b/Source/Core/DebuggerWX/Src/JitWindow.h @@ -46,8 +46,8 @@ public: wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL, - const wxString& title = _T("JIT block viewer")); + long style = wxTAB_TRAVERSAL | wxBORDER_NONE, + const wxString& name = _T("JIT block viewer")); static void ViewAddr(u32 em_address); void Update(); diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.h b/Source/Core/DebuggerWX/Src/MemoryWindow.h index 6dd49464e9..13664930d7 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.h +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.h @@ -40,7 +40,7 @@ class CMemoryWindow wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER, + long style = wxTAB_TRAVERSAL | wxBORDER_NONE, const wxString& name = _T("Memory")); wxCheckBox* chk8; diff --git a/Source/Core/DebuggerWX/Src/RegisterWindow.cpp b/Source/Core/DebuggerWX/Src/RegisterWindow.cpp index fd9b5634cc..f6efd07943 100644 --- a/Source/Core/DebuggerWX/Src/RegisterWindow.cpp +++ b/Source/Core/DebuggerWX/Src/RegisterWindow.cpp @@ -26,8 +26,10 @@ BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel) END_EVENT_TABLE() -CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) - : wxPanel(parent, id, position, size, style, title) +CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, + const wxPoint& position, const wxSize& size, + long style, const wxString& name) + : wxPanel(parent, id, position, size, style, name) , m_GPRGridView(NULL) { CreateGUIControls(); diff --git a/Source/Core/DebuggerWX/Src/RegisterWindow.h b/Source/Core/DebuggerWX/Src/RegisterWindow.h index f92373048a..00fbf70aff 100644 --- a/Source/Core/DebuggerWX/Src/RegisterWindow.h +++ b/Source/Core/DebuggerWX/Src/RegisterWindow.h @@ -27,11 +27,10 @@ class CRegisterWindow public: CRegisterWindow(wxWindow* parent, wxWindowID id = wxID_ANY, - const wxString& name = wxT("Registers"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER - ); + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxT("Registers")); void NotifyUpdate(); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 96da86cd96..17c6d99288 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -317,8 +317,8 @@ EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged) EVT_AUINOTEBOOK_TAB_RIGHT_UP(wxID_ANY, CFrame::OnTab) // Post events to child panels -EVT_MENU(wxID_ANY, CFrame::PostEvent) -EVT_TEXT(wxID_ANY, CFrame::PostEvent) +EVT_MENU_RANGE(IDM_INTERPRETER, IDM_ADDRBOX, CFrame::PostEvent) +EVT_TEXT(IDM_ADDRBOX, CFrame::PostEvent) END_EVENT_TABLE() @@ -513,10 +513,6 @@ CFrame::~CFrame() delete m_XRRConfig; #endif - // Close the log window now so that its settings are saved - if (!g_pCodeWindow) - m_LogWindow->Close(); - ClosePages(); delete m_Mgr; @@ -572,6 +568,11 @@ void CFrame::OnClose(wxCloseEvent& event) event.Skip(); // Save GUI settings if (g_pCodeWindow) SaveIniPerspectives(); + + // Close the log window now so that its settings are saved + if (!g_pCodeWindow) + m_LogWindow->Close(); + // Uninit m_Mgr->UnInit(); @@ -587,10 +588,9 @@ void CFrame::OnClose(wxCloseEvent& event) // Warning: This may cause an endless loop if the event is propagated back to its parent void CFrame::PostEvent(wxCommandEvent& event) { - if (g_pCodeWindow - && event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX - //&& event.GetId() != IDM_JITUNLIMITED - ) + if (g_pCodeWindow && + event.GetId() >= IDM_INTERPRETER && + event.GetId() <= IDM_ADDRBOX) { event.StopPropagation(); g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index 91347a5fa6..4962561bd7 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -374,7 +374,8 @@ void CFrame::TogglePane() if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window; } - if (NB) { + if (NB) + { if (NB->GetPageCount() == 0) m_Mgr->GetPane(wxT("Pane 1")).Hide(); else @@ -492,7 +493,7 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event) for (u32 i = 0; i < Perspectives.size(); i++) { wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, - wxString::FromAscii(Perspectives.at(i).Name.c_str()), wxT(""), wxITEM_CHECK); + wxString::FromAscii(Perspectives[i].Name.c_str()), wxT(""), wxITEM_CHECK); menuPopup->Append(mItem); if (i == ActivePerspective) mItem->Check(true); } @@ -524,7 +525,7 @@ void CFrame::OnToolBar(wxCommandEvent& event) } SaveIniPerspectives(); GetStatusBar()->SetStatusText(wxString::FromAscii(std::string - ("Saved " + Perspectives.at(ActivePerspective).Name).c_str()), 0); + ("Saved " + Perspectives[ActivePerspective].Name).c_str()), 0); break; case IDM_PERSPECTIVES_ADD_PANE: AddPane(); @@ -733,13 +734,9 @@ void CFrame::SetSimplePaneSize() ini.Get("LogWindow", "y", &y, Size); // Update size - m_Mgr->GetPane(wxT("Pane 0")).BestSize(x, y).MinSize(x, y).MaxSize(x, y); - m_Mgr->GetPane(wxT("Pane 1")).BestSize(x, y).MinSize(x, y).MaxSize(x, y); + m_Mgr->GetPane(wxT("Pane 0")).BestSize(x, y); + m_Mgr->GetPane(wxT("Pane 1")).BestSize(x, y); m_Mgr->Update(); - - // Set the position of the Pane - m_Mgr->GetPane(wxT("Pane 1")).MinSize(-1, -1).MaxSize(-1, -1); - m_Mgr->GetPane(wxT("Pane 0")).MinSize(-1, -1).MaxSize(-1, -1); } void CFrame::SetPaneSize() @@ -752,11 +749,11 @@ void CFrame::SetPaneSize() if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar))) { if (!m_Mgr->GetAllPanes().Item(i).IsOk()) return; - if (Perspectives.at(ActivePerspective).Width.size() <= j || - Perspectives.at(ActivePerspective).Height.size() <= j) + if (Perspectives[ActivePerspective].Width.size() <= j || + Perspectives[ActivePerspective].Height.size() <= j) continue; - u32 W = Perspectives.at(ActivePerspective).Width.at(j), - H = Perspectives.at(ActivePerspective).Height.at(j); + u32 W = Perspectives[ActivePerspective].Width[j], + H = Perspectives[ActivePerspective].Height[j]; // Check limits W = Limit(W, 5, 95); H = Limit(H, 5, 95); // Produce pixel width from percentage width @@ -787,7 +784,7 @@ void CFrame::ReloadPanes() CloseAllNotebooks(); // Create new panes with notebooks - for (u32 i = 0; i < Perspectives.at(ActivePerspective).Width.size() - 1; i++) + for (u32 i = 0; i < Perspectives[ActivePerspective].Width.size() - 1; i++) { wxString PaneName = wxString::Format(wxT("Pane %i"), i + 1); m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Hide() @@ -797,7 +794,7 @@ void CFrame::ReloadPanes() HideAllNotebooks(true); // Perspectives - m_Mgr->LoadPerspective(Perspectives.at(ActivePerspective).Perspective, false); + m_Mgr->LoadPerspective(Perspectives[ActivePerspective].Perspective, false); // Reset toolbars ResetToolbarStyle(); // Restore settings @@ -807,6 +804,7 @@ void CFrame::ReloadPanes() // Load GUI settings g_pCodeWindow->Load(); // Open notebook pages + AddRemoveBlankPage(); g_pCodeWindow->OpenPages(); if (g_pCodeWindow->bShowOnStart[0]) ToggleLogWindow(true); if (g_pCodeWindow->bShowOnStart[1]) ToggleConsole(true); @@ -839,7 +837,7 @@ void CFrame::LoadIniPerspectives() SPerspectives Tmp; std::string _Section, _Perspective, _Width, _Height; std::vector _SWidth, _SHeight; - Tmp.Name = VPerspectives.at(i); + Tmp.Name = VPerspectives[i]; // Don't save a blank perspective if (Tmp.Name.empty()) continue; @@ -859,12 +857,12 @@ void CFrame::LoadIniPerspectives() for (u32 j = 0; j < _SWidth.size(); j++) { int _Tmp; - if (TryParseInt(_SWidth.at(j).c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp); + if (TryParseInt(_SWidth[j].c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp); } for (u32 j = 0; j < _SHeight.size(); j++) { int _Tmp; - if (TryParseInt(_SHeight.at(j).c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp); + if (TryParseInt(_SHeight[j].c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp); } Perspectives.push_back(Tmp); } @@ -911,7 +909,7 @@ void CFrame::SaveIniPerspectives() std::string STmp = ""; for (u32 i = 0; i < Perspectives.size(); i++) { - STmp += Perspectives.at(i).Name + ","; + STmp += Perspectives[i].Name + ","; } STmp = STmp.substr(0, STmp.length()-1); ini.Set("Perspectives", "Perspectives", STmp.c_str()); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 3c3159022a..94bc88ee24 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -724,6 +724,8 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event) X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()), "RESIZE", x, y, width, height); #endif + m_LogWindow->Refresh(); + m_LogWindow->Update(); } event.Skip(); } @@ -820,7 +822,7 @@ void CFrame::StartGame(const std::string& filename) wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(CFrame::OnKeyUp), (wxObject*)0, this); - m_RenderFrame->Connect(wxID_ANY, wxEVT_SIZE, + m_RenderParent->Connect(wxID_ANY, wxEVT_SIZE, wxSizeEventHandler(CFrame::OnRenderParentResize), (wxObject*)0, this); } @@ -912,7 +914,7 @@ void CFrame::DoStop() Core::Stop(); // Destroy the renderer frame when not rendering to main - m_RenderFrame->Disconnect(wxID_ANY, wxEVT_SIZE, + m_RenderParent->Disconnect(wxID_ANY, wxEVT_SIZE, wxSizeEventHandler(CFrame::OnRenderParentResize), (wxObject*)0, this); wxTheApp->Disconnect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard