42 const long idRemove =
wxNewId();
43 const long idRemoveAll =
wxNewId();
46 const long idEnable =
wxNewId();
47 const long idDisable =
wxNewId();
48 const long idShowTemp =
wxNewId();
99 Connect(idList, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
100 (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction)
103 Connect(idList, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
104 (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction)
119 for (DebuggerManager::RegisteredPlugins::const_iterator dbg = debuggers.begin(); dbg != debuggers.end(); ++dbg)
121 int count = dbg->first->GetBreakpointsCount();
122 for (
int ii = 0; ii < count; ++ii)
124 cb::shared_ptr<cbBreakpoint> bp = dbg->first->GetBreakpoint(ii);
125 if (showTemp || (!showTemp && !bp->IsTemporary()))
137 if (it->plugin != activeDebugger)
139 else if (it->breakpoint->IsEnabled())
162 if (it->breakpoint->IsVisibleInEditor())
164 if (it->breakpoint->GetLocation() == filename && it->breakpoint->GetLine() == line)
186 filename(filename_in),
191 return plugin == item.
plugin 210 it->plugin->DeleteBreakpoint(it->breakpoint);
220 std::set<cbDebuggerPlugin*> plugins;
221 std::set<cbEditor*> editors;
232 plugins.insert(it->plugin);
237 plugins.insert(it->plugin);
239 for (std::set<cbDebuggerPlugin*>::iterator it = plugins.begin(); it != plugins.end(); ++it)
240 (*it)->DeleteAllBreakpoints();
241 for (std::set<cbEditor*>::iterator it = editors.begin(); it != editors.end(); ++it)
242 (*it)->RefreshBreakpointMarkers();
260 it->plugin->EnableBreakpoint(it->breakpoint, enable);
261 if (it->breakpoint->IsVisibleInEditor())
275 std::set<cbEditor*> editors;
279 if (item >= 0 || item < static_cast<int>(
m_breakpoints.size()))
295 for (std::set<cbEditor*>::iterator it = editors.begin(); it != editors.end(); ++it)
296 (*it)->RefreshBreakpointMarkers();
307 if (sel < 0 || sel >= static_cast<int>(
m_breakpoints.size()))
327 if (item_index < 0 || item_index >= static_cast<int>(
m_breakpoints.size()))
346 bool hasEnabled =
false, hasDisabled =
false;
351 bool enabled =
m_breakpoints[itemIndex].breakpoint->IsEnabled();
359 menu.
Append(idOpen,
_(
"Open in editor"));
365 menu.
Append(idEnable,
_(
"Enable"));
367 menu.
Append(idDisable,
_(
"Disable"));
370 menu.
Append(idRemove,
_(
"Remove"));
371 menu.
Append(idRemoveAll,
_(
"Remove all"));
377 menu.
Enable(idOpen,
false);
379 menu.
Enable(idRemove,
false);
382 menu.
Enable(idRemoveAll,
false);
413 const wxString& filename =
event.GetString();
414 int line =
event.GetInt();
418 if (it->breakpoint->GetLocation() == filename && it->breakpoint->GetLine() == line)
420 it->plugin->UpdateBreakpoint(it->breakpoint);
421 if (it->breakpoint->IsVisibleInEditor())
425 static_cast<cbEditor*>(ed)->RefreshBreakpointMarkers();
442 if (event.GetId() == idShowTemp)
448 bool enable = (
event.GetId() == idEnable);
449 typedef std::pair<cbEditor*, cbDebuggerPlugin*> EditorPair;
450 std::set<EditorPair> editorsToRefresh;
465 editorsToRefresh.insert(EditorPair(editor, item.
plugin));
470 for (std::set<EditorPair>::iterator it = editorsToRefresh.begin(); it != editorsToRefresh.end(); ++it)
471 it->first->RefreshBreakpointMarkers();
void OnBreakpointEdit(CodeBlocksEvent &event)
cbEditor * IsBuiltinOpen(const wxString &filename)
cbDebuggerPlugin * GetActiveDebugger()
virtual cb::shared_ptr< cbBreakpoint > AddBreakpoint(const wxString &filename, int line)=0
Request to add a breakpoint.
static bool GetFlag(Flags flag)
Items::iterator FindBreakpoint(const wxString &filename, int line)
Base class for debugger plugins.
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void OnRemoveAll(wxCommandEvent &event)
long GetNextItem(long item, int geometry=wxLIST_NEXT_ALL, int state=wxLIST_STATE_DONTCARE) const
void RemoveAllBreakpoints()
cbDebuggerPlugin * plugin
void OnShowTemp(wxCommandEvent &event)
void OnBreakpointAdd(CodeBlocksEvent &event)
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
void GotoLine(int line, bool centerOnScreen=true) override
Move the caret at the specified line.
void OnUpdateUI(wxUpdateUIEvent &event)
void BreakpointProperties(const Item &item)
bool operator()(const BreakpointsDlg::Item &item) const
virtual bool IsOk() const
bool RemoveBreakpoint(cbDebuggerPlugin *plugin, const wxString &filename, int line)
virtual void Activate()
Activate this editor.
#define wxLIST_STATE_SELECTED
void OnEnable(wxCommandEvent &event)
virtual wxString GetLocation() const =0
virtual void UpdateBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint)=0
A generic Code::Blocks event.
EditorManager * GetEditorManager() const
cb::shared_ptr< cbBreakpoint > breakpoint
long InsertItem(wxListItem &info)
DebuggerManager * GetDebuggerManager() const
virtual bool IsVisibleInEditor() const =0
virtual void RefreshBreakpointMarkers()
Refresh all markers for the breakpoints (only the markers for the current debugger will be shown) ...
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
void OnDoubleClick(wxListEvent &event)
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
cbDebuggerPlugin * plugin
Base class that all "editors" should inherit from.
virtual void EnableBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint, bool enable)=0
void OnOpen(wxCommandEvent &event)
void EnableBreakpoint(const wxString &filename, int line, bool enable)
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
const wxString & filename
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
const wxString & _(const wxString &string)
void OnRightClick(wxListEvent &event)
EditorBase * GetEditor(int index)
std::map< cbDebuggerPlugin *, PluginData > RegisteredPlugins
virtual void DeleteBreakpoint(cb::shared_ptr< cbBreakpoint > breakpoint)=0
bool AddBreakpoint(cbDebuggerPlugin *plugin, const wxString &filename, int line)
static wxString GetDataFolder(bool global=true)
friend struct FindBreakpointPred
RegisteredPlugins const & GetAllDebuggers() const
int GetColumnCount() const
void OnRemove(wxCommandEvent &event)
void OnKeyUp(wxKeyEvent &event)
FindBreakpointPred(cbDebuggerPlugin *plugin_in, const wxString &filename_in, int line_in)
bool SetItem(wxListItem &info)
bool SetColumnWidth(int col, int width)
void EditBreakpoint(const wxString &filename, int line)
static void SetFlag(Flags flag, bool value)
void OnProperties(wxCommandEvent &event)