Mercurial > jwe > octave
changeset 25622:a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
* gui-preferences.h: new const struct for this preference
* file-editor.cc: include gui-preferences.h;
(request_open_file): give editor tab of related file the focus only if it
is desired to open editor files, do not open a closed file when inserting
a breakpoint or update the debug pointer, never open a closed file when
removing a breakpoint;
* settings-dialog.cc (settings_dialog): initialize the new checkbox from the
preferences file;
(write_changed_settings): store checkbox state into the preferences file;
* settings-dialog.ui: add new debugging section in editor tab with checkbox
for opening files when debugging from console window
author | Torsten <mttl@mailbox.org> |
---|---|
date | Sun, 15 Jul 2018 11:56:04 +0200 |
parents | 0fa7312e34bc |
children | 331f46b9ee6c |
files | libgui/src/gui-preferences.h libgui/src/m-editor/file-editor.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.ui |
diffstat | 4 files changed, 51 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/gui-preferences.h Sat Jul 14 22:48:02 2018 -0700 +++ b/libgui/src/gui-preferences.h Sun Jul 15 11:56:04 2018 +0200 @@ -42,7 +42,7 @@ // Editor preferences // Octave comment strings -const gui_pref ed_comment_str_old = gui_pref ("editor/octave_comment_string", QVariant (0)); +const gui_pref ed_comment_str_old ("editor/octave_comment_string", QVariant (0)); const gui_pref ed_comment_str ("editor/oct_comment_str", QVariant (0)); const gui_pref ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8)); @@ -51,6 +51,7 @@ const int ed_comment_strings_count = 5; // File handling +const gui_pref ed_show_dbg_file ("editor/show_dbg_file", QVariant (true)); #endif
--- a/libgui/src/m-editor/file-editor.cc Sat Jul 14 22:48:02 2018 -0700 +++ b/libgui/src/m-editor/file-editor.cc Sun Jul 15 11:56:04 2018 +0200 @@ -45,6 +45,7 @@ #include <Qsci/qscicommandset.h> #include "main-window.h" +#include "gui-preferences.h" #include "oct-map.h" #include "octave-link.h" #include "utils.h" @@ -1190,6 +1191,10 @@ if (call_custom_editor (openFileName, line)) return; // custom editor called + QSettings *settings = resource_manager::get_settings (); + bool show_dbg_file + = settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool (); + if (openFileName.isEmpty ()) { // This happens if edit is calles without an argument @@ -1217,7 +1222,7 @@ emit fetab_do_breakpoint_marker (insert, tab, line, cond); } - if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) + if (show_dbg_file && ! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) { emit fetab_set_focus (tab); focus (); @@ -1225,6 +1230,12 @@ } else { + if (! show_dbg_file && (breakpoint_marker || debug_pointer)) + return; // Do not open a file for showing dbg markers + + if (breakpoint_marker && ! insert) + return; // Never open a file when removing breakpoints + file_editor_tab *fileEditorTab = nullptr; // Reuse <unnamed> tab if it hasn't yet been modified. bool reusing = false;
--- a/libgui/src/settings-dialog.cc Sat Jul 14 22:48:02 2018 -0700 +++ b/libgui/src/settings-dialog.cc Sun Jul 15 11:56:04 2018 +0200 @@ -508,6 +508,7 @@ ui->editor_create_new_file->setChecked (settings->value ("editor/create_new_file", false).toBool ()); ui->editor_reload_changed_files->setChecked (settings->value ("editor/always_reload_changed_files", false).toBool ()); ui->editor_hiding_closes_files->setChecked (settings->value ("editor/hiding_closes_files", false).toBool ()); + ui->editor_show_dbg_file->setChecked (settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool ()); // terminal ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName", "Courier New").toString ())); @@ -883,6 +884,8 @@ settings->setValue ("editor/create_new_file", ui->editor_create_new_file->isChecked ()); settings->setValue ("editor/hiding_closes_files", ui->editor_hiding_closes_files->isChecked ()); settings->setValue ("editor/always_reload_changed_files", ui->editor_reload_changed_files->isChecked ()); + settings->setValue (ed_show_dbg_file.key, ui->editor_show_dbg_file->isChecked ()); + settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value ()); settings->setValue ("terminal/fontName", ui->terminal_fontName->currentFont ().family ());
--- a/libgui/src/settings-dialog.ui Sat Jul 14 22:48:02 2018 -0700 +++ b/libgui/src/settings-dialog.ui Sun Jul 15 11:56:04 2018 +0200 @@ -789,9 +789,9 @@ <property name="geometry"> <rect> <x>0</x> - <y>-558</y> + <y>-585</y> <width>645</width> - <height>1131</height> + <height>1196</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_16"> @@ -1865,6 +1865,32 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_10"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>Debugging</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_12"> + <item> + <layout class="QGridLayout" name="gridLayout_19"> + <item row="0" column="0"> + <widget class="QCheckBox" name="editor_show_dbg_file"> + <property name="text"> + <string>Always show debug breakpoints and pointers (opens related file if closed)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="groupBox_8"> <property name="title"> <string>File handling</string> @@ -1916,7 +1942,7 @@ </property> </widget> </item> - <item row="6" column="0"> + <item row="8" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="topMargin"> <number>0</number> @@ -1974,7 +2000,7 @@ </item> </layout> </item> - <item row="8" column="0"> + <item row="10" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_16"> <item> <widget class="QLabel" name="label_16"> @@ -2001,11 +2027,14 @@ </item> </layout> </item> - <item row="5" column="0"> + <item row="7" column="0"> <widget class="QCheckBox" name="editor_hiding_closes_files"> <property name="text"> <string>Close all files when the editor widget is closed/hidden</string> </property> + <property name="checked"> + <bool>true</bool> + </property> </widget> </item> </layout>