~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/debuggergdb/debuggertree.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
4
 */
 
5
 
 
6
#ifndef DEBUGGERTREE_H
 
7
#define DEBUGGERTREE_H
 
8
 
 
9
#include <vector>
 
10
 
 
11
#include <wx/intl.h>
 
12
#include <wx/panel.h>
 
13
#include <wx/treectrl.h>
 
14
#include <wx/notebook.h>
 
15
#include <wx/dynarray.h>
 
16
 
 
17
#include "debugger_defs.h"
 
18
 
 
19
extern int cbCustom_WATCHES_CHANGED;
 
20
 
 
21
class WatchTreeData : public wxTreeItemData
 
22
{
 
23
    public:
 
24
        WatchTreeData(Watch* w) : m_pWatch(w) {}
 
25
        Watch* m_pWatch;
 
26
};
 
27
 
 
28
class DebuggerGDB;
 
29
 
 
30
class DebuggerTree : public wxPanel
 
31
{
 
32
    public:
 
33
        DebuggerTree(wxWindow* parent, DebuggerGDB* debugger);
 
34
        virtual ~DebuggerTree();
 
35
        wxTreeCtrl* GetTree(){ return m_pTree; }
 
36
 
 
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
 
40
 
 
41
        void ClearWatches();
 
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);
 
50
    protected:
 
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);
 
66
 
 
67
        wxTreeCtrl* m_pTree;
 
68
        DebuggerGDB* m_pDebugger;
 
69
        WatchesArray m_Watches;
 
70
        wxArrayString m_TreeState;
 
71
        int m_NumUpdates;
 
72
        int m_CurrNumUpdates;
 
73
    private:
 
74
        // recursive struct to keep all watch tree entries
 
75
        struct WatchTreeEntry
 
76
        {
 
77
            wxString name; // entry's name
 
78
            std::vector<WatchTreeEntry> entries; // child entries
 
79
            Watch* watch; // the associated watch
 
80
 
 
81
            WatchTreeEntry() : watch(0) {}
 
82
 
 
83
            void Clear()
 
84
            {
 
85
                name.Clear();
 
86
                watch = 0;
 
87
                entries.clear();
 
88
            }
 
89
            WatchTreeEntry& AddChild(const wxString& childname, Watch* childwatch)
 
90
            {
 
91
                WatchTreeEntry wet;
 
92
                wet.name = childname;
 
93
                wet.watch = childwatch;
 
94
                entries.push_back(wet);
 
95
                return *(--entries.end());
 
96
            }
 
97
        };
 
98
        WatchTreeEntry m_RootEntry;
 
99
 
 
100
        void BuildTree(WatchTreeEntry& entry, wxTreeItemId parent);
 
101
 
 
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);
 
106
 
 
107
        bool m_InUpdateBlock;
 
108
        DECLARE_EVENT_TABLE()
 
109
};
 
110
 
 
111
#endif // DEBUGGERTREE_H
 
112