39 const long idTooltipGrid =
wxNewId();
40 const long idTooltipTimer =
wxNewId();
42 const long idMenuRename =
wxNewId();
43 const long idMenuProperties =
wxNewId();
44 const long idMenuDelete =
wxNewId();
45 const long idMenuDeleteAll =
wxNewId();
46 const long idMenuAddDataBreak =
wxNewId();
47 const long idMenuExamineMemory =
wxNewId();
48 const long idMenuAutoUpdate =
wxNewId();
49 const long idMenuUpdate =
wxNewId();
73 #if wxCHECK_VERSION(3, 0, 0) 94 wxPG_CONST_WXCHAR_PTR
GetName()
const override 96 return wxT(
"cbDummyEditor");
102 cb_unused
const wxSize& sz)
const override 104 wxPGWindowList
const list;
109 cb_unused
wxWindow* wnd_primary, cb_unused
wxEvent& event)
const override 115 cb_unused
wxWindow* ctrl )
const override 120 cb_unused
wxWindow* ctrl)
const override {}
131 wxPG_CONST_WXCHAR_PTR
GetName()
const override 133 return wxT(
"cbTextCtrlAndButtonTooltipEditor");
139 wxPGWindowList
const &list = wxPGTextCtrlAndButtonEditor::CreateControls(propgrid, property, pos, sz);
141 list.m_secondary->SetToolTip(
_(
"Click the button to see the value.\n" 142 "Hold CONTROL to see the raw output string returned by the debugger.\n" 143 "Hold SHIFT to see debugging representation of the cbWatch object."));
159 wxStringProperty(label, wxPG_LABEL, value),
172 wxPGEditorDialogAdapter* GetEditorDialog()
const override;
215 Map::iterator it = s_dialogs.find(watchPtr);
216 if (it != s_dialogs.end())
221 s_dialogs[watchPtr] = dlg;
227 dlg->m_type = TypeDebug;
229 dlg->m_type = TypeWatchTree;
232 dlg->SetValue(watch);
240 Map::iterator it = s_dialogs.find(watch->
GetWatch().get());
241 if (it != s_dialogs.end())
242 it->second->SetValue(watch);
264 for (Map::iterator it = s_dialogs.begin(); it != s_dialogs.end(); ++it)
266 if (it->second ==
this)
280 m_text->SetValue(watch->GetValueAsString(wxPG_FULL_VALUE));
284 m_text->SetValue(watch->
GetWatch()->GetDebugString());
291 m_text->SetValue(value);
305 result += indent +
wxT(
"[symbol = ") + sym +
wxT(
"]\n");
306 result += indent + wxT(
"[value = ") + value + wxT(
"]\n");
309 for(
int child_index = 0; child_index < watch.
GetChildCount(); ++child_index)
311 cb::shared_ptr<const cbWatch> child = watch.
GetChild(child_index);
318 DECLARE_EVENT_TABLE()
320 typedef std::map<cbWatch const*, WatchRawDialog*>
Map;
359 cb::shared_ptr<cbWatch> watch = activeDebugger->
AddWatch(text);
381 #if wxCHECK_VERSION(3, 0, 0) 382 #define wxPG_EX_DISABLE_TLP_TRACKING 0x00000000 387 m_grid->SetVirtualWidth(0);
394 #if wxCHECK_VERSION(3, 0, 0) 398 wxT(
"cbTextCtrlAndButtonTooltipEditor"),
405 #if wxCHECK_VERSION(3, 0, 0) 417 cb::shared_ptr<cbWatch>(),
false));
427 bool readonly,
const wxColour &changedColour)
431 cb::shared_ptr<cbWatch> child = watch.
GetChild(ii);
434 child->GetSymbol(symbol);
435 child->GetValue(value);
436 child->GetType(type);
439 prop->SetExpanded(child->IsExpanded());
448 if (child->IsChanged())
455 #if wxCHECK_VERSION(3, 0, 0) 458 grid.SetPropertyColourToDefault(prop);
462 AppendChildren(grid, *prop, *child.get(), readonly, changedColour);
473 watch->GetSymbol(symbol);
474 watch->GetValue(value);
475 property->SetLabel(symbol);
476 property->SetValue(value);
477 property->SetExpanded(watch->IsExpanded());
478 watch->GetType(type);
479 if (watch->IsChanged())
483 #if wxCHECK_VERSION(3, 0, 0) 486 grid->SetPropertyColourToDefault(property);
496 valueTruncated = value.
Left(128) +
wxT(
"...");
498 valueTruncated=value;
502 property->DeleteChildren();
504 if (property->
GetName() != symbol)
510 AppendChildren(*grid, *property, *watch, readonly, changedColour);
519 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
542 watch->GetSymbol(symbol);
564 item.
property->SetExpanded(watch->IsExpanded());
579 watch->GetSymbol(symbol);
583 item.
property->SetExpanded(watch->IsExpanded());
603 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
614 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
615 watch->Expand(
false);
641 if (prop_parent && !prop_parent->
IsRoot())
657 cb::shared_ptr<cbWatch>(),
false));
675 if (!selected || !property || property != selected)
683 cb::shared_ptr<cbWatch> watch = prop.
GetWatch();
692 if (parent && parent->
IsRoot())
698 if (it->property == &prop)
704 prop.DeleteChildren();
725 cb::shared_ptr<cbWatch> watch = watches_prop->
GetWatch();
728 if (it !=
m_watches.end() && !it->special)
733 unsigned int index = watches_prop->GetIndexInParent();
738 if (index < root->GetChildCount())
748 cb::shared_ptr<cbWatch> watch = watches_prop->
GetWatch();
751 if (it !=
m_watches.end() && !it->special)
770 m.
Append(idMenuRename,
_(
"Rename"),
_(
"Rename the watch"));
771 m.
Append(idMenuAddDataBreak,
_(
"Add Data breakpoint"),
_(
"Add Data breakpoing"));
774 _(
"Flag which controls if this watch should be auto updated."));
775 m.
Append(idMenuUpdate,
_(
"Update"),
_(
"Manually update the selected watch."));
777 m.
Append(idMenuProperties,
_(
"Properties"),
_(
"Show the properties for the watch"));
778 m.
Append(idMenuDelete,
_(
"Delete"),
_(
"Delete the currently selected watch"));
779 m.
Append(idMenuDeleteAll,
_(
"Delete All"),
_(
"Delete all watches"));
783 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
793 if (itItem !=
m_watches.end() && itItem->special)
818 m.
Enable(idMenuRename,
false);
820 m.
Enable(idMenuProperties,
false);
822 m.
Enable(idMenuDelete,
false);
824 m.
Enable(idMenuDeleteAll,
false);
826 m.
Enable(idMenuAddDataBreak,
false);
828 if (rootWatch != watch)
830 m.
Enable(idMenuAutoUpdate,
false);
831 m.
Enable(idMenuUpdate,
false);
835 m.
Check(idMenuAutoUpdate, watch->IsAutoUpdateEnabled());
837 m.
Enable(idMenuUpdate,
false);
848 m.
Insert(position, idMenuExamineMemory,
_(
"Examine memory"),
849 _(
"Opens the Examine memory window and shows the raw data for this variable"));
851 m.
Enable(idMenuExamineMemory,
false);
859 m.
Append(idMenuDelete,
_(
"Delete"),
_(
"Delete the currently selected watch"));
860 m.
Append(idMenuDeleteAll,
_(
"Delete All"),
_(
"Delete all watches"));
880 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
907 specialWatches.push_back(*it);
927 prop->
GetWatch()->GetSymbol(expression);
930 if (plugin && !expression.
empty())
945 cb::shared_ptr<cbWatch> watch = prop->
GetWatch();
946 if (watch->IsPointerType())
947 watch->GetSymbol(expression);
949 expression = watch->MakeSymbolToAddress();
969 cb::shared_ptr<cbWatch> watch = selected->
GetWatch();
972 watch->AutoUpdate(!watch->IsAutoUpdateEnabled());
981 cb::shared_ptr<cbWatch> watch = selected->
GetWatch();
1002 cb::shared_ptr<cbWatch> old_watch = watchesProp->
GetWatch();
1004 watchesProp->
SetWatch(cb::shared_ptr<cbWatch>());
1006 cb::shared_ptr<cbWatch> new_watch = active_plugin->
AddWatch(newSymbol);
1011 if (it->property == watchesProp)
1012 it->watch = new_watch;
1014 watchesProp->SetExpanded(new_watch->IsExpanded());
1025 watchesProp->SetExpanded(item.
watch->IsExpanded());
1044 if (!supports || plugin != active)
1077 return property ? grid->GetFirstChild(property) :
nullptr;
1082 #if wxCHECK_VERSION(3, 0, 0) 1083 wxPropertyGridPageState *state = grid->GetState();
1085 wxPropertyGridState *state = grid->GetState();
1088 width[0] = width[1] = width[2] = 0;
1089 int minWidths[3] = { state->GetColumnMinWidth(0),
1090 state->GetColumnMinWidth(1),
1091 state->GetColumnMinWidth(2) };
1097 width[0] = std::max(width[0], state->GetColumnFullWidth(dc, p, 0));
1098 width[1] = std::max(width[1], state->GetColumnFullWidth(dc, p, 1));
1099 width[2] = std::max(width[2], state->GetColumnFullWidth(dc, p, 2));
1108 width[0] = std::max(width[0], w[0]);
1109 width[1] = std::max(width[1], w[1]);
1110 width[2] = std::max(width[2], w[2]);
1114 width[0] = std::max(width[0], minWidths[0]);
1115 width[1] = std::max(width[1], minWidths[1]);
1116 width[2] = std::max(width[2], minWidths[2]);
1122 dc.SetFont(grid->GetFont());
1131 wxRect rect = grid->GetPropertyRect(first, last);
1141 rect.
width = std::accumulate(width, width+3, 0);
1146 #if wxCHECK_VERSION(3, 0, 0) 1147 wxSize size(std::min(minWidth, rect.
width), std::min(minHeight, height));
1149 wxSize size(std::min(minWidth, rect.
width + grid->GetMarginWidth()), std::min(minHeight, height));
1151 grid->SetMinSize(size);
1154 proportions[0] =
static_cast<int>(floor((
double)width[0]/size.x*100.0+0.5));
1155 proportions[1] =
static_cast<int>(floor((
double)width[1]/size.x*100.0+0.5));
1156 proportions[2]= std::max(100 - proportions[0] - proportions[1], 0);
1169 m_timer(this, idTooltipTimer),
1190 m_watch->MarkAsChangedRecursive(
false);
1213 m_watch->MarkAsChangedRecursive(
false);
1246 wxPoint pos = GetScreenPosition();
1248 SetSize(pos.
x, pos.
y, size.x, size.y);
1279 wxRect rect = GetScreenRect();
void SetPropertyColoursToDefault(wxPGPropArg id)
wxSize Fit(wxWindow *window)
wxPoint wxGetMousePosition()
cbDebuggerPlugin * GetActiveDebugger()
void UpdateControl(cb_unused wxPGProperty *property, cb_unused wxWindow *ctrl) const override
wxPG_CONST_WXCHAR_PTR GetName() const override
wxPGProperty * Insert(wxPGPropArg priorThis, wxPGProperty *newProperty)
void BeginLabelEdit(unsigned int colIndex=0)
wxPGProperty * GetRealRoot(wxPropertyGrid *grid)
cbExamineMemoryDlg * GetExamineMemoryDialog()
Returns a pointer to the memory dialog.
bool IsPropertyExpanded(wxPGPropArg id) const
bool FromString(const wxString &s)
void AddSpecialWatch(cb::shared_ptr< cbWatch > watch, bool readonly)
WatchesProperty * property
Base class for debugger plugins.
wxPGProperty * GetLastItem(int flags=wxPG_ITERATE_DEFAULT)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void OnPropertyRightClick(wxPropertyGridEvent &event)
wxPGProperty * Item(unsigned int i) const
wxPGEditorDialogAdapter * GetEditorDialog() const override
bool OnDropText(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxString &text) override
virtual void ShowWatchProperties(cb::shared_ptr< cbWatch > watch)=0
void OnExpand(wxPropertyGridEvent &event)
wxPGProperty * Append(wxPGProperty *property)
void SetColumnCount(int colCount)
void SetPropertyHelpString(wxPGPropArg id, const wxString &helpString)
void GetColumnWidths(wxClientDC &dc, wxPropertyGrid *grid, wxPGProperty *root, int width[3])
bool OnEvent(cb_unused wxPropertyGrid *propgrid, cb_unused wxPGProperty *property, cb_unused wxWindow *wnd_primary, cb_unused wxEvent &event) const override
void RegisterColour(const wxString &category, const wxString &name, const wxString &id, const wxColour &defaultColour)
bool IsPropertyEnabled(wxPGPropArg id) const
wxWindow * pWindow
The window to dock.
bool DisableProperty(wxPGPropArg id)
static wxPGEditor * watchesDummyEditor
bool IsEditorFocused() const
WatchesProperty(const wxString &label, const wxString &value, cb::shared_ptr< cbWatch > watch, bool readonly)
void SetPropertyTextColour(wxPGPropArg id, const wxColour &colour, int flags=wxPG_RECURSE)
virtual void DeleteWatch(cb::shared_ptr< cbWatch > watch)=0
Event used to request from the main app to add a window to the docking system.
virtual void ExpandWatch(cb::shared_ptr< cbWatch > watch)=0
std::map< cbWatch const *, WatchRawDialog * > Map
wxPG_CONST_WXCHAR_PTR GetName() const override
wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult WXUNUSED(def)) override
void SetPropertyAttribute(wxPGPropArg id, const wxString &attrName, wxVariant value, long argFlags=0)
void DeleteProperty(WatchesProperty &prop)
cb::shared_ptr< const cbWatch > GetWatch() const
void SetValue(WatchesProperty *prop)
void OnIdle(wxIdleEvent &event)
const wxPGEditor * DoGetEditorClass() const override
bool SetColumnProportion(unsigned int column, int proportion)
wxScrolled< wxPanel > wxScrolledWindow
cb::shared_ptr< cbWatch > GetChild(int index)
cbDebuggerPlugin * GetDebuggerHavingWatch(cb::shared_ptr< cbWatch > watch)
virtual bool Start(int milliseconds=-1, bool oneShot=wxTIMER_CONTINUOUS)
void ResetColumnSizes(bool enableAutoResizing=false)
static int GetMetric(wxSystemMetric index, wxWindow *win=NULL)
void UpdateWatch(wxPropertyGrid *grid, wxPGProperty *property, cb::shared_ptr< cbWatch > watch, bool readonly)
void SetPropertyLabel(wxPGPropArg id, const wxString &newproplabel)
virtual cb::shared_ptr< cbBreakpoint > AddDataBreakpoint(const wxString &dataExpression)=0
Request to add a breakpoint based on a data expression.
virtual void GetSymbol(wxString &symbol) const =0
virtual wxWindow * GetWindow()=0
cb::shared_ptr< cbWatch > m_watch
bool Contains(int x, int y) const
DebuggerManager * GetDebuggerManager() const
wxPGProperty * GetProperty() const
void SetWatch(cb::shared_ptr< cbWatch > watch)
void OnPropertyChanged(wxPropertyGridEvent &event)
bool GetValueFromControl(cb_unused wxVariant &variant, cb_unused wxPGProperty *property, cb_unused wxWindow *ctrl) const override
wxColour GetColour(const wxString &id) const
int GetChildCount() const
virtual bool SetWatchValue(cb::shared_ptr< cbWatch > watch, const wxString &value)=0
wxString Left(size_t count) const
wxPGWindowList CreateControls(wxPropertyGrid *propgrid, wxPGProperty *property, const wxPoint &pos, const wxSize &sz) const override
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
static void WatchToString(wxString &result, const cbWatch &watch, const wxString &indent=wxEmptyString)
virtual void CollapseWatch(cb::shared_ptr< cbWatch > watch)=0
void RenameWatch(wxObject *prop, const wxString &newSymbol)
cb::shared_ptr< cbWatch > GetWatch()
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
IMPLEMENT_DYNAMIC_CLASS(cbDummyEditor, wxPGEditor)
cbWatchesDlg * GetWatchesDialog()
Returns a pointer to the watches dialog.
DLLIMPORT bool IsWindowReallyShown(wxWindow *win)
Finds out if a window is really shown.
bool EnableProperty(wxPGPropArg id, bool enable=true)
WatchItemPredicate(cb::shared_ptr< cbWatch > watch)
bool SelectProperty(wxPGPropArg id, bool focus=false)
wxPGProperty * GetParent() const
void SetPropertyName(wxPGPropArg id, const wxString &newName)
static wxPGEditor * watchesPropertyEditor
#define wxDEFAULT_DIALOG_STYLE
void OnCollapse(wxPropertyGridEvent &event)
wxPGProperty * GetSelection() const
void EndLabelEdit(bool commit=true)
virtual void AddWatch(cb::shared_ptr< cbWatch > watch)=0
wxString WatchToString(cbWatch const &watch)
unsigned int GetChildCount() const
void OnClose(cb_unused wxCloseEvent &event)
const wxString & _(const wxString &string)
wxEventType wxEVT_KEY_DOWN
bool m_append_empty_watch
void Veto(bool veto=true)
wxPGProperty * AppendIn(wxPGPropArg id, wxPGProperty *newProperty)
#define wxPG_EX_DISABLE_TLP_TRACKING
static void UpdateValue(const WatchesProperty *watch)
void SetMinSize(wxPropertyGrid *grid)
std::vector< WatchItem > WatchItems
void AppendChildren(wxPropertyGrid &grid, wxPGProperty &property, cbWatch &watch, bool readonly, const wxColour &changedColour)
virtual void SetBaseAddress(const wxString &addr)=0
ColourManager * GetColourManager() const
cb::shared_ptr< cbWatch > watch
static WatchRawDialog * Create(const WatchesProperty *watch)
wxString wxPG_CONST_WXCHAR_PTR
void OnKeyDown(wxKeyEvent &event)
virtual void GetValue(wxString &value) const =0
virtual cb::shared_ptr< cbWatch > AddWatch(const wxString &symbol)=0
virtual void UpdateWatch(cb::shared_ptr< cbWatch > watch)=0
cbBreakpointsDlg * GetBreakpointDialog()
Returns a pointer to the breakpoints dialog.
EVTIMPORT const wxEventType cbEVT_SHOW_DOCK_WINDOW
void AddWatch(cb::shared_ptr< cbWatch > watch)
static wxPGEditor * RegisterEditorClass(wxPGEditor *editor, bool noDefCheck=false)
bool ProcessEvent(CodeBlocksEvent &event)
wxRect & Inflate(wxCoord dx, wxCoord dy)
cb::shared_ptr< cbWatch > DLLIMPORT cbGetRootWatch(cb::shared_ptr< cbWatch > watch)
void SetValueToUnspecified(cb_unused wxPGProperty *property, cb_unused wxWindow *ctrl) const override
wxPGProperty * GetRoot() const
bool operator()(const WatchItem &item) const
void OnPropertySelected(wxPropertyGridEvent &event)
virtual bool SupportsFeature(cbDebuggerFeature::Flags flag)=0
void DeleteProperty(wxPGPropArg id)
int GetVerticalSpacing() const
virtual bool IsActive() const
void OnPropertyLableEditEnd(wxPropertyGridEvent &event)
bool wxGetKeyState(wxKeyCode key)
wxTextCtrl * GetLabelEditor() const
static wxString Format(const wxString &format,...)
void SetValue(const WatchesProperty *watch)
wxPGWindowList CreateControls(cb_unused wxPropertyGrid *propgrid, cb_unused wxPGProperty *property, cb_unused const wxPoint &pos, cb_unused const wxSize &sz) const override
void RemoveWatch(cb::shared_ptr< cbWatch > watch)
wxPGProperty * RemoveProperty(wxPGPropArg id)
void OnPropertyChanging(wxPropertyGridEvent &event)
void OnPropertyLableEditBegin(wxPropertyGridEvent &event)
cb::shared_ptr< cbWatch > m_watch
dialog to show the value of a watch