void cbDebuggerPlugin::EditorLinesAddedOrRemoved(cbEditor* editor, int startline, int lines) { // here we keep the breakpoints in sync with the editors // (whenever lines are added or removed) if (!editor || lines == 0) return; const wxString& filename = editor->GetFilename(); std::vector<int> breakpoints_for_file; int count = GetBreakpointsCount(); for (int ii = 0; ii < count; ++ii) { const cb::shared_ptr<cbBreakpoint> &b = GetBreakpoint(ii); if (b->GetLocation() == filename) { breakpoints_for_file.push_back(ii); } } if (lines < 0) { // removed lines // make "lines" positive, for easier reading below lines = -lines; int endline = startline + lines - 1; std::vector<cb::shared_ptr<cbBreakpoint> > to_remove; for (std::vector<int>::iterator it = breakpoints_for_file.begin(); it != breakpoints_for_file.end(); ++it) { const cb::shared_ptr<cbBreakpoint> &b = GetBreakpoint(*it); if (b->GetLine() > endline) ShiftBreakpoint(*it, -lines); else if (b->GetLine() >= startline && b->GetLine() <= endline) to_remove.push_back(b); } for (std::vector<cb::shared_ptr<cbBreakpoint> >::iterator it = to_remove.begin(); it != to_remove.end(); ++it) DeleteBreakpoint(*it); } else { for (std::vector<int>::iterator it = breakpoints_for_file.begin(); it != breakpoints_for_file.end(); ++it) { const cb::shared_ptr<cbBreakpoint> &b = GetBreakpoint(*it); if (b->GetLine() > startline) ShiftBreakpoint(*it, lines); } } }
// Set a breakpoint's ignore count bool BreakptMgr::IgnoreByLineno(const wxString& file, const int lineno) { BreakpointInfo &bp = GetBreakpoint(file, lineno); if ( bp.IsNull() ) { return false; } if (bp.bp_type == BP_type_invalid) { return false; } long newvalue = ::wxGetNumberFromUser( _("Please enter the new ignore-count"), wxT(""), _("Set ignore-count"), bp.ignore_number, 0, 1000000); if ((newvalue == -1) || (newvalue == (long)bp.ignore_number)) { return false; } if (! SetBPIgnoreCount(bp.GetId(), newvalue)) { return false; } bp.ignore_number = newvalue; // Explicitly set the best type, in case the user just reset a previously-ignored bp SetBestBPType( bp ); RefreshBreakpointMarkers(); return true; }
void PHPDebugPane::OnBreakpointItemActivated(wxDataViewEvent& event) { XDebugBreakpoint bp = GetBreakpoint(event.GetItem()); PHPEvent eventOpenFile(wxEVT_PHP_BREAKPOINT_ITEM_ACTIVATED); eventOpenFile.SetLineNumber(bp.GetLine()); eventOpenFile.SetFileName(bp.GetFileName()); EventNotifier::Get()->AddPendingEvent(eventOpenFile); }
void BreakptMgr::DragBreakpoint(LEditor* editor, int line, wxBitmap bitmap) { // See if there's a bp marker under the cursor. If so, let the user drag it BreakpointInfo &bp = GetBreakpoint(editor->GetFileName().GetFullPath(), line+1); if ( bp.IsNull() ) { return; } m_dragImage = new myDragImage(editor, bitmap, bp); m_dragImage->StartDrag(); }
std::string DownloadTask::dump() { Json::Value root; root["url"] = GetUrl(); root["download_path"] = GetDownloadPath(); root["md5"] = GetMd5(); root["file_size"] = Json::Value(GetFileSize()); root["progress"] = Json::Value(GetProgress()); root["breakpoint"] = Json::Value(GetBreakpoint()); return root.toString(); }
wxString BreakptMgr::GetTooltip(const wxString& fileName, const int lineno) { if (fileName.IsEmpty() || lineno < 0) { return wxEmptyString; } const BreakpointInfo &bp = GetBreakpoint(fileName, lineno); if ( bp.IsNull() ) { return wxEmptyString; } wxString tooltip; if (! tooltip.IsEmpty()) { tooltip << wxT("<hr>"); } int id = (bp.debugger_id > 0 ? bp.debugger_id : bp.internal_id - FIRST_INTERNAL_ID); tooltip << _("<b>Breakpoint: ") << id << _("</b>\n"); bool isSimple = true; if (bp.is_temp) { tooltip << _("Temporary \n"); isSimple = false; } if (! bp.is_enabled) { tooltip << _(" (disabled)\n"); isSimple = false; } if (bp.ignore_number > 0) { tooltip << wxString::Format(_("Ignore-count = %u\n"), bp.ignore_number); isSimple = false; } if (! bp.conditions.IsEmpty()) { tooltip << wxString::Format(_("Condition:\n<code>%s</code>\n"), bp.conditions.c_str()); isSimple = false; } if (! bp.commandlist.IsEmpty()) { tooltip << wxString::Format(_("Commands:\n<code>%s</code>\n"), bp.commandlist.c_str()); isSimple = false; } if ( isSimple ) { tooltip << _("Normal breakpoint\n"); } tooltip.Trim().Trim(false); return tooltip; }
int BreakptMgr::DelBreakpointByLineno(const wxString& file, const int lineno) { const BreakpointInfo& bp = GetBreakpoint(file, lineno); if ( bp.IsNull() ) { return false; } int bpId = bp.GetId(); if(bpId == wxID_CANCEL || bpId == BP_type_none) return false; DelBreakpoint(bpId); return true; }
void PHPDebugPane::OnDeleteBreakpoint(wxCommandEvent& event) { wxUnusedVar(event); // Send event for every breakpoint id wxDataViewItemArray items; m_dvListCtrlBreakpoints->GetSelections(items); for(size_t i = 0; i < items.GetCount(); ++i) { XDebugBreakpoint bp = GetBreakpoint(items.Item(i)); PHPEvent eventDelBP(wxEVT_PHP_DELETE_BREAKPOINT); eventDelBP.SetInt(bp.GetBreakpointId()); eventDelBP.SetFileName(bp.GetFileName()); eventDelBP.SetLineNumber(bp.GetLine()); EventNotifier::Get()->AddPendingEvent(eventDelBP); } }
void BreakptMgr::EditBreakpointByLineno(const wxString& file, const int lineno) { const BreakpointInfo &bp = GetBreakpoint(file, lineno); if ( bp.IsNull() ) return; int bid = bp.GetId(); if (bid == wxID_CANCEL || bid == BP_type_none) { return; } int index = FindBreakpointById(bid, m_bps); if (index == wxNOT_FOUND) { return; } bool dummy; EditBreakpoint(index, dummy); }