Mercurial > hg > octave-nkf
annotate scripts/gui/uigetfile.m @ 20410:d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
* NEWS: Announce switch from decimal to octal MODE for mkfifo.
* file-io.cc (convert): Add a FIXME note that this function is repeated in
* syscalls.cc.
* syscalls.cc (convert): New function to convert from one base to another.
* syscalls.cc (Fmkfifo): Change docstring to note that MODE argument is now
octal. Convert MODE from octal to decimal before calling octave_mkfifo().
Add BIST tests.
* __gnuplot_get_var__.m, __gnuplot_ginput__.m: Change instances of MODE
argument in m-files from decimal to octal.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 17 May 2015 10:04:08 -0700 |
parents | 777f26aa8e3e |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19793
diff
changeset
|
1 ## Copyright (C) 2010-2015 Kai Habel |
11283 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uigetfile () |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
21 ## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
22 ## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}) |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
23 ## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}, @var{default_file}) |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12522
diff
changeset
|
24 ## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "Position", [@var{px} @var{py}]) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
25 ## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "MultiSelect", @var{mode}) |
11283 | 26 ## |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
27 ## Open a GUI dialog for selecting a file and return the filename @var{fname}, |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
28 ## the path to this file @var{fpath}, and the filter index @var{fltidx}. |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
29 ## |
11283 | 30 ## @var{flt} contains a (list of) file filter string(s) in one of the following |
31 ## formats: | |
32 ## | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
33 ## @table @asis |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
34 ## @item @qcode{"/path/to/filename.ext"} |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
35 ## If a filename is given then the file extension is extracted and used as |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
36 ## filter. In addition, the path is selected as current path and the filename |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
37 ## is selected as default file. Example: @code{uigetfile ("myfun.m")} |
11283 | 38 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
39 ## @item A single file extension @qcode{"*.ext"} |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
40 ## Example: @code{uigetfile ("*.ext")} |
11283 | 41 ## |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
42 ## @item A 2-column cell array |
20383
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
20053
diff
changeset
|
43 ## containing a file extension in the first column and a brief description in |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
20053
diff
changeset
|
44 ## the second column. |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
45 ## Example: @code{uigetfile (@{"*.ext", "My Description";"*.xyz", |
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
46 ## "XYZ-Format"@})} |
11583
c4c2cd67c440
Fixes for ui file functions, bug#32190
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
47 ## |
11283 | 48 ## The filter string can also contain a semicolon separated list of filter |
49 ## extensions. | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
50 ## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture |
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
51 ## Formats"@})} |
11283 | 52 ## @end table |
53 ## | |
54 ## @var{dialog_name} can be used to customize the dialog title. | |
20383
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
20053
diff
changeset
|
55 ## |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
56 ## If @var{default_file} is given then it will be selected in the GUI dialog. |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
57 ## If, in addition, a path is given it is also used as current path. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11583
diff
changeset
|
58 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
59 ## The screen position of the GUI dialog can be set using the |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
60 ## @qcode{"Position"} key and a 2-element vector containing the pixel |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
61 ## coordinates. Two or more files can be selected when setting the |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
62 ## @qcode{"MultiSelect"} key to @qcode{"on"}. In that case @var{fname} is a |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16580
diff
changeset
|
63 ## cell array containing the files. |
15532
95d7475a0a89
doc: Add seealso links between uigetfile, uiputfile, uigetdir.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
64 ## @seealso{uiputfile, uigetdir} |
11283 | 65 ## @end deftypefn |
66 | |
67 ## Author: Kai Habel | |
68 | |
69 function [retfile, retpath, retindex] = uigetfile (varargin) | |
70 | |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
71 if (nargin > 7) |
11295
75ff3db6a687
Simplify code for uimenu.m. Fix error messages for ui file functions.
Kai Habel <kai.habel@gmx.de>
parents:
11284
diff
changeset
|
72 error ("uigetfile: number of input arguments must be less than eight"); |
11283 | 73 endif |
74 | |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
75 ## Preset default values |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
76 outargs = {cell(0, 2), # File Filter |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
77 "Open File", # Dialog Title |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
78 "", # Default file name |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
79 [240, 120], # Dialog Position (pixel x/y) |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
80 "off", # MultiSelect on/off |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
81 pwd}; # Default directory |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
82 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
83 idx1 = idx2 = []; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
84 if (length (varargin) > 0) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
85 for i = 1 : length (varargin) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
86 val = varargin{i}; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
87 if (ischar (val)) |
14225
f0d903879eaa
Replace unnecessary strcmpi calls with strcmp.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
88 val = tolower (val); |
17405
3f0ed69d21c6
Replace unnecessary instances of strncmp with strcmp.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
89 if (strcmp (val, "multiselect")) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
90 idx1 = i; |
17405
3f0ed69d21c6
Replace unnecessary instances of strncmp with strcmp.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
91 elseif (strcmp (val, "position")) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
92 idx2 = i; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
93 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
94 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
95 endfor |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
96 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
97 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
98 stridx = [idx1, idx2, 0]; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
99 if (length (stridx) > 1) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
100 stridx = min (stridx(1 : end - 1)); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
101 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
102 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
103 args = varargin; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
104 if (stridx) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
105 args = varargin(1 : stridx - 1); |
11283 | 106 endif |
107 | |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
108 len = length (args); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
109 if (len > 0) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
110 file_filter = args{1}; |
13697
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
111 [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter); |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
112 if (length (defdir) > 0) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
113 outargs{6} = defdir; |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
114 endif |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
115 else |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
116 outargs{1} = __file_filter__ (outargs{1}); |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
117 endif |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
118 |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
119 if (len > 1) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
120 if (ischar (args{2})) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
121 if (length (args{2}) > 0) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
122 outargs{2} = args{2}; |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
123 endif |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
124 elseif (! isempty (args{2})) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
125 print_usage (); |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
126 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
127 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
128 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
129 if (len > 2) |
13697
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
130 if (ischar (args{3})) |
19956
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
131 if (isdir (args{3})) |
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
132 fdir = args{3}; |
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
133 fname = fext = ""; |
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
134 else |
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
135 [fdir, fname, fext] = fileparts (varargin{3}); |
70380bb91b81
uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
136 endif |
13697
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
137 if (length (fdir) > 0) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
138 outargs{6} = fdir; |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
139 endif |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
140 if (length (fname) > 0 || length (fext) > 0) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
141 outargs{3} = strcat (fname, fext); |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
142 endif |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
143 elseif (! isempty (args{3})) |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
144 print_usage (); |
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
145 endif |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
146 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
147 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
148 if (stridx) |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
149 ## string arguments ("position" or "multiselect") |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
150 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
151 ## check for even number of remaining arguments, prop/value pair(s) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
152 if (rem (nargin - stridx + 1, 2)) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
153 error ("uigetfile: expecting property/value pairs"); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
154 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
155 |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
156 for i = stridx : 2 : nargin |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
157 prop = varargin{i}; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
158 val = varargin{i + 1}; |
17405
3f0ed69d21c6
Replace unnecessary instances of strncmp with strcmp.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
159 if (strcmpi (prop, "position")) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14363
diff
changeset
|
160 if (ismatrix (val) && length (val) == 2) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
161 outargs{4} = val; |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
162 else |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
163 error ("uigetfile: expecting 2-element vector for position argument"); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
164 endif |
17408
266fafd1ffc1
fix 2 strcmp<->strncmp issues from 3f0ed69d21c6
Andreas Weber <andreas.weber@hs-offenburg.de>
parents:
17405
diff
changeset
|
165 elseif (strcmpi (prop, "multiselect")) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
166 if (ischar (val)) |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
167 outargs{5} = tolower (val); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
168 else |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
169 error ("uigetfile: expecting string argument (on/off) for multiselect"); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
170 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
171 else |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
172 error ("uigetfile: unknown argument"); |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
173 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
174 endfor |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
175 endif |
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
176 |
20053
9b7ca334a104
Backout cset a9952a647d52 and use __octave_link_enabled__ rather than isguirunning.
Rik <rik@octave.org>
parents:
20038
diff
changeset
|
177 if (__octave_link_enabled__ ()) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
178 [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:}); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
179 else |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20004
diff
changeset
|
180 funcname = __get_funcname__ (mfilename ()); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
181 [retfile, retpath, retindex] = feval (funcname, outargs{:}); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
182 endif |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
183 |
11283 | 184 endfunction |
185 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14225
diff
changeset
|
186 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11583
diff
changeset
|
187 %!demo |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
188 %! uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'}); |
13215 | 189 |
190 ## Remove from test statistics. No real tests possible. | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
191 %!assert (1) |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14225
diff
changeset
|
192 |