Mercurial > hg > octave-lyh
annotate scripts/plot/uigetdir.m @ 11540:b0ef6f28e09a
deprecate krylovb function
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 15 Jan 2011 03:40:32 -0500 |
parents | fd0a3ac60b0e |
children | 3c6e8aaa9555 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2010-2011 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 -*- | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
20 ## @deftypefn {Function File} {@var{dirname} =} uigetdir () |
11283 | 21 ## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}) |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name}) |
11283 | 23 ## Open a GUI dialog to select a directory. If @var{init_path} is not given |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
24 ## the current working directory is used. @var{dialog_name} optionally be used to |
11283 | 25 ## customize the dialog title. |
26 ## @end deftypefn | |
27 | |
28 ## Author: Kai Habel | |
29 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
30 function dirname = uigetdir (init_path = pwd, dialog_name = "Choose directory?") |
11283 | 31 |
32 if (nargin > 2) | |
33 print_usage (); | |
34 endif | |
35 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
36 if (!ischar(init_path) || !ischar(name)) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
37 error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments"); |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
38 endif |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
39 |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
40 |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
41 if (any (strcmp (available_backends(), "fltk"))) |
11289 | 42 if (!isdir (init_path)) |
43 init_path = fileparts (init_path); | |
44 endif | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
45 dirname = __fltk_uigetfile__ ("", dialog_name, init_path, [240, 120], "dir"); |
11283 | 46 else |
11295
75ff3db6a687
Simplify code for uimenu.m. Fix error messages for ui file functions.
Kai Habel <kai.habel@gmx.de>
parents:
11289
diff
changeset
|
47 error ("uigetdir: fltk backend required."); |
11283 | 48 endif |
49 | |
50 endfunction | |
51 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
11295
diff
changeset
|
52 |
11283 | 53 %!demo |
54 %! uigetdir(pwd, "Select Directory") |