# HG changeset patch # User Shai Ayal # Date 1205521336 -7200 # Node ID 67edbcb19665446df26053e3670a6f31078c0897 # Parent fdd465b00ec0860ffaaea82f1fa166a7c81943c6 rudimentry (i.e. no font metrics) sync of axes.position and axes.outerposition * * * preserve axes position if mode is replace * * * use default_axes_postion when syncing outerposition and position * * * Update transformation matrices when axes position changes. diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2008-06-04 Shai Ayal + * graphics.cc (axes::properties::set_defaults): Preserve position + if mode is replace. + (axes::properties::sync_positions): Use default_axes_postion for + consistency. + + * graphics.h.in (axes::properties::sync_positions, + axes::properties::update_position, + axes::properties::update_outerposition): New functions to sync + outerposition and position. + * graphics.h.in (axes::properties::update_xlim, axes::properties::update_ylim, axes::properties::update_zlim): pass is_logscale flag to axes::properties::calc_ticks_and_lims @@ -37,6 +47,9 @@ 2008-06-04 Michael Goffioul + * graphics.cc (axes::properties::sync_positions): Update + transformation data. + * graphics.cc (Faddlistener): Rename from Fadd_listener. * graphics.h.in (axes::properties::pixel2coord): Center Z coordinate diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -172,6 +172,8 @@ return m; } + + static void xset_gcbo (const graphics_handle& h) { @@ -1821,6 +1823,35 @@ // --------------------------------------------------------------------- +void +axes::properties::sync_positions (void) +{ + // FIXME -- this should take font metrics into consideration, + // for now we'll just make it position 90% of outerposition + if (activepositionproperty.is ("outerposition")) + { + Matrix outpos = outerposition.get ().matrix_value (); + Matrix defpos = default_axes_position (); + Matrix pos(outpos); + pos(0) = outpos(0) + defpos(0) * outpos(2); + pos(1) = outpos(1) + defpos(1) * outpos(3); + pos(2) = outpos(2) * defpos(2); + pos(3) = outpos(3) * defpos(3); + position = pos; + } + else + { + Matrix pos = position.get ().matrix_value (); + pos(0) -= pos(2)*0.05; + pos(1) -= pos(3)*0.05; + pos(2) *= 1.1; + pos(3) *= 1.1; + outerposition = pos; + } + + update_transform (); +} + void axes::properties::set_title (const octave_value& v) { @@ -1873,7 +1904,6 @@ axes::properties::set_defaults (base_graphics_object& obj, const std::string& mode) { - position = default_axes_position (); title = graphics_handle (); box = "on"; key = "off"; @@ -1976,6 +2006,8 @@ touterposition(2) = 1; touterposition(3) = 1; outerposition = touterposition; + + position = default_axes_position (); } activepositionproperty = "outerposition"; diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -2566,7 +2566,7 @@ // properties declarations. BEGIN_PROPERTIES(axes) - array_property position , default_axes_position () + array_property position u , default_axes_position () mutable handle_property title GSO , graphics_handle () bool_property box , "on" bool_property key , "off" @@ -2625,7 +2625,7 @@ radio_property xaxislocation , "{bottom}|top|zero" array_property view u , Matrix () radio_property nextplot , "add|replace_children|{replace}" - array_property outerposition , default_axes_outerposition () + array_property outerposition u , default_axes_outerposition () radio_property activepositionproperty , "{outerposition}|position" radio_property __colorbar__ h , "{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside" color_property ambientlightcolor , color_values (1, 1, 1) @@ -2713,6 +2713,10 @@ void update_ydir (void) { update_camera (); } void update_zdir (void) { update_camera (); } + void sync_positions (void); + void update_outerposition (void) { sync_positions ();} + void update_position (void) { sync_positions (); } + double calc_tick_sep (double minval, double maxval); void calc_ticks_and_lims (array_property& lims, array_property& ticks, bool limmode_is_auto, bool is_logscale); void fix_limits (array_property& lims)