Home > marsbar > @mardo > ui_event_types_cb.m

ui_event_types_cb

PURPOSE ^

method to handle callbacks from ui_event_types

SYNOPSIS ^

function varargout = ui_event_types_cb(D, action, varargin)

DESCRIPTION ^

 method to handle callbacks from ui_event_types
 FORMAT varargout = ui_event_types_cb(D, action, varargin)

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = ui_event_types_cb(D, action, varargin)
0002 % method to handle callbacks from ui_event_types
0003 % FORMAT varargout = ui_event_types_cb(D, action, varargin)
0004 %
0005 % $Id$
0006 
0007 if nargin < 2
0008   error('Need action');
0009 end
0010 
0011 et = event_types(D);
0012 F  = gcbf;
0013 
0014 switch lower(action)
0015  case 'ok'
0016   set(findobj(F,'Tag','Done'),'UserData',1)
0017  case 'cancel'
0018   set(findobj(F,'Tag','Done'),'UserData',0)
0019  case 'new'
0020   e = struct('name', 'New event', 'e_spec', []);
0021   if isempty(et), et = e; else et = [et e]; end
0022   D = event_types(D, et);
0023   [D ic] = ui_et_edit(D, length(et));
0024   if ~isempty(ic) % not cancelled
0025     pr_refresh_et(D, ic, F);
0026   end
0027  case 'edit'
0028   hList = findobj(F,'Tag','eList');
0029   ic = get(hList, 'Value');
0030   if isempty(ic)
0031     msgbox('Please select an event type to edit');
0032   elseif length(ic) > 1
0033     msgbox('Please select a single event type to edit');
0034   else
0035     et = event_types(D);
0036     [D ic] = ui_et_edit(D, ic);
0037     if ~isempty(ic) % not cancelled
0038       pr_refresh_et(D, ic, F, hList);
0039     end
0040   end
0041  case 'delete'
0042   hList = findobj(F,'Tag','eList');
0043   ic = get(hList, 'Value');
0044   if isempty(ic)
0045     msgbox('Please select event type(s) to delete');
0046   else
0047     et(ic) = [];
0048     D = event_types(D, et);
0049     pr_refresh_et(D, 1, F, hList);
0050   end  
0051  otherwise
0052   error([ action ' is deviant' ]);
0053 end
0054 
0055 return
0056 
0057 
0058   
0059   

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019