function dt_initcontrol
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% dt_initcontrol.m
%
% initialize Detector Control Window GUI:
%   push buttons, sliders, radio buttons, editable text boxes, info text display
%
% ripped off from initcontrol triton v1.61
% mss 060905
%%
% Do not modify the following line, maintained by CVS
% $Id: dt_initcontrol.m,v 1.2 2008/01/11 21:31:49 msoldevilla Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global HANDLES PARAMS

% 14 rows, 4 columns
r = 16; % rows      (extra space for separations btw sections)
c = 4;  % columns
h = 1/r;
w = 1/c;
%
% make x and y locations in plot control window (relative units)
for ci = 1:c
    x(:,ci) = ((ci-1)/c) .* ones(r,1);
    y(:,ci) = h .* [r-1:-1:0]';
end
%
% offset y to provide space between control sections

dy = h * 0.25;

%row 1
ri = 1;
y(ri,:) = y(ri,:) - dy;

% rows 2-4
ri = 2;
y(ri,:) = y(ri,:) - ri * dy;
y(ri+1,:) = y(ri+1,:) - ri * dy;
y(ri+2,:) = y(ri+2,:) - ri * dy;    

% rows 5-6
ri = 3;
y(ri+2,:) = y(ri+2,:) - ri * dy;
y(ri+3,:) = y(ri+3,:) - ri * dy;

% rows 7-8
for ri = 4:5;
y(ri+3,:) = y(ri+3,:) - ri * dy;
end

% rows 9-10, 11-12, 13-14
for ri = 5:7     
    y(2*ri-1,:) = y(2*ri-1,:) - (ri+1) * dy;
    y(2*ri,:) = y(2*ri,:) - (ri+1) * dy;
end


% % rows 2-3,4-5,6-7,8-9,
% for ri = 2:5
%     y(2*ri-2,:) = y(2*ri-2,:) - ri * dy;
%     y(2*ri-1,:) = y(2*ri-1,:) - ri * dy;
% end
% % rows 10-15
% for ri = 5:10
%     y(ri+5,:) = y(ri+5,:) - (ri+1) * dy;
% end
% 
% % rows 16-17, 18-19, 20-21, 22-23, 24-25, 26-27
% shift = 2 * h;
% for ri = 8:14
%    y(2*ri-2,:) = y(2*ri-2,:) - (ri+1)*dy + shift;
%    y(2*ri-1,:) = y(2*ri-1,:) - (ri+1)*dy + shift;
% end
% % row 28-40
% for ri = 14: r-14
%     y(ri+14,:) = y(ri+14,:) - (ri+2) * dy + shift;
% end
%

bgColor = [1 1 1];  % white

bgColor2 = [.75 1 .875]; % light green for LTSA
bgColor3 = [.75 .875 1]; % light blue for XWAV




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% LTSA Heading
% row 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
labelStr='LTSA Detector Options';
btnPos=[x(1,1) y(1,1) 2*w h];
HANDLES.ltsa.dt.headtext = uicontrol(HANDLES.fig.dt, ...
    'Style','text', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor2,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off'); 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Spectrogram Heading
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
labelStr='Spectrogram Detector Options';
btnPos=[x(1,3) y(1,3) 2*w h];
HANDLES.dt.headtext = uicontrol(HANDLES.fig.dt, ...
    'Style','text', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor3,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off'); 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% LTSA Detector Options
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Ignore Periodic Signals Options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Enable/disable Periodic Signal Removal
%***********************************
labelStr = 'Ignore Periodic Signals';
btnPos = [x(2,3) y(2,3) w*2 h];
HANDLES.ltsa.dt.IgnPeriodic = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor2,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', PARAMS.ltsa.dt.ignore_periodic,...
    'Callback','dtcontrol_ltsa(''IgnorePeriodic_toggle'')'); 

%***********************************
% Low Period Text
%***********************************
labelStr = 'Low Period (s)';
btnPos=[x(3,3) y(3,3) w h];
HANDLES.ltsa.dt.LPeriodTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Low Period Editable Text
%***********************************
labelStr=num2str(3*60);
btnPos=[x(4,3) y(4,3) w h];
HANDLES.ltsa.dt.LPeriodEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''LowPeriod'')');
%***********************************
% High Period Text
%***********************************
labelStr = 'High Period (s)';
btnPos=[x(3,4) y(3,4) w h];
HANDLES.ltsa.dt.HPeriodTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% High Period Editable Text
%***********************************
labelStr=num2str(7*60);
btnPos=[x(4,4) y(4,4) w h];
HANDLES.ltsa.dt.HPeriodEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''HighPeriod'')');

HANDLES.ltsa.dt.PeriodicEdit=[HANDLES.ltsa.dt.LPeriodTxt,...
    HANDLES.ltsa.dt.LPeriodEdtxt, HANDLES.ltsa.dt.HPeriodTxt, ...
    HANDLES.ltsa.dt.HPeriodEdtxt];

HANDLES.ltsa.dt.Periodic=[HANDLES.ltsa.dt.IgnPeriodic,... 
    HANDLES.ltsa.dt.PeriodicEdit];


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Detector Frequency Range
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Frequency Range Text
%***********************************
labelStr = 'Frequency Range';
btnPos=[x(2,1) y(2,1) w*2 h];
HANDLES.ltsa.dt.FreqRngTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');

%***********************************
% Minimum Frequency Text
%***********************************
labelStr = 'Min Freq (Hz)';
btnPos=[x(3,1) y(3,1) w h];
HANDLES.ltsa.dt.MinFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.ltsa.dt.HzRange(1));
btnPos=[x(4,1) y(4,1) w h];
HANDLES.ltsa.dt.MinFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''MinFreq'')');
%***********************************
% Maximum Frequency Text
%***********************************
labelStr = 'Max Freq (Hz)';
btnPos=[x(3,2) y(3,2) w h];
HANDLES.ltsa.dt.MaxFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Maximum Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.ltsa.dt.HzRange(2));
btnPos=[x(4,2) y(4,2) w h];
HANDLES.ltsa.dt.MaxFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''MaxFreq'')');


HANDLES.ltsa.dt.FreqControls = [HANDLES.ltsa.dt.FreqRngTxt, ... 
    HANDLES.ltsa.dt.MinFreqTxt, HANDLES.ltsa.dt.MinFreqEdtxt, ...
    HANDLES.ltsa.dt.MaxFreqTxt, HANDLES.ltsa.dt.MaxFreqEdtxt];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Minimum Signal Duration
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Min Signal Duration Text
%***********************************
labelStr = 'Min Duration (s)';
btnPos=[x(5,1) y(5,1) w h];
HANDLES.ltsa.dt.MinDurTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Enable', 'off', ...                   %%%%%%%%%Turn this on when created
   'Visible','off');
%***********************************
% Min Signal Duration Editable Text
%***********************************
labelStr=('Default');
btnPos=[x(6,1) y(6,1) w h];
HANDLES.ltsa.dt.MinDurEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Enable', 'off',...                   %%%%%%%%%Turn this on when created
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''MinDuration'')');

HANDLES.ltsa.dt.SigDurationControl = [HANDLES.ltsa.dt.MinDurTxt, ...
    HANDLES.ltsa.dt.MinDurEdtxt];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Detector Threshold
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Threshold Text
%***********************************
labelStr = 'Threshold (dB)';
btnPos=[x(5,2) y(5,2) w h];
HANDLES.ltsa.dt.ThresholdTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Threshold Editable Text
%***********************************
labelStr=num2str(PARAMS.ltsa.dt.Threshold_dB);
btnPos=[x(6,2) y(6,2) w h];
HANDLES.ltsa.dt.ThresholdEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''Threshold'')');

HANDLES.ltsa.dt.ThresholdControls = [HANDLES.ltsa.dt.ThresholdTxt, ...
    HANDLES.ltsa.dt.ThresholdEdtxt];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Noise Subtraction Options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Enable/disable Manual Noise Pick
%***********************************
labelStr = 'Pick Noise';
btnPos = [x(7,4) y(7,4) w h];
HANDLES.ltsa.dt.NoiseEst = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor2,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', PARAMS.ltsa.dt.mean_selection,...
    'Callback','dtcontrol_ltsa(''detection_noise'')'); 

%***********************************
% Mean Subtraction Text
%***********************************
labelStr = 'Rolling Mean (h)';
btnPos=[x(5,4) y(5,4) w h];
HANDLES.ltsa.dt.MeanSubDurTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor2,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Mean Subtraction Editable Text
%***********************************
labelStr=num2str(PARAMS.ltsa.dt.MeanAve_hr);
btnPos=[x(6,4) y(6,4) w h];
HANDLES.ltsa.dt.MeanSubDurEdTxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol_ltsa(''MeanSubtractionDuration'')');
  
    
HANDLES.ltsa.dt.MeanNoiseControls = [HANDLES.ltsa.dt.MeanSubDurTxt,...
    HANDLES.ltsa.dt.MeanSubDurEdTxt];

HANDLES.ltsa.dt.NoiseControls = [HANDLES.ltsa.dt.NoiseEst, ...
    HANDLES.ltsa.dt.MeanNoiseControls];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Detection Plot Options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Enable/disable plotting of detections
%***********************************
labelStr = 'Plot detections';
btnPos = [x(7,1) y(7,1) 2*w h];
HANDLES.ltsa.dt.plot = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor2,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', 1,...
    'Callback','dtcontrol_ltsa(''plot_toggle'')'); 
%***********************************
% Enable/disable plotting of classifications
%***********************************
labelStr = 'Plot call class';
btnPos = [x(7,2) y(7,2) w h];
HANDLES.ltsa.dt.PlotClass = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor2,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', 0,...
    'Callback','dtcontrol_ltsa(''PlotClass_toggle'')'); 

HANDLES.ltsa.dt.PlotControls = [ HANDLES.ltsa.dt.plot , ...
    HANDLES.ltsa.dt.PlotClass];

HANDLES.ltsa.dt.AllControls=[HANDLES.ltsa.dt.headtext, ...
    HANDLES.ltsa.dt.Periodic, HANDLES.ltsa.dt.FreqControls, ...
    HANDLES.ltsa.dt.SigDurationControl, HANDLES.ltsa.dt.ThresholdControls, ...
    HANDLES.ltsa.dt.NoiseControls, HANDLES.ltsa.dt.PlotControls];


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%  Spectrogram detection control
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Noise Subtraction Options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Enable/disable Manual Noise Pick
%***********************************
labelStr = 'Pick Noise';
btnPos = [x(8,4) y(8,4) w h];
HANDLES.dt.NoiseEst = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor3,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Enable', 'off',...                   %%%%%%%%%Turn this on when created
    'Value', 0,...
    'Callback','dtcontrol(''detection_noise'')'); 

%***********************************
% Mean Subtraction Text
%***********************************
labelStr = 'Mean Subtraction Duration (s)';
btnPos=[x(8,1) y(8,1) 2*w h];
HANDLES.dt.MeanSubDurTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Mean Subtraction Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.MeanAve_s);
btnPos=[x(8,3) y(8,3) w h];
HANDLES.dt.MeanSubDurEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MeanSubtractionDuration'')');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Call Type Options
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dx=0.008;
%***********************************
% Enable/disable Tonal Detections
%***********************************
labelStr = char('Tonal', 'Detections');
btnPos = [x(10,1) y(10,1) w 2*h];
HANDLES.dt.tonals = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor3,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', 1,...
    'Callback','dtcontrol(''dt_tonals'')'); 
%***********************************
% Enable/disable broadband detections
%***********************************
labelStr = char('Broadband', 'Detections');
btnPos = [x(10,3)+dx y(10,3) (1-dx)*w 2*h];
HANDLES.dt.broadbands = uicontrol(HANDLES.fig.dt, ...
    'Style','radiobutton', ...
    'Units','normalized', ...
    'Position',btnPos, ...
    'BackgroundColor',bgColor3,...
    'String',labelStr, ...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Value', 1,...
    'Callback','dtcontrol(''dt_broadbands'')'); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Detector Thresholds
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Tonal Threshold Text
%***********************************
labelStr = 'Threshold (dB)';
btnPos=[x(9,2) y(9,2) (1-dx)*w h];
HANDLES.dt.TonalThresholdTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Tonal Threshold Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Thresholds(1));
btnPos=[x(10,2) y(10,2) (1-dx)*w h];
HANDLES.dt.TonalThresholdEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''TonalThreshold'')');
%***********************************
% Broadband Threshold Text
%***********************************
labelStr = 'Threshold (dB)';
btnPos=[x(9,4) y(9,4) w h];
HANDLES.dt.BBThresholdTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Broadband Threshold Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Thresholds(2));
btnPos=[x(10,4) y(10,4) w h];
HANDLES.dt.BBThresholdEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''BBThreshold'')');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Detector Frequency Ranges
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Minimum Tonal Frequency Text
%***********************************
labelStr = 'Min Freq (Hz)';
btnPos=[x(11,1) y(11,1) w h];
HANDLES.dt.MinTonalFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Tonal Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Ranges(1,1));
btnPos=[x(12,1) y(12,1) w h];
HANDLES.dt.MinTonalFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MinTonalFreq'')');
%***********************************
% Maximum Tonal Frequency Text
%***********************************
labelStr = 'Max Freq (Hz)';
btnPos=[x(11,2) y(11,2) (1-dx)*w h];
HANDLES.dt.MaxTonalFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Maximum Tonal Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Ranges(1,2));
btnPos=[x(12,2) y(12,2) (1-dx)*w h];
HANDLES.dt.MaxTonalFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MaxTonalFreq'')');
%***********************************
% Minimum Broadband Frequency Text
%***********************************
labelStr = 'Min Freq (Hz)';
btnPos=[x(11,3)+dx y(11,3) (1-dx)*w h];
HANDLES.dt.MinBBFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Broadband Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Ranges(2,1));
btnPos=[x(12,3)+dx y(12,3) (1-dx)*w h];
HANDLES.dt.MinBBFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MinBroadbandFreq'')');
%***********************************
% Maximum Broadband Frequency Text
%***********************************
labelStr = 'Max Freq (Hz)';
btnPos=[x(11,4) y(11,4) w h];
HANDLES.dt.MaxBBFreqTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Maximum Broadband Frequency Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.Ranges(2,2));
btnPos=[x(12,4) y(12,4) w h];
HANDLES.dt.MaxBBFreqEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MaxBroadbandFreq'')');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Tonal Duration Info
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Minimum Duration Text
%***********************************
labelStr = 'Min Duration (s)';
btnPos=[x(13,1) y(13,1) w h];
HANDLES.dt.MinDurTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Duration Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.WhistleMinLength_s);
btnPos=[x(14,1) y(14,1) w h];
HANDLES.dt.MinDurEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MinTonalDuration'')');
%***********************************
% Minimum Tonal Separation Text
%***********************************
labelStr = 'Min Separation (s)';
btnPos=[x(13,2) y(13,2) (1-dx)*w h];
HANDLES.dt.MinSepTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Tonal Separation Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.WhistleMinSep_s);
btnPos=[x(14,2) y(14,2) (1-dx)*w h];
HANDLES.dt.MinSepEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MinTonalSeparation'')');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Broadband bandwidth Info
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%***********************************
% Minimum Broadband Saturation Text
%***********************************
labelStr = 'Min Saturation (Hz)';
btnPos=[x(13,3)+dx y(13,3) (1-dx)*w h];
HANDLES.dt.MinBBSatTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Minimum Broadband Saturation Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.MinClickSaturation);
btnPos=[x(14,3)+dx y(14,3) (1-dx)*w h];
HANDLES.dt.MinBBSatEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MinBBSaturation'')');
%***********************************
% Maximum Broadband Saturation Text
%***********************************
labelStr = 'Max Saturation (Hz)';
btnPos=[x(13,4) y(13,4) w h];
HANDLES.dt.MaxBBSatTxt = uicontrol(HANDLES.fig.dt,...
   'Style','text',...
   'Units','normalized',...
   'Position',btnPos,...
   'BackgroundColor',bgColor3,...
   'String',labelStr,...
   'FontUnits','normalized', ...
   'Visible','off');
%***********************************
% Maximum Broadband Bandwidth Editable Text
%***********************************
labelStr=num2str(PARAMS.dt.MaxClickSaturation);
btnPos=[x(14,4) y(14,4) w h];
HANDLES.dt.MaxBBSatEdtxt = uicontrol(HANDLES.fig.dt,...
    'Style','edit',...
    'Units','normalized',...
    'Position',btnPos,...
    'BackgroundColor',bgColor,...
    'String',labelStr,...
    'FontUnits','normalized', ...
    'Visible','off',...
    'Callback','dtcontrol(''MaxBBSaturation'')');



HANDLES.dt.MeanNoiseControls = [HANDLES.dt.MeanSubDurTxt, ...
    HANDLES.dt.MeanSubDurEdtxt];

HANDLES.dt.NoiseControls = [HANDLES.dt.NoiseEst, ...
    HANDLES.dt.MeanNoiseControls];

HANDLES.dt.TonalControls = [HANDLES.dt.MinTonalFreqTxt, ...
    HANDLES.dt.MinTonalFreqEdtxt, HANDLES.dt.MaxTonalFreqTxt, ...
    HANDLES.dt.MaxTonalFreqEdtxt, HANDLES.dt.MinDurTxt, ...
    HANDLES.dt.MinDurEdtxt, HANDLES.dt.MinSepTxt, HANDLES.dt.MinSepEdtxt, ...
    HANDLES.dt.TonalThresholdTxt, HANDLES.dt.TonalThresholdEdtxt];

HANDLES.dt.BBControls = [HANDLES.dt.MinBBFreqTxt, HANDLES.dt.MinBBFreqEdtxt, ...
    HANDLES.dt.MaxBBFreqTxt, HANDLES.dt.MaxBBFreqEdtxt, ...
    HANDLES.dt.MinBBSatTxt, HANDLES.dt.MinBBSatEdtxt, ...  
    HANDLES.dt.MaxBBSatTxt, HANDLES.dt.MaxBBSatEdtxt, ...  
    HANDLES.dt.BBThresholdTxt, HANDLES.dt.BBThresholdEdtxt];

HANDLES.dt.AllControls = [HANDLES.dt.headtext, HANDLES.dt.NoiseControls, ...
    HANDLES.dt.tonals, HANDLES.dt.TonalControls, HANDLES.dt.broadbands, ...
    HANDLES.dt.BBControls];


