Mercurial > octave-nkf
comparison scripts/plot/util/private/__add_default_menu__.m @ 18995:52e01aa1fe8b
Overhaul FLTK pan, rotate, zoom
* graphics.in.h: add axes properties pan, rotate3d, mouse_wheel_zoom
and custom set_pan which disables rotate3d.
* graphics.cc: add custom set_rotate3d and link with pan property.
Disable rotate3d for 2D plots.
* __init_fltk__.cc: replace gui_mode and mouse_wheel_zoom with axes
properties pan, rotate3d and mouse_wheel_zoom. Disable pan for legends,
move them instead.
* __add_default_menu__.m: Add new menu entries for new pan and zoom modes.
* findall.m: Update test for added uimenus.
Each axes now has its own properties for interactive GUI control of pan,
rotate3d and mouse_wheel_zoom. Now it's possible to have several figures
and set pan for the 2D plot in figure x and rotate3d for the 3D plot in
figure y. There are two new pan modes: "Pan x only" and "Pan y only".
The toolbar buttons "P" and "R" set pan and rotate3d for the last clicked axes
object or the object below the center of the canvas if none was clicked yet.
The legend can now be moved with the mouse.
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Sun, 27 Jul 2014 22:31:14 +0200 |
parents | c9f960441513 |
children | 137d01e7c2d4 |
comparison
equal
deleted
inserted
replaced
18993:4c45986a278e | 18995:52e01aa1fe8b |
---|---|
42 __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off", | 42 __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off", |
43 "tag", "__default_menu__"); | 43 "tag", "__default_menu__"); |
44 uimenu (__e, "label", "&Grid", "callback", @grid_cb); | 44 uimenu (__e, "label", "&Grid", "callback", @grid_cb); |
45 uimenu (__e, "label", "Auto&scale", "callback", @autoscale_cb); | 45 uimenu (__e, "label", "Auto&scale", "callback", @autoscale_cb); |
46 gm = uimenu (__e, "label", "GUI &Mode"); | 46 gm = uimenu (__e, "label", "GUI &Mode"); |
47 uimenu (gm, "label", "Pan+Zoom", "callback", @guimode_cb); | 47 uimenu (gm, "label", "Pan x and y", "tag", "pan_on", "callback", @guimode_cb); |
48 uimenu (gm, "label", "Rotate+Zoom", "callback", @guimode_cb); | 48 uimenu (gm, "label", "Pan x only", "tag", "pan_xon", "callback", @guimode_cb); |
49 uimenu (gm, "label", "None+Zoom", "callback", @guimode_cb); | 49 uimenu (gm, "label", "Pan y only", "tag", "pan_yon", "callback", @guimode_cb); |
50 uimenu (gm, "label", "Rotate on", "tag", "rotate3d", "callback", @guimode_cb); | |
51 uimenu (gm, "label", "Enable mousezoom", "tag", "zoom_on", "callback", @guimode_cb); | |
52 uimenu (gm, "label", "Disable mousezoom", "tag", "zoom_off", "callback", @guimode_cb); | |
50 | 53 |
51 endif | 54 endif |
52 | 55 |
53 endfunction | 56 endfunction |
54 | 57 |
88 function autoscale_cb (h, e) | 91 function autoscale_cb (h, e) |
89 axis ("auto"); | 92 axis ("auto"); |
90 endfunction | 93 endfunction |
91 | 94 |
92 function guimode_cb (h, e) | 95 function guimode_cb (h, e) |
93 lbl = get (h, "label"); | 96 id = get (h, "tag"); |
94 switch (lbl) | 97 switch (id) |
95 case "Pan+Zoom" | 98 case "pan_on" |
96 gui_mode ("2D"); | 99 set (gco, "pan", "on"); |
97 case "Rotate+Zoom" | 100 case "pan_xon" |
98 gui_mode ("3D"); | 101 set (gco, "pan", "xon"); |
99 case "None" | 102 case "pan_yon" |
100 gui_mode ("None"); | 103 set (gco, "pan", "yon"); |
104 case "rotate3d" | |
105 set (gco, "rotate3d", "on"); | |
106 case "no_pan_rotate" | |
107 set (gco, "pan", "off"); | |
108 set (gco, "rotate3d", "off"); | |
109 case "zoom_on" | |
110 set (gco, "mouse_wheel_zoom", 0.05); | |
111 case "zoom_off" | |
112 set (gco, "mouse_wheel_zoom", 0.0); | |
101 endswitch | 113 endswitch |
102 endfunction | 114 endfunction |
103 |