Mercurial > hg > octave-lyh
annotate scripts/plot/fill.m @ 16581:fa4a035e0cf4
Add octave_link uiputfile implementation
* libgui/src/dialog.cc, libgui/src/dialog.h
(FileDialog::FileDialog): Change bool multiselect to QString multimode, add mode option of 'create' and set options accordingly.
(QUIWidgetCreator::signal_filedialog): Change bool multiselect to QString multimode.
(QUIWidgetCreator::create_filedialog): Change bool multiselect to QString multimode.
* libgui/src/main-window.cc, libgui/src/main-window.h
(main_window::connect_uiwidget_links): update bool multiselect to QString multimode.
(main_window::handle_create_filedialog): update bool multiselect to QString multimode.
* libgui/src/octave-qt-link.h
(octave_qt_link::do_file_dialog): update bool multiselect to std::string multimode.
* libinterp/interpfcn/octave-link.h
(octave_link::do_file_dialog): update bool multiselect to std::string multimode.
(octave_link::file_dialog): update bool multiselect to std::string multimode.
* scripts/plot/uiputfile.m
(uiputfile): update to call __octave_link_file_dialog__ if octave_link is present.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 28 Apr 2013 17:00:00 -0400 |
parents | 11949c9795a0 |
children | 806f48d8a577 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14001
diff
changeset
|
1 ## Copyright (C) 2007-2012 David Bateman |
7020 | 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 -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} fill (@var{x}, @var{y}, @var{c}) |
7020 | 21 ## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2}) |
22 ## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val}) | |
23 ## @deftypefnx {Function File} {} fill (@var{h}, @dots{}) | |
7650 | 24 ## @deftypefnx {Function File} {@var{h} =} fill (@dots{}) |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
25 ## Create one or more filled patch objects. |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
26 ## |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
27 ## The optional return value @var{h} is an array of graphics handles to |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
28 ## the created patch objects. |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
29 ## @seealso{patch} |
7020 | 30 ## @end deftypefn |
31 | |
7216 | 32 function retval = fill (varargin) |
7020 | 33 |
7215 | 34 [h, varargin] = __plt_get_axis_arg__ ("fill", varargin{:}); |
7216 | 35 |
7020 | 36 htmp = []; |
7215 | 37 iargs = __find_patches__ (varargin{:}); |
7216 | 38 |
7215 | 39 oldh = gca (); |
40 unwind_protect | |
41 axes (h); | |
7020 | 42 |
11306
262c365eb71c
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11149
diff
changeset
|
43 nextplot = get (h, "nextplot"); |
7020 | 44 for i = 1 : length (iargs) |
11325
56c8a00a269f
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11306
diff
changeset
|
45 if (i > 1 && strncmp (nextplot, "replace", 7)) |
56c8a00a269f
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11306
diff
changeset
|
46 set (h, "nextplot", "add"); |
56c8a00a269f
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11306
diff
changeset
|
47 endif |
7020 | 48 if (i == length (iargs)) |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
49 args = varargin(iargs(i):end); |
7020 | 50 else |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
51 args = varargin(iargs(i):iargs(i+1)-1); |
7020 | 52 endif |
7041 | 53 newplot (); |
7215 | 54 [tmp, fail] = __patch__ (h, args{:}); |
7020 | 55 if (fail) |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
56 print_usage (); |
7020 | 57 endif |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
58 htmp(end + 1, 1) = tmp; |
7020 | 59 endfor |
11306
262c365eb71c
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11149
diff
changeset
|
60 if (strncmp (nextplot, "replace", 7)) |
262c365eb71c
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11149
diff
changeset
|
61 set (h, "nextplot", nextplot); |
262c365eb71c
fill.m: Allow multiple filled polygons.
Ben Abbott <bpabbott@mac.com>
parents:
11149
diff
changeset
|
62 endif |
7215 | 63 unwind_protect_cleanup |
64 axes (oldh); | |
65 end_unwind_protect | |
66 | |
7020 | 67 if (nargout > 0) |
7216 | 68 retval = htmp; |
7020 | 69 endif |
7215 | 70 |
7020 | 71 endfunction |
72 | |
73 function iargs = __find_patches__ (varargin) | |
74 iargs = []; | |
75 i = 1; | |
76 while (i < nargin) | |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
77 iargs(end + 1) = i; |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7650
diff
changeset
|
78 if (ischar (varargin{i}) |
10549 | 79 && (strcmpi (varargin{i}, "faces") |
80 || strcmpi (varargin{i}, "vertices"))) | |
7020 | 81 i += 4; |
7208 | 82 elseif (isnumeric (varargin{i})) |
7020 | 83 i += 2; |
84 endif | |
85 | |
86 if (i <= nargin) | |
87 while (true); | |
11149
fe3c3dfc07eb
style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents:
10793
diff
changeset
|
88 if (ischar (varargin{i}) |
fe3c3dfc07eb
style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents:
10793
diff
changeset
|
89 && (strcmpi (varargin{i}, "faces") |
fe3c3dfc07eb
style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents:
10793
diff
changeset
|
90 || strcmpi (varargin{i}, "vertices"))) |
10549 | 91 break; |
92 elseif (isnumeric (varargin{i})) | |
93 ## Assume its the colorspec | |
94 i++; | |
95 break; | |
96 elseif (ischar (varargin{i})) | |
97 colspec = tolower (varargin{i}); | |
98 collen = length (colspec); | |
14230
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
99 if (any (strncmp (colspec, |
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
100 {"blue", "black", "k", "red", "green", ... |
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
101 "yellow", "magenta", "cyan", "white"}, |
fe65588c31b8
fill.m: Return column vector of graphics handles
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
102 collen))) |
10549 | 103 i++; |
104 break; | |
105 endif | |
106 else | |
107 i += 2; | |
108 endif | |
7020 | 109 endwhile |
110 endif | |
111 endwhile | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14230
diff
changeset
|
112 |
7020 | 113 endfunction |
114 | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
115 |
7020 | 116 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14230
diff
changeset
|
117 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14230
diff
changeset
|
118 %! t1 = (1/16:1/8:1) * 2*pi; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14230
diff
changeset
|
119 %! t2 = ((1/16:1/8:1) + 1/32) * 2*pi; |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
120 %! x1 = sin (t1) - 0.8; |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
121 %! y1 = cos (t1); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
122 %! x2 = sin (t2) + 0.8; |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
123 %! y2 = cos (t2); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
124 %! h = fill (x1,y1,'r', x2,y2,'g'); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
125 |