Mercurial > octave-nkf
annotate libinterp/corefcn/octave-link.cc @ 20463:7ac907da9fba
Use error() rather than ::error() unless explicitly required.
* resource-manager.cc (instance_ok), shortcut-manager.cc (instance_ok),
daspk.cc (DASPK_ABORT, DASPK_ABORT2), dasrt.cc (DASRT_ABORT, DASRT_ABORT2),
dassl.cc (DASSL_ABORT, DASSL_ABORT2), debug.cc (instance_ok),
display.cc (instance_ok), dynamic-ld.cc (octave_shlib_list::instance_ok,
octave_dynamic_loader::instance_ok, do_load_oct, do_load_mex), file-io.cc
(fopen_mode_to_ios_mode, do_stream_open, Ffprintf, Fsprintf, Fscanf, Ffscanf,
get_sscanf_data, Fsscanf, do_fread, do_fwrite, Fpopen, Ftempname, convert,
Fumask), graphics.in.h (graphics_toolkit::instance_ok,
gh_manager::instance_ok), load-path.cc (instance_ok),
ls-oct-ascii.cc (save_three_d), lsode.cc (LSODE_ABORT, LSODE_ABORT2),
oct-errno.in.cc (instance_ok), octave-link.cc (connect_link),
pager.cc (octave_pager_stream::instance_ok, octave_diary_stream::instance_ok),
quad.cc (QUAD_ABORT, QUAD_ABORT2),
sighandlers.cc (w32_interrupt_manager::instance_ok,
octave_child_list::instance_ok), symtab.cc (do_update_nest),
symtab.h (instance_ok), syscalls.cc (convert), toplev.h (instance_ok),
txt-eng-ft.cc (instance_ok, set_mode), urlwrite.cc (instance_ok),
__init_fltk__.cc (instance_ok), ov-builtin.cc (do_multi_index_op),
ov-classdef.cc (class_fevalStatic, make_class, octave_classdef::subsasgn,
do_multi_index_op, cdef_object_array::subsref, cdef_object_array::subsasgn,
install_meth, meta_subsref, run_constructor, make_meta_class, get_value,
set_value, check_method), ov-classdef.h (meta_subsref, instance_ok),
ov-fcn-handle.cc (octave_fcn_handle), ov-mex-fcn.cc (do_multi_index_op),
ov-range.h (octave_range), ov-typeinfo.cc (instance_ok),
ov-usr-fcn.cc (subsref, do_multi_index_op), pt-arg-list.cc (Fend,
convert_to_const_vector), pt-cell.cc (rvalue1), pt-colon.cc (append, rvalue1),
pt-eval.cc (visit_simple_for_command, visit_switch_command),
pt-exp.cc (is_logically_true, rvalue), pt-id.cc (eval_undefined_error),
pt-id.h (workspace_error), pt-mat.cc (get_concat_class):
Use error() rather than ::error().
author | Rik <rik@octave.org> |
---|---|
date | Thu, 06 Aug 2015 08:09:01 -0700 |
parents | aa36fb998a4d |
children | fd0efcdb3718 |
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 |
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18712
diff
changeset
|
3 Copyright (C) 2013-2015 John W. Eaton |
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18712
diff
changeset
|
4 Copyright (C) 2011-2015 Jacob Dawid |
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18712
diff
changeset
|
5 Copyright (C) 2011-2015 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 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 for more details. |
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 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 <http://www.gnu.org/licenses/>. |
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 |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
25 #ifdef HAVE_CONFIG_H |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
26 #include <config.h> |
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 |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
29 #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
|
30 #include "defun.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
31 #include "oct-env.h" |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
32 #include "oct-mutex.h" |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
33 #include "singleton-cleanup.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
34 #include "toplev.h" |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15041
diff
changeset
|
35 |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
36 #include "octave-link.h" |
13501 | 37 |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
38 static int |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
39 octave_readline_hook (void) |
14668
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
40 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
41 octave_link::entered_readline_hook (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
42 octave_link::generate_events (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
43 octave_link::process_events (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
44 octave_link::finished_readline_hook (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
45 |
14671
f346343654a4
Settings readline event hook and fixed race condition.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14670
diff
changeset
|
46 return 0; |
14668
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
47 } |
6a6733a55982
Removed unused classes and added octave loop hook.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14664
diff
changeset
|
48 |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
49 octave_link *octave_link::instance = 0; |
13501 | 50 |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
51 octave_link::octave_link (void) |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
52 : 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
|
53 debugging (false), link_enabled (true) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
54 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
55 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
|
56 } |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
57 |
16524
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
58 void |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
59 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
|
60 { |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
61 if (enabled ()) |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
62 instance->do_set_workspace ((symbol_table::current_scope () |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
63 == symbol_table::top_scope ()), |
20216
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20005
diff
changeset
|
64 instance->debugging, |
16524
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
65 symbol_table::workspace_info ()); |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
66 } |
6a8e63dadfad
provide octave_link::set_workspace function with default values
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
67 |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
68 // 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
|
69 // 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
|
70 // 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
|
71 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
72 void |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
73 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
|
74 { |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16420
diff
changeset
|
75 if (obj && instance) |
20463
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20216
diff
changeset
|
76 error ("octave_link is already linked!"); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
77 else |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16399
diff
changeset
|
78 instance = obj; |
13501 | 79 } |
80 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
81 void |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
82 octave_link::do_generate_events (void) |
14719
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
83 { |
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
84 } |
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
85 |
89c64340e9ab
Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
86 void |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
87 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
|
88 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
89 event_queue_mutex->lock (); |
14875
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14804
diff
changeset
|
90 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
91 gui_event_queue.run (); |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
92 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
93 event_queue_mutex->unlock (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
94 } |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
95 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
96 void |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
97 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
|
98 { |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
99 event_queue_mutex->lock (); |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
100 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
101 gui_event_queue.discard (); |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
102 |
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
103 event_queue_mutex->unlock (); |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
104 } |
15371
eec0d1fcba4f
use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
105 |
16552
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
106 DEFUN (__octave_link_enabled__, , , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
107 "-*- texinfo -*-\n\ |
16552
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
108 @deftypefn {Built-in Function} {} __octave_link_enabled__ ()\n\ |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
109 Undocumented internal function.\n\ |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
110 @end deftypefn") |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
111 { |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
112 return octave_value (octave_link::enabled ()); |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
113 } |
8fc1f6535380
new function, __octave_link_enabled__
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
114 |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
115 DEFUN (__octave_link_edit_file__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
116 "-*- texinfo -*-\n\ |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
117 @deftypefn {Built-in Function} {} __octave_link_edit_file__ (@var{file})\n\ |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
118 Undocumented internal function.\n\ |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
119 @end deftypefn") |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
120 { |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
121 octave_value retval; |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
122 |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
123 if (args.length () == 1) |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
124 { |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
125 std::string file = args(0).string_value (); |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
126 |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
127 if (! error_state) |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
128 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
129 flush_octave_stdout (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
130 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
131 retval = octave_link::edit_file (file); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
132 } |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
133 else |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
134 error ("expecting file name as argument"); |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
135 } |
17884
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
136 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
|
137 { |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
138 std::string file = args(0).string_value (); |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
139 |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
140 if (! error_state) |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
141 { |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
142 flush_octave_stdout (); |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
143 |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
144 retval = octave_link::prompt_new_edit_file (file); |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
145 } |
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 |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
147 error ("expecting file name as first argument"); |
766ad9be2966
Prompt for non-existent new file when using edit.m from GUI (bug #40450)
Torsten <ttl@justmail.de>
parents:
17787
diff
changeset
|
148 } |
16420
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
149 |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
150 return retval; |
81ec95768520
use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
151 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
152 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
153 DEFUN (__octave_link_message_dialog__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 "-*- texinfo -*-\n\ |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
155 @deftypefn {Built-in Function} {} __octave_link_message_dialog__ (@var{dlg}, @var{msg}, @var{title})\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
156 Undocumented internal function.\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
157 @end deftypefn") |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
158 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
159 octave_value retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
160 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
161 if (args.length () == 3) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
162 { |
16729
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
163 std::string dlg = args(0).string_value (); |
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
164 std::string msg = 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
|
165 std::string title = args(2).string_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
166 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
167 if (! error_state) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
168 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
169 flush_octave_stdout (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
170 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
171 retval = octave_link::message_dialog (dlg, msg, title); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
172 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
173 else |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
174 error ("invalid arguments"); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
175 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
176 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
177 return retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
178 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
179 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
180 DEFUN (__octave_link_question_dialog__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
181 "-*- texinfo -*-\n\ |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
182 @deftypefn {Built-in Function} {} __octave_link_question_dialog__ (@var{msg}, @var{title}, @var{btn1}, @var{btn2}, @var{btn3}, @var{default})\n\ |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
183 Undocumented internal function.\n\ |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
184 @end deftypefn") |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
185 { |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
186 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
|
187 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
188 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
|
189 { |
16729
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
190 std::string msg = args(0).string_value (); |
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
191 std::string title = args(1).string_value (); |
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
192 std::string btn1 = args(2).string_value (); |
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
193 std::string btn2 = args(3).string_value (); |
34728454d8a6
octave-link.cc: align code assignments statements for readability.
Rik <rik@octave.org>
parents:
16582
diff
changeset
|
194 std::string btn3 = args(4).string_value (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
195 std::string btndef = args(5).string_value (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
196 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
197 if (! error_state) |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
198 { |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
199 flush_octave_stdout (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
200 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
201 retval = octave_link::question_dialog (msg, title, btn1, btn2, btn3, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
202 btndef); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
203 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
204 else |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
205 error ("invalid arguments"); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
206 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
207 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
208 return retval; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
209 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
210 |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
211 DEFUN (__octave_link_file_dialog__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
212 "-*- texinfo -*-\n\ |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
213 @deftypefn {Built-in Function} {} __octave_link_file_dialog__ (@var{filterlist}, @var{title}, @var{filename}, @var{size} @var{multiselect}, @var{pathname})\n\ |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
214 Undocumented internal function.\n\ |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
215 @end deftypefn") |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
216 { |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
217 octave_value_list retval; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
218 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
219 if (args.length () == 6) |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
220 { |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
221 |
16582 | 222 const Array<std::string> flist = args(0).cellstr_value (); |
223 std::string title = args(1).string_value (); | |
224 std::string filename = args(2).string_value (); | |
225 Matrix pos = args(3).matrix_value (); | |
226 std::string multi_on = args(4).string_value (); // on, off, create | |
227 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
|
228 |
18710
5bd1ca29c5f0
Clean up questionable code bits identified by clang sanitize.
Rik <rik@octave.org>
parents:
17884
diff
changeset
|
229 octave_idx_type nel; |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
230 octave_link::filter_list filter_lst; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
231 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
232 for (octave_idx_type i = 0; i < flist.rows (); i++) |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
233 filter_lst.push_back (std::make_pair (flist(i,0), |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
234 (flist.columns () > 1 |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
235 ? flist(i,1) : ""))); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
236 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
237 if (! error_state) |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
238 { |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
239 flush_octave_stdout (); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
240 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
241 std::list<std::string> items_lst |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
242 = octave_link::file_dialog (filter_lst, title, filename, pathname, |
16581
fa4a035e0cf4
Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16580
diff
changeset
|
243 multi_on); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
244 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
245 nel = items_lst.size (); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
246 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
247 retval.resize (3); |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
248 |
17233
98fcf9373f5e
octave-link.cc: Don't add 2 extra entries when using uigetfile (bug #39732).
Rik <rik@octave.org>
parents:
17029
diff
changeset
|
249 // If 3, then retval is filename, directory, and selected index. |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
250 if (nel <= 3) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
251 { |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
252 int idx = 0; |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
253 for (std::list<std::string>::iterator it = items_lst.begin (); |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
254 it != items_lst.end (); it++) |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
255 { |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
256 retval(idx++) = *it; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
257 |
16582 | 258 if (idx == 1 && retval(0).string_value ().length () == 0) |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
259 retval(0) = 0; |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
260 |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
261 if (idx == 3) |
16582 | 262 retval(2) = atoi (retval(2).string_value ().c_str ()); |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
263 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
264 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
265 else |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
266 { |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
267 // Multiple files. |
17233
98fcf9373f5e
octave-link.cc: Don't add 2 extra entries when using uigetfile (bug #39732).
Rik <rik@octave.org>
parents:
17029
diff
changeset
|
268 nel = items_lst.size () - 2; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
269 Cell items (dim_vector (1, nel)); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
270 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
271 std::list<std::string>::iterator it = items_lst.begin (); |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
272 |
17377
15e2ad6372f7
maint: Tweaks to remove compiler warnings.
Rik <rik@octave.org>
parents:
17233
diff
changeset
|
273 for (int idx = 0; idx < nel; idx++) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
274 { |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
275 items.xelem (idx) = *it; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
276 it++; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
277 } |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
278 |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
279 retval(0) = items; |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
280 retval(1) = *it++; |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
281 retval(2) = atoi (it->c_str ()); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
282 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
283 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
284 else |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
285 error ("invalid arguments"); |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
286 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
287 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
288 return retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
289 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16552
diff
changeset
|
290 |
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 DEFUN (__octave_link_list_dialog__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
292 "-*- texinfo -*-\n\ |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
293 @deftypefn {Built-in Function} {} __octave_link_list_dialog__ (@var{list}, @var{mode}, @var{size}, @var{intial}, @var{name}, @var{prompt}, @var{ok_string}, @var{cancel_string})\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
294 Undocumented internal function.\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
295 @end deftypefn") |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
296 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
297 octave_value_list retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
298 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
299 if (args.length () == 8) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
300 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
301 Cell list = args(0).cell_value (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
302 const Array<std::string> tlist = list.cellstr_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
|
303 octave_idx_type nel = tlist.numel (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
304 std::list<std::string> list_lst; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
305 for (octave_idx_type i = 0; i < nel; i++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
306 list_lst.push_back (tlist(i)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
307 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
308 std::string mode = args(1).string_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
309 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
310 Matrix size_matrix = args(2).matrix_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
311 int width = size_matrix(0); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
312 int height = size_matrix(1); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
313 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
314 Matrix initial_matrix = args(3).matrix_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
315 nel = initial_matrix.numel (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
316 std::list<int> initial_lst; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
317 for (octave_idx_type i = 0; i < nel; i++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
318 initial_lst.push_back (initial_matrix(i)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
319 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
320 std::string name = args(4).string_value (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
321 list = args(5).cell_value (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
322 const Array<std::string> plist = list.cellstr_value (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
323 nel = plist.numel (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
324 std::list<std::string> prompt_lst; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
325 for (octave_idx_type i = 0; i < nel; i++) |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
326 prompt_lst.push_back (plist(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
|
327 std::string ok_string = args(6).string_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
328 std::string cancel_string = args(7).string_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
329 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
330 if (! error_state) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
331 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
332 flush_octave_stdout (); |
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 std::pair<std::list<int>, int> result |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
335 = octave_link::list_dialog (list_lst, mode, width, height, |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
336 initial_lst, name, prompt_lst, |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
337 ok_string, cancel_string); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
338 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
339 std::list<int> items_lst = result.first; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
340 nel = items_lst.size (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
341 Matrix items (dim_vector (1, nel)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
342 octave_idx_type i = 0; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
343 for (std::list<int>::iterator it = items_lst.begin (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
344 it != items_lst.end (); it++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
345 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
346 items.xelem(i++) = *it; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
347 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
348 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
349 retval(1) = result.second; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
350 retval(0) = items; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
351 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
352 else |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
353 error ("invalid arguments"); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
354 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
355 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
356 return retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
357 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
358 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
359 DEFUN (__octave_link_input_dialog__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
360 "-*- texinfo -*-\n\ |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
361 @deftypefn {Built-in Function} {} __octave_link_input_dialog__ (@var{prompt}, @var{title}, @var{rowscols}, @var{defaults})\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
362 Undocumented internal function.\n\ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
363 @end deftypefn") |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
364 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
365 octave_value retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
366 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
367 if (args.length () == 4) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
368 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
369 Cell prompt = args(0).cell_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
370 Array<std::string> tmp = prompt.cellstr_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
371 octave_idx_type nel = tmp.numel (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
372 std::list<std::string> prompt_lst; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
373 for (octave_idx_type i = 0; i < nel; i++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
374 prompt_lst.push_back (tmp(i)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
375 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
376 std::string title = args(1).string_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
377 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
378 Matrix rc = args(2).matrix_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
379 nel = rc.rows (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
380 std::list<float> nr; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16524
diff
changeset
|
381 std::list<float> nc; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
382 for (octave_idx_type i = 0; i < nel; i++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
383 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
384 nr.push_back (rc(i,0)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
385 nc.push_back (rc(i,1)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
386 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
387 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
388 Cell defaults = args(3).cell_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
389 tmp = defaults.cellstr_value (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
390 nel = tmp.numel (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
391 std::list<std::string> defaults_lst; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
392 for (octave_idx_type i = 0; i < nel; i++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
393 defaults_lst.push_back (tmp(i)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
394 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
395 if (! error_state) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
396 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
397 flush_octave_stdout (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
398 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
399 std::list<std::string> items_lst |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
400 = octave_link::input_dialog (prompt_lst, title, nr, nc, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
401 defaults_lst); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
402 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
403 nel = items_lst.size (); |
19987
028b2302f940
inputdlg: allow input prompts of varied size, return answer as column vector (Bug 44552)
John Donoghue <john.donoghue@ieee.org>
parents:
19731
diff
changeset
|
404 Cell items (dim_vector (nel, 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
|
405 octave_idx_type i = 0; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
406 for (std::list<std::string>::iterator it = items_lst.begin (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
407 it != items_lst.end (); it++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
408 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
409 items.xelem(i++) = *it; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
410 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
411 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
412 retval = items; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
413 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
414 else |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
415 error ("invalid arguments"); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
416 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
417 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
418 return retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
419 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
420 |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
421 DEFUN (__octave_link_show_preferences__, , , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
422 "-*- texinfo -*-\n\ |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
423 @deftypefn {Built-in Function} {} __octave_link_show_preferences__ ()\n\ |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
424 Undocumented internal function.\n\ |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
425 @end deftypefn") |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
426 { |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
427 octave_value retval; |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
428 |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
429 retval = octave_link::show_preferences (); |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
430 |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
431 return retval; |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
432 } |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
433 |
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
|
434 DEFUN (__octave_link_show_doc__, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
435 "-*- texinfo -*-\n\ |
18712
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
18710
diff
changeset
|
436 @deftypefn {Built-in Function} {} __octave_link_show_doc__ (@var{filename})\n\ |
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
|
437 Undocumented internal function.\n\ |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
438 @end deftypefn") |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
439 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
440 octave_value retval; |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
441 std::string file; |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16894
diff
changeset
|
442 |
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
|
443 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
|
444 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
|
445 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
446 retval = octave_link::show_doc (file); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
447 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
448 return retval; |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
449 } |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
450 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
451 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
452 |