# HG changeset patch # User Jordi Gutiérrez Hermoso
# Date 1282804596 18000 # Node ID db1bc83879ff9bf3f25ecf54c504e50f9caae65f # Parent da90c16fbe8471f91a4cd53e4a9e6b99e404f26b Improvements to FLTK backend rotation * Don't rotate past the top and bottom * Implement __calc_dimensions__ in C++ so that it's available to graphics object ctors * Make rotation the default mode in 3d plots * Replace an instance of m-script __calc_dimensions__ with C++ version diff -r da90c16fbe84 -r db1bc83879ff scripts/ChangeLog --- a/scripts/ChangeLog Wed Aug 25 12:36:23 2010 -0400 +++ b/scripts/ChangeLog Thu Aug 26 01:36:36 2010 -0500 @@ -1,3 +1,10 @@ +2010-08-27 Jordi Gutiérrez Hermoso + + * plot/__go_draw_axes__.m: Remove __calc_dimensions__ and use + defun instead. + * plot/__actual_axis_position__.m: Also remove + __calc_dimensions__ in lieu of defun. + 2010-08-25 Ben Abbott * plot/__go_draw_axes__.m: Revert erroneous portion of changeset diff -r da90c16fbe84 -r db1bc83879ff scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Wed Aug 25 12:36:23 2010 -0400 +++ b/scripts/plot/__go_draw_axes__.m Thu Aug 26 01:36:36 2010 -0500 @@ -45,7 +45,8 @@ ymirror = true; endif - nd = __calc_dimensions__ (axis_obj); + nd = __calc_dimensions__ (h); + if (strcmpi (axis_obj.plotboxaspectratiomode, "manual")) pos = __actual_axis_position__ (axis_obj); else @@ -1779,29 +1780,6 @@ endfunction -function nd = __calc_dimensions__ (obj) - kids = obj.children; - nd = 2; - for i = 1:length (kids) - obj = get (kids(i)); - switch (obj.type) - case {"image", "text"} - ## ignore as they - case {"line", "patch"} - if (! isempty (obj.zdata)) - nd = 3; - endif - case "surface" - nd = 3; - case "hggroup" - obj_nd = __calc_dimensions__ (obj); - if (obj_nd == 3) - nd = 3; - endif - endswitch - endfor -endfunction - function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) ## DATA is already transposed. diff -r da90c16fbe84 -r db1bc83879ff scripts/plot/private/__actual_axis_position__.m --- a/scripts/plot/private/__actual_axis_position__.m Wed Aug 25 12:36:23 2010 -0400 +++ b/scripts/plot/private/__actual_axis_position__.m Thu Aug 26 01:36:36 2010 -0500 @@ -31,7 +31,8 @@ ## When using {rltb}margin, Gnuplot does not handle the specified ## aspect ratio properly, so handle it here. - if (__calc_dimensions__ (axis_obj) == 2 || all (mod (axis_obj.view, 90) == 0)) + if (__calc_dimensions__ (axis_obj.parent) == 2 + || all (mod (axis_obj.view, 90) == 0)) aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2); else ## FIXME -- this works for "axis square", but has not been @@ -63,26 +64,3 @@ endfunction -function nd = __calc_dimensions__ (obj) - kids = obj.children; - nd = 2; - for i = 1:length (kids) - obj = get (kids(i)); - switch (obj.type) - case {"image", "text"} - ## ignore as they - case {"line", "patch"} - if (! isempty (obj.zdata)) - nd = 3; - endif - case "surface" - nd = 3; - case "hggroup" - obj_nd = __calc_dimensions__ (obj); - if (obj_nd == 3) - nd = 3; - endif - endswitch - endfor -endfunction - diff -r da90c16fbe84 -r db1bc83879ff src/ChangeLog --- a/src/ChangeLog Wed Aug 25 12:36:23 2010 -0400 +++ b/src/ChangeLog Thu Aug 26 01:36:36 2010 -0500 @@ -1,3 +1,25 @@ +2010-08-27 Jordi Gutiérrez Hermoso + + * graphics.cc (void axes::properties::rotate_view (double + delta_el, double delta_az)) Don't rotate past the top and bottom. + (void axes::properties::update_camera (void)) Fix the view when + rotating to the bottom. + (octave_value calc_dimensions(const graphics_object& go)) New + function, C++ implementation of __calc_dimensions__in a couple of + scripts in scripts/plot. + (__calc_dimensions__) New defun to replace m-script function. + * graphics.h.in Declare calc_dimension + * DLD-FUNCTIONS/fltk_backend.cc ( plot_window (int xx, int yy, int + ww, int hh, figure::properties& xfp)) Use calc_dimensions to + decide if the current figure should be rotated or not. + (void mark_modified (void)) Recompute the number of dimensions in + the plot in case it's been modified and deactivate rotation if + necessary. + (class plot_window) Declare ndim. + (void button_press (Fl_Widget* widg)) Validate that ndim == 3 + before turning on rotation. + (int handle (int event)) Also validate that ndim == 3. + 2010-08-24 David Bateman * ls-mat5.cc (static void read_mat5_binary_data (std::istream&, diff -r da90c16fbe84 -r db1bc83879ff src/DLD-FUNCTIONS/fltk_backend.cc --- a/src/DLD-FUNCTIONS/fltk_backend.cc Wed Aug 25 12:36:23 2010 -0400 +++ b/src/DLD-FUNCTIONS/fltk_backend.cc Thu Aug 26 01:36:36 2010 -0500 @@ -224,7 +224,8 @@ public: plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp) : Fl_Window (xx, yy, ww, hh, "octave"), window_label (), shift (0), - fp (xfp), canvas (0), autoscale (0), togglegrid (0), panzoom (0), rotate (0), help (0), status (0) + fp (xfp), canvas (0), autoscale (0), togglegrid (0), panzoom (0), + rotate (0), help (0), status (0) { callback (window_close, static_cast