# HG changeset patch # User Torsten # Date 1369159702 -7200 # Node ID e9d0b8252a0a031322e1f8b2387b779f90df6bcb # Parent c19cc8c158b3c95174841020f05389db52beec8b 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 diff -r c19cc8c158b3 -r e9d0b8252a0a libgui/src/m-editor/file-editor-tab.cc --- 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 (); + _edit_area->setCaretLineBackgroundColor (setting_color); _edit_area->setCaretLineVisible (settings->value ("editor/highlightCurrentLine", true).toBool ()); diff -r c19cc8c158b3 -r e9d0b8252a0a libgui/src/settings-dialog.cc --- 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 #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 (); + _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 ()); diff -r c19cc8c158b3 -r e9d0b8252a0a libgui/src/settings-dialog.h --- 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 #include +#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 diff -r c19cc8c158b3 -r e9d0b8252a0a libgui/src/settings-dialog.ui --- 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 @@ - - - true - - - Highlight current line - - + + + + + true + + + Highlight current line + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + Color + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -376,6 +432,9 @@ Qt::Vertical + + QSizePolicy::Expanding + 20 @@ -1120,5 +1179,21 @@ + + editor_highlightCurrentLine + toggled(bool) + editor_label_cl_color + setEnabled(bool) + + + 184 + 86 + + + 515 + 86 + + +