2
* This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3
* http://www.gnu.org/licenses/gpl-3.0.html
13
#include <wx/treectrl.h>
14
#include <wx/notebook.h>
15
#include <wx/dynarray.h>
17
#include "debugger_defs.h"
19
extern int cbCustom_WATCHES_CHANGED;
21
class WatchTreeData : public wxTreeItemData
24
WatchTreeData(Watch* w) : m_pWatch(w) {}
30
class DebuggerTree : public wxPanel
33
DebuggerTree(wxWindow* parent, DebuggerGDB* debugger);
34
virtual ~DebuggerTree();
35
wxTreeCtrl* GetTree(){ return m_pTree; }
37
void BeginUpdateTree(); ///< Clears and freezes the tree for massive updates
38
void BuildTree(Watch* watch, const wxString& infoText, WatchStringFormat fmt); ///< adds a new node to the tree, parsing @c infoText
39
void EndUpdateTree(); ///< Un-freezes the tree
42
void SetWatches(const WatchesArray& watches);
43
const WatchesArray& GetWatches();
44
void AddWatch(const wxString& watch, WatchFormat format = Undefined, bool notify = true);
45
void DeleteWatch(Watch* watch, bool notify = true);
46
void DeleteWatch(const wxString& watch, WatchFormat format = Any, bool notify = true);
47
void DeleteAllWatches();
48
Watch* FindWatch(const wxString& watch, WatchFormat format = Any);
49
int FindWatchIndex(const wxString& watch, WatchFormat format = Any);
51
void BuildTreeGDB(Watch* watch, const wxString& infoText);
52
void BuildTreeCDB(Watch* watch, const wxString& infoText);
53
void NotifyForChangedWatches();
54
void ShowMenu(wxTreeItemId id, const wxPoint& pt);
55
void OnTreeRightClick(wxTreeEvent& event);
56
void OnRightClick(wxCommandEvent& event);
57
void OnAddWatch(wxCommandEvent& event);
58
void OnLoadWatchFile(wxCommandEvent& event);
59
void OnSaveWatchFile(wxCommandEvent& event);
60
void OnEditWatch(wxCommandEvent& event);
61
void OnDeleteWatch(wxCommandEvent& event);
62
void OnDeleteAllWatches(wxCommandEvent& event);
63
void OnDereferencePointer(wxCommandEvent& event);
64
void OnWatchThis(wxCommandEvent& event);
65
void OnChangeValue(wxCommandEvent& event);
68
DebuggerGDB* m_pDebugger;
69
WatchesArray m_Watches;
70
wxArrayString m_TreeState;
74
// recursive struct to keep all watch tree entries
77
wxString name; // entry's name
78
std::vector<WatchTreeEntry> entries; // child entries
79
Watch* watch; // the associated watch
81
WatchTreeEntry() : watch(0) {}
89
WatchTreeEntry& AddChild(const wxString& childname, Watch* childwatch)
93
wet.watch = childwatch;
94
entries.push_back(wet);
95
return *(--entries.end());
98
WatchTreeEntry m_RootEntry;
100
void BuildTree(WatchTreeEntry& entry, wxTreeItemId parent);
102
void ParseEntry(WatchTreeEntry& entry, Watch* watch, wxString& text, long array_index = -1);
103
int FindCharOutsideQuotes(const wxString& str, wxChar ch); // returns position of ch in str
104
int FindCommaPos(const wxString& str); // ignores commas in function signatures
105
void FixupVarNameForChange(wxString& str);
107
bool m_InUpdateBlock;
108
DECLARE_EVENT_TABLE()
111
#endif // DEBUGGERTREE_H