0001 function varargout = mars_arm(action, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010 global MARS
0011 if ~isfield(MARS, 'ARMOIRE')
0012 error('Global structure does not contain marmoire object');
0013 end
0014
0015 if nargin < 1
0016 error('Need action');
0017 end
0018
0019 o = MARS.ARMOIRE;
0020
0021 switch lower(action)
0022 case 'get'
0023 [varargout{1} o varargout{2}] = get_item_data(o, varargin{:});
0024 case 'set'
0025 [o varargout{1}] = set_item_data(o, varargin{:});
0026 case 'clear'
0027 [o varargout{1}] = clear_item_data(o, varargin{:});
0028 case 'set_ui'
0029 [o varargout{1}] = set_item_data_ui(o, varargin{:});
0030 case 'update'
0031 [o varargout{1}] = update_item_data(o, varargin{:});
0032 case 'set_param'
0033 o = set_item_param(o, varargin{:});
0034 case 'get_param'
0035 varargout{1} = get_item_param(o, varargin{:});
0036 case 'save'
0037 [varargout{1} o] = save_item_data(o, varargin{:});
0038 case 'save_ui'
0039 [varargout{1} o] = save_item_data_ui(o, varargin{:});
0040 case 'isempty'
0041 varargout{1} = isempty_item_data(o, varargin{:});
0042 case 'item_exists'
0043 varargout{1} = item_exists(o, varargin{:});
0044 case 'show_summary'
0045 if nargin < 2, error('Need item name'); end
0046 item_name = varargin{1};
0047 if ~item_exists(o, item_name)
0048 error(['What is ' item_name '?']);
0049 end
0050 if mars_arm('isempty', item_name)
0051 S = {'[Empty]'};
0052 else
0053 S = summary(get_item_data(o, item_name));
0054 fn = get_item_param(o, item_name, 'file_name');
0055 if isempty(fn), fn = '[Not set]'; end
0056 S = [{['Filename: ' fn]} S];
0057 end
0058 mars_utils('graphic_text', S, get_item_param(o, item_name, 'title'));
0059 otherwise
0060 error(['Weird: ' action]);
0061 end
0062
0063 MARS.ARMOIRE = o;