changeset 16702:553cfdd5d660

make white space visibility in the editor configurable * settings-dialog.ui: insert checkboxes for white space visibility * settings-dialog.cc(read_settings): read state for checkboxes from settings, (write_changed_settings): write state of checkboxes into settings file * file-editor-tab.cc(notice-settings): load white space visibility from settings
author Torsten <ttl@justmail.de>
date Sun, 26 May 2013 14:49:41 +0200
parents ccfbc767ff5a
children 5cf19370011d
files libgui/src/m-editor/file-editor-tab.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui
diffstat 3 files changed, 72 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat May 25 16:36:34 2013 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sun May 26 14:49:41 2013 +0200
@@ -1123,6 +1123,14 @@
   else
     _edit_area->setAutoCompletionThreshold (-1);
 
+  if (settings->value ("editor/show_white_space",false).toBool ())
+    if (settings->value ("editor/show_white_space_indent",false).toBool ())
+      _edit_area->setWhitespaceVisibility (QsciScintilla::WsVisibleAfterIndent);
+    else
+      _edit_area->setWhitespaceVisibility (QsciScintilla::WsVisible);
+  else
+    _edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible);
+
   if (settings->value ("editor/showLineNumbers", true).toBool ())
     {
       _edit_area->setMarginLineNumbers (2, true);
--- a/libgui/src/settings-dialog.cc	Sat May 25 16:36:34 2013 +0200
+++ b/libgui/src/settings-dialog.cc	Sun May 26 14:49:41 2013 +0200
@@ -108,6 +108,8 @@
   ui->editor_checkbox_ac_document->setChecked (settings->value ("editor/codeCompletion_document",false).toBool ());
   ui->editor_checkbox_ac_case->setChecked (settings->value ("editor/codeCompletion_case",true).toBool ());
   ui->editor_checkbox_ac_replace->setChecked (settings->value ("editor/codeCompletion_replace",false).toBool ());
+  ui->editor_ws_checkbox->setChecked (settings->value ("editor/show_white_space",false).toBool ());
+  ui->editor_ws_indent_checkbox->setChecked (settings->value ("editor/show_white_space_indent",false).toBool ());
   ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",false).toBool ());
   ui->editor_restoreSession->setChecked (settings->value ("editor/restoreSession",true).toBool ());
   ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier New").toString()) );
@@ -411,6 +413,8 @@
   settings->setValue ("editor/codeCompletion_document", ui->editor_checkbox_ac_document->isChecked ());
   settings->setValue ("editor/codeCompletion_case", ui->editor_checkbox_ac_case->isChecked ());
   settings->setValue ("editor/codeCompletion_replace", ui->editor_checkbox_ac_replace->isChecked ());
+  settings->setValue ("editor/show_white_space", ui->editor_ws_checkbox->isChecked ());
+  settings->setValue ("editor/show_white_space_indent", ui->editor_ws_indent_checkbox->isChecked ());
   settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
   settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ());
   settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value());
--- a/libgui/src/settings-dialog.ui	Sat May 25 16:36:34 2013 +0200
+++ b/libgui/src/settings-dialog.ui	Sun May 26 14:49:41 2013 +0200
@@ -208,6 +208,40 @@
           </widget>
          </item>
          <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_4">
+           <item>
+            <widget class="QCheckBox" name="editor_ws_checkbox">
+             <property name="text">
+              <string>Show white space</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QCheckBox" name="editor_ws_indent_checkbox">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>But no white spaces used for indentation</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_12">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
+         <item>
           <layout class="QGridLayout" name="editor_grid_current_line" rowstretch="0" columnstretch="0,0,0,0,0">
            <item row="0" column="0">
             <widget class="QCheckBox" name="editor_highlightCurrentLine">
@@ -457,18 +491,18 @@
         </spacer>
        </item>
        <item>
-        <widget class="QCheckBox" name="useCustomFileEditor">
-         <property name="enabled">
-          <bool>true</bool>
-         </property>
-         <property name="text">
-          <string>Use custom file editor</string>
-         </property>
-        </widget>
-       </item>
-       <item>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
+          <widget class="QCheckBox" name="useCustomFileEditor">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Use custom file editor</string>
+           </property>
+          </widget>
+         </item>
+         <item>
           <widget class="QLabel" name="customEditorLabel">
            <property name="enabled">
             <bool>false</bool>
@@ -1264,5 +1298,21 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>editor_ws_checkbox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_ws_indent_checkbox</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>85</x>
+     <y>119</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>282</x>
+     <y>119</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>