Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/contour_options.pro'
pro contour_options, mosaic_spec, changes, CALLER=caller

;Frank Varosi NASA/GSFC 1990.
;F.V.1992, separated contour specific options from pro display_options.

   common menus, menu_window
   common contour_options, TickLen, bitspix

	if N_struct( mosaic_spec ) NE 1 then return

	menu_options = ["Options for Contours of Mosaic image:"	,$
			" "					,$
			"return to main menu"			,$
			" "					,$
			"colors of contour Levels"		,$
			"Labeling of contour Levels"		,$
			"fraction of Levels to Reverse"		,$
			" "					,$
			"Rotation Index of image"		,$
			"Rotation Angle (degrees)"		,$
			" "					,$
			"smoother contour Lines ?"		,$
			"contour Line thickness (on hardcopy)"	,$
			"contour Line type (solid or dashed)"	,$
			"character size factor of all text"	,$
			" "					,$
			"show contour Level info?"		,$
			"tick marks pointing in/out ?"		,$
			"number of grey Levels for hardcopy"	]

	if N_elements( caller ) EQ 1 then menu_options(2) = "return to "+caller
	if N_elements( bitspix ) NE 1 then bitspix = 5

	window_set_show, menu_window
	select = 4
	changes = ""

MENU:	select = wmenu( menu_options, INIT=select, TITLE=0 )
	if (select LT 0) then return

	if (mosaic_spec.scaling EQ "Log10") then cs = mosaic_spec.contour_Log $
					    else cs = mosaic_spec.contour
	request = menu_options(select)
	task = next_word( request )
	changes = [changes,task]

	CASE task OF

	"Rotation": BEGIN
		if next_word( request ) EQ "Angle" then begin
			mosaic_spec.Rot_Ang_Deg = $
			 get_text_input( "Rotation Angle (degrees) ?", $
			  DEF=string( mosaic_spec.Rot_Ang_Deg,FORM="(F6.2)" ) )
		  endif else begin
			Rotation = select_number( "Rotation (# x 90 deg) ?", $
						 0,7,INIT=mosaic_spec.Rotation )
			Rdiff = Rotation - mosaic_spec.Rotation
			wd = where( [Rdiff MOD 2], ndiff )
			if (ndiff GT 0) then begin
				Arcs_Pix_RA = mosaic_spec(wd).RA_pix
				Arcs_Pix_DEC = mosaic_spec(wd).DEC_pix
				mosaic_spec(wd).RA_pix = Arcs_Pix_DEC
				mosaic_spec(wd).DEC_pix = Arcs_Pix_RA
			  endif
			mosaic_spec.Rotation = Rotation
		   endelse
		END

	 "colors": BEGIN
			menu = ["select contour Level color:",	$
				"dark (min)",			$
				"bright (max)",			$
				"variable with adjct"		]
			copt = wmenu( menu, INIT=2, TIT=0 )
			cnum = ( !D.table_size - copt+1 ) MOD !D.table_size
			cs.Ccolors = cnum
			print," color #: ",cnum
		     END

	"contour": BEGIN
		   what = get_words( request )
		   CASE what(1) OF
			"thickness": cs.Cthick = $
				select_number( "contour Line thickness",$
							2, 9, FACTOR=0.5, $
							INIT=2*cs.Cthick )
			"type":	BEGIN
				menu = ["select contour Line type:",	$
					"solid", "dotted", "dashed"	]
				cs.CLines = ( wmenu( menu, TIT=0, $
					INIT=cs.CLines(0)+1 )-1 ) > 0
				END
			else:
		    ENDCASE
		   END

	"character": BEGIN
			print," "
			print," current char.size factor = ",$
				strtrim( mosaic_spec.options.Char_Size, 2 )
			text = ""
			read," enter new char.size factor: ",text
			if strlen( text ) GT 0 then $
				mosaic_spec.options.Char_Size = float( text )
			print," new char.size factor = ",$
				strtrim( mosaic_spec.options.Char_Size, 2 )
		     END

	"smoother":	cs.spline = yes_no_menu( "interp for smooth contours", $
						/BINARY, NO_DEFAULT=cs.spline )

	"Labeling": BEGIN
			menu = ["consecutive contours"	,$
				"every other contour"	,$
				"No Labels"		]
			sel = ( wmenu( menu ) > 0 ) + 1

			if (sel LT 3) then begin

				w = where( cs.CLabels, NL )
				NL = select_number( "# contour Labels ?",$
								0,30, INIT=NL )
				if (NL GT 0) then begin
					NL = (NL*sel) < 30
			  		cs.CLabels(*)=0
					cs.CLabels = $
					    abs( ( indgen( NL ) MOD sel )-1 )
				   endif

			  endif else cs.CLabels(*)=0
		     END

	"fraction": BEGIN
			f = findgen(21)/20
			menu  = ["fraction to reverse color:", strtrim( f, 2 )]
			sel = wmenu( menu, TIT=0, INIT=20*abs(cs.Levfracrev)+1 )
			if (sel LE 0) then goto,MENU
			Levfracrev = f(sel-1)
			if (Levfracrev GT 0) then begin
				sel = wmenu( [ "reverse from...","Top (max) ?",$
					       "Bottom (min) ?"], INIT=1,TIT=0 )
			  endif else sel=0
			if (sel EQ 2) then cs.Levfracrev = -Levfracrev $
					else cs.Levfracrev =  Levfracrev
		     END

	   "show":	mosaic_spec.options.Levprint = $
				yes_no_menu( "show contour Level info",/BIN,$
					NO_DEF=mosaic_spec.options.Levprint )

	   "tick": BEGIN
			menu  = ["direction of tick marks ?","INTO plot","OUT"]
			sel = wmenu( menu, INIT=1, TITLE=0 )
			if (sel LE 0) then goto,MENU
			tickdir = next_word( menu(sel) )
			CASE tickdir OF
			"INTO":		TickLen = .02
			"OUT":		TickLen = -.02
			ENDCASE
		     END

	 "number": BEGIN
			menu = [ "Hardcopy Grey Levels?"	,$
				strtrim( 2^(indgen(5)+1), 2 )	]
			sel = wmenu( menu, INIT=bitspix, TIT=0 )
			if (sel GT 0) then bitspix = sel
			print," bits per pixel = " + strtrim( bitspix, 2 )
		     END

	  "return":	return

	   else:

	ENDCASE

	if (mosaic_spec.scaling EQ "Log10") then mosaic_spec.contour_Log = cs $
					    else mosaic_spec.contour = cs
   goto,MENU
end