function mdselwin
%
%   Name: mdselwin
%
%   Usage: mdselwin
%
%   Description: Pallette window for selection of active modes 
%     
%   The following variable is defined in the workspace
%	by these features:
%
%       mode_anal - vector of indices of modes to use in the analysis
%  

     
%
%  Version SWD980513
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global HANDLES

HANDLES.hmdsel(1) = figure('units','pixels','position',[30 30 300 200],...
			'menubar','none','numbertitle','off','resize','off',...
			'name','Diamond: Mode Selection','visible','off');

top=.95;
left=.05;
btnwd=.25;
btnht=.1;
spacing=.01;

%
%  Close Button

btnpos = [1-spacing-btnwd 0.01 btnwd btnht];
HANDLES.hmdsel(2) = uicontrol(HANDLES.hmdsel(1),...
	'style','push',...
	'units','normal',...
	'position',btnpos,...
	'string','Close',...
	'call','set(HANDLES.hmdsel(1),''visible'',''off'')');

%
%  Use All Modes Checkbox
%

btnpos = [0.55 0.5 0.4 0.1];
HANDLES.hmdsel(3) = uicontrol(HANDLES.hmdsel(1),...
	'style','checkbox',...
	'units','normal',...
	'position',btnpos,...
	'string','Use All Modes',...
	'value',0,...
   'callback',...
   ['if ~isempty(DAMAGEID),',...
      'if get(HANDLES.hmdsel(3),''value'') == 1,',...
			' set(HANDLES.hmdsel(4:5),''visible'',''off''),',...
			' DAMAGEID.mode_anal = [1:length(DAMAGEID.undammode)];',...
		    ' else,',...
			' set(HANDLES.hmdsel(4:5),''visible'',''on''),',...
			' set(HANDLES.hmdsel(5),''string'',mat2str(DAMAGEID.mode_anal)),',...
         ' end,',...
         'elseif ~isempty(MODELCOR),',...
           'if get(HANDLES.hmdsel(3),''value'') == 1,',...
			'    set(HANDLES.hmdsel(4:5),''visible'',''off''),',...
			'    MODELCOR.mode_anal = [1:size(MODELCOR.measmode,2)];',...
		   '  else,',...
			'    set(HANDLES.hmdsel(4:5),''visible'',''on''),',...
			'    set(HANDLES.hmdsel(5),''string'',mat2str(MODELCOR.mode_anal)),',...
         '  end,',...
         'end,']);


%
%  Enter Vector of modes to keep
%

btnpos = [0.05 0.3 0.15 0.1];
HANDLES.hmdsel(4) = uicontrol(HANDLES.hmdsel(1),...
	'style','text',...
	'units','normal',...
	'position',btnpos,...
	'string','Modes:');

btnpos = [0.20 0.3 0.5 0.1];
HANDLES.hmdsel(5) = uicontrol(HANDLES.hmdsel(1),...
	'style','edit',...
	'units','normal',...
	'position',btnpos,...
	'string','[ 1 ]',...
   'callback',...
   ['if ~isempty(DAMAGEID),',...
      '  DAMAGEID.mode_anal = str2num(get(HANDLES.hmdsel(5),''string''));',...
      'elseif ~isempty(MODELCOR),',...
      '  MODELCOR.mode_anal = str2num(get(HANDLES.hmdsel(5),''string''));',...
      'end,']);

return
