annotate libinterp/dldfcn/__fltk_uigetfile__.cc @ 19895:19755f4fc851

maint: Cleanup C++ code to follow Octave coding conventions. Try to wrap long lines to < 80 characters. Use GNU style and don't indent first brace of function definition. "case" statement is aligned flush left with brace of switch stmt. Remove trailing '\' line continuation from the end of #define macros. Use 2 spaces for indent. * files-dock-widget.cc, history-dock-widget.cc, main-window.cc, octave-cmd.cc, octave-dock-widget.cc, octave-gui.cc, resource-manager.cc, settings-dialog.cc, shortcut-manager.cc, welcome-wizard.cc, workspace-view.cc, cellfun.cc, data.cc, debug.cc, debug.h, dirfns.cc, error.h, file-io.cc, gl-render.cc, gl-render.h, gl2ps-renderer.h, graphics.cc, graphics.in.h, help.cc, input.cc, load-path.cc, load-path.h, lookup.cc, lu.cc, oct-stream.cc, octave-default-image.h, ordschur.cc, pr-output.cc, qz.cc, strfns.cc, symtab.cc, symtab.h, sysdep.cc, variables.cc, zfstream.h, __fltk_uigetfile__.cc, __init_fltk__.cc, __magick_read__.cc, __osmesa_print__.cc, audiodevinfo.cc, ov-classdef.cc, ov-classdef.h, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-java.cc, ov-range.cc, ov-re-mat.cc, ov-usr-fcn.h, ov.cc, op-int.h, options-usage.h, pt-eval.cc, Array-C.cc, Array-fC.cc, Array.cc, Array.h, PermMatrix.cc, Sparse.cc, chMatrix.h, dSparse.cc, dim-vector.h, bsxfun-decl.h, bsxfun-defs.cc, oct-norm.cc, Sparse-op-defs.h, oct-inttypes.cc, oct-inttypes.h, main.in.cc, mkoctfile.in.cc: Cleanup C++ code to follow Octave coding conventions.
author Rik <rik@octave.org>
date Wed, 25 Feb 2015 11:55:49 -0800
parents 4197fc428c7d
children d575cd1e0da7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
1 /*
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 18410
diff changeset
3 Copyright (C) 2010-2015 Kai Habel
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
4
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
5 This file is part of Octave.
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
6
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
10 option) any later version.
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
11
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
15 for more details.
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
16
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
20
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
21 */
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
22
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
24 #include <config.h>
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
25 #endif
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
26
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
27 #ifdef HAVE_FLTK
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
28
13721
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12805
diff changeset
29 #ifdef WIN32
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12805
diff changeset
30 #define WIN32_LEAN_AND_MEAN
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12805
diff changeset
31 #endif
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12805
diff changeset
32
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
33 #include <FL/Fl.H>
12565
0f71b9639207 Correct typo in #include path for FLTK header files (bug #32972).
Rik <octave@nomad.inbox5.com>
parents: 12466
diff changeset
34 #include <FL/Fl_File_Chooser.H>
12205
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
35
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
36 // FLTK headers may include X11/X.h which defines Complex, and that
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
37 // conflicts with Octave's Complex typedef. We don't need the X11
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
38 // Complex definition in this file, so remove it before including Octave
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
39 // headers which may require Octave's Complex typedef.
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
40 #undef Complex
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12193
diff changeset
41
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
42 #endif
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
43
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
44 #include "defun-dld.h"
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
45 #include "file-ops.h"
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
46
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
47 DEFUN_DLD (__fltk_uigetfile__, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
48 "-*- texinfo -*-\n\
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
49 @deftypefn {Built-in Function} {} __fltk_uigetfile__ (@dots{})\n\
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
50 Undocumented internal function.\n\
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
51 @end deftypefn")
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
52 {
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
53 #ifdef HAVE_FLTK
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
54 // Expected argument list:
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
55 //
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
56 // args(0) ... FileFilter in fltk format
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
57 // args(1) ... Title
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
58 // args(2) ... Default Filename
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
59 // args(3) ... PostionValue [x,y]
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
60 // args(4) ... SelectValue "on"/"off"/"dir"/"create"
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
61
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
62 octave_value_list retval (3, octave_value (0));
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
63
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
64 std::string file_filter = args(0).string_value ();
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
65 std::string title = args(1).string_value ();
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
66 std::string default_name = args(2).string_value ();
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
67 Matrix pos = args(3).matrix_value ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
68
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
69 int multi_type = Fl_File_Chooser::SINGLE;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
70 std::string flabel = "Filename:";
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
71
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
72 std::string multi = args(4).string_value ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
73 if (multi == "on")
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
74 multi_type = Fl_File_Chooser::MULTI;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
75 else if (multi == "dir")
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
76 {
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
77 multi_type = Fl_File_Chooser::DIRECTORY;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
78 flabel = "Directory:";
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
79 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
80 else if (multi == "create")
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
81 multi_type = Fl_File_Chooser::CREATE;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
82
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
83 Fl_File_Chooser::filename_label = flabel.c_str ();
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
84
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
85 Fl_File_Chooser fc (default_name.c_str (), file_filter.c_str (),
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
86 multi_type, title.c_str ());
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
87
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
88 fc.preview (0);
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
89
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
90 if (multi_type == Fl_File_Chooser::CREATE)
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
91 fc.ok_label ("Save");
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
92
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
93 fc.show ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
94
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
95 while (fc.shown ())
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
96 Fl::wait ();
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
97
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
98 if (fc.value ())
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
99 {
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
100 int file_count = fc.count ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
101 std::string fname;
12466
67f98480b181 Use / for fltk path processing only
Kai Habel <kai.habel@gmx.de>
parents: 12206
diff changeset
102
67f98480b181 Use / for fltk path processing only
Kai Habel <kai.habel@gmx.de>
parents: 12206
diff changeset
103 //fltk uses forward slash even for windows
67f98480b181 Use / for fltk path processing only
Kai Habel <kai.habel@gmx.de>
parents: 12206
diff changeset
104 std::string sep = "/";
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
105 std::size_t idx;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
106
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
107 if (file_count == 1 && multi_type != Fl_File_Chooser::DIRECTORY)
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
108 {
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
109 fname = fc.value ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
110 idx = fname.find_last_of (sep);
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
111 retval(0) = fname.substr (idx + 1);
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
112 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
113 else
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
114 {
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
115 Cell file_cell = Cell (file_count, 1);
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
116 for (octave_idx_type n = 1; n <= file_count; n++)
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
117 {
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
118 fname = fc.value (n);
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
119 idx = fname.find_last_of (sep);
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
120 file_cell(n - 1) = fname.substr (idx + 1);
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
121 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
122 retval(0) = file_cell;
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
123 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
124
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
125 if (multi_type == Fl_File_Chooser::DIRECTORY)
18410
073fbe7e6a3a Use native separatos in __fltk_getfile__
John Donoghue <john.donoghue@ieee.org>
parents: 17787
diff changeset
126 retval(0) = file_ops::native_separator_path (std::string (fc.value ()));
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
127 else
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
128 {
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19731
diff changeset
129 retval(1) = file_ops::native_separator_path (
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19731
diff changeset
130 std::string (fc.directory ()) + sep);
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
131 retval(2) = fc.filter_value () + 1;
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
132 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
133 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
134
12206
6212f303243e __fltk_uigetfile__.cc: style fixes
John W. Eaton <jwe@octave.org>
parents: 12205
diff changeset
135 fc.hide ();
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
136 Fl::flush ();
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
137
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
138 return retval;
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
139 #else
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
140 error ("__fltk_uigetfile__: not available without OpenGL and FLTK libraries");
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
141 return octave_value ();
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15195
diff changeset
142 #endif
12183
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
143 }
b4d26c65e7e6 Allow ui file function to work if gnuplot is the selected toolkit and fltk is available
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
144
12805
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 12565
diff changeset
145 /*
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 12565
diff changeset
146 ## No test needed for internal helper function.
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 12565
diff changeset
147 %!assert (1)
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 12565
diff changeset
148 */
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 12565
diff changeset
149