octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with Ben's change to preserve axis propers when used with co


From: David Bateman
Subject: Re: Problem with Ben's change to preserve axis propers when used with colorbars
Date: Thu, 16 Oct 2008 14:50:49 +0100
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

David Bateman wrote:
Ok, then the proper place to do this is in

graphics.cc (void axes::properties::set_defaults (base_graphics_object&, const std::string&))

and in fact there is already a comment there to that effect. I.E.

 // FIXME -- this is not quite right; we should preserve
 // "position" and "units".

I'll take a look and see if I can create a fix that preserves the axes properties, but after the deletion callbacks are run.

D.


The change is relative simple and attached. Can you confirm that this addresses your issues, and if so I'll commit it, as it addresses the case like

pcolor(peaks()); colorbar(); pause(1); plot(1:10)

Regards
David


--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary

# HG changeset patch
# User David Bateman <address@hidden>
# Date 1224164948 -3600
# Node ID ba193eeb3f5af47c0d0a5f6f99e7c6bfdc0560a9
# Parent  48b37ac8377ef7ac4eb32fe3d5338fa11ae3ba7e
Preserve font and position properties when axes are replace in the handle code

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-16  David Bateman  <address@hidden>
 
+       * 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".
diff --git a/scripts/plot/colorbar.m b/scripts/plot/colorbar.m
--- a/scripts/plot/colorbar.m
+++ b/scripts/plot/colorbar.m
@@ -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
 
diff --git a/scripts/plot/newplot.m b/scripts/plot/newplot.m
--- a/scripts/plot/newplot.m
+++ b/scripts/plot/newplot.m
@@ -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");
diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-16  David Bateman  <address@hidden>
+
+       * 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  <address@hidden>
 
        * graphics.h.in (class axes::properties): New property: interpreter.
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -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 ();
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]