Mercurial > hg > octave-nkf
annotate scripts/deprecated/mouse_wheel_zoom.m @ 20279:db30302bedc3
Added tag rc-4-0-0-3 for changeset 065f933ef083
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 10 Apr 2015 14:41:21 -0400 |
parents | 47440b762547 |
children |
rev | line source |
---|---|
19965
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2007-2013 Shai Ayal |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 ## @deftypefn {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val}) |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 ## Query or set the mouse wheel zoom factor. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 ## |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 ## The zoom factor is a number in the range (0,1) which is the |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 ## percentage of the current axis limits that will be used when zooming. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 ## For example, if the current x-axis limits are [0, 50] and |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 ## @code{mouse_wheel_zoom} is 0.4 (40%), then a zoom operation will |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 ## change the limits by 20. |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #### @end deftypefn |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 ## Deprecated in 4.0 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 function retval = mouse_wheel_zoom (val) |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 persistent warned = false; |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 if (! warned) |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 warned = true; |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 warning ("Octave:deprecated-function", |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 "mouse_wheel_zoom is obsolete and will be removed from a future version of Octave, please use the mousehweelzoom axes property instead"); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 endif |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 if (nargin != 1) |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 print_usage (); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 endif |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 fig = get (0, "currentfigure"); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 if (isempty (fig)) |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 retval = get (0, "defaultaxesmousewheelzoom"); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 set (0, "defaultaxesmousewheelzoom", val); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 else |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 retval = get (gca, "mousewheelzoom"); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 set (gca, "mousewheelzoom", val); |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 endif |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 endfunction |
47440b762547
bring back mouse_wheel_zoom function as deprecated
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 |