6 #include <tdetexteditor/document.h> 9 #include <kdevpartcontroller.h> 16 Debugger::Debugger(KDevPartController *partController)
17 :m_partController(partController)
19 connect( m_partController, TQT_SIGNAL(partAdded(KParts::Part*)),
20 this, TQT_SLOT(partAdded(KParts::Part*)) );
39 KParts::Part *part = m_partController->partForURL(KURL(fileName));
43 MarkInterface *iface =
dynamic_cast<MarkInterface*
>(part);
49 disconnect( part, TQT_SIGNAL(marksChanged()),
this, TQT_SLOT(marksChanged()) );
50 iface->removeMark( lineNum, Breakpoint | ActiveBreakpoint | ReachedBreakpoint | DisabledBreakpoint );
52 BPItem bpItem(fileName, lineNum);
53 TQValueList<BPItem>::Iterator it = BPList.find(bpItem);
54 if (it != BPList.end())
64 uint markType = Breakpoint;
66 markType |= ActiveBreakpoint;
68 markType |= DisabledBreakpoint;
69 iface->addMark( lineNum, markType );
71 BPList.append(
BPItem(fileName, lineNum));
74 connect( part, TQT_SIGNAL(marksChanged()),
this, TQT_SLOT(marksChanged()) );
80 TQPtrListIterator<KParts::Part> it(*m_partController->parts());
81 for ( ; it.current(); ++it)
83 MarkInterface *iface =
dynamic_cast<MarkInterface*
>(it.current());
87 TQPtrList<Mark> list = iface->marks();
88 TQPtrListIterator<Mark> markIt(list);
89 for( ; markIt.current(); ++markIt )
91 Mark* mark = markIt.current();
92 if( mark->type & ExecutionPoint )
93 iface->removeMark( mark->line, ExecutionPoint );
103 m_partController->editDocument(url, lineNum);
105 KParts::Part *part = m_partController->partForURL(url);
108 MarkInterface *iface =
dynamic_cast<MarkInterface*
>(part);
112 iface->addMark( lineNum, ExecutionPoint );
115 void Debugger::marksChanged()
117 if(sender()->inherits(
"KTextEditor::Document") )
119 KTextEditor::Document* doc = (KTextEditor::Document*) sender();
120 MarkInterface* iface = KTextEditor::markInterface( doc );
124 if( !m_partController->partForURL( doc->url() ) )
127 KTextEditor::Mark *m;
128 TQValueList<BPItem> oldBPList = BPList;
129 TQPtrList<KTextEditor::Mark> newMarks = iface->marks();
141 bool bpchanged =
false;
143 for (uint i = 0; i < oldBPList.count(); i++)
145 if (oldBPList[i].fileName() != doc->url().path())
149 for (uint newIdx=0; newIdx < newMarks.count(); newIdx++)
151 m = newMarks.at(newIdx);
152 if ((m->type & Breakpoint) &&
153 m->line == oldBPList[i].lineNum() &&
154 doc->url().path() == oldBPList[i].fileName())
156 newMarks.remove(newIdx);
172 for (uint i = 0; i < newMarks.count(); i++)
175 if (m->type & Breakpoint)
182 if ( bpchanged && m_partController->activePart() == doc )
185 m_partController->activatePart( doc );
192 void Debugger::partAdded( KParts::Part* part )
194 MarkInterfaceExtension *iface =
dynamic_cast<MarkInterfaceExtension*
>(part);
198 iface->setDescription((MarkInterface::MarkTypes)Breakpoint, i18n(
"Breakpoint"));
199 iface->setPixmap((MarkInterface::MarkTypes)Breakpoint, *inactiveBreakpointPixmap());
200 iface->setPixmap((MarkInterface::MarkTypes)ActiveBreakpoint, *activeBreakpointPixmap());
201 iface->setPixmap((MarkInterface::MarkTypes)ReachedBreakpoint, *reachedBreakpointPixmap());
202 iface->setPixmap((MarkInterface::MarkTypes)DisabledBreakpoint, *disabledBreakpointPixmap());
203 iface->setPixmap((MarkInterface::MarkTypes)ExecutionPoint, *executionPointPixmap());
204 iface->setMarksUserChangable( Bookmark | Breakpoint );
206 connect( part, TQT_SIGNAL(marksChanged()),
this, TQT_SLOT(marksChanged()) );
209 #include "debugger.moc" void gotoExecutionPoint(const KURL &url, int lineNum=-1)
Displays an icon in the file at the line that the debugger has stoped at.
void toggledBreakpoint(const TQString &fileName, int lineNum)
The user has toggled a breakpoint.
void clearExecutionPoint()
Remove the executution point being displayed.
Describes a single breakpoint in the system.
void setBreakpoint(const TQString &fileName, int lineNum, int id, bool enabled, bool pending)
Controls the breakpoint icon being displayed in the editor through the markinterface.
Handles signals from the editor that relate to breakpoints and the execution point of the debugger...