; show_att $i
;
; display on screen a peak.
;
set mm = 2
set mm1 = (($freq_1_2d*$box_f1)*($si1_2d-1)/($specw_1_2d+$si1_2d))
set mm2 = (($freq_2_2d*$box_f2)*($si2_2d-1)/($specw_2_2d+$si2_2d))
set i = $_
if (exist("att[" // $i //"]")) then
   set l = $att[$i]
else
   error "Unknown peak"
endif

set f1 = (head($l)) set f2 = (head(tail($l)))
set f1i = (ptoi($f1,2,1))
set f2i = (ptoi($f2,2,2))

;print ("l "//$l)
set t = (tail(tail(tail($l))))
set u = (tolower(head($t))) 
set v = (tolower(head(tail($t)))) 
;if (tolower(head($t)) s! "unk" ) then
if (($u s! "unk" ) & ($v s! "unk" )) then
;   print ("t "//$t)
;   print (head(tail($t)))
   set s1 = ($spin[(head($t))])
   set s2 = ($spin[(head(tail($t)))])
   set t = (head(tail($s1)))
   set sys = (head(tail(tail($s1))))
   if ($sys s! "unk") then 
      set r1 = (head($sys[$sys]))
      set t = ($t // ":" // $r1)
   else
      set r1 = -10
      set t = ($t // "?")
   endif
   set t = ($t; "-"; head(tail($s2)))

   set sys = (head(tail(tail($s2))))
   if ($sys s! "unk") then 
      set r2 = (head($sys[$sys]))
      set t = ($t // ":" // $r2)
   else
      set r2 = -10
      set t = ($t // "?")
   endif

   set s = $scolor
   if ($r1 s! $r2) then
      if ($s != 7) then
          scolor ($s+1)
      else
          scolor 1 
      endif
   endif
   showline ($f2i-$mm2) ($f1i-$mm1) ($f2i+$mm2) ($f1i-$mm1)
   showline ($f2i+$mm2) ($f1i-$mm1) ($f2i+$mm2) ($f1i+$mm1)
   showline ($f2i+$mm2) ($f1i+$mm1) ($f2i-$mm2) ($f1i+$mm1)
   showline ($f2i-$mm2) ($f1i+$mm1) ($f2i-$mm2) ($f1i-$mm1)

   showtext $t ($f2i+$mm2) ($f1i+$mm1)
   scolor $s
else
   showline ($f2i-$mm2) $f1i ($f2i+$mm2) $f1i
   showline $f2i ($f1i-$mm1) $f2i ($f1i+$mm1)

endif


