Initialize ITextMark with a lineNumber

Ensure that it is updated as the lines are moved. That can be later used
to quickly find and remove the marks again.

Change-Id: I2285111996d5c8ef12f792fd73ff00ce186addc1
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Daniel Teske
2012-02-21 16:27:04 +01:00
committed by hjk
parent b112c277da
commit 2df2c0655c
7 changed files with 44 additions and 33 deletions

View File

@@ -122,13 +122,12 @@ public:
DisassemblerAgentPrivate::DisassemblerAgentPrivate()
: editor(0),
locationMark(0),
mimeType(_("text/x-qtcreator-generic-asm")),
tryMixed(true),
resetLocationScheduled(false)
{
locationMark = new ITextMark;
locationMark->setIcon(debuggerCore()->locationMarkIcon());
locationMark->setPriority(TextEditor::ITextMark::HighPriority);
}
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
@@ -349,9 +348,16 @@ void DisassemblerAgent::updateLocationMarker()
const DisassemblerLines contents = d->contentsAtCurrentLocation();
int lineNumber = contents.lineForAddress(d->location.address());
if (d->location.needsMarker()) {
d->editor->markableInterface()->removeMark(d->locationMark);
if (lineNumber)
d->editor->markableInterface()->addMark(d->locationMark, lineNumber);
if (d->locationMark)
d->editor->markableInterface()->removeMark(d->locationMark);
delete d->locationMark;
d->locationMark = 0;
if (lineNumber) {
d->locationMark = new ITextMark(lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon());
d->locationMark->setPriority(TextEditor::ITextMark::HighPriority);
d->editor->markableInterface()->addMark(d->locationMark);
}
}
QPlainTextEdit *plainTextEdit =
@@ -385,11 +391,11 @@ void DisassemblerAgent::updateBreakpointMarkers()
const int lineNumber = contents.lineForAddress(address);
if (!lineNumber)
continue;
ITextMark *marker = new ITextMark;
ITextMark *marker = new ITextMark(lineNumber);
marker->setIcon(handler->icon(id));
marker->setPriority(ITextMark::NormalPriority);
d->breakpointMarks.append(marker);
d->editor->markableInterface()->addMark(marker, lineNumber);
d->editor->markableInterface()->addMark(marker);
}
}