time | Calls | line |
---|
| | 1 | function clearNotify(h, flag)
|
| | 2 | %clearNotify Perform actions when a figure has some content cleared
|
| | 3 |
|
| | 4 | % Copyright 2014-2016 The MathWorks, Inc.
|
| | 5 |
|
< 0.001 | 2 | 6 | fig = [];
|
< 0.001 | 2 | 7 | for k=1:length(h)
|
< 0.001 | 2 | 8 | obj = h(k);
|
< 0.001 | 2 | 9 | if isgraphics(obj)
|
< 0.001 | 2 | 10 | f = ancestor(obj,'figure');
|
< 0.001 | 2 | 11 | if ~isempty(f)
|
< 0.001 | 2 | 12 | fig = f;
|
< 0.001 | 2 | 13 | break;
|
| | 14 | end
|
| | 15 | end
|
| | 16 | end
|
| | 17 |
|
| | 18 | % If this is a live script figure then capture any info before
|
| | 19 | % the figure is cleared.
|
< 0.001 | 2 | 20 | if ~isempty(fig) && isappdata(fig, 'EDITOR_APPDATA')
|
| | 21 | if nargin == 1
|
| | 22 | flag = '';
|
| | 23 | end
|
| | 24 | v = getappdata(fig,'EDITOR_APPDATA');
|
| | 25 | if ischar(v) && strcmp(v,'unittest') % unit testing API for when clearNotify is called.
|
| | 26 | setappdata(fig,'EDITOR_APPDATA',flag);
|
| | 27 | elseif strcmp(flag,'reset')
|
| | 28 | % Since Live editor uses web graphics and clf('reset') is not
|
| | 29 | % supported by web graphics, we need to trigger a morph.
|
| | 30 | matlab.internal.editor.FigureManager.figureBeingReset(fig);
|
| | 31 | else
|
| | 32 | matlab.internal.editor.FigureManager.figureBeingCleared(fig, flag);
|
| | 33 | end
|
< 0.001 | 2 | 34 | end
|
Other subfunctions in this file are not included in this listing.