Code::Blocks  SVN r11506
debugger_interface_creator.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 // sdk.h must be the first include in the file to work as a PCH
7 #include <sdk.h>
8 
9 #ifndef CB_PRECOMP
10  #include "cbeditor.h"
11  #include "editormanager.h"
12 #endif
13 
15 
16 #include "backtracedlg.h"
17 #include "breakpointsdlg.h"
18 #include "cbstyledtextctrl.h"
19 #include "cpuregistersdlg.h"
20 #include "disassemblydlg.h"
21 #include "examinememorydlg.h"
22 #include "threadsdlg.h"
23 #include "watchesdlg.h"
24 
25 inline void RemoveDockWindow(wxWindow *window)
26 {
27  if (window)
28  {
30  evt.pWindow = window;
31  Manager::Get()->ProcessEvent(evt);
32  window->Destroy();
33  }
34 }
35 
37 {
41 }
42 
44 {
46 }
47 
49 {
50  BacktraceDlg *dialog = new BacktraceDlg(Manager::Get()->GetAppWindow());
52  evt.name = _T("CallStackPane");
53  evt.title = _("Call stack");
54  evt.pWindow = dialog;
56  evt.desiredSize.Set(150, 150);
57  evt.floatingSize.Set(450, 150);
58  evt.minimumSize.Set(150, 150);
59  Manager::Get()->ProcessEvent(evt);
60  return dialog;
61 }
62 
64 {
65  if (dialog)
66  RemoveDockWindow(dialog->GetWindow());
67 }
68 
70 {
71  BreakpointsDlg *dialog = new BreakpointsDlg;
72 
74  evt.name = _T("BreakpointsPane");
75  evt.title = _("Breakpoints");
76  evt.pWindow = dialog;
78  evt.desiredSize.Set(350, 250);
79  evt.floatingSize.Set(350, 250);
80  evt.minimumSize.Set(150, 150);
81  Manager::Get()->ProcessEvent(evt);
82  return dialog;
83 }
84 
86 {
87  if (dialog)
88  RemoveDockWindow(dialog->GetWindow());
89 }
90 
92 {
93  CPURegistersDlg *dialog = new CPURegistersDlg(Manager::Get()->GetAppWindow());
94 
96  evt.name = _T("CPURegistersPane");
97  evt.title = _("CPU Registers");
98  evt.pWindow = dialog;
100  evt.desiredSize.Set(350, 250);
101  evt.floatingSize.Set(350, 250);
102  evt.minimumSize.Set(150, 150);
103  Manager::Get()->ProcessEvent(evt);
104  return dialog;
105 }
106 
108 {
109  if (dialog)
110  RemoveDockWindow(dialog->GetWindow());
111 }
112 
114 {
115  DisassemblyDlg *dialog = new DisassemblyDlg(Manager::Get()->GetAppWindow());
117 
118  evt.name = _T("DisassemblyPane");
119  evt.title = _("Disassembly");
120  evt.pWindow = dialog;
122  evt.desiredSize.Set(350, 250);
123  evt.floatingSize.Set(350, 250);
124  evt.minimumSize.Set(150, 150);
125  Manager::Get()->ProcessEvent(evt);
126  return dialog;
127 }
128 
130 {
131  if (dialog)
132  RemoveDockWindow(dialog->GetWindow());
133 }
134 
136 {
137  ExamineMemoryDlg *dialog = new ExamineMemoryDlg(Manager::Get()->GetAppWindow());
139  evt.name = _T("ExamineMemoryPane");
140  evt.title = _("Memory");
141  evt.pWindow = dialog;
143  evt.desiredSize.Set(450, 250);
144  evt.floatingSize.Set(450, 250);
145  evt.minimumSize.Set(350, 150);
146  Manager::Get()->ProcessEvent(evt);
147  return dialog;
148 }
149 
151 {
152  if (dialog)
153  RemoveDockWindow(dialog->GetWindow());
154 }
155 
157 {
158  ThreadsDlg *dialog = new ThreadsDlg(Manager::Get()->GetAppWindow());
159 
161  evt.name = _T("ThreadsPane");
162  evt.title = _("Running threads");
163  evt.pWindow = dialog;
165  evt.desiredSize.Set(350, 75);
166  evt.floatingSize.Set(450, 75);
167  evt.minimumSize.Set(250, 75);
168  Manager::Get()->ProcessEvent(evt);
169  return dialog;
170 }
171 
173 {
174  if (dialog)
175  RemoveDockWindow(dialog->GetWindow());
176 }
177 
179 {
180  WatchesDlg *dialog = new WatchesDlg;
182  evt.name = _T("WatchesPane");
183  evt.title = _("Watches");
184  evt.pWindow = dialog;
186  evt.desiredSize.Set(150, 250);
187  evt.floatingSize.Set(150, 250);
188  evt.minimumSize.Set(150, 150);
189  Manager::Get()->ProcessEvent(evt);
190  return dialog;
191 }
192 
194 {
195  if (dialog)
196  RemoveDockWindow(dialog->GetWindow());
197 }
198 
199 bool DebugInterfaceFactory::ShowValueTooltip(const cb::shared_ptr<cbWatch> &watch, const wxRect &rect)
200 {
201  delete m_tooltip;
202  m_tooltip = nullptr;
203 
205  if (!rect.Contains(pt))
206  return false;
207  else
208  {
209  m_tooltip = new ValueTooltip(watch, Manager::Get()->GetAppWindow());
210 #ifndef __WXMAC__
211  m_tooltip->Position(pt, wxSize(0, 0));
212 #endif
213  // hide any other tooltips
215  cbEditor *ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : nullptr;
216  if (ed && ed->GetControl()->CallTipActive())
217  ed->GetControl()->CallTipCancel();
218 
219  m_tooltip->Show();
220  return true;
221  }
222 }
223 
225 {
226  if (m_tooltip)
227  m_tooltip->Dismiss();
228 }
229 
231 {
232  if (m_tooltip)
234 }
235 
237 {
238  return m_tooltip && m_tooltip->IsShown();
239 }
240 
242 {
244 }
wxString name
Dock&#39;s name. Must be unique. If empty, a unique name will be assigned.
Definition: sdk_events.h:135
wxPoint wxGetMousePosition()
bool CallTipActive()
Is there an active call tip?
virtual void DeleteThreads(cbThreadsDlg *dialog)
virtual void DeleteDisassembly(cbDisassemblyDlg *dialog)
wxString title
Dock&#39;s title.
Definition: sdk_events.h:136
virtual wxWindow * GetWindow()=0
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
Definition: manager.cpp:182
virtual void DeleteMemory(cbExamineMemoryDlg *dialog)
wxWindow * pWindow
The window to dock.
Definition: sdk_events.h:137
EVTIMPORT const wxEventType cbEVT_ADD_DOCK_WINDOW
Definition: sdk_events.cpp:129
Event used to request from the main app to add a window to the docking system.
Definition: sdk_events.h:83
virtual cbBacktraceDlg * CreateBacktrace()
#define _T(string)
wxSize minimumSize
The minimum allowed size.
Definition: sdk_events.h:140
virtual cbWatchesDlg * CreateWatches()
virtual wxWindow * GetWindow()=0
virtual bool ShowValueTooltip(const cb::shared_ptr< cbWatch > &watch, const wxRect &rect)
Show new value tooltip.
virtual wxWindow * GetWindow()=0
DockSide dockSide
The side to dock it.
Definition: sdk_events.h:142
virtual cbBreakpointsDlg * CreateBreapoints()
wxSize floatingSize
The desired floating size.
Definition: sdk_events.h:139
A generic Code::Blocks event.
Definition: sdk_events.h:20
void Set(int width, int height)
EditorManager * GetEditorManager() const
Definition: manager.cpp:434
virtual void DeleteBreakpoints(cbBreakpointsDlg *dialog)
EVTIMPORT const wxEventType cbEVT_REMOVE_DOCK_WINDOW
Definition: sdk_events.cpp:130
virtual cbDisassemblyDlg * CreateDisassembly()
virtual wxWindow * GetWindow()=0
bool Contains(int x, int y) const
Event functor class.
Definition: cbfunctor.h:37
EditorBase * GetActiveEditor()
null_pointer_t nullptr
Definition: nullptr.cpp:16
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
Definition: cbeditor.cpp:842
void CallTipCancel()
Cancel calltip only if not jumping braces via tab.
void RemoveDockWindow(wxWindow *window)
void RemoveAllEventSinksFor(void *owner)
Definition: manager.cpp:570
virtual void DeleteCPURegisters(cbCPURegistersDlg *dialog)
Base class that all "editors" should inherit from.
Definition: editorbase.h:30
void OnEditorDeactivate(CodeBlocksEvent &event)
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
Definition: editorbase.cpp:209
EVTIMPORT const wxEventType cbEVT_EDITOR_DEACTIVATED
Definition: sdk_events.cpp:84
virtual void DeleteWatches(cbWatchesDlg *dialog)
virtual cbCPURegistersDlg * CreateCPURegisters()
const wxString & _(const wxString &string)
virtual wxWindow * GetWindow()=0
A file editor.
Definition: cbeditor.h:43
virtual wxWindow * GetWindow()=0
virtual void DeleteBacktrace(cbBacktraceDlg *dialog)
bool ProcessEvent(CodeBlocksEvent &event)
Definition: manager.cpp:246
void UpdateWatch()
virtual wxWindow * GetWindow()=0
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
Definition: manager.cpp:550
virtual cbExamineMemoryDlg * CreateMemory()
virtual cbThreadsDlg * CreateThreads()
wxSize desiredSize
The desired size.
Definition: sdk_events.h:138