annotate libgui/src/settings-dialog.h @ 29498:5384bb4efc51

rearrange default lexer settings and add second color mode to gui editor * default-qt-settings.in: remove all lexer related default settings * gui-preferences-ed.h: add constants related to the number of lexer styles, remove obsolete preference ed_highlight_current_line_color * gui-settings.cc (get_color_value): move detecting the color from the QVaraiant drom color_value into this separate function (required for reading the default lexer settings); (color_value); see get_color_value; (set_color_value): shorter access to QStringList elements * gui-settings.h: new method get_color_value, new constant for the magenta color indicating same color as the default value in the editor styles * file-editor-tab.cc (file_edito_tab): read lexer settings depending on the current color mode, determine color of current line depending on background color (no more user pref) * octave-qscintilla.cc (set_selection_marker_color): increase alpha value for highlighted occurrences of double clicked word * resource-manager.cc (get_valid_lexer_styles): moved this method from settings_dialog (static) to normal method here; (copy_font_attributes): private method for copying attributes from one font to another font (read_lexer_settings): take color mode into consideration, if lexer settings not found in settings file, take defaults from the lexer, not from octaves default settings file, and write them to the settings file related to the selected color mode * resource-manager.h: new methods get_valid_lexer_styles, copy_font_attributes and new arguments for read_lexer_settings * settings-dialog.cc (get_valid_lexer_styles) moved static method into non-static in resource_manager; (settings_dialog): remove settings for current editor line color; move lexer definition and reading related settings into separate new slot update_editor_lexers, add color mode checkbox and connect state change to update_editor_lexers; (update_editor_lexers): definition of lexers for each language and call update_lexer for the specific actions; (update_lexer): call rmgr.read_lexer_settings, i.e., read settings or get default values from lexer check whether the language tabs in the settings dialog have to be created or updated (due to color mode change), call get_lexer_settings in the first and update the color picker in the second case; (get_lexer_settings, renamed from read_lexer_settings): create the language tab and fill in the lexer values (write_lexer_settings): new argument color mode, write settings into the related section into the settings file; (write_changed_settings): write the editor color mode into the settings, remove editor current line color * settings-dialog.h: new methods update_editor_lexers, update_lexer, renamed read_lexer_settings into get_lexer_settings, new arguments for write_lexer_settings, removed class variable for editor current line color * settings-dialog.ui: added checkbox for editor color mode, removed color picker for editor current line color
author Torsten Lilge <ttl-octave@mailbox.org>
date Tue, 06 Apr 2021 21:26:52 +0200
parents 2a251de6c1a5
children 730cac3d6d5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27935
diff changeset
3 // Copyright (C) 2011-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
25
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
26 #if ! defined (octave_settings_dialog_h)
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
27 #define octave_settings_dialog_h 1
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
28
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
29 #include <QCheckBox>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30 #include <QDialog>
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
31 #include <QLineEdit>
24475
8cb985e362f3 Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents: 24011
diff changeset
32 #include <QRadioButton>
16646
025bc6b5080e use QScintilla's lexer for highlighting Octave programs
John W. Eaton <jwe@octave.org>
parents: 16636
diff changeset
33
16693
e9d0b8252a0a make color of current line marker in the editor configurable
Torsten <ttl@justmail.de>
parents: 16646
diff changeset
34 #include "color-picker.h"
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents: 27412
diff changeset
35 #include "gui-preferences-ed.h"
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
36 #include "gui-settings.h"
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25617
diff changeset
37 #include "ui-settings-dialog.h"
16693
e9d0b8252a0a make color of current line marker in the editor configurable
Torsten <ttl@justmail.de>
parents: 16646
diff changeset
38
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25617
diff changeset
39 class QsciLexer;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
41 namespace octave
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
42 {
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
43 class base_qobject;
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
44
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
45 // Ui::settings_dialog is a generated class.
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
46
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
47 class settings_dialog : public QDialog, private Ui::settings_dialog
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
48 {
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
49 Q_OBJECT public:
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25617
diff changeset
50
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
51 explicit settings_dialog (QWidget *parent, base_qobject& octave_qobj,
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
52 const QString& desired_tab = QString ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
53
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
54 ~settings_dialog (void) = default;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
56 void show_tab (const QString&);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
57
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
58 signals:
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
59
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
60 void apply_new_settings (void);
19631
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19423
diff changeset
61
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
62 private slots:
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
63
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
64 void get_octave_dir (void);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
65 void get_file_browser_dir (void);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
66 void get_dir (QLineEdit*, const QString&);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
67 void set_disabled_pref_file_browser_dir (bool disable);
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
68 void proxy_items_update (void);
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18180
diff changeset
69
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
70 // slots updating colors depending on theme
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
71 void update_terminal_colors (int mode);
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
72 void update_workspace_colors (int mode);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
73 void update_varedit_colors (int mode);
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
74 void update_editor_lexers (int mode);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
75
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
76 // slots for dialog's buttons
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
77 void button_clicked (QAbstractButton *button);
19631
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19423
diff changeset
78
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
79 // slots for import/export-buttons of shortcut sets
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
80 void import_shortcut_set (void);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
81 void export_shortcut_set (void);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
82 void default_shortcut_set (void);
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18310
diff changeset
83
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
84 private:
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23927
diff changeset
85
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
86 #if defined (HAVE_QSCINTILLA)
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
87 void update_lexer (QsciLexer *lexer, gui_settings *settings, int mode);
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
88 void get_lexer_settings (QsciLexer *lexer, gui_settings *settings);
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
89 void write_lexer_settings (QsciLexer *lexer, gui_settings *settings, int mode);
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
90 #endif
16610
a1f613e5066d workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents: 16500
diff changeset
91
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
92 void write_changed_settings (bool closing);
19632
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
93
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
94 void read_workspace_colors (gui_settings *settings);
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
95 void write_workspace_colors (gui_settings *settings);
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
96
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
97 void read_terminal_colors (gui_settings *settings);
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
98 void write_terminal_colors (gui_settings *settings);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
99
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
100 void read_varedit_colors (gui_settings *settings);
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
101 void write_varedit_colors (gui_settings *settings);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23432
diff changeset
102
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
103 base_qobject& m_octave_qobj;
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
104
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
105 color_picker *m_widget_title_bg_color;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
106 color_picker *m_widget_title_bg_color_active;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
107 color_picker *m_widget_title_fg_color;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
108 color_picker *m_widget_title_fg_color_active;
24475
8cb985e362f3 Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents: 24011
diff changeset
109
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
110 QRadioButton *m_rb_comment_strings[ed_comment_strings_count];
26530
dc02f20df07d Use check boxes for "uncommenting text" strings in editor properties (bug #55404).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26376
diff changeset
111 QCheckBox *m_rb_uncomment_strings[ed_comment_strings_count];
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
112
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
113 QCheckBox *m_ws_enable_colors;
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
114 QCheckBox *m_ws_hide_tool_tips;
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
115 };
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
116 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
117
20945
9d9270e2f98f eliminate comments after preprocessor conditionals
John W. Eaton <jwe@octave.org>
parents: 20774
diff changeset
118 #endif