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