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:
jkobus
2013-08-13 12:57:31 +02:00
committed by Jarek Kobus
parent 760aa0f8bc
commit e8801167aa
69 changed files with 489 additions and 531 deletions

View File

@@ -38,15 +38,12 @@
#include "manager.h"
#include "context.h"
#include "normalindenter.h"
#include "fontsettings.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <QSharedPointer>
#include <QDebug>
using namespace Core;
using namespace TextEditor::Internal;
@@ -94,30 +91,6 @@ void PlainTextEditorWidget::unCommentSelection()
Utils::unCommentSelection(this, m_commentDefinition);
}
void PlainTextEditorWidget::setFontSettings(const FontSettings &fs)
{
BaseTextEditorWidget::setFontSettings(fs);
if (baseTextDocument()->syntaxHighlighter()) {
Highlighter *highlighter =
static_cast<Highlighter *>(baseTextDocument()->syntaxHighlighter());
highlighter->configureFormat(Highlighter::VisualWhitespace, fs.toTextCharFormat(C_VISUAL_WHITESPACE));
highlighter->configureFormat(Highlighter::Keyword, fs.toTextCharFormat(C_KEYWORD));
highlighter->configureFormat(Highlighter::DataType, fs.toTextCharFormat(C_TYPE));
highlighter->configureFormat(Highlighter::Comment, fs.toTextCharFormat(C_COMMENT));
// Using C_NUMBER for all kinds of numbers.
highlighter->configureFormat(Highlighter::Decimal, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::BaseN, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::Float, fs.toTextCharFormat(C_NUMBER));
// Using C_STRING for strings and chars.
highlighter->configureFormat(Highlighter::Char, fs.toTextCharFormat(C_STRING));
highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(C_STRING));
highlighter->rehighlight();
}
}
void PlainTextEditorWidget::setTabSettings(const TextEditor::TabSettings &ts)
{
BaseTextEditorWidget::setTabSettings(ts);