GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gui-preferences-ed.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2017-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_gui_preferences_ed_h)
27 #define octave_gui_preferences_ed_h 1
28 
29 #if defined (HAVE_QSCINTILLA)
30 #include <Qsci/qsciscintilla.h>
31 #endif
32 
33 #include "gui-settings.h"
34 #include "localcharset-wrapper.h"
35 
36 // Editor preferences
37 
38 // Lexer
39 
40 const gui_pref
41 ed_color_mode ("editor/color_mode", QVariant (0));
42 
43 const int ed_max_lexer_styles = 64;
44 const int ed_max_style_number = 128;
45 
46 // Code completion
47 
48 const gui_pref
49 ed_code_completion_octave_builtins ("editor/codeCompletion_octave_builtins",
50  QVariant (true));
51 
52 const gui_pref
53 ed_code_completion_octave_functions ("editor/codeCompletion_octave_functions",
54  QVariant (true));
55 
56 const gui_pref
57 ed_code_completion_keywords ("editor/codeCompletion_keywords", QVariant (true));
58 
59 const gui_pref
60 ed_code_completion_document ("editor/codeCompletion_document", QVariant (true));
61 
62 const gui_pref
63 ed_code_completion_replace ("editor/codeCompletion_replace", QVariant (false));
64 
65 const gui_pref
66 ed_code_completion_case ("editor/codeCompletion_case", QVariant (true));
67 
68 const gui_pref
69 ed_code_completion ("editor/codeCompletion", QVariant (true));
70 
71 const gui_pref
72 ed_code_completion_threshold ("editor/codeCompletion_threshold", QVariant (3));
73 
74 // Code formatting
75 
76 const gui_pref
77 ed_code_folding ("editor/code_folding", QVariant (true));
78 
79 const gui_pref
80 ed_auto_indent ("editor/auto_indent", QVariant (true));
81 
82 const gui_pref
83 ed_tab_indents_line ("editor/tab_indents_line", QVariant (false));
84 
85 const gui_pref
86 ed_backspace_unindents_line ("editor/backspace_unindents_line",
87  QVariant (false));
88 
89 const gui_pref
90 ed_show_indent_guides ("editor/show_indent_guides", QVariant (false));
91 
92 const gui_pref
93 ed_indent_uses_tabs ("editor/indent_uses_tabs", QVariant (false));
94 
95 const gui_pref
96 ed_indent_width ("editor/indent_width", QVariant (2));
97 
98 const gui_pref
99 ed_tab_width ("editor/tab_width", QVariant (2));
100 
101 const gui_pref
102 ed_auto_endif ("editor/auto_endif", QVariant (1));
103 
104 // Long line handling
105 
106 const gui_pref
107 ed_long_line_column ("editor/long_line_column", QVariant (80));
108 
109 const gui_pref
110 ed_long_line_marker ("editor/long_line_marker", QVariant (true));
111 
112 const gui_pref
113 ed_long_line_marker_line ("editor/long_line_marker_line", QVariant (true));
114 
115 const gui_pref
116 ed_long_line_marker_background ("editor/long_line_marker_background",
117  QVariant (false));
118 
119 const gui_pref
120 ed_wrap_lines ("editor/wrap_lines", QVariant (false));
121 
122 const gui_pref
123 ed_break_lines ("editor/break_lines", QVariant (false));
124 
125 const gui_pref
126 ed_break_lines_comments ("editor/break_lines_comments", QVariant (false));
127 
128 // Other
129 
130 const gui_pref
131 ed_highlight_all_occurrences ("editor/highlight_all_occurrences",
132  QVariant (true));
133 
134 const gui_pref
135 ed_show_Line_numbers ("editor/showLineNumbers", QVariant (true));
136 
137 const gui_pref
138 ed_line_numbers_size ("editor/line_numbers_size", QVariant ( 0));
139 
140 const gui_pref
141 ed_show_edit_status_bar ("editor/show_edit_status_bar", QVariant (true));
142 
143 const gui_pref
144 ed_highlight_current_line ("editor/highlightCurrentLine", QVariant (true));
145 
146 const gui_pref
147 ed_highlight_current_line_color ("editor/highlightCurrentLineColor",
148  QVariant (settings_color_no_change));
149 
150 const gui_pref
151 ed_show_white_space ("editor/show_white_space", QVariant (false));
152 
153 const gui_pref
154 ed_show_white_space_indent ("editor/show_white_space_indent", QVariant (false));
155 
156 const gui_pref
157 ed_show_line_numbers ("editor/showLineNumbers", QVariant (true));
158 
159 const gui_pref
160 ed_show_eol_chars ("editor/show_eol_chars", QVariant (false));
161 
162 const gui_pref
163 ed_show_toolbar ("editor/show_toolbar", QVariant (true));
164 
165 const gui_pref
166 ed_show_hscroll_bar ("editor/show_hscroll_bar", QVariant (true));
167 
168 // Octave comment strings
169 
170 const gui_pref
171 ed_comment_str_old ("editor/octave_comment_string", QVariant (0));
172 
173 const gui_pref
174 ed_comment_str ("editor/oct_comment_str", QVariant (0));
175 
176 const gui_pref
177 ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8));
178 
179 const QString
180 ed_last_comment_str ("editor/oct_last_comment_str");
181 
182 const QStringList
184  "##",
185  "#",
186  "%",
187  "%%",
188  "%!"
189 };
190 
192 
193 // Session data
194 
195 const gui_pref
196 ed_restore_session ("editor/restoreSession", QVariant (true));
197 
198 const gui_pref
199 ed_session_names ("editor/savedSessionTabs", QVariant (QStringList ()));
200 
201 const gui_pref
202 ed_session_enc ("editor/saved_session_encodings", QVariant (QStringList ()));
203 
204 const gui_pref
205 ed_session_ind ("editor/saved_session_tab_index", QVariant (QStringList ()));
206 
207 const gui_pref
208 ed_session_lines ("editor/saved_session_lines", QVariant (QStringList ()));
209 
210 const gui_pref
211 ed_session_bookmarks ("editor/saved_session_bookmarks", QVariant (QStringList ()));
212 
213 // Tabs
214 const QStringList
216  QT_TRANSLATE_NOOP ("octave::settings_dialog", "Top"),
217  QT_TRANSLATE_NOOP ("octave::settings_dialog", "Bottom"),
218  QT_TRANSLATE_NOOP ("octave::settings_dialog", "Left"),
219  QT_TRANSLATE_NOOP ("octave::settings_dialog", "Right")
220 };
221 
222 const gui_pref
223 ed_tab_position ("editor/tab_position", QVariant (QTabWidget::North));
224 
225 const gui_pref
226 ed_tabs_rotated ("editor/tabs_rotated", QVariant (false));
227 
228 const gui_pref
229 ed_tabs_max_width ("editor/tabs_max_width", QVariant (0));
230 
231 // File handling
232 
233 const gui_pref
234 ed_force_newline ("editor/force_newline", QVariant (true));
235 
236 const gui_pref
237 ed_rm_trailing_spaces ("editor/rm_trailing_spaces", QVariant (true));
238 
239 #if defined (HAVE_QSCINTILLA)
240 #if defined (Q_OS_WIN32)
241 const int os_eol_mode = QsciScintilla::EolWindows;
242 #else
243 const int os_eol_mode = QsciScintilla::EolUnix;
244 #endif
245 #else
246 const int os_eol_mode = 2;
247 #endif
248 
249 const gui_pref
250 ed_default_eol_mode ("editor/default_eol_mode", QVariant (os_eol_mode));
251 
252 const gui_pref
253 ed_show_dbg_file ("editor/show_dbg_file", QVariant (true));
254 
255 const gui_pref
256 ed_default_enc ("editor/default_encoding", QVariant ("UTF-8"));
257 
258 const gui_pref
259 ed_create_new_file ("editor/create_new_file", QVariant (false));
260 
261 const gui_pref
262 ed_hiding_closes_files ("editor/hiding_closes_files", QVariant (false));
263 
264 const gui_pref
265 ed_always_reload_changed_files ("editor/always_reload_changed_files",
266  QVariant (false));
267 
268 const gui_pref
269 ed_mru_file_list ("editor/mru_file_list", QVariant ());
270 
271 const gui_pref
272 ed_mru_file_encodings ("editor/mru_file_encodings", QVariant ());
273 
274 // The find dialog
275 
277 {
285  FIND_DLG_SEL = 128
286 };
287 
288 // Dialog position, the default will be calculated from the editor's geometry
289 const gui_pref
290 ed_fdlg_pos ("editor/fdgl_pos", QVariant (QPoint (0, 0)));
291 
292 const gui_pref
293 ed_fdlg_opts ("editor/fdgl_opts", QVariant (FIND_DLG_WRAP));
294 
295 const gui_pref
296 ed_fdlg_search ("editor/fdgl_search", QVariant ());
297 const gui_pref
298 ed_fdlg_replace ("editor/fdgl_replace", QVariant ());
299 
300 #endif
const gui_pref ed_tabs_rotated("editor/tabs_rotated", QVariant(false))
const gui_pref ed_always_reload_changed_files("editor/always_reload_changed_files", QVariant(false))
const gui_pref ed_comment_str_old("editor/octave_comment_string", QVariant(0))
const gui_pref ed_indent_uses_tabs("editor/indent_uses_tabs", QVariant(false))
const gui_pref ed_code_completion("editor/codeCompletion", QVariant(true))
const gui_pref ed_show_hscroll_bar("editor/show_hscroll_bar", QVariant(true))
const gui_pref ed_code_completion_octave_functions("editor/codeCompletion_octave_functions", QVariant(true))
const gui_pref ed_auto_endif("editor/auto_endif", QVariant(1))
const gui_pref ed_show_toolbar("editor/show_toolbar", QVariant(true))
const gui_pref ed_uncomment_str("editor/oct_uncomment_str", QVariant(1+2+4+8))
const gui_pref ed_show_white_space("editor/show_white_space", QVariant(false))
const gui_pref ed_create_new_file("editor/create_new_file", QVariant(false))
const gui_pref ed_mru_file_encodings("editor/mru_file_encodings", QVariant())
const gui_pref ed_color_mode("editor/color_mode", QVariant(0))
const gui_pref ed_session_names("editor/savedSessionTabs", QVariant(QStringList()))
const gui_pref ed_line_numbers_size("editor/line_numbers_size", QVariant(0))
const gui_pref ed_wrap_lines("editor/wrap_lines", QVariant(false))
const gui_pref ed_highlight_current_line("editor/highlightCurrentLine", QVariant(true))
const gui_pref ed_fdlg_opts("editor/fdgl_opts", QVariant(FIND_DLG_WRAP))
const gui_pref ed_fdlg_pos("editor/fdgl_pos", QVariant(QPoint(0, 0)))
const gui_pref ed_tabs_max_width("editor/tabs_max_width", QVariant(0))
const gui_pref ed_break_lines("editor/break_lines", QVariant(false))
const gui_pref ed_break_lines_comments("editor/break_lines_comments", QVariant(false))
const QString ed_last_comment_str("editor/oct_last_comment_str")
const gui_pref ed_highlight_current_line_color("editor/highlightCurrentLineColor", QVariant(settings_color_no_change))
const gui_pref ed_long_line_marker("editor/long_line_marker", QVariant(true))
const gui_pref ed_tab_position("editor/tab_position", QVariant(QTabWidget::North))
const gui_pref ed_tab_indents_line("editor/tab_indents_line", QVariant(false))
const int ed_max_lexer_styles
const gui_pref ed_code_completion_octave_builtins("editor/codeCompletion_octave_builtins", QVariant(true))
const gui_pref ed_show_edit_status_bar("editor/show_edit_status_bar", QVariant(true))
const gui_pref ed_code_completion_threshold("editor/codeCompletion_threshold", QVariant(3))
const gui_pref ed_fdlg_search("editor/fdgl_search", QVariant())
const gui_pref ed_code_completion_document("editor/codeCompletion_document", QVariant(true))
const gui_pref ed_backspace_unindents_line("editor/backspace_unindents_line", QVariant(false))
const gui_pref ed_restore_session("editor/restoreSession", QVariant(true))
const gui_pref ed_code_completion_case("editor/codeCompletion_case", QVariant(true))
const int os_eol_mode
find_dialog_options
@ FIND_DLG_CASE
@ FIND_DLG_REGX
@ FIND_DLG_WRAP
@ FIND_DLG_WORDS
@ FIND_DLG_MORE
@ FIND_DLG_START
@ FIND_DLG_SEL
@ FIND_DLG_BACK
const gui_pref ed_rm_trailing_spaces("editor/rm_trailing_spaces", QVariant(true))
const gui_pref ed_default_enc("editor/default_encoding", QVariant("UTF-8"))
const gui_pref ed_long_line_marker_background("editor/long_line_marker_background", QVariant(false))
const gui_pref ed_mru_file_list("editor/mru_file_list", QVariant())
const int ed_max_style_number
const gui_pref ed_show_dbg_file("editor/show_dbg_file", QVariant(true))
const gui_pref ed_show_white_space_indent("editor/show_white_space_indent", QVariant(false))
const gui_pref ed_session_ind("editor/saved_session_tab_index", QVariant(QStringList()))
const gui_pref ed_show_line_numbers("editor/showLineNumbers", QVariant(true))
const gui_pref ed_highlight_all_occurrences("editor/highlight_all_occurrences", QVariant(true))
const gui_pref ed_show_eol_chars("editor/show_eol_chars", QVariant(false))
const gui_pref ed_session_lines("editor/saved_session_lines", QVariant(QStringList()))
const QStringList ed_tab_position_names
const gui_pref ed_show_indent_guides("editor/show_indent_guides", QVariant(false))
const gui_pref ed_code_folding("editor/code_folding", QVariant(true))
const gui_pref ed_force_newline("editor/force_newline", QVariant(true))
const QStringList ed_comment_strings
const gui_pref ed_indent_width("editor/indent_width", QVariant(2))
const gui_pref ed_fdlg_replace("editor/fdgl_replace", QVariant())
const gui_pref ed_tab_width("editor/tab_width", QVariant(2))
const gui_pref ed_comment_str("editor/oct_comment_str", QVariant(0))
const gui_pref ed_hiding_closes_files("editor/hiding_closes_files", QVariant(false))
const gui_pref ed_long_line_column("editor/long_line_column", QVariant(80))
const gui_pref ed_default_eol_mode("editor/default_eol_mode", QVariant(os_eol_mode))
const gui_pref ed_code_completion_replace("editor/codeCompletion_replace", QVariant(false))
const gui_pref ed_session_bookmarks("editor/saved_session_bookmarks", QVariant(QStringList()))
const gui_pref ed_show_Line_numbers("editor/showLineNumbers", QVariant(true))
const int ed_comment_strings_count
const gui_pref ed_code_completion_keywords("editor/codeCompletion_keywords", QVariant(true))
const gui_pref ed_auto_indent("editor/auto_indent", QVariant(true))
const gui_pref ed_session_enc("editor/saved_session_encodings", QVariant(QStringList()))
const gui_pref ed_long_line_marker_line("editor/long_line_marker_line", QVariant(true))
const QColor settings_color_no_change(255, 0, 255)