Mercurial > octave
annotate libgui/src/octave-qt-link.cc @ 25557:bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
* octave-qt-link.cc (do_enter_debugger_event): test for function type; if it
is command-line then return without action
author | Torsten <mttl@mailbox.org> |
---|---|
date | Sat, 07 Jul 2018 13:45:16 +0200 |
parents | ab10403a0b50 |
children | bd362df6277c |
rev | line source |
---|---|
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24766
diff
changeset
|
3 Copyright (C) 2013-2018 John W. Eaton |
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24766
diff
changeset
|
4 Copyright (C) 2011-2018 Jacob Dawid |
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24766
diff
changeset
|
5 Copyright (C) 2011-2018 John P. Swensen |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 This file is part of Octave. |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24301
diff
changeset
|
9 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
10 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24301
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
12 (at your option) any later version. |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
15 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22417
diff
changeset
|
17 GNU General Public License for more details. |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24301
diff
changeset
|
21 <https://www.gnu.org/licenses/>. |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 */ |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21717
diff
changeset
|
25 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
26 # include "config.h" |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #endif |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
29 #include <QDialog> |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
30 #include <QDir> |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24632
diff
changeset
|
31 #include <QMetaType> |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
32 #include <QPushButton> |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24632
diff
changeset
|
33 #include <QStringList> |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
34 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
35 #include "oct-env.h" |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
36 #include "str-vec.h" |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
37 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
38 #include "builtin-defun-decls.h" |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
39 #include "dialog.h" |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
40 #include "error.h" |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
41 #include "interpreter-private.h" |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
42 #include "load-path.h" |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24632
diff
changeset
|
43 #include "ov.h" |
25557
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
44 #include "octave.h" |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
45 #include "oct-map.h" |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24641
diff
changeset
|
46 #include "symscope.h" |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
47 #include "utils.h" |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
48 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
49 #include "octave-gui.h" |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 #include "octave-qt-link.h" |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
51 #include "resource-manager.h" |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24641
diff
changeset
|
52 |
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24641
diff
changeset
|
53 Q_DECLARE_METATYPE (octave_value) |
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24641
diff
changeset
|
54 Q_DECLARE_METATYPE (octave::symbol_scope) |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
55 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
56 namespace octave |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24632
diff
changeset
|
57 { |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
58 octave_qt_link::octave_qt_link (QWidget *, gui_application *app_context) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
59 : octave_link (), m_app_context (app_context) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
60 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
61 qRegisterMetaType<octave_value> ("octave_value"); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
62 qRegisterMetaType<symbol_scope> ("symbol_scope"); |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
63 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
65 bool octave_qt_link::do_confirm_shutdown (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
66 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
67 // Lock the mutex before emitting signal. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
68 lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
69 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
70 emit confirm_shutdown_signal (); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
71 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
72 // Wait while the GUI shuts down. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
73 wait (); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
74 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
75 // The GUI has sent a signal and the thread has been awakened. |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
76 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
77 unlock (); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
78 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
79 return m_shutdown_confirm_result; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
80 } |
16485
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
81 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
82 bool octave_qt_link::do_copy_image_to_clipboard (const std::string& file) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
83 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
84 emit copy_image_to_clipboard_signal (QString::fromStdString (file), true); |
20113
c36f2b083613
make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents:
20091
diff
changeset
|
85 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
86 return true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
87 } |
20113
c36f2b083613
make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents:
20091
diff
changeset
|
88 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
89 bool octave_qt_link::do_edit_file (const std::string& file) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
90 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
91 emit edit_file_signal (QString::fromStdString (file)); |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
92 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
93 return true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
94 } |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
95 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
96 bool octave_qt_link::do_prompt_new_edit_file (const std::string& file) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
97 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
98 QSettings *settings = resource_manager::get_settings (); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
99 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
100 if (! settings || settings->value ("editor/create_new_file",false).toBool ()) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
101 return true; |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
102 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
103 QFileInfo file_info (QString::fromStdString (file)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
104 QStringList btn; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
105 QStringList role; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
106 role << "YesRole" << "RejectRole"; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
107 btn << tr ("Create") << tr ("Cancel"); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
108 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
109 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
110 uiwidget_creator.lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
111 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
112 uiwidget_creator.signal_dialog ( |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
113 tr ("File\n%1\ndoes not exist. Do you want to create it?"). |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
114 arg (QDir::currentPath () + QDir::separator () |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
115 + QString::fromStdString (file)), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
116 tr ("Octave Editor"), "quest", btn, tr ("Create"), role); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
117 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
118 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
119 uiwidget_creator.wait (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
120 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
121 // The GUI has sent a signal and the thread has been awakened. |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
122 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
123 QString answer = uiwidget_creator.get_dialog_button (); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
124 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
125 uiwidget_creator.unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
126 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
127 return (answer == tr ("Create")); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
128 } |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17824
diff
changeset
|
129 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
130 int octave_qt_link::do_message_dialog (const std::string& dlg, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
131 const std::string& msg, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
132 const std::string& title) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
133 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
134 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
135 uiwidget_creator.lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
136 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
137 uiwidget_creator.signal_dialog (QString::fromStdString (msg), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
138 QString::fromStdString (title), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
139 QString::fromStdString (dlg), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
140 QStringList (), QString (), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
141 QStringList ()); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
142 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
143 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
144 uiwidget_creator.wait (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
145 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
146 // The GUI has sent a signal and the thread has been awakened. |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
147 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
148 int answer = uiwidget_creator.get_dialog_result (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
149 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
150 uiwidget_creator.unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
151 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
152 return answer; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
153 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
154 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
155 std::string octave_qt_link::do_question_dialog (const std::string& msg, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
156 const std::string& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
157 const std::string& btn1, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
158 const std::string& btn2, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
159 const std::string& btn3, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
160 const std::string& btndef) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
161 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
162 QStringList btn; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
163 QStringList role; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
164 // Must use ResetRole which is left-aligned for all OS and WM. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
165 role << "ResetRole" << "ResetRole" << "ResetRole"; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
166 btn << QString::fromStdString (btn1); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
167 if (btn2 == "") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
168 role.removeAt (0); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
169 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
170 btn << QString::fromStdString (btn2); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
171 btn << QString::fromStdString (btn3); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
172 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
173 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
174 uiwidget_creator.lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
175 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
176 uiwidget_creator.signal_dialog (QString::fromStdString (msg), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
177 QString::fromStdString (title), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
178 "quest", |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
179 btn, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
180 QString::fromStdString (btndef), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
181 role); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
182 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
183 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
184 uiwidget_creator.wait (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
185 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
186 // The GUI has sent a signal and the thread has been awakened. |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
187 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
188 std::string answer = uiwidget_creator.get_dialog_button ().toStdString (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
189 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
190 uiwidget_creator.unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
191 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
192 return answer; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
193 } |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
194 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
195 static QStringList |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
196 make_qstring_list (const std::list<std::string>& lst) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
197 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
198 QStringList retval; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
199 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
200 for (auto it = lst.begin (); it != lst.end (); it++) |
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
201 retval.append (QString::fromStdString (*it)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
202 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
203 return retval; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
204 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
205 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
206 static QStringList |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
207 make_filter_list (const octave_link::filter_list& lst) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
208 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
209 QStringList retval; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
210 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
211 // We have pairs of data, first being the list of extensions |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
212 // exta;exb;extc etc second the name to use as filter name |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
213 // (optional). Qt wants a list of filters in the format of |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
214 // 'FilterName (space separated exts)'. |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
215 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
216 for (auto it = lst.begin (); it != lst.end (); it++) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
217 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
218 QString ext = QString::fromStdString (it->first); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
219 QString name = QString::fromStdString (it->second); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
220 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
221 // Strip out extensions from name and replace ';' with spaces in |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
222 // list. |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
223 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
224 name.replace (QRegExp ("\\(.*\\)"), ""); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
225 ext.replace (";", " "); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
226 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
227 if (name.isEmpty ()) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
228 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
229 // No name field. Build one from the extensions. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
230 name = ext.toUpper () + " Files"; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
231 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
232 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
233 retval.append (name + " (" + ext + ')'); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
234 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
235 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
236 return retval; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
237 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
238 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
239 std::pair<std::list<int>, int> |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
240 octave_qt_link::do_list_dialog (const std::list<std::string>& list, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
241 const std::string& mode, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
242 int width, int height, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
243 const std::list<int>& initial, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
244 const std::string& name, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
245 const std::list<std::string>& prompt, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
246 const std::string& ok_string, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
247 const std::string& cancel_string) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
248 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
249 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
250 uiwidget_creator.lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
251 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
252 uiwidget_creator.signal_listview (make_qstring_list (list), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
253 QString::fromStdString (mode), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
254 width, height, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
255 QList<int>::fromStdList (initial), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
256 QString::fromStdString (name), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
257 make_qstring_list (prompt), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
258 QString::fromStdString (ok_string), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
259 QString::fromStdString (cancel_string)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
260 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
261 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
262 uiwidget_creator.wait (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
263 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
264 // The GUI has sent a signal and the thread has been awakened. |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
265 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
266 const QIntList *selected = uiwidget_creator.get_list_index (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
267 int ok = uiwidget_creator.get_dialog_result (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
268 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
269 uiwidget_creator.unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
270 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
271 return std::pair<std::list<int>, int> (selected->toStdList (), ok); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
272 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
273 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
274 std::list<std::string> |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
275 octave_qt_link::do_input_dialog (const std::list<std::string>& prompt, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
276 const std::string& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
277 const std::list<float>& nr, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
278 const std::list<float>& nc, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
279 const std::list<std::string>& defaults) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
280 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
281 std::list<std::string> retval; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
282 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
283 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
284 uiwidget_creator.lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
285 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
286 uiwidget_creator.signal_inputlayout (make_qstring_list (prompt), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
287 QString::fromStdString (title), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
288 QFloatList::fromStdList (nr), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
289 QFloatList::fromStdList (nc), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
290 make_qstring_list (defaults)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
291 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
292 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
293 uiwidget_creator.wait (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
294 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
295 // The GUI has sent a signal and the thread has been awakened. |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
296 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
297 const QStringList *inputLine = uiwidget_creator.get_string_list (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
298 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
299 uiwidget_creator.unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
300 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
301 for (auto it = inputLine->begin (); it != inputLine->end (); it++) |
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
302 retval.push_back (it->toStdString ()); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
303 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
304 return retval; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
305 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
306 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
307 std::list<std::string> |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
308 octave_qt_link::do_file_dialog (const filter_list& filter, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
309 const std::string& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
310 const std::string& filename, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
311 const std::string& dirname, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
312 const std::string& multimode) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
313 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
314 std::list<std::string> retval; |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
315 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
316 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
317 uiwidget_creator.lock (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
318 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
319 uiwidget_creator.signal_filedialog (make_filter_list (filter), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
320 QString::fromStdString (title), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
321 QString::fromStdString (filename), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
322 QString::fromStdString (dirname), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
323 QString::fromStdString (multimode)); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
324 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
325 // Wait while the user is responding to dialog. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
326 uiwidget_creator.wait (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
327 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
328 // The GUI has sent a signal and the thread has been awakened. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
329 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
330 // Add all the file dialog results to a string list. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
331 const QStringList *inputLine = uiwidget_creator.get_string_list (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
332 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
333 for (auto it = inputLine->begin (); it != inputLine->end (); it++) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
334 retval.push_back (it->toStdString ()); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
335 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
336 retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ()); |
25342
416856765a55
be more careful with using auto in place of explicit const iterator decls
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
337 retval.push_back ((QString ("%1").arg ( |
416856765a55
be more careful with using auto in place of explicit const iterator decls
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
338 uiwidget_creator.get_dialog_result ())).toStdString ()); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19970
diff
changeset
|
339 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
340 uiwidget_creator.unlock (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
341 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
342 return retval; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
343 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
344 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
345 // Prompt to allow file to be run by setting cwd (or if addpath_option==true, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
346 // alternatively setting the path). |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
347 // This uses a QMessageBox unlike other functions in this file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
348 // because uiwidget_creator.waitcondition.wait hangs when called from |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
349 // file_editor_tab::handle_context_menu_break_condition(). (FIXME: why hang?) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
350 int octave_qt_link::do_debug_cd_or_addpath_error (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
351 const std::string& dir, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
352 bool addpath_option) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
353 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
354 int retval = -1; |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
355 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
356 QString qdir = QString::fromStdString (dir); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
357 QString qfile = QString::fromStdString (file); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
358 QString msg |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
359 = (addpath_option |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
360 ? tr ("The file %1 does not exist in the load path. To run or debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
361 : tr ("The file %1 is shadowed by a file with the same name in the load path. To run or debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir)); |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
362 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
363 QString title = tr ("Change Directory or Add Directory to Load Path"); |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
364 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
365 QString cd_txt = tr ("&Change Directory"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
366 QString addpath_txt = tr ("&Add Directory to Load Path"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
367 QString cancel_txt = tr ("Cancel"); |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
368 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
369 QStringList btn; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
370 QStringList role; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
371 btn << cd_txt; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
372 role << "YesRole"; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
373 if (addpath_option) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
374 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
375 btn << addpath_txt; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
376 role << "AcceptRole"; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
377 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
378 btn << cancel_txt; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
379 role << "RejectRole"; |
21311
718332a58d35
Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21310
diff
changeset
|
380 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
381 // Lock mutex before signaling. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
382 uiwidget_creator.lock (); |
21311
718332a58d35
Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21310
diff
changeset
|
383 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
384 uiwidget_creator.signal_dialog (msg, title, "quest", btn, cancel_txt, role); |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
385 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
386 // Wait while the user is responding to message box. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
387 uiwidget_creator.wait (); |
21311
718332a58d35
Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21310
diff
changeset
|
388 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
389 // The GUI has sent a signal and the thread has been awakened. |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
390 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
391 QString result = uiwidget_creator.get_dialog_button (); |
21311
718332a58d35
Fix left mouse button in editor margin bug from cset 65827e9cccb8
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21310
diff
changeset
|
392 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
393 uiwidget_creator.unlock (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
394 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
395 if (result == cd_txt) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
396 retval = 1; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
397 else if (result == addpath_txt) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
398 retval = 2; |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
399 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
400 return retval; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
401 } |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
402 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
403 void octave_qt_link::do_change_directory (const std::string& dir) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
404 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
405 emit change_directory_signal (QString::fromStdString (dir)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
406 } |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
407 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
408 void octave_qt_link::do_execute_command_in_terminal |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
409 (const std::string& command) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
410 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
411 emit execute_command_in_terminal_signal (QString::fromStdString (command)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
412 } |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
413 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
414 void octave_qt_link::do_set_workspace (bool top_level, bool debug, |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
415 const symbol_scope& scope, |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
416 bool update_variable_editor) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
417 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
418 if (! top_level && ! debug) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
419 return; |
19904
793230bb81d4
don't update workspace viewer unless at top level (bug #44156)
John W. Eaton <jwe@octave.org>
parents:
19714
diff
changeset
|
420 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
421 emit set_workspace_signal (top_level, debug, scope); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23807
diff
changeset
|
422 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
423 if (update_variable_editor) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
424 emit refresh_variable_editor_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
425 } |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
426 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
427 void octave_qt_link::do_clear_workspace (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
428 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
429 emit clear_workspace_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
430 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
431 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
432 void octave_qt_link::do_set_history (const string_vector& hist) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
433 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
434 QStringList qt_hist; |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
435 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
436 for (octave_idx_type i = 0; i < hist.numel (); i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
437 qt_hist.append (QString::fromStdString (hist[i])); |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
438 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
439 emit set_history_signal (qt_hist); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
440 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
441 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
442 void octave_qt_link::do_append_history (const std::string& hist_entry) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
443 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
444 emit append_history_signal (QString::fromStdString (hist_entry)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
445 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
446 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
447 void octave_qt_link::do_clear_history (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
448 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
449 emit clear_history_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
450 } |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
451 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
452 void octave_qt_link::do_pre_input_event (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
453 { } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
454 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
455 void octave_qt_link::do_post_input_event (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
456 { } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
457 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
458 void octave_qt_link::do_enter_debugger_event (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
459 int line) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
460 { |
25557
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
461 interpreter& interp = __get_interpreter__ ( |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
462 "octave_qt_link::do_enter_debugger_event"); |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
463 octave_value_list fct = F__which__ (interp, ovl (file),0); |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
464 octave_map map = fct(0).map_value (); |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
465 |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
466 QString type = QString::fromStdString ( |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
467 map.contents ("type").data ()[0].string_value ()); |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
468 if (type == QString ("command-line function")) |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
469 return; |
bb779fc2d0db
do not attempt to open a file when debugging a command line fct (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25407
diff
changeset
|
470 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
471 do_insert_debugger_pointer (file, line); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
472 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
473 emit enter_debugger_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
474 } |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
475 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
476 void octave_qt_link::do_execute_in_debugger_event (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
477 int line) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
478 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
479 do_delete_debugger_pointer (file, line); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
480 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
481 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
482 void octave_qt_link::do_exit_debugger_event (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
483 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
484 emit exit_debugger_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
485 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
486 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
487 // Display (if @insert true) or remove the appropriate symbol for a breakpoint |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
488 // in @file at @line with condition @cond. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
489 void octave_qt_link::do_update_breakpoint (bool insert, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
490 const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
491 int line, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
492 const std::string& cond) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
493 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
494 emit update_breakpoint_marker_signal (insert, QString::fromStdString (file), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
495 line, QString::fromStdString (cond)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
496 } |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
497 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
498 bool octave_qt_link::file_in_path (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
499 const std::string& dir) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
500 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
501 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
502 bool ok = false; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
503 bool addpath_option = true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
504 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
505 std::string curr_dir = sys::env::get_current_directory (); |
16426
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
506 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
507 if (same_file (curr_dir, dir)) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
508 ok = true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
509 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
510 { |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
511 load_path& lp = __get_load_path__ ("octave_qt_link::file_in_path"); |
16528
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
512 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
513 bool dir_in_load_path = lp.contains_canonical (dir); |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
514 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
515 // get base name, allowing "@class/method.m" (bug #41514) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
516 std::string base_file = (file.length () > dir.length ()) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
517 ? file.substr (dir.length () + 1) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
518 : sys::env::base_pathname (file); |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
519 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
520 std::string lp_file = lp.find_file (base_file); |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
521 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
522 if (dir_in_load_path) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
523 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
524 if (same_file (lp_file, file)) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
525 ok = true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
526 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
527 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
528 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
529 // File directory is not in path. Is the file in the path in |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
530 // the current directory? If so, then changing the current |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
531 // directory will be needed. Adding directory to path is |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
532 // not enough because the file in the current directory would |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
533 // still be found. |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
534 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
535 if (same_file (lp_file, base_file)) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
536 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
537 if (same_file (curr_dir, dir)) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
538 ok = true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
539 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
540 addpath_option = false; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
541 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
542 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
543 } |
21717
efdf6424003a
Allow GUI to set breakpoints in @class/method (bug #41514).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21578
diff
changeset
|
544 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
545 if (! ok) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
546 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
547 int action = debug_cd_or_addpath_error (file, dir, addpath_option); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
548 switch (action) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
549 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
550 case 1: |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
551 Fcd (ovl (dir)); |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
552 ok = true; |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
553 break; |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
554 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
555 case 2: |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
556 { |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24718
diff
changeset
|
557 load_path& lp = __get_load_path__ ("octave_qt_link::file_in_path"); |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
558 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
559 lp.prepend (dir); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
560 ok = true; |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
561 } |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
562 break; |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
563 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
564 default: |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
565 break; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
566 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
567 } |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
568 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
569 return ok; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
570 } |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
571 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
572 void octave_qt_link::do_show_preferences (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
573 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
574 emit show_preferences_signal (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
575 } |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
576 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
577 void octave_qt_link::do_show_doc (const std::string& file) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
578 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
579 emit show_doc_signal (QString::fromStdString (file)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
580 } |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
581 |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
582 void octave_qt_link::do_register_doc (const std::string& file) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
583 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
584 emit register_doc_signal (QString::fromStdString (file)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
585 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
586 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
587 void octave_qt_link::do_unregister_doc (const std::string& file) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
588 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
589 emit unregister_doc_signal (QString::fromStdString (file)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
590 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
591 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
592 void octave_qt_link::do_edit_variable (const std::string& expr, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
593 const octave_value& val) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
594 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
595 emit edit_variable_signal (QString::fromStdString (expr), val); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
596 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
597 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
598 void octave_qt_link::do_insert_debugger_pointer (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
599 int line) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
600 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
601 emit insert_debugger_pointer_signal (QString::fromStdString (file), line); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
602 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
603 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
604 void octave_qt_link::do_delete_debugger_pointer (const std::string& file, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
605 int line) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
606 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
607 emit delete_debugger_pointer_signal (QString::fromStdString (file), line); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
608 } |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
609 } |