forked from qt-creator/qt-creator
Add common interface for text formats inside syntax highlighter
Change-Id: I87f64446161a57aea0896f68e4eafacef791969b Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
#include <projectexplorer/session.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/basetextdocumentlayout.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -571,8 +570,6 @@ public:
|
||||
bool m_mouseDragging;
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
|
||||
QColor m_backgroundColor;
|
||||
|
||||
private:
|
||||
QComboBox *m_entriesComboBox;
|
||||
};
|
||||
@@ -1048,7 +1045,7 @@ void VcsBaseEditorWidget::slotActivateAnnotation()
|
||||
ah->setChangeNumbers(changes);
|
||||
ah->rehighlight();
|
||||
} else {
|
||||
baseTextDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes, d->m_backgroundColor));
|
||||
baseTextDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,33 +1183,6 @@ void VcsBaseEditorWidget::reportCommandFinished(bool ok, int exitCode, const QVa
|
||||
setPlainText(tr("Failed to retrieve data."));
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
{
|
||||
TextEditor::BaseTextEditorWidget::setFontSettings(fs);
|
||||
d->m_backgroundColor = fs.toTextCharFormat(TextEditor::C_TEXT)
|
||||
.brushProperty(QTextFormat::BackgroundBrush).color();
|
||||
|
||||
if (d->m_parameters->type == AnnotateOutput) {
|
||||
if (BaseAnnotationHighlighter *highlighter = qobject_cast<BaseAnnotationHighlighter *>(baseTextDocument()->syntaxHighlighter())) {
|
||||
highlighter->setBackgroundColor(d->m_backgroundColor);
|
||||
highlighter->rehighlight();
|
||||
}
|
||||
} else if (hasDiff()) {
|
||||
if (DiffHighlighter *highlighter = qobject_cast<DiffHighlighter*>(baseTextDocument()->syntaxHighlighter())) {
|
||||
static QVector<TextEditor::TextStyle> categories;
|
||||
if (categories.isEmpty()) {
|
||||
categories << TextEditor::C_TEXT
|
||||
<< TextEditor::C_ADDED_LINE
|
||||
<< TextEditor::C_REMOVED_LINE
|
||||
<< TextEditor::C_DIFF_FILE
|
||||
<< TextEditor::C_DIFF_LOCATION;
|
||||
}
|
||||
highlighter->setFormats(fs.toTextCharFormats(categories));
|
||||
highlighter->rehighlight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const VcsBaseEditorParameters *VcsBaseEditorWidget::findType(const VcsBaseEditorParameters *array,
|
||||
int arraySize,
|
||||
EditorContentType et)
|
||||
|
||||
Reference in New Issue
Block a user