1
//////////////////////////////////////////////////////////////////////////////
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : debuggerpane.cpp
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
//////////////////////////////////////////////////////////////////////////////
24
//////////////////////////////////////////////////////////////////////////////
25
#include <wx/aui/framemanager.h>
26
#include "dockablepane.h"
27
#include "editor_config.h"
28
#include "detachedpanesinfo.h"
29
#include "wx/dcbuffer.h"
30
#include "memoryview.h"
31
#include "debuggerpane.h"
32
#include "localvarstree.h"
33
#include "simpletable.h"
34
#include "listctrlpanel.h"
35
#include "wx/xrc/xmlres.h"
37
#include "breakpointdlg.h"
38
#include "threadlistpanel.h"
40
const wxString DebuggerPane::LOCALS = wxT("Locals");
41
const wxString DebuggerPane::WATCHES = wxT("Watches");
42
const wxString DebuggerPane::FRAMES = wxT("Call Stack");
43
const wxString DebuggerPane::BREAKPOINTS = wxT("Breakpoints");
44
const wxString DebuggerPane::THREADS = wxT("Threads");
45
const wxString DebuggerPane::MEMORY = wxT("Memory");
47
/*#define ADD_DEBUGGER_PAGE(win, name, bmp) \
48
if( detachedPanes.Index(name) != wxNOT_FOUND ) {\
50
DockablePane *pane = new DockablePane(GetParent(), m_book, win, name, bmp, wxSize(200, 200));\
51
m_mgr->AddPane(pane, info.Name(name).Caption(name));\
53
m_book->AddPage(win, name, bmp, false);\
56
#define ADD_DEBUGGER_PAGE(win, name, bmp) \
57
if( detachedPanes.Index(name) != wxNOT_FOUND ) {\
58
new DockablePane(GetParent(), m_book, win, name, bmp, wxSize(200, 200));\
60
m_book->AddPage(win, name, name, bmp, false);\
63
BEGIN_EVENT_TABLE(DebuggerPane, wxPanel)
64
EVT_PAINT(DebuggerPane::OnPaint)
65
EVT_ERASE_BACKGROUND(DebuggerPane::OnEraseBg)
66
EVT_SIZE(DebuggerPane::OnSize)
67
EVT_BOOK_PAGE_CHANGED(wxID_ANY, DebuggerPane::OnPageChanged)
70
DebuggerPane::DebuggerPane(wxWindow *parent, const wxString &caption, wxAuiManager *mgr)
71
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(400, 300))
79
DebuggerPane::~DebuggerPane()
83
void DebuggerPane::OnPageChanged(NotebookEvent &event)
86
if (event.GetEventObject() == m_book) {
87
ManagerST::Get()->UpdateDebuggerPane();
94
void DebuggerPane::CreateGUIControls()
96
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
99
m_book = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVB_TOP);
100
mainSizer->Add(m_book, 1, wxEXPAND|wxALL, 1);
102
// load list of detached panes
103
wxArrayString detachedPanes;
104
DetachedPanesInfo dpi;
105
EditorConfigST::Get()->ReadObject(wxT("DetachedPanesList"), &dpi);
106
detachedPanes = dpi.GetPanes();
108
m_localsTree = new LocalVarsTree(m_book, wxID_ANY);
109
ADD_DEBUGGER_PAGE(m_localsTree, LOCALS, wxXmlResource::Get()->LoadBitmap(wxT("locals_view")));
111
//add the watches view
112
m_watchesTable = new SimpleTable(m_book);
113
ADD_DEBUGGER_PAGE(m_watchesTable, WATCHES, wxXmlResource::Get()->LoadBitmap(wxT("watches")));
115
m_frameList = new ListCtrlPanel(m_book);
116
ADD_DEBUGGER_PAGE(m_frameList, FRAMES, wxXmlResource::Get()->LoadBitmap(wxT("frames")));
118
m_breakpoints = new BreakpointDlg(m_book);
119
ADD_DEBUGGER_PAGE(m_breakpoints, BREAKPOINTS, wxXmlResource::Get()->LoadBitmap(wxT("breakpoint")));
121
m_threads = new ThreadListPanel(m_book);
122
ADD_DEBUGGER_PAGE(m_threads, THREADS, wxXmlResource::Get()->LoadBitmap(wxT("threads")));
124
m_memory = new MemoryView(m_book);
125
ADD_DEBUGGER_PAGE(m_memory, MEMORY, wxXmlResource::Get()->LoadBitmap(wxT("memory_view")));
130
void DebuggerPane::SelectTab(const wxString &tabName)
132
for (size_t i=0; i< m_book->GetPageCount(); i++) {
133
if (m_book->GetPageText(i) == tabName) {
134
m_book->SetSelection(i);
140
void DebuggerPane::Clear()
142
GetLocalsTree()->Clear();
143
GetWatchesTable()->Clear();
144
GetFrameListView()->Clear();
145
GetThreadsView()->Clear();
146
GetMemoryView()->Clear();
149
void DebuggerPane::OnEraseBg(wxEraseEvent &e)
154
void DebuggerPane::OnPaint(wxPaintEvent &e)
157
wxBufferedPaintDC dc(this);
158
dc.SetPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW) );
159
dc.SetBrush( *wxTRANSPARENT_BRUSH );
161
dc.DrawRectangle( wxRect(GetSize()) );
164
void DebuggerPane::OnSize(wxSizeEvent &e)