GUI: Moved debugging window to AUI, more AUI improvements to be done

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4052 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-08-25 01:50:27 +00:00
parent 984988c5d3
commit b01b7c78a5
24 changed files with 3624 additions and 404 deletions

View File

@ -51,7 +51,7 @@ class CBreakPointWindow
enum
{
ID_TOOLBAR = 500,
ID_TOOLBAR = 501,
ID_BPS = 1002,
IDM_DELETE,
IDM_CLEAR,

View File

@ -88,18 +88,15 @@ inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
}
BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
// Menu tooltips
EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
// Menu bar
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // CPU Mode
@ -117,8 +114,8 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow) //views
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleJitWindow)
EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleSoundWindow)
EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleVideoWindow)
@ -132,7 +129,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
@ -150,15 +147,24 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
// Menu tooltips
//EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
//EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
END_EVENT_TABLE()
// Class, input event handler and host message handler
/*
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
*/
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
/* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
things may crash */
@ -177,10 +183,10 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
CreateGUIControls(_LocalCoreStartupParameter);
// Create the toolbar
RecreateToolbar();
//RecreateToolbar();
// Update bitmap buttons
UpdateButtonStates();
//UpdateButtonStates();
// Connect keyboard
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
@ -209,6 +215,30 @@ CCodeWindow::~CCodeWindow()
file.Save(DEBUGGER_CONFIG_FILE);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
//Redirect old wxFrame calls
// ------------
wxFrame *CCodeWindow::GetParentFrame()
{
wxFrame *Parent = wxDynamicCast(GetParent(), wxFrame);
return Parent;
}
wxMenuBar *CCodeWindow::GetMenuBar()
{
if (GetParentFrame()) return GetParentFrame()->GetMenuBar();
}
wxToolBar *CCodeWindow::GetToolBar()
{
if (GetParentFrame()) return GetParentFrame()->GetToolBar();
}
bool CCodeWindow::IsActive()
{
if (GetParentFrame()) return GetParentFrame()->IsActive();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
{
if ((event.GetKeyCode() == WXK_SPACE) && IsActive())
@ -275,8 +305,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
// Load these settings before CreateGUIControls()
void CCodeWindow::Load_( IniFile &ini )
@ -318,8 +346,11 @@ void CCodeWindow::Load( IniFile &ini )
}
void CCodeWindow::Save(IniFile &ini) const
void CCodeWindow::Save(IniFile &ini)
{
// Crashes on exit, will be fixed
return;
ini.Set("CodeWindow", "x", GetPosition().x);
ini.Set("CodeWindow", "y", GetPosition().y);
ini.Set("CodeWindow", "w", GetSize().GetWidth());
@ -346,8 +377,7 @@ void CCodeWindow::Save(IniFile &ini) const
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
CreateMenu(_LocalCoreStartupParameter);
//CreateMenu(_LocalCoreStartupParameter);
// Configure the code window
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
@ -421,14 +451,15 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
// Create CPU Mode and Views menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter)
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar * _pMenuBar)
{
// Create menu
pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
//pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
pMenuBar = _pMenuBar;
// Add separator to mark beginning of debugging menus
// CPU Mode
wxMenu* pCoreMenu = new wxMenu;
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _T("&Interpreter core")
@ -451,19 +482,19 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
" and retry it several times, either with changes to Dolphin or if you are"
" developing a homebrew game.]")
, wxITEM_CHECK);
automaticstart->Check(bAutomaticStart);
automaticstart->Check(bAutomaticStart);
pCoreMenu->AppendSeparator();
pCoreMenu->AppendSeparator();
jitblocklinking = pCoreMenu->Append(IDM_JITBLOCKLINKING, _T("&JIT Block Linking off"),
_T("Provide safer execution by not linking the JIT blocks."
), wxITEM_CHECK);
jitblocklinking = pCoreMenu->Append(IDM_JITBLOCKLINKING + 123, _T("&JIT Block Linking off"),
_T("Provide safer execution by not linking the JIT blocks."),
wxITEM_CHECK);
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"),
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing.")
_T(" [This option must be selected before a game is started.]"),
wxITEM_CHECK);
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"),
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing.")
_T(" [This option must be selected before a game is started.]"),
wxITEM_CHECK);
#ifdef JIT_OFF_OPTIONS
pCoreMenu->AppendSeparator();
@ -486,7 +517,6 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
// dualcore->Check(_LocalCoreStartupParameter.bUseDualCore);
pMenuBar->Append(pCoreMenu, _T("&CPU Mode"));
// Views
@ -514,12 +544,11 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pDebugDialogs->AppendSeparator();
wxMenuItem* pFontPicker = pDebugDialogs->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
pMenuBar->Append(pDebugDialogs, _T("&Views"));
pMenuBar->Append(pDebugDialogs, _T("&Views"));
CreateSymbolsMenu();
SetMenuBar(pMenuBar);
//SetMenuBar(pMenuBar);
}
@ -546,7 +575,7 @@ void CCodeWindow::InitBitmaps()
}
void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
{
int w = m_Bitmaps[Toolbar_DebugGo].GetWidth(),
h = m_Bitmaps[Toolbar_DebugGo].GetHeight();
@ -871,6 +900,8 @@ void CCodeWindow::UpdateButtonStates()
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
wxToolBar* toolBar = GetToolBar();
if (!toolBar) return;
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
toolBar->EnableTool(IDM_DEBUG_GO, false);
@ -925,19 +956,22 @@ void CCodeWindow::UpdateButtonStates()
calls->SetFont(DebuggerFont);
}
void CCodeWindow::RecreateToolbar()
void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)
{
/*
// delete and recreate the toolbar
wxToolBarBase* toolBar = GetToolBar();
delete toolBar;
SetToolBar(NULL);
long style = TOOLBAR_STYLE;
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP);
wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR);
wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR2);
PopulateToolbar(theToolBar);
SetToolBar(theToolBar);
*/
}

View File

@ -22,6 +22,7 @@
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/listbox.h>
#include <wx/aui/aui.h>
#include "Thread.h"
#include "CoreParameter.h"
@ -33,26 +34,32 @@ class CJitWindow;
class CCodeView;
class CCodeWindow
: public wxFrame
: public wxPanel
{
public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
wxWindowID id = wxID_ANY);
/*
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = _T("Dolphin-Debugger"),
const wxPoint& pos = wxPoint(950, 100),
const wxSize& size = wxSize(400, 500),
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
*/
~CCodeWindow();
// Function redirection
wxFrame *GetParentFrame();
wxMenuBar * GetMenuBar();
wxToolBar * GetToolBar();
bool IsActive();
void Load_(IniFile &file);
void Load(IniFile &file);
void Save(IniFile &file) const;
void Update();
void NotifyMapLoaded();
void Save(IniFile &file);
bool UseInterpreter();
bool BootToPause();
@ -62,59 +69,20 @@ class CCodeWindow
//bool UseDualCore(); // not used
void JumpToAddress(u32 _Address);
void Update();
void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar * pMenuBar);
void RecreateToolbar(wxAuiToolBar*);
void PopulateToolbar(wxAuiToolBar* toolBar);
void CreateSymbolsMenu();
void UpdateButtonStates();
private:
enum
{
// ==============================================================
// Menu Entries
// CPU Mode
IDM_INTERPRETER = 2000, // These cannot interfere with enums in Globals.h!
//IDM_DUALCORE, // not used
IDM_AUTOMATICSTART, IDM_BOOTTOPAUSE,
IDM_JITUNLIMITED, IDM_JITBLOCKLINKING, // JIT
IDM_JITOFF,
IDM_JITLSOFF, IDM_JITLSLXZOFF, IDM_JITLSLWZOFF, IDM_JITLSLBZXOFF,
IDM_JITLSPOFF, IDM_JITLSFOFF,
IDM_JITIOFF,
IDM_JITFPOFF,
IDM_JITPOFF,
IDM_JITSROFF,
// Views
IDM_FONTPICKER,
IDM_LOGWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
IDM_JITWINDOW,
IDM_SOUNDWINDOW,
IDM_VIDEOWINDOW,
// Symbols
IDM_CLEARSYMBOLS,
IDM_CLEANSYMBOLS, // not used
IDM_SCANFUNCTIONS,
IDM_LOADMAPFILE,
IDM_SAVEMAPFILE, IDM_SAVEMAPFILEWITHCODES,
IDM_CREATESIGNATUREFILE,
IDM_RENAME_SYMBOLS,
IDM_USESIGNATUREFILE,
//IDM_USESYMBOLFILE, // not used
IDM_PATCHHLEFUNCTIONS,
// JIT
IDM_CLEARCODECACHE,
IDM_LOGINSTRUCTIONS,
IDM_SEARCHINSTRUCTION,
// Profiler
IDM_PROFILEBLOCKS,
IDM_WRITEPROFILE,
// ==============================================================
// Toolbar
ID_TOOLBAR,
ID_TOOLBAR = 2000,
IDM_DEBUG_GO,
IDM_STEP,
IDM_STEPOVER,
@ -153,6 +121,39 @@ class CCodeWindow
bool bSoundWindow;
bool bVideoWindow;
void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event);
void SingleCPUStep();
void OnAddrBoxChange(wxCommandEvent& event);
void OnToggleRegisterWindow(wxCommandEvent& event);
void OnToggleBreakPointWindow(wxCommandEvent& event);
void OnToggleMemoryWindow(wxCommandEvent& event);
void OnToggleJitWindow(wxCommandEvent& event);
void OnToggleSoundWindow(wxCommandEvent& event);
void OnToggleVideoWindow(wxCommandEvent& event);
void OnChangeFont(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void UpdateLists();
void UpdateCallstack();
void OnStatusBar(wxMenuEvent& event); void OnStatusBar_(wxUpdateUIEvent& event);
void DoTip(wxString text);
void OnKeyDown(wxKeyEvent& event);
// Sub dialogs
wxMenuBar* pMenuBar;
CRegisterWindow* m_RegisterWindow;
@ -180,45 +181,6 @@ class CCodeWindow
DECLARE_EVENT_TABLE()
void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event);
void SingleCPUStep();
void OnAddrBoxChange(wxCommandEvent& event);
void OnToggleRegisterWindow(wxCommandEvent& event);
void OnToggleBreakPointWindow(wxCommandEvent& event);
void OnToggleMemoryWindow(wxCommandEvent& event);
void OnToggleJitWindow(wxCommandEvent& event);
void OnToggleSoundWindow(wxCommandEvent& event);
void OnToggleVideoWindow(wxCommandEvent& event);
void OnChangeFont(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter);
void CreateSymbolsMenu();
void UpdateButtonStates();
void UpdateLists();
void UpdateCallstack();
void RecreateToolbar();
void PopulateToolbar(wxToolBar* toolBar);
void OnStatusBar(wxMenuEvent& event); void OnStatusBar_(wxUpdateUIEvent& event);
void DoTip(wxString text);
void OnKeyDown(wxKeyEvent& event);
void InitBitmaps();
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
};

View File

@ -122,7 +122,6 @@ void CCodeWindow::CreateSymbolsMenu()
}
void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
{
if (Core::GetState() == Core::CORE_RUN) {
@ -311,15 +310,11 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
{
bool show = GetMenuBar()->IsChecked(event.GetId());
bool Show = GetMenuBar()->IsChecked(event.GetId());
if (show)
if (Show)
{
if (!m_RegisterWindow)
{
m_RegisterWindow = new CRegisterWindow(this);
}
if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(this);
m_RegisterWindow->Show(true);
}
else // hide
@ -329,11 +324,7 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
// 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) m_RegisterWindow->Hide();
}
}

View File

@ -43,7 +43,7 @@
enum
{
IDM_ADDRBOX = 350,
IDM_MEM_ADDRBOX = 350,
IDM_SYMBOLLIST,
IDM_SETVALBUTTON,
IDM_DUMP_MEMORY,
@ -51,7 +51,7 @@ enum
};
BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame)
EVT_TEXT(IDM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange)
EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage)
EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue)
@ -74,7 +74,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
//sizerBig->Add(sizerLeft, 1, wxEXPAND);
sizerBig->Add(memview, 20, wxEXPAND);
sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, _T("")));
sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T("")));
sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _T("Set &Value")));