diff --git a/src/Preferences.cc b/src/Preferences.cc index a0926041..efa96448 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -561,6 +561,11 @@ void Preferences::on_checkBoxEnableBraceMatching_toggled(bool val) Settings::Settings::inst()->set(Settings::Settings::enableBraceMatching, Value(val)); writeSettings(); } +void Preferences::on_checkBoxEnableLineNumbers_toggled(bool checked) +{ + Settings::Settings::inst()->set(Settings::Settings::enableLineNumbers, Value(checked)); + writeSettings(); +} void Preferences::writeSettings() { @@ -684,6 +689,7 @@ void Preferences::updateGUI() this->checkBoxHighlightCurrentLine->setChecked(s->get(Settings::Settings::highlightCurrentLine).toBool()); this->checkBoxEnableBraceMatching->setChecked(s->get(Settings::Settings::enableBraceMatching).toBool()); this->checkBoxShowWarningsIn3dView->setChecked(s->get(Settings::Settings::showWarningsIn3dView).toBool()); + this->checkBoxEnableLineNumbers->setChecked(s->get(Settings::Settings::enableLineNumbers).toBool()); } void Preferences::initComboBox(QComboBox *comboBox, const Settings::SettingsEntry& entry) diff --git a/src/Preferences.h b/src/Preferences.h index a23195a9..3dadf7f3 100644 --- a/src/Preferences.h +++ b/src/Preferences.h @@ -70,6 +70,7 @@ public slots: // Display void on_checkBoxHighlightCurrentLine_toggled(bool); void on_checkBoxEnableBraceMatching_toggled(bool); + void on_checkBoxEnableLineNumbers_toggled(bool); signals: void requestRedraw() const; diff --git a/src/Preferences.ui b/src/Preferences.ui index c5352bd6..6592d371 100644 --- a/src/Preferences.ui +++ b/src/Preferences.ui @@ -31,7 +31,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -95,7 +104,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -107,9 +125,9 @@ 0 - 0 - 634 - 662 + -262 + 639 + 653 @@ -226,7 +244,7 @@ - Helvetica + TeX Gyre Heros 12 @@ -680,6 +698,13 @@ + + + + Display Line Numbers + + + @@ -1126,7 +1151,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1163,8 +1197,8 @@ 0 0 - 98 - 36 + 82 + 26 @@ -1198,7 +1232,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1217,8 +1260,8 @@ 0 0 - 440 - 339 + 490 + 383 diff --git a/src/scintillaeditor.cpp b/src/scintillaeditor.cpp index c135c2a6..1873e6d0 100644 --- a/src/scintillaeditor.cpp +++ b/src/scintillaeditor.cpp @@ -180,6 +180,7 @@ void ScintillaEditor::applySettings() qsci->setBraceMatching(s->get(Settings::Settings::enableBraceMatching).toBool() ? QsciScintilla::SloppyBraceMatch : QsciScintilla::NoBraceMatch); qsci->setCaretLineVisible(s->get(Settings::Settings::highlightCurrentLine).toBool()); + qsci->setMarginLineNumbers(1,s->get(Settings::Settings::enableLineNumbers).toBool()); } void ScintillaEditor::setPlainText(const QString &text) diff --git a/src/settings.cc b/src/settings.cc index 35197389..2a63e89f 100644 --- a/src/settings.cc +++ b/src/settings.cc @@ -141,5 +141,5 @@ SettingsEntry Settings::indentStyle("editor", "indentStyle", values("Spaces", _( SettingsEntry Settings::tabKeyFunction("editor", "tabKeyFunction", values("Indent", _("Indent"), "InsertTab", _("Insert Tab")), Value("Indent")); SettingsEntry Settings::highlightCurrentLine("editor", "highlightCurrentLine", Value(true), Value(true)); SettingsEntry Settings::enableBraceMatching("editor", "enableBraceMatching", Value(true), Value(true)); - +SettingsEntry Settings::enableLineNumbers("editor", "enableLineNumbers", Value(true), Value(true)); } diff --git a/src/settings.h b/src/settings.h index 6222f280..afba5663 100644 --- a/src/settings.h +++ b/src/settings.h @@ -50,6 +50,7 @@ public: static SettingsEntry tabKeyFunction; static SettingsEntry highlightCurrentLine; static SettingsEntry enableBraceMatching; + static SettingsEntry enableLineNumbers; static Settings *inst(bool erase = false);