# HG changeset patch # User Philipp Kutin # Date 1375093096 -7200 # Node ID 13da13e1e17ffcc6a301cc1bfd9ab45f4a63f2ae # Parent b9ffacf34c2d81ce855d734806760212427a9152 waitbar.m: Cache axes and patch handles in figure's __guidata__. * scripts/plot/waitbar.m: Instead of calling "findobj" twice, cache the handles for the wait bar axes and patch objects in the figure's __guidata__ field. diff --git a/scripts/plot/waitbar.m b/scripts/plot/waitbar.m --- a/scripts/plot/waitbar.m +++ b/scripts/plot/waitbar.m @@ -87,9 +87,13 @@ endif if (h) - p = findobj (h, "type", "patch"); + gd = get (h, "__guidata__"); + ## Get the cached handles. + ax = gd(1); + p = gd(2); + set (p, "xdata", [0; frac; frac; 0]); - ax = findobj (h, "type", "axes"); + if (ischar (msg) || iscellstr (msg)) th = get (ax, "title"); curr_msg = get (th, "string"); @@ -116,7 +120,10 @@ "xlimmode", "manual", "ylimmode", "manual", "position", [0.1, 0.3, 0.8, 0.2]); - patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]); + p = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]); + + ## Cache the axes and patch handles. + set (h, "__guidata__", [ax p]); if (! (ischar (msg) || iscellstr (msg))) msg = "Please wait...";