Commit 407e1eaa authored by Daniel Teske's avatar Daniel Teske
Browse files

Marks: If there are more then 3 marks, paint the highest priority



Also make the mark area 2 pixels wider so that 3 marks fit.
And adjust the priorities of marks, so that bookmarks and breakpoints
are visible even if there are multiple tasks on the line.

Change-Id: Ie8e3e7fa4db262c4243fb61772b6373ea283f1c9
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 9ca38374
......@@ -46,7 +46,7 @@ Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *man
m_onlyFile(m_fileInfo.fileName()),
m_path(m_fileInfo.path())
{
setPriority(TextEditor::ITextMark::LowPriority);
setPriority(TextEditor::ITextMark::NormalPriority);
setIcon(m_manager->bookmarkIcon());
}
......
......@@ -93,7 +93,7 @@ void TaskHub::addTask(Task task)
bool visible = (task.type == Task::Warning || task.type == Task::Error);
TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible);
mark->setIcon(taskTypeIcon(task.type));
mark->setPriority(TextEditor::ITextMark::HighPriority);
mark->setPriority(TextEditor::ITextMark::LowPriority);
task.addMark(mark);
}
emit taskAdded(task);
......
......@@ -3682,7 +3682,7 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const
int markWidth = 0;
if (d->m_marksVisible) {
markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing();
markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing() + 2;
// if (documentLayout->doubleMarkCount)
// markWidth += fm.lineSpacing() / 3;
......@@ -3797,7 +3797,23 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
if (TextBlockUserData *userData = static_cast<TextBlockUserData*>(block.userData())) {
if (d->m_marksVisible) {
int xoffset = 0;
foreach (ITextMark *mark, userData->marks()) {
TextMarks marks = userData->marks();
TextMarks::const_iterator it = marks.constBegin();
if (marks.size() > 3) {
// We want the 3 with the highest priority so iterate from the back
int count = 0;
it = marks.constEnd() - 1;
while (it != marks.constBegin()) {
if ((*it)->visible())
++count;
if (count == 3)
break;
--it;
}
}
TextMarks::const_iterator end = marks.constEnd();
for ( ; it != end; ++it) {
ITextMark *mark = *it;
if (!mark->visible())
continue;
const int height = fmLineSpacing - 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment