Mercurial > octave
annotate libinterp/corefcn/octave-link.cc @ 26117:a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
* syminfo.h (symbol_info_list::varval): New function.
* octave-link.h, octave-link.cc (octave_link::set_workspace,
octave_link::do_set_workspace): Pass symbol_info object instead of
symbol_scope.
* octave-qt-link.h, octave-qt-link.cc (octave_link::do_set_workspace):
Likewise. Change all uses. Register symbol_info_list instead of
symbol_scope as a Qt meta type.
* workspace-model.h, workspace-model.cc: Store symbol_info_list object
instead of symbol_scope.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 16 Nov 2018 19:35:39 -0500 |
parents | 700b3f415ebe |
children | a6694db4bd41 |
rev | line source |
---|---|
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
1 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24645
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:
24645
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:
24645
diff
changeset
|
5 Copyright (C) 2011-2018 John P. Swensen |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24361
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:
24361
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. |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
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. |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
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:
24361
diff
changeset
|
21 <https://www.gnu.org/licenses/>. |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
22 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
23 */ |
13501 | 24 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21440
diff
changeset
|
25 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
26 # include "config.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
27 #endif |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
28 |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
29 #include "builtin-defun-decls.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
30 #include "cmd-edit.h" |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
31 #include "defun.h" |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
32 #include "interpreter.h" |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
33 #include "interpreter-private.h" |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
34 #include "octave-link.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
35 #include "oct-env.h" |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
36 #include "oct-mutex.h" |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
37 #include "ovl.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
38 #include "pager.h" |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
39 #include "syminfo.h" |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
40 #include "symtab.h" |
13501 | 41 |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
42 static int |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
43 octave_readline_hook (void) |
14668
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
44 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
45 octave_link::entered_readline_hook (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
46 octave_link::generate_events (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
47 octave_link::process_events (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
48 octave_link::finished_readline_hook (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
49 |
14671
f346343654a4
Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14670
diff
changeset
|
50 return 0; |
14668
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
51 } |
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
52 |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
53 octave_link *octave_link::instance = nullptr; |
13501 | 54 |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
55 octave_link::octave_link (void) |
23057
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
56 : event_queue_mutex (new octave::mutex ()), gui_event_queue (), |
16485
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
57 debugging (false), link_enabled (true) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
58 { |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
59 octave::command_editor::add_event_hook (octave_readline_hook); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
60 } |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
61 |
21440
062c65569ad7
avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
62 octave_link::~octave_link (void) |
062c65569ad7
avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
63 { |
062c65569ad7
avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
64 delete event_queue_mutex; |
062c65569ad7
avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
65 } |
062c65569ad7
avoid some address-sanitizer leak warnings (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
66 |
16524
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
67 void |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
68 octave_link::set_workspace (void) |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
69 { |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
70 if (enabled ()) |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
71 { |
23693
b9378eff6d13
move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23652
diff
changeset
|
72 octave::symbol_table& symtab |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
73 = octave::__get_symbol_table__ ("octave_link::set_workspace"); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
74 |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
75 octave::call_stack& cs |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
76 = octave::__get_call_stack__ ("octave_link::set_workspace"); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
77 |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
78 instance->do_set_workspace (symtab.at_top_level (), |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
79 instance->debugging, |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25948
diff
changeset
|
80 cs.get_symbol_info (), true); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
81 } |
16524
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
82 } |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
83 |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
84 // OBJ should be an object of a class that is derived from the base |
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
85 // class octave_link, or 0 to disconnect the link. It is the |
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
86 // responsibility of the caller to delete obj. |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
87 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
88 void |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
89 octave_link::connect_link (octave_link *obj) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
90 { |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
91 if (obj && instance) |
20428
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
92 error ("octave_link is already linked!"); |
21055
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20941
diff
changeset
|
93 |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20941
diff
changeset
|
94 instance = obj; |
13501 | 95 } |
96 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
97 void |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
98 octave_link::do_generate_events (void) |
22417
48c00363dc74
maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
99 { } |
14719
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
100 |
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
101 void |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
102 octave_link::do_process_events (void) |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
103 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
104 event_queue_mutex->lock (); |
14875
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14804
diff
changeset
|
105 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
106 gui_event_queue.run (); |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
107 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
108 event_queue_mutex->unlock (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
109 } |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
110 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
111 void |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
112 octave_link::do_discard_events (void) |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
113 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
114 event_queue_mutex->lock (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
115 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
116 gui_event_queue.discard (); |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
117 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
118 event_queue_mutex->unlock (); |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
119 } |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
120 |
16552
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
121 DEFUN (__octave_link_enabled__, , , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
122 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
123 @deftypefn {} {} __octave_link_enabled__ () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
124 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
125 @end deftypefn */) |
16552
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
126 { |
21078
49852ff04747
maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
127 return ovl (octave_link::enabled ()); |
16552
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
128 } |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
129 |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
130 DEFUN (__octave_link_edit_file__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
131 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
132 @deftypefn {} {} __octave_link_edit_file__ (@var{file}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
133 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
134 @end deftypefn */) |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
135 { |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
136 octave_value retval; |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
137 |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
138 if (args.length () == 1) |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
139 { |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20700
diff
changeset
|
140 std::string file = args(0).xstring_value ("first argument must be filename"); |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
141 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
142 octave::flush_stdout (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
143 |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
144 retval = octave_link::edit_file (file); |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
145 } |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
146 else if (args.length () == 2) |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
147 { |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20700
diff
changeset
|
148 std::string file = args(0).xstring_value ("first argument must be filename"); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
149 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
150 octave::flush_stdout (); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
151 |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
152 retval = octave_link::prompt_new_edit_file (file); |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
153 } |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
154 |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
155 return retval; |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
156 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
157 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
158 DEFUN (__octave_link_question_dialog__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
159 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
160 @deftypefn {} {} __octave_link_question_dialog__ (@var{msg}, @var{title}, @var{btn1}, @var{btn2}, @var{btn3}, @var{default}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
161 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
162 @end deftypefn */) |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
163 { |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
164 octave_value retval; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
165 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
166 if (args.length () == 6) |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
167 { |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
168 std::string msg = args(0).xstring_value ("invalid arguments"); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
169 std::string title = args(1).xstring_value ("invalid arguments"); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
170 std::string btn1 = args(2).xstring_value ("invalid arguments"); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
171 std::string btn2 = args(3).xstring_value ("invalid arguments"); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
172 std::string btn3 = args(4).xstring_value ("invalid arguments"); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20667
diff
changeset
|
173 std::string btndef = args(5).xstring_value ("invalid arguments"); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
174 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
175 octave::flush_stdout (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
176 |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
177 retval = octave_link::question_dialog (msg, title, btn1, btn2, btn3, |
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
178 btndef); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
179 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
180 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
181 return retval; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
182 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
183 |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
184 DEFUN (__octave_link_file_dialog__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
185 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
186 @deftypefn {} {} __octave_link_file_dialog__ (@var{filterlist}, @var{title}, @var{filename}, @var{size} @var{multiselect}, @var{pathname}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
187 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
188 @end deftypefn */) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
189 { |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
190 if (args.length () != 6) |
20941
a4f5da7c5463
maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents:
20898
diff
changeset
|
191 return ovl (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
192 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
193 octave_value_list retval (3); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
194 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
195 const Array<std::string> flist = args(0).cellstr_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
196 std::string title = args(1).string_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
197 std::string filename = args(2).string_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
198 Matrix pos = args(3).matrix_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
199 std::string multi_on = args(4).string_value (); // on, off, create |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
200 std::string pathname = args(5).string_value (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
201 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
202 octave_idx_type nel; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
203 octave_link::filter_list filter_lst; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
204 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
205 for (octave_idx_type i = 0; i < flist.rows (); i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
206 filter_lst.push_back (std::make_pair (flist(i,0), |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
207 (flist.columns () > 1 |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
208 ? flist(i,1) : ""))); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
209 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
210 octave::flush_stdout (); |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
211 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
212 std::list<std::string> items_lst |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
213 = octave_link::file_dialog (filter_lst, title, filename, pathname, |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
214 multi_on); |
20667
8742e0b1cc49
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20581
diff
changeset
|
215 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
216 nel = items_lst.size (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
217 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
218 // If 3, then retval is filename, directory, and selected index. |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
219 if (nel <= 3) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
220 { |
21836
2049e123bf7b
uigetdir, uigetfile, uiputfile: Return zeros when user cancels (bug #48171)
Mike Miller <mtmiller@octave.org>
parents:
21748
diff
changeset
|
221 if (items_lst.front ().empty ()) |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
222 retval = ovl (octave_value (0.), octave_value (0.), octave_value (0.)); |
21836
2049e123bf7b
uigetdir, uigetfile, uiputfile: Return zeros when user cancels (bug #48171)
Mike Miller <mtmiller@octave.org>
parents:
21748
diff
changeset
|
223 else |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
224 { |
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
225 int idx = 0; |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
226 for (auto& str : items_lst) |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
227 { |
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
228 if (idx != 2) |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
229 retval(idx++) = str; |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
230 else |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
231 retval(idx++) = atoi (str.c_str ()); |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
232 } |
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
233 } |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
234 } |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
235 else |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
236 { |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
237 // Multiple files. |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
238 nel -= 2; |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
239 Cell items (dim_vector (1, nel)); |
20667
8742e0b1cc49
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20581
diff
changeset
|
240 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25060
diff
changeset
|
241 auto it = items_lst.begin (); |
20667
8742e0b1cc49
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20581
diff
changeset
|
242 |
21837
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
243 for (int idx = 0; idx < nel; idx++, it++) |
3ef630a564f8
Clean up C++ code for F__octave_link_file_dialog__.
Rik <rik@octave.org>
parents:
21836
diff
changeset
|
244 items.xelem (idx) = *it; |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
245 |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
246 retval = ovl (items, *it++, atoi (it->c_str ())); |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
247 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
248 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
249 return retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
250 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
251 |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
252 DEFUN (__octave_link_list_dialog__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
253 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
254 @deftypefn {} {} __octave_link_list_dialog__ (@var{list}, @var{mode}, @var{size}, @var{intial}, @var{name}, @var{prompt}, @var{ok_string}, @var{cancel_string}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
255 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
256 @end deftypefn */) |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
257 { |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
258 if (args.length () != 8) |
20941
a4f5da7c5463
maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents:
20898
diff
changeset
|
259 return ovl (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
260 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
261 Cell list = args(0).cell_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
262 const Array<std::string> tlist = list.cellstr_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
263 octave_idx_type nel = tlist.numel (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
264 std::list<std::string> list_lst; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
265 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
266 list_lst.push_back (tlist(i)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
267 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
268 std::string mode = args(1).string_value (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
269 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
270 Matrix size_matrix = args(2).matrix_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
271 int width = size_matrix(0); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
272 int height = size_matrix(1); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
273 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
274 Matrix initial_matrix = args(3).matrix_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
275 nel = initial_matrix.numel (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
276 std::list<int> initial_lst; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
277 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
278 initial_lst.push_back (initial_matrix(i)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
279 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
280 std::string name = args(4).string_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
281 list = args(5).cell_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
282 const Array<std::string> plist = list.cellstr_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
283 nel = plist.numel (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
284 std::list<std::string> prompt_lst; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
285 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
286 prompt_lst.push_back (plist(i)); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
287 std::string ok_string = args(6).string_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
288 std::string cancel_string = args(7).string_value (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
289 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
290 octave::flush_stdout (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
291 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
292 std::pair<std::list<int>, int> result |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
293 = octave_link::list_dialog (list_lst, mode, width, height, |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
294 initial_lst, name, prompt_lst, |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
295 ok_string, cancel_string); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
296 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
297 std::list<int> items_lst = result.first; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
298 nel = items_lst.size (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
299 Matrix items (dim_vector (1, nel)); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
300 octave_idx_type i = 0; |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
301 for (const auto& int_el : items_lst) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
302 items.xelem(i++) = int_el; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
303 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
304 return ovl (items, result.second); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
305 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
306 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
307 DEFUN (__octave_link_input_dialog__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
308 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
309 @deftypefn {} {} __octave_link_input_dialog__ (@var{prompt}, @var{title}, @var{rowscols}, @var{defaults}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
310 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
311 @end deftypefn */) |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
312 { |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
313 if (args.length () != 4) |
20941
a4f5da7c5463
maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents:
20898
diff
changeset
|
314 return ovl (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
315 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
316 Cell prompt = args(0).cell_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
317 Array<std::string> tmp = prompt.cellstr_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
318 octave_idx_type nel = tmp.numel (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
319 std::list<std::string> prompt_lst; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
320 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
321 prompt_lst.push_back (tmp(i)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
322 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
323 std::string title = args(1).string_value (); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
324 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
325 Matrix rc = args(2).matrix_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
326 nel = rc.rows (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
327 std::list<float> nr; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
328 std::list<float> nc; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
329 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
330 { |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
331 nr.push_back (rc(i,0)); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
332 nc.push_back (rc(i,1)); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
333 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
334 |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
335 Cell defaults = args(3).cell_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
336 tmp = defaults.cellstr_value (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
337 nel = tmp.numel (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
338 std::list<std::string> defaults_lst; |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
339 for (octave_idx_type i = 0; i < nel; i++) |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
340 defaults_lst.push_back (tmp(i)); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
341 |
23060
baf03cdb28b5
move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23057
diff
changeset
|
342 octave::flush_stdout (); |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
343 |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
344 std::list<std::string> items_lst |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
345 = octave_link::input_dialog (prompt_lst, title, nr, nc, |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
346 defaults_lst); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
347 |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
348 nel = items_lst.size (); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
349 Cell items (dim_vector (nel, 1)); |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
350 octave_idx_type i = 0; |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
351 for (const auto& str_el : items_lst) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
352 items.xelem(i++) = str_el; |
20898
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
353 |
8da80da1ac37
maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents:
20892
diff
changeset
|
354 return ovl (items); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
355 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
356 |
25921
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
357 |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
358 DEFUN (__octave_link_named_icon__, args, , |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
359 doc: /* -*- texinfo -*- |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
360 @deftypefn {} {} __octave_link_dialog_icons__ (@var{icon_name}) |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
361 Undocumented internal function. |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
362 @end deftypefn */) |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
363 { |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
364 uint8NDArray retval; |
25948
700b3f415ebe
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25921
diff
changeset
|
365 |
25921
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
366 if (args.length () > 0) |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
367 { |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
368 std::string icon_name = args(0).xstring_value ("invalid arguments"); |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
369 |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
370 retval = octave_link::get_named_icon (icon_name); |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
371 } |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
372 |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
373 return ovl (retval); |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
374 } |
9c47eedc44e2
msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25790
diff
changeset
|
375 |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
376 DEFUN (__octave_link_show_preferences__, , , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
377 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
378 @deftypefn {} {} __octave_link_show_preferences__ () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
379 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
380 @end deftypefn */) |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
381 { |
21078
49852ff04747
maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
382 return ovl (octave_link::show_preferences ()); |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
383 } |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
384 |
25639
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
385 DEFUN (__octave_link_gui_preference__, args, , |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
386 doc: /* -*- texinfo -*- |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
387 @deftypefn {} {} __octave_link_gui_preference__ () |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
388 Undocumented internal function. |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
389 @end deftypefn */) |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
390 { |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
391 std::string key; |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
392 std::string value = ""; |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
393 |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
394 if (args.length () >= 1) |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
395 key = args(0).string_value(); |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
396 else |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
397 error ("__octave_link_gui_preference__: " |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
398 "first argument must be the preference key"); |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
399 |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
400 if (args.length () >= 2) |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
401 value = args(1).string_value(); |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
402 |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
403 return ovl (octave_link::gui_preference (key, value)); |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
404 } |
7644e7f1721f
change gui preferences from within the worker thread (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25337
diff
changeset
|
405 |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
406 DEFUN (__octave_link_file_remove__, args, , |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
407 doc: /* -*- texinfo -*- |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
408 @deftypefn {} {} __octave_link_file_remove__ () |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
409 Undocumented internal function. |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
410 @end deftypefn */) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
411 { |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
412 std::string old_name, new_name; |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
413 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
414 if (args.length () == 2) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
415 { |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
416 old_name = args(0).string_value(); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
417 new_name = args(1).string_value(); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
418 } |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
419 else |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
420 error ("__octave_link_file_remove__: " |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
421 "old and new name expected as arguments"); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
422 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
423 octave_link::file_remove (old_name, new_name); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
424 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
425 return ovl (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
426 } |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
427 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
428 DEFUN (__octave_link_file_renamed__, args, , |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
429 doc: /* -*- texinfo -*- |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
430 @deftypefn {} {} __octave_link_file_renamed__ () |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
431 Undocumented internal function. |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
432 @end deftypefn */) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
433 { |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
434 bool load_new; |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
435 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
436 if (args.length () == 1) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
437 load_new = args(0).bool_value(); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
438 else |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
439 error ("__octave_link_file_renamed__: " |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
440 "first argument must be boolean for reload new named file"); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
441 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
442 octave_link::file_renamed (load_new); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
443 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
444 return ovl (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
445 } |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25639
diff
changeset
|
446 |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
447 DEFMETHOD (openvar, interp, args, , |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
448 doc: /* -*- texinfo -*- |
23938
e54e13ee99ce
openvar: fix doc string declaration
Mike Miller <mtmiller@octave.org>
parents:
23927
diff
changeset
|
449 @deftypefn {} {} openvar (@var{name}) |
e54e13ee99ce
openvar: fix doc string declaration
Mike Miller <mtmiller@octave.org>
parents:
23927
diff
changeset
|
450 Open the variable @var{name} in the graphical Variable Editor. |
e54e13ee99ce
openvar: fix doc string declaration
Mike Miller <mtmiller@octave.org>
parents:
23927
diff
changeset
|
451 @end deftypefn */) |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23693
diff
changeset
|
452 { |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
453 if (args.length () != 1) |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23693
diff
changeset
|
454 print_usage (); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23693
diff
changeset
|
455 |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
456 if (! args(0).is_string ()) |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24082
diff
changeset
|
457 error ("openvar: NAME must be a string"); |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
458 |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
459 std::string name = args(0).string_value (); |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
460 |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
461 if (! (Fisguirunning ())(0).is_true ()) |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24082
diff
changeset
|
462 warning ("openvar: GUI is not running, can't start Variable Editor"); |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
463 else |
24641
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
464 { |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
465 octave::symbol_scope scope = interp.require_current_scope ("openvar"); |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
466 |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
467 octave_value val = scope.varval (name); |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
468 |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
469 if (val.is_undefined ()) |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
470 error ("openvar: '%s' is not a variable", name.c_str ()); |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
471 |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
472 octave_link::edit_variable (name, val); |
7d177be54c37
pass variable value to variable editor in addition to variable name
John W. Eaton <jwe@octave.org>
parents:
24631
diff
changeset
|
473 } |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
474 |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
475 return ovl (); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23693
diff
changeset
|
476 } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23693
diff
changeset
|
477 |
23976
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
478 /* |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
479 %!error openvar () |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
480 %!error openvar ("a", "b") |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
481 %!error <NAME must be a string> openvar (1:10) |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
482 */ |
529272d1c271
Complete openvar implementation (bug #51899).
Rik <rik@octave.org>
parents:
23938
diff
changeset
|
483 |
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
|
484 DEFUN (__octave_link_show_doc__, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
485 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
486 @deftypefn {} {} __octave_link_show_doc__ (@var{filename}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
487 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21837
diff
changeset
|
488 @end deftypefn */) |
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
|
489 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
490 std::string file; |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
491 |
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
|
492 if (args.length () >= 1) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
493 file = args(0).string_value(); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
494 |
21078
49852ff04747
maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
495 return ovl (octave_link::show_doc (file)); |
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
|
496 } |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
497 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
498 DEFUN (__octave_link_register_doc__, args, , |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
499 doc: /* -*- texinfo -*- |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
500 @deftypefn {} {} __octave_link_register_doc__ (@var{filename}) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
501 Undocumented internal function. |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
502 @end deftypefn */) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
503 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
504 std::string file; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
505 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
506 if (args.length () >= 1) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
507 file = args(0).string_value(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
508 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
509 return ovl (octave_link::register_doc (file)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
510 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
511 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
512 DEFUN (__octave_link_unregister_doc__, args, , |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
513 doc: /* -*- texinfo -*- |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
514 @deftypefn {} {} __octave_link_unregister_doc__ (@var{filename}) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
515 Undocumented internal function. |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
516 @end deftypefn */) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
517 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
518 std::string file; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
519 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
520 if (args.length () >= 1) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
521 file = args(0).string_value(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
522 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
523 return ovl (octave_link::unregister_doc (file)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
524 } |