func view_title(win)
; constructs a standard window title for window # <win>.  LS 8feb99
 if defined(eval('$viewer'+string(win))) eq 0 then
   ; window not yet used
   return,0

 dst = '$data'+ist(win,1)	;name of the data array
 sq = 'viewer '+string(win)+', '+show_array(eval(dst))

 if $view_scaletype(win) ne 5 then {
   if $view_scaletype(win) eq 3 then sq2 = ' log ' else sq2 = ''
   sq2 += sprintf(' scaled %g to %g, g = %3.1f',$view_scale_range(0,win),$view_scale_range(1,win),$trim_gamma)
 } else
   sq2 = ' custom scaling'
 return,sq + sq2
endfunc
