Mercurial > hg > ltpda
comparison m-toolbox/classes/@launchBay/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 launchBay window | |
2 % | |
3 % M Hewitson 30-11-08 | |
4 % | |
5 % $Id: buildMainfig.m,v 1.5 2009/02/02 18:15: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', 'LAUNCHBAYmainfig'); | |
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 Launch Bay',... | |
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', 'off',... | |
46 'Tag', 'LAUNCHBAYmainfig'); | |
47 end | |
48 | |
49 % Set mainfig callbacks | |
50 set(mainfig.handle, 'CloseRequestFcn', {'launchBay.cb_mainfigClose', mainfig}); | |
51 | |
52 % Add Logo | |
53 M = 0.0; | |
54 ax = axes('Position', [M M 1-2*M 1-2*M], 'Parent', mainfig.handle); | |
55 logo = imread('LPFlogo.gif'); | |
56 image(logo, 'Parent', ax) | |
57 set(ax,'Visible', 'on', 'Box', 'off', 'Xtick', [], 'Ytick', []); | |
58 axis(ax, 'off'); | |
59 | |
60 % create a grid of launch buttons | |
61 launchers = {'modelViewer', 'modelViewer.png'; ... | |
62 'sigBuilder', 'sigBuilder.png'; ... | |
63 'repogui', 'repogui.png'; | |
64 'constructor', 'constructor.png'; | |
65 'specwinViewer', 'specwinViewer.png'; | |
66 'LTPDAprefs', 'ltpdaprefs.png'; | |
67 'pzmodel_helper', 'pzmodeldesigner.png'; | |
68 'ltpdv', 'ltpdv.png'; | |
69 'ltpdaquicklook', 'quicklook.png'}; | |
70 | |
71 | |
72 % Place buttons | |
73 vmarg = 0.02; | |
74 h = 0.2; | |
75 w = 0.2; | |
76 l = vmarg; | |
77 b = 1-h-vmarg; | |
78 for kk = 1:size(launchers,1) | |
79 | |
80 pbh = uicontrol(mainfig.handle,'Style','pushbutton',... | |
81 'String','',... | |
82 'Callback', launchers{kk,1}, ... | |
83 'Units', 'normalized', ... | |
84 'Fontsize', mainfig.Gproperties.fontsize, ... | |
85 'Position',[l b w h]); | |
86 | |
87 img = imread(launchers{kk,2}); | |
88 set(pbh, 'cdata', img); | |
89 | |
90 l = l + w + vmarg; | |
91 if l+w+vmarg > 1 | |
92 l = vmarg; | |
93 b = b - vmarg - h; | |
94 end | |
95 | |
96 end | |
97 | |
98 | |
99 | |
100 end |