function ltpdv_buildSpectralPanel(panH, mainfig)


Gproperties = getappdata(mainfig, 'Gproperties');

% List of functions
preFcns = ltpdv_spectral_function_list;

% Margins
pmarg = 0.025;

% Text string
ll = pmarg;
lh = 0.05;
lb = 1-pmarg-lh;
lw = 0.3;
sth = uicontrol(panH,'Style','text',...
   'String','Functions',...
   'Units', 'normalized', ...
   'BackgroundColor', Gproperties.Gcol, ...
   'Fontsize', 12, ...
   'Position',[ll lb lw lh]);

% Params panel
pl = pmarg + 0.3 + pmarg;
pb = 0.1;
pw = 1-pl-pmarg;
ph = 1 - pb - pmarg;

paramh = uipanel('Parent',panH,'Title','Parameters',...
   'Units', 'normalized', ...
   'BackgroundColor', 0.8*[0.99 0.92 0.82], ...
   'Fontsize', 12, ...
   'Tag', 'LTPDVspectralparampan', ...
   'Position',[pl pb pw ph]);

% Function list
ll = pmarg;
lb = pmarg;
lw = 0.3;
lh = 1-2*pmarg - 0.05;
lh = uicontrol(panH, 'Style', 'listbox', ...
   'String', preFcns(:,2),...
   'BackgroundColor', 'w', ...
   'Value',1, 'Units', 'normalized', ...
   'Fontsize', 12, ...
   'Tag', 'LTPDVspectralfcnlist', ...
   'Position',[ll lb lw lh], ...
   'Callback', {@ltpdv_spectral_fcnlist, paramh, mainfig});

% Build params
ltpdv_spectral_fcnlist(lh, paramh, mainfig);

% Process button
phght = 0.05;
pbott = pmarg;
pwidt = 0.2;
pleft = 1-pmarg-pwidt;
pbh = uicontrol(panH,'Style','pushbutton',...
   'String','Process',...
   'Callback', {@ltpdv_fcn_run, 'spectral', panH, mainfig}, ...
   'Units', 'normalized', ...
   'Position',[pleft pbott pwidt phght]);



