annotate scripts/plot/util/zoom.m @ 20000:ca7599ae464d

doc: Grammarcheck documentation ahead of 4.0 release. * plot.txi, data.cc, graphics.cc, ordschur.cc, __ilu__.cc, __osmesa_print__.cc, audiodevinfo.cc, soundsc.m, interp2.m, interp3.m, interpn.m, annotation.m, zoom.m: Grammarcheck documentation ahead of 4.0 release.
author Rik <rik@octave.org>
date Fri, 20 Feb 2015 14:26:36 -0800
parents 4197fc428c7d
children 9fc020886ae9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19898
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19864
diff changeset
1 ## Copyright (C) 2014-2015 John W. Eaton
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 ## your option) any later version.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ## General Public License for more details.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
20000
ca7599ae464d doc: Grammarcheck documentation ahead of 4.0 release.
Rik <rik@octave.org>
parents: 19898
diff changeset
20 ## @deftypefn {Command} {} zoom
ca7599ae464d doc: Grammarcheck documentation ahead of 4.0 release.
Rik <rik@octave.org>
parents: 19898
diff changeset
21 ## @deftypefnx {Command} {} zoom (@var{factor})
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
22 ## @deftypefnx {Command} {} zoom on
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
23 ## @deftypefnx {Command} {} zoom off
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
24 ## @deftypefnx {Command} {} zoom xon
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
25 ## @deftypefnx {Command} {} zoom yon
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 ## @deftypefnx {Command} {} zoom out
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 ## @deftypefnx {Command} {} zoom reset
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
28 ## @deftypefnx {Command} {} zoom (@var{hfig}, @var{option})
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
29 ## Zoom the current axes object or control the interactive zoom mode of
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
30 ## a figure in the GUI.
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 ##
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 ## Given a numeric argument greater than zero, zoom by the given factor.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 ## If the zoom factor is greater than one, zoom in on the plot. If the
19417
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
34 ## factor is less than one, zoom out. If the zoom factor is a two- or
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
35 ## three-element vector, then the elements specify the zoom factors for
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
36 ## the x, y, and z axes respectively.
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 ##
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
38 ## Given the option @qcode{"on"} or @qcode{"off"}, set the interactive
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
39 ## zoom mode on or off.
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
40 ##
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
41 ## With no arguments, toggle the current zoom mode on or off.
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
42 ##
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
43 ## Given the option @qcode{"xon"} or @qcode{"yon"}, enable zoom mode
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
44 ## for the x or y axis only.
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
45 ##
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 ## Given the option @qcode{"out"}, zoom to the initial zoom setting.
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 ##
19502
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
48 ## Given the option @qcode{"reset"}, store the current zoom setting so
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
49 ## that @code{zoom out} will return to this zoom level.
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 ##
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
51 ## If the first argument @var{hfig} is a figure, then operate on
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
52 ## the given figure rather than the current figure as returned by
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
53 ## @code{gcf}.
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
54 ##
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 ## @seealso{pan, rotate3d}
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 ## @end deftypefn
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 ## Eventually we need to also support these features:
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 ## @deftypefnx {Command} {zoom_object_handle =} zoom (@var{hfig})
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 function zoom (varargin)
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 hfig = NaN;
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 nargs = nargin;
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 if (nargs > 2)
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 print_usage ();
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
19417
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
71 if (nargin == 1 && nargout > 0 && isfigure (varargin{1}))
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 error ("zoom_object_handle = zoom (hfig): not implemented");
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 if (nargs == 2)
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 hfig = varargin{1};
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 if (isfigure (hfig))
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 varargin(1) = [];
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 nargs--;
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 else
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 error ("zoom: expecting figure handle as first argument");
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 if (isnan (hfig))
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 hfig = gcf ();
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 if (nargs == 0)
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
90 zm = get (hfig, "__zoom_mode__");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
91 if (strcmp (zm.Enable, "on"))
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
92 zm.Enable = "off";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
93 else
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
94 zm.Enable = "on";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
95 endif
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
96 set (hfig, "__zoom_mode__", zm);
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 elseif (nargs == 1)
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 arg = varargin{1};
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 if (isnumeric (arg))
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 factor = arg;
19417
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
101 switch (numel (factor))
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
102 case 2
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
103 xfactor = factor(1);
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
104 yfactor = factor(2);
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
105 case 1
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
106 xfactor = yfactor = factor;
19417
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
107 otherwise
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
108 error ("zoom: invalid factor");
ec037d41da06 zoom: allow x, y, and z axes to be zoomed independently
John W. Eaton <jwe@octave.org>
parents: 19344
diff changeset
109 endswitch
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
110 if (xfactor < 0 || yfactor < 0)
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 error ("zoom: factor must be greater than 1");
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
112 elseif (xfactor == 1 && yfactor == 1)
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 return;
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 cax = get (hfig, "currentaxes");
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 if (! isempty (cax))
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
117 if (xfactor != 1)
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
118 if (yfactor != 1)
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
119 mode = "both";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
120 else
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
121 mode = "horizontal";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
122 endif
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
123 else
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
124 if (yfactor != 1)
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
125 mode = "vertical";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
126 endif
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 endif
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
128 __zoom__ (cax, mode, factor);
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130 elseif (ischar (arg))
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 switch (arg)
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 case {"on", "off", "xon", "yon"}
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
133 zm = get (hfig, "__zoom_mode__");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
134 switch (arg)
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
135 case {"on", "off"}
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
136 zm.Enable = arg;
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
137 zm.Motion = "both";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
138 case "xon"
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
139 zm.Enable = "on";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
140 zm.Motion = "horizontal";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
141 case "yon"
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
142 zm.Enable = "on";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
143 zm.Motion = "vertical";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
144 endswitch
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
145 set (hfig, "__zoom_mode__", zm);
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
146 if (strcmp (arg, "off"))
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
147 set (hfig, "__mouse_mode__", "none");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
148 else
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
149 ## FIXME: Is there a better way other than calling these
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
150 ## functions to set the other mouse mode Enable fields to
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
151 ## "off"?
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
152 pan ("off");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
153 rotate3d ("off");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
154 set (hfig, "__mouse_mode__", "zoom");
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
155 endif
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 case "out"
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 cax = get (hfig, "currentaxes");
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 if (! isempty (cax))
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
160 __zoom__ (cax, "out");
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163 case "reset"
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 cax = get (hfig, "currentaxes");
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 if (! isempty (cax))
19864
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19502
diff changeset
166 __zoom__ (cax, "reset");
19281
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169 otherwise
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 error ("zoom: unrecognized option '%s'", arg);
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 endswitch
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 else
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 error ("zoom: wrong type argument '%s'", class (arg));
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 endif
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176
8a6f87637c16 hg new function, zoom
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 endfunction
19502
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
178
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
179 %!demo
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
180 %! clf;
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
181 %! sombrero ();
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
182 %! pause (1);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
183 %! %% zoom in by a factor of 2
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
184 %! zoom (2);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
185 %! pause (1);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
186 %! %% return to original zoom level
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
187 %! zoom out;
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
188 %! pause (1);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
189 %! %% zoom in by a factor of 2
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
190 %! zoom (2);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
191 %! pause (1);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
192 %! %% set this zoom level as the "initial zoom level"
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
193 %! %% and zoom in some more
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
194 %! zoom reset;
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
195 %! zoom (2);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
196 %! pause (1);
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
197 %! %% return to zoom level set by last call to "zoom reset"
8e1883060940 * zoom.m: Improve documentation. New demo.
John W. Eaton <jwe@octave.org>
parents: 19417
diff changeset
198 %! zoom out;