GUI: Fixed breakpoints toolbar

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4078 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-27 11:08:52 +00:00
parent 273f8ed4e9
commit 5f3752d358
5 changed files with 61 additions and 98 deletions

View File

@ -15,13 +15,13 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "BreakPointDlg.h"
#include "Common.h" #include "Common.h"
#include "Host.h" #include "Host.h"
#include "Debugger.h" #include "Debugger.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "BreakPointWindow.h"
#include "BreakPointDlg.h"
BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog) BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
EVT_CLOSE(BreakPointDlg::OnClose) EVT_CLOSE(BreakPointDlg::OnClose)
@ -29,9 +29,11 @@ BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel) EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
class CBreakPointWindow;
BreakPointDlg::BreakPointDlg(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) BreakPointDlg::BreakPointDlg(CBreakPointWindow *_Parent, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
, Parent(_Parent)
{ {
CreateGUIControls(); CreateGUIControls();
} }
@ -48,7 +50,6 @@ void BreakPointDlg::CreateGUIControls()
SetSize(8,8,279,121); SetSize(8,8,279,121);
Center(); Center();
wxStaticText* WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Address"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1")); wxStaticText* WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Address"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1"));
m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(192,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK")); m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(192,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
@ -73,7 +74,8 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
if (AsciiToHex(AddressString.mb_str(), Address)) if (AsciiToHex(AddressString.mb_str(), Address))
{ {
PowerPC::breakpoints.Add(Address); PowerPC::breakpoints.Add(Address);
Host_UpdateBreakPointView(); Parent->NotifyUpdate();
//Host_UpdateBreakPointView();
Close(); Close();
} }
} }

View File

@ -26,21 +26,20 @@
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#undef BreakPointDlg_STYLE
#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class BreakPointDlg : public wxDialog class BreakPointDlg : public wxDialog
{ {
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
public: public:
BreakPointDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("BreakPoint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = BreakPointDlg_STYLE); BreakPointDlg(CBreakPointWindow *, wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("BreakPoint"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX);
virtual ~BreakPointDlg(); virtual ~BreakPointDlg();
private: private:
CBreakPointWindow *Parent;
wxButton *m_pButtonOK; wxButton *m_pButtonOK;
wxButton *m_pButtonCancel; wxButton *m_pButtonCancel;
wxTextCtrl *m_pEditAddress; wxTextCtrl *m_pEditAddress;

View File

@ -33,8 +33,6 @@ extern "C" {
#include "../resources/toolbar_delete.c" #include "../resources/toolbar_delete.c"
} }
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame) BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame)
EVT_CLOSE(CBreakPointWindow::OnClose) EVT_CLOSE(CBreakPointWindow::OnClose)
EVT_MENU(IDM_DELETE, CBreakPointWindow::OnDelete) EVT_MENU(IDM_DELETE, CBreakPointWindow::OnDelete)
@ -57,26 +55,18 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
// Create the toolbar // Create the toolbar
RecreateToolbar(); RecreateToolbar();
} }
CBreakPointWindow::~CBreakPointWindow() CBreakPointWindow::~CBreakPointWindow()
{} {}
void CBreakPointWindow::Save(IniFile& _IniFile) const
void
CBreakPointWindow::Save(IniFile& _IniFile) const
{ {
_IniFile.Set("BreakPoint", "x", GetPosition().x); _IniFile.Set("BreakPoint", "x", GetPosition().x);
_IniFile.Set("BreakPoint", "y", GetPosition().y); _IniFile.Set("BreakPoint", "y", GetPosition().y);
_IniFile.Set("BreakPoint", "w", GetSize().GetWidth()); _IniFile.Set("BreakPoint", "w", GetSize().GetWidth());
_IniFile.Set("BreakPoint", "h", GetSize().GetHeight()); _IniFile.Set("BreakPoint", "h", GetSize().GetHeight());
} }
void CBreakPointWindow::Load(IniFile& _IniFile)
void
CBreakPointWindow::Load(IniFile& _IniFile)
{ {
int x,y,w,h; int x,y,w,h;
_IniFile.Get("BreakPoint", "x", &x, GetPosition().x); _IniFile.Get("BreakPoint", "x", &x, GetPosition().x);
@ -86,9 +76,7 @@ CBreakPointWindow::Load(IniFile& _IniFile)
SetSize(x, y, w, h); SetSize(x, y, w, h);
} }
void CBreakPointWindow::CreateGUIControls()
void
CBreakPointWindow::CreateGUIControls()
{ {
SetTitle(wxT("Breakpoints")); SetTitle(wxT("Breakpoints"));
SetIcon(wxNullIcon); SetIcon(wxNullIcon);
@ -101,9 +89,7 @@ CBreakPointWindow::CreateGUIControls()
NotifyUpdate(); NotifyUpdate();
} }
void CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
void
CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
{ {
int w = m_Bitmaps[Toolbar_Delete].GetWidth(), int w = m_Bitmaps[Toolbar_Delete].GetWidth(),
h = m_Bitmaps[Toolbar_Delete].GetHeight(); h = m_Bitmaps[Toolbar_Delete].GetHeight();
@ -129,13 +115,11 @@ CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
toolBar->Realize(); toolBar->Realize();
} }
void CBreakPointWindow::RecreateToolbar()
void
CBreakPointWindow::RecreateToolbar()
{ {
// delete and recreate the toolbar // delete and recreate the toolbar
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);
@ -147,9 +131,7 @@ CBreakPointWindow::RecreateToolbar()
SetToolBar(theToolBar); SetToolBar(theToolBar);
} }
void CBreakPointWindow::InitBitmaps()
void
CBreakPointWindow::InitBitmaps()
{ {
// load orignal size 48x48 // load orignal size 48x48
m_Bitmaps[Toolbar_Delete] = wxGetBitmapFromMemory(toolbar_delete_png); m_Bitmaps[Toolbar_Delete] = wxGetBitmapFromMemory(toolbar_delete_png);
@ -163,25 +145,17 @@ CBreakPointWindow::InitBitmaps()
} }
} }
void CBreakPointWindow::OnClose(wxCloseEvent& /*event*/)
void
CBreakPointWindow::OnClose(wxCloseEvent& /*event*/)
{ {
Hide(); Hide();
} }
void CBreakPointWindow::NotifyUpdate() void CBreakPointWindow::NotifyUpdate()
{ {
if (m_BreakPointListView != NULL) if (m_BreakPointListView != NULL) m_BreakPointListView->Update();
{
m_BreakPointListView->Update();
}
} }
void CBreakPointWindow::OnDelete(wxCommandEvent& event)
void
CBreakPointWindow::OnDelete(wxCommandEvent& event)
{ {
if (m_BreakPointListView) if (m_BreakPointListView)
{ {
@ -189,31 +163,37 @@ CBreakPointWindow::OnDelete(wxCommandEvent& event)
} }
} }
void CBreakPointWindow::OnActivated(wxListEvent& event)
{
long Index = event.GetIndex();
if (Index >= 0)
{
u32 Address = (u32)m_BreakPointListView->GetItemData(Index);
if (m_pCodeWindow != NULL)
{
m_pCodeWindow->JumpToAddress(Address);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Breakpoint actions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// ==========================================================================================
// Clear all breakpoints // Clear all breakpoints
// ------------ void CBreakPointWindow::OnClear(wxCommandEvent& event)
void
CBreakPointWindow::OnClear(wxCommandEvent& event)
{ {
PowerPC::breakpoints.Clear(); PowerPC::breakpoints.Clear();
NotifyUpdate();
} }
// ============ // Add one breakpoint
void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
void
CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
{ {
BreakPointDlg bpDlg(this); BreakPointDlg bpDlg(this, this);
bpDlg.ShowModal(); bpDlg.ShowModal();
} }
// ==========================================================================================
// Load breakpoints from file // Load breakpoints from file
// -------------- void CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
void
CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
{ {
// load ini // load ini
IniFile ini; IniFile ini;
@ -238,8 +218,8 @@ CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
PowerPC::breakpoints.Add(Address); PowerPC::breakpoints.Add(Address);
} }
} }
// only update after we are done with the loop // Only update after we are done with the loop
Host_UpdateBreakPointView(); NotifyUpdate();
} }
else else
{ {
@ -247,9 +227,12 @@ CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
} }
} }
// ================= /////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Memory check actions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void void
CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event) CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
{ {
@ -257,12 +240,8 @@ CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
memDlg.ShowModal(); memDlg.ShowModal();
} }
// ==========================================================================================
// Load memory checks from file // Load memory checks from file
// -------------- void CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
void
CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
{ {
// load ini // load ini
IniFile ini; IniFile ini;
@ -340,28 +319,12 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
PowerPC::memchecks.Add(MemCheck); PowerPC::memchecks.Add(MemCheck);
} }
} }
// update after we are done with the loop // Update after we are done with the loop
Host_UpdateBreakPointView(); NotifyUpdate();
} }
else else
{ {
wxMessageBox(_T("You have no ") T_FULL_GAMECONFIG_DIR _T("MemoryChecks.ini file")); wxMessageBox(_T("You have no ") T_FULL_GAMECONFIG_DIR _T("MemoryChecks.ini file"));
} }
} }
// ================= /////////////////////////////////////////////////////////////////////////////////////////////////////////
void
CBreakPointWindow::OnActivated(wxListEvent& event)
{
long Index = event.GetIndex();
if (Index >= 0)
{
u32 Address = (u32)m_BreakPointListView->GetItemData(Index);
if (m_pCodeWindow != NULL)
{
m_pCodeWindow->JumpToAddress(Address);
}
}
}

View File

@ -309,7 +309,7 @@ END_EVENT_TABLE()
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////
// Creation and close, quit functions // Creation and close, quit functions
// ---------------------------------------- // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CFrame::CFrame(bool showLogWindow, CFrame::CFrame(bool showLogWindow,
wxFrame* parent, wxFrame* parent,
wxWindowID id, wxWindowID id,
@ -331,7 +331,7 @@ CFrame::CFrame(bool showLogWindow,
{ {
// Start debugging mazimized // Start debugging mazimized
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, this); g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
@ -361,6 +361,7 @@ CFrame::CFrame(bool showLogWindow,
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Panels // Panels
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
// This panel is the parent for rendering and it holds the gamelistctrl
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);
@ -372,7 +373,7 @@ CFrame::CFrame(bool showLogWindow,
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_NB1->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
} }
else else
{ {
@ -415,7 +416,6 @@ CFrame::CFrame(bool showLogWindow,
---------------------------- ----------------------------
*/ */
// This panel is the parent for rendering and it holds the gamelistctrl
if (UseDebugger) if (UseDebugger)
{ {
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());

View File

@ -405,7 +405,6 @@ void Host_ShowJitResults(unsigned int address)
CJitWindow::ViewAddr(address); CJitWindow::ViewAddr(address);
} }
void Host_UpdateMainFrame() void Host_UpdateMainFrame()
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
@ -416,7 +415,7 @@ void Host_UpdateMainFrame()
wxPostEvent(g_pCodeWindow, event); wxPostEvent(g_pCodeWindow, event);
} }
} }
// Remove this?
void Host_UpdateBreakPointView() void Host_UpdateBreakPointView()
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
@ -430,8 +429,8 @@ void Host_UpdateBreakPointView()
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
/* Update Wiimote status bar */ // Update Wiimote status bar
// ¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
void Host_UpdateLeds(int led_bits) void Host_UpdateLeds(int led_bits)
{ {
// Convert it to a simpler byte format // Convert it to a simpler byte format