Mercurial > hg > octave-nkf
comparison scripts/plot/util/pan.m @ 19157:137d01e7c2d4
New scripts pan.m and rotate3d.m, update __add_default_menu__.m
* pan.m: New script to control panning mode for GUI
* rotate3d.m: New script to control panning mode for GUI
* __add_default_menu__.m: Update uimenus and callbacks. The menubar items
now sets properties on all axes except legends. It's now possible to
set, for example, the grid for all plots in a subplot.
* findall.m: Update test to reflect change of __add_default_menu__.m
* __unimplemented__.m: remove added pan and rotate3d scripts
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Mon, 28 Jul 2014 22:40:12 +0200 |
parents | |
children | 8a6f87637c16 |
comparison
equal
deleted
inserted
replaced
19156:a0c514c243f6 | 19157:137d01e7c2d4 |
---|---|
1 ## Copyright (C) 2014 Andreas Weber | |
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 -*- | |
20 ## @deftypefn {Command} {} pan | |
21 ## @deftypefnx {Command} {} pan on | |
22 ## @deftypefnx {Command} {} pan xon | |
23 ## @deftypefnx {Command} {} pan yon | |
24 ## @deftypefnx {Command} {} pan off | |
25 ## @deftypefnx {Function File} {} pan (@var{hax}, @dots{}) | |
26 ## Control panning mode of interactive graph in GUI. | |
27 ## | |
28 ## The function state input may be either @qcode{"on"}, @qcode{"xon"}, | |
29 ## @qcode{"yon"} or @qcode{"off"}. | |
30 ## | |
31 ## If it is omitted the current state is toggled (@qcode{"xon"} and | |
32 ## @qcode{"yon"} are treated as @qcode{"on"}). | |
33 ## | |
34 ## @qcode{"xon"} limits panning to the x-axis, @qcode{"yon"} to the | |
35 ## y-axis. | |
36 ## | |
37 ## If the first argument @var{hax} is an axes handle, then operate on | |
38 ## this axis rather than the current axes returned by @code{gca}. | |
39 ## | |
40 ## To query the current mode use the @code{get} | |
41 ## function. For example: | |
42 ## @example | |
43 ## mode = get (gca, "pan"); | |
44 ## @end example | |
45 ## @seealso{rotate3d} | |
46 ## @end deftypefn | |
47 | |
48 function pan (varargin) | |
49 | |
50 if (numel (varargin) > 0 && isaxes (varargin{1})) | |
51 hax = varargin{1}; | |
52 varargin(1) = []; | |
53 else | |
54 hax = gca (); | |
55 endif | |
56 | |
57 toolkit = get (ancestor (hax, "figure"), "__graphics_toolkit__"); | |
58 if (! strcmp (toolkit, "fltk")) | |
59 warning ("pan: Only implemented for graphics_toolkit FLTK"); | |
60 endif | |
61 | |
62 if (numel (varargin) > 1) | |
63 print_usage (); | |
64 elseif (numel (varargin) == 0) | |
65 # toggle | |
66 m = get (hax, "pan"); | |
67 if (findstr (m, "on") > 0) | |
68 set (hax, "pan", "off"); | |
69 else | |
70 set (hax, "pan", "on"); | |
71 endif | |
72 elseif (numel (varargin) == 1) | |
73 set (hax, "pan", varargin{1}); | |
74 endif | |
75 | |
76 endfunction | |
77 |