window title="Fishery Reserve Model"

grid 1 4 sticky=NE
	label text=View: font="bold 10"
	button text=Docs func=openFile action=FishResDoc.pdf
	button text="R Code" func=openFile action=FishRes.r
	button text=Window func=openFile action=FishResWin.txt

notebook tabs="Simulation Equilibrium" name=nbfres #width=380 height=150

grid 5 1  # Simulation tab in notebook
	label text="------Simulation----------------------------------" font=bold fg=orangered sticky=SW
	grid 1 3 sticky=W
		label text="Model:  " font="bold 10" sticky=W padx=5
		radio name=mod mode=numeric value=1 text="1. Continuous" sticky=W action=yModel1 bg="#bbe2ff"
		radio name=mod mode=numeric value=2 text="2. Discrete" sticky=W action=yModel2 bg="#fff3b0"
	label text="Inputs" font="bold 10"
	grid 1 2
		grid 4 1 sticky=N
			label text=Biological font="bold 10" sticky=N
			# growth rate, carrying capacity, initial population, proportion of K in reserve, exchange rate
			entry name=K value="100" label=K sticky=NE width=6
			grid 3 3 sticky=W
				label r
				entry name=rCont value="0.4" label="" sticky=W width=6 entrybg="#bbe2ff"
				entry name=rDisc value="0.492" label="" sticky=W width=6 entrybg="#fff3b0"
				label M
				entry name=Mcont value="0.1" label="" sticky=W width=6 entrybg="#bbe2ff"
				entry name=Mdisc value="0.095" label="" sticky=W width=6 entrybg="#fff3b0"
				label a
				entry name=aCont value="0.6" label="" sticky=W width=6 entrybg="#bbe2ff"
				entry name=aDisc value="0.451" label="" sticky=W width=6 entrybg="#fff3b0"
			vector length=4 vertical=T names="gam k x10 x20" values="0 2 0.5 0.5" labels="gamma k x10 x20" sticky=NE width=6
		grid 3 1
			label text=Control font="bold 10"
			grid 2 1
			grid 3 3
				label "F res"
				entry name=FresCont width=6 entrybg="#bbe2ff" value=0
				entry name=FresDisc width=6 entrybg="#fff3b0" value=0
				label "F min"
				entry name=FminCont width=6 entrybg="#bbe2ff" value=0.35
				entry name=FminDisc width=6 entrybg="#fff3b0" value=0.295
				label "F max"
				entry name=FmaxCont width=6 entrybg="#bbe2ff" value=0.55
				entry name=FmaxDisc width=6 entrybg="#fff3b0" value=0.423
				entry name=Fcy value="8" label=cycle width=6
			grid 1 2
				# final time, time of reserve, time step for odesolve
				vector length=4 vertical=T names="p1 tres tmax tstp" labels="p1 't res' 't max' 't step'" \
					values="0.7 15 80 0.2" sticky=NE width=6
				# ode solver tolerances
				vector length=2 vertical=T names="atol rtol" labels="'abs tol' 'rel tol'" values="1e-06 1e-04" sticky=NE width=6
	grid 2 3 sticky=W byrow=F
		grid 1 2
			radio name=ptype text="Time Series" value="t" mode=character sticky=W
			radio name=ptype text="Pairs" value="p" mode=character sticky=W func=runModel font="times italic 10" # hot button
		check name=enableCheck text="Enforce Constraints" checked=TRUE sticky=W
		null padx=10
		null
		grid 1 2 sticky=E
			entry name=xscale value=2 width=4 label="x max" sticky=NE 
			button text="Plot g(x)" func=seegx bg=darkseagreen1 sticky=NE
		button text="Plot trajectories" func=runModel bg=darkseagreen1 sticky=SE

grid 5 1 # Equilibrium tab in notebook
	label text="------Equilibrium---------------------------------" font=bold fg=forestgreen sticky=SW
	grid 1 2 
		grid 3 1
			grid 1 2  sticky=W
				label text=x1 font="bold 10" sticky=SW
				vector length=3 vertical=F names=xvec values="0.05 0.95 0.02" labels="from to by" width=5
			grid 1 2  sticky=W
				label text=p1 font="bold 10" sticky=W
				vector length=3 vertical=F names=pvec values="0 0.95 0.02" labels=NULL width=5
			grid 1 2
				entry name=Fbig value=1 width=6 label="max F" sticky=SE entrybg="#bbe2ff"
				entry name=hbig value=0.632 width=6 label="" sticky=SE entrybg="#fff3b0"
		grid 3 2 byrow=F
			entry name=qlev value=0.975 width=5 label="C/Cmax" sticky=SE
			entry name=ncell value=100 width=5 label="grid cells" sticky=SE
			entry name=nlev value=8 width=5 label="cntr levels" sticky=SE
			#button text=Pairs func=doAction action="tget(yield)(`pairs`)" sticky=SE bg=darkseagreen1
			#button text=Image func=doAction action="tget(yield)(`image`)" sticky=SE bg=darkseagreen1
			#button text=Contour func=doAction action="tget(yield)(`contour`)" sticky=SE bg=darkseagreen1
			button text=Pairs   func=yield action=pairs sticky=SE bg=darkseagreen1
			button text=Image   func=yield action=image sticky=SE bg=darkseagreen1
			button text=Contour func=yield action=contour sticky=SE bg=darkseagreen1
	vector length=5 vertical=F names=eqOut labels="Cmax p1 F2 x1 x2" width=6 entrybg="#ffb3d9"
	label text="------History---------------------------------------" font="bold" fg=blue sticky=SW pady="10 0"
	grid 1 2
		history name=FRhist func=runModel sticky=W import="FishHist.txt" 
		text name=msg value="Notes:" height=8 width=18 edit=TRUE font="times 9" bg=antiquewhite scrollbar=FALSE
