changeset 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 99477f7ad5f9
children bbd7b1d4b268
files src/ChangeLog src/graphics.cc
diffstat 2 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-09  Konstantinos Poulios  <logari81@googlemail.com>
+
+	* graphics.cc (axes::properties::update_xlabel_position,
+	axes::properties::update_ylabel_position,
+	axes::properties::update_zlabel_position,
+	axes::properties::update_title_position): Use get_transform only
+	when it is required.
+	(text::properties::request_autopos): Remove redundant temporary
+	settting of autopos_tag to none.
+
 2011-02-08  John W. Eaton  <jwe@octave.org>
 
 	* pr-output.cc (INSTANTIATE_ABS): Omit inline keyword from
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -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