Home > m > gui > quicklook > ltpdaquicklook.m

ltpdaquicklook

PURPOSE ^

LTPDAQUICKLOOK allows the user to quicklook LTPDA objects.

SYNOPSIS ^

function varargout = ltpdaquicklook(varargin)

DESCRIPTION ^

 LTPDAQUICKLOOK allows the user to quicklook LTPDA objects.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: LTPDAQUICKLOOK allows the user to quicklook LTPDA objects.

 CALL:        ltpdaquicklook


 VERSION:     $Id: ltpdaquicklook.m,v 1.1 2008/03/07 13:34:41 hewitson Exp $

 HISTORY: 07-03-08 M Hewitson
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = ltpdaquicklook(varargin)
0002 
0003 % LTPDAQUICKLOOK allows the user to quicklook LTPDA objects.
0004 %
0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0006 %
0007 % DESCRIPTION: LTPDAQUICKLOOK allows the user to quicklook LTPDA objects.
0008 %
0009 % CALL:        ltpdaquicklook
0010 %
0011 %
0012 % VERSION:     $Id: ltpdaquicklook.m,v 1.1 2008/03/07 13:34:41 hewitson Exp $
0013 %
0014 % HISTORY: 07-03-08 M Hewitson
0015 %             Creation
0016 %
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 
0019 
0020 %% Check if I exist already
0021 id = findobj('Tag', 'LTPDAquicklook');
0022 if ~isempty(id)
0023   figure(id)
0024   return
0025 end
0026 
0027 %% Some initial setup
0028 
0029 Gproperties.Gcol    = [240 240 240]/255;
0030 Gproperties.Gwidth  = 400;
0031 Gproperties.Gheight = 400;
0032 Gproperties.Gborder = 10;
0033 fontsize = getappdata(0, 'ltpda_repo_gui_fontsize');
0034 
0035 Gproperties.Screen   = get(0,'screensize');
0036 Gproperties.Gposition = [150 ...
0037   100 ...
0038   Gproperties.Gwidth...
0039   Gproperties.Gheight];
0040 
0041 %  Initialize and hide the GUI as it is being constructed.
0042 mainfig = figure('Name', 'LTPDA Quicklook',...
0043   'NumberTitle', 'off',...
0044   'Visible','off',...
0045   'Position',Gproperties.Gposition,...
0046   'Color', Gproperties.Gcol,...
0047   'Toolbar', 'none',...
0048   'MenuBar', 'none',...
0049   'Resize', 'off',...
0050   'Tag', 'LTPDAquicklook');
0051 
0052 % Set mainfig callbacks
0053 set(mainfig, 'CloseRequestFcn', {@ltpda_quicklook_close, mainfig});
0054 
0055 % Set Application data
0056 setappdata(mainfig, 'Gproperties', Gproperties);
0057 
0058 
0059 %% GUI Parts
0060 
0061 % Objects list
0062 objs = getWorkspaceObjs();
0063 setappdata(mainfig, 'objs', objs);
0064 
0065 lbh = uicontrol(mainfig,'Style','listbox',...
0066   'String',{' '},...
0067   'Value',1,...
0068   'BackgroundColor', 'w',...
0069   'Fontsize', fontsize,...
0070   'Max', 1000,...
0071   'Position',[10 90 150 300],...
0072   'Tag', 'LTPDA_quicklook_objlist');
0073 
0074 % Set callback
0075 set(lbh, 'Callback', {@objList, mainfig});
0076 
0077 setWorkspaceObjsList(objs)
0078 
0079 % Refresh button
0080 pbh = uicontrol(mainfig,'Style','pushbutton',...
0081   'String','Refresh',...
0082   'Callback', {@refresh, mainfig}, ...
0083   'Position',[10 70 60 25]);
0084 
0085 
0086 % Object display
0087 sth = uicontrol(mainfig,'Style','text',...
0088   'String','',...
0089   'BackgroundColor', 'w', ...
0090   'ForegroundColor', 'b', ...
0091   'HorizontalAlignment', 'left', ...
0092   'Tag', 'LTPDA_quicklook_display', ...
0093   'Position',[170 90 220 300]);
0094 
0095 % Plot button
0096 pbh = uicontrol(mainfig,'Style','pushbutton',...
0097   'String','iplot',...
0098   'Callback', {@call_iplot, mainfig}, ...
0099   'Position',[10 10 60 25]);
0100 
0101 % history plot
0102 pbh = uicontrol(mainfig,'Style','pushbutton',...
0103   'String','plot history',...
0104   'Callback', {@call_histplot, mainfig}, ...
0105   'Position',[80 10 80 25]);
0106 
0107 
0108 %% Start the GUI
0109 
0110 % Make the GUI visible.
0111 set(mainfig,'Visible','on')
0112 
0113 %% Callbacks
0114 
0115 %---------------- history plot
0116 function call_histplot(varargin)
0117 
0118 mainfig = varargin{end};
0119 objs = getappdata(mainfig, 'objs');
0120 
0121 % get selection
0122 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0123 idx = get(olh, 'Value');
0124 
0125 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0126 eval(cmd);
0127 
0128 plot(obj.hist);
0129 
0130 
0131 %---------------- iplot
0132 function call_iplot(varargin)
0133 
0134 mainfig = varargin{end};
0135 objs = getappdata(mainfig, 'objs');
0136 
0137 % get selection
0138 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0139 idx = get(olh, 'Value');
0140 
0141 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0142 eval(cmd);
0143 
0144 iplot(obj);
0145 
0146 %---------------- refresh
0147 function refresh(varargin)
0148 
0149 mainfig = varargin{end};
0150 objs = getWorkspaceObjs();
0151 setWorkspaceObjsList(objs)
0152 setappdata(mainfig, 'objs', objs);
0153 
0154 %---------------- Close function
0155 function ltpda_quicklook_close(varargin)
0156 % Callback executed when the GUI is closed
0157 
0158 disp('* Goodbye from the LTPDA Quicklook GUI *')
0159 delete(varargin{1})
0160 
0161 
0162 %---------------- Get a list of LTPDA objects in the MATLAB workspace
0163 function objs = getWorkspaceObjs()
0164 
0165 % get base workspace variables
0166 ws_vars = evalin('base','whos');
0167 
0168 objs = [];
0169 for j=1:length(ws_vars)
0170 
0171   cmd = sprintf('obj = evalin(''base'', ''%s'');', ws_vars(j).name);
0172   eval(cmd)
0173   if ltpda_isuserobject(obj)
0174     objs = [objs ws_vars(j)];
0175   end
0176 
0177 end
0178 
0179 
0180 %---------------- Callback for list selection
0181 function objList(varargin)
0182 
0183 mainfig = varargin{end};
0184 objs = getappdata(mainfig, 'objs');
0185 
0186 % get selection
0187 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0188 idx = get(olh, 'Value');
0189 
0190 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0191 eval(cmd);
0192 
0193 txt = display(obj);
0194 
0195 dh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_display');
0196 set(dh, 'String', txt);
0197 
0198 
0199 %---------------- Fill the workspace object list
0200 function setWorkspaceObjsList(objs)
0201 
0202 id = findobj('Tag', 'LTPDA_quicklook_objlist');
0203 
0204 objlist = [];
0205 for j=1:length(objs)
0206   obj = objs(j);
0207   str = sprintf('%s\t\t(%s)', obj.name, obj.class);
0208   objlist = [objlist cellstr(str)];
0209 end
0210 
0211 set(id, 'Value', 1);
0212 set(id, 'String', objlist);
0213 
0214

Generated on Fri 07-Mar-2008 15:46:43 by m2html © 2003