Mercurial > hg > ltpda
diff m-toolbox/m/gui/ltpdv/callbacks/ltpdv_delete_objects.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/ltpdv/callbacks/ltpdv_delete_objects.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,44 @@ +function ltpdv_delete_objects(varargin) + +% LTPDV_DELETE_OBJECTS delete the selected objects from the object list +% +% M Hewitson 22-04-08 +% +% $Id: ltpdv_delete_objects.m,v 1.1 2008/05/11 10:38:43 hewitson Exp $ +% + +% Handles +clearAll = false; +if nargin == 3 + myh = varargin{1}; + mainfig = varargin{end}; +elseif nargin == 4 + myh = varargin{1}; + mainfig = varargin{end-1}; + if strcmp(varargin{end}, 'all') + clearAll = true; + end +end + +% Get selected rows +rows = getappdata(mainfig, 'ObjectListSelectedRows'); + +if clearAll + % Set new object list + setappdata(mainfig, 'LTPDAobjects', {}); +else + % Get current object list + objs = getappdata(mainfig, 'LTPDAobjects'); + + % Build index list to keep + a = 1:length(objs); + idx = a(~ismember(a,rows)); + % Set new object list + setappdata(mainfig, 'LTPDAobjects', objs(idx)); +end + + +% Refresh object list +ltpdv_refresh_object_list(mainfig); + +% END \ No newline at end of file