GUI: Dock logwindow

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4075 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-08-27 10:10:07 +00:00
parent cb0eafcfc8
commit da6a200540
9 changed files with 279 additions and 322 deletions
+85 -74
View File
@@ -263,8 +263,8 @@ EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_TOGGLE_CONSOLE, CFrame::OnToggleConsole)
EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_CONSOLE, CFrame::OnToggleConsole)
EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
@@ -319,7 +319,8 @@ CFrame::CFrame(bool showLogWindow,
bool _UseDebugger,
long style)
: wxFrame(parent, id, title, pos, size, style)
, UseDebugger(_UseDebugger)
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
, m_NB0(NULL), m_NB1(NULL), m_NB2(NULL)
, m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
@@ -333,7 +334,7 @@ CFrame::CFrame(bool showLogWindow,
if (UseDebugger) this->Maximize(true);
// Debugger class
if (UseDebugger)
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this);
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
// Create timer
#if wxUSE_TIMER
@@ -341,7 +342,7 @@ CFrame::CFrame(bool showLogWindow,
m_timer.Start( floor((double)(1000 / TimesPerSecond)) );
#endif
// Create toolbar bitmaps
// Create toolbar bitmaps
InitBitmaps();
// Give it an icon
@@ -357,29 +358,25 @@ CFrame::CFrame(bool showLogWindow,
// Give it a menu bar
CreateMenu();
// Give it a console
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener();
if (SConfig::GetInstance().m_InterfaceConsole)
console->Open();
// -------------------------------------------------------------------------
// Panels
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
m_Panel = new CPanel(this, IDM_MPANEL);
//wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY);
static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
if (UseDebugger)
{
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB2 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
g_pCodeWindow->UpdateNotebook(0, m_NB0);
g_pCodeWindow->UpdateNotebook(1, m_NB1);
}
else
{
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
}
// -------------------------------------------------------------------------
@@ -394,7 +391,17 @@ CFrame::CFrame(bool showLogWindow,
m_Mgr = new wxAuiManager();
m_Mgr->SetManagedWindow(this);
// Window perspectives
// Normal perspectives
/*
----------
| Pane 0 |
----------
-------------------
| Pane 0 | Pane 1 |
-------------------
*/
// Debug perspectives
/*
-------------------
| Pane 0 | |
@@ -419,22 +426,20 @@ CFrame::CFrame(bool showLogWindow,
else
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide());
m_Mgr->AddPane(m_NB0, wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide());
}
// Open log window
m_LogWindow = new CLogWindow(this);
if (m_bLogWindow) m_LogWindow->Show();
// Create toolbar
RecreateToolbar();
if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);
if (UseDebugger) g_pCodeWindow->UpdateToolbar(m_ToolBarDebug);
// Position the panes
// Show titles to position the panes
/*
m_Mgr->GetPane(wxT("Pane0")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true);
*/
if (UseDebugger)
{
@@ -442,15 +447,15 @@ CFrame::CFrame(bool showLogWindow,
m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).Layer(0).Center().Position(0);
m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).Layer(0).Center().Position(1);
m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).Layer(0).Right();
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(0);
m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(1);
m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
m_Mgr->GetPane(wxT("Pane0")).Left();
m_Mgr->GetPane(wxT("Pane1")).Left();
m_Mgr->GetPane(wxT("Pane2")).Center();
m_Mgr->GetPane(wxT("Pane3")).Show().Right();
m_Mgr->GetPane(wxT("Pane3")).Show().PaneBorder(true).CaptionVisible(false).Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
// Load perspective
@@ -465,8 +470,9 @@ CFrame::CFrame(bool showLogWindow,
}
else
{
m_Mgr->GetPane(wxT("Pane0")).Layer(0).CenterPane().PaneBorder(false);
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
}
// Show window
@@ -477,6 +483,13 @@ CFrame::CFrame(bool showLogWindow,
// Open notebook pages
if (UseDebugger) g_pCodeWindow->OpenPages();
if (m_bLogWindow) ToggleLogWindow(true, UseDebugger ? m_NB1 : m_NB0);
if (!UseDebugger) SetSimplePaneSize();
// Give it a console
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener();
if (SConfig::GetInstance().m_InterfaceConsole)
console->Open();
//if we are ever going back to optional iso caching:
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
@@ -552,7 +565,6 @@ void CFrame::OnClose(wxCloseEvent& event)
UpdateGUI();
}
}
void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{
event.Skip();
@@ -560,21 +572,6 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
// 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();
}
void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
{
// Don't skip the event, override it
//event.Skip();
event.Veto();
wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_REGISTERWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_BREAKPOINTWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_JITWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_MEMORYWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_SOUNDWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_VIDEOWINDOW, false); }
}
void CFrame::DoFullscreen(bool _F)
{
@@ -591,50 +588,64 @@ void CFrame::DoFullscreen(bool _F)
m_Mgr->LoadPerspective(AuiCurrent, true);
}
}
void CFrame::DoLoadPerspective(int i)
void CFrame::SetSimplePaneSize()
{
//Save();
wxArrayInt i, j;
i.Add(0); j.Add(50);
i.Add(1); j.Add(50);
SetPaneSize(i, j);
}
void CFrame::SetPaneSize(wxArrayInt Pane, wxArrayInt Size)
{
int iClientSize = this->GetSize().GetX();
m_Mgr->LoadPerspective(AuiPerspective[i], true);
for (int i = 0; i < Pane.size(); i++)
{
// Check limits
if (Size[i] > 95) Size[i] = 95; if (Size[i] < 5) Size[i] = 5;
// Produce pixel width from percentage width
Size[i] = iClientSize * (float)(Size[i]/100.0);
// Update size
m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).BestSize(Size[i], -1).MinSize(Size[i], -1).MaxSize(Size[i], -1);
}
m_Mgr->Update();
for (int i = 0; i < Pane.size(); i++)
{
// Remove the size limits
m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1);
}
}
void CFrame::DoLoadPerspective(int Perspective)
{
Save();
int _iLeftWidth, _iMidWidth, _iRightWidth, iClientSize = this->GetSize().GetX();
m_Mgr->LoadPerspective(AuiPerspective[Perspective], true);
// Check limits
if (iLeftWidth[0] > 95) iLeftWidth[0] = 95; if (iLeftWidth[0] < 5) iLeftWidth[0] = 5;
if (iLeftWidth[1] > 95) iLeftWidth[1] = 95; if (iLeftWidth[1] < 5) iLeftWidth[1] = 5;
if (iMidWidth[1] > 95) iMidWidth[1] = 95; if (iMidWidth[1] < 5) iMidWidth[1] = 5;
int _iRightWidth, iClientSize = this->GetSize().GetX();
wxArrayInt i, j;
// Set the size
if (i == 0)
if (Perspective == 0)
{
_iLeftWidth = iClientSize * (float)(iLeftWidth[0]/100.0);
_iRightWidth = iClientSize - _iLeftWidth;
m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
_iRightWidth = 100 - iLeftWidth[0];
i.Add(0); j.Add(iLeftWidth[0]);
i.Add(2); j.Add(_iRightWidth);
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
//m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
}
else
{
_iLeftWidth = iClientSize * (float)(iLeftWidth[1]/100.0);
_iMidWidth = iClientSize * (float)(iMidWidth[1]/100.0);
_iRightWidth = iClientSize - _iLeftWidth - _iMidWidth;
_iRightWidth = 100 - iLeftWidth[1] - iMidWidth[1];
i.Add(0); j.Add(iLeftWidth[1]);
i.Add(2); j.Add(iMidWidth[1]);
i.Add(3); j.Add(_iRightWidth);
m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1);
m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
//m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1);
//m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
}
m_Mgr->Update();
// Remove the size limits
m_Mgr->GetPane(wxT("Pane0")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane1")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane2")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane3")).MinSize(-1, -1).MaxSize(-1, -1);
SetPaneSize(i, j);
}
void CFrame::Save()
{
+20 -14
View File
@@ -68,13 +68,14 @@ class CFrame : public wxFrame
// These have to be public
wxStatusBar* m_pStatusBar;
CCodeWindow* g_pCodeWindow;
wxBitmap aNormalFile;
void InitBitmaps();
void DoStop();
bool bRenderToMain;
void UpdateGUI();
void ToggleLogWindow(bool check);
void ToggleConsole(bool check);
CCodeWindow* g_pCodeWindow;
void ToggleLogWindow(bool, wxAuiNotebook * _NB = NULL);
void ToggleConsole(bool, wxAuiNotebook * _NB = NULL);
void PostEvent(wxCommandEvent& event);
void PostMenuEvent(wxMenuEvent& event);
void PostUpdateUIEvent(wxUpdateUIEvent& event);
@@ -96,17 +97,6 @@ class CFrame : public wxFrame
u8 g_Speakers[3]; u8 g_Speakers_[3];
// ---------------
private:
bool UseDebugger;
wxBoxSizer* sizerPanel;
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
wxToolBarToolBase* m_ToolPlay;
bool m_bLogWindow;
CLogWindow* m_LogWindow;
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
@@ -117,9 +107,25 @@ class CFrame : public wxFrame
wxArrayString AuiPerspective;
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void DoToggleWindow(int,bool);
void DoRemovePage(wxWindow *, bool Hide = true);
void DoLoadPerspective(int);
void HidePane();
void SetSimplePaneSize();
void SetPaneSize(wxArrayInt,wxArrayInt);
void Save();
private:
bool UseDebugger;
wxBoxSizer* sizerPanel;
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
wxToolBarToolBase* m_ToolPlay;
bool m_bLogWindow;
CLogWindow* m_LogWindow;
char **drives;
enum EToolbar
+109 -33
View File
@@ -89,14 +89,10 @@ extern "C" {
#include "../resources/KDE.h"
};
// Constants
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
// Other Windows
wxCheatsWindow* CheatsWindow;
wxInfoWindow* InfoWindow;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create menu items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ -204,10 +200,10 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar);
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar"));
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
viewMenu->AppendCheckItem(IDM_TOGGLE_LOGWINDOW, _T("Show &Logwindow"));
viewMenu->Check(IDM_TOGGLE_LOGWINDOW, m_bLogWindow);
viewMenu->AppendCheckItem(IDM_TOGGLE_CONSOLE, _T("Show &Console"));
viewMenu->Check(IDM_TOGGLE_CONSOLE, SConfig::GetInstance().m_InterfaceConsole);
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow"));
viewMenu->Check(IDM_LOGWINDOW, m_bLogWindow);
viewMenu->AppendCheckItem(IDM_CONSOLE, _T("Show &Console"));
viewMenu->Check(IDM_CONSOLE, SConfig::GetInstance().m_InterfaceConsole);
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LISTWII, _T("Show Wii"));
@@ -327,7 +323,7 @@ void CFrame::RecreateToolbar()
/*
wxToolBarBase* ToolBar = GetToolBar();
long style = ToolBar ? ToolBar->GetWindowStyle() : TOOLBAR_STYLE;
long style = ToolBar ? ToolBar->GetWindowStyle() : wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
delete ToolBar;
SetToolBar(NULL);
@@ -437,8 +433,9 @@ void CFrame::InitBitmaps()
}
// Update in case the bitmap has been updated
if (GetToolBar() != NULL)
RecreateToolbar();
//if (GetToolBar() != NULL) RecreateToolbar();
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -861,15 +858,59 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// GUI
// Notebooks
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnResize(wxSizeEvent& event)
void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
{
// fit frame content, not needed right now
//FitInside();
// Override event
event.Veto();
DoMoveIcons(); // In FrameWiimote.cpp
event.Skip();
wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Log"))) { GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(false); DoToggleWindow(IDM_LOGWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); DoToggleWindow(IDM_REGISTERWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); DoToggleWindow(IDM_BREAKPOINTWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); DoToggleWindow(IDM_JITWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); DoToggleWindow(IDM_MEMORYWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); DoToggleWindow(IDM_SOUNDWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); DoToggleWindow(IDM_VIDEOWINDOW, false); }
}
void CFrame::HidePane()
{
if (m_NB0->GetPageCount() == 0)
m_Mgr->GetPane(wxT("Pane1")).Hide();
else
m_Mgr->GetPane(wxT("Pane1")).Show();
m_Mgr->Update();
SetSimplePaneSize();
}
void CFrame::DoRemovePage(wxWindow * Win, bool Hide)
{
// If m_dialog is NULL, then possibly the system
// didn't report the checked menu item status correctly.
// It should be true just after the menu item was selected,
// if there was no modeless dialog yet.
wxASSERT(Win != NULL);
if (Win)
{
if (m_NB0)
{
if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND) m_NB0->RemovePage(m_NB0->GetPageIndex(Win));
}
if (m_NB1)
{
if (m_NB1->GetPageIndex(Win) != wxNOT_FOUND) m_NB1->RemovePage(m_NB1->GetPageIndex(Win));
}
if (m_NB2)
{
if (m_NB2->GetPageIndex(Win) != wxNOT_FOUND) m_NB2->RemovePage(m_NB2->GetPageIndex(Win));
}
if (Hide) Win->Hide();
}
}
// Enable and disable the toolbar
@@ -906,41 +947,76 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
this->SendSizeEvent();
}
void CFrame::DoToggleWindow(int Id, bool Show)
{
switch (Id)
{
case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? m_NB1 : m_NB0); break;
case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, m_NB1); break;
case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(Show, m_NB0); break;
case IDM_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(Show, m_NB1); break;
case IDM_JITWINDOW: g_pCodeWindow->OnToggleJitWindow(Show, m_NB1); break;
case IDM_SOUNDWINDOW: g_pCodeWindow->OnToggleSoundWindow(Show, m_NB0); break;
case IDM_VIDEOWINDOW: g_pCodeWindow->OnToggleVideoWindow(Show, m_NB0); break;
}
}
// Enable and disable the log window
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
{
ToggleLogWindow(event.IsChecked());
DoToggleWindow(event.GetId(), event.IsChecked());
}
void CFrame::ToggleLogWindow(bool check)
void CFrame::ToggleLogWindow(bool Show, wxAuiNotebook * _NB)
{
SConfig::GetInstance().m_InterfaceLogWindow = check;
if (SConfig::GetInstance().m_InterfaceLogWindow)
m_LogWindow->Show();
SConfig::GetInstance().m_InterfaceLogWindow = Show;
if (Show)
{
if (!_NB) return;
if (m_LogWindow && _NB->GetPageIndex(m_LogWindow) != wxNOT_FOUND) return;
if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
_NB->AddPage(m_LogWindow, wxT("Log"), true, aNormalFile);
}
else
m_LogWindow->Hide();
{
DoRemovePage(m_LogWindow);
}
// Hide pane
if (!UseDebugger) HidePane();
// Make sure the check is updated (if wxw isn't calling this func)
GetMenuBar()->FindItem(IDM_TOGGLE_LOGWINDOW)->Check(check);
//GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(Show);
}
// Enable and disable the console
void CFrame::OnToggleConsole(wxCommandEvent& event)
{
ToggleConsole(event.IsChecked());
}
void CFrame::ToggleConsole(bool check)
void CFrame::ToggleConsole(bool Show, wxAuiNotebook * _NB)
{
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener();
SConfig::GetInstance().m_InterfaceConsole = check;
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
SConfig::GetInstance().m_InterfaceConsole = Show;
if (SConfig::GetInstance().m_InterfaceConsole)
console->Open();
Console->Open();
else
console->Close();
Console->Close();
// Make sure the check is updated (if wxw isn't calling this func)
GetMenuBar()->FindItem(IDM_TOGGLE_CONSOLE)->Check(check);
GetMenuBar()->FindItem(IDM_CONSOLE)->Check(Show);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// GUI
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnResize(wxSizeEvent& event)
{
// fit frame content, not needed right now
//FitInside();
DoMoveIcons(); // In FrameWiimote.cpp
event.Skip();
}
// Update the enabled/disabled status
+1 -2
View File
@@ -133,6 +133,7 @@ enum
// Views
IDM_FONTPICKER,
IDM_LOGWINDOW,
IDM_CONSOLE,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
@@ -183,8 +184,6 @@ enum
IDM_TOGGLE_SKIPIDLE,
IDM_TOGGLE_TOOLBAR,
IDM_TOGGLE_STATUSBAR,
IDM_TOGGLE_LOGWINDOW,
IDM_TOGGLE_CONSOLE,
IDM_NOTIFYMAPLOADED,
IDM_OPENCONTAININGFOLDER,
IDM_OPENSAVEFOLDER,
+2 -2
View File
@@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
END_EVENT_TABLE()
CLogWindow::CLogWindow(wxWindow* parent)
: wxDialog(parent, wxID_ANY, wxT("Log/Console"),
: wxDialog(parent, wxID_ANY, wxT("Log"),
wxPoint(100, 700), wxSize(800, 270),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
wxNO_BORDER)
, m_logSection(1)
{
m_logManager = LogManager::GetInstance();