Mercurial > octave-nkf
changeset 18767:f6f1f27026bb gui-release
status bars and code folding a user preference (bug #42306)
* settings-dialog.ui: new checkboxes for status bars (main window
and editor) and code folding
* settings-dialog.cc (constructor): init new checkboxes from settings,
(write-changed-settings): write boxes check states into settings
* file-editor-tab.cc (constructor): do not set code folding here,
(notice-settings): set code folding and show/hide status bar
depending on settings
* main-window.cc (notice-settings): show/hide status bar depending on settings
author | Torsten <ttl@justmail.de> |
---|---|
date | Tue, 06 May 2014 20:38:50 +0200 |
parents | 0f9ed79fb206 |
children | c23e9e29a499 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/main-window.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui |
diffstat | 4 files changed, 70 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Tue May 06 18:08:15 2014 +0200 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue May 06 20:38:50 2014 +0200 @@ -129,10 +129,6 @@ _edit_area->setMarginsBackgroundColor (QColor (232, 232, 220)); _edit_area->setMarginType (2, QsciScintilla::TextMargin); - // code folding - _edit_area->setMarginType (3, QsciScintilla::SymbolMargin); - _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3); - // other features _edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch); _edit_area->setAutoIndent (true); @@ -1379,6 +1375,23 @@ update_lexer (); + // code folding + if (settings->value ("editor/code_folding",true).toBool ()) + { + _edit_area->setMarginType (3, QsciScintilla::SymbolMargin); + _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3); + } + else + { + _edit_area->setFolding (QsciScintilla::NoFoldStyle, 3); + } + + // status bar + if (settings->value ("editor/show_edit_status_bar",true).toBool ()) + _status_bar->show (); + else + _status_bar->hide (); + //highlight current line color QVariant default_var = QColor (240, 240, 240); QColor setting_color = settings->value ("editor/highlight_current_line_color",
--- a/libgui/src/main-window.cc Tue May 06 18:08:15 2014 +0200 +++ b/libgui/src/main-window.cc Tue May 06 20:38:50 2014 +0200 @@ -682,6 +682,11 @@ int icon_size = settings->value ("toolbar_icon_size",16).toInt (); _main_tool_bar->setIconSize (QSize (icon_size,icon_size)); + if (settings->value ("show_status_bar",true).toBool ()) + status_bar->show (); + else + status_bar->hide (); + _prevent_readline_conflicts = settings->value ("shortcuts/prevent_readline_conflicts", true).toBool (); configure_shortcuts ();
--- a/libgui/src/settings-dialog.cc Tue May 06 18:08:15 2014 +0200 +++ b/libgui/src/settings-dialog.cc Tue May 06 20:38:50 2014 +0200 @@ -122,6 +122,10 @@ ui->cb_prompt_to_exit->setChecked ( settings->value ("prompt_to_exit",false).toBool ()); + // Main status bar + ui->cb_status_bar->setChecked ( + settings->value ("show_status_bar",true).toBool ()); + // Octave startup ui->cb_restore_octave_dir->setChecked ( settings->value ("restore_octave_dir",false).toBool ()); @@ -153,6 +157,10 @@ settings->value ("editor/long_line_marker",true).toBool ()); ui->editor_long_line_column->setValue ( settings->value ("editor/long_line_column",80).toInt ()); + ui->cb_edit_status_bar->setChecked ( + settings->value ("editor/show_edit_status_bar",true).toBool ()); + ui->cb_code_folding->setChecked ( + settings->value ("editor/code_folding",true).toBool ()); ui->editor_codeCompletion->setChecked ( settings->value ("editor/codeCompletion", true).toBool () ); @@ -552,6 +560,9 @@ // promp to exit settings->setValue ( "prompt_to_exit", ui->cb_prompt_to_exit->isChecked ()); + // status bar + settings->setValue ( "show_status_bar", ui->cb_status_bar->isChecked ()); + // Octave startup settings->setValue ("restore_octave_dir", ui->cb_restore_octave_dir->isChecked ()); @@ -571,6 +582,10 @@ ui->editor_long_line_marker->isChecked ()); settings->setValue ("editor/long_line_column", ui->editor_long_line_column->value ()); + settings->setValue ("editor/code_folding", + ui->cb_code_folding->isChecked ()); + settings->setValue ("editor/show_edit_status_bar", + ui->cb_edit_status_bar->isChecked ()); settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ()); settings->setValue ("editor/codeCompletion_threshold",
--- a/libgui/src/settings-dialog.ui Tue May 06 18:08:15 2014 +0200 +++ b/libgui/src/settings-dialog.ui Tue May 06 20:38:50 2014 +0200 @@ -32,7 +32,7 @@ </size> </property> <property name="currentIndex"> - <number>6</number> + <number>1</number> </property> <widget class="QWidget" name="tab_general"> <property name="enabled"> @@ -103,7 +103,7 @@ </property> </widget> </item> - <item row="5" column="0"> + <item row="6" column="0"> <widget class="QCheckBox" name="cb_prompt_to_exit"> <property name="text"> <string>Confirm before exiting</string> @@ -280,6 +280,16 @@ </property> </widget> </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="cb_status_bar"> + <property name="text"> + <string>Show status bar</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> </layout> </item> </layout> @@ -396,7 +406,7 @@ <x>0</x> <y>0</y> <width>662</width> - <height>470</height> + <height>524</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_16"> @@ -648,6 +658,26 @@ </item> </layout> </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="cb_code_folding"> + <property name="text"> + <string>Enable Code Folding</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QCheckBox" name="cb_edit_status_bar"> + <property name="text"> + <string>Show status bar</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> </layout> </item> <item>