function [hanalr] = anrebtns(figNumber)
% Function: anrebtns.m
% 
% Usage: hanalr = anrebtns(figNumber);
% 
% Description:
%    Initializes the Analyze Real Modes Window
%    Handles and graphics elements.
%    Returns a vector to those elements.
%
% Version SWD970521
%
% Author(s): Erik Straser, estraser@lanl.gov
%   modified by Scott W. Doebling, doebling@lanl.gov
%
% Institution: Los Alamos National Laboratory, ESA-EA
%
% Copyright (c) 1996, The Regents of the University
%     	of California.

%%===========================================
%% Analyze Real Modes buttons
%%===========================================

%====================================
% General buttons parameters
%====================================
top=.95;
left=.84;
btnwd=.15;
btnht=.06;
spacing=.01;

%====================================
% Set up the console frame
%=====================================
frmborder=0.01;
ypos=.05-frmborder;
frmpos=[left-frmborder ypos btnwd+2*frmborder .95+2*frmborder];
hanalr(1)=uicontrol(figNumber, ...
        'Style','Frame', ...
        'Position',frmpos, ...
        'BackgroundColor',[.5 .5 .5]);

%
% Set up plot axes
%

hanalr(2) = axes('position',[.1 .22 .7 .7]);

%
% MAC Button
%

btnnum=0.75;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd btnht];
hanalr(3)=uicontrol(figNumber, ...
      'style','pushbutton', ...
      'position',btnpos, ...
      'string','Plot MAC',...
      'callback',['showall(onHndlVector(2));',...
		'ipltcmplx = 1; iplt_t =0; asphiplt;',...
		'onHndlVector(2) = macplot(onHndlVector(2),Phiplot);']);

%
% Define Text box for Mode Number
%

btnnum=2.75;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left+0.5*btnwd ypos-btnht btnwd*0.5 btnht];
hanalr(4) = uicontrol('style','edit',...
	'pos',btnpos,...
        'string',1);

btnnum=2.75;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd*0.5 btnht];
hanalr(5)=uicontrol('style','text',...
	'pos',btnpos,...
    	'string','Mode');

%
%  Define Previous and Next Mode Buttons
%
btnnum=3.25;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd*0.5 btnht*0.5];
hanalr(6) = uicontrol('style','push',...
	'pos',btnpos,...
        'string','prev', ...
  	'callback',['nmod=nmod-1;', ...
		'set(onHndlVector(4),''string'',num2str(nmod));', ...
	  'if nmod<1,', ...
	     'disp(''Mode out of range''),', ...
	     'nmod=1;', ...
	     'set(onHndlVector(4),''string'',num2str(nmod));', ... 
	  'end;']);

btnnum=3.25;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left+0.5*btnwd ypos-btnht btnwd*0.5 btnht*0.5];
hanalr(7) = uicontrol('style','push',...
	'pos',btnpos,...
        'string','next', ...
  	'callback',['nmod=nmod+1;', ...
		'set(onHndlVector(4),''string'',num2str(nmod));', ...
	  'if nmod>size(Phi,2),', ...
	     'disp(''Mode out of range''),', ...
	     'nmod=size(Phi,2);', ...
	     'set(onHndlVector(4),''string'',num2str(nmod));', ...
	  'end;']);

%
% Driving point pair
%

btnnum=5;
ypos=top-(btnnum-1)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];
hanalr(8)=uicontrol(figNumber, ...
      'style','text', ...
      'position',btnpos, ...
      'string','Drive Pt Pair');
btnnum=6;
ypos=top-(btnnum-1)*(btnht+spacing)+spacing;
btnpos=[left ypos-btnht btnwd btnht];
hanalr(9)=uicontrol(figNumber, ...
      'style','edit', ...
      'position',btnpos, ...
      'string','[1 1]', ...
      'back','white', ...
      'callback','dppair=str2num(get(onHndlVector(9),''string''));');


%
% Menu of Mass Normalization Methods
%

btnnum=7;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd btnht];
hanalr(11)=uicontrol(figNumber, ...
      'style','popup', ...
      'position',btnpos, ...
      'string','Drive Pt.|Unit Mass',...
      'value',1,...
      'callback','imnmeth = get(onHndlVector(11),''value'');');

%
% Mass Normalization Button
%

btnnum=8;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd btnht];
hanalr(10)=uicontrol(figNumber, ...
      'style','pushbutton', ...
      'position',btnpos, ...
      'string','Normalize',...
      'callback',[...
       'if imnmeth == 1,',...
			'disp(''Normalizing Real Modes...''),',...
			'[phir_resp,phir_ref] = DPnorm(dppair,phir_resp,phir_ref);',...
			'norm_method = ''Driving Point'';',...
         'disp(''Done Normalizing Real Modes''),',...
       'elseif imnmeth == 2,',...
 			'disp(''Normalizing Real Modes...''),',...
         '[phir_resp,phir_ref] = unmnorm(phir_resp,phir_ref);',...
         'norm_method = ''Unit Mass Matrix'';',...
         'disp(''Done Normalizing Real Modes''),',...
		 'end,']);

%
%  Input/Output mode shape selector
%

btnnum=9;
ypos=top-(btnnum-1)*(btnht+spacing)+2*spacing;
btnpos=[left ypos-btnht btnwd btnht];
hanalr(12)  = uicontrol(figNumber, ...
      'style','popup', ...
      'position',btnpos, ...
      'Value',1,...
      'string','Resp DOF|Ref DOF', ...
       'callback','iopDOF=get(onHndlVector(12),''value'');');

set(hanalr,'visible','off')

return
