Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/ltpdv/callbacks/ltpdv_buildMathPanel.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,115 @@ +function ltpdv_buildMathPanel(panH, mainfig) + +Gproperties = getappdata(mainfig, 'Gproperties'); + +% Sizes +pmarg = 0.025; % Margin size +pw = 0.5 - 2*pmarg; % Panel width +ph = 0.3; % Panel height +bheight = 0.2; % Button height +bwidth = 0.2; % Button width +BUTTON_FONT = 12; +%--------------------- Calculator pad +pl = pmarg; +pb = 0.5 + pmarg; +% Panel +pan = uipanel(panH, 'Title','Calculator ','FontSize', Gproperties.fontsize,... + 'BackgroundColor', [0.4 0.4 0.4],... + 'ForegroundColor', 'w',... + 'Position',[pl pb pw ph], 'Units', 'normalized'); + +% Buttons +buts = {'+', '-', './', '.*', '.^', '*', '/', '^'}; +bl = pmarg; +bb = 1-pmarg-bheight; +for j=1:numel(buts) + bh = uicontrol(pan, 'String',buts{j},... + 'Callback', {@ltpdv_calc_btn, mainfig, 2}, ... + 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ... + 'Position',[bl bb bwidth bheight]); + % move + bl = bl + bwidth + pmarg; + if bl + bwidth > (1-pmarg) + bl = pmarg; + bb = bb - bheight - pmarg; + end +end + +%----------------------- Stats panel +pl = 0.5 + pmarg; +pb = 0.5 + pmarg; +% Panel +pan = uipanel(panH, 'Title','Stats ','FontSize', Gproperties.fontsize,... + 'BackgroundColor', [0.4 0.4 0.4],... + 'ForegroundColor', 'w',... + 'Position',[pl pb pw ph], 'Units', 'normalized'); + +% Buttons +buts = {'mean', 'median', 'sum', 'std', 'var'}; +bl = pmarg; +bb = 1-pmarg-bheight; +for j=1:numel(buts) + bh = uicontrol(pan, 'String',buts{j},... + 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ... + 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ... + 'Position',[bl bb bwidth bheight]); + % move + bl = bl + bwidth + pmarg; + if bl + bwidth > (1-pmarg) + bl = pmarg; + bb = bb - bheight - pmarg; + end +end + +%----------------------- Trig panel +pl = pmarg; +pb = pmarg; +% Panel +pan = uipanel(panH, 'Title','Trig ','FontSize', Gproperties.fontsize,... + 'BackgroundColor', [0.4 0.4 0.4],... + 'ForegroundColor', 'w',... + 'Position',[pl pb pw ph], 'Units', 'normalized'); + +% Buttons +buts = {'sin', 'asin', 'cos', 'acos', 'tan', 'atan', 'log', 'log10', 'exp'}; +bl = pmarg; +bb = 1-pmarg-bheight; +for j=1:numel(buts) + bh = uicontrol(pan, 'String',buts{j},... + 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ... + 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ... + 'Position',[bl bb bwidth bheight]); + % move + bl = bl + bwidth + pmarg; + if bl + bwidth > (1-pmarg) + bl = pmarg; + bb = bb - bheight - pmarg; + end +end + +%----------------------- Misc panel +pl = 0.5 + pmarg; +pb = pmarg; +% Panel +pan = uipanel(panH, 'Title','Misc ','FontSize', Gproperties.fontsize,... + 'BackgroundColor', [0.4 0.4 0.4],... + 'ForegroundColor', 'w',... + 'Position',[pl pb pw ph], 'Units', 'normalized'); + +% Buttons +buts = {'sqrt', 'real', 'imag', 'conj', 'abs', 'phase'}; +bl = pmarg; +bb = 1-pmarg-bheight; +for j=1:numel(buts) + bh = uicontrol(pan, 'String',buts{j},... + 'Callback', {@ltpdv_calc_btn, mainfig, 1}, ... + 'Units', 'normalized', 'Fontsize', BUTTON_FONT, ... + 'Position',[bl bb bwidth bheight]); + % move + bl = bl + bwidth + pmarg; + if bl + bwidth > (1-pmarg) + bl = pmarg; + bb = bb - bheight - pmarg; + end +end +