comparison m-toolbox/classes/@constructor/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 constructor window
2 %
3 % M Hewitson 18-10-08
4 %
5 % $Id: buildMainfig.m,v 1.2 2008/12/02 08:59:14 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.3;
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', 'CONSTRUCTORmainfig');
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 Constructor Helper',...
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', 'CONSTRUCTORmainfig');
47 end
48
49 % Set mainfig callbacks
50 set(mainfig.handle, 'CloseRequestFcn', {'constructor.cb_mainfigClose', mainfig});
51
52 %------------------------------------------------------------------------
53 %- General properties
54 %------------------------------------------------------------------------
55 hmarg = 0.01;
56 vmarg = 0.02;
57 commHeight = 0.5;
58 % l b w h
59
60 % make settings panel
61 w = 1-2*hmarg;
62 h = 0.2-2*vmarg;
63 l = hmarg;
64 b = 1-h-vmarg;
65 span = uipanel(mainfig.handle,...
66 'Title', 'Settings ', ...
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
76 % make build panel
77 w = 1-2*hmarg;
78 h = 0.8-2*vmarg;
79 l = hmarg;
80 b = vmarg;
81 ppan = uipanel(mainfig.handle,...
82 'Title', 'Build ', ...
83 'FontSize', mainfig.Gproperties.fontsize, ...
84 'BackgroundColor', [200 220 240]/255, ...
85 'Position', [l b w h], ...
86 'BorderType', 'line', ...
87 'BorderWidth', 1, ...
88 'Tag', 'MODELVIEWERparamspanel', ...
89 'HighlightColor', [0.5 0.5 0.5]);
90
91
92 %--- Settings
93
94 % Select class to construct
95 % label
96 l = hmarg;
97 h = commHeight;
98 b = 0.5-(h/2);
99 w = 0.15;
100 sth = uicontrol(span, 'Style','text',...
101 'String', 'Select class ',...
102 'Units', 'normalized', ...
103 'HorizontalAlignment', 'right',...
104 'BackgroundColor', [0.9 0.9 0.9], ...
105 'Fontsize', mainfig.Gproperties.fontsize, ...
106 'Position',[l b w h]);
107
108 % menu box
109 l = l + w + hmarg;
110 w = 0.2;
111 clsh = uicontrol(span, ...
112 'Style', 'popupmenu', ...
113 'Units', 'normalized',...
114 'Fontsize', mainfig.Gproperties.fontsize, ...
115 'BackgroundColor', 'w', ...
116 'String', utils.helper.ltpda_userclasses, ...
117 'Position', [l b w h],...
118 'Tag', 'ClassSelect', ...
119 'Callback', {'constructor.cb_selectClass', mainfig});
120
121 % Select class to construct
122 % label
123 l = l + w + hmarg;
124 w = 0.15;
125 sth = uicontrol(span, 'Style','text',...
126 'String', 'Select set ',...
127 'Units', 'normalized', ...
128 'HorizontalAlignment', 'right',...
129 'BackgroundColor', [0.9 0.9 0.9], ...
130 'Fontsize', mainfig.Gproperties.fontsize, ...
131 'Position',[l b w h]);
132
133 % menu box
134 l = l + w + hmarg;
135 w = 0.35;
136 ssh = uicontrol(span, ...
137 'Style', 'popupmenu', ...
138 'Units', 'normalized',...
139 'Fontsize', mainfig.Gproperties.fontsize, ...
140 'BackgroundColor', 'w', ...
141 'String', {' '}, ...
142 'Position', [l b w h],...
143 'Tag', 'SetSelect', ...
144 'Callback', {'constructor.cb_selectSet', mainfig});
145
146
147
148 %------------- Build panel
149
150 % display plist
151 l = hmarg;
152 w = 1-2*hmarg;
153 b = 0.2;
154 h = 0.8-vmarg;
155 sth = uicontrol(ppan, 'Style','edit',...
156 'String', '',...
157 'Units', 'normalized', ...
158 'BackgroundColor', [1 1 1], ...
159 'Fontsize', mainfig.Gproperties.fontsize, ...
160 'Tag', 'ConstructorDisplay', ...
161 'HorizontalAlignment', 'left', ...
162 'Max', 100, ...
163 'Position',[l b w h]);
164
165 % Variable name field
166 l = hmarg;
167 b = vmarg;
168 w = 0.15;
169 h = 0.1;
170 sth = uicontrol(ppan,'Style','text',...
171 'String','Variable ',...
172 'Units', 'normalized', ...
173 'HorizontalAlignment', 'left', ...
174 'BackgroundColor', [200 220 240]/255, ...
175 'Fontsize', mainfig.Gproperties.fontsize, ...
176 'Position',[l b w h]);
177
178 l = l + w + hmarg;
179
180 eth = uicontrol(ppan,'Style','edit',...
181 'String','obj',...
182 'Units', 'normalized', ...
183 'BackgroundColor', 'w', ...
184 'HorizontalAlignment', 'center', ...
185 'Fontsize', mainfig.Gproperties.fontsize, ...
186 'Tag', 'VariableTxt', ...
187 'Position',[l b w h]);
188
189 % Build btn
190 l = l + w + hmarg;
191 pbh = uicontrol(ppan,'Style','pushbutton','String','Build',...
192 'Units', 'normalized', ...
193 'Position',[l b w h],...
194 'Tag', 'BuildBtn');
195 set(pbh, 'Callback', {'constructor.buildObj', mainfig});
196
197
198 % Fire callbacks
199
200 constructor.cb_selectClass(clsh, mainfig);
201 constructor.cb_selectSet(ssh, mainfig);
202
203
204
205 end