More work on the FrameAui:

Added a default perspective for the debugger.
Save all perspectives, and not just the active one.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5979 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-07-26 03:46:14 +00:00
parent 37217d7857
commit 0eaa7352fd
16 changed files with 425 additions and 496 deletions

View File

@ -26,7 +26,6 @@
#include "FileUtil.h"
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
EVT_CLOSE(CBreakPointWindow::OnClose)
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
EVT_LIST_ITEM_SELECTED(ID_TOOLBAR, CBreakPointWindow::OnSelectItem)
END_EVENT_TABLE()
@ -84,11 +83,6 @@ void CBreakPointWindow::OnSelectItem(wxListEvent& event)
}
}
void CBreakPointWindow::OnClose(wxCloseEvent& /*event*/)
{
Hide();
}
void CBreakPointWindow::NotifyUpdate()
{
if (m_BreakPointListView != NULL) m_BreakPointListView->Update();
@ -115,7 +109,6 @@ void CBreakPointWindow::OnActivated(wxListEvent& event)
}
}
// Breakpoint actions
// ---------------------
@ -126,12 +119,14 @@ void CBreakPointWindow::OnClear()
PowerPC::memchecks.Clear();
NotifyUpdate();
}
// Add one breakpoint
void CBreakPointWindow::OnAddBreakPoint()
{
BreakPointDlg bpDlg(this, this);
bpDlg.ShowModal();
}
// Load breakpoints from file
void CBreakPointWindow::OnAddBreakPointMany()
{
@ -168,7 +163,6 @@ void CBreakPointWindow::OnAddBreakPointMany()
}
// Memory check actions
// ---------------------
void

View File

@ -75,7 +75,6 @@ class CBreakPointWindow
void CreateGUIControls();
void OnSelectItem(wxListEvent& event);
void OnClose(wxCloseEvent& event);
void OnActivated(wxListEvent& event);
};

View File

@ -100,13 +100,6 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleWindow) // View
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
@ -392,10 +385,8 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
// Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar * _pMenuBar)
wxMenuBar *pMenuBar)
{
pMenuBar = _pMenuBar;
// CPU Mode
wxMenu* pCoreMenu = new wxMenu;
@ -448,39 +439,16 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pMenuBar->Append(pCoreMenu, _T("&JIT"));
CreateMenuSymbols();
CreateMenuSymbols(pMenuBar);
}
// Create View menu
void CCodeWindow::CreateMenuView(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
void CCodeWindow::CreateMenuOptions(wxMenu* pMenu)
{
wxMenuItem* pRegister = _pMenu->Append(IDM_REGISTERWINDOW, _T("&Registers"),
wxEmptyString, wxITEM_CHECK);
pRegister->Check(bRegisterWindow);
wxMenuItem* pBreakPoints = _pMenu->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"),
wxEmptyString, wxITEM_CHECK);
pBreakPoints->Check(bBreakpointWindow);
wxMenuItem* pMemory = _pMenu->Append(IDM_MEMORYWINDOW, _T("&Memory"),
wxEmptyString, wxITEM_CHECK);
pMemory->Check(bMemoryWindow);
wxMenuItem* pJit = _pMenu->Append(IDM_JITWINDOW, _T("&Jit"),
wxEmptyString, wxITEM_CHECK);
pJit->Check(bJitWindow);
wxMenuItem* pSound = _pMenu->Append(IDM_SOUNDWINDOW, _T("&Sound"),
wxEmptyString, wxITEM_CHECK);
pSound->Check(bSoundWindow);
wxMenuItem* pVideo = _pMenu->Append(IDM_VIDEOWINDOW, _T("&Video"),
wxEmptyString, wxITEM_CHECK);
pVideo->Check(bVideoWindow);
}
void CCodeWindow::CreateMenuOptions(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
{
wxMenuItem* boottopause = _pMenu->Append(IDM_BOOTTOPAUSE, _T("Boot to pause"),
wxMenuItem* boottopause = pMenu->Append(IDM_BOOTTOPAUSE, _T("Boot to pause"),
wxT("Start the game directly instead of booting to pause"), wxITEM_CHECK);
boottopause->Check(bBootToPause);
wxMenuItem* automaticstart = _pMenu->Append(IDM_AUTOMATICSTART, _T("&Automatic start")
wxMenuItem* automaticstart = pMenu->Append(IDM_AUTOMATICSTART, _T("&Automatic start")
, wxString::FromAscii(
"Automatically load the Default ISO when Dolphin starts, or the last game you loaded,"
" if you have not given it an elf file with the --elf command line. [This can be"
@ -490,7 +458,7 @@ void CCodeWindow::CreateMenuOptions(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
, wxITEM_CHECK);
automaticstart->Check(bAutomaticStart);
_pMenu->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
pMenu->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
}
// CPU Mode and JIT Menu

View File

@ -71,10 +71,9 @@ class CCodeWindow
void Update();
void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar * pMenuBar);
void CreateMenuView(wxMenuBar * pMenuBar, wxMenu*);
void CreateMenuOptions(wxMenuBar * pMenuBar, wxMenu*);
void CreateMenuSymbols();
wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxAuiToolBar*);
void PopulateToolbar(wxAuiToolBar* toolBar);
void UpdateButtonStates();
@ -86,7 +85,6 @@ class CCodeWindow
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void ToggleCodeWindow(bool bShow);
void ToggleRegisterWindow(bool bShow);
void ToggleBreakPointWindow(bool bShow);
@ -103,7 +101,6 @@ class CCodeWindow
void OnProfilerMenu(wxCommandEvent& event);
// Sub dialogs
wxMenuBar* pMenuBar;
CRegisterWindow* m_RegisterWindow;
CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow;
@ -111,15 +108,8 @@ class CCodeWindow
// Settings
bool bAutomaticStart; bool bBootToPause;
int iLogWindow;
int iConsoleWindow;
bool bCodeWindow; int iCodeWindow;
bool bRegisterWindow; int iRegisterWindow;
bool bBreakpointWindow; int iBreakpointWindow;
bool bMemoryWindow; int iMemoryWindow;
bool bJitWindow; int iJitWindow;
bool bSoundWindow; int iSoundWindow;
bool bVideoWindow; int iVideoWindow;
bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
private:
@ -158,8 +148,6 @@ class CCodeWindow
wxMenuItem* jitpoff;
wxMenuItem* jitsroff;
std::string fontDesc;
CCodeView* codeview;
wxListBox* callstack;
wxListBox* symbols;

View File

@ -79,47 +79,42 @@ void CCodeWindow::Load()
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// The font to override DebuggerFont with
ini.Get("ShowOnStart", "DebuggerFont", &fontDesc);
std::string fontDesc;
ini.Get("General", "DebuggerFont", &fontDesc);
if (!fontDesc.empty())
DebuggerFont.SetNativeFontInfoUserDesc(wxString::FromAscii(fontDesc.c_str()));
// Decide what windows to use
// This stuff really doesn't belong in CodeWindow anymore, does it? It should be
// in Frame.cpp somewhere, even though it's debugger stuff.
ini.Get("ShowOnStart", "Code", &bCodeWindow, true);
ini.Get("ShowOnStart", "Registers", &bRegisterWindow, false);
ini.Get("ShowOnStart", "Breakpoints", &bBreakpointWindow, false);
ini.Get("ShowOnStart", "Memory", &bMemoryWindow, false);
ini.Get("ShowOnStart", "JIT", &bJitWindow, false);
ini.Get("ShowOnStart", "Sound", &bSoundWindow, false);
ini.Get("ShowOnStart", "Video", &bVideoWindow, false);
// Get notebook affiliation
std::string _Section = StringFromFormat("P - %s",
(Parent->ActivePerspective < Parent->Perspectives.size())
? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
ini.Get(_Section.c_str(), "Log", &iLogWindow, 1);
ini.Get(_Section.c_str(), "Console", &iConsoleWindow, 1);
ini.Get(_Section.c_str(), "Code", &iCodeWindow, 1);
ini.Get(_Section.c_str(), "Registers", &iRegisterWindow, 1);
ini.Get(_Section.c_str(), "Breakpoints", &iBreakpointWindow, 0);
ini.Get(_Section.c_str(), "Memory", &iMemoryWindow, 1);
ini.Get(_Section.c_str(), "JIT", &iJitWindow, 1);
ini.Get(_Section.c_str(), "Sound", &iSoundWindow, 0);
ini.Get(_Section.c_str(), "Video", &iVideoWindow, 0);
// Get floating setting
ini.Get("Float", "Log", &Parent->bFloatWindow[0], false);
ini.Get("Float", "Console", &Parent->bFloatWindow[1], false);
ini.Get("Float", "Code", &Parent->bFloatWindow[2], false);
ini.Get("Float", "Registers", &Parent->bFloatWindow[3], false);
ini.Get("Float", "Breakpoints", &Parent->bFloatWindow[4], false);
ini.Get("Float", "Memory", &Parent->bFloatWindow[5], false);
ini.Get("Float", "JIT", &Parent->bFloatWindow[6], false);
ini.Get("Float", "Sound", &Parent->bFloatWindow[7], false);
ini.Get("Float", "Video", &Parent->bFloatWindow[8], false);
// Boot to pause or not
ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false);
ini.Get("ShowOnStart", "BootToPause", &bBootToPause, true);
ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
ini.Get("General", "BootToPause", &bBootToPause, true);
const char* SettingName[] = {
"Log",
"Console",
"Registers",
"Breakpoints",
"Memory",
"JIT",
"Sound",
"Video",
"Code"
};
// Decide what windows to show
for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++)
ini.Get("ShowOnStart", SettingName[i], &bShowOnStart[i], false);
// Get notebook affiliation
std::string _Section = "P - " +
((Parent->ActivePerspective < Parent->Perspectives.size())
? Parent->Perspectives.at(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);
// Get floating setting
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
ini.Get("Float", SettingName[i], &Parent->bFloatWindow[i], false);
}
void CCodeWindow::Save()
@ -127,49 +122,44 @@ void CCodeWindow::Save()
IniFile ini;
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Set("ShowOnStart", "DebuggerFont", fontDesc);
ini.Set("General", "DebuggerFont",
std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
// Boot to pause or not
ini.Set("ShowOnStart", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
ini.Set("ShowOnStart", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
ini.Set("General", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
const char* SettingName[] = {
"Log",
"Console",
"Registers",
"Breakpoints",
"Memory",
"JIT",
"Sound",
"Video",
"Code"
};
// Save windows settings
//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));
std::string _Section = StringFromFormat("P - %s",
(Parent->ActivePerspective < Parent->Perspectives.size())
? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
ini.Set(_Section.c_str(), "Log", iLogWindow);
ini.Set(_Section.c_str(), "Console", iConsoleWindow);
ini.Set(_Section.c_str(), "Code", iCodeWindow);
ini.Set(_Section.c_str(), "Registers", iRegisterWindow);
ini.Set(_Section.c_str(), "Breakpoints", iBreakpointWindow);
ini.Set(_Section.c_str(), "Memory", iMemoryWindow);
ini.Set(_Section.c_str(), "JIT", iJitWindow);
ini.Set(_Section.c_str(), "Sound", iSoundWindow);
ini.Set(_Section.c_str(), "Video", iVideoWindow);
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
ini.Set("ShowOnStart", SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i));
// Save notebook affiliations
std::string _Section = "P - " + Parent->Perspectives.at(Parent->ActivePerspective).Name;
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
ini.Set(_Section.c_str(), SettingName[i], iNbAffiliation[i]);
// Save floating setting
ini.Set("Float", "Log", !!FindWindowById(IDM_LOGWINDOW_PARENT));
ini.Set("Float", "Console", !!FindWindowById(IDM_CONSOLEWINDOW_PARENT));
ini.Set("Float", "Code", !!FindWindowById(IDM_CODEWINDOW_PARENT));
ini.Set("Float", "Registers", !!FindWindowById(IDM_REGISTERWINDOW_PARENT));
ini.Set("Float", "Breakpoints", !!FindWindowById(IDM_BREAKPOINTWINDOW_PARENT));
ini.Set("Float", "Memory", !!FindWindowById(IDM_MEMORYWINDOW_PARENT));
ini.Set("Float", "JIT", !!FindWindowById(IDM_JITWINDOW_PARENT));
ini.Set("Float", "Sound", !!FindWindowById(IDM_SOUNDWINDOW_PARENT));
ini.Set("Float", "Video", !!FindWindowById(IDM_VIDEOWINDOW_PARENT));
for (int i = IDM_LOGWINDOW_PARENT; i <= IDM_CODEWINDOW_PARENT; i++)
ini.Set("Float", SettingName[i - IDM_LOGWINDOW_PARENT], !!FindWindowById(i));
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
}
// Symbols, JIT, Profiler
// ----------------
void CCodeWindow::CreateMenuSymbols()
void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar)
{
wxMenu *pSymbolsMenu = new wxMenu;
pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _T("&Clear symbols"));
@ -411,14 +401,11 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
void CCodeWindow::OnChangeFont(wxCommandEvent& event)
{
wxFontData data;
data.SetInitialFont(GetFont());
data.SetInitialFont(DebuggerFont);
wxFontDialog dialog(this, data);
if ( dialog.ShowModal() == wxID_OK )
{
DebuggerFont = dialog.GetFontData().GetChosenFont();
fontDesc = std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str());
}
}
// Toogle windows
@ -426,52 +413,29 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event)
void CCodeWindow::OpenPages()
{
ToggleCodeWindow(true);
if (bRegisterWindow)
if (bShowOnStart[0])
Parent->ToggleLogWindow(true);
if (bShowOnStart[IDM_CONSOLEWINDOW - IDM_LOGWINDOW])
Parent->ToggleConsole(true);
if (bShowOnStart[IDM_REGISTERWINDOW - IDM_LOGWINDOW])
ToggleRegisterWindow(true);
if (bBreakpointWindow)
if (bShowOnStart[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW])
ToggleBreakPointWindow(true);
if (bMemoryWindow)
if (bShowOnStart[IDM_MEMORYWINDOW - IDM_LOGWINDOW])
ToggleMemoryWindow(true);
if (bJitWindow)
if (bShowOnStart[IDM_JITWINDOW - IDM_LOGWINDOW])
ToggleJitWindow(true);
if (bSoundWindow)
if (bShowOnStart[IDM_SOUNDWINDOW - IDM_LOGWINDOW])
ToggleDLLWindow(IDM_SOUNDWINDOW, true);
if (bVideoWindow)
if (bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW])
ToggleDLLWindow(IDM_VIDEOWINDOW, true);
}
void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{
bool bShow = GetMenuBar()->IsChecked(event.GetId());
switch(event.GetId())
{
case IDM_REGISTERWINDOW:
ToggleRegisterWindow(bShow);
break;
case IDM_BREAKPOINTWINDOW:
ToggleBreakPointWindow(bShow);
break;
case IDM_MEMORYWINDOW:
ToggleMemoryWindow(bShow);
break;
case IDM_JITWINDOW:
ToggleJitWindow(bShow);
break;
case IDM_SOUNDWINDOW:
ToggleDLLWindow(IDM_SOUNDWINDOW, bShow);
break;
case IDM_VIDEOWINDOW:
ToggleDLLWindow(IDM_VIDEOWINDOW, bShow);
break;
}
event.Skip();
}
void CCodeWindow::ToggleCodeWindow(bool bShow)
{
if (bShow)
Parent->DoAddPage(this, iCodeWindow,
Parent->DoAddPage(this,
iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
else // Hide
Parent->DoRemovePage(this);
@ -484,11 +448,15 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow)
{
if (!m_RegisterWindow)
m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
Parent->DoAddPage(m_RegisterWindow, iRegisterWindow,
Parent->DoAddPage(m_RegisterWindow,
iNbAffiliation[IDM_REGISTERWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
Parent->DoRemovePage(m_RegisterWindow, false);
m_RegisterWindow = NULL;
}
}
void CCodeWindow::ToggleBreakPointWindow(bool bShow)
@ -498,11 +466,15 @@ void CCodeWindow::ToggleBreakPointWindow(bool bShow)
{
if (!m_BreakpointWindow)
m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
Parent->DoAddPage(m_BreakpointWindow, iBreakpointWindow,
Parent->DoAddPage(m_BreakpointWindow,
iNbAffiliation[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
Parent->DoRemovePage(m_BreakpointWindow, false);
m_BreakpointWindow = NULL;
}
}
void CCodeWindow::ToggleMemoryWindow(bool bShow)
@ -512,11 +484,15 @@ void CCodeWindow::ToggleMemoryWindow(bool bShow)
{
if (!m_MemoryWindow)
m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
Parent->DoAddPage(m_MemoryWindow, iMemoryWindow,
Parent->DoAddPage(m_MemoryWindow,
iNbAffiliation[IDM_MEMORYWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
Parent->DoRemovePage(m_MemoryWindow, false);
m_MemoryWindow = NULL;
}
}
void CCodeWindow::ToggleJitWindow(bool bShow)
@ -526,11 +502,15 @@ void CCodeWindow::ToggleJitWindow(bool bShow)
{
if (!m_JitWindow)
m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
Parent->DoAddPage(m_JitWindow, iJitWindow,
Parent->DoAddPage(m_JitWindow,
iNbAffiliation[IDM_JITWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
Parent->DoRemovePage(m_JitWindow, false);
m_JitWindow = NULL;
}
}
// Notice: This windows docking will produce several wx debugging messages for plugin
@ -541,8 +521,7 @@ void CCodeWindow::ToggleJitWindow(bool bShow)
void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
{
std::string DLLName;
int PluginType, i;
bool bFloat;
int PluginType;
wxPanel *Win;
switch(Id)
@ -550,14 +529,10 @@ void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
case IDM_SOUNDWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str();
PluginType = PLUGIN_TYPE_DSP;
i = iSoundWindow;
bFloat = Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW];
break;
case IDM_VIDEOWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str();
PluginType = PLUGIN_TYPE_VIDEO;
i = iVideoWindow;
bFloat = Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW];
break;
default:
PanicAlert("CCodeWindow::ToggleDLLWindow called with invalid Id");
@ -574,7 +549,9 @@ void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
{
Win->Show();
Win->SetId(Id);
Parent->DoAddPage(Win, i, bFloat);
Parent->DoAddPage(Win,
iNbAffiliation[Id - IDM_LOGWINDOW],
Parent->bFloatWindow[Id - IDM_LOGWINDOW]);
}
}
else

View File

@ -17,7 +17,6 @@
#include "Debugger.h"
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/listctrl.h>
@ -44,7 +43,7 @@
// ugly that this lib included code from the main
#include "../../DolphinWX/Src/Globals.h"
// UGLY
// TODO: Fix this ugly hack
namespace {
CJitWindow *the_jit_window;
}
@ -60,13 +59,12 @@ enum
};
BEGIN_EVENT_TABLE(CJitWindow, wxPanel)
// EVT_TEXT(IDM_ADDRBOX, CJitWindow::OnAddrBoxChange)
// EVT_LISTBOX(IDM_SYMBOLLIST, CJitWindow::OnSymbolListChange)
//EVT_TEXT(IDM_ADDRBOX, CJitWindow::OnAddrBoxChange)
//EVT_LISTBOX(IDM_SYMBOLLIST, CJitWindow::OnSymbolListChange)
//EVT_HOST_COMMAND(wxID_ANY, CJitWindow::OnHostMessage)
EVT_BUTTON(IDM_REFRESH_LIST, CJitWindow::OnRefresh)
END_EVENT_TABLE()
CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString& name)
: wxPanel(parent, id, pos, size, style, name)
@ -74,11 +72,14 @@ CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
the_jit_window = this;
wxBoxSizer* sizerBig = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sizerSplit = new wxBoxSizer(wxHORIZONTAL);
sizerSplit->Add(ppc_box = new wxTextCtrl(this, IDM_PPC_BOX, _T("(ppc)"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerSplit->Add(x86_box = new wxTextCtrl(this, IDM_X86_BOX, _T("(x86)"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerSplit->Add(ppc_box = new wxTextCtrl(this, IDM_PPC_BOX, _T("(ppc)"),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerSplit->Add(x86_box = new wxTextCtrl(this, IDM_X86_BOX, _T("(x86)"),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerBig->Add(block_list = new JitBlockList(this, IDM_BLOCKLIST,
wxDefaultPosition, wxSize(100, 140),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING), 0, wxEXPAND);
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING),
0, wxEXPAND);
sizerBig->Add(sizerSplit, 2, wxEXPAND);
// sizerBig->Add(memview, 5, wxEXPAND);
// sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
@ -94,12 +95,6 @@ CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
sizerBig->Fit(this);
}
CJitWindow::~CJitWindow()
{
}
void CJitWindow::OnRefresh(wxCommandEvent& /*event*/) {
block_list->Update();
}
@ -136,12 +131,14 @@ void CJitWindow::Compare(u32 em_address)
}
if (block_num >= 0) {
JitBlock *block = jit->GetBlockCache()->GetBlock(block_num);
if (!(block->originalAddress <= em_address && block->originalSize + block->originalAddress >= em_address))
if (!(block->originalAddress <= em_address &&
block->originalSize + block->originalAddress >= em_address))
block_num = -1;
}
// Do not merge this "if" with the above - block_num changes inside it.
if (block_num < 0) {
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)", em_address).c_str()));
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)",
em_address).c_str()));
x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str()));
delete[] xDis;
return;
@ -201,16 +198,18 @@ void CJitWindow::Compare(u32 em_address)
sptr += sprintf(sptr, "%i estimated cycles\n", st.numCycles);
sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n", size, num_x86_instructions, 100 * (num_x86_instructions / size - 1));
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n", size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n",
size, num_x86_instructions, 100 * (num_x86_instructions / size - 1));
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n",
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
ppc_box->SetValue(wxString::FromAscii((char*)xDis));
} else {
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)", em_address).c_str()));
ppc_box->SetValue(wxString::FromAscii(StringFromFormat(
"(non-code address: %08x)", em_address).c_str()));
x86_box->SetValue(wxString::FromAscii("---"));
}
delete[] xDis;
}
@ -229,8 +228,6 @@ void CJitWindow::OnHostMessage(wxCommandEvent& event)
}
}
// JitBlockList
//================
@ -244,7 +241,8 @@ enum {
COLUMN_COST, // (estimated as x86size * numexec)
};
JitBlockList::JitBlockList(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
JitBlockList::JitBlockList(wxWindow* parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style) // | wxLC_VIRTUAL)
{
Init();

View File

@ -30,7 +30,6 @@
#include "Thread.h"
#include "CoreParameter.h"
class JitBlockList : public wxListCtrl
{
std::vector<int> block_ranking;
@ -40,7 +39,6 @@ public:
void Update();
};
class CJitWindow : public wxPanel
{
public:
@ -50,7 +48,6 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& title = _T("JIT block viewer"));
~CJitWindow();
static void ViewAddr(u32 em_address);
void Update();

View File

@ -119,10 +119,6 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
sizerBig->Fit(this);
}
CMemoryWindow::~CMemoryWindow()
{
}
void CMemoryWindow::Save(IniFile& _IniFile) const
{
// Prevent these bad values that can happen after a crash or hanging

View File

@ -43,7 +43,6 @@ class CMemoryWindow
long style = wxNO_BORDER,
const wxString& name = _T("Memory"));
~CMemoryWindow();
wxCheckBox* chk8;
wxCheckBox* chk16;
wxCheckBox* chk32;
@ -59,6 +58,8 @@ class CMemoryWindow
void JumpToAddress(u32 _Address);
private:
DECLARE_EVENT_TABLE()
CMemoryView* memview;
wxListBox* symbols;
@ -66,9 +67,6 @@ class CMemoryWindow
wxTextCtrl* addrbox;
wxTextCtrl* valbox;
DECLARE_EVENT_TABLE()
void U8(wxCommandEvent& event);
void U16(wxCommandEvent& event);
void U32(wxCommandEvent& event);

View File

@ -23,7 +23,6 @@
extern const char* GetGRPName(unsigned int index);
BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel)
EVT_CLOSE(CRegisterWindow::OnClose)
END_EVENT_TABLE()
@ -34,17 +33,8 @@ CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxString
CreateGUIControls();
}
CRegisterWindow::~CRegisterWindow()
{
}
void CRegisterWindow::CreateGUIControls()
{
//SetTitle(wxT("Registers"));
//SetIcon(wxNullIcon);
//Center();
wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL);
m_GPRGridView = new CRegisterView(this, ID_GPR);
sGrid->Add(m_GPRGridView, 1, wxGROW);
@ -54,11 +44,6 @@ void CRegisterWindow::CreateGUIControls()
NotifyUpdate();
}
void CRegisterWindow::OnClose(wxCloseEvent& WXUNUSED (event))
{
Hide();
}
void CRegisterWindow::NotifyUpdate()
{
if (m_GPRGridView != NULL)

View File

@ -33,8 +33,6 @@ public:
long style = wxTAB_TRAVERSAL | wxNO_BORDER
);
virtual ~CRegisterWindow();
void NotifyUpdate();
@ -47,7 +45,6 @@ private:
};
CRegisterView* m_GPRGridView;
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};

View File

@ -266,7 +266,7 @@ EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnDropDownToolbarSelect)
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnDropDownToolbarSelect)
EVT_MENU(IDM_NO_DOCKING, CFrame::OnDropDownToolbarSelect)
// Drop down float
EVT_MENU_RANGE(IDM_FLOAT_LOGWINDOW, IDM_FLOAT_VIDEOWINDOW, CFrame::OnFloatWindow)
EVT_MENU_RANGE(IDM_FLOAT_LOGWINDOW, IDM_FLOAT_CODEWINDOW, CFrame::OnFloatWindow)
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
@ -282,8 +282,7 @@ 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_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_CONSOLEWINDOW, CFrame::OnToggleConsole)
EVT_MENU_RANGE(IDM_LOGWINDOW, IDM_VIDEOWINDOW, CFrame::OnToggleWindow)
EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged)
@ -348,7 +347,7 @@ CFrame::CFrame(wxFrame* parent,
, m_timer(this)
#endif
{
for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++)
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
bFloatWindow[i] = false;
if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
@ -367,7 +366,7 @@ CFrame::CFrame(wxFrame* parent,
{
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
g_pCodeWindow->Hide();
g_pCodeWindow->Load();
LoadIniPerspectives();
}
// Create timer
@ -451,7 +450,7 @@ CFrame::CFrame(wxFrame* parent,
if (g_pCodeWindow)
{
// Load perspective
SaveLocal();
LoadIniPerspectives();
DoLoadPerspective();
}
else
@ -515,6 +514,7 @@ CFrame::~CFrame()
#endif
// Close the log window now so that its settings are saved
if (!g_pCodeWindow)
m_LogWindow->Close();
ClosePages();
@ -571,7 +571,7 @@ void CFrame::OnClose(wxCloseEvent& event)
// Don't forget the skip or the window won't be destroyed
event.Skip();
// Save GUI settings
if (g_pCodeWindow) Save();
if (g_pCodeWindow) SaveIniPerspectives();
// Uninit
m_Mgr->UnInit();

View File

@ -121,8 +121,8 @@ class CFrame : public CRenderFrame
bool bNoWiimoteMsg;
void UpdateGUI();
void UpdateGameList();
void ToggleLogWindow(bool, int i = -1);
void ToggleConsole(bool, int i = -1);
void ToggleLogWindow(bool bShow);
void ToggleConsole(bool bShow);
void PostEvent(wxCommandEvent& event);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
@ -141,7 +141,7 @@ class CFrame : public CRenderFrame
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
bool bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
// Utility
wxWindow * GetNotebookPageFromId(wxWindowID Id);
@ -191,10 +191,10 @@ class CFrame : public CRenderFrame
wxString AuiFullscreen, AuiCurrent;
wxArrayString AuiPerspective;
u32 ActivePerspective;
void NamePanes();
void AddPane();
void Save();
void SaveLocal();
void UpdateCurrentPerspective();
void SaveIniPerspectives();
void LoadIniPerspectives();
void OnPaneClose(wxAuiManagerEvent& evt);
void ReloadPanes();
void DoLoadPerspective();
@ -313,8 +313,7 @@ class CFrame : public CRenderFrame
void OnToggleToolbar(wxCommandEvent& event);
void DoToggleToolbar(bool);
void OnToggleStatusbar(wxCommandEvent& event);
void OnToggleLogWindow(wxCommandEvent& event);
void OnToggleConsole(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnKeyUp(wxKeyEvent& event);

View File

@ -94,14 +94,7 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
m_Mgr->Update();
}
// Enable and disable the log window
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
{
SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked();
ToggleLogWindow(event.IsChecked(), g_pCodeWindow ? g_pCodeWindow->iLogWindow : 0);
}
void CFrame::ToggleLogWindow(bool bShow, int i)
void CFrame::ToggleLogWindow(bool bShow)
{
GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(bShow);
@ -109,7 +102,9 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
{
if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
m_LogWindow->Enable();
DoAddPage(m_LogWindow, i, bFloatWindow[0]);
DoAddPage(m_LogWindow,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[0] : 0,
g_pCodeWindow ? bFloatWindow[0] : false);
}
else
{
@ -122,14 +117,7 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
TogglePane();
}
// Enable and disable the console
void CFrame::OnToggleConsole(wxCommandEvent& event)
{
SConfig::GetInstance().m_InterfaceConsole = event.IsChecked();
ToggleConsole(event.IsChecked(), g_pCodeWindow ? g_pCodeWindow->iConsoleWindow : 0);
}
void CFrame::ToggleConsole(bool bShow, int i)
void CFrame::ToggleConsole(bool bShow)
{
#ifdef _WIN32
GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(bShow);
@ -156,7 +144,9 @@ void CFrame::ToggleConsole(bool bShow, int i)
ConsoleWin->Reparent(ConsoleParent);
ConsoleParent->Enable();
DoAddPage(ConsoleParent, i, bFloatWindow[1]);
DoAddPage(ConsoleParent,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[1] : 0,
g_pCodeWindow ? bFloatWindow[1] : false);
}
else // Hide
{
@ -177,6 +167,44 @@ void CFrame::ToggleConsole(bool bShow, int i)
#endif
}
void CFrame::OnToggleWindow(wxCommandEvent& event)
{
bool bShow = GetMenuBar()->IsChecked(event.GetId());
switch(event.GetId())
{
case IDM_LOGWINDOW:
if (!g_pCodeWindow)
SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked();
ToggleLogWindow(bShow);
break;
case IDM_CONSOLEWINDOW:
if (!g_pCodeWindow)
SConfig::GetInstance().m_InterfaceConsole = event.IsChecked();
ToggleConsole(event.IsChecked());
break;
case IDM_REGISTERWINDOW:
g_pCodeWindow->ToggleRegisterWindow(bShow);
break;
case IDM_BREAKPOINTWINDOW:
g_pCodeWindow->ToggleBreakPointWindow(bShow);
break;
case IDM_MEMORYWINDOW:
g_pCodeWindow->ToggleMemoryWindow(bShow);
break;
case IDM_JITWINDOW:
g_pCodeWindow->ToggleJitWindow(bShow);
break;
case IDM_SOUNDWINDOW:
g_pCodeWindow->ToggleDLLWindow(IDM_SOUNDWINDOW, bShow);
break;
case IDM_VIDEOWINDOW:
g_pCodeWindow->ToggleDLLWindow(IDM_VIDEOWINDOW, bShow);
break;
}
event.Skip();
}
// Notebooks
// ---------------------
void CFrame::ClosePages()
@ -204,24 +232,11 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
AddRemoveBlankPage();
// Update the notebook affiliation
if(GetNotebookAffiliation(IDM_LOGWINDOW) >= 0)
g_pCodeWindow->iLogWindow = GetNotebookAffiliation(IDM_LOGWINDOW);
if(GetNotebookAffiliation(IDM_CONSOLEWINDOW) >= 0)
g_pCodeWindow->iConsoleWindow = GetNotebookAffiliation(IDM_CONSOLEWINDOW);
if(GetNotebookAffiliation(IDM_CODEWINDOW) >= 0)
g_pCodeWindow->iCodeWindow = GetNotebookAffiliation(IDM_CODEWINDOW);
if(GetNotebookAffiliation(IDM_REGISTERWINDOW) >= 0)
g_pCodeWindow->iRegisterWindow = GetNotebookAffiliation(IDM_REGISTERWINDOW);
if(GetNotebookAffiliation(IDM_BREAKPOINTWINDOW) >= 0)
g_pCodeWindow->iBreakpointWindow = GetNotebookAffiliation(IDM_BREAKPOINTWINDOW);
if(GetNotebookAffiliation(IDM_JITWINDOW) >= 0)
g_pCodeWindow->iJitWindow = GetNotebookAffiliation(IDM_JITWINDOW);
if(GetNotebookAffiliation(IDM_MEMORYWINDOW) >= 0)
g_pCodeWindow->iMemoryWindow = GetNotebookAffiliation(IDM_MEMORYWINDOW);
if(GetNotebookAffiliation(IDM_SOUNDWINDOW) >= 0)
g_pCodeWindow->iSoundWindow = GetNotebookAffiliation(IDM_SOUNDWINDOW);
if(GetNotebookAffiliation(IDM_VIDEOWINDOW) >= 0)
g_pCodeWindow->iVideoWindow = GetNotebookAffiliation(IDM_VIDEOWINDOW);
for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++)
{
if(GetNotebookAffiliation(i) >= 0)
g_pCodeWindow->iNbAffiliation[i - IDM_LOGWINDOW] = GetNotebookAffiliation(i);
}
}
void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
@ -249,6 +264,17 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
g_pCodeWindow->ToggleDLLWindow(IDM_VIDEOWINDOW, false);
}
void CFrame::OnFloatingPageClosed(wxCloseEvent& event)
{
ToggleFloatWindow(event.GetId() - IDM_LOGWINDOW_PARENT + IDM_FLOAT_LOGWINDOW);
}
void CFrame::OnFloatingPageSize(wxSizeEvent& event)
{
event.Skip();
ResizeConsole();
}
void CFrame::OnFloatWindow(wxCommandEvent& event)
{
ToggleFloatWindow(event.GetId());
@ -270,6 +296,36 @@ void CFrame::ToggleFloatWindow(int Id)
}
}
void CFrame::DoFloatNotebookPage(wxWindowID Id)
{
wxPanel *Win = (wxPanel*)FindWindowById(Id);
if (!Win) return;
for (int i = 0; i < GetNotebookCount(); i++)
{
wxAuiNotebook *nb = GetNotebookFromId(i);
if (nb->GetPageIndex(Win) != wxNOT_FOUND)
{
nb->RemovePage(nb->GetPageIndex(Win));
// Create the parent frame and reparent the window
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
if (nb->GetPageCount() == 0)
AddRemoveBlankPage();
}
}
}
void CFrame::DoUnfloatPage(int Id)
{
wxFrame * Win = (wxFrame*)FindWindowById(Id);
if (!Win) return;
wxWindow * Child = Win->GetWindowChildren().Item(0)->GetData();
Child->Reparent(this);
DoAddPage(Child, g_pCodeWindow->iNbAffiliation[Child->GetId() - IDM_LOGWINDOW], false);
Win->Destroy();
}
void CFrame::OnTab(wxAuiNotebookEvent& event)
{
event.Skip();
@ -283,7 +339,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
MenuPopup->Append(Item);
Item->Enable(false);
MenuPopup->Append(new wxMenuItem(MenuPopup));
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++)
{
wxWindow *Win = FindWindowById(i);
if (Win && Win->IsEnabled())
@ -364,6 +420,7 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
}
}
}
AddRemoveBlankPage();
}
void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
@ -378,47 +435,6 @@ void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
}
void CFrame::DoUnfloatPage(int Id)
{
wxFrame * Win = (wxFrame*)FindWindowById(Id);
if (!Win) return;
wxWindow * Child = Win->GetWindowChildren().Item(0)->GetData();
Child->Reparent(this);
DoAddPage(Child, 0, false);
Win->Destroy();
}
void CFrame::OnFloatingPageClosed(wxCloseEvent& event)
{
ToggleFloatWindow(event.GetId() - IDM_LOGWINDOW_PARENT + IDM_FLOAT_LOGWINDOW);
}
void CFrame::OnFloatingPageSize(wxSizeEvent& event)
{
event.Skip();
ResizeConsole();
}
void CFrame::DoFloatNotebookPage(wxWindowID Id)
{
wxPanel *Win = (wxPanel*)FindWindowById(Id);
if (!Win) return;
for (int i = 0; i < GetNotebookCount(); i++)
{
wxAuiNotebook *nb = GetNotebookFromId(i);
if (nb->GetPageIndex(Win) != wxNOT_FOUND)
{
nb->RemovePage(nb->GetPageIndex(Win));
// Create the parent frame and reparent the window
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
if (nb->GetPageCount() == 0)
AddRemoveBlankPage();
}
}
}
// Toolbar
void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
{
@ -501,13 +517,13 @@ void CFrame::OnToolBar(wxCommandEvent& event)
case IDM_SAVE_PERSPECTIVE:
if (Perspectives.size() == 0)
{
wxMessageBox(wxT("Please create a perspective before saving"), wxT("Notice"), wxOK, this);
wxMessageBox(wxT("Please create a perspective before saving"),
wxT("Notice"), wxOK, this);
return;
}
Save();
if (Perspectives.size() > 0 && ActivePerspective < Perspectives.size())
GetStatusBar()->SetStatusText(wxString::FromAscii(StringFromFormat(
"Saved %s", Perspectives.at(ActivePerspective).Name.c_str()).c_str()), 0);
SaveIniPerspectives();
GetStatusBar()->SetStatusText(wxString::FromAscii(std::string
("Saved " + Perspectives.at(ActivePerspective).Name).c_str()), 0);
break;
case IDM_PERSPECTIVES_ADD_PANE:
AddPane();
@ -530,8 +546,8 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
{
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
wxT("Create new perspective"));
wxString DefaultValue = wxString::Format(wxT("Perspective %u"),
unsigned(Perspectives.size() + 1));
wxString DefaultValue = wxString::Format(wxT("Perspective %d"),
Perspectives.size() + 1);
dlg.SetValue(DefaultValue);
bool DlgOk = false; int Return = 0;
while (!DlgOk)
@ -559,7 +575,12 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
SPerspectives Tmp;
Tmp.Name = dlg.GetValue().mb_str();
Tmp.Perspective = m_Mgr->SavePerspective();
ActivePerspective = Perspectives.size();
Perspectives.push_back(Tmp);
UpdateCurrentPerspective();
}
break;
case IDM_TAB_SPLIT:
@ -757,35 +778,23 @@ void CFrame::SetPaneSize()
void CFrame::ReloadPanes()
{
// Keep settings
bool bConsole = SConfig::GetInstance().m_InterfaceConsole;
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
// Check that there is a perspective
if (Perspectives.size() > 0)
{
// Check that the perspective was saved once before
if (Perspectives.at(ActivePerspective).Width.size() == 0) return;
// Hide to avoid flickering
HideAllNotebooks(true);
// Close all pages
ClosePages();
CloseAllNotebooks();
//m_Mgr->Update();
// Create new panes with notebooks
for (u32 i = 0; i < Perspectives.at(ActivePerspective).Width.size() - 1; i++)
{
wxString PaneName = wxString::Format(wxT("Pane %i"), i + 1);
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Hide()
.CaptionVisible(m_bEdit).Dockable(!m_bNoDocking));
.CaptionVisible(m_bEdit).Dockable(!m_bNoDocking).Position(i)
.Name(PaneName).Caption(PaneName));
}
HideAllNotebooks(true);
// Names
NamePanes();
// Perspectives
m_Mgr->LoadPerspective(Perspectives.at(ActivePerspective).Perspective, false);
// Reset toolbars
@ -793,22 +802,13 @@ void CFrame::ReloadPanes()
// Restore settings
TogglePaneStyle(m_bNoDocking, IDM_NO_DOCKING);
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
}
// Create one pane by default
else
{
m_Mgr->AddPane(CreateEmptyNotebook());
}
// Restore settings
SConfig::GetInstance().m_InterfaceConsole = bConsole;
// Load GUI settings
if (g_pCodeWindow) g_pCodeWindow->Load();
g_pCodeWindow->Load();
// Open notebook pages
AddRemoveBlankPage();
if (g_pCodeWindow) g_pCodeWindow->OpenPages();
if (SConfig::GetInstance().m_InterfaceLogWindow) ToggleLogWindow(true);
if (SConfig::GetInstance().m_InterfaceConsole) ToggleConsole(true);
g_pCodeWindow->OpenPages();
if (g_pCodeWindow->bShowOnStart[0]) ToggleLogWindow(true);
if (g_pCodeWindow->bShowOnStart[1]) ToggleConsole(true);
}
void CFrame::DoLoadPerspective()
@ -821,7 +821,7 @@ void CFrame::DoLoadPerspective()
}
// Update the local perspectives array
void CFrame::SaveLocal()
void CFrame::LoadIniPerspectives()
{
Perspectives.clear();
std::vector<std::string> VPerspectives;
@ -829,8 +829,8 @@ void CFrame::SaveLocal()
IniFile ini;
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Get("Perspectives", "Perspectives", &_Perspectives, "");
ini.Get("Perspectives", "Active", &ActivePerspective, 5);
ini.Get("Perspectives", "Perspectives", &_Perspectives, "Perspective 1");
ini.Get("Perspectives", "Active", &ActivePerspective, 0);
SplitString(_Perspectives, ",", VPerspectives);
for (u32 i = 0; i < VPerspectives.size(); i++)
@ -841,12 +841,15 @@ void CFrame::SaveLocal()
Tmp.Name = VPerspectives.at(i);
// Don't save a blank perspective
if (Tmp.Name.empty()) continue;
//if (!ini.Exists(_Section.c_str(), "Width")) continue;
_Section = StringFromFormat("P - %s", Tmp.Name.c_str());
ini.Get(_Section.c_str(), "Perspective", &_Perspective, "");
ini.Get(_Section.c_str(), "Width", &_Width, "");
ini.Get(_Section.c_str(), "Height", &_Height, "");
ini.Get(_Section.c_str(), "Perspective", &_Perspective,
"layout2|"
"name=Pane 0;caption=Pane 0;state=768;dir=5;prop=100000;|"
"name=Pane 1;caption=Pane 1;state=31458108;dir=4;prop=100000;|"
"dock_size(5,0,0)=22|dock_size(4,0,0)=333|");
ini.Get(_Section.c_str(), "Width", &_Width, "70,25");
ini.Get(_Section.c_str(), "Height", &_Height, "80,80");
Tmp.Perspective = wxString::FromAscii(_Perspective.c_str());
@ -866,41 +869,43 @@ void CFrame::SaveLocal()
}
}
void CFrame::Save()
void CFrame::UpdateCurrentPerspective()
{
SPerspectives *current = &Perspectives[ActivePerspective];
current->Perspective = m_Mgr->SavePerspective();
// Get client size
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY();
current->Width.clear();
current->Height.clear();
for (size_t i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->
IsKindOf(CLASSINFO(wxAuiToolBar)))
{
current->Width.push_back(PixelsToPercentage(
m_Mgr->GetAllPanes().Item(i).window->
GetClientSize().GetX(), iClientX));
current->Height.push_back(PixelsToPercentage(
m_Mgr->GetAllPanes().Item(i).window->
GetClientSize().GetY(), iClientY));
}
}
}
void CFrame::SaveIniPerspectives()
{
if (Perspectives.size() == 0) return;
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
// Turn off edit before saving
TogglePaneStyle(false, IDM_EDIT_PERSPECTIVES);
// Name panes
NamePanes();
// Get client size
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY();
UpdateCurrentPerspective();
IniFile ini;
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
std::string _Section = StringFromFormat("P - %s", Perspectives.at(ActivePerspective).Name.c_str());
ini.Set(_Section.c_str(), "Perspective", m_Mgr->SavePerspective().mb_str());
std::string SWidth = "", SHeight = "";
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
SWidth += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX(), iClientX));
SHeight += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY(), iClientY));
SWidth += ","; SHeight += ",";
}
}
// Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length()-1); SHeight = SHeight.substr(0, SHeight.length()-1);
ini.Set(_Section.c_str(), "Width", SWidth.c_str());
ini.Set(_Section.c_str(), "Height", SHeight.c_str());
// Save perspective names
std::string STmp = "";
for (u32 i = 0; i < Perspectives.size(); i++)
@ -910,36 +915,44 @@ void CFrame::Save()
STmp = STmp.substr(0, STmp.length()-1);
ini.Set("Perspectives", "Perspectives", STmp.c_str());
ini.Set("Perspectives", "Active", ActivePerspective);
// Save the perspectives
for (size_t i = 0; i < Perspectives.size(); i++)
{
std::string _Section = "P - " + Perspectives[i].Name;
ini.Set(_Section.c_str(), "Perspective", Perspectives[i].Perspective.mb_str());
std::string SWidth = "", SHeight = "";
for (size_t j = 0; j < Perspectives[i].Width.size(); j++)
{
SWidth += StringFromFormat("%i,", Perspectives[i].Width[j]);
SHeight += StringFromFormat("%i,", Perspectives[i].Height[j]);
}
// Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length()-1);
SHeight = SHeight.substr(0, SHeight.length()-1);
ini.Set(_Section.c_str(), "Width", SWidth.c_str());
ini.Set(_Section.c_str(), "Height", SHeight.c_str());
}
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// Save notebook affiliations
g_pCodeWindow->Save();
// Update the local vector
SaveLocal();
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
}
void CFrame::NamePanes()
{
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
m_Mgr->GetAllPanes().Item(i).Name(wxString::Format(wxT("Pane %i"), j));
m_Mgr->GetAllPanes().Item(i).Caption(wxString::Format(wxT("Pane %i"), j));
j++;
}
}
}
void CFrame::AddPane()
{
int PaneNum = GetNotebookCount() + 1;
wxString PaneName = wxString::Format(wxT("Pane %i"), PaneNum);
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
.CaptionVisible(m_bEdit).Dockable(!m_bNoDocking));
.CaptionVisible(m_bEdit).Dockable(!m_bNoDocking)
.Name(PaneName).Caption(PaneName)
.Position(GetNotebookCount()));
NamePanes();
AddRemoveBlankPage();
m_Mgr->Update();
}

View File

@ -177,7 +177,7 @@ void CFrame::CreateMenu()
if (g_pCodeWindow)
{
pOptionsMenu->AppendSeparator();
g_pCodeWindow->CreateMenuOptions(NULL, pOptionsMenu);
g_pCodeWindow->CreateMenuOptions(pOptionsMenu);
}
m_MenuBar->Append(pOptionsMenu, _T("&Options"));
@ -213,16 +213,36 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow"));
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _T("Show &Console"));
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
viewMenu->AppendSeparator();
if (g_pCodeWindow)
{
g_pCodeWindow->CreateMenuView(NULL, viewMenu);
viewMenu->Check(IDM_LOGWINDOW, g_pCodeWindow->bShowOnStart[0]);
viewMenu->Check(IDM_CONSOLEWINDOW, g_pCodeWindow->bShowOnStart[1]);
const wxString MenuText[] = {
wxT("&Registers"),
wxT("&Breakpoints"),
wxT("&Memory"),
wxT("&JIT"),
wxT("&Sound"),
wxT("&Video")
};
for (int i = IDM_REGISTERWINDOW; i <= IDM_VIDEOWINDOW; i++)
{
viewMenu->AppendCheckItem(i, MenuText[i - IDM_REGISTERWINDOW]);
viewMenu->Check(i, g_pCodeWindow->bShowOnStart[i - IDM_LOGWINDOW]);
}
viewMenu->AppendSeparator();
}
else
{
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
}
wxMenu *platformMenu = new wxMenu;
viewMenu->AppendSubMenu(platformMenu, _T("Show Platforms"));

View File

@ -124,6 +124,39 @@ enum
IDM_CONFIG_PAD_PLUGIN,
IDM_CONFIG_WIIMOTE_PLUGIN,
// Views
IDM_LOGWINDOW,
IDM_CONSOLEWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
IDM_JITWINDOW,
IDM_SOUNDWINDOW,
IDM_VIDEOWINDOW,
IDM_CODEWINDOW,
// Float Window IDs
IDM_LOGWINDOW_PARENT,
IDM_CONSOLEWINDOW_PARENT,
IDM_REGISTERWINDOW_PARENT,
IDM_BREAKPOINTWINDOW_PARENT,
IDM_MEMORYWINDOW_PARENT,
IDM_JITWINDOW_PARENT,
IDM_SOUNDWINDOW_PARENT,
IDM_VIDEOWINDOW_PARENT,
IDM_CODEWINDOW_PARENT,
// Float popup menu IDs
IDM_FLOAT_LOGWINDOW,
IDM_FLOAT_CONSOLEWINDOW,
IDM_FLOAT_REGISTERWINDOW,
IDM_FLOAT_BREAKPOINTWINDOW,
IDM_FLOAT_MEMORYWINDOW,
IDM_FLOAT_JITWINDOW,
IDM_FLOAT_SOUNDWINDOW,
IDM_FLOAT_VIDEOWINDOW,
IDM_FLOAT_CODEWINDOW,
// --------------------------------------------------------------
// Debugger Menu Entries
// --------------------
@ -141,39 +174,6 @@ enum
IDM_JITSROFF,
IDM_FONTPICKER,
// Views
IDM_LOGWINDOW,
IDM_CONSOLEWINDOW,
IDM_CODEWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
IDM_JITWINDOW,
IDM_SOUNDWINDOW,
IDM_VIDEOWINDOW,
// Float Window IDs
IDM_LOGWINDOW_PARENT,
IDM_CONSOLEWINDOW_PARENT,
IDM_CODEWINDOW_PARENT,
IDM_REGISTERWINDOW_PARENT,
IDM_BREAKPOINTWINDOW_PARENT,
IDM_MEMORYWINDOW_PARENT,
IDM_JITWINDOW_PARENT,
IDM_SOUNDWINDOW_PARENT,
IDM_VIDEOWINDOW_PARENT,
// Float popup menu IDs
IDM_FLOAT_LOGWINDOW,
IDM_FLOAT_CONSOLEWINDOW,
IDM_FLOAT_CODEWINDOW,
IDM_FLOAT_REGISTERWINDOW,
IDM_FLOAT_BREAKPOINTWINDOW,
IDM_FLOAT_MEMORYWINDOW,
IDM_FLOAT_JITWINDOW,
IDM_FLOAT_SOUNDWINDOW,
IDM_FLOAT_VIDEOWINDOW,
// Symbols
IDM_CLEARSYMBOLS,
IDM_CLEANSYMBOLS, // not used