comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_buildMathPanel.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 function ltpdv_buildMathPanel(panH, mainfig)
2
3 Gproperties = getappdata(mainfig, 'Gproperties');
4
5 % Sizes
6 pmarg = 0.025; % Margin size
7 pw = 0.5 - 2*pmarg; % Panel width
8 ph = 0.3; % Panel height
9 bheight = 0.2; % Button height
10 bwidth = 0.2; % Button width
11 BUTTON_FONT = 12;
12 %--------------------- Calculator pad
13 pl = pmarg;
14 pb = 0.5 + pmarg;
15 % Panel
16 pan = uipanel(panH, 'Title','Calculator ','FontSize', Gproperties.fontsize,...
17 'BackgroundColor', [0.4 0.4 0.4],...
18 'ForegroundColor', 'w',...
19 'Position',[pl pb pw ph], 'Units', 'normalized');
20
21 % Buttons
22 buts = {'+', '-', './', '.*', '.^', '*', '/', '^'};
23 bl = pmarg;
24 bb = 1-pmarg-bheight;
25 for j=1:numel(buts)
26 bh = uicontrol(pan, 'String',buts{j},...
27 'Callback', {@ltpdv_calc_btn, mainfig, 2}, ...
28 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
29 'Position',[bl bb bwidth bheight]);
30 % move
31 bl = bl + bwidth + pmarg;
32 if bl + bwidth > (1-pmarg)
33 bl = pmarg;
34 bb = bb - bheight - pmarg;
35 end
36 end
37
38 %----------------------- Stats panel
39 pl = 0.5 + pmarg;
40 pb = 0.5 + pmarg;
41 % Panel
42 pan = uipanel(panH, 'Title','Stats ','FontSize', Gproperties.fontsize,...
43 'BackgroundColor', [0.4 0.4 0.4],...
44 'ForegroundColor', 'w',...
45 'Position',[pl pb pw ph], 'Units', 'normalized');
46
47 % Buttons
48 buts = {'mean', 'median', 'sum', 'std', 'var'};
49 bl = pmarg;
50 bb = 1-pmarg-bheight;
51 for j=1:numel(buts)
52 bh = uicontrol(pan, 'String',buts{j},...
53 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
54 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
55 'Position',[bl bb bwidth bheight]);
56 % move
57 bl = bl + bwidth + pmarg;
58 if bl + bwidth > (1-pmarg)
59 bl = pmarg;
60 bb = bb - bheight - pmarg;
61 end
62 end
63
64 %----------------------- Trig panel
65 pl = pmarg;
66 pb = pmarg;
67 % Panel
68 pan = uipanel(panH, 'Title','Trig ','FontSize', Gproperties.fontsize,...
69 'BackgroundColor', [0.4 0.4 0.4],...
70 'ForegroundColor', 'w',...
71 'Position',[pl pb pw ph], 'Units', 'normalized');
72
73 % Buttons
74 buts = {'sin', 'asin', 'cos', 'acos', 'tan', 'atan', 'log', 'log10', 'exp'};
75 bl = pmarg;
76 bb = 1-pmarg-bheight;
77 for j=1:numel(buts)
78 bh = uicontrol(pan, 'String',buts{j},...
79 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
80 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
81 'Position',[bl bb bwidth bheight]);
82 % move
83 bl = bl + bwidth + pmarg;
84 if bl + bwidth > (1-pmarg)
85 bl = pmarg;
86 bb = bb - bheight - pmarg;
87 end
88 end
89
90 %----------------------- Misc panel
91 pl = 0.5 + pmarg;
92 pb = pmarg;
93 % Panel
94 pan = uipanel(panH, 'Title','Misc ','FontSize', Gproperties.fontsize,...
95 'BackgroundColor', [0.4 0.4 0.4],...
96 'ForegroundColor', 'w',...
97 'Position',[pl pb pw ph], 'Units', 'normalized');
98
99 % Buttons
100 buts = {'sqrt', 'real', 'imag', 'conj', 'abs', 'phase'};
101 bl = pmarg;
102 bb = 1-pmarg-bheight;
103 for j=1:numel(buts)
104 bh = uicontrol(pan, 'String',buts{j},...
105 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
106 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
107 'Position',[bl bb bwidth bheight]);
108 % move
109 bl = bl + bwidth + pmarg;
110 if bl + bwidth > (1-pmarg)
111 bl = pmarg;
112 bb = bb - bheight - pmarg;
113 end
114 end
115