source: trunk/src/@xmltree/view.m @ 1036

Last change on this file since 1036 was 723, checked in by sommeria, 11 years ago

xmltree and toolbox_calib added to svn

File size: 5.7 KB
Line 
1function view(tree)
2% XMLTREE/VIEW View Method
3% FORMAT view(tree)
4%
5% tree   - XMLTree object
6%_______________________________________________________________________
7%
8% Display an XML tree in a graphical interface
9%_______________________________________________________________________
10% @(#)view.m                  Guillaume Flandin                02/04/08
11
12error(nargchk(1,1,nargin));
13
14%-Build the Graphical User Interface
15%-----------------------------------------------------------------------
16figH = findobj('Tag','mlBatchFigure'); %this tag doesn't exist so a new
17% window is created ....
18if isempty(figH)
19        h = xmltree_build_ui;
20        figH = h.fig;
21else
22   set(figH,'Visible','on');
23   % recover all the handles
24   % h = struct(...);
25end
26drawnow;
27
28%-New title for the main window
29%-----------------------------------------------------------------------
30set(figH,'Name',['XML TreeViewer:' getfilename(tree)]);
31
32
33%-Initialize batch listbox
34%-----------------------------------------------------------------------
35tree = set(tree,root(tree),'show',1);
36builtin('set',figH,'UserData',tree);
37
38view_ui('update',figH);
39
40%=======================================================================
41function handleStruct = xmltree_build_ui
42
43%- Create Figure
44pixfactor = 72 / get(0,'screenpixelsperinch');
45%- Figure window size and position
46oldRootUnits   = get(0,'Units');
47set(0, 'Units', 'points');
48figurePos      = get(0,'DefaultFigurePosition');
49figurePos(3:4) = [560 420];
50figurePos      = figurePos * pixfactor;
51rootScreenSize = get(0,'ScreenSize');
52if ((figurePos(1) < 1) ...
53          | (figurePos(1)+figurePos(3) > rootScreenSize(3)))
54   figurePos(1) = 30;
55end
56set(0, 'Units', oldRootUnits);
57if ((figurePos(2)+figurePos(4)+60 > rootScreenSize(4)) ...
58          | (figurePos(2) < 1))
59   figurePos(2) = rootScreenSize(4) - figurePos(4) - 60;
60end
61%- Create Figure Window
62handleStruct.fig = figure(...
63        'Name','XML TreeViewer', ...
64        'Units', 'points', ...
65        'NumberTitle','off', ...
66        'Resize','on', ...
67        'Color',[0.8 0.8 0.8],...
68        'Position',figurePos, ...
69        'MenuBar','none', ...
70        'Tag', 'BatchFigure', ...
71        'CloseRequestFcn','view_ui close');
72
73%- Build batch listbox
74batchListPos = [20 55 160 345] * pixfactor;
75batchString = ' ';
76handleStruct.batchList = uicontrol( ...
77        'Parent',handleStruct.fig, ...
78        'Style', 'listbox', ...
79        'HorizontalAlignment','left', ...
80        'Units','points', ...
81        'Visible','on',...
82        'BackgroundColor', [1 1 1], ...
83        'Max', 1, ...
84        'Value', 1 , ...
85        'Enable', 'on', ...
86        'Position', batchListPos, ...
87        'Callback', 'view_ui batchlist', ...
88        'String', batchString, ...
89        'Tag', 'BatchListbox');
90
91%- Build About listbox
92aboutListPos = [200 220 340 180] * pixfactor;
93aboutString = ' ';
94handleStruct.aboutList = uicontrol( ...
95        'Parent',handleStruct.fig, ...
96        'Style', 'list', ...
97        'HorizontalAlignment','left', ...
98        'Units','points', ...
99        'Visible','on',...
100        'BackgroundColor', [0.8 0.8 0.8], ...
101        'Min', 0, ...
102        'Max', 2, ...
103        'Value', [], ...
104        'Enable', 'inactive', ...
105        'Position', aboutListPos, ...
106        'Callback', '', ...
107        'String', aboutString, ...
108        'Tag', 'AboutListbox');
109
110%- The Add button
111addBtnPos = [20 20 70 25] * pixfactor;
112handleStruct.add = uicontrol( ...
113        'Parent',handleStruct.fig, ...
114        'Style', 'pushbutton', ...
115        'Units', 'points', ...
116        'Position', addBtnPos, ...
117        'String', 'Add', ...
118   'Visible', 'on', ...
119   'Enable','on',...
120        'Tag', 'Add', ...
121        'Callback', 'view_ui add');
122        %'TooltipString', 'Add batch', ...
123   
124%- The modify button
125modifyBtnPos = [95 20 70 25] * pixfactor;
126handleStruct.modify = uicontrol( ...
127        'Parent',handleStruct.fig, ...
128        'Style', 'pushbutton', ...
129        'Units', 'points', ...
130        'Position', modifyBtnPos, ...
131        'String', 'Modify', ...
132   'Visible', 'on', ...
133   'Enable','on',...
134        'Tag', 'Modify', ...
135        'Callback', 'view_ui modify');
136        %'TooltipString', 'Modify batch', ...
137
138%- The Copy button
139copyBtnPos = [170 20 70 25] * pixfactor;
140handleStruct.copy = uicontrol( ...
141        'Parent',handleStruct.fig, ...
142        'Style', 'pushbutton', ...
143        'Units', 'points', ...
144        'Position', copyBtnPos, ...
145        'String', 'Copy', ...
146   'Visible', 'on', ...
147   'Enable','on',...
148        'Tag', 'Copy', ...
149        'Callback', 'view_ui copy');
150        %'TooltipString', 'Copy batch', ...
151
152%- The delete button
153deleteBtnPos = [245 20 70 25] * pixfactor;
154handleStruct.delete = uicontrol( ...
155        'Parent',handleStruct.fig, ...
156        'Style', 'pushbutton', ...
157        'Units', 'points', ...
158        'Position', deleteBtnPos, ...
159        'String', 'Delete', ...
160   'Visible', 'on', ...
161   'Enable','on',...
162        'Tag', 'Delete', ...
163        'Callback', 'view_ui delete');
164        %'TooltipString', 'Delete batch', ...
165
166%- The save button
167saveBtnPos = [320 20 70 25] * pixfactor;
168handleStruct.save = uicontrol( ...
169        'Parent',handleStruct.fig, ...
170        'Style', 'pushbutton', ...
171        'Units', 'points', ...
172        'Position', saveBtnPos, ...
173        'String', 'Save', ...
174   'Visible', 'on', ...
175   'UserData',0,...
176        'Tag', 'Save', ...
177        'Callback', 'view_ui save');
178        %'TooltipString', 'Save batch', ...
179
180%- The run button 
181runBtnPos = [395 20 70 25] * pixfactor;
182handleStruct.run = uicontrol( ...
183        'Parent',handleStruct.fig, ...
184        'Style', 'pushbutton', ...
185        'Units', 'points', ...
186        'Position', runBtnPos, ...
187        'String', 'Run', ...
188        'Visible', 'on', ...
189        'Enable', 'on', ...
190        'Tag', 'Run', ...
191        'Callback', 'view_ui run');
192        %'TooltipString', 'Run batch', ...
193
194%- The close button
195closeBtnPos = [470 20 70 25] * pixfactor;
196handleStruct.close = uicontrol( ...
197        'Parent',handleStruct.fig, ...
198        'Style', 'pushbutton', ...
199        'Units', 'points', ...
200        'Position', closeBtnPos, ...
201        'String', 'Close', ...
202        'Visible', 'on', ...
203        'Tag', 'Close', ...
204        'Callback', 'view_ui close');
205        %'TooltipString', 'Close window', ...
206
207handleArray = [handleStruct.fig handleStruct.batchList handleStruct.aboutList handleStruct.add handleStruct.modify handleStruct.copy handleStruct.delete handleStruct.save handleStruct.run handleStruct.close];
208
209set(handleArray,'Units', 'normalized');
Note: See TracBrowser for help on using the repository browser.