Skip to content

Commit

Permalink
Merge pull request #1612 from jasleenkaur/Line_Number
Browse files Browse the repository at this point in the history
added line number option on editor preferences
  • Loading branch information
kintel committed Mar 31, 2016
2 parents 8308bd7 + 012a4a9 commit 9caee5b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 13 deletions.
6 changes: 6 additions & 0 deletions src/Preferences.cc
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/Preferences.h
Expand Up @@ -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;
Expand Down
67 changes: 55 additions & 12 deletions src/Preferences.ui
Expand Up @@ -31,7 +31,16 @@
</property>
<widget class="QWidget" name="page3DView">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand Down Expand Up @@ -95,7 +104,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand All @@ -107,9 +125,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>634</width>
<height>662</height>
<y>-262</y>
<width>639</width>
<height>653</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
Expand Down Expand Up @@ -226,7 +244,7 @@
<widget class="QFontComboBox" name="fontChooser">
<property name="currentFont">
<font>
<family>Helvetica</family>
<family>TeX Gyre Heros</family>
<pointsize>12</pointsize>
</font>
</property>
Expand Down Expand Up @@ -680,6 +698,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxEnableLineNumbers">
<property name="text">
<string>Display Line Numbers</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1126,7 +1151,16 @@
</widget>
<widget class="QWidget" name="pageFeatures">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
Expand Down Expand Up @@ -1163,8 +1197,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>36</height>
<width>82</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
Expand Down Expand Up @@ -1198,7 +1232,16 @@
</widget>
<widget class="QWidget" name="pageAdvanced">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand All @@ -1217,8 +1260,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>339</height>
<width>490</width>
<height>383</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down
1 change: 1 addition & 0 deletions src/scintillaeditor.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/settings.cc
Expand Up @@ -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));
}
1 change: 1 addition & 0 deletions src/settings.h
Expand Up @@ -50,6 +50,7 @@ class Settings
static SettingsEntry tabKeyFunction;
static SettingsEntry highlightCurrentLine;
static SettingsEntry enableBraceMatching;
static SettingsEntry enableLineNumbers;

static Settings *inst(bool erase = false);

Expand Down

0 comments on commit 9caee5b

Please sign in to comment.