function orca(root);
%
% Call orca(root);
%
% root	= Root of an _orca.mat definitions file from another run 
%		  If root omitted or empty, orca checks for orc_def.mat containing _orca.mat 
%		  root from last run in directory.  In no orc_def.mat available, orca starts
%		  with iiprog=1;
%
% Graphical User Interface for running the ORCA normal model.
%
% Evan Westwood
% Applied Research Laboratories
% The University of Texas at Austin
%
% Set Bdef.size (after executing adi_global) to control size of bathymetry plot;
% Edit and run adi_global_set to customize plot sizes, contours, fonts, etc.
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
orca_global
format compact
if nargin<1, root=[]; end
if isempty(Odef), orca_global_set; end
%
% Close any other ORCA windows open:
figs=get(0,'Children'); names=get(figs,'Name'); ii=find(strcmp(names,'ORCA')); close(figs(ii));
%
bcol=[0 0 0]; fcol=[1 1 0];
box_sp=[.03 .03]; lab_h=0; lab_v=0.22;
%
orca_init;
%
if exist([root,'_orca.mat'],'file')==2,
% If [root,'_orca.mat'] file exists, use it:
	gui_file=[root,'_orca.mat'];
elseif exist('orca_def.mat','file')==2,
% If 'gui_def.mat' file exists, use _orca.mat file from last run:
	load orca_def; gui_file=[orca_root,'_orca.mat'];
else
% If nothing available set iiprog=1:
	gui_file=[];
end
%
if ~isempty(gui_file) & exist(gui_file,'file')==2,
	ORC_cur=ORC;		% Save current ORC
	eval(['load ',gui_file]);  SOO=[];
% Transfer all loaded fields to ORC_cur:
	loaded_fields=fieldnames(ORC);
	for j=1:length(loaded_fields),
		if ~strcmp(loaded_fields{j},'BOX'),
			expr=['ORC_cur.',loaded_fields{j},'=ORC.',loaded_fields{j},';']; eval(expr),
		end
	end
% Replace ORC by ORC_cur:
	ORC=ORC_cur; clear ORC_cur;
end
%
Odef.size=[.2,.2];
Odef.fname='Arial'; Odef.ptsize=14; Odef.iibold=1;
figure; set(gcf,'Name','ORCA');
axpos=[.5 .5 Odef.size(1)+2 Odef.size(2)+1.75];
set(gcf,'Units','Inches','Position',axpos);
Obox.figno=gcf; h0=gcf;
%%pos=get(gca,'Position'); ax_sp=pos(1:2); ORC.fp_size=pos(3:4);
% Set widths and heights of ORCA boxes so we know how big figure needs to be:	
hoff0=0; voff0=0;		
% Allow for Longitude label on top
% Also allow for SRC/REC/TGT iinav checkboxes
% 
box_h=[2.1 1.7 1.3 1.3 1.4]; 
%%box_v=[.48 .27 .27 .27 .27 .27 .27 .27];
box_v=[.27 .27 .27 .27 .27 .27 .27 .27 .27];
%
fig_width=max(hoff0+sum(box_h+box_sp(1)),2.25);
fig_height=voff0+sum(box_v+lab_v+box_sp(2)) + .2;
ORC.box_size=[fig_width,fig_height];
%
set(gcf,'Position',[1 1 ORC.box_size]);
%
POS.load=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,2);
POS.out_root=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,1);
POS.svp_file=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,8);
POS.svp_info1=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,7);
POS.svp_info2=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,6);
POS.hdf_root=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,8);
POS.hdf_sets=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,[3:7]);
POS.hdf_rank=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,7);
POS.hdf_dim_names=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,[5:6]);
POS.hdf_dims=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,[5:6]);
POS.hdf_dim_lims=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,[5:6]);
POS.plot_all=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,8) + [0,.265,0,0]';
POS.psize=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,8);
POS.clim=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,9);
POS.vopt1=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,6);
POS.ssp_inp=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,8);
POS.ssp_plot=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,9);
POS.reinit=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,9) + [0,.265,0,0]';
POS.vparm=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,9) + [0;.265;0;0];
POS.mtl_root=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,4);
POS.TL_ovlay=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,3) + [0,.265,0,0]';
%
POS.type=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,6);
POS.freq=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,5);
POS.parm1=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,4);
POS.iirx=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,1,3) + [0;.265;0;0];
POS.opt1=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,4);
POS.tlinc=POS.opt1 + [0,.27,0,0]';
POS.tlph=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,5);
POS.BW=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,5);
POS.zs=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,3);
POS.zr=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,2);
POS.rng=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,1);
POS.iiarr=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,2) + [0;.265;0;0];
POS.ii_make=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,2);
POS.arr_make=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,3);
POS.arr_xyz=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,[1:2]);
%
POS.opt2=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,4);
POS.mf_dphi=POS.opt2 + [0;.265;0;0];
POS.zmf=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,3);
POS.rc_log=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,3);
POS.opt4=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,4);
POS.opt3=POS.opt4; POS.opt3(2)=POS.opt3(2)+.265;
POS.opt5=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,3);
POS.opt6=POS.opt5; POS.opt6(2)=POS.opt6(2)+.265;
POS.iiprog=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,2);
POS.run=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,1);
%
POS.hdf_root2=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,7);
POS.bcalc=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,7) + [0;.265;0;0];
%
POS.auto=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,7);
POS.iidata=POS.auto + [0;.265;0;0];
POS.diag=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,6) + [0;.265;0;0];
% box_h=[2.1 1.7 1.3 1.3 1.4]; 
box_h3=[box_h(1) .68 1.25 1.25 1.1];
jrow=[3:7];
POS.ssp=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,1,jrow);
% jrow=[1:7];
POS.parm_lab=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,2,jrow);
POS.nlay=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,3,jrow(end)+1);
POS.layval1=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,3,jrow);
POS.layval2=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,4,jrow);
POS.jlay=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,4,jrow(end)+1);
POS.hspval=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,5,jrow);
POS.imp_svp=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,jrow(end));
POS.SSP_root=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,5);
POS.SSP_no=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,4);
POS.SSP_imp=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,5,3) + [0;.265;0;0];
%
POS.mtraj=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,4,2);
POS.mtraj_view=POS.mtraj - [0;.265;0;0];
POS.kn_view=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,2);
POS.imlog=POS.kn_view + [0;.265;0;0];
POS.vg_view=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,1);
POS.vopt2=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,4);
POS.Ts_view=POS.vopt2 + [0;.265;0;0];
%
box_h3=[1.7 3.95];
POS.parm_code=gui_box_pos(hoff0,voff0,box_h3,box_v,box_sp,lab_h,lab_v,2,[7:8]);
POS.nrun=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,2,9);
POS.nparm=gui_box_pos(hoff0,voff0,box_h,box_v,box_sp,lab_h,lab_v,3,9);
%%%
tag=[]; nprog=Obox.nprog;
bcolp=[.8 0 0]; fcolp=[1 1 1];      % Default pushbutton colors
%
tip='Program'; fmt='%s'; vbl='Obox.progs(Obox.prog_order)';
val=find(Obox.prog_order==ORC.iiprog); if isempty(val), val=1; end
orca_box([1:nprog],POS.iiprog,fmt,vbl,'popupmenu',tag,tip,val,tip,bcol,fcol);
%
tip='re-init';  
orca_box([1:nprog],POS.reinit,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
tip='Load _orca root'; fmt='%s'; vbl='''dummy''';
orca_box([1:nprog],POS.load,fmt,vbl,'popupmenu',tag,tip,1,tip,[.8,0,0],[1,1,1]);
%
tip='Output File Root'; fmt='%s'; vbl='ORC.out_root';
orca_box([1:nprog],POS.out_root,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
%
tip='SVP File'; fmt='%s'; vbl='''dummy''';
orca_box([1:5,8,9,10],POS.svp_file,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
POS.adi_set=[POS.svp_file(1), POS.svp_file(2)+.28, .6, .2];
tip='Set ADI Dir';
orca_box([1:5,8,9,10],POS.adi_set,[],tip,'pushbutton',tag,tip,1,[],bcolp,fcolp);
%
tip='Hw,Hsed,nlay'; fmt='%1i,%1i,%1i'; vbl='ORC.svp_info(1:3)';
orca_box([1:5,9,10],POS.svp_info1,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
tip='cw1,cw2,csed'; fmt='%1i,%1i,%1i'; vbl='ORC.svp_info(4:6)';
orca_box([1:5,9,10],POS.svp_info2,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
%

% Inputs for running ORCA:
tip='CW Frequencies'; fmt='%1.1f '; vbl='ORC.cw_freqs';
orca_box([1,5,8],POS.freq,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Center Frequencies'; fmt='%1.1f '; vbl='ORC.cw_freqs';
orca_box([9,10],POS.freq,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='fs,+NF/-Tw,fmin,fmax'; fmt='%1.0f,%1.1f,%2.1f,%2.1f'; vbl='ORC.bb_parms'; 
orca_box([2],POS.freq,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Parms: rmin,dBcut'; fmt='%1.1f,%2i'; vbl='ORC.gen_opts([4 7])';
orca_box([1,2,5,9,10],POS.parm1,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='k-Plane [Real Axis]'; vbl='ORC.gen_opts(1)'; val=ORC.gen_opts(1);
orca_box([1,2,5,9,10],POS.iirx,[],vbl,'checkbox',tag,tip,val,[],bcol,fcol);
%
tip='Compute TL'; vbl='ORC.cw_opts(1)';
orca_box([1],POS.opt1,[],vbl,'checkbox',tag,tip,ORC.cw_opts(1),[],bcol,fcol);
tip='Create FFT File '; vbl='ORC.bb_opts(1)';
orca_box([2],POS.opt1,[],vbl,'checkbox',tag,tip,ORC.bb_opts(1),[],bcol,fcol);
tip='Incoherent TL Also'; vbl='ORC.cw_opts(12)';
orca_box([1],POS.tlinc,[],vbl,'checkbox',tag,tip,ORC.cw_opts(12),[],bcol,fcol);
tip='TL Phase Also'; vbl='ORC.cw_opts(13)';
orca_box([1],POS.tlph,[],vbl,'checkbox',tag,tip,ORC.cw_opts(13),[],bcol,fcol);
tip='Source Depths'; fmt='%1.1f,%1.1f,%1.1f'; vbl='ORC.zs_lims';
orca_box([1,2,8,9,10],POS.zs,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Receiver Depths'; fmt='%1.1f,%1.1f,%1.1f'; vbl='ORC.zr_lims';
orca_box([1,2,8,9,10],POS.zr,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Spec Receiver Array'; vbl='ORC.iiarr';
orca_box([1,2,8,9,10],POS.iiarr,[],vbl,'checkbox',tag,tip,ORC.iiarr,[],bcol,fcol);
tip='Rec Array'; fmt='%s'; vbl='ORC.geom_files';
orca_box([1,2,8,9,10],POS.zr,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
POS.arr_set=[POS.zr(1), POS.zr(2)+.28, .6, .2];
tip='Set ARR Dir';
orca_box([1,2,8,9,10],POS.arr_set,[],tip,'pushbutton',tag,tip,1,[],bcolp,fcolp);
%
prog_arrays=[1,2,9,10];
% Create Array Geometry File:
tip='Make Array File ...'; vbl='ORC.ii_make';
orca_box(prog_arrays,POS.ii_make,[],vbl,'checkbox',tag,tip,ORC.ii_make,[],bcol,fcol);
tip='Array x,y,z'; fmt='%1.1f,%1.1f,%1.1f\n'; vbl='ORC.arr_xyz'''; 
orca_box(prog_arrays,POS.arr_xyz,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Make Array Geometry File';
orca_box(prog_arrays,POS.arr_make,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
tip='Ranges (km)'; fmt='%1.1f,%1.1f,%1.1f'; vbl='ORC.rng_lims';
orca_box([1,2,8,9,10],POS.rng,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
%
tip='CW Mode Functions'; vbl='ORC.cw_opts(2)';
orca_box([1],POS.opt2,[],vbl,'checkbox',tag,tip,ORC.cw_opts(2),[],bcol,fcol);
tip='BB Mode Functions'; vbl='ORC.bb_opts(6)';
orca_box([2],POS.opt2,[],vbl,'checkbox',tag,tip,ORC.cw_opts(6),[],bcol,fcol);
%%tip='|phi| [Re/Im]'; vbl='ORC.cw_opts(14)';
%%orca_box([1,2],POS.mf_form,[],vbl,'checkbox',tag,tip,ORC.cw_opts(14),[],bcol,fcol);
%%tip='Arg(phi) Also'; vbl='ORC.cw_opts(15)';
%%orca_box([1,2],POS.mf_im,[],vbl,'checkbox',tag,tip,ORC.cw_opts(15),[],bcol,fcol);
tip='Re,Im(dphi) Also'; vbl='ORC.cw_opts(16)';
orca_box([1,2],POS.mf_dphi,[],vbl,'checkbox',tag,tip,ORC.cw_opts(16),[],bcol,fcol);
tip='MF Depths'; fmt='%1.1f,%1.1f,%1.1f'; vbl='ORC.zmf_lims';
orca_box([1,2],POS.zmf,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
%
tip='Mode Traj'; vbl='ORC.cw_opts(4) | ORC.bb_opts(4)';
val=ORC.cw_opts(4) | ORC.bb_opts(4);
orca_box([1,2],POS.opt3,[],vbl,'checkbox',tag,tip,val,[],bcol,fcol);
%%POS.opt3,POS.opt4,keyboard
%
tip='Output Group Velocity'; vbl='ORC.cw_opts(5) | ORC.bb_opts(5)';
val=ORC.cw_opts(5) | ORC.bb_opts(5);
orca_box([1,2],POS.opt4,[],vbl,'checkbox',tag,tip,val,[],bcol,fcol);
%
tip='Mode Eigenvalues'; vbl='ORC.cw_opts(6)';
orca_box([1],POS.opt6,[],vbl,'checkbox',tag,tip,ORC.cw_opts(6),[],bcol,fcol);
%
tip='Mode List'; vbl='ORC.cw_opts(7)';
orca_box([1],POS.opt5,[],vbl,'checkbox',tag,tip,ORC.cw_opts(7),[],bcol,fcol);
%
tip='BW,+Tw/-df'; fmt='%1.1f,%1.1f'; vbl='ORC.nba_opts([4,5])';
orca_box([9],POS.BW,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Meld in Freq [block]'; vbl='ORC.nba_opts(1)';
orca_box([9],POS.opt5,[],vbl,'checkbox',tag,tip,ORC.nba_opts(1),[],bcol,fcol);
tip='Create FFT File'; vbl='ORC.nba_opts(2)';
orca_box([9],POS.opt6,[],vbl,'checkbox',tag,tip,ORC.nba_opts(2),[],bcol,fcol);
tip='View Transfer Function'; vbl='ORC.nba_opts(3)';
orca_box([9],POS.opt4,[],vbl,'checkbox',tag,tip,ORC.nba_opts(3),[],bcol,fcol);
%
tip='ORCA Diagnostics'; vbl='ORC.gen_opts(12)';
orca_box([1:5],POS.diag,[],vbl,'checkbox',tag,tip,ORC.gen_opts(12),[],bcol,fcol);
tip='Auto View'; vbl='ORC.auto';
orca_box([1:5,8],POS.auto,[],vbl,'checkbox',tag,tip,ORC.auto,[],bcol,fcol);
tip='Copy Data to Odat.xx'; vbl='ORC.iidata';
orca_box([1:5,7,8,9],POS.iidata,[],vbl,'checkbox',tag,tip,ORC.iidata,[],bcol,fcol);
tip='Vary Parms'; vbl='ORC.type_opts(4)';
orca_box([1,3,4],POS.vparm,[],vbl,'checkbox',tag,tip,ORC.type_opts(4),[],bcol,fcol);
%
% k-Plane Images:
tip='k-Plane Frequency'; fmt='%1.1f'; vbl='ORC.kpl_parms(1)';
orca_box([3],POS.freq,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Re(k)/K Limits'; fmt='%1.2f,%1.2f,%1i'; vbl='ORC.kpl_parms(4:6)';
orca_box([3],POS.zs,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Im(k) - dB/km'; fmt='%1.0f,%1.0f,%1i'; vbl='ORC.kpl_parms(7:9)';
orca_box([3],POS.zr,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
%
% Parameter Variation:
tip='Number of Runs'; fmt='%1i'; vbl='ORC.var_parm1(1)';
orca_box([1:4],POS.nrun,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='# Parms to Vary'; fmt='%1i'; vbl='ORC.var_parm1(2)';
orca_box([1:4],POS.nparm,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Parm Codes: [obt,nlay,ktb,pc,val1,val2] (nparm rows)'; 
fmt='%1i,%1i,%1i,%1i,%1.2f,%1.2f\n'; vbl='ORC.var_parm2''';
orca_box([1:4],POS.parm_code,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
%
tip='BL Frequencies'; fmt='%1.0f,%1.0f,%1i'; vbl='ORC.rc_parms{1}';
orca_box([4],POS.zs,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='BL Angles (deg)'; fmt='%1.0f,%1.0f,%1i'; vbl='ORC.rc_parms{2}';
orca_box([4],POS.zr,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
% Bottom Loss:

tip='RUN ORCA';
orca_box([1:5],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='RUN ORCA NB Approx';
orca_box([9],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Compute Dom Beta';
orca_box([10],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Beta HDF File'; fmt='%s'; vbl='''dummy''';
orca_box([10],POS.hdf_root2,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='Compute Beta vs. Mode';
orca_box([10],POS.bcalc,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
% Inputes for entering or creating SVP File:
tip='Create SVP File';
orca_box([6],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Ocean SSP: [z,c]'; fmt='%1.0f,%1.0f\n'; vbl='ORC.ssp'''; 
orca_box([6],POS.ssp,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Plot Ocean SSP';
orca_box([1:6,9],POS.ssp_plot,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Input SSP on Graph';
orca_box([6],POS.ssp_inp,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
parm_str={'1','5','1600','1605','.2','.2','1.2','1.2',  ...
	 '0','0','0','0','1.2','5','1','1'};
ORC.parm_lab={'ii','h','cp1','cp2','ap1','ap2','rho1','rho2','cs1','cs2',...
	'as1','as2','beta','ctol','fexpp','fexps'};
ORC.parm_ord=[1:4,9:10,7:8,5:6,11:16];
for j=1:10, ORC.parm_str{j}=parm_str; end
%
tip='No. Bot Layers'; fmt='%1i'; vbl='ORC.nlay'; 
orca_box([6],POS.nlay,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Parms'; fmt='%s'; vbl='ORC.parm_lab'; 
orca_box([6],POS.parm_lab,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
tip='Layer 1 Parms'; fmt='%s'; vbl='ORC.parm_str{1}'; 
orca_box([6],POS.layval1,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='2+EditLayer'; fmt='%s'; vbl='int2str([2:max(2,ORC.nlay)]'')'; 
orca_box([6],POS.jlay,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='Layer 2+ Parms'; fmt='%s'; vbl='ORC.parm_str{1}'; 
orca_box([6],POS.layval2,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='H-space Parms'; fmt='%s'; vbl='ORC.parm_str{1}([3:2:11,15,16])'; 
orca_box([6],POS.hspval,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Import SVP'; fmt='%s'; vbl='''dummy''';
orca_box([6],POS.imp_svp,fmt,vbl,'popupmenu',tag,tip,1,tip,[.8,0,0],[1,1,1]);
tip='SSP from _SSP.mat'; fmt='%s'; vbl='''dummy''';
orca_box([6],POS.SSP_root,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='SSP: #, Hw, cs, cb, cmin'; fmt='%i'; vbl='1'; 
orca_box([6],POS.SSP_no,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='Import SSP';
orca_box([6],POS.SSP_imp,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
% RAM PE:
tip='RUN RAM PE';
orca_box([8],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
%
% View HDF File:
tip='HDF File'; fmt='%s'; vbl='''dummy''';
orca_box([7],POS.hdf_root,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='HDF Set Names'; fmt='%s'; vbl='ORC.hdf_sets';
orca_box([7],POS.hdf_sets,fmt,vbl,'listbox',tag,tip,1,tip,bcol,fcol);
tip='HDF Set Rank'; fmt='%1i'; vbl='ORC.hdf_rank';
orca_box([7],POS.hdf_rank,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
tip='Set Dim Names'; fmt='%s'; vbl='ORC.hdf_dim_names';
orca_box([7],POS.hdf_dim_names,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
tip='Dims [min,max]'; fmt='%1i '; vbl='ORC.hdf_dims';
orca_box([7],POS.hdf_dims,fmt,vbl,'text',tag,tip,1,tip,bcol,fcol);
tip='Dim Limits'; fmt='%s'; vbl='{'' '','' ''}'; 
orca_box([7],POS.hdf_dim_lims,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
if 0,
    tip='Meas TL File'; fmt='%s'; vbl='''dummy''';
	orca_box([7],POS.mtl_root,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
	tip='Overlay TL';
	orca_box([7],POS.TL_ovlay,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
end
%
tip='Plot All HDF Sets',
orca_box([7],POS.plot_all,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Mode Trajectory File'; fmt='%s'; vbl='''dummy''';
orca_box([7],POS.mtraj,fmt,vbl,'popupmenu',tag,tip,1,tip,bcol,fcol);
tip='Plot Mode Trajectory';
orca_box([7],POS.mtraj_view,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Plot Modes in k Plane',
orca_box([7],POS.kn_view,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
tip='Log Axis for Im(k)'; vbl='ORC.v_opts(4)';
orca_box([7],POS.imlog,[],vbl,'checkbox',tag,tip,ORC.v_opts(4),[],bcol,fcol);
tip='Plot Dispersion Curves';
orca_box([7],POS.vg_view,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
if 0,
   tip='Norm Pulse Envelopes'; vbl='ORC.v_opts(2)';
   orca_box([7],POS.vopt2,[],vbl,'checkbox',tag,tip,ORC.v_opts(2),[],bcol,fcol);
   tip='Plot Pulse Envelopes',
   orca_box([7],POS.Ts_view,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
	tip='Time Delays, BW'; fmt='%1.1f,%1.1f,%1.1f,%1.0f'; vbl='ORC.tau_lims';
	orca_box([7],POS.zr,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
end
%
tip='View HDF Set';
orca_box([7],POS.run,[],tip,'pushbutton',tag,tip,1,[],bcol,fcol);
% General:
tip='Size [w,h]'; fmt='%2.1f,%2.1f'; vbl='ORC.psize'; 
orca_box([1:8],POS.psize,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Cmin,Cmax'; fmt='%2.0f,%2.0f'; vbl='ORC.clim'; 
orca_box([7],POS.clim,fmt,vbl,'edit',tag,tip,1,tip,bcol,fcol);
tip='Create New Fig'; vbl='ORC.v_opts(1)';
orca_box([1:10],POS.vopt1,[],vbl,'checkbox',tag,tip,ORC.v_opts(1),[],bcol,fcol);
%
orca_act('Program');
%
