%
%  Name: modmenu.m
% 
%  Usage: modmenu
% 
%  Description:
%    Initializes modal analysis menus
%

%  Version SWD970710
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%		ESA-EA
%
%  Copyright (c) 1997, The Regents of the University
%     	of California. (See top level of code for
%        full copyright statement)
%

%%=============================================
%% Menu Items for modal analysis
%%=============================================
%=======================================
% Load/Save menu
%========================================
hmmenu(2)=uimenu(figNumber,'Label','Load/Save','enable','on');
   h2=uimenu(hmmenu(2),'Label','Load');
     h3= uimenu(h2,'Label','Data');
	 uimenu(h3,'Label','Primary','Callback', ...
             ['[filename,pathname,error]=loadfile(0,pathname);', ...
              'if error==0,',...
	      'disp(''Loading Primary Data...''),',...
	      '	nds=1; loaddata;',...
	      'disp(''Done Loading Primary Data''),',...
		'end']);
	uimenu(h3,'Label','Secondary','Callback', ...
             ['[filename,pathname,error]=loadfile(0,pathname);', ...
              'if error==0,',...
		'disp(''Loading Secondary Data...''),',...
		'	nds=2; loaddata;',...
		'disp(''Done Loading Secondary Data''),',...
		' end']);
      uimenu(h2,'Label','Modes','Callback', ...
             ['[filename,pathname,error]=loadfile(1,pathname);', ...
               'if error==0,',...
		'disp(''Loading Modes...''),',...
		'eval([''load '' [pathname,filename]]);', ...
		'set(hmmenu(6),''enable'',''on''),',...
	         'disp(''Done Loading Modes''),',...
		'end;']);             
      uimenu(h2,'Label','Geometry','Callback', ...
             ['[filename,pathname,error]=loadfile(2,pathname);', ...
                'if error==0,',...
                '   loadgeom,',...
                'end;']);
   h2=uimenu(hmmenu(2),'Label','Save');
      uimenu(h2,'Label','Data','Callback', ...
             ['[filename,pathname,error]=savefile(0,pathname);', ...
              'if error==0,',...
		'  savedata,',...
	      'end;']);
      uimenu(h2,'Label','Modes','Callback', ...
             ['[filename,pathname,error]=savefile(1,pathname);', ...
	      'if error==0,',...
		'disp(''Saving Modes...''),',...
		'savemode,',...
		'disp(''Done Saving Modes''),',...
		'end,']);
      uimenu(h2,'Label','Geometry','Callback', ...
             ['[filename,pathname,error]=savefile(2,pathname);', ...
                'if error==0,',...
                ' savegeom,',...
                'end,']);

%=======================================
% Geometry menu
%========================================
hmmenu(3)=uimenu(figNumber,'Label','Geometry/DOF','enable','on');
   uimenu(hmmenu(3),'Label','Edit Geometry','Callback','editgeom');
   uimenu(hmmenu(3),'Label','Edit DOF List','Callback','makeDOF');
   
%=======================================
% Data menu
%========================================
hmmenu(4)=uimenu(figNumber,'Label','Data','enable','off');
   	 h4(6) = uimenu(hmmenu(4),'Label','Select Data Function');
         h4(1) = uimenu(h4(6),'label','FRF','callback',['nds = 1; nfunc = 1; assignG,',...
			'set(h4(1:5),''checked'',''off''), set(h4(1),''checked'',''on''), dataplot,']);
   	   h4(2) = uimenu(h4(6),'label','COH','callback',['nds = 1; nfunc = 2; assignG,',...
			'set(h4(1:5),''checked'',''off''), set(h4(2),''checked'',''on''), dataplot,']);
    	   h4(3) = uimenu(h4(6),'label','CPS','callback',['nds = 1; nfunc = 3; assignG,',...
			'set(h4(1:5),''checked'',''off''), set(h4(3),''checked'',''on''), dataplot,']);
	   h4(4) = uimenu(h4(6),'label','PSD Resp','callback',['nds = 1; nfunc = 4; assignG,',...
			'set(h4(1:5),''checked'',''off''), set(h4(4),''checked'',''on''), dataplot,']);
	   h4(5) = uimenu(h4(6),'label','PSD Ref','callback',['nds = 1; nfunc = 5; assignG,',...
			'set(h4(1:5),''checked'',''off''), set(h4(5),''checked'',''on''), dataplot,']);
   uimenu(hmmenu(4),'Label','Plot','Callback',[ ...
	'set(figNumber,''name'',''Diamond:  Modal Analysis (plot)'');', ...
	'dataplot']);
   uimenu(hmmenu(4),'Label','Multi-plot','Callback','mplot1');

%=======================================
% Identify Modes menu
%========================================
 hmmenu(5)=uimenu(figNumber,'Label','Identify Modes','enable','off');
         uimenu(hmmenu(5),'Label','Peak Picking','Callback',[ ...
	'set(figNumber,''name'',''Diamond:  Modal Analysis (Peak Picking)'');', ...
	'drawnow,',...
	'peakpick;']);
       uimenu(hmmenu(5),'Label','ERA','Callback',[ ...
	'set(figNumber,''name'',''Diamond:  Modal Analysis (ERA)'');', ...
	'ERAwind']);
       uimenu(hmmenu(5),'Label','Complex Exponential','Callback',[ ...
	'set(figNumber,''name'',''Diamond:  Modal Analysis (Complex Exponential)'');', ... 
        'CEwind']);
       uimenu(hmmenu(5),'Label','Rational Polynomial','Callback',[ ...
	'set(figNumber,''name'',''Diamond:  Modal Analysis (Rational Polynomial)'');', ...
	'RPwindow']);
    uimenu(hmmenu(5),'Label','NL Least Squares','Callback','disp(''This item is not operational yet'')',...
	'enable','off');
    uimenu(hmmenu(5),'label','Clear Modes (NO UNDO!)',...
	'callback',['clear Freq Damp phic_resp phic_ref phir_resp phir_ref Freqall Dampall Phicrespall Phicrefall Phirrespall Phirrefall,',...
			' set(hmmenu(6),''enable'',''off''),',...
			'disp(''MODES CLEARED''),']);

%=======================================
% Analyze Modes menu
%========================================
hmmenu(6) = uimenu(figNumber,'label','Analyze Modes','enable','off');
   
    uimenu(hmmenu(6),'Label','Print Freq and Damp', ...
	'Callback','prntfreq');
    uimenu(hmmenu(6),'Label','Plot Mode Shapes', ...
	'Callback',['nomodes;',...
		'if exist(''Nodes'')~=1,',...
		' disp(''ERROR: No Geometry Loaded - Cannot View Modes''),',...
		'elseif imodes == 0,',...
		' disp(''No Mode Shapes Defined - Cannot View Modes''),',...
      'else,',...
      ' if exist(''phir_resp'')==1, ipltcmplx=1; else,',...
      ' ipltcmplx = 2; end,',...
      ' iopDOF=1; iplt_t=0;',...
		' asphiplt,',...
		' viewmode,',...
		'end,']);

    uimenu(hmmenu(6),'Label','Analyze Complex Modes', ...
	'Callback',['nomodes;',...
		'if imodesc == 1,', ...
		' acmplxmd,', ...
		'else,', ...
		' disp(''No Complex mode shapes defined - Cannot Analyze Complex Modes'');', ...
		'end;']);
    uimenu(hmmenu(6),'Label','Analyze Real Modes', ...
	'Callback',['nomodes;',...
		'if imodesr == 1,', ...
		' arealmd,', ...
		'else,', ...
		' disp(''No Real mode shapes defined - Cannot Analyze Real Modes'');', ...
      'end;']);


