!
! Useful stuff for contours.
!
require color-table

!
! The right button menu (for CAP contours of IRGrid data).
!
define widget contour-right intmenu 'contour right'
	title 'Contour plot options'
	line
	submenu 'Contour type' 'contour-types'
	submenu 'Label options' 'contour-label-options'
!	entry 'Toggle Multi-colored/Mono-colored contours' 'ToggleBoolean color-mono' \
!		(PDParam(icon_component,'color-mono') <> 'true')
	submenu 'Mono/Multi-colored' 'contour-colors'
	submenu 'Contour color (when mono)' 'simple-color'
	submenu 'Color table (when coded)' 'con-ctables'
	submenu 'Line width' linewidth
	entry 'Interpolation...' 'require interp; popup InterpParams'
	entry 'Adjust range limits...' 'require range; popup range-limits'
endmenu

!
! The right button menu for model data.
!
define widget contour-model-right intmenu 'contour right'
	title 'Model contour plot options'
	line
	entry 'Pop up model widget' 'popup model'
	line
	submenu 'Contour type' 'contour-types'
	submenu 'Label options' 'contour-label-options'
	entry 'Color-coded contours' 'ToggleBoolean color-mono' \
		(PDParam(icon_component,'color-mono') <> 'true')
	submenu 'Contour color (when mono)' 'simple-color'
	submenu 'Line width' linewidth
endmenu

!
! Various right button submenus
!
define widget contour-types intmenu 'contour types'
	title 'Contour representation'
	line
	entry 'Line contours' 'ContourType "contour"' \
	     (PDParam(icon_component,'representation') = 'contour')
	entry 'Filled contours' 'ContourType "filled-contour"' \
	     (PDParam(icon_component,'representation') = 'filled-contour')
endmenu


procedure ContourType type string
	parameter #icon_component representation #type
!
! Move filled contours to the bottom
!
!	if (type = "filled-contour")
!		move #icon_component 1
!	endif
	if (type = "filled-contour")
		parameter #icon_component representation-style filled
	endif
	if (type = "contour")
		parameter #icon_component representation-style line
	endif
endprocedure


define widget contour-label-options intmenu 'label options'
	title 'Contour labelling'
	line
	entry 'Label contours' 'ToggleBoolean do-labels' \
		(PDParam(icon_component,'do-labels') <> 'false')
	entry 'Blank data under labels' 'ToggleBoolean label-blanking' \
		(PDParam(icon_component,'label-blanking') <> 'false')
endmenu

!
! Various right button submenus
!
define widget contour-colors intmenu 'contour colors'
	title 'Line Coloring'
	line
	entry 'Multi-colored contours' 'ToggleBoolean color-mono' \
	     (PDParam(icon_component,'color-mono') = 'false')
	entry 'Mono-colored contours' 'ToggleBoolean color-mono' \
	     (PDParam(icon_component,'color-mono') = 'true')
endmenu

define widget con-ctables intmenu 'color tables'
	title 'Contour color tables'
	line
	entry 'All white' 'con-setctable AllWhite' \
		(PDParam(icon_component, 'color-table') = 'AllWhite')
	entry 'Contour' 'con-setctable Contour' \
		(PDParam(icon_component, 'color-table') = 'Contour')
	entry 'Rainbow' 'con-setctable Rainbow' \
		(PDParam(icon_component, 'color-table') = 'Rainbow')
	entry 'Reverse Rainbow' 'con-setctable RevRainbow' \
		(PDParam(icon_component, 'color-table') = 'RevRainbow')
	entry 'Red/Blue' 'con-setctable RedBlue' \
		(PDParam(icon_component, 'color-table') = 'RedBlue')
	entry '3-step red/yellow/blue' 'con-setctable SmallRainbow' \
		(PDParam(icon_component, 'color-table') = 'SmallRainbow')
	entry 'acradar' 'con-setctable acradar' \
		(PDParam(icon_component, 'color-table') = 'acradar')
	submenu 'Other color tables' 	Color-tables
endmenu


procedure con-setctable table string
	parameter #icon_component color-table #table
endprocedure



!
! A procedure to put up the center/step adjuster.
!
procedure contour-putup-adj comp string
	require ctr-step
	popup center-step
endprocedure
