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
// http://code.google.com/p/dolphin-emu/
#include "BreakPointDlg.h"
#include "Common.h"
#include "Host.h"
#include "Debugger.h"
#include "StringUtil.h"
#include "PowerPC/PowerPC.h"
#include "BreakPointWindow.h"
#include "BreakPointDlg.h"
BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
EVT_CLOSE(BreakPointDlg::OnClose)
@ -29,9 +29,11 @@ BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel)
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)
, Parent(_Parent)
{
CreateGUIControls();
}
@ -46,8 +48,7 @@ void BreakPointDlg::CreateGUIControls()
{
SetIcon(wxNullIcon);
SetSize(8,8,279,121);
Center();
Center();
wxStaticText* WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Address"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1"));
@ -73,7 +74,8 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
if (AsciiToHex(AddressString.mb_str(), Address))
{
PowerPC::breakpoints.Add(Address);
Host_UpdateBreakPointView();
Parent->NotifyUpdate();
//Host_UpdateBreakPointView();
Close();
}
}

View File

@ -26,21 +26,20 @@
#include <wx/textctrl.h>
#include <wx/statbox.h>
#undef BreakPointDlg_STYLE
#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class BreakPointDlg : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
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();
private:
CBreakPointWindow *Parent;
wxButton *m_pButtonOK;
wxButton *m_pButtonCancel;
wxTextCtrl *m_pEditAddress;

View File

@ -33,8 +33,6 @@ extern "C" {
#include "../resources/toolbar_delete.c"
}
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame)
EVT_CLOSE(CBreakPointWindow::OnClose)
EVT_MENU(IDM_DELETE, CBreakPointWindow::OnDelete)
@ -57,26 +55,18 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
// Create the toolbar
RecreateToolbar();
}
CBreakPointWindow::~CBreakPointWindow()
{}
void
CBreakPointWindow::Save(IniFile& _IniFile) const
void CBreakPointWindow::Save(IniFile& _IniFile) const
{
_IniFile.Set("BreakPoint", "x", GetPosition().x);
_IniFile.Set("BreakPoint", "y", GetPosition().y);
_IniFile.Set("BreakPoint", "w", GetSize().GetWidth());
_IniFile.Set("BreakPoint", "h", GetSize().GetHeight());
}
void
CBreakPointWindow::Load(IniFile& _IniFile)
void CBreakPointWindow::Load(IniFile& _IniFile)
{
int x,y,w,h;
_IniFile.Get("BreakPoint", "x", &x, GetPosition().x);
@ -86,9 +76,7 @@ CBreakPointWindow::Load(IniFile& _IniFile)
SetSize(x, y, w, h);
}
void
CBreakPointWindow::CreateGUIControls()
void CBreakPointWindow::CreateGUIControls()
{
SetTitle(wxT("Breakpoints"));
SetIcon(wxNullIcon);
@ -101,9 +89,7 @@ CBreakPointWindow::CreateGUIControls()
NotifyUpdate();
}
void
CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
void CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
{
int w = m_Bitmaps[Toolbar_Delete].GetWidth(),
h = m_Bitmaps[Toolbar_Delete].GetHeight();
@ -129,13 +115,11 @@ CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
toolBar->Realize();
}
void
CBreakPointWindow::RecreateToolbar()
void CBreakPointWindow::RecreateToolbar()
{
// delete and recreate the toolbar
wxToolBarBase* toolBar = GetToolBar();
long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;
long style = toolBar ? toolBar->GetWindowStyle() : wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
delete toolBar;
SetToolBar(NULL);
@ -147,9 +131,7 @@ CBreakPointWindow::RecreateToolbar()
SetToolBar(theToolBar);
}
void
CBreakPointWindow::InitBitmaps()
void CBreakPointWindow::InitBitmaps()
{
// load orignal size 48x48
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();
}
void CBreakPointWindow::NotifyUpdate()
{
if (m_BreakPointListView != NULL)
{
m_BreakPointListView->Update();
}
if (m_BreakPointListView != NULL) m_BreakPointListView->Update();
}
void
CBreakPointWindow::OnDelete(wxCommandEvent& event)
void CBreakPointWindow::OnDelete(wxCommandEvent& event)
{
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
// ------------
void
CBreakPointWindow::OnClear(wxCommandEvent& event)
void CBreakPointWindow::OnClear(wxCommandEvent& event)
{
PowerPC::breakpoints.Clear();
NotifyUpdate();
}
// ============
void
CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
// Add one breakpoint
void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
{
BreakPointDlg bpDlg(this);
BreakPointDlg bpDlg(this, this);
bpDlg.ShowModal();
}
// ==========================================================================================
// Load breakpoints from file
// --------------
void
CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
void CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
{
// load ini
IniFile ini;
@ -238,8 +218,8 @@ CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
PowerPC::breakpoints.Add(Address);
}
}
// only update after we are done with the loop
Host_UpdateBreakPointView();
// Only update after we are done with the loop
NotifyUpdate();
}
else
{
@ -247,9 +227,12 @@ CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
}
}
// =================
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Memory check actions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void
CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
{
@ -257,12 +240,8 @@ CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
memDlg.ShowModal();
}
// ==========================================================================================
// Load memory checks from file
// --------------
void
CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
void CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
{
// load ini
IniFile ini;
@ -340,28 +319,12 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
PowerPC::memchecks.Add(MemCheck);
}
}
// update after we are done with the loop
Host_UpdateBreakPointView();
// Update after we are done with the loop
NotifyUpdate();
}
else
{
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
// ----------------------------------------
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CFrame::CFrame(bool showLogWindow,
wxFrame* parent,
wxWindowID id,
@ -331,7 +331,7 @@ CFrame::CFrame(bool showLogWindow,
{
// Start debugging mazimized
if (UseDebugger) this->Maximize(true);
//if (UseDebugger) this->Maximize(true);
// Debugger class
if (UseDebugger)
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
@ -361,6 +361,7 @@ CFrame::CFrame(bool showLogWindow,
// -------------------------------------------------------------------------
// Panels
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// This panel is the parent for rendering and it holds the gamelistctrl
m_Panel = new CPanel(this, IDM_MPANEL);
//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_NB1 = 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
{
@ -415,7 +416,6 @@ CFrame::CFrame(bool showLogWindow,
----------------------------
*/
// This panel is the parent for rendering and it holds the gamelistctrl
if (UseDebugger)
{
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);
}
void Host_UpdateMainFrame()
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
@ -416,7 +415,7 @@ void Host_UpdateMainFrame()
wxPostEvent(g_pCodeWindow, event);
}
}
// Remove this?
void Host_UpdateBreakPointView()
{
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)
{
// Convert it to a simpler byte format