Mercurial > octave
annotate scripts/gui/uigetdir.m @ 30196:813b7827c5f8
Remove "position" argument from file dialog functions (bug #60980).
* libinterp/corefcn/event-manager.cc (F__event_manager_file_dialog__),
libinterp/dldfcn/__fltk_uigetfile (F__fltk_uigetfile__): Remove unused
argument "position".
* scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uiputfile.m,
scripts/gui/private/__uigetdir_fltk__.m,
scripts/gui/private/__uigetfile_fltk__.m,
scripts/gui/private/__uiputfile_fltk__.m: Remove handling argument "position".
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 19 Sep 2021 17:06:26 +0200 |
parents | a7981aa5822b |
children | 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28022
diff
changeset
|
3 ## Copyright (C) 2010-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
11283 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
11283 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
11283 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
11283 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
21 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
11283 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
27 ## @deftypefn {} {@var{dirname} =} uigetdir () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
28 ## @deftypefnx {} {@var{dirname} =} uigetdir (@var{init_path}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
29 ## @deftypefnx {} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name}) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
30 ## Open a GUI dialog for selecting a directory. |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
31 ## |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
32 ## If @var{init_path} is not given the current working directory is used. |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19848
diff
changeset
|
33 ## |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
34 ## @var{dialog_name} may be used to customize the dialog title. |
28022
306df6825dd9
doc: Document return values for uigetdir/uigetfil when 'Cancel' button used (bug #57670).
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
35 ## |
306df6825dd9
doc: Document return values for uigetdir/uigetfil when 'Cancel' button used (bug #57670).
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
36 ## The output @var{dirname} is a character string with the name of the selected |
306df6825dd9
doc: Document return values for uigetdir/uigetfil when 'Cancel' button used (bug #57670).
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
37 ## directory. However, if the @samp{Cancel} button is clicked the output is of |
306df6825dd9
doc: Document return values for uigetdir/uigetfil when 'Cancel' button used (bug #57670).
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
38 ## type double with the value @code{0}. |
15532
95d7475a0a89
doc: Add seealso links between uigetfile, uiputfile, uigetdir.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
39 ## @seealso{uigetfile, uiputfile} |
11283 | 40 ## @end deftypefn |
41 | |
13697
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
42 function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open") |
11283 | 43 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
44 if (! ischar (init_path) || ! ischar (dialog_name)) |
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 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
|
46 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11583
diff
changeset
|
47 |
25781
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
48 if (! isfolder (init_path)) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
49 init_path = fileparts (init_path); |
11283 | 50 endif |
51 | |
30195
a7981aa5822b
event-manager: Add function to signal valid implementation of GUI dialogs (bug #60980).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
52 if (__event_manager_have_dialogs__ ()) |
16655
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
53 file_filter = cell (0, 2); |
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
54 default_file_name = ""; |
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
55 dialog_mode = "dir"; |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
56 |
16655
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
57 [filename, dirname, filterindex] ... |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
58 = __event_manager_file_dialog__ (file_filter, dialog_name, |
30196
813b7827c5f8
Remove "position" argument from file dialog functions (bug #60980).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30195
diff
changeset
|
59 default_file_name, dialog_mode, |
813b7827c5f8
Remove "position" argument from file dialog functions (bug #60980).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30195
diff
changeset
|
60 init_path); |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
61 else |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
62 funcname = __get_funcname__ (mfilename ()); |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
63 dirname = feval (funcname, init_path, dialog_name); |
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
64 endif |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
65 |
11283 | 66 endfunction |
67 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
68 |
11583
c4c2cd67c440
Fixes for ui file functions, bug#32190
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
69 %!demo |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
70 %! uigetdir (pwd, 'Select Directory'); |
13215 | 71 |
72 ## Remove from test statistics. No real tests possible. | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
73 %!assert (1) |