annotate libgui/src/gui-preferences-ed.h @ 27849:28d7ec92bae6

replace prefs literals by symbolic constant in main window * gui-preferences-cs.h: new symbolic constants for pref keys and defaults * gui-preferences-ed.h: new symbolic constants for pref keys and defaults * gui-preferences-mw.h: new symbolic constants for pref keys and defaults * file-editor.cc (request_open_file): replace literals by const. symbols * main-window.cc ((notice_settings, read_settings, handle_octave_ready, restore_create_file_setting, focus_console_after_command): replace literals by const. symbols * qt-interpreter-events.cc (prompt_new_edit_file): replace literals by const. symbols * settings-dialog.cc (settings_dialog, write_changed_settings): replace literals by const. symbols
author Torsten Lilge <ttl-octave@mailbox.org>
date Mon, 16 Dec 2019 08:00:43 +0100
parents 5169ed0ff0f0
children 3fada47cc58a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 Copyright (C) 2017-2019 Torsten <mttl@mailbox.de>
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 (at your option) any later version.
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 GNU General Public License for more details.
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 <https://www.gnu.org/licenses/>.
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 #if ! defined (octave_gui_preferences_ed_h)
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 #define octave_gui_preferences_ed_h 1
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #include "gui-preferences.h"
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 // Editor preferences
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 // Octave comment strings
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 ed_comment_str_old ("editor/octave_comment_string", QVariant (0));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 ed_comment_str ("editor/oct_comment_str", QVariant (0));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 const QString
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 ed_last_comment_str ("editor/oct_last_comment_str");
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 const QStringList
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 ed_comment_strings (QStringList () << "##" << "#" << "%"<< "%%" << "%!");
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 const int ed_comment_strings_count = 5;
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 // Session data
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 ed_session_names ("editor/savedSessionTabs", QVariant (QStringList ()));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 ed_session_enc ("editor/saved_session_encodings", QVariant (QStringList ()));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 ed_session_ind ("editor/saved_session_tab_index", QVariant (QStringList ()));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 ed_session_lines ("editor/saved_session_lines", QVariant (QStringList ()));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 // Tabs
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 const QStringList
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 ed_tab_position_names (QStringList ()
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 << QT_TRANSLATE_NOOP ("file_editor::file_editor", "Top")
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 << QT_TRANSLATE_NOOP ("file_editor::file_editor", "Bottom")
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 << QT_TRANSLATE_NOOP ("file_editor::file_editor", "Left")
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 << QT_TRANSLATE_NOOP ("file_editor::file_editor", "Right"));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 ed_tab_position ("editor/tab_position", QVariant (QTabWidget::North));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 // File handling
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 ed_show_dbg_file ("editor/show_dbg_file", QVariant (true));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 const gui_pref
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 ed_default_enc ("editor/default_encoding",
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 QVariant (QTextCodec::codecForLocale ()->name ().toUpper ().prepend ("SYSTEM (").append (")")));
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
27849
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27787
diff changeset
83 const gui_pref
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27787
diff changeset
84 ed_create_new_file ("editor/create_new_file", QVariant (false));
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27787
diff changeset
85
27787
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
86 // The find dialog
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
87
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
88 enum find_dialog_options
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
89 {
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
90 FIND_DLG_MORE = 1,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
91 FIND_DLG_CASE = 2,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
92 FIND_DLG_START = 4,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
93 FIND_DLG_WRAP = 8,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
94 FIND_DLG_REGX = 16,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
95 FIND_DLG_WORDS = 32,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
96 FIND_DLG_BACK = 64,
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
97 FIND_DLG_SEL = 128
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
98 };
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
99
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
100 // Dialog position, the default will be calculated from the editor's geometry
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
101 const gui_pref
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
102 ed_fdlg_pos ("editor/fdgl_pos", QVariant (QPoint (0,0)));
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
103
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
104 const gui_pref
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
105 ed_fdlg_opts ("editor/fdgl_opts", QVariant (FIND_DLG_WRAP));
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
106
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
107 const gui_pref
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
108 ed_fdlg_search ("editor/fdgl_search", QVariant ());
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
109 const gui_pref
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
110 ed_fdlg_replace ("editor/fdgl_replace", QVariant ());
5169ed0ff0f0 only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27560
diff changeset
111
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 #endif