Mercurial > hg > ltpda
comparison m-toolbox/classes/@modelViewer/buildMainfig.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % BUILDMAINFIG build the main modelViewer window | |
2 % | |
3 % M Hewitson 18-10-08 | |
4 % | |
5 % $Id: buildMainfig.m,v 1.2 2008/11/30 16:16:24 hewitson Exp $ | |
6 % | |
7 function mainfig = buildMainfig(mainfig, varargin) | |
8 % %% Check if I exist already | |
9 % id = findobj('Tag', 'SIGBUILDERmainfig'); | |
10 % if ~isempty(id) | |
11 % figure(id) | |
12 % return | |
13 % end | |
14 | |
15 %% Some initial setup | |
16 | |
17 Screen = get(0,'screensize'); | |
18 mainfig.Gproperties.Gcol = [255 255 255]/255; | |
19 mainfig.Gproperties.Screen = Screen; | |
20 mainfig.Gproperties.Gwidth = 0.3; | |
21 mainfig.Gproperties.Gheight = 0.5; | |
22 mainfig.Gproperties.Gborder = 10; | |
23 mainfig.Gproperties.fontsize = 12; | |
24 | |
25 l = (0.5-mainfig.Gproperties.Gwidth/2); | |
26 b = (0.5-mainfig.Gproperties.Gheight/2); | |
27 w = mainfig.Gproperties.Gwidth; | |
28 h = mainfig.Gproperties.Gheight; | |
29 mainfig.Gproperties.Gposition = [l b w h]; | |
30 | |
31 if ~isempty(varargin) && ishandle(varargin{1}) | |
32 mainfig.handle = varargin{1}; | |
33 set(mainfig.handle, 'Tag', 'MODELVIEWERmainfig'); | |
34 set(mainfig.handle, 'Units', 'normalized'); | |
35 else | |
36 % Initialize and hide the GUI as it is being constructed. | |
37 mainfig.handle = figure('Name', 'LTPDA Model Viewer',... | |
38 'NumberTitle', 'off',... | |
39 'Visible','off',... | |
40 'Units','normalized',... | |
41 'Position',mainfig.Gproperties.Gposition,... | |
42 'Toolbar', 'none',... | |
43 'MenuBar', 'none',... | |
44 'Color', mainfig.Gproperties.Gcol,... | |
45 'Resize', 'on',... | |
46 'Tag', 'MODELVIEWERmainfig'); | |
47 end | |
48 | |
49 % Set mainfig callbacks | |
50 set(mainfig.handle, 'CloseRequestFcn', {'modelViewer.cb_mainfigClose', mainfig}); | |
51 | |
52 %------------------------------------------------------------------------ | |
53 %- General properties | |
54 %------------------------------------------------------------------------ | |
55 hmarg = 0.01; | |
56 vmarg = 0.02; | |
57 commHeight = 0.2; | |
58 % l b w h | |
59 | |
60 % make settings panel | |
61 w = 1-2*hmarg; | |
62 h = 0.25-2*vmarg; | |
63 l = hmarg; | |
64 b = 1-h-vmarg; | |
65 span = uipanel(mainfig.handle,... | |
66 'Title', 'Select model ', ... | |
67 'FontSize', mainfig.Gproperties.fontsize, ... | |
68 'BackgroundColor', [0.9 0.9 0.9], ... | |
69 'Position', [l b w h], ... | |
70 'BorderType', 'line', ... | |
71 'BorderWidth', 1, ... | |
72 'Tag', 'SettingsPanel', ... | |
73 'HighlightColor', [0.5 0.5 0.5]); | |
74 | |
75 % 'BackgroundColor', [1 1 1], ... | |
76 | |
77 % make parameter panel | |
78 w = 1-2*hmarg; | |
79 h = 0.55-2*vmarg; | |
80 l = hmarg; | |
81 b = 0.2+vmarg; | |
82 ppan = uipanel(mainfig.handle,... | |
83 'Title', 'Parameters ', ... | |
84 'FontSize', mainfig.Gproperties.fontsize, ... | |
85 'BackgroundColor', [200 220 240]/255, ... | |
86 'Position', [l b w h], ... | |
87 'BorderType', 'line', ... | |
88 'BorderWidth', 1, ... | |
89 'Tag', 'MODELVIEWERparamspanel', ... | |
90 'HighlightColor', [0.5 0.5 0.5]); | |
91 | |
92 % make parameter panel | |
93 w = 1-2*hmarg; | |
94 h = 0.2-2*vmarg; | |
95 l = hmarg; | |
96 b = vmarg; | |
97 cpan = uipanel(mainfig.handle,... | |
98 'Title', 'Controls ', ... | |
99 'FontSize', mainfig.Gproperties.fontsize, ... | |
100 'BackgroundColor', [200 220 240]/255, ... | |
101 'Position', [l b w h], ... | |
102 'BorderType', 'line', ... | |
103 'BorderWidth', 1, ... | |
104 'Tag', 'MODELVIEWERcontrolpanel', ... | |
105 'HighlightColor', [0.5 0.5 0.5]); | |
106 | |
107 %------------------------------------------------------------------------ | |
108 % Model type | |
109 | |
110 % label | |
111 l = hmarg; | |
112 h = commHeight; | |
113 b = 1-h-3*hmarg; | |
114 w = 0.15; | |
115 sth = uicontrol(span, 'Style','text',... | |
116 'String', 'model type ',... | |
117 'Units', 'normalized', ... | |
118 'HorizontalAlignment', 'right',... | |
119 'BackgroundColor', [0.9 0.9 0.9], ... | |
120 'Fontsize', mainfig.Gproperties.fontsize, ... | |
121 'Position',[l b w h]); | |
122 | |
123 % menu box | |
124 l = l + w + hmarg; | |
125 w = 0.2; | |
126 mtsh = uicontrol(span, ... | |
127 'Style', 'popupmenu', ... | |
128 'Units', 'normalized',... | |
129 'Fontsize', mainfig.Gproperties.fontsize, ... | |
130 'BackgroundColor', 'w', ... | |
131 'String', {'ao', 'ssm'}, ... | |
132 'Position', [l b w h],... | |
133 'Tag', 'ModelTypeSelect', ... | |
134 'Callback', {'modelViewer.cb_selectModelType', mainfig}); | |
135 | |
136 | |
137 % Model | |
138 | |
139 % label | |
140 l = l + w + hmarg; | |
141 h = commHeight; | |
142 w = 0.15; | |
143 sth = uicontrol(span, 'Style','text',... | |
144 'String', 'model ',... | |
145 'Units', 'normalized', ... | |
146 'HorizontalAlignment', 'right',... | |
147 'BackgroundColor', [0.9 0.9 0.9], ... | |
148 'Fontsize', mainfig.Gproperties.fontsize, ... | |
149 'Position',[l b w h]); | |
150 | |
151 % menu box | |
152 l = l + w + hmarg; | |
153 w = 0.4; | |
154 clsh = uicontrol(span, ... | |
155 'Style', 'popupmenu', ... | |
156 'Units', 'normalized',... | |
157 'Fontsize', mainfig.Gproperties.fontsize, ... | |
158 'BackgroundColor', 'w', ... | |
159 'String', ' ', ... | |
160 'Position', [l b w h],... | |
161 'Tag', 'ModelSelect', ... | |
162 'Callback', {'modelViewer.cb_selectModel', mainfig}); | |
163 | |
164 | |
165 % Description field | |
166 l = hmarg; | |
167 h = 2.5*commHeight; | |
168 w = 1-2*hmarg; | |
169 b = 4*vmarg; | |
170 sth = uicontrol(span, 'Style','text',... | |
171 'String', ' ',... | |
172 'Units', 'normalized', ... | |
173 'HorizontalAlignment', 'left',... | |
174 'BackgroundColor', [1 1 1], ... | |
175 'Max', 1000, ... | |
176 'Fontsize', mainfig.Gproperties.fontsize, ... | |
177 'Enable', 'on', ... | |
178 'Tag', 'MODELVIEWERmodeldescription', ... | |
179 'Position',[l b w h]); | |
180 | |
181 % Fire callbacks | |
182 modelViewer.cb_selectModelType(mtsh, mainfig); | |
183 modelViewer.cb_selectModel(clsh, mainfig); | |
184 | |
185 % Build button | |
186 h = 1.5*commHeight; | |
187 w = 0.2; | |
188 l = 1-w-hmarg; | |
189 b = 4*vmarg; | |
190 pbh = uicontrol(cpan,'Style','pushbutton',... | |
191 'String','build',... | |
192 'Callback', {'modelViewer.cb_buildModel', mainfig}, ... | |
193 'Units', 'normalized', ... | |
194 'Fontsize', mainfig.Gproperties.fontsize, ... | |
195 'Position',[l b w h]); | |
196 | |
197 % Type button | |
198 h = 1.5*commHeight; | |
199 w = 0.2; | |
200 l = l-w-vmarg; | |
201 b = 4*vmarg; | |
202 pbh = uicontrol(cpan,'Style','pushbutton',... | |
203 'String','type',... | |
204 'Callback', {'modelViewer.cb_typeModel', mainfig}, ... | |
205 'Units', 'normalized', ... | |
206 'Fontsize', mainfig.Gproperties.fontsize, ... | |
207 'Position',[l b w h]); | |
208 | |
209 | |
210 | |
211 end |