annotate libinterp/interpfcn/octave-link.cc @ 16512:7f2395651a1c

dialog boxes with Qt widgets * dialog.h, dialog.cc: New files. * libgui/src/module.mk: Update file lists. * main-window.h, main-window.ccmain_window::connect_uiwidget_links, main_window::handle_create_dialog, main_window::handle_create_listview, main_window::handle_create_inputlayout): New functions. (main_window::construct): Call connect_uiwidget_links. * octave-link.h, octave-link.cc (octave_link::message_dialog, octave_link::do_message_dialog, octave_link::list_dialog, octave_link::do_list_dialog, octave_link::input_dialog, octave_link::do_input_dialog): New functions. * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::message_dialog, octave_qt_link::do_message_dialog, octave_qt_link::list_dialog, octave_qt_link::do_list_dialog, octave_qt_link::input_dialog, octave_qt_link::do_input_dialog, make_qstring_list): New functions. * octave-link.cc (F__octave_link_edit_file__): Call flush_octave_stdout before running the edit file action. (F__octave_link_message_dialog__, F__octave_link_list_dialog__, __octave_link_input_dialog__): New functions. * errordlg.m, helpdlg.m, inputdlg.m, listdlg.m, msgbox.m, warndlg.m: New demos adapted from dlgtest.m * dlgtest.m: Delete. * scripts/java/module.mk: Remove it from the list of files. * inputdlg.m: Try __octave_link_input_dialog__ first. Only try java method if JAVA feature is available. * listdlg.m: Likwise, for __octave_link_list_dialog__. * private/message_dialog.m: Likewise, for __octave_link_message_dialog__.
author Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
date Sat, 13 Apr 2013 15:22:34 -0400
parents 8b783661e03f
children 6a8e63dadfad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents: 16399
diff changeset
3 Copyright (C) 2013 John W. Eaton
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 Copyright (C) 2011-2012 John P. Swensen
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
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16420
diff changeset
58 // 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
59 // 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
60 // 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
61
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents: 16399
diff changeset
62 void
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16420
diff changeset
63 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
64 {
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16420
diff changeset
65 if (obj && instance)
16415
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents: 16399
diff changeset
66 ::error ("octave_link is already linked!");
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents: 16399
diff changeset
67 else
70032fc70bee move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents: 16399
diff changeset
68 instance = obj;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
69 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
70
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
71 void
15371
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
72 octave_link::do_generate_events (void)
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
73 {
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
74 }
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
75
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
76 void
15371
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
77 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
78 {
15371
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
79 event_queue_mutex->lock ();
14875
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14804
diff changeset
80
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
81 gui_event_queue.run ();
15371
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
82
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
83 event_queue_mutex->unlock ();
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
84 }
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
85
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
86 void
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16468
diff changeset
87 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
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 ();
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
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.discard ();
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 ();
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16468
diff changeset
94 }
15371
eec0d1fcba4f use Octave singleton style for octave_link class
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
95
16420
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
96 DEFUN (__octave_link_edit_file__, args, ,
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
97 "-*- texinfo -*-\n\
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
98 @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
99 Undocumented internal function.\n\
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
100 @end deftypefn")
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
101 {
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
102 octave_value retval;
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
103
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
104 if (args.length () == 1)
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
105 {
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
106 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
107
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
108 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
109 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
110 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
111
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
112 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
113 }
16420
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
114 else
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
115 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
116 }
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
117
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
118 return retval;
81ec95768520 use octave-link instead of hook for edit function
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
119 }
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
120
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
121 DEFUN (__octave_link_message_dialog__, args, ,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
122 "-*- texinfo -*-\n\
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
123 @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
124 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
125 @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
126 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
127 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
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 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
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 std::string dlg = args(0).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
132 std::string msg = 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
133 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
134
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
135 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
136 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
137 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
138
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
139 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
140 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
141 else
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
142 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
143 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
144
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
145 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
146 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
147
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
148 DEFUN (__octave_link_list_dialog__, args, ,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
149 "-*- texinfo -*-\n\
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
150 @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
151 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
152 @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
153 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
154 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
155
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
156 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
157 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
158 Cell list = 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
159 const Array<std::string> tlist= list.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
160 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
161 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
162 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
163 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
164
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 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
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 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
168 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
169 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
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 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
172 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
173 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
174 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
175 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
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 std::string name = args(4).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
178 std::string prompt_string = args(5).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
179 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
180 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
181
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
182 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
183 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
184 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
185
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
186 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
187 = octave_link::list_dialog (list_lst, mode, width, height,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
188 initial_lst, name, prompt_string,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
189 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
190
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
191 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
192 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
193 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
194 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
195 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
196 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
197 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
198 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
199 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
200
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
201 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
202 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
203 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
204 else
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
205 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
206 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
207
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
208 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
209 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
210
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
211 DEFUN (__octave_link_input_dialog__, args, ,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
212 "-*- texinfo -*-\n\
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
213 @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
214 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
215 @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
216 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
217 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
218
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
219 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
220 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
221 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
222 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
223 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
224 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
225 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
226 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
227
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
228 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
229
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
230 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
231 nel = rc.rows ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
232 std::list<int> nr;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
233 std::list<int> nc;
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
234 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
235 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
236 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
237 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
238 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
239
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
240 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
241 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
242 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
243 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
244 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
245 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
246
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
247 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
248 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
249 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
250
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
251 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
252 = 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
253 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
254
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
255 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
256 Cell 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
257 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
258 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
259 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
260 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
261 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
262 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
263
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
264 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
265 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
266 else
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
267 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
268 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
269
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16485
diff changeset
270 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
271 }