Mercurial > octave
annotate scripts/gui/uigetdir.m @ 27923:bd51beb6205e
update formatting of copyright notices
* Use <https://octave.org/copyright/> instead of
<https://octave.org/COPYRIGHT.html/>.
* For consistency with other comments in the Octave sources, use
C++-style comments for copyright blocks in C and C++ files.
* Use delimiters above and below copyright blocks that are appropriate
for the language used in the file.
* Eliminate extra spacing inside copyright blocks.
* lex.ll (looks_like_copyright): Also allow newlines and carriage
returns before the word "Copyright".
* scripts/mk-doc.pl (gethelp): Also skip empty comment lines.
* bp-table.cc, type.m: Adjust tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jan 2020 11:59:41 -0500 |
parents | 1891570abac8 |
children | a4268efb7334 |
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 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2010-2020 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. |
15532
95d7475a0a89
doc: Add seealso links between uigetfile, uiputfile, uigetdir.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
35 ## @seealso{uigetfile, uiputfile} |
11283 | 36 ## @end deftypefn |
37 | |
38 ## Author: Kai Habel | |
39 | |
13697
0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13215
diff
changeset
|
40 function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open") |
11283 | 41 |
42 if (nargin > 2) | |
43 print_usage (); | |
44 endif | |
45 | |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
46 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
|
47 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
|
48 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11583
diff
changeset
|
49 |
25781
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
50 if (! isfolder (init_path)) |
12522
33bbae85769a
Add uimenu, uigetdir, uigetfile, and uiputfile to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12183
diff
changeset
|
51 init_path = fileparts (init_path); |
11283 | 52 endif |
53 | |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
54 if (__event_manager_enabled__ ()) |
16655
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
55 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
|
56 default_file_name = ""; |
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
57 dialog_position = [240, 120]; |
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
58 dialog_mode = "dir"; |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
59 |
16655
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
60 [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
|
61 = __event_manager_file_dialog__ (file_filter, dialog_name, |
16655
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
62 default_file_name, dialog_position, |
8fa0b416f465
* uigetdir.m: Eliminate unnecessary cell array for function args.
John W. Eaton <jwe@octave.org>
parents:
16654
diff
changeset
|
63 dialog_mode, init_path); |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
64 else |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
65 funcname = __get_funcname__ (mfilename ()); |
16654
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
66 dirname = feval (funcname, init_path, dialog_name); |
510b711f4e31
Added uigetdir to octave_link
John Donoghue <john.donoghue@ieee.org>
parents:
15532
diff
changeset
|
67 endif |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19799
diff
changeset
|
68 |
11283 | 69 endfunction |
70 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
71 |
11583
c4c2cd67c440
Fixes for ui file functions, bug#32190
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
72 %!demo |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
73 %! uigetdir (pwd, 'Select Directory'); |
13215 | 74 |
75 ## 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
|
76 %!assert (1) |