Commit 8cc916a0 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Added categories for occurrences and for renaming occurrences

So they can be adapted in the color schemes.
parent 12911cda
......@@ -841,7 +841,7 @@ void CPPEditor::renameInPlace()
if (c.position() >= s.cursor.anchor()
&& c.position() <= s.cursor.position()) {
m_currentRenameSelection = i;
m_renameSelections[i].format.setBackground(QColor(255, 200, 200));
m_renameSelections[i].format = m_occurrenceRenameFormat;
setExtraSelections(CodeSemanticsSelection, m_renameSelections);
break;
}
......@@ -1566,6 +1566,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
highlighter->rehighlight();
m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK));
m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
m_occurrenceRenameFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_RENAME));
}
void CPPEditor::setDisplaySettings(const TextEditor::DisplaySettings &ds)
......@@ -1632,9 +1634,6 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
int line = 0, column = 0;
convertPosition(position(), &line, &column);
QTextCharFormat format;
format.setBackground(QColor(220, 220, 220));
QList<QTextEdit::ExtraSelection> selections;
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
......@@ -1655,7 +1654,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
if (! good)
continue;
highlightUses(document(), format, uses, &selections);
highlightUses(document(), m_occurrencesFormat, uses, &selections);
break; // done
}
......
......@@ -301,6 +301,8 @@ private:
QAction *m_sortAction;
QTimer *m_updateMethodBoxTimer;
QTimer *m_updateUsesTimer;
QTextCharFormat m_occurrencesFormat;
QTextCharFormat m_occurrenceRenameFormat;
QList<QTextEdit::ExtraSelection> m_renameSelections;
int m_currentRenameSelection;
......
......@@ -190,6 +190,10 @@ QColor FormatDescription::background() const
} else if (m_name == QLatin1String(Constants::C_SELECTION)) {
const QPalette palette = QApplication::palette();
return palette.color(QPalette::Highlight);
} else if (m_name == QLatin1String(Constants::C_OCCURRENCES)) {
return QColor(220, 220, 220);
} else if (m_name == QLatin1String(Constants::C_OCCURRENCES_RENAME)) {
return QColor(255, 200, 200);
}
return QColor(); // invalid color
}
......
......@@ -77,6 +77,8 @@ const char * const C_SEARCH_SCOPE = "SearchScope";
const char * const C_PARENTHESES = "Parentheses";
const char * const C_CURRENT_LINE = "CurrentLine";
const char * const C_CURRENT_LINE_NUMBER = "CurrentLineNumber";
const char * const C_OCCURRENCES = "Occurrences";
const char * const C_OCCURRENCES_RENAME = "Occurrences.Rename";
const char * const C_NUMBER = "Number";
const char * const C_STRING = "String";
......
......@@ -77,6 +77,9 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
currentLineNumber.format().setBold(true);
formatDescriptions.append(currentLineNumber);
formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES), tr("Occurrences")));
formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_RENAME), tr("Renaming Occurrence")));
// Standard categories
formatDescriptions.append(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue));
formatDescriptions.append(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen));
......
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