exporting patch:
# HG changeset patch
# User Daniel J Sebald <daniel.sebald@ieee.org>
# Date 1524965427 18000
#      Sat Apr 28 20:30:27 2018 -0500
# Node ID 6e5ab3ea3e9bf0917b0b023e0bbe0cc6c4c38962
# Parent  abc5095d58c20e7e61395ee12c02f169755d011e
Treat ishold() as a non-global axes property, toolkit title consistency (bug #53778)

* area.m: Add 'hax' to ishold() input.
* contour.m: Ditto.
* contour3.m: Ditto.
* contourf.m: Ditto.
* errorbar.m: Ditto.
* fill.m: Ditto.
* isosurface.m: Ditto.
* loglog.m: Ditto.
* loglogerr.m: Ditto.
* mesh.m: Ditto.
* meshc.m: Ditto.
* patch.m: Ditto.
* pcolor.m: Ditto.
* plot.m: Ditto.
* plot3.m: Ditto.
* polar.m: Ditto.
* __bar__.m: Ditto.
* quiver.m: Ditto.
* quiver3.m: Ditto.
* ribbon.m: Ditto.
* scatter3.m: Ditto.
* semilogx.m: Ditto.
* semilogxerr.m: Ditto.
* semilogy.m: Ditto.
* semilogyerr.m: Ditto.
* slice.m: Ditto.
* stairs.m: Ditto.
* surf.m: Ditto.
* surface.m (__surface__): Ditto.
* surfc.m: Ditto.
* surfl.m: Ditto.
* tetramesh.m: Ditto.
* trimesh.m: Ditto.
* trisurf.m: Ditto.
* graphics.cc (get_title): Condition on there being a valid number as well
  as 'numbertitle' true to use that number in title.
* __init_fltk__.cc (set_name): Use "GNU Octave" as default title if none
  specified, consistent with Qt toolkit.
* __gnuplot_drawnow__.m (gnuplot_set_term): Ditto.

diff --git a/libinterp/corefcn/graphics.cc b/libinterp/corefcn/graphics.cc
--- a/libinterp/corefcn/graphics.cc
+++ b/libinterp/corefcn/graphics.cc
@@ -4679,7 +4679,7 @@ figure::properties::update_units (const 
 std::string
 figure::properties::get_title (void) const
 {
-  if (is_numbertitle ())
+  if (! get_number ().isempty () && is_numbertitle ())
     {
       std::ostringstream os;
       std::string nm = get_name ();
diff --git a/libinterp/dldfcn/__init_fltk__.cc b/libinterp/dldfcn/__init_fltk__.cc
--- a/libinterp/dldfcn/__init_fltk__.cc
+++ b/libinterp/dldfcn/__init_fltk__.cc
@@ -1074,7 +1074,10 @@ public:
   void set_name (void)
   {
     m_window_label = m_fp.get_title ();
-    label (m_window_label.c_str ());
+    if (! m_window_label.empty ())
+      label (m_window_label.c_str ());
+    else
+      label ("GNU Octave");
   }
 
 private:
diff --git a/scripts/plot/draw/area.m b/scripts/plot/draw/area.m
--- a/scripts/plot/draw/area.m
+++ b/scripts/plot/draw/area.m
@@ -116,7 +116,7 @@ function h = area (varargin)
     hax = newplot (hax);
     htmp = __area__ (hax, x, y, bv, varargin{num_numeric+1:end});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
 
diff --git a/scripts/plot/draw/contour.m b/scripts/plot/draw/contour.m
--- a/scripts/plot/draw/contour.m
+++ b/scripts/plot/draw/contour.m
@@ -73,7 +73,7 @@ function [c, h] = contour (varargin)
 
     [ctmp, htmp] = __contour__ (hax, "none", varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
 
diff --git a/scripts/plot/draw/contour3.m b/scripts/plot/draw/contour3.m
--- a/scripts/plot/draw/contour3.m
+++ b/scripts/plot/draw/contour3.m
@@ -75,7 +75,7 @@ function [c, h] = contour3 (varargin)
 
     [ctmp, htmp] = __contour__ (hax, "auto", varargin{:});
 
-  if (! ishold ())
+  if (! ishold (hax))
     set (hax, "view", [-37.5, 30], "box", "on",
               "xgrid", "on", "ygrid", "on", "zgrid", "on");
   endif
diff --git a/scripts/plot/draw/contourf.m b/scripts/plot/draw/contourf.m
--- a/scripts/plot/draw/contourf.m
+++ b/scripts/plot/draw/contourf.m
@@ -75,7 +75,7 @@ function [c, h] = contourf (varargin)
     [ctmp, htmp] = __contour__ (hax, "none", "fill", "on",
                                      "linecolor", "black", varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
 
diff --git a/scripts/plot/draw/errorbar.m b/scripts/plot/draw/errorbar.m
--- a/scripts/plot/draw/errorbar.m
+++ b/scripts/plot/draw/errorbar.m
@@ -180,7 +180,7 @@ function h = errorbar (varargin)
 
     htmp = __errplot__ ("errorbar", hax, varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
   unwind_protect_cleanup
diff --git a/scripts/plot/draw/fill.m b/scripts/plot/draw/fill.m
--- a/scripts/plot/draw/fill.m
+++ b/scripts/plot/draw/fill.m
@@ -88,7 +88,7 @@ function h = fill (varargin)
   unwind_protect
     hax = newplot (hax);
     old_nxtplt = get (hax, "nextplot");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
     unwind_protect
diff --git a/scripts/plot/draw/isosurface.m b/scripts/plot/draw/isosurface.m
--- a/scripts/plot/draw/isosurface.m
+++ b/scripts/plot/draw/isosurface.m
@@ -192,7 +192,7 @@ function varargout = isosurface (varargi
                   "FaceVertexCData", fc,
                   "FaceColor", "flat", "EdgeColor", ec,
                   "FaceLighting", "gouraud");
-      if (! ishold ())
+      if (! ishold (hax))
         set (hax, "View", [-37.5, 30]);
       endif
       isonormals (x, y, z, v, pa);
diff --git a/scripts/plot/draw/loglog.m b/scripts/plot/draw/loglog.m
--- a/scripts/plot/draw/loglog.m
+++ b/scripts/plot/draw/loglog.m
@@ -53,7 +53,7 @@ function h = loglog (varargin)
     hax = newplot (hax);
 
     set (hax, "xscale", "log", "yscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "xminortick", "on", "yminortick", "on", "box", "on");
     endif
 
diff --git a/scripts/plot/draw/loglogerr.m b/scripts/plot/draw/loglogerr.m
--- a/scripts/plot/draw/loglogerr.m
+++ b/scripts/plot/draw/loglogerr.m
@@ -63,7 +63,7 @@ function h = loglogerr (varargin)
     hax = newplot (hax);
 
     set (hax, "xscale", "log", "yscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "xminortick", "on", "yminortick", "on", "box", "on");
     endif
     htmp = __errplot__ ("loglogerr", hax, varargin{:});
diff --git a/scripts/plot/draw/mesh.m b/scripts/plot/draw/mesh.m
--- a/scripts/plot/draw/mesh.m
+++ b/scripts/plot/draw/mesh.m
@@ -80,7 +80,7 @@ function h = mesh (varargin)
                       varargin{chararg:end});
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/meshc.m b/scripts/plot/draw/meshc.m
--- a/scripts/plot/draw/meshc.m
+++ b/scripts/plot/draw/meshc.m
@@ -81,7 +81,7 @@ function h = meshc (varargin)
                       varargin{chararg:end});
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on",
                 "xlimmode", "manual", "ylimmode", "manual");
diff --git a/scripts/plot/draw/patch.m b/scripts/plot/draw/patch.m
--- a/scripts/plot/draw/patch.m
+++ b/scripts/plot/draw/patch.m
@@ -92,7 +92,7 @@ function h = patch (varargin)
   ## FIXME: This is a hack to get 'layer' command to work for 2D patches
   ##        Alternative is much more complicated surgery in graphics.cc.
   ##        of get_children_limits() for 'z' axis and 'patch' object type.
-  if (! ishold ())
+  if (! ishold (hax))
     if (isempty (get (htmp, "zdata")))
       set (hax, "zlim", [-1 1]);
     endif
diff --git a/scripts/plot/draw/pcolor.m b/scripts/plot/draw/pcolor.m
--- a/scripts/plot/draw/pcolor.m
+++ b/scripts/plot/draw/pcolor.m
@@ -84,7 +84,7 @@ function h = pcolor (varargin)
     htmp = surface (x, y, z, c);
 
     set (htmp, "facecolor", "flat");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [0, 90], "box", "on");
       ## FIXME: Maybe this should be in the general axis limit setting routine?
       ##        When values are integers (such as from meshgrid), we want to
diff --git a/scripts/plot/draw/plot.m b/scripts/plot/draw/plot.m
--- a/scripts/plot/draw/plot.m
+++ b/scripts/plot/draw/plot.m
@@ -222,7 +222,7 @@ function h = plot (varargin)
     hax = newplot (hax);
     htmp = __plt__ ("plot", hax, varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
   unwind_protect_cleanup
diff --git a/scripts/plot/draw/plot3.m b/scripts/plot/draw/plot3.m
--- a/scripts/plot/draw/plot3.m
+++ b/scripts/plot/draw/plot3.m
@@ -358,7 +358,7 @@ function h = plot3 (varargin)
       legend (hax, hlgnd, tlgnd);
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30]);
     endif
 
diff --git a/scripts/plot/draw/polar.m b/scripts/plot/draw/polar.m
--- a/scripts/plot/draw/polar.m
+++ b/scripts/plot/draw/polar.m
@@ -95,7 +95,7 @@ function h = polar (varargin)
       print_usage ();
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       hg = hggroup (hax, "tag", "polar_grid", "handlevisibility", "off");
 
       set (hax, "visible", "off", "plotboxaspectratio", [1, 1, 1],
diff --git a/scripts/plot/draw/private/__bar__.m b/scripts/plot/draw/private/__bar__.m
--- a/scripts/plot/draw/private/__bar__.m
+++ b/scripts/plot/draw/private/__bar__.m
@@ -204,7 +204,7 @@ function varargout = __bar__ (vertical, 
       htmp = bars (hax, vertical, x, y, xb, yb, gwidth, group,
                    have_line_spec, bv, newargs{:});
 
-      if (! ishold ())
+      if (! ishold (hax))
         if (numel (x(:,1)) <= 15 && all (x(:,1) == fix (x(:,1))))
           ## Set manual ticks, rather than relying on autoselection,
           ## when ticks are a small number of integers.
diff --git a/scripts/plot/draw/quiver.m b/scripts/plot/draw/quiver.m
--- a/scripts/plot/draw/quiver.m
+++ b/scripts/plot/draw/quiver.m
@@ -86,7 +86,7 @@ function h = quiver (varargin)
 
     ## FIXME: This should be moved into __quiver__ when problem with
     ##        re-initialization of title object is fixed.
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "box", "on");
     endif
 
diff --git a/scripts/plot/draw/quiver3.m b/scripts/plot/draw/quiver3.m
--- a/scripts/plot/draw/quiver3.m
+++ b/scripts/plot/draw/quiver3.m
@@ -86,7 +86,7 @@ function h = quiver3 (varargin)
     hax = newplot (hax);
     htmp = __quiver__ (hax, true, varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/ribbon.m b/scripts/plot/draw/ribbon.m
--- a/scripts/plot/draw/ribbon.m
+++ b/scripts/plot/draw/ribbon.m
@@ -94,7 +94,7 @@ function h = ribbon (varargin)
       htmp(c) = surface (xx, yy, zz, cc);
     endfor
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/scatter3.m b/scripts/plot/draw/scatter3.m
--- a/scripts/plot/draw/scatter3.m
+++ b/scripts/plot/draw/scatter3.m
@@ -82,7 +82,7 @@ function h = scatter3 (varargin)
 
     htmp = __scatter__ (hax, 3, "scatter3", varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/semilogx.m b/scripts/plot/draw/semilogx.m
--- a/scripts/plot/draw/semilogx.m
+++ b/scripts/plot/draw/semilogx.m
@@ -53,7 +53,7 @@ function h = semilogx (varargin)
     hax = newplot (hax);
 
     set (hax, "xscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "xminortick", "on", "box", "on");
     endif
 
diff --git a/scripts/plot/draw/semilogxerr.m b/scripts/plot/draw/semilogxerr.m
--- a/scripts/plot/draw/semilogxerr.m
+++ b/scripts/plot/draw/semilogxerr.m
@@ -65,7 +65,7 @@ function h = semilogxerr (varargin)
     hax = newplot (hax);
 
     set (hax, "xscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "xminortick", "on");
     endif
 
diff --git a/scripts/plot/draw/semilogy.m b/scripts/plot/draw/semilogy.m
--- a/scripts/plot/draw/semilogy.m
+++ b/scripts/plot/draw/semilogy.m
@@ -53,7 +53,7 @@ function h = semilogy (varargin)
     hax = newplot (hax);
 
     set (hax, "yscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "yminortick", "on", "box", "on");
     endif
 
diff --git a/scripts/plot/draw/semilogyerr.m b/scripts/plot/draw/semilogyerr.m
--- a/scripts/plot/draw/semilogyerr.m
+++ b/scripts/plot/draw/semilogyerr.m
@@ -65,7 +65,7 @@ function h = semilogyerr (varargin)
     hax = newplot (hax);
 
     set (hax, "yscale", "log");
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "yminortick", "on");
     endif
 
diff --git a/scripts/plot/draw/slice.m b/scripts/plot/draw/slice.m
--- a/scripts/plot/draw/slice.m
+++ b/scripts/plot/draw/slice.m
@@ -183,7 +183,7 @@ function h = slice (varargin)
       htmp = surface (sx, sy, sz, vi);
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30.0],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/stairs.m b/scripts/plot/draw/stairs.m
--- a/scripts/plot/draw/stairs.m
+++ b/scripts/plot/draw/stairs.m
@@ -82,7 +82,7 @@ function [xs, ys] = stairs (varargin)
       hax = newplot (hax);
       [htmp, xxs, yys] = __stairs__ (true, varargin{:});
 
-      if (! ishold ())
+      if (! ishold (hax))
         set (hax, "box", "on");
       endif
 
diff --git a/scripts/plot/draw/surf.m b/scripts/plot/draw/surf.m
--- a/scripts/plot/draw/surf.m
+++ b/scripts/plot/draw/surf.m
@@ -71,7 +71,7 @@ function h = surf (varargin)
 
     htmp = surface (varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/surface.m b/scripts/plot/draw/surface.m
--- a/scripts/plot/draw/surface.m
+++ b/scripts/plot/draw/surface.m
@@ -189,7 +189,7 @@ function [h, bad_usage] = __surface__ (a
   h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
                       other_args{:});
 
-  if (! ishold ())
+  if (! ishold (ax))
     set (ax, "view", [0, 90]);
   endif
 
diff --git a/scripts/plot/draw/surfc.m b/scripts/plot/draw/surfc.m
--- a/scripts/plot/draw/surfc.m
+++ b/scripts/plot/draw/surfc.m
@@ -80,7 +80,7 @@ function h = surfc (varargin)
                       varargin{chararg:end});
     endif
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on",
                 "xlimmode", "manual", "ylimmode", "manual");
diff --git a/scripts/plot/draw/surfl.m b/scripts/plot/draw/surfl.m
--- a/scripts/plot/draw/surfl.m
+++ b/scripts/plot/draw/surfl.m
@@ -144,7 +144,7 @@ function h = surfl (varargin)
     hax = newplot (hax);
 
     htmp = surface (varargin{:});
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on", "clim", [0 1]);
     endif
diff --git a/scripts/plot/draw/tetramesh.m b/scripts/plot/draw/tetramesh.m
--- a/scripts/plot/draw/tetramesh.m
+++ b/scripts/plot/draw/tetramesh.m
@@ -105,7 +105,7 @@ function h = tetramesh (varargin)
     endfor
   endif
 
-  if (! ishold ())
+  if (! ishold (hax))
     set (hax, "view", [-37.5, 30]);
   endif
 
diff --git a/scripts/plot/draw/trimesh.m b/scripts/plot/draw/trimesh.m
--- a/scripts/plot/draw/trimesh.m
+++ b/scripts/plot/draw/trimesh.m
@@ -86,7 +86,7 @@ function h = trimesh (tri, x, y, z, vara
                   "FaceLighting", "none", "EdgeLighting", "flat",
                   "Tag", "trimesh", varargin{:});
 
-    if (! ishold ())
+    if (! ishold (hax))
       set (hax, "view", [-37.5, 30],
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");
     endif
diff --git a/scripts/plot/draw/trisurf.m b/scripts/plot/draw/trisurf.m
--- a/scripts/plot/draw/trisurf.m
+++ b/scripts/plot/draw/trisurf.m
@@ -82,7 +82,7 @@ function h = trisurf (tri, x, y, z, vara
   htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)],
                 "FaceVertexCData", c, varargin{:});
 
-  if (! ishold ())
+  if (! ishold (hax))
     set (hax, "view", [-37.5, 30],
               "xgrid", "on", "ygrid", "on", "zgrid", "on");
   endif
diff --git a/scripts/plot/util/__gnuplot_drawnow__.m b/scripts/plot/util/__gnuplot_drawnow__.m
--- a/scripts/plot/util/__gnuplot_drawnow__.m
+++ b/scripts/plot/util/__gnuplot_drawnow__.m
@@ -146,15 +146,15 @@ function enhanced = gnuplot_set_term (pl
       if (output_to_screen (term) && ! strcmp (term, "dumb"))
         fig.numbertitle = get (h, "numbertitle");
         fig.name = strrep (get (h, "name"), '"', '\"');
-        if (strcmp (get (h, "numbertitle"), "on"))
+        if (! isempty (get (h, "number")) && strcmp (get (h, "numbertitle"), "on"))
           title_str = sprintf ("Figure %d", h);
+          if (! isempty (fig.name))
+            title_str = sprintf ("%s: %s", title_str, fig.name);
+          endif
+        elseif (! isempty (fig.name))
+          title_str = fig.name;
         else
-          title_str = "";
-        endif
-        if (! isempty (fig.name) && ! isempty (title_str))
-          title_str = sprintf ("%s: %s", title_str, fig.name);
-        elseif (! isempty (fig.name) && isempty (title_str))
-          title_str = fig.name;
+          title_str = "GNU Octave";
         endif
         if (! isempty (title_str))
           title_str = sprintf ('title "%s"', title_str);
