Make the break point window toolbar a real toolbar, and general debugger gui cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7263 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2011-02-27 23:03:08 +00:00
parent e926b28480
commit 50c2f61d24
8 changed files with 191 additions and 255 deletions

View File

@ -15,57 +15,47 @@
// 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 <wx/wx.h> #include "BreakpointDlg.h"
//#include "Host.h"
#include "Common.h"
#include "Host.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "BreakpointWindow.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)
EVT_BUTTON(ID_OK, BreakPointDlg::OnOK) EVT_BUTTON(wxID_OK, BreakPointDlg::OnOK)
EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel) EVT_BUTTON(wxID_CANCEL, BreakPointDlg::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
class CBreakPointWindow; BreakPointDlg::BreakPointDlg(CBreakPointWindow *_Parent)
: wxDialog(_Parent, wxID_ANY, wxT("BreakPoint"), wxDefaultPosition, wxDefaultSize)
BreakPointDlg::BreakPointDlg(CBreakPointWindow *_Parent, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) , Parent(_Parent)
: wxDialog(parent, id, title, position, size, style)
, Parent(_Parent)
{ {
CreateGUIControls(); m_pEditAddress = new wxTextCtrl(this, wxID_ANY, wxT("80000000"));
wxButton *m_pButtonOK = new wxButton(this, wxID_OK, wxT("OK"));
wxButton *m_pButtonCancel = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->AddStretchSpacer();
sButtons->Add(m_pButtonCancel, 0);
sButtons->Add(m_pButtonOK, 0);
wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL);
sMainSizer->Add(m_pEditAddress, 0, wxEXPAND | wxALL, 5);
sMainSizer->Add(sButtons, 0, wxALL, 5);
SetSizer(sMainSizer);
Layout();
Fit();
} }
void BreakPointDlg::OnClose(wxCloseEvent& WXUNUSED(event))
BreakPointDlg::~BreakPointDlg()
{
}
void BreakPointDlg::CreateGUIControls()
{
SetIcon(wxNullIcon);
SetSize(8,8,279,121);
Center();
m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(192,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
m_pButtonCancel = new wxButton(this, ID_CANCEL, _("Cancel"), wxPoint(112,64), wxSize(73,25), 0, wxDefaultValidator, _("Cancel"));
m_pEditAddress = new wxTextCtrl(this, ID_ADDRESS, wxT("80000000"), wxPoint(56,24), wxSize(197,20), 0, wxDefaultValidator, wxT("WxEdit1"));
}
void BreakPointDlg::OnClose(wxCloseEvent& /*event*/)
{ {
EndModal(wxID_CLOSE);
Destroy(); Destroy();
} }
void BreakPointDlg::OnOK(wxCommandEvent& /*event*/) void BreakPointDlg::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
wxString AddressString = m_pEditAddress->GetLineText(0); wxString AddressString = m_pEditAddress->GetLineText(0);
u32 Address = 0; u32 Address = 0;
@ -76,9 +66,11 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
//Host_UpdateBreakPointView(); //Host_UpdateBreakPointView();
Close(); Close();
} }
else
PanicAlert("The address %s is invalid.", (const char *)AddressString.ToUTF8());
} }
void BreakPointDlg::OnCancel(wxCommandEvent& /*event*/) void BreakPointDlg::OnCancel(wxCommandEvent& WXUNUSED(event))
{ {
Close(); Close();
} }

View File

@ -20,47 +20,24 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/stattext.h> class CBreakPointWindow;
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
class BreakPointDlg : public wxDialog class BreakPointDlg : public wxDialog
{ {
private: public:
DECLARE_EVENT_TABLE(); BreakPointDlg(CBreakPointWindow *_Parent);
public: private:
BreakPointDlg(CBreakPointWindow *, wxWindow *parent, wxWindowID id = 1, const wxString &title = _("BreakPoint"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX);
virtual ~BreakPointDlg();
private: CBreakPointWindow *Parent;
wxTextCtrl *m_pEditAddress;
CBreakPointWindow *Parent; void OnClose(wxCloseEvent& WXUNUSED(event));
wxButton *m_pButtonOK; void OnCancel(wxCommandEvent& WXUNUSED(event));
wxButton *m_pButtonCancel; void OnOK(wxCommandEvent& WXUNUSED(event));
wxTextCtrl *m_pEditAddress;
private: DECLARE_EVENT_TABLE();
enum
{
ID_WXSTATICTEXT1 = 1006,
ID_OK = 1005,
ID_CANCEL = 1004,
ID_ADDRESS = 1003,
ID_WXSTATICBOX1 = 1001,
};
private:
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void OnCancel(wxCommandEvent& event);
void OnOK(wxCommandEvent& event);
}; };
#endif #endif

View File

@ -16,8 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/mstream.h>
#include <wx/imaglist.h>
#include "BreakpointView.h" #include "BreakpointView.h"
#include "DebuggerUIUtil.h" #include "DebuggerUIUtil.h"
@ -26,12 +24,11 @@
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "HW/Memmap.h" #include "HW/Memmap.h"
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id, CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id)
const wxPoint& pos, const wxSize& size, long style) : wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
: wxListCtrl(parent, id, pos, size, style) wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING)
{ {
SetFont(DebuggerFont); SetFont(DebuggerFont);
Refresh(); Refresh();
} }
@ -39,11 +36,11 @@ void CBreakPointView::Update()
{ {
ClearAll(); ClearAll();
InsertColumn(0, _("Active"), wxLIST_FORMAT_LEFT, 50); InsertColumn(0, wxT("Active"));
InsertColumn(1, _("Type"), wxLIST_FORMAT_LEFT, 50); InsertColumn(1, wxT("Type"));
InsertColumn(2, _("Function"), wxLIST_FORMAT_CENTER, 200); InsertColumn(2, wxT("Function"));
InsertColumn(3, _("Address"), wxLIST_FORMAT_LEFT, 100); InsertColumn(3, wxT("Address"));
InsertColumn(4, _("Flags"), wxLIST_FORMAT_CENTER, 100); InsertColumn(4, wxT("Flags"));
char szBuffer[64]; char szBuffer[64];
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints(); const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
@ -105,9 +102,6 @@ void CBreakPointView::Update()
SetItemData(Item, rMemCheck.StartAddress); SetItemData(Item, rMemCheck.StartAddress);
} }
SetColumnWidth(2, -1);
SetColumnWidth(3, -1);
Refresh(); Refresh();
} }

View File

@ -25,8 +25,7 @@
class CBreakPointView : public wxListCtrl class CBreakPointView : public wxListCtrl
{ {
public: public:
CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, CBreakPointView(wxWindow* parent, const wxWindowID id);
const wxSize& size, long style);
void Update(); void Update();
void DeleteCurrentSelection(); void DeleteCurrentSelection();

View File

@ -15,7 +15,6 @@
// 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 <wx/wx.h>
#include <wx/imaglist.h> #include <wx/imaglist.h>
#include "BreakpointView.h" #include "BreakpointView.h"
@ -33,116 +32,117 @@ extern "C" {
#include "../../resources/toolbar_debugger_delete.c" #include "../../resources/toolbar_debugger_delete.c"
} }
#include <map> #define _connect_macro_(id, handler) \
typedef void (CBreakPointWindow::*toolbar_func)(); Connect(id, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(handler), (wxObject*)0, (wxEvtHandler*)parent)
typedef std::map<long, toolbar_func> toolbar_m;
typedef std::pair<long, toolbar_func> toolbar_p;
toolbar_m toolbar_map;
class CBreakPointBar : public wxListCtrl class CBreakPointBar : public wxAuiToolBar
{ {
public:
CBreakPointBar(wxWindow* parent, const wxWindowID id)
: wxAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT)
{
SetToolBitmapSize(wxSize(24, 24));
m_Bitmaps[Toolbar_Delete] =
wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(24, 24));
m_Bitmaps[Toolbar_Add_BP] =
wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(24, 24));
m_Bitmaps[Toolbar_Add_MC] =
wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(24, 24));
AddTool(ID_DELETE, wxT("Delete"), m_Bitmaps[Toolbar_Delete]);
_connect_macro_(ID_DELETE, CBreakPointWindow::OnDelete);
AddTool(ID_CLEAR, wxT("Clear"), m_Bitmaps[Toolbar_Delete]);
_connect_macro_(ID_CLEAR, CBreakPointWindow::OnClear);
AddTool(ID_ADDBP, wxT("+BP"), m_Bitmaps[Toolbar_Add_BP]);
_connect_macro_(ID_ADDBP, CBreakPointWindow::OnAddBreakPoint);
// Add memory breakpoints if you can use them
if (Memory::AreMemoryBreakpointsActivated())
{
AddTool(ID_ADDMC, wxT("+MC"), m_Bitmaps[Toolbar_Add_MC]);
_connect_macro_(ID_ADDMC, CBreakPointWindow::OnAddMemoryCheck);
}
AddTool(ID_LOAD, wxT("Load"), m_Bitmaps[Toolbar_Delete]);
_connect_macro_(ID_LOAD, CBreakPointWindow::LoadAll);
AddTool(ID_SAVE, wxT("Save"), m_Bitmaps[Toolbar_Delete]);
_connect_macro_(ID_SAVE, CBreakPointWindow::Event_SaveAll);
}
private:
enum enum
{ {
Toolbar_Delete, Toolbar_Delete,
Toolbar_Add_BP, Toolbar_Add_BP,
Toolbar_Add_MC, Toolbar_Add_MC,
Bitmaps_max Num_Bitmaps
}; };
wxBitmap m_Bitmaps[Bitmaps_max];
public: enum
CBreakPointBar(CBreakPointWindow* parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl((wxWindow*)parent, id, pos, size, style)
{ {
SetBackgroundColour(wxColour(0x555555)); ID_DELETE = 2000,
SetForegroundColour(wxColour(0xffffff)); ID_CLEAR,
ID_ADDBP,
ID_ADDMC,
ID_LOAD,
ID_SAVE
};
// load original size 48x48 wxBitmap m_Bitmaps[Num_Bitmaps];
wxMemoryInputStream st1(toolbar_delete_png, sizeof(toolbar_delete_png));
wxMemoryInputStream st2(toolbar_add_breakpoint_png, sizeof(toolbar_add_breakpoint_png));
wxMemoryInputStream st3(toolbar_add_memcheck_png, sizeof(toolbar_add_memcheck_png));
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxImage(st1, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxImage(st2, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxImage(st3, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
m_imageListNormal = new wxImageList(24, 24);
m_imageListNormal->Add(m_Bitmaps[Toolbar_Delete]);
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_BP]);
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_MC]);
AssignImageList(m_imageListNormal, wxIMAGE_LIST_NORMAL);
toolbar_map.insert(toolbar_p(InsertItem(0, _("Delete"), 0), &CBreakPointWindow::OnDelete));
toolbar_map.insert(toolbar_p(InsertItem(1, _("Clear"), 0), &CBreakPointWindow::OnClear));
toolbar_map.insert(toolbar_p(InsertItem(2, _("+BP"), 1), &CBreakPointWindow::OnAddBreakPoint));
// just add memory breakpoints if you can use them
if (Memory::AreMemoryBreakpointsActivated())
{
toolbar_map.insert(toolbar_p(InsertItem(3, _("+MC"), 2), &CBreakPointWindow::OnAddMemoryCheck));
toolbar_map.insert(toolbar_p(InsertItem(4, _("Load"), 0), &CBreakPointWindow::LoadAll));
toolbar_map.insert(toolbar_p(InsertItem(5, _("Save"), 0), &CBreakPointWindow::SaveAll));
}
else
{
toolbar_map.insert(toolbar_p(InsertItem(3, _("Load"), 0), &CBreakPointWindow::LoadAll));
toolbar_map.insert(toolbar_p(InsertItem(4, _("Save"), 0), &CBreakPointWindow::SaveAll));
}
}
}; };
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel) BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
EVT_CLOSE(CBreakPointWindow::OnClose) EVT_CLOSE(CBreakPointWindow::OnClose)
EVT_LIST_ITEM_SELECTED(ID_BPS, CBreakPointWindow::OnSelectBP) EVT_LIST_ITEM_SELECTED(ID_BPS, CBreakPointWindow::OnSelectBP)
EVT_LIST_ITEM_RIGHT_CLICK(ID_BPS, CBreakPointWindow::OnRightClick)
EVT_LIST_ITEM_SELECTED(ID_TOOLBAR, CBreakPointWindow::OnSelectToolbar)
END_EVENT_TABLE() END_EVENT_TABLE()
CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent,
wxWindowID id, const wxString& title, const wxPoint& position, wxWindowID id, const wxString& title, const wxPoint& position,
const wxSize& size, long style) const wxSize& size, long style)
: wxPanel(parent, id, position, size, style, title) : wxPanel(parent, id, position, size, style, title)
, m_BreakPointListView(NULL)
, m_pCodeWindow(_pCodeWindow) , m_pCodeWindow(_pCodeWindow)
{ {
CreateGUIControls(); CreateGUIControls();
} }
void CBreakPointWindow::OnClose(wxCloseEvent& WXUNUSED(event)) CBreakPointWindow::~CBreakPointWindow()
{
m_mgr.UnInit();
}
void CBreakPointWindow::OnClose(wxCloseEvent& event)
{ {
SaveAll(); SaveAll();
event.Skip();
} }
void CBreakPointWindow::CreateGUIControls() void CBreakPointWindow::CreateGUIControls()
{ {
m_BreakPointBar = new CBreakPointBar(this, ID_TOOLBAR, wxDefaultPosition, wxSize(0, 55), m_mgr.SetManagedWindow(this);
wxLC_ICON | wxSUNKEN_BORDER | wxLC_SINGLE_SEL); m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
m_BreakPointListView = new CBreakPointView(this, ID_BPS, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
wxBoxSizer* sizerH = new wxBoxSizer(wxVERTICAL); m_BreakPointListView = new CBreakPointView(this, ID_BPS);
sizerH->Add(m_BreakPointBar, 0, wxALL | wxEXPAND);
sizerH->Add(m_BreakPointListView, 1, wxEXPAND);
SetSizer(sizerH); m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
} LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false));
m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane());
void CBreakPointWindow::OnSelectToolbar(wxListEvent& event) m_mgr.Update();
{
(this->*toolbar_map[event.GetItem().GetId()])();
m_BreakPointBar->SetItemState(event.GetItem().GetId(), 0, wxLIST_STATE_SELECTED);
} }
void CBreakPointWindow::NotifyUpdate() void CBreakPointWindow::NotifyUpdate()
{ {
if (m_BreakPointListView) m_BreakPointListView->Update();
m_BreakPointListView->Update();
} }
void CBreakPointWindow::OnDelete() void CBreakPointWindow::OnDelete(wxCommandEvent& WXUNUSED(event))
{ {
if (m_BreakPointListView) m_BreakPointListView->DeleteCurrentSelection();
m_BreakPointListView->DeleteCurrentSelection();
} }
// jump to begin addr // jump to begin addr
@ -157,31 +157,31 @@ void CBreakPointWindow::OnSelectBP(wxListEvent& event)
} }
} }
// modify
void CBreakPointWindow::OnRightClick(wxListEvent& event)
{
}
// Clear all breakpoints and memchecks // Clear all breakpoints and memchecks
void CBreakPointWindow::OnClear() void CBreakPointWindow::OnClear(wxCommandEvent& WXUNUSED(event))
{ {
PowerPC::breakpoints.Clear(); PowerPC::breakpoints.Clear();
PowerPC::memchecks.Clear(); PowerPC::memchecks.Clear();
NotifyUpdate(); NotifyUpdate();
} }
void CBreakPointWindow::OnAddBreakPoint() void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& WXUNUSED(event))
{ {
BreakPointDlg bpDlg(this, this); BreakPointDlg bpDlg(this);
bpDlg.ShowModal(); bpDlg.ShowModal();
} }
void CBreakPointWindow::OnAddMemoryCheck() void CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event))
{ {
MemoryCheckDlg memDlg(this); MemoryCheckDlg memDlg(this);
memDlg.ShowModal(); memDlg.ShowModal();
} }
void CBreakPointWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event))
{
SaveAll();
}
void CBreakPointWindow::SaveAll() void CBreakPointWindow::SaveAll()
{ {
// simply dump all to bp/mc files in a way we can read again // simply dump all to bp/mc files in a way we can read again
@ -194,7 +194,7 @@ void CBreakPointWindow::SaveAll()
} }
} }
void CBreakPointWindow::LoadAll() void CBreakPointWindow::LoadAll(wxCommandEvent& WXUNUSED(event))
{ {
IniFile ini; IniFile ini;
BreakPoints::TBreakPointsStr newbps; BreakPoints::TBreakPointsStr newbps;

View File

@ -18,51 +18,52 @@
#ifndef __BREAKPOINTWINDOW_h__ #ifndef __BREAKPOINTWINDOW_h__
#define __BREAKPOINTWINDOW_h__ #define __BREAKPOINTWINDOW_h__
#include <wx/wx.h>
#include <wx/aui/aui.h>
class CBreakPointView; class CBreakPointView;
class CBreakPointBar; class CBreakPointBar;
class CCodeWindow; class CCodeWindow;
class wxListEvent; class wxListEvent;
class IniFile; class IniFile;
class CBreakPointWindow class CBreakPointWindow : public wxPanel
: public wxPanel
{ {
public: public:
CBreakPointWindow(CCodeWindow* _pCodeWindow, CBreakPointWindow(CCodeWindow* _pCodeWindow,
wxWindow* parent, wxWindow* parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString& title = _("Breakpoints"), const wxString& title = wxT("Breakpoints"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxBORDER_NONE); long style = wxTAB_TRAVERSAL | wxBORDER_NONE);
~CBreakPointWindow();
void NotifyUpdate(); void NotifyUpdate();
void OnDelete(); void OnDelete(wxCommandEvent& WXUNUSED(event));
void OnClear(); void OnClear(wxCommandEvent& WXUNUSED(event));
void OnAddBreakPoint(); void OnAddBreakPoint(wxCommandEvent& WXUNUSED(event));
void OnAddMemoryCheck(); void OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event));
void Event_SaveAll(wxCommandEvent& WXUNUSED(event));
void SaveAll(); void SaveAll();
void LoadAll(); void LoadAll(wxCommandEvent& WXUNUSED(event));
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
enum enum
{ {
ID_TOOLBAR = 501,
ID_BPS = 1002, ID_BPS = 1002,
}; };
CBreakPointBar* m_BreakPointBar; wxAuiManager m_mgr;
CBreakPointView* m_BreakPointListView; CBreakPointView* m_BreakPointListView;
CCodeWindow* m_pCodeWindow; CCodeWindow* m_pCodeWindow;
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);
void OnSelectToolbar(wxListEvent& event);
void OnSelectBP(wxListEvent& event); void OnSelectBP(wxListEvent& event);
void OnRightClick(wxListEvent& event);
void CreateGUIControls(); void CreateGUIControls();
}; };

View File

@ -21,60 +21,67 @@
#include "Host.h" #include "Host.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#define TEXT_BOX(text) new wxStaticText(this, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize)
BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog) BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog)
EVT_CLOSE(MemoryCheckDlg::OnClose) EVT_CLOSE(MemoryCheckDlg::OnClose)
EVT_BUTTON(ID_OK, MemoryCheckDlg::OnOK) EVT_BUTTON(wxID_OK, MemoryCheckDlg::OnOK)
EVT_BUTTON(ID_CANCEL, MemoryCheckDlg::OnCancel) EVT_BUTTON(wxID_CANCEL, MemoryCheckDlg::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
MemoryCheckDlg::MemoryCheckDlg(wxWindow *parent)
MemoryCheckDlg::MemoryCheckDlg(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, wxID_ANY, _("Memory Check"), wxDefaultPosition, wxDefaultSize)
: wxDialog(parent, id, title, position, size, style)
{ {
CreateGUIControls(); m_pEditStartAddress = new wxTextCtrl(this, wxID_ANY, wxT(""));
} m_pEditEndAddress = new wxTextCtrl(this, wxID_ANY, wxT(""));
m_pWriteFlag = new wxCheckBox(this, wxID_ANY, _("Write"));
MemoryCheckDlg::~MemoryCheckDlg()
{
}
void MemoryCheckDlg::CreateGUIControls()
{
SetIcon(wxNullIcon);
SetSize(8,8,470,122);
Center();
m_pButtonCancel = new wxButton(this, ID_CANCEL, _("Cancel"), wxPoint(248,64), wxSize(73,25), 0, wxDefaultValidator, _("Cancel"));
m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(328,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
m_pReadFlag = new wxCheckBox(this, ID_READ_FLAG, _("Read"), wxPoint(336,33), wxSize(57,15), 0, wxDefaultValidator, _("Read"));
m_pWriteFlag = new wxCheckBox(this, ID_WRITE_FLAG, _("Write"), wxPoint(336,16), wxSize(57,17), 0, wxDefaultValidator, wxT("WxCheckBox1"));
m_pWriteFlag->SetValue(true); m_pWriteFlag->SetValue(true);
m_log_flag = new wxCheckBox(this, ID_LOG_FLAG, _("Log"), wxPoint(420,16), wxSize(57,17), 0, wxDefaultValidator, wxT("WxCheckBox2")); m_pReadFlag = new wxCheckBox(this, wxID_ANY, _("Read"));
m_log_flag = new wxCheckBox(this, wxID_ANY, _("Log"));
m_log_flag->SetValue(true); m_log_flag->SetValue(true);
m_break_flag = new wxCheckBox(this, ID_BREAK_FLAG, _("Break"), wxPoint(420,33), wxSize(57,15), 0, wxDefaultValidator, wxT("WxCheckBox2")); m_break_flag = new wxCheckBox(this, wxID_ANY, _("Break"));
new wxStaticBox(this, ID_WXSTATICBOX2, _("Action"), wxPoint(328,0), wxSize(73,57)); wxStaticBoxSizer *sAddressRangeBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Address Range"));
sAddressRangeBox->Add(TEXT_BOX("Start"), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
sAddressRangeBox->Add(m_pEditStartAddress, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, 10);
sAddressRangeBox->Add(TEXT_BOX("End"), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
sAddressRangeBox->Add(m_pEditEndAddress, 1, wxALIGN_CENTER_VERTICAL);
new wxStaticText(this, ID_WXSTATICTEXT2, _("End"), wxPoint(168,24), wxDefaultSize, 0, wxT("WxStaticText2")); wxStaticBoxSizer *sActionBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Action"));
sActionBox->Add(m_pWriteFlag);
sActionBox->Add(m_pReadFlag);
new wxStaticText(this, ID_WXSTATICTEXT1, _("Start"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1")); wxBoxSizer* sFlags = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Flags"));
sFlags->Add(m_log_flag);
sFlags->Add(m_break_flag);
m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT(""), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1")); wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->AddStretchSpacer();
sButtons->Add(new wxButton(this, wxID_CANCEL, _("Cancel")));
sButtons->Add(new wxButton(this, wxID_OK, wxT("OK")));
m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT(""), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2")); wxBoxSizer *sControls = new wxBoxSizer(wxHORIZONTAL);
sControls->Add(sAddressRangeBox, 0, wxEXPAND);
sControls->Add(sActionBox, 0, wxEXPAND);
sControls->Add(sFlags, 0, wxEXPAND);
new wxStaticBox(this, ID_WXSTATICBOX1, _("Address Range"), wxPoint(0,0), wxSize(321,57)); wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL);
sMainSizer->Add(sControls, 0, wxEXPAND | wxALL, 5);
sMainSizer->Add(sButtons, 0, wxEXPAND | wxALL, 5);
SetSizer(sMainSizer);
Layout();
Fit();
} }
void MemoryCheckDlg::OnClose(wxCloseEvent& /*event*/) void MemoryCheckDlg::OnClose(wxCloseEvent& WXUNUSED(event))
{ {
EndModal(wxID_CLOSE);
Destroy(); Destroy();
} }
void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/) void MemoryCheckDlg::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
wxString StartAddressString = m_pEditStartAddress->GetLineText(0); wxString StartAddressString = m_pEditStartAddress->GetLineText(0);
wxString EndAddressString = m_pEditEndAddress->GetLineText(0); wxString EndAddressString = m_pEditEndAddress->GetLineText(0);
@ -109,7 +116,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
} }
} }
void MemoryCheckDlg::OnCancel(wxCommandEvent& /*event*/) void MemoryCheckDlg::OnCancel(wxCommandEvent& WXUNUSED(event))
{ {
Close(); Close();
} }

View File

@ -19,29 +19,13 @@
#define __MEMORYCHECKDLG_h__ #define __MEMORYCHECKDLG_h__
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#undef MemoryCheckDlg_STYLE
#define MemoryCheckDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxSTAY_ON_TOP | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class MemoryCheckDlg : public wxDialog class MemoryCheckDlg : public wxDialog
{ {
private:
DECLARE_EVENT_TABLE();
public: public:
MemoryCheckDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Memory Check"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MemoryCheckDlg_STYLE); MemoryCheckDlg(wxWindow *parent);
virtual ~MemoryCheckDlg();
private: private:
wxButton* m_pButtonCancel;
wxButton* m_pButtonOK;
wxCheckBox* m_pReadFlag; wxCheckBox* m_pReadFlag;
wxCheckBox* m_pWriteFlag; wxCheckBox* m_pWriteFlag;
wxCheckBox* m_log_flag; wxCheckBox* m_log_flag;
@ -49,29 +33,11 @@ class MemoryCheckDlg : public wxDialog
wxTextCtrl* m_pEditEndAddress; wxTextCtrl* m_pEditEndAddress;
wxTextCtrl* m_pEditStartAddress; wxTextCtrl* m_pEditStartAddress;
private: void OnClose(wxCloseEvent& WXUNUSED(event));
void OnOK(wxCommandEvent& WXUNUSED(event));
void OnCancel(wxCommandEvent& WXUNUSED(event));
enum DECLARE_EVENT_TABLE();
{
ID_BREAK_FLAG = 1018,
ID_LOG_FLAG = 1017,
ID_CANCEL = 1016,
ID_OK = 1015,
ID_READ_FLAG = 1014,
ID_WRITE_FLAG = 1013,
ID_WXSTATICBOX2 = 1012,
ID_EDIT_END_ADDRESS = 1011,
ID_WXSTATICTEXT2 = 1010,
ID_WXSTATICTEXT1 = 1009,
ID_EDIT_START_ADDR = 1008,
ID_WXSTATICBOX1 = 1007,
};
private:
void OnClose(wxCloseEvent& event);
void OnOK(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void CreateGUIControls();
}; };
#endif #endif