changeset 16693:e9d0b8252a0a

make color of current line marker in the editor configurable * settings-dailog.ui: add dummy for color picker * settings-dialog.h: add pointer to color picker as class variable * settings-dialog.cc(constructor): add color picker with color from settings (write_changed_settings): store color from color picker in settings file * file-editor-tab.cc(constructor): remove setting the color of the marker here (notice_settings): load color for the marker from the settings file
author Torsten <ttl@justmail.de>
date Tue, 21 May 2013 20:08:22 +0200
parents c19cc8c158b3
children bf1de4943a5d
files libgui/src/m-editor/file-editor-tab.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.h libgui/src/settings-dialog.ui
diffstat 4 files changed, 104 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat May 18 23:00:19 2013 -0400
+++ b/libgui/src/m-editor/file-editor-tab.cc	Tue May 21 20:08:22 2013 +0200
@@ -99,9 +99,6 @@
   _edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
   _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
 
-  //highlight current line color
-  _edit_area->setCaretLineBackgroundColor (QColor (245, 245, 245));
-
   // other features
   _edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch);
   _edit_area->setAutoIndent (true);
@@ -1090,6 +1087,11 @@
 
   QFontMetrics lexer_font_metrics (_edit_area->lexer ()->defaultFont (0));
 
+  //highlight current line color
+  QVariant default_var = QColor (240, 240, 240);
+  QColor setting_color = settings->value ("editor/highlight_current_line_color",
+                                          default_var).value<QColor> ();
+  _edit_area->setCaretLineBackgroundColor (setting_color);
   _edit_area->setCaretLineVisible
     (settings->value ("editor/highlightCurrentLine", true).toBool ());
 
--- a/libgui/src/settings-dialog.cc	Sat May 18 23:00:19 2013 -0400
+++ b/libgui/src/settings-dialog.cc	Tue May 21 20:08:22 2013 +0200
@@ -24,7 +24,6 @@
 #include <config.h>
 #endif
 
-#include "color-picker.h"
 #include "resource-manager.h"
 #include "workspace-model.h"
 #include "settings-dialog.h"
@@ -91,7 +90,18 @@
   ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor",false).toBool ());
   ui->customFileEditor->setText (settings->value ("customFileEditor").toString ());
   ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
+
+  QVariant default_var = QColor (240, 240, 240);
+  QColor setting_color = settings->value ("editor/highlight_current_line_color",
+                                          default_var).value<QColor> ();
+  _editor_current_line_color = new color_picker (setting_color);
+  ui->editor_grid_current_line->addWidget (_editor_current_line_color,0,3);
+  _editor_current_line_color->setMinimumSize (50,10);
+  _editor_current_line_color->setEnabled (false);
+  connect (ui->editor_highlightCurrentLine, SIGNAL (toggled (bool)),
+           _editor_current_line_color, SLOT (setEnabled (bool)));
   ui->editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine",true).toBool () );
+
   ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
   ui->editor_spinbox_ac_threshold->setValue (settings->value ("editor/codeCompletion_threshold",2).toInt ());
   ui->editor_checkbox_ac_keywords->setChecked (settings->value ("editor/codeCompletion_keywords",true).toBool ());
@@ -377,6 +387,7 @@
   settings->setValue ("customFileEditor", ui->customFileEditor->text ());
   settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
   settings->setValue ("editor/highlightCurrentLine", ui->editor_highlightCurrentLine->isChecked ());
+  settings->setValue ("editor/highlight_current_line_color",_editor_current_line_color->color ());
   settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
   settings->setValue ("editor/codeCompletion_threshold", ui->editor_spinbox_ac_threshold->value ());
   settings->setValue ("editor/codeCompletion_keywords", ui->editor_checkbox_ac_keywords->isChecked ());
--- a/libgui/src/settings-dialog.h	Sat May 18 23:00:19 2013 -0400
+++ b/libgui/src/settings-dialog.h	Tue May 21 20:08:22 2013 +0200
@@ -26,6 +26,8 @@
 #include <QDialog>
 #include <QSettings>
 
+#include "color-picker.h"
+
 #ifdef HAVE_QSCINTILLA
 class QsciLexer;
 #endif
@@ -57,6 +59,8 @@
 
   void read_terminal_colors (QSettings *settings);
   void write_terminal_colors (QSettings *settings);
+  
+  color_picker *_editor_current_line_color;
 };
 
 #endif // SETTINGSDIALOG_H
--- a/libgui/src/settings-dialog.ui	Sat May 18 23:00:19 2013 -0400
+++ b/libgui/src/settings-dialog.ui	Tue May 21 20:08:22 2013 +0200
@@ -208,14 +208,70 @@
           </widget>
          </item>
          <item>
-          <widget class="QCheckBox" name="editor_highlightCurrentLine">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="text">
-            <string>Highlight current line</string>
-           </property>
-          </widget>
+          <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">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Highlight current line</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <spacer name="horizontalSpacer_10">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeType">
+              <enum>QSizePolicy::Fixed</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>20</width>
+               <height>0</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item row="0" column="4">
+            <spacer name="horizontalSpacer_9">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item row="0" column="2">
+            <widget class="QLabel" name="editor_label_cl_color">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>Color</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="3">
+            <spacer name="horizontalSpacer_11">
+             <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>
           <widget class="QCheckBox" name="editor_longWindowTitle">
@@ -376,6 +432,9 @@
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Expanding</enum>
+         </property>
          <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
@@ -1120,5 +1179,21 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>editor_highlightCurrentLine</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_label_cl_color</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>184</x>
+     <y>86</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>515</x>
+     <y>86</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>