Home > m > gui > ltpdv > callbacks > ltpdv_buildMathPanel.m

ltpdv_buildMathPanel

PURPOSE ^

SYNOPSIS ^

function ltpdv_buildMathPanel(panH, mainfig)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ltpdv_buildMathPanel(panH, mainfig)
0002 
0003 Gproperties = getappdata(mainfig, 'Gproperties');
0004 
0005 % Sizes
0006 pmarg   = 0.025;           % Margin size
0007 pw      = 0.5 - 2*pmarg;   % Panel width
0008 ph      = 0.3;            % Panel height
0009 bheight = 0.2;             % Button height
0010 bwidth  = 0.2;            % Button width
0011 BUTTON_FONT = 12;
0012 %--------------------- Calculator pad
0013 pl = pmarg;
0014 pb = 0.5 + pmarg;
0015 % Panel
0016 pan =  uipanel(panH, 'Title','Calculator  ','FontSize', Gproperties.fontsize,...
0017    'BackgroundColor', [0.4 0.4 0.4],...
0018    'ForegroundColor', 'w',...
0019    'Position',[pl pb pw ph], 'Units', 'normalized');
0020 
0021 % Buttons
0022 buts = {'+', '-', './', '.*', '.^', '*', '/', '^'};
0023 bl = pmarg;
0024 bb = 1-pmarg-bheight;
0025 for j=1:numel(buts)
0026    bh = uicontrol(pan, 'String',buts{j},...
0027       'Callback', {@ltpdv_calc_btn, mainfig, 2}, ...
0028       'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
0029       'Position',[bl bb bwidth bheight]);
0030    % move
0031    bl = bl + bwidth + pmarg;
0032    if bl + bwidth > (1-pmarg)
0033       bl = pmarg;
0034       bb = bb - bheight - pmarg;
0035    end
0036 end
0037 
0038 %----------------------- Stats panel
0039 pl = 0.5 + pmarg;
0040 pb = 0.5 + pmarg;
0041 % Panel
0042 pan =  uipanel(panH, 'Title','Stats  ','FontSize', Gproperties.fontsize,...
0043    'BackgroundColor', [0.4 0.4 0.4],...
0044    'ForegroundColor', 'w',...
0045    'Position',[pl pb pw ph], 'Units', 'normalized');
0046 
0047 % Buttons
0048 buts = {'mean', 'median', 'sum', 'std', 'var'};
0049 bl = pmarg;
0050 bb = 1-pmarg-bheight;
0051 for j=1:numel(buts)
0052    bh = uicontrol(pan, 'String',buts{j},...
0053       'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
0054       'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
0055       'Position',[bl bb bwidth bheight]);
0056    % move
0057    bl = bl + bwidth + pmarg;
0058    if bl + bwidth > (1-pmarg)
0059       bl = pmarg;
0060       bb = bb - bheight - pmarg;
0061    end
0062 end
0063 
0064 %----------------------- Trig panel
0065 pl = pmarg;
0066 pb = pmarg;
0067 % Panel
0068 pan =  uipanel(panH, 'Title','Trig  ','FontSize', Gproperties.fontsize,...
0069    'BackgroundColor', [0.4 0.4 0.4],...
0070    'ForegroundColor', 'w',...
0071    'Position',[pl pb pw ph], 'Units', 'normalized');
0072 
0073 % Buttons
0074 buts = {'sin', 'asin', 'cos', 'acos', 'tan', 'atan', 'log', 'log10', 'exp'};
0075 bl = pmarg;
0076 bb = 1-pmarg-bheight;
0077 for j=1:numel(buts)
0078    bh = uicontrol(pan, 'String',buts{j},...
0079       'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
0080       'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
0081       'Position',[bl bb bwidth bheight]);
0082    % move
0083    bl = bl + bwidth + pmarg;
0084    if bl + bwidth > (1-pmarg)
0085       bl = pmarg;
0086       bb = bb - bheight - pmarg;
0087    end
0088 end
0089 
0090 %----------------------- Misc panel
0091 pl = 0.5 + pmarg;
0092 pb = pmarg;
0093 % Panel
0094 pan =  uipanel(panH, 'Title','Misc  ','FontSize', Gproperties.fontsize,...
0095    'BackgroundColor', [0.4 0.4 0.4],...
0096    'ForegroundColor', 'w',...
0097    'Position',[pl pb pw ph], 'Units', 'normalized');
0098 
0099 % Buttons
0100 buts = {'sqrt', 'real', 'imag', 'conj', 'abs', 'phase'};
0101 bl = pmarg;
0102 bb = 1-pmarg-bheight;
0103 for j=1:numel(buts)
0104    bh = uicontrol(pan, 'String',buts{j},...
0105       'Callback', {@ltpdv_calc_btn, mainfig, 1}, ...
0106       'Units', 'normalized', 'Fontsize', BUTTON_FONT, ...
0107       'Position',[bl bb bwidth bheight]);
0108    % move
0109    bl = bl + bwidth + pmarg;
0110    if bl + bwidth > (1-pmarg)
0111       bl = pmarg;
0112       bb = bb - bheight - pmarg;
0113    end
0114 end
0115

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003