; mod_att $pic
;
; builds a dialog box permitting to modify a peak in the data base.
; (called with the 'edit peak' in the menu )
;

set pic = $_

if (exist("att[" // $pic //"]")) then
   set l = $att[$pic]
else
   error "Unknown peak"
endif

set tmp = ('tmp' // int(1000000*$random))
open $tmp
fprint $tmp ('formbox "'; 'Peak';$pic; '" \')
fprint $tmp ('"set att[' // $pic // '] = ($f1;$f2;$amp;$sp1;$sp2;$note)" \')
fprint $tmp  ('"Current experiment'; $cur_exp; '" message \')
fprint $tmp  ('"ppm in F1" real f1'; head($l); '\')
fprint $tmp  ('"ppm in F2" real f2'; head(tail($l)); '\')
fprint $tmp  ('"Amplitude :" real amp'; head(tail(tail($l))); '\')
fprint $tmp  ('"Spin F1" string sp1'; head(tail(tail(tail($l)))); 'noreturn \')
fprint $tmp  ('Show action "show_spin $sp1" noreturn \')
fprint $tmp  ('Edit action "mod_spin $sp1" \')
fprint $tmp  ('"Spin F2" string sp2'; head(tail(tail(tail(tail($l))))); 'noreturn \')
fprint $tmp  ('Show action "show_spin $sp2" noreturn \')
fprint $tmp  ('Edit action "mod_spin $sp2" \')
fprint $tmp  ('"note" string note "'; tail(tail(tail(tail(tail($l))))); '" \')
fprint $tmp  ('separator Show action "show_att'; $pic; '" noreturn \')
fprint $tmp  ('Remove action "rem_att'; $pic; ' closeform $widget" *')
close $tmp
@($tmp)
sh ("/bin/rm"; $tmp)



