Mercurial > hg > octave-lyh
changeset 17147:13da13e1e17f
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.
author | Philipp Kutin <philipp.kutin@gmail.com> |
---|---|
date | Mon, 29 Jul 2013 12:18:16 +0200 |
parents | b9ffacf34c2d |
children | 743c9745009a |
files | scripts/plot/waitbar.m |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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...";