changeset 21898:b5313b6cbe72

Simplify handling of 'box' property for legend axes objects. * gl-render.cc(opengl_renderer::draw_axes): Handle legend 'box' property by calling draw_axes_boxes unless 'box' property is 'off' and axes has tag 'legend'. * legend.m: Simplify code by equating "show" to "visible" property of legend and "box" to "box" property of legend.
author Rik <rik@octave.org>
date Tue, 14 Jun 2016 10:32:24 -0700
parents 39afd54c2981
children 7c053ad1c7ba
files libinterp/corefcn/gl-render.cc scripts/plot/appearance/legend.m
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Tue Jun 14 13:23:29 2016 -0400
+++ b/libinterp/corefcn/gl-render.cc	Tue Jun 14 10:32:24 2016 -0700
@@ -1755,9 +1755,9 @@
     glDisable (GL_LINE_SMOOTH);
 
   // draw axes object
-
   draw_axes_planes (props);
-  draw_axes_boxes (props);
+  if (props.get_tag () != "legend" || props.get_box () != "off")
+    draw_axes_boxes (props);
 
   set_font (props);
   set_interpreter (props.get_ticklabelinterpreter ());
--- a/scripts/plot/appearance/legend.m	Tue Jun 14 13:23:29 2016 -0400
+++ b/scripts/plot/appearance/legend.m	Tue Jun 14 10:32:24 2016 -0700
@@ -318,22 +318,22 @@
     ## hleg output will be assigned hlegend value at end of function.
   elseif (strcmp (show, "off"))
     if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "off");
+      set (hlegend, "visible", "off");
       hlegend = [];
     endif
   elseif (strcmp (show, "on"))
     if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "on");
-      ## NOTE: Matlab sets both "visible" and "box" to "on"
-      set (hlegend, "visible", get (hlegend, "box"));
+      set (hlegend, "visible", "on");
+      ## NOTE: Matlab sets both "visible" and "box" to "on" for "show on"
+      ## set (hlegend, "box", "on");
     endif
   elseif (strcmp (box, "on"))
     if (! isempty (hlegend))
-      set (hlegend, "box", "on", "visible", "on");
+      set (hlegend, "box", "on");
     endif
   elseif (strcmp (box, "off"))
     if (! isempty (hlegend))
-      set (hlegend, "box", "off", "visible", "off");
+      set (hlegend, "box", "off");
     endif
   elseif (! have_labels && ! isempty (hlegend)
           && ! (strcmp (location, "default")
@@ -585,7 +585,6 @@
                           "box", box,
                           "xtick", [], "ytick", [],
                           "xlim", [0, 1], "ylim", [0, 1],
-                          "visible", ifelse (strcmp (box, "on"), "on", "off"),
                           "activepositionproperty", "position");
           ## Inherit properties from current axis
           ## "fontunits" shoud be first because it affects interpretation