annotate scripts/gui/uigetfile.m @ 21171:2935d56203a4 stable

Fix regressions caused by ismatrix definition change (partial fix bug #47036). * inputdlg.m: Test that linespec isnumeric. * uigetfile.m: Check that position property value isnumeric. * fminunc.m: Check that x0 isnumeric. * fsolve.m: Check that x0 isnumeric. * lsqnonneg.m: Check that inputs C & D are both isnumeric and ismatrix. * pqpnonneg.m: Check that inputs C & D are both isnumeric and ismatrix. * bicg.m: Check input A issquare. Rephrase error messages. * bicgstab.m: Check input A issquare. Rephrase error messages. * cgs.m: Check input A issquare. Rephrase error messages. * gmres.m: Check input A issquare. Rephrase error messages. Change BIST test to match new error message. * qmr.m: Check input A issquare. Rephrase error messages. * spconvert.m: Check nargin first. Simplify input validation. Wrap long error message to < 80 chars. * treeplot.m: Simplify input validation.
author Rik <rik@octave.org>
date Mon, 01 Feb 2016 22:59:43 -0800
parents 777f26aa8e3e
children 3be6a07e8bad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
1 ## Copyright (C) 2010-2015 Kai Habel
11283
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
2 ##
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
3 ## This file is part of Octave.
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
4 ##
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
8 ## your option) any later version.
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
9 ##
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
13 ## General Public License for more details.
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
14 ##
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
18
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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}.
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
diff changeset
29 ##
11283
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
30 ## @var{flt} contains a (list of) file filter string(s) in one of the following
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
31 ## formats:
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19848
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: 19848
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
48 ## The filter string can also contain a semicolon separated list of filter
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
52 ## @end table
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
53 ##
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
54 ## @var{dialog_name} can be used to customize the dialog title.
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19848
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
65 ## @end deftypefn
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
66
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
67 ## Author: Kai Habel
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
68
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
69 function [retfile, retpath, retindex] = uigetfile (varargin)
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
73 endif
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
74
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
diff changeset
75 ## Preset default values
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
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: 19799
diff changeset
77 "Open File", # Dialog Title
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
diff changeset
78 "", # Default file name
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
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: 19799
diff changeset
80 "off", # MultiSelect on/off
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
106 endif
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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}))
19751
70380bb91b81 uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents: 19697
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: 19697
diff changeset
132 fdir = args{3};
70380bb91b81 uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents: 19697
diff changeset
133 fname = fext = "";
70380bb91b81 uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents: 19697
diff changeset
134 else
70380bb91b81 uigetfile.m: Don't start in directory one above the requested directory.
Rik <rik@octave.org>
parents: 19697
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: 19697
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)
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
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"))
21171
2935d56203a4 Fix regressions caused by ismatrix definition change (partial fix bug #47036).
Rik <rik@octave.org>
parents: 20173
diff changeset
160 if (isnumeric (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
19848
9b7ca334a104 Backout cset a9952a647d52 and use __octave_link_enabled__ rather than isguirunning.
Rik <rik@octave.org>
parents: 19833
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
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19799
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
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
184 endfunction
58f175d39a7a GUI file functions
Kai Habel <kai.habel@gmx.de>
parents:
diff changeset
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
cb8fd692b600 Add tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 12642
diff changeset
189
cb8fd692b600 Add tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 12642
diff changeset
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