changeset 8228:53dbbd331498

Preserve font and position properties when axes are replace in the handle code
author David Bateman <dbateman@free.fr>
date Thu, 16 Oct 2008 14:49:08 +0100
parents 586b02ac671e
children 1bf51192fa1d
files scripts/ChangeLog scripts/plot/colorbar.m scripts/plot/newplot.m src/ChangeLog src/graphics.cc
diffstat 5 files changed, 23 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Oct 16 09:19:48 2008 -0400
+++ b/scripts/ChangeLog	Thu Oct 16 14:49:08 2008 +0100
@@ -4,6 +4,13 @@
 
 2008-10-16  David Bateman  <dbateman@free.fr>
 
+	* plot/colorbar.m (colorbar:resetaxis): Uncomment the reseting of
+	the axes.
+
+	* plot/newplot.m: Don't preserve axes properties here, but rather
+	do it in the graphics handle code so that the preservation can be
+	done after callbacks are executed.
+	
 	* plot/__go_draw_axes__.m: If current plot is an image, don't flag
 	the plot as binary, as the binary specification is already in the
 	"usingclause".
--- a/scripts/plot/colorbar.m	Thu Oct 16 09:19:48 2008 -0400
+++ b/scripts/plot/colorbar.m	Thu Oct 16 14:49:08 2008 +0100
@@ -186,7 +186,7 @@
   if (ishandle (h) && strcmp (get (h, "type"), "axes") && 
       (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) &&
       ishandle (get (h, "axes")))
-    #set (get (h, "axes"), "position", pos, "outerposition", opos);
+     set (get (h, "axes"), "position", pos, "outerposition", opos);
   endif
 endfunction
 
--- a/scripts/plot/newplot.m	Thu Oct 16 09:19:48 2008 -0400
+++ b/scripts/plot/newplot.m	Thu Oct 16 14:49:08 2008 +0100
@@ -44,17 +44,7 @@
       case "add"
       case "replacechildren"
       case "replace"
-        ## Preserve certain axes properties
-        fontprops = {"fontangle", get(ca, "fontangle"), ...
-		     "fontname", get(ca, "fontname"), ...
-		     "fontsize", get(ca, "fontsize"), ...
-		     "fontunits", get(ca, "fontunits"), ...
-		     "fontweight", get(ca, "fontweight"), ...
-		     "position", get(ca, "position"), ...
-		     "outerposition", get(ca, "outerposition"), ...
-		     "activepositionproperty", get(ca, "activepositionproperty")};
 	__go_axes_init__ (ca, "replace");
-	set (ca, fontprops{:});
 	__request_drawnow__ ();
       otherwise
 	error ("newplot: unrecognized nextplot property for current axes");
--- a/src/ChangeLog	Thu Oct 16 09:19:48 2008 -0400
+++ b/src/ChangeLog	Thu Oct 16 14:49:08 2008 +0100
@@ -1,3 +1,10 @@
+2008-10-16  David Bateman  <dbateman@free.fr>
+
+	* graphics.cc (void axes::properties::set_defaults 
+	(base_graphics_object&,	const std::string&)): Preserve font
+	and position properties if the axis is "replaced".
+
+
 2008-10-16  John W. Eaton  <jwe@octave.org>
 
 	* graphics.h.in (class axes::properties): New property: interpreter.
--- a/src/graphics.cc	Thu Oct 16 09:19:48 2008 -0400
+++ b/src/graphics.cc	Thu Oct 16 14:49:08 2008 +0100
@@ -2269,11 +2269,6 @@
   cameraviewanglemode = "auto";
   plotboxaspectratio = Matrix (1, 3, 1.0);
   drawmode = "normal";
-  fontangle = "normal";
-  fontname = "Helvetica";
-  fontsize = 12;
-  fontunits = "points";
-  fontweight = "normal";
   gridlinestyle = ":";
   linestyleorder = "-";
   linewidth = 0.5;
@@ -2297,20 +2292,24 @@
   visible = "on";
   nextplot = "replace";
 
-  // FIXME -- this is not quite right; we should preserve
-  // "position" and "units".
-
   if (mode != "replace")
     {
+      fontangle = "normal";
+      fontname = "Helvetica";
+      fontsize = 12;
+      fontunits = "points";
+      fontweight = "normal";
+
       Matrix touterposition (1, 4, 0.0);
       touterposition(2) = 1;
       touterposition(3) = 1;
       outerposition = touterposition;
 
       position = default_axes_position ();
+
+      activepositionproperty = "outerposition";
     }
 
-  activepositionproperty = "outerposition";
 
   delete_children ();