Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/contour_titles.pro'
;+
; NAME:
;	contour_titles
; PURPOSE:
;	Draw the Titles and subtitles for pro contour_mosaic
; CALLING:
;	contour_titles, image_spec, posxy
; INPUTS:
;	image_spec = structure containing all text for titles and subtitles.
;	posxy = position of contour plot in normalized window (IDL protocol)
; KEYWORDS:
;	HC_FILE = string, file name when doing hardcopy output.
;	/ERASE
; PROCEDURE:
;	Call xyouts.
; HISTORY:
;	Written: Frank Varosi NASA/GSFC 1990.
;	F.V. 1991, added option /ERASE to redraw titles (without re-contouring)
;-

pro contour_titles, image_spec, posxy, HC_FILE=HC_file, ERASE=erase

	if (NOT image_spec.options.show_titles) then return

	CSiz = image_spec.options.Char_Size
	xtLoc = (posxy(2)-posxy(0))/2 + posxy(0)
	ytLoc = (posxy(3) + 0.06*(CSiz>1) ) < .93

	if keyword_set( erase ) AND $
	   ( (!D.name EQ "SUN") OR (!D.name EQ "X") ) then begin
		wset, image_spec.windo
		yt = !D.y_vsize * ytLoc - !D.y_ch_size/2
		tv, bytarr( !D.x_vsize, !D.y_vsize - yt ), 0, yt
		yt = !D.y_vsize * .04 + !D.y_ch_size
		tv, bytarr( !D.x_vsize, yt )
	   endif

	xyouts, xtLoc, ytLoc, /NORM, ALIGN=.5, image_spec.title, SIZE=1.1*CSiz

	xyouts, 0.1, 0.01, /NORM, image_spec.subtitles(0) + "    " + $
				image_spec.subtitles(1), SIZE=0.8*CSiz
	xyouts, 0.1, 0.04, /NORM, image_spec.subtitles(2), SIZE=0.8*CSiz

	if (image_spec.filter NE "none") then begin
		filter = image_spec.filter
		fw = image_spec.filt_width
		filtid = "   Filter:  " + filter + "(" + strtrim( fw, 2 ) + ")"
	  endif else filtid = ""

	if N_elements( HC_file ) EQ 1 then begin
		if strlen( HC_file ) GT 1 then begin
			HC_info = image_spec.file
			pos = strpos( HC_info, "averaged_mosaics" )
			if (pos GE 0) then HC_info = strmid( HC_info, $
					pos+1+strlen( "averaged_mosaics" ), 99 )
			blanks = string( replicate( 32b, 13 ) )
			xyouts,.1,.965,/NORM, HC_info + blanks + HC_file, SIZ=.7
		   endif
	   endif

	if (image_spec.options.Levprint) then begin

	   if (image_spec.scaling EQ "Log10") then $
				cs = image_spec.contour_Log $
			  else 	cs = image_spec.contour
	   NLev = cs.NLev

	   if (image_spec.options.show_contours) AND (NLev GT 1) then begin

		LLev = NLev - 1
		Levels = cs.Levels(0:LLev)
		Levinc = Levels(1) - Levels(0)
		Levmax = Levels(LLev) < image_spec.maxT
		cinfo = string( [Levels(0),Levinc,Levmax], FORM="(G9.2)" )
		cinfo = strtrim( cinfo, 2 )
		cinfo = "Contours(" + image_spec.scaling + "):  min=" +  $
			cinfo(0) + "   inc=" + cinfo(1) + "   max=" + cinfo(2)

	     endif else begin
		
		maxv = image_spec.maxT
		minv = image_spec.minT

		if (image_spec.scaling EQ "Log10") then begin
			maxv = aLog10( maxv )
			minv = aLog10( minv > image_spec.minLog )
			format = "(G5.2)"
		  endif else format = "(G9.2)"

		cinfo = "Scaling: " + image_spec.scaling + $
			"( min=" + string( minv, FORM=format ) + $
			"  max=" + string( maxv, FORM=format ) + " )"
	      endelse

	    if N_elements( HC_info ) EQ 1 then $
		 xyouts,0.1,.95,/NORM, cinfo + filtid, SIZE=.7	$
	    else xyouts,.02,.98,/NORM, cinfo + filtid, SIZE=.9

	  endif
end