diff src/graphics.cc @ 12422:a3be83af8cfa

simplifications in position updating functions for axes labels and titles
author Konstantinos Poulios <logari81@gmail.com>
date Wed, 09 Feb 2011 18:05:43 +0100
parents 5367bd36b9f8
children 2ed62b9f949e
line wrap: on
line diff
--- a/src/graphics.cc	Wed Feb 09 08:14:18 2011 -0500
+++ b/src/graphics.cc	Wed Feb 09 18:05:43 2011 +0100
@@ -4121,8 +4121,6 @@
 void
 axes::properties::update_xlabel_position (void)
 {
-  graphics_xform xform = get_transform ();
-
   text::properties& xlabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_xlabel ()).get_properties ());
 
@@ -4150,6 +4148,8 @@
       if (xlabel_props.positionmode_is ("auto")
           || xlabel_props.rotationmode_is ("auto"))
         {
+          graphics_xform xform = get_transform ();
+
           Matrix ext (1, 2, 0.0);
           ext = get_ticklabel_extents (get_xtick ().matrix_value (),
                                        get_xticklabel ().all_strings (),
@@ -4205,8 +4205,6 @@
 void
 axes::properties::update_ylabel_position (void)
 {
-  graphics_xform xform = get_transform ();
-
   text::properties& ylabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_ylabel ()).get_properties ());
 
@@ -4234,6 +4232,8 @@
       if (ylabel_props.positionmode_is ("auto")
           || ylabel_props.rotationmode_is ("auto"))
         {
+          graphics_xform xform = get_transform ();
+
           Matrix ext (1, 2, 0.0);
           ext = get_ticklabel_extents (get_ytick ().matrix_value (),
                                        get_yticklabel ().all_strings (),
@@ -4289,8 +4289,6 @@
 void
 axes::properties::update_zlabel_position (void)
 {
-  graphics_xform xform = get_transform ();
-
   text::properties& zlabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_zlabel ()).get_properties ());
 
@@ -4320,6 +4318,8 @@
       if (zlabel_props.positionmode_is ("auto")
           || zlabel_props.rotationmode_is ("auto"))
         {
+          graphics_xform xform = get_transform ();
+
           Matrix ext (1, 2, 0.0);
           ext = get_ticklabel_extents (get_ztick ().matrix_value (),
                                        get_zticklabel ().all_strings (),
@@ -4396,8 +4396,6 @@
 void
 axes::properties::update_title_position (void)
 {
-  graphics_xform xform = get_transform ();
-
   text::properties& title_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_title ()).get_properties ());
 
@@ -4407,6 +4405,8 @@
 
       if (title_props.positionmode_is ("auto"))
         {
+          graphics_xform xform = get_transform ();
+
           // FIXME: bbox should be stored in axes::properties
           ColumnVector bbox(4);
           bbox(0) = octave_Inf;
@@ -5731,12 +5731,7 @@
 {
   if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") ||
       autopos_tag_is ("zlabel") || autopos_tag_is ("title"))
-    {
-      const std::string text_type = get_autopos_tag ();
-      set_autopos_tag ("none");
-      update_autopos (text_type);
-      set_autopos_tag (text_type);
-    }
+    update_autopos (get_autopos_tag ());
 }
 
 void