Mercurial > hg > ltpda
comparison m-toolbox/classes/@specwinViewer/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 2011/05/18 08:25:36 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 = 1000; | |
21 mainfig.Gproperties.Gheight = 600; | |
22 mainfig.Gproperties.Gborder = 10; | |
23 mainfig.Gproperties.fontsize = 12; | |
24 | |
25 l = (Screen(3)/2-mainfig.Gproperties.Gwidth/2); | |
26 b = (Screen(4)/2-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', 'SPECWINVIEWERmainfig'); | |
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 Specwin Viewer',... | |
38 'NumberTitle', 'off',... | |
39 'Visible','off',... | |
40 'Position',mainfig.Gproperties.Gposition,... | |
41 'Toolbar', 'none',... | |
42 'MenuBar', 'none',... | |
43 'Color', mainfig.Gproperties.Gcol,... | |
44 'Resize', 'on',... | |
45 'Tag', 'SPECWINVIEWERmainfig'); | |
46 % 'Units','normalized',... | |
47 end | |
48 | |
49 % Set mainfig callbacks | |
50 set(mainfig.handle, 'CloseRequestFcn', {'specwinViewer.cb_mainfigClose', mainfig}); | |
51 | |
52 %------------------------------------------------------------------------ | |
53 %- General properties | |
54 %------------------------------------------------------------------------ | |
55 hmarg = 0.02; | |
56 vmarg = 0.02; | |
57 commHeight = 0.06; | |
58 % l b w h | |
59 | |
60 % make settings panel | |
61 w = 0.5-2*hmarg; | |
62 h = 1-2*vmarg; | |
63 l = hmarg; | |
64 b = 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 = 0.5-2*hmarg; | |
78 h = 1-2*vmarg; | |
79 l = 0.5+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', 'SPECWINVIEWERparamspanel', ... | |
89 'HighlightColor', [0.5 0.5 0.5]); | |
90 | |
91 | |
92 %--- Settings | |
93 | |
94 % Select window to construct | |
95 % label | |
96 l = hmarg; | |
97 h = commHeight; | |
98 b = 1-h-3*hmarg; | |
99 w = 0.35; | |
100 sth = uicontrol(span, 'Style','text',... | |
101 'String', 'Window type ',... | |
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.5; | |
111 clsh = uicontrol(span, ... | |
112 'Style', 'popupmenu', ... | |
113 'Units', 'normalized',... | |
114 'Fontsize', mainfig.Gproperties.fontsize, ... | |
115 'BackgroundColor', 'w', ... | |
116 'String', specwin.getTypes, ... | |
117 'Position', [l b w h],... | |
118 'Tag', 'WindowSelect', ... | |
119 'Callback', {'specwinViewer.cb_selectWindow', mainfig}); | |
120 | |
121 % Select window size | |
122 % label | |
123 b = b - h - hmarg; | |
124 l = hmarg; | |
125 w = 0.35; | |
126 sth = uicontrol(span, 'Style','text',... | |
127 'String', 'Window size ',... | |
128 'Units', 'normalized', ... | |
129 'HorizontalAlignment', 'right',... | |
130 'BackgroundColor', [0.9 0.9 0.9], ... | |
131 'Fontsize', mainfig.Gproperties.fontsize, ... | |
132 'Position',[l b w h]); | |
133 | |
134 % menu box | |
135 l = l + w + hmarg; | |
136 w = 0.5; | |
137 ssh = uicontrol(span, ... | |
138 'Style', 'edit', ... | |
139 'Units', 'normalized',... | |
140 'Fontsize', mainfig.Gproperties.fontsize, ... | |
141 'BackgroundColor', 'w', ... | |
142 'String', '100', ... | |
143 'Position', [l b w h],... | |
144 'Tag', 'WindowSize'); | |
145 | |
146 % Select window psll | |
147 % label | |
148 b = b - h - hmarg; | |
149 l = hmarg; | |
150 w = 0.35; | |
151 sth = uicontrol(span, 'Style','text',... | |
152 'String', 'Window PSLL ',... | |
153 'Units', 'normalized', ... | |
154 'HorizontalAlignment', 'right',... | |
155 'BackgroundColor', [0.9 0.9 0.9], ... | |
156 'Fontsize', mainfig.Gproperties.fontsize, ... | |
157 'Position',[l b w h], ... | |
158 'Tag', 'WindowPSLLlabel'); | |
159 | |
160 % menu box | |
161 l = l + w + hmarg; | |
162 w = 0.5; | |
163 ssh = uicontrol(span, ... | |
164 'Style', 'edit', ... | |
165 'Units', 'normalized',... | |
166 'Fontsize', mainfig.Gproperties.fontsize, ... | |
167 'BackgroundColor', 'w', ... | |
168 'String', '100', ... | |
169 'Position', [l b w h],... | |
170 'Tag', 'WindowPSLL'); | |
171 | |
172 % Plot time btn | |
173 w = 0.4; | |
174 l = hmarg; | |
175 b = b - h - hmarg; | |
176 pbh = uicontrol(span,'Style','pushbutton',... | |
177 'String','Plot Time-domain',... | |
178 'Callback', {'specwinViewer.cb_plotTime', mainfig}, ... | |
179 'Units', 'normalized', ... | |
180 'Fontsize', mainfig.Gproperties.fontsize, ... | |
181 'Position',[l b w h]); | |
182 | |
183 % Plot freq btn | |
184 l = l+w+hmarg; | |
185 pbh = uicontrol(span,'Style','pushbutton',... | |
186 'String','Plot Freq-domain',... | |
187 'Callback', {'specwinViewer.cb_plotFreq', mainfig}, ... | |
188 'Units', 'normalized', ... | |
189 'Fontsize', mainfig.Gproperties.fontsize, ... | |
190 'Position',[l b w h]); | |
191 | |
192 % info display | |
193 w = 1-2*hmarg; | |
194 l = hmarg; | |
195 h = 0.4; | |
196 b = b - h - hmarg; | |
197 pbh = uicontrol(span,'Style','text',... | |
198 'String',' ',... | |
199 'BackgroundColor', [1 1 1], ... | |
200 'ForegroundColor', [0.2 0.2 1], ... | |
201 'Units', 'normalized', ... | |
202 'Fontsize', 14, ... | |
203 'Tag', 'InfoDisplay', ... | |
204 'Position',[l b w h]); | |
205 | |
206 % constructor display | |
207 w = 1-2*hmarg; | |
208 l = hmarg; | |
209 h = 0.1; | |
210 b = b - h - hmarg; | |
211 pbh = uicontrol(span,'Style','edit',... | |
212 'String',' ',... | |
213 'BackgroundColor', [1 1 1], ... | |
214 'ForegroundColor', [0 0 0], ... | |
215 'Units', 'normalized', ... | |
216 'Fontsize', mainfig.Gproperties.fontsize, ... | |
217 'Tag', 'ConstructorDisplay', ... | |
218 'Position',[l b w h]); | |
219 | |
220 % axes | |
221 M = 0.01; | |
222 ax = axes('Position', [0.2+M 0.2 0.7 0.7], ... | |
223 'Parent', ppan, ... | |
224 'Tag', 'SpecwinViewerAxes', ... | |
225 'Visible', 'on', ... | |
226 'Box', 'on'); | |
227 | |
228 setappdata(mainfig.handle, 'axes', ax); | |
229 | |
230 % plot button | |
231 w = 0.2; | |
232 l = 1-w-vmarg; | |
233 b = hmarg; | |
234 pbh = uicontrol(ppan,'Style','pushbutton',... | |
235 'String','plot',... | |
236 'Callback', {'specwinViewer.cb_plot', mainfig}, ... | |
237 'Units', 'normalized', ... | |
238 'Fontsize', mainfig.Gproperties.fontsize, ... | |
239 'Position',[l b w h]); | |
240 | |
241 | |
242 % Fire callbacks | |
243 specwinViewer.cb_selectWindow(mainfig); | |
244 | |
245 | |
246 end |