objref MenuPre
MenuPre = new VBox()
MenuPre.intercept(1)

Tau_rec= GrCell[0].syn1[0].taurec
Tau_facil= GrCell[0].syn1[0].taufacil
Tau_1= GrCell[0].syn1[0].tauin
U= GrCell[0].syn1[0].usr
u0=GrCell[0].syn1[0].u0
Dnet=GrCell[0].syn1[0].Deff
c0cleft= GrCell[0].syn1[0].c0cleft
rPSD= GrCell[0].syn1[0].rPSD
rabs= GrCell[0].syn1[0].rabs
nu= GrCell[0].syn1[0].nu
meandist= GrCell[0].syn1[0].meandist
Rmf= GrCell[0].syn1[0].Rmf
alpha= GrCell[0].syn1[0].alpha
inclugludir= GrCell[0].syn1[0].inclugludir
inclugludir1spike= GrCell[0].syn1[0].inclugludir1spike 
inclugluspill= GrCell[0].syn1[0].inclugluspill
inclugluspill1spike= GrCell[0].syn1[0].inclugluspill1spike
Nvesicles= GrCell[0].syn1[0].Nvesicles
Popeak= GrCell[0].syn1[0].Popeak
td1= GrCell[0].syn1[0].td1
tm1= GrCell[0].syn1[0].tm1
ts1= GrCell[0].syn1[0].ts1

xpanel("1")   
xlabel("Presinaptic parameters")

xvalue("T_transition (ms)","Tau_1", 1,"UpDatePre()", 0, 0 )
xvalue("T_recovery (ms)","Tau_rec", 1,"UpDatePre()", 0, 0 )
xvalue("T_facilitation (ms)","Tau_facil", 1,"UpDatePre()", 0, 0 )
xvalue("Vesicle release probability","U", 1,"UpDatePre()", 0, 0 )
xvalue("Facilitated vrp","u0", 1,"UpDatePre()", 0, 0 )
xvalue("Net-diffusion coefficient","Dnet", 1,"UpDatePre()", 0, 0)
xvalue("Beginning conc. in the cleft","c0cleft", 1,"UpDatePre()", 0, 0)
xvalue("Radius of absorbtion","rabs", 1,"UpDatePre()", 0, 0)
xvalue("Radius of PSD","rPSD", 1,"UpDatePre()", 0, 0)
xvalue("Density of sites","nu", 1,"UpDatePre()", 0, 0)
xvalue("Mean distance","meandist", 1,"UpDatePre()", 0, 0)
xvalue("Radius MF terminal","Rmf", 1,"UpDatePre()", 0, 0)
xvalue("alpha","alpha", 1,"UpDatePre()", 0, 0)
xstatebutton("Include direct component",&inclugludir,"UpDatePre()")
xstatebutton("Include spillover component",&inclugluspill,"UpDatePre()")
xstatebutton("Include dir. comp. to 1 spike",&inclugludir1spike,"UpDatePre()")
xstatebutton("Include spill. comp. to 1 spike", &inclugluspill1spike, "UpDatePre()") 
xvalue("Number of vesicles","Nvesicles", 1,"UpDatePre()", 0, 0)
xvalue("Popeak","Popeak", 1,"UpDatePre()", 0, 0)
xvalue("tm1","tm1", 1,"UpDatePre()", 0, 0)
xvalue("td1","td1", 1,"UpDatePre()", 0, 0)
xvalue("ts1","ts1", 1,"UpDatePre()", 0, 0)
xpanel()
MenuPre.intercept(0)
MenuPre.map("Presinaptic parameters")




proc UpDatePre(){
	for (i=0;i<=3;i=i+1) {
		GrCell[0].syn1[i].taurec=Tau_rec
		GrCell[0].syn1[i].taufacil=Tau_facil
	
		GrCell[0].syn1[i].tauin=Tau_1
		GrCell[0].syn1[i].usr=U
		GrCell[0].syn1[i].u0=u0
GrCell[0].syn1[i].Deff=Dnet
GrCell[0].syn1[i].rabs=rabs
GrCell[0].syn1[i].c0cleft=c0cleft
GrCell[0].syn1[i].rPSD=rPSD
GrCell[0].syn1[i].nu=nu
GrCell[0].syn1[i].meandist=meandist
GrCell[0].syn1[i].Rmf=Rmf
GrCell[0].syn1[i].alpha=alpha
GrCell[0].syn1[i].inclugludir=inclugludir
GrCell[0].syn1[i].inclugluspill=inclugluspill
GrCell[0].syn1[i].inclugludir1spike=inclugludir1spike
GrCell[0].syn1[i].inclugluspill1spike=inclugluspill1spike
GrCell[0].syn1[i].Nvesicles=Nvesicles
GrCell[0].syn1[i].Popeak=Popeak
GrCell[0].syn1[i].td1=td1
GrCell[0].syn1[i].tm1=tm1
GrCell[0].syn1[i].ts1=ts1
		
			
	}
	print "Updated presynaptic data"
}