0001 function varargout = ltpdaquicklook(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 hs = findall(0);
0022 found = -1;
0023 for j=1:length(hs)
0024 h = hs(j);
0025 if strcmp(get(h, 'Tag'), 'LTPDAquicklook')
0026 found = h;
0027 end
0028 end
0029 if found ~= -1
0030 figure(found);
0031 return
0032 end
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 Gproperties.Gcol = [240 240 240]/255;
0043 Gproperties.Gwidth = 400;
0044 Gproperties.Gheight = 400;
0045 Gproperties.Gborder = 10;
0046 fontsize = getappdata(0, 'ltpda_repo_gui_fontsize');
0047
0048 Gproperties.Screen = get(0,'screensize');
0049 Gproperties.Gposition = [150 ...
0050 100 ...
0051 Gproperties.Gwidth...
0052 Gproperties.Gheight];
0053
0054
0055 mainfig = figure('Name', 'LTPDA Quicklook',...
0056 'NumberTitle', 'off',...
0057 'Visible','off',...
0058 'Position',Gproperties.Gposition,...
0059 'Color', Gproperties.Gcol,...
0060 'Toolbar', 'none',...
0061 'MenuBar', 'none',...
0062 'Resize', 'off',...
0063 'HandleVisibility', 'callback', ...
0064 'Tag', 'LTPDAquicklook');
0065
0066
0067 set(mainfig, 'CloseRequestFcn', {@ltpda_quicklook_close, mainfig});
0068
0069
0070 setappdata(mainfig, 'Gproperties', Gproperties);
0071
0072
0073
0074
0075
0076 objs = getWorkspaceObjs();
0077 setappdata(mainfig, 'objs', objs);
0078
0079 lbh = uicontrol(mainfig,'Style','listbox',...
0080 'String',{' '},...
0081 'Value',1,...
0082 'BackgroundColor', 'w',...
0083 'Fontsize', fontsize,...
0084 'Max', 1000,...
0085 'Position',[10 90 150 300],...
0086 'Tag', 'LTPDA_quicklook_objlist');
0087
0088
0089 set(lbh, 'Callback', {@objList, mainfig});
0090
0091 setWorkspaceObjsList(objs)
0092
0093
0094 pbh = uicontrol(mainfig,'Style','pushbutton',...
0095 'String','Refresh',...
0096 'Callback', {@refresh, mainfig}, ...
0097 'Position',[10 70 60 25]);
0098
0099
0100
0101 sth = uicontrol(mainfig,'Style','text',...
0102 'String','',...
0103 'BackgroundColor', 'w', ...
0104 'ForegroundColor', 'b', ...
0105 'HorizontalAlignment', 'left', ...
0106 'Tag', 'LTPDA_quicklook_display', ...
0107 'Position',[170 90 220 300]);
0108
0109
0110 pbh = uicontrol(mainfig,'Style','pushbutton',...
0111 'String','iplot',...
0112 'Callback', {@call_iplot, mainfig}, ...
0113 'Position',[10 10 60 25]);
0114
0115
0116 pbh = uicontrol(mainfig,'Style','pushbutton',...
0117 'String','plot history',...
0118 'Callback', {@call_histplot, mainfig}, ...
0119 'Position',[80 10 80 25]);
0120
0121
0122
0123
0124
0125 set(mainfig,'Visible','on')
0126
0127
0128
0129
0130 function call_histplot(varargin)
0131
0132 mainfig = varargin{end};
0133 objs = getappdata(mainfig, 'objs');
0134
0135
0136 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0137 idx = get(olh, 'Value');
0138
0139 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0140 eval(cmd);
0141
0142 plot(obj.hist);
0143
0144
0145
0146 function call_iplot(varargin)
0147
0148 mainfig = varargin{end};
0149 objs = getappdata(mainfig, 'objs');
0150
0151
0152 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0153 idx = get(olh, 'Value');
0154
0155 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0156 eval(cmd);
0157
0158 iplot(obj);
0159
0160
0161 function refresh(varargin)
0162
0163 mainfig = varargin{end};
0164 objs = getWorkspaceObjs();
0165 setWorkspaceObjsList(objs)
0166 setappdata(mainfig, 'objs', objs);
0167
0168
0169 function ltpda_quicklook_close(varargin)
0170
0171
0172 disp('* Goodbye from the LTPDA Quicklook GUI *')
0173 delete(varargin{1})
0174
0175
0176
0177 function objs = getWorkspaceObjs()
0178
0179
0180 ws_vars = evalin('base','whos');
0181
0182 objs = [];
0183 for j=1:length(ws_vars)
0184
0185 cmd = sprintf('obj = evalin(''base'', ''%s'');', ws_vars(j).name);
0186 eval(cmd)
0187 if ltpda_isuserobject(obj)
0188 objs = [objs ws_vars(j)];
0189 end
0190
0191 end
0192
0193
0194
0195 function objList(varargin)
0196
0197 mainfig = varargin{end};
0198 objs = getappdata(mainfig, 'objs');
0199
0200
0201 olh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_objlist');
0202 idx = get(olh, 'Value');
0203
0204 cmd = sprintf('obj = evalin(''base'', ''%s'');', objs(idx).name);
0205 eval(cmd);
0206
0207 txt = display(obj);
0208
0209 dh = findobj(mainfig, 'Tag', 'LTPDA_quicklook_display');
0210 set(dh, 'String', txt);
0211
0212
0213
0214 function setWorkspaceObjsList(objs)
0215
0216 id = findobj('Tag', 'LTPDA_quicklook_objlist');
0217
0218 objlist = [];
0219 for j=1:length(objs)
0220 obj = objs(j);
0221 str = sprintf('%s\t\t(%s)', obj.name, obj.class);
0222 objlist = [objlist cellstr(str)];
0223 end
0224
0225 set(id, 'Value', 1);
0226 set(id, 'String', objlist);
0227
0228