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

View File

@ -46,15 +46,6 @@ BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame)
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated) EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
END_EVENT_TABLE() END_EVENT_TABLE()
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
{
wxMemoryInputStream is(data, length);
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
}
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)
: wxFrame(parent, id, title, position, size, style) : wxFrame(parent, id, title, position, size, style)
, m_BreakPointListView(NULL) , m_BreakPointListView(NULL)

View File

@ -76,13 +76,14 @@ class CPluginManager;
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
/*
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name)) #define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
{ {
wxMemoryInputStream is(data, length); wxMemoryInputStream is(data, length);
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1)); return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
} }
*/
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel) BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
@ -158,22 +159,20 @@ END_EVENT_TABLE()
// Class, input event handler and host message handler // Class, input event handler and host message handler
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *ParentObject, wxWindow* Parent,
wxWindowID id) wxWindowID Id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxT("Dolphin-Debugger")) : wxPanel(Parent, Id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxT("Dolphin-Debugger"))
, Parent(ParentObject)
/* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and /* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
things may crash */ things may crash */
, m_RegisterWindow(NULL) , m_RegisterWindow(NULL)
, m_BreakpointWindow(NULL) , m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL) , m_MemoryWindow(NULL)
, m_JitWindow(NULL) , m_JitWindow(NULL)
, m_ToolBarDebug(NULL), m_NB0(NULL), m_NB1(NULL)
{ {
// Load ini settings // Load ini settings
this->Load(); this->Load();
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
InitBitmaps(); InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter); CreateGUIControls(_LocalCoreStartupParameter);
@ -187,7 +186,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
wxKeyEventHandler(CCodeWindow::OnKeyDown), wxKeyEventHandler(CCodeWindow::OnKeyDown),
(wxObject*)0, this); (wxObject*)0, this);
} }
CCodeWindow::~CCodeWindow() CCodeWindow::~CCodeWindow()
{ {
@ -196,48 +194,24 @@ CCodeWindow::~CCodeWindow()
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
// Redirect old wxFrame calls // Redirect old wxFrame calls
// ------------ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxFrame *CCodeWindow::GetParentFrame()
{
wxFrame *Parent = wxDynamicCast(GetParent()->GetParent(), wxFrame);
return Parent;
}
wxMenuBar *CCodeWindow::GetMenuBar() wxMenuBar *CCodeWindow::GetMenuBar()
{ {
if (GetParentFrame()) return GetParentFrame()->GetMenuBar(); return Parent->GetMenuBar();
} }
wxAuiToolBar *CCodeWindow::GetToolBar() wxAuiToolBar *CCodeWindow::GetToolBar()
{ {
if (GetParentFrame()) return m_ToolBarDebug; return Parent->m_ToolBarDebug;
}
bool CCodeWindow::IsActive()
{
if (GetParentFrame()) return GetParentFrame()->IsActive();
}
void CCodeWindow::UpdateToolbar(wxAuiToolBar * _ToolBar2)
{
m_ToolBarDebug = _ToolBar2;
}
void CCodeWindow::UpdateNotebook(int _i, wxAuiNotebook * _NB)
{
if (_i == 0)
m_NB0 = _NB;
else
m_NB1 = _NB;
} }
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
void CCodeWindow::OnKeyDown(wxKeyEvent& event) void CCodeWindow::OnKeyDown(wxKeyEvent& event)
{ {
if ((event.GetKeyCode() == WXK_SPACE) && IsActive()) if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive())
{
SingleCPUStep(); SingleCPUStep();
}
else else
{
event.Skip(); event.Skip();
}
} }
void CCodeWindow::OnHostMessage(wxCommandEvent& event) void CCodeWindow::OnHostMessage(wxCommandEvent& event)
@ -688,7 +662,7 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
UpdateButtonStates(); UpdateButtonStates();
// Update all toolbars in the aui manager // Update all toolbars in the aui manager
UpdateManager(); Parent->UpdateGUI();
} }
@ -899,13 +873,6 @@ void CCodeWindow::UpdateButtonStates()
if (ToolBar) ToolBar->Realize(); if (ToolBar) ToolBar->Realize();
} }
// Update manager
void CCodeWindow::UpdateManager()
{
// Caution: This can cause an endless loop if this event comes back to this function
wxCommandEvent evnt(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
wxPostEvent(GetParentFrame(), evnt);
}
void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar) void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)
{ {
@ -926,10 +893,7 @@ void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)
} }
// Show Tool Tip for menu items // Show Tool Tip for menu items
void CCodeWindow::DoTip(wxString text) void CCodeWindow::DoTip(wxString text)
{ {
// Create a blank tooltip to clear the eventual old one // Create a blank tooltip to clear the eventual old one

View File

@ -30,7 +30,9 @@
// GUI global // GUI global
#include "../../DolphinWX/Src/Globals.h" #include "../../DolphinWX/Src/Globals.h"
#include "../../DolphinWX/Src/Frame.h"
class CFrame;
class CRegisterWindow; class CRegisterWindow;
class CBreakPointWindow; class CBreakPointWindow;
class CMemoryWindow; class CMemoryWindow;
@ -42,7 +44,7 @@ class CCodeWindow
{ {
public: public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *, wxWindow* parent,
wxWindowID id = wxID_ANY); wxWindowID id = wxID_ANY);
/* /*
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
@ -57,20 +59,14 @@ class CCodeWindow
void Load(); void Load();
void Save(); void Save();
// Function redirection and parent interaction // Parent interaction
wxFrame *GetParentFrame(); CFrame *Parent;
wxMenuBar * GetMenuBar(); wxMenuBar * GetMenuBar();
wxAuiToolBar * GetToolBar(), * m_ToolBarDebug; wxAuiToolBar * GetToolBar();
wxAuiNotebook *m_NB0, *m_NB1;
bool IsActive();
void UpdateToolbar(wxAuiToolBar *);
void UpdateNotebook(int, wxAuiNotebook *);
wxBitmap aNormalFile;
#ifdef _WIN32 #ifdef _WIN32
wxWindow * GetWxWindow(wxString); wxWindow * GetWxWindow(wxString);
#endif #endif
wxWindow * GetNootebookPage(wxString); wxWindow * GetNootebookPage(wxString);
void DoToggleWindow(int,bool);
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax]; wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter(); bool UseInterpreter();
@ -89,6 +85,15 @@ class CCodeWindow
void UpdateButtonStates(); void UpdateButtonStates();
void OpenPages(); void OpenPages();
void UpdateManager(); void UpdateManager();
void OnToggleWindow(wxCommandEvent& event);
void OnToggleRegisterWindow(bool,wxAuiNotebook*);
void OnToggleBreakPointWindow(bool,wxAuiNotebook*);
void OnToggleMemoryWindow(bool,wxAuiNotebook*);
void OnToggleJitWindow(bool,wxAuiNotebook*);
void OnToggleSoundWindow(bool,wxAuiNotebook*);
void OnToggleVideoWindow(bool,wxAuiNotebook*);
void OnChangeFont(wxCommandEvent& event);
// Sub dialogs // Sub dialogs
wxMenuBar* pMenuBar; wxMenuBar* pMenuBar;
@ -127,17 +132,7 @@ class CCodeWindow
void OnCodeViewChange(wxCommandEvent &event); void OnCodeViewChange(wxCommandEvent &event);
void SingleCPUStep(); void SingleCPUStep();
void OnAddrBoxChange(wxCommandEvent& event); void OnAddrBoxChange(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnToggleRegisterWindow(bool,wxAuiNotebook*);
void OnToggleBreakPointWindow(bool,wxAuiNotebook*);
void OnToggleMemoryWindow(bool,wxAuiNotebook*);
void OnToggleJitWindow(bool,wxAuiNotebook*);
void OnToggleSoundWindow(bool,wxAuiNotebook*);
void OnToggleVideoWindow(bool,wxAuiNotebook*);
void OnChangeFont(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event); void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event);

View File

@ -327,15 +327,15 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxWindow * CCodeWindow::GetNootebookPage(wxString Name) wxWindow * CCodeWindow::GetNootebookPage(wxString Name)
{ {
if (!m_NB0 || !m_NB1) return NULL; if (!Parent->m_NB0 || !Parent->m_NB1) return NULL;
for(u32 i = 0; i <= m_NB0->GetPageCount(); i++) for(u32 i = 0; i <= Parent->m_NB0->GetPageCount(); i++)
{ {
if (m_NB0->GetPageText(i).IsSameAs(Name)) return m_NB0->GetPage(i); if (Parent->m_NB0->GetPageText(i).IsSameAs(Name)) return Parent->m_NB0->GetPage(i);
} }
for(u32 i = 0; i <= m_NB1->GetPageCount(); i++) for(u32 i = 0; i <= Parent->m_NB1->GetPageCount(); i++)
{ {
if (m_NB1->GetPageText(i).IsSameAs(Name)) return m_NB1->GetPage(i); if (Parent->m_NB1->GetPageText(i).IsSameAs(Name)) return Parent->m_NB1->GetPage(i);
} }
return NULL; return NULL;
} }
@ -350,13 +350,13 @@ wxWindow * CCodeWindow::GetWxWindow(wxString Name)
Win->AdoptAttributesFromHWND(); Win->AdoptAttributesFromHWND();
return Win; return Win;
} }
else if (GetParent()->GetParent()->FindWindowByName(Name)) else if (Parent->FindWindowByName(Name))
{ {
return GetParent()->GetParent()->FindWindowByName(Name); return Parent->FindWindowByName(Name);
} }
else if (GetParent()->GetParent()->FindWindowByLabel(Name)) else if (Parent->FindWindowByLabel(Name))
{ {
return GetParent()->GetParent()->FindWindowByLabel(Name); return Parent->FindWindowByLabel(Name);
} }
else if (GetNootebookPage(Name)) else if (GetNootebookPage(Name))
{ {
@ -368,82 +368,39 @@ wxWindow * CCodeWindow::GetWxWindow(wxString Name)
#endif #endif
void CCodeWindow::OpenPages() void CCodeWindow::OpenPages()
{ {
if (bRegisterWindow) OnToggleRegisterWindow(true, m_NB0); if (bRegisterWindow) Parent->DoToggleWindow(IDM_REGISTERWINDOW, true);
if (bBreakpointWindow) OnToggleBreakPointWindow(true, m_NB1); if (bBreakpointWindow) Parent->DoToggleWindow(IDM_BREAKPOINTWINDOW, true);
if (bMemoryWindow) OnToggleMemoryWindow(true, m_NB0); if (bMemoryWindow) Parent->DoToggleWindow(IDM_MEMORYWINDOW, true);
if (bJitWindow) OnToggleJitWindow(true, m_NB0); if (bJitWindow) Parent->DoToggleWindow(IDM_JITWINDOW, true);
if (bSoundWindow) OnToggleSoundWindow(true, m_NB1); if (bSoundWindow) Parent->DoToggleWindow(IDM_SOUNDWINDOW, true);
if (bVideoWindow) OnToggleVideoWindow(true, m_NB1); if (bVideoWindow) Parent->DoToggleWindow(IDM_VIDEOWINDOW, true);
} }
void CCodeWindow::OnToggleWindow(wxCommandEvent& event) void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{ {
DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId())); Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
}
void CCodeWindow::DoToggleWindow(int Id, bool Show)
{
switch (Id)
{
case IDM_REGISTERWINDOW: OnToggleRegisterWindow(Show, m_NB0); break;
case IDM_BREAKPOINTWINDOW: OnToggleBreakPointWindow(Show, m_NB1); break;
case IDM_MEMORYWINDOW: OnToggleMemoryWindow(Show, m_NB0); break;
case IDM_JITWINDOW: OnToggleJitWindow(Show, m_NB0); break;
case IDM_SOUNDWINDOW: OnToggleSoundWindow(Show, m_NB1); break;
case IDM_VIDEOWINDOW: OnToggleVideoWindow(Show, m_NB1); break;
}
} }
void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB) void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB)
{ {
if (Show) if (Show)
{ {
if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return; if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return;
if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(GetParent()->GetParent()); if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent);
_NB->AddPage(m_RegisterWindow, wxT("Registers"), true, aNormalFile ); _NB->AddPage(m_RegisterWindow, wxT("Registers"), true, Parent->aNormalFile );
} }
else // hide else // hide
{ Parent->DoRemovePage (m_RegisterWindow);
// 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(m_RegisterWindow != NULL);
//if (m_RegisterWindow) m_RegisterWindow->Hide();
if (m_RegisterWindow)
{
if (m_NB0->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(m_RegisterWindow));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(m_RegisterWindow));
m_RegisterWindow->Hide();
}
}
} }
void CCodeWindow::OnToggleBreakPointWindow(bool Show, wxAuiNotebook * _NB) void CCodeWindow::OnToggleBreakPointWindow(bool Show, wxAuiNotebook * _NB)
{ {
if (Show) if (Show)
{ {
if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return; if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return;
if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, GetParent()->GetParent()); if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent);
_NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, aNormalFile ); _NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, Parent->aNormalFile );
} }
else // hide else // hide
{ Parent->DoRemovePage(m_BreakpointWindow);
// 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(m_BreakpointWindow != NULL);
if (m_BreakpointWindow)
{
if (m_NB0->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(m_BreakpointWindow));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(m_BreakpointWindow));
m_BreakpointWindow->Hide();
}
}
} }
void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB) void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB)
@ -451,26 +408,11 @@ void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB)
if (Show) if (Show)
{ {
if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return; if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return;
if (!m_JitWindow) m_JitWindow = new CJitWindow(GetParent()->GetParent()); if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent);
_NB->AddPage(m_JitWindow, wxT("JIT"), true, aNormalFile ); _NB->AddPage(m_JitWindow, wxT("JIT"), true, Parent->aNormalFile );
} }
else // hide else // hide
{ Parent->DoRemovePage(m_JitWindow);
// 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(m_JitWindow != NULL);
if (m_JitWindow)
{
if (m_NB0->GetPageIndex(m_JitWindow) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(m_JitWindow));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(m_JitWindow));
m_JitWindow->Hide();
}
}
} }
@ -479,26 +421,11 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB)
if (Show) if (Show)
{ {
if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return; if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return;
if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(GetParent()->GetParent()); if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent);
_NB->AddPage(m_MemoryWindow, wxT("Memory"), true, aNormalFile ); _NB->AddPage(m_MemoryWindow, wxT("Memory"), true, Parent->aNormalFile );
} }
else // hide else // hide
{ Parent->DoRemovePage(m_MemoryWindow);
// 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(m_MemoryWindow != NULL);
if (m_MemoryWindow)
{
if (m_NB0->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(m_MemoryWindow));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(m_MemoryWindow));
m_MemoryWindow->Hide();
}
}
} }
//Toggle Sound Debugging Window //Toggle Sound Debugging Window
@ -516,7 +443,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
#endif #endif
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str()); //Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str());
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetParent()->GetParent()->GetHandle(), Parent->GetHandle(),
//GetHandle(), //GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show PLUGIN_TYPE_DSP, true // DSP, show
@ -528,7 +455,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
if (Win) if (Win)
{ {
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str()); //Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
_NB->AddPage(Win, wxT("Sound"), true, aNormalFile ); _NB->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
} }
#endif #endif
} }
@ -536,13 +463,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
{ {
#ifdef _WIN32 #ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Sound")); wxWindow *Win = GetWxWindow(wxT("Sound"));
if (Win) Parent->DoRemovePage (Win, false);
{
if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(Win));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(Win));
}
#endif #endif
// Close the sound dll that has an open debugger // Close the sound dll that has an open debugger
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
@ -568,7 +489,7 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
#endif #endif
// Show and/or create the window // Show and/or create the window
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show PLUGIN_TYPE_VIDEO, true // Video, show
); );
@ -576,20 +497,14 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
} }
Win = GetWxWindow(wxT("Video")); Win = GetWxWindow(wxT("Video"));
if (Win) _NB->AddPage(Win, wxT("Video"), true, aNormalFile ); if (Win) _NB->AddPage(Win, wxT("Video"), true, Parent->aNormalFile );
#endif #endif
} }
else // hide else // hide
{ {
#ifdef _WIN32 #ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Video")); wxWindow *Win = GetWxWindow(wxT("Video"));
if (Win) Parent->DoRemovePage (Win, false);
{
if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND)
m_NB0->RemovePage(m_NB0->GetPageIndex(Win));
else
m_NB1->RemovePage(m_NB1->GetPageIndex(Win));
}
#endif #endif
// Close the video dll that has an open debugger // Close the video dll that has an open debugger
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(

View File

@ -263,8 +263,8 @@ EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow) EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_TOGGLE_CONSOLE, CFrame::OnToggleConsole) EVT_MENU(IDM_CONSOLE, CFrame::OnToggleConsole)
EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged) EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged) EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
@ -319,7 +319,8 @@ CFrame::CFrame(bool showLogWindow,
bool _UseDebugger, bool _UseDebugger,
long style) long style)
: wxFrame(parent, id, title, pos, size, 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) , m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL) , HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow) , m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
@ -333,7 +334,7 @@ CFrame::CFrame(bool showLogWindow,
if (UseDebugger) this->Maximize(true); if (UseDebugger) this->Maximize(true);
// Debugger class // Debugger class
if (UseDebugger) if (UseDebugger)
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this); g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
// Create timer // Create timer
#if wxUSE_TIMER #if wxUSE_TIMER
@ -341,7 +342,7 @@ CFrame::CFrame(bool showLogWindow,
m_timer.Start( floor((double)(1000 / TimesPerSecond)) ); m_timer.Start( floor((double)(1000 / TimesPerSecond)) );
#endif #endif
// Create toolbar bitmaps // Create toolbar bitmaps
InitBitmaps(); InitBitmaps();
// Give it an icon // Give it an icon
@ -357,29 +358,25 @@ CFrame::CFrame(bool showLogWindow,
// Give it a menu bar // Give it a menu bar
CreateMenu(); CreateMenu();
// Give it a console
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener();
if (SConfig::GetInstance().m_InterfaceConsole)
console->Open();
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Panels // Panels
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
m_Panel = new CPanel(this, IDM_MPANEL); m_Panel = new CPanel(this, IDM_MPANEL);
//wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY); //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) 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_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB1 = 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_NB2 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile); m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
}
g_pCodeWindow->UpdateNotebook(0, m_NB0); else
g_pCodeWindow->UpdateNotebook(1, m_NB1); {
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -394,7 +391,17 @@ CFrame::CFrame(bool showLogWindow,
m_Mgr = new wxAuiManager(); m_Mgr = new wxAuiManager();
m_Mgr->SetManagedWindow(this); m_Mgr->SetManagedWindow(this);
// Window perspectives
// Normal perspectives
/*
----------
| Pane 0 |
----------
-------------------
| Pane 0 | Pane 1 |
-------------------
*/
// Debug perspectives
/* /*
------------------- -------------------
| Pane 0 | | | Pane 0 | |
@ -419,22 +426,20 @@ CFrame::CFrame(bool showLogWindow,
else else
{ {
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide()); 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 // Create toolbar
RecreateToolbar(); RecreateToolbar();
if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false); 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("Pane0")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true);
*/
if (UseDebugger) if (UseDebugger)
{ {
@ -442,15 +447,15 @@ CFrame::CFrame(bool showLogWindow,
m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false); m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective(); AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).Layer(0).Center().Position(0); m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(0);
m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).Layer(0).Center().Position(1); m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(1);
m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).Layer(0).Right(); m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Right();
AuiPerspective.Add(m_Mgr->SavePerspective()); AuiPerspective.Add(m_Mgr->SavePerspective());
m_Mgr->GetPane(wxT("Pane0")).Left(); m_Mgr->GetPane(wxT("Pane0")).Left();
m_Mgr->GetPane(wxT("Pane1")).Left(); m_Mgr->GetPane(wxT("Pane1")).Left();
m_Mgr->GetPane(wxT("Pane2")).Center(); 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()); AuiPerspective.Add(m_Mgr->SavePerspective());
// Load perspective // Load perspective
@ -465,8 +470,9 @@ CFrame::CFrame(bool showLogWindow,
} }
else 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(); AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
} }
// Show window // Show window
@ -477,6 +483,13 @@ CFrame::CFrame(bool showLogWindow,
// Open notebook pages // Open notebook pages
if (UseDebugger) g_pCodeWindow->OpenPages(); 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: //if we are ever going back to optional iso caching:
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache); //m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
@ -552,7 +565,6 @@ void CFrame::OnClose(wxCloseEvent& event)
UpdateGUI(); UpdateGUI();
} }
} }
void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{ {
event.Skip(); 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 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) 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) void CFrame::DoFullscreen(bool _F)
{ {
@ -591,50 +588,64 @@ void CFrame::DoFullscreen(bool _F)
m_Mgr->LoadPerspective(AuiCurrent, true); m_Mgr->LoadPerspective(AuiCurrent, true);
} }
} }
void CFrame::SetSimplePaneSize()
void CFrame::DoLoadPerspective(int i)
{ {
//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 int _iRightWidth, iClientSize = this->GetSize().GetX();
if (iLeftWidth[0] > 95) iLeftWidth[0] = 95; if (iLeftWidth[0] < 5) iLeftWidth[0] = 5; wxArrayInt i, j;
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;
// Set the size // Set the size
if (i == 0) if (Perspective == 0)
{ {
_iLeftWidth = iClientSize * (float)(iLeftWidth[0]/100.0); _iRightWidth = 100 - iLeftWidth[0];
_iRightWidth = iClientSize - _iLeftWidth; i.Add(0); j.Add(iLeftWidth[0]);
i.Add(2); j.Add(_iRightWidth);
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("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 else
{ {
_iLeftWidth = iClientSize * (float)(iLeftWidth[1]/100.0); _iRightWidth = 100 - iLeftWidth[1] - iMidWidth[1];
_iMidWidth = iClientSize * (float)(iMidWidth[1]/100.0); i.Add(0); j.Add(iLeftWidth[1]);
_iRightWidth = iClientSize - _iLeftWidth - _iMidWidth; 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("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("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("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
} }
SetPaneSize(i, j);
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);
} }
void CFrame::Save() void CFrame::Save()
{ {

View File

@ -68,13 +68,14 @@ class CFrame : public wxFrame
// These have to be public // These have to be public
wxStatusBar* m_pStatusBar; wxStatusBar* m_pStatusBar;
CCodeWindow* g_pCodeWindow;
wxBitmap aNormalFile;
void InitBitmaps(); void InitBitmaps();
void DoStop(); void DoStop();
bool bRenderToMain; bool bRenderToMain;
void UpdateGUI(); void UpdateGUI();
void ToggleLogWindow(bool check); void ToggleLogWindow(bool, wxAuiNotebook * _NB = NULL);
void ToggleConsole(bool check); void ToggleConsole(bool, wxAuiNotebook * _NB = NULL);
CCodeWindow* g_pCodeWindow;
void PostEvent(wxCommandEvent& event); void PostEvent(wxCommandEvent& event);
void PostMenuEvent(wxMenuEvent& event); void PostMenuEvent(wxMenuEvent& event);
void PostUpdateUIEvent(wxUpdateUIEvent& event); void PostUpdateUIEvent(wxUpdateUIEvent& event);
@ -96,17 +97,6 @@ class CFrame : public wxFrame
u8 g_Speakers[3]; u8 g_Speakers_[3]; 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 // AUI
wxAuiManager *m_Mgr; wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
@ -117,9 +107,25 @@ class CFrame : public wxFrame
wxArrayString AuiPerspective; wxArrayString AuiPerspective;
void OnNotebookPageClose(wxAuiNotebookEvent& event); void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event); void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void DoToggleWindow(int,bool);
void DoRemovePage(wxWindow *, bool Hide = true);
void DoLoadPerspective(int); void DoLoadPerspective(int);
void HidePane();
void SetSimplePaneSize();
void SetPaneSize(wxArrayInt,wxArrayInt);
void Save(); 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; char **drives;
enum EToolbar enum EToolbar

View File

@ -89,14 +89,10 @@ extern "C" {
#include "../resources/KDE.h" #include "../resources/KDE.h"
}; };
// Constants
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
// Other Windows // Other Windows
wxCheatsWindow* CheatsWindow; wxCheatsWindow* CheatsWindow;
wxInfoWindow* InfoWindow; wxInfoWindow* InfoWindow;
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create menu items // Create menu items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -204,10 +200,10 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar); viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar);
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar")); viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar"));
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar); viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
viewMenu->AppendCheckItem(IDM_TOGGLE_LOGWINDOW, _T("Show &Logwindow")); viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow"));
viewMenu->Check(IDM_TOGGLE_LOGWINDOW, m_bLogWindow); viewMenu->Check(IDM_LOGWINDOW, m_bLogWindow);
viewMenu->AppendCheckItem(IDM_TOGGLE_CONSOLE, _T("Show &Console")); viewMenu->AppendCheckItem(IDM_CONSOLE, _T("Show &Console"));
viewMenu->Check(IDM_TOGGLE_CONSOLE, SConfig::GetInstance().m_InterfaceConsole); viewMenu->Check(IDM_CONSOLE, SConfig::GetInstance().m_InterfaceConsole);
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LISTWII, _T("Show Wii")); viewMenu->AppendCheckItem(IDM_LISTWII, _T("Show Wii"));
@ -327,7 +323,7 @@ void CFrame::RecreateToolbar()
/* /*
wxToolBarBase* ToolBar = GetToolBar(); wxToolBarBase* ToolBar = GetToolBar();
long style = ToolBar ? ToolBar->GetWindowStyle() : TOOLBAR_STYLE; long style = ToolBar ? ToolBar->GetWindowStyle() : wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
delete ToolBar; delete ToolBar;
SetToolBar(NULL); SetToolBar(NULL);
@ -437,8 +433,9 @@ void CFrame::InitBitmaps()
} }
// Update in case the bitmap has been updated // Update in case the bitmap has been updated
if (GetToolBar() != NULL) //if (GetToolBar() != NULL) RecreateToolbar();
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 // Override event
//FitInside(); event.Veto();
DoMoveIcons(); // In FrameWiimote.cpp wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
event.Skip();
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 // Enable and disable the toolbar
@ -906,41 +947,76 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
this->SendSizeEvent(); 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 // Enable and disable the log window
void CFrame::OnToggleLogWindow(wxCommandEvent& event) void CFrame::OnToggleLogWindow(wxCommandEvent& event)
{ {
ToggleLogWindow(event.IsChecked()); DoToggleWindow(event.GetId(), event.IsChecked());
} }
void CFrame::ToggleLogWindow(bool Show, wxAuiNotebook * _NB)
void CFrame::ToggleLogWindow(bool check)
{ {
SConfig::GetInstance().m_InterfaceLogWindow = check; SConfig::GetInstance().m_InterfaceLogWindow = Show;
if (SConfig::GetInstance().m_InterfaceLogWindow) if (Show)
m_LogWindow->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 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) // 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 // Enable and disable the console
void CFrame::OnToggleConsole(wxCommandEvent& event) void CFrame::OnToggleConsole(wxCommandEvent& event)
{ {
ToggleConsole(event.IsChecked()); ToggleConsole(event.IsChecked());
} }
void CFrame::ToggleConsole(bool Show, wxAuiNotebook * _NB)
void CFrame::ToggleConsole(bool check)
{ {
ConsoleListener *console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
SConfig::GetInstance().m_InterfaceConsole = check; SConfig::GetInstance().m_InterfaceConsole = Show;
if (SConfig::GetInstance().m_InterfaceConsole) if (SConfig::GetInstance().m_InterfaceConsole)
console->Open(); Console->Open();
else else
console->Close(); Console->Close();
// Make sure the check is updated (if wxw isn't calling this func) // 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 // Update the enabled/disabled status

View File

@ -133,6 +133,7 @@ enum
// Views // Views
IDM_FONTPICKER, IDM_FONTPICKER,
IDM_LOGWINDOW, IDM_LOGWINDOW,
IDM_CONSOLE,
IDM_REGISTERWINDOW, IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW, IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW, IDM_MEMORYWINDOW,
@ -183,8 +184,6 @@ enum
IDM_TOGGLE_SKIPIDLE, IDM_TOGGLE_SKIPIDLE,
IDM_TOGGLE_TOOLBAR, IDM_TOGGLE_TOOLBAR,
IDM_TOGGLE_STATUSBAR, IDM_TOGGLE_STATUSBAR,
IDM_TOGGLE_LOGWINDOW,
IDM_TOGGLE_CONSOLE,
IDM_NOTIFYMAPLOADED, IDM_NOTIFYMAPLOADED,
IDM_OPENCONTAININGFOLDER, IDM_OPENCONTAININGFOLDER,
IDM_OPENSAVEFOLDER, IDM_OPENSAVEFOLDER,

View File

@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
END_EVENT_TABLE() END_EVENT_TABLE()
CLogWindow::CLogWindow(wxWindow* parent) CLogWindow::CLogWindow(wxWindow* parent)
: wxDialog(parent, wxID_ANY, wxT("Log/Console"), : wxDialog(parent, wxID_ANY, wxT("Log"),
wxPoint(100, 700), wxSize(800, 270), wxPoint(100, 700), wxSize(800, 270),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxNO_BORDER)
, m_logSection(1) , m_logSection(1)
{ {
m_logManager = LogManager::GetInstance(); m_logManager = LogManager::GetInstance();