Commit 3fa6b673 authored by Eike Ziller's avatar Eike Ziller
Browse files

TextEditors: Move font settings to document



Change-Id: I325764cbaa9684fa2758b0ea6c6ea58de142cb73
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent b59d61e2
...@@ -1529,13 +1529,14 @@ TextEditor::CompletionAssistProvider *CPPEditor::completionAssistProvider() ...@@ -1529,13 +1529,14 @@ TextEditor::CompletionAssistProvider *CPPEditor::completionAssistProvider()
return CppModelManagerInterface::instance()->cppEditorSupport(this)->completionAssistProvider(); return CppModelManagerInterface::instance()->cppEditorSupport(this)->completionAssistProvider();
} }
void CPPEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void CPPEditorWidget::applyFontSettings()
{ {
TextEditor::BaseTextEditorWidget::setFontSettings(fs); TextEditor::BaseTextEditorWidget::applyFontSettings();
TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter(); TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
if (!highlighter) if (!highlighter)
return; return;
const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
m_occurrencesFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES); m_occurrencesFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES);
m_occurrencesUnusedFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_UNUSED); m_occurrencesUnusedFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_UNUSED);
m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline); m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
......
...@@ -145,7 +145,6 @@ Q_SIGNALS: ...@@ -145,7 +145,6 @@ Q_SIGNALS:
void outlineModelIndexChanged(const QModelIndex &index); void outlineModelIndexChanged(const QModelIndex &index);
public Q_SLOTS: public Q_SLOTS:
virtual void setFontSettings(const TextEditor::FontSettings &);
void setSortedOutline(bool sort); void setSortedOutline(bool sort);
void switchDeclarationDefinition(bool inNextSplit); void switchDeclarationDefinition(bool inNextSplit);
void renameSymbolUnderCursor(); void renameSymbolUnderCursor();
...@@ -162,6 +161,7 @@ protected: ...@@ -162,6 +161,7 @@ protected:
void contextMenuEvent(QContextMenuEvent *); void contextMenuEvent(QContextMenuEvent *);
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
void applyFontSettings();
TextEditor::BaseTextEditor *createEditor(); TextEditor::BaseTextEditor *createEditor();
const CPlusPlus::Macro *findCanonicalMacro(const QTextCursor &cursor, const CPlusPlus::Macro *findCanonicalMacro(const QTextCursor &cursor,
......
...@@ -497,7 +497,7 @@ void CppCodeStylePreferencesWidget::decorateEditors(const TextEditor::FontSettin ...@@ -497,7 +497,7 @@ void CppCodeStylePreferencesWidget::decorateEditors(const TextEditor::FontSettin
} }
foreach (TextEditor::SnippetEditorWidget *editor, m_previews) { foreach (TextEditor::SnippetEditorWidget *editor, m_previews) {
editor->setFontSettings(fontSettings); editor->baseTextDocument()->setFontSettings(fontSettings);
if (provider) if (provider)
provider->decorateEditor(editor); provider->decorateEditor(editor);
} }
......
...@@ -185,7 +185,6 @@ public: ...@@ -185,7 +185,6 @@ public:
public slots: public slots:
void setDisplaySettings(const DisplaySettings &ds); void setDisplaySettings(const DisplaySettings &ds);
void setFontSettings(const TextEditor::FontSettings &fs);
signals: signals:
void jumpToOriginalFileRequested(int diffFileIndex, void jumpToOriginalFileRequested(int diffFileIndex,
...@@ -194,6 +193,7 @@ signals: ...@@ -194,6 +193,7 @@ signals:
protected: protected:
virtual int extraAreaWidth(int *markWidthPtr = 0) const { return BaseTextEditorWidget::extraAreaWidth(markWidthPtr); } virtual int extraAreaWidth(int *markWidthPtr = 0) const { return BaseTextEditorWidget::extraAreaWidth(markWidthPtr); }
void applyFontSettings();
BaseTextEditor *createEditor() { return new DiffViewEditorEditable(this); } BaseTextEditor *createEditor() { return new DiffViewEditorEditable(this); }
virtual QString lineNumber(int blockNumber) const; virtual QString lineNumber(int blockNumber) const;
virtual int lineNumberDigits() const; virtual int lineNumberDigits() const;
...@@ -356,9 +356,10 @@ void DiffViewEditorWidget::setDisplaySettings(const DisplaySettings &ds) ...@@ -356,9 +356,10 @@ void DiffViewEditorWidget::setDisplaySettings(const DisplaySettings &ds)
BaseTextEditorWidget::setDisplaySettings(settings); BaseTextEditorWidget::setDisplaySettings(settings);
} }
void DiffViewEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void DiffViewEditorWidget::applyFontSettings()
{ {
BaseTextEditorWidget::setFontSettings(fs); BaseTextEditorWidget::applyFontSettings();
const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
m_fileLineForeground = fs.formatFor(C_DIFF_FILE_LINE).foreground(); m_fileLineForeground = fs.formatFor(C_DIFF_FILE_LINE).foreground();
m_chunkLineForeground = fs.formatFor(C_DIFF_CONTEXT_LINE).foreground(); m_chunkLineForeground = fs.formatFor(C_DIFF_CONTEXT_LINE).foreground();
m_textForeground = fs.toTextCharFormat(C_TEXT).foreground().color(); m_textForeground = fs.toTextCharFormat(C_TEXT).foreground().color();
...@@ -1578,8 +1579,8 @@ static QTextCharFormat fullWidthFormatForTextStyle(const TextEditor::FontSetting ...@@ -1578,8 +1579,8 @@ static QTextCharFormat fullWidthFormatForTextStyle(const TextEditor::FontSetting
void DiffEditorWidget::setFontSettings(const TextEditor::FontSettings &fontSettings) void DiffEditorWidget::setFontSettings(const TextEditor::FontSettings &fontSettings)
{ {
m_leftEditor->setFontSettings(fontSettings); m_leftEditor->baseTextDocument()->setFontSettings(fontSettings);
m_rightEditor->setFontSettings(fontSettings); m_rightEditor->baseTextDocument()->setFontSettings(fontSettings);
m_fileLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_FILE_LINE); m_fileLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_FILE_LINE);
m_chunkLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_CONTEXT_LINE); m_chunkLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_CONTEXT_LINE);
......
...@@ -125,7 +125,7 @@ DiffShowEditor::DiffShowEditor(DiffEditorWidget *editorWidget) ...@@ -125,7 +125,7 @@ DiffShowEditor::DiffShowEditor(DiffEditorWidget *editorWidget)
m_diffShowWidget, SLOT(setFontSettings(TextEditor::FontSettings))); m_diffShowWidget, SLOT(setFontSettings(TextEditor::FontSettings)));
m_diffShowWidget->setDisplaySettings(TextEditorSettings::displaySettings()); m_diffShowWidget->setDisplaySettings(TextEditorSettings::displaySettings());
m_diffShowWidget->setCodeStyle(TextEditorSettings::codeStyle()); m_diffShowWidget->setCodeStyle(TextEditorSettings::codeStyle());
m_diffShowWidget->setFontSettings(TextEditorSettings::fontSettings()); m_diffShowWidget->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
} }
DiffShowEditor::~DiffShowEditor() DiffShowEditor::~DiffShowEditor()
......
...@@ -71,7 +71,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) : ...@@ -71,7 +71,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) :
QWidget(parent), d(new EnvironmentItemsWidgetPrivate) QWidget(parent), d(new EnvironmentItemsWidgetPrivate)
{ {
d->m_editor = new TextEditor::SnippetEditorWidget(this); d->m_editor = new TextEditor::SnippetEditorWidget(this);
d->m_editor->setFontSettings(TextEditor::TextEditorSettings::fontSettings()); d->m_editor->baseTextDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(d->m_editor); layout->addWidget(d->m_editor);
} }
......
...@@ -89,14 +89,14 @@ void EditorWidget::unCommentSelection() ...@@ -89,14 +89,14 @@ void EditorWidget::unCommentSelection()
Handles common IDE fonts&colors settings Handles common IDE fonts&colors settings
(Tools -> Options -> Text editor -> Fonts and colors) (Tools -> Options -> Text editor -> Fonts and colors)
*/ */
void EditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void EditorWidget::applyFontSettings()
{ {
TextEditor::BaseTextEditorWidget::setFontSettings(fs); TextEditor::BaseTextEditorWidget::applyFontSettings();
PythonHighlighter *highlighter = PythonHighlighter *highlighter =
qobject_cast<PythonHighlighter *>(baseTextDocument()->syntaxHighlighter()); qobject_cast<PythonHighlighter *>(baseTextDocument()->syntaxHighlighter());
if (highlighter) if (highlighter)
highlighter->setFontSettings(fs); highlighter->setFontSettings(baseTextDocument()->fontSettings());
} }
TextEditor::BaseTextEditor *EditorWidget::createEditor() TextEditor::BaseTextEditor *EditorWidget::createEditor()
......
...@@ -47,10 +47,8 @@ public: ...@@ -47,10 +47,8 @@ public:
virtual void unCommentSelection(); virtual void unCommentSelection();
public slots:
virtual void setFontSettings(const TextEditor::FontSettings &);
protected: protected:
void applyFontSettings();
TextEditor::BaseTextEditor *createEditor(); TextEditor::BaseTextEditor *createEditor();
private: private:
......
...@@ -997,10 +997,11 @@ void QmlJSTextEditorWidget::setSelectedElements() ...@@ -997,10 +997,11 @@ void QmlJSTextEditorWidget::setSelectedElements()
emit selectedElementsChanged(offsets, wordAtCursor); emit selectedElementsChanged(offsets, wordAtCursor);
} }
void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void QmlJSTextEditorWidget::applyFontSettings()
{ {
TextEditor::BaseTextEditorWidget::setFontSettings(fs); TextEditor::BaseTextEditorWidget::applyFontSettings();
const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
m_occurrencesFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES); m_occurrencesFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES);
m_occurrencesUnusedFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_UNUSED); m_occurrencesUnusedFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_UNUSED);
m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline); m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
......
...@@ -135,7 +135,6 @@ public slots: ...@@ -135,7 +135,6 @@ public slots:
void findUsages(); void findUsages();
void renameUsages(); void renameUsages();
void showContextPane(); void showContextPane();
virtual void setFontSettings(const TextEditor::FontSettings &);
signals: signals:
void outlineModelIndexChanged(const QModelIndex &index); void outlineModelIndexChanged(const QModelIndex &index);
...@@ -168,6 +167,7 @@ protected: ...@@ -168,6 +167,7 @@ protected:
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void scrollContentsBy(int dx, int dy); void scrollContentsBy(int dx, int dy);
void applyFontSettings();
TextEditor::BaseTextEditor *createEditor(); TextEditor::BaseTextEditor *createEditor();
void createToolBar(QmlJSEditor *editable); void createToolBar(QmlJSEditor *editable);
TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor, TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor,
......
...@@ -107,7 +107,7 @@ void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSetti ...@@ -107,7 +107,7 @@ void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSetti
} }
} }
m_ui->previewTextEdit->setFontSettings(fontSettings); m_ui->previewTextEdit->baseTextDocument()->setFontSettings(fontSettings);
if (provider) if (provider)
provider->decorateEditor(m_ui->previewTextEdit); provider->decorateEditor(m_ui->previewTextEdit);
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "basetexteditor.h" #include "basetexteditor.h"
#include "convenience.h" #include "convenience.h"
#include "extraencodingsettings.h" #include "extraencodingsettings.h"
#include "fontsettings.h"
#include "indenter.h" #include "indenter.h"
#include "storagesettings.h" #include "storagesettings.h"
#include "syntaxhighlighter.h" #include "syntaxhighlighter.h"
...@@ -77,6 +78,7 @@ public: ...@@ -77,6 +78,7 @@ public:
StorageSettings m_storageSettings; StorageSettings m_storageSettings;
TabSettings m_tabSettings; TabSettings m_tabSettings;
ExtraEncodingSettings m_extraEncodingSettings; ExtraEncodingSettings m_extraEncodingSettings;
FontSettings m_fontSettings;
QTextDocument *m_document; QTextDocument *m_document;
SyntaxHighlighter *m_highlighter; SyntaxHighlighter *m_highlighter;
QScopedPointer<Indenter> m_indenter; QScopedPointer<Indenter> m_indenter;
...@@ -230,6 +232,19 @@ const TabSettings &BaseTextDocument::tabSettings() const ...@@ -230,6 +232,19 @@ const TabSettings &BaseTextDocument::tabSettings() const
return d->m_tabSettings; return d->m_tabSettings;
} }
void BaseTextDocument::setFontSettings(const FontSettings &fontSettings)
{
if (fontSettings == d->m_fontSettings)
return;
d->m_fontSettings = fontSettings;
emit fontSettingsChanged();
}
const FontSettings &BaseTextDocument::fontSettings() const
{
return d->m_fontSettings;
}
void BaseTextDocument::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings) void BaseTextDocument::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings)
{ {
d->m_extraEncodingSettings = extraEncodingSettings; d->m_extraEncodingSettings = extraEncodingSettings;
......
...@@ -43,6 +43,7 @@ namespace TextEditor { ...@@ -43,6 +43,7 @@ namespace TextEditor {
class BaseTextDocumentPrivate; class BaseTextDocumentPrivate;
class ExtraEncodingSettings; class ExtraEncodingSettings;
class FontSettings;
class ITextMarkable; class ITextMarkable;
class Indenter; class Indenter;
class StorageSettings; class StorageSettings;
...@@ -71,6 +72,7 @@ public: ...@@ -71,6 +72,7 @@ public:
const StorageSettings &storageSettings() const; const StorageSettings &storageSettings() const;
const TabSettings &tabSettings() const; const TabSettings &tabSettings() const;
const ExtraEncodingSettings &extraEncodingSettings() const; const ExtraEncodingSettings &extraEncodingSettings() const;
const FontSettings &fontSettings() const;
void setIndenter(Indenter *indenter); void setIndenter(Indenter *indenter);
Indenter *indenter() const; Indenter *indenter() const;
...@@ -112,10 +114,12 @@ public: ...@@ -112,10 +114,12 @@ public:
public slots: public slots:
void setTabSettings(const TextEditor::TabSettings &tabSettings); void setTabSettings(const TextEditor::TabSettings &tabSettings);
void setFontSettings(const TextEditor::FontSettings &fontSettings);
signals: signals:
void mimeTypeChanged(); void mimeTypeChanged();
void tabSettingsChanged(); void tabSettingsChanged();
void fontSettingsChanged();
private: private:
void cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument); void cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument);
......
...@@ -2347,6 +2347,7 @@ BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate() ...@@ -2347,6 +2347,7 @@ BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate()
m_parenthesesMatchingTimer(0), m_parenthesesMatchingTimer(0),
m_extraArea(0), m_extraArea(0),
m_codeStylePreferences(0), m_codeStylePreferences(0),
m_fontSettingsNeedsApply(true), // apply when making visible the first time, for the split case
extraAreaSelectionAnchorBlockNumber(-1), extraAreaSelectionAnchorBlockNumber(-1),
extraAreaToggleMarkBlockNumber(-1), extraAreaToggleMarkBlockNumber(-1),
extraAreaHighlightFoldedBlockNumber(-1), extraAreaHighlightFoldedBlockNumber(-1),
...@@ -2404,6 +2405,7 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals() ...@@ -2404,6 +2405,7 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals()
QObject::connect(m_document.data(), SIGNAL(aboutToReload()), q, SLOT(documentAboutToBeReloaded())); QObject::connect(m_document.data(), SIGNAL(aboutToReload()), q, SLOT(documentAboutToBeReloaded()));
QObject::connect(m_document.data(), SIGNAL(reloadFinished(bool)), q, SLOT(documentReloadFinished(bool))); QObject::connect(m_document.data(), SIGNAL(reloadFinished(bool)), q, SLOT(documentReloadFinished(bool)));
QObject::connect(m_document.data(), SIGNAL(tabSettingsChanged()), q, SLOT(updateTabStops())); QObject::connect(m_document.data(), SIGNAL(tabSettingsChanged()), q, SLOT(updateTabStops()));
QObject::connect(m_document.data(), SIGNAL(fontSettingsChanged()), q, SLOT(applyFontSettingsDelayed()));
q->slotUpdateExtraAreaWidth(); q->slotUpdateExtraAreaWidth();
} }
...@@ -5363,25 +5365,25 @@ void BaseTextEditorWidget::unCommentSelection() ...@@ -5363,25 +5365,25 @@ void BaseTextEditorWidget::unCommentSelection()
void BaseTextEditorWidget::showEvent(QShowEvent* e) void BaseTextEditorWidget::showEvent(QShowEvent* e)
{ {
if (!d->m_fontSettings.isEmpty()) { if (d->m_fontSettingsNeedsApply) {
setFontSettings(d->m_fontSettings); applyFontSettings();
d->m_fontSettings.clear(); d->m_fontSettingsNeedsApply = false;
} }
QPlainTextEdit::showEvent(e); QPlainTextEdit::showEvent(e);
} }
void BaseTextEditorWidget::setFontSettingsIfVisible(const TextEditor::FontSettings &fs) void BaseTextEditorWidget::applyFontSettingsDelayed()
{ {
if (!isVisible()) { if (isVisible())
d->m_fontSettings = fs; applyFontSettings();
return; else
} d->m_fontSettingsNeedsApply = true;
setFontSettings(fs);
} }
void BaseTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) void BaseTextEditorWidget::applyFontSettings()
{ {
const FontSettings &fs = baseTextDocument()->fontSettings();
const QTextCharFormat textFormat = fs.toTextCharFormat(C_TEXT); const QTextCharFormat textFormat = fs.toTextCharFormat(C_TEXT);
const QTextCharFormat selectionFormat = fs.toTextCharFormat(C_SELECTION); const QTextCharFormat selectionFormat = fs.toTextCharFormat(C_SELECTION);
const QTextCharFormat lineNumberFormat = fs.toTextCharFormat(C_LINE_NUMBER); const QTextCharFormat lineNumberFormat = fs.toTextCharFormat(C_LINE_NUMBER);
......
...@@ -343,6 +343,7 @@ private: ...@@ -343,6 +343,7 @@ private:
protected: protected:
virtual BaseTextEditor *createEditor() = 0; virtual BaseTextEditor *createEditor() = 0;
virtual void applyFontSettings();
private slots: private slots:
void editorContentsChange(int position, int charsRemoved, int charsAdded); void editorContentsChange(int position, int charsRemoved, int charsAdded);
...@@ -412,8 +413,6 @@ public slots: ...@@ -412,8 +413,6 @@ public slots:
virtual void format(); virtual void format();
virtual void rewrapParagraph(); virtual void rewrapParagraph();
virtual void unCommentSelection(); virtual void unCommentSelection();
virtual void setFontSettings(const TextEditor::FontSettings &);
void setFontSettingsIfVisible(const TextEditor::FontSettings &);
virtual void setDisplaySettings(const TextEditor::DisplaySettings &); virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
virtual void setMarginSettings(const TextEditor::MarginSettings &); virtual void setMarginSettings(const TextEditor::MarginSettings &);
virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &); virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
...@@ -547,6 +546,7 @@ private: ...@@ -547,6 +546,7 @@ private:
private slots: private slots:
void handleBlockSelection(int diff_row, int diff_col); void handleBlockSelection(int diff_row, int diff_col);
void updateTabStops(); void updateTabStops();
void applyFontSettingsDelayed();
// parentheses matcher // parentheses matcher
void _q_matchParentheses(); void _q_matchParentheses();
......
...@@ -138,7 +138,7 @@ public: ...@@ -138,7 +138,7 @@ public:
ICodeStylePreferences *m_codeStylePreferences; ICodeStylePreferences *m_codeStylePreferences;
DisplaySettings m_displaySettings; DisplaySettings m_displaySettings;
MarginSettings m_marginSettings; MarginSettings m_marginSettings;
FontSettings m_fontSettings; bool m_fontSettingsNeedsApply;
BehaviorSettings m_behaviorSettings; BehaviorSettings m_behaviorSettings;
int extraAreaSelectionAnchorBlockNumber; int extraAreaSelectionAnchorBlockNumber;
......
...@@ -54,7 +54,7 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, ...@@ -54,7 +54,7 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory,
CodeStyleSelectorWidget *selector = new CodeStyleSelectorWidget(factory, this); CodeStyleSelectorWidget *selector = new CodeStyleSelectorWidget(factory, this);
selector->setCodeStyle(codeStyle); selector->setCodeStyle(codeStyle);
m_preview = new SnippetEditorWidget(this); m_preview = new SnippetEditorWidget(this);
m_preview->setFontSettings(TextEditorSettings::fontSettings()); m_preview->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
DisplaySettings displaySettings = m_preview->displaySettings(); DisplaySettings displaySettings = m_preview->displaySettings();
displaySettings.m_visualizeWhitespace = true; displaySettings.m_visualizeWhitespace = true;
m_preview->setDisplaySettings(displaySettings); m_preview->setDisplaySettings(displaySettings);
......
...@@ -171,7 +171,7 @@ void PlainTextEditorWidget::configure(const MimeType &mimeType) ...@@ -171,7 +171,7 @@ void PlainTextEditorWidget::configure(const MimeType &mimeType)
} }
} }
setFontSettings(TextEditorSettings::fontSettings()); baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
emit configured(editor()); emit configured(editor());
} }
......
...@@ -335,7 +335,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w) ...@@ -335,7 +335,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
foreach (ISnippetProvider *provider, providers) { foreach (ISnippetProvider *provider, providers) {
m_ui.groupCombo->addItem(provider->displayName(), provider->groupId()); m_ui.groupCombo->addItem(provider->displayName(), provider->groupId());
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w); SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
snippetEditor->setFontSettings(TextEditorSettings::fontSettings()); snippetEditor->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
provider->decorateEditor(snippetEditor); provider->decorateEditor(snippetEditor);
m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor); m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor);
connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent())); connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent()));
...@@ -541,7 +541,7 @@ void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings ...@@ -541,7 +541,7 @@ void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings
ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); ExtensionSystem::PluginManager::getObjects<ISnippetProvider>();
for (int i = 0; i < m_ui.groupCombo->count(); ++i) { for (int i = 0; i < m_ui.groupCombo->count(); ++i) {
SnippetEditorWidget *snippetEditor = editorAt(i); SnippetEditorWidget *snippetEditor = editorAt(i);
snippetEditor->setFontSettings(fontSettings); snippetEditor->baseTextDocument()->setFontSettings(fontSettings);
const QString &id = m_ui.groupCombo->itemData(i).toString(); const QString &id = m_ui.groupCombo->itemData(i).toString();
// This list should be quite short... Re-iterating over it is ok. // This list should be quite short... Re-iterating over it is ok.
foreach (const ISnippetProvider *provider, providers) { foreach (const ISnippetProvider *provider, providers) {
......
...@@ -335,7 +335,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor) ...@@ -335,7 +335,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor)
{ {
// Connect to settings change signals // Connect to settings change signals
connect(m_instance, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), connect(m_instance, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
editor, SLOT(setFontSettingsIfVisible(TextEditor::FontSettings))); editor->baseTextDocument(), SLOT(setFontSettings(TextEditor::FontSettings)));
connect(m_instance, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)), connect(m_instance, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
editor, SLOT(setTypingSettings(TextEditor::TypingSettings))); editor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
connect(m_instance, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), connect(m_instance, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
...@@ -357,7 +357,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor) ...@@ -357,7 +357,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor)
m_instance, SLOT(zoomResetRequested())); m_instance, SLOT(zoomResetRequested()));
// Apply current settings // Apply current settings
editor->setFontSettings(fontSettings()); editor->baseTextDocument()->setFontSettings(fontSettings());
editor->baseTextDocument()->setTabSettings(codeStyle()->tabSettings()); // also set through code style ??? editor->baseTextDocument()->setTabSettings(codeStyle()->tabSettings()); // also set through code style ???
editor->setTypingSettings(typingSettings()); editor->setTypingSettings(typingSettings());
editor->setStorageSettings(storageSettings()); editor->setStorageSettings(storageSettings());
......
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