/*
    gr_plots2.idlg

*!  VERSION 1.0.1  14may2007

*******************************************************************************
***     THIS FILE IS BUILT FROM gr_plots.idlg BY REPLACING ALL INSTANCES    ***
***     OF gr_plots WITH gr_plots2                                          ***
*******************************************************************************

	// SCRIPTS and PROGRAMS for external use
		* SCRIPT  gr_plots2_enable
		* SCRIPT  gr_plots2_disable
		* PROGRAM gr_plots2_output
		* gr_plots2.settabtitle TABTITLE
		* gr_plots2_outputCmd.setstring OUTPUT_STRING
			// examples
				gr_plots2_outputCmd.setstring "plotopts"
				gr_plots2_outputCmd.setstring ""
					-- This is the default

		* gr_plots2_outputCmdStub.setstring OUTPUT_STRING
		  Note... This is to be used with gr_plots2_setMultiView_on
			// examples
				gr_plots2_outputCmdStub.setstring "line"
				gr_plots2_outputCmdStub.setstring "plot"
					-- This is the default

		* SCRIPT  gr_plots2_setMultiView_on
		* SCRIPT  gr_plots2_setMultiView_off

		* SCRIPT gr_plots2_setDefaultScatter  // this is the default
		* SCRIPT gr_plots2_setDefaultLine
		* SCRIPT gr_plots2_setDefaultConnected
		* SCRIPT gr_plots2_setDefaultArea
		* SCRIPT gr_plots2_setDefaultBar
		* SCRIPT gr_plots2_setDefaultSpike
		* SCRIPT gr_plots2_setDefaultDropline
		* SCRIPT gr_plots2_setTitlePlot
		* SCRIPT gr_plots2_setTitlePlots

		**Scripts to limit plots with gr_plots2_setMultiView_on
			* SCRIPT gr_plots2_setLimit_1
			* SCRIPT gr_plots2_setLimit_2
			* SCRIPT gr_plots2_setLimit_3
			* SCRIPT gr_plots2_setLimit_4
			* SCRIPT gr_plots2_setLimit_5
			* SCRIPT gr_plots2_setLimit_6
			* SCRIPT gr_plots2_setLimit_7
			* SCRIPT gr_plots2_setLimit_8  //The default

		* SCRIPT gr_plots2_setNoMarkerLabel
*/

SCRIPT gr_plots2_PREINIT
BEGIN
	create DOUBLE  gr_plots2_plotLimit
	gr_plots2_plotLimit.setvalue 8
	create BOOLEAN gr_plots2_hasOutput
	create BOOLEAN gr_plots2_isMultiViewOn
	create STRING  gr_plots2_outputCmd		// * Public *
	create STRING  gr_plots2_outputCmdStub		// * Public *
	gr_plots2_outputCmdStub.setstring "plot"		// the default
	create STRING  gr_plots2_savedValues

	create STRING gr_plots2_defaultType
	gr_plots2_defaultType.setstring "scatter"	// Default is scatter
	
	create STRING gr_plots2_lineResults
	create STRING gr_plots2_markerResults
	create STRING gr_plots2_areaResults
	create STRING gr_plots2_barResults
	create STRING gr_plots2_spikeResults

	script gr_plots2_setupMultiPlot
	script gr_plots2_setMultiView_off	// This is the default mode

	create BOOLEAN gr_plots2_noMLabel
	gr_plots2_noMLabel.setfalse
END

SCRIPT gr_plots2_setupMultiPlot
BEGIN
	create STRING gr_plots2_result_1
	create STRING gr_plots2_result_2
	create STRING gr_plots2_result_3
	create STRING gr_plots2_result_4
	create STRING gr_plots2_result_5
	create STRING gr_plots2_result_6
	create STRING gr_plots2_result_7
	create STRING gr_plots2_result_8
END

SCRIPT gr_plots2_POSTINIT
BEGIN
	program gr_plots2_checkLineResults
	program gr_plots2_checkMarkerResults
	program gr_plots2_checkAreaResults
	program gr_plots2_checkBarResults
	program gr_plots2_checkSpikeResults

	program gr_plots2_rebuildPlotsList
END

SCRIPT gr_plots2_setMultiView_off
BEGIN
	gr_plots2_isMultiViewOn.setfalse
	gr_plots2.tx_plot_type.show
	gr_plots2.lb_plot_type.show
	gr_plots2.lb_plot_type.withvalue gr_plots2.lb_plot_type.setvalue "@"

	gr_plots2.tx_plot.hide
	gr_plots2.lb_plot.hide
	gr_plots2.bu_edit.hide
	gr_plots2.tb_note.hide
END

SCRIPT gr_plots2_setMultiView_on
BEGIN
	gr_plots2_isMultiViewOn.settrue
	gr_plots2.tx_plot_type.hide
	gr_plots2.lb_plot_type.hide
	gr_plots2.bu_line.hide
	gr_plots2.bu_marker.hide
	gr_plots2.bu_area.hide
	gr_plots2.bu_bar.hide
	gr_plots2.bu_spike.hide

	gr_plots2.tx_plot.show
	gr_plots2.lb_plot.show
	gr_plots2.bu_edit.show
	gr_plots2.tb_note.show
END

SCRIPT gr_plots2_setLimit_1
BEGIN
	gr_plots2_plotLimit.setvalue 1
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_2
BEGIN
	gr_plots2_plotLimit.setvalue 2
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_3
BEGIN
	gr_plots2_plotLimit.setvalue 3
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_4
BEGIN
	gr_plots2_plotLimit.setvalue 4
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_5
BEGIN
	gr_plots2_plotLimit.setvalue 5
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_6
BEGIN
	gr_plots2_plotLimit.setvalue 6
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_7
BEGIN
	gr_plots2_plotLimit.setvalue 7
	program gr_plots2_rebuildPlotsList
END
SCRIPT gr_plots2_setLimit_8
BEGIN
	gr_plots2_plotLimit.setvalue 8
	program gr_plots2_rebuildPlotsList
END

SCRIPT gr_plots2_setNoMarkerLabel
BEGIN
	gr_plots2_noMLabel.settrue
END

//**** Name is used externally... DO NOT CHANGE
DIALOG gr_plots2, tabtitle("Plot")
BEGIN
  TEXT     tx_plot_type		_lft	_top	_iwd	.,
  LISTBOX  lb_plot_type		@	_ss	_vnwd	135,	///
	contents(gr_plots2_plotType)				///
	values(gr_plots2_plotType_values)			///
	onselchangelist(gr_plots2_plotType_sel)

  DEFINE y @y

  BUTTON bu_line 		140	y	120	.,	///
	label("Line properties  ")				///
	onpush(script gr_plots2_showLineDialog)

  BUTTON bu_marker 		@ 	@	@	.,	///
	label("Marker properties  ")				///
	onpush(program gr_plots2_showMarkerDialog)		///
	tooltip("Marker symbol and label properties")

  BUTTON bu_area		@	@	@	.,      ///
	label("Area properties  ")				///
	onpush(script gr_plots2_showAreaDialog)

  BUTTON bu_bar			@	@	@	.,	///
	label("Bar properties  ")				///
	onpush(script gr_plots2_showBarDialog)

  BUTTON bu_spike		@	@	@	.,      ///
	label("Spike properties  ")				///
	onpush(script gr_plots2_showSpikeDialog)

//**MultiView on
  TEXT tx_plot			_lft	_top	_vnwd	.,	///
	label("Select plot:")
  LISTBOX lb_plot		@	_ss	_vnwd	135,	///
	contents(gr_plots2_plotList)				///
	values(gr_plots2_plotList_values)			///
	ondblclick(program gr_plots2_plotList_event)
  BUTTON  bu_edit		_vnsep	@	80	.,	///
	label("Edit")						///
	tooltip("Edit the selected plot")			///
	onpush(program gr_plots2_plotList_event)
  TEXTBOX tb_note		_lft	175	_iwd	_tb3,	///
	label("The plots shown here do not necessarily"		///
		"reflect the number of actual plots for the graph.")
END

//** Lists

LIST gr_plots2_plotType
BEGIN
	"Default"
	"Scatter"
	"Line"
	"Connected"
	"Area"
	"Bar"
	"Spike"
	"Dropline"
END
LIST gr_plots2_plotType_values
BEGIN
	""
	"scatter"
	"line"
	"connected"
	"area"
	"bar"
	"spike"
	"dropline"
END
LIST gr_plots2_plotType_sel
BEGIN
	program gr_plots2_default_sel
	program gr_plots2_scatter_sel
	program gr_plots2_line_sel
	program gr_plots2_connected_sel
	program gr_plots2_area_sel
	program gr_plots2_bar_sel
	program gr_plots2_spike_sel
	program gr_plots2_dropline_sel
END

LIST gr_plots2_plotList
BEGIN
	"Plot 1"
	"Plot 2"
	"Plot 3"
	"Plot 4"
	"Plot 5"
	"Plot 6"
	"Plot 7"
	"Plot 8"
END
LIST gr_plots2_plotList_values
BEGIN
	"plot1"
	"plot2"
	"plot3"
	"plot4"
	"plot5"
	"plot6"
	"plot7"
	"plot8"
END
PROGRAM gr_plots2_plotList_event
BEGIN
	if gr_plots2.lb_plot.iseq("plot1") {
		call program gr_plots2_plot1_sel
	}
	if gr_plots2.lb_plot.iseq("plot2") {
		call program gr_plots2_plot2_sel
	}
	if gr_plots2.lb_plot.iseq("plot3") {
		call program gr_plots2_plot3_sel
	}
	if gr_plots2.lb_plot.iseq("plot4") {
		call program gr_plots2_plot4_sel
	}
	if gr_plots2.lb_plot.iseq("plot5") {
		call program gr_plots2_plot5_sel
	}
	if gr_plots2.lb_plot.iseq("plot6") {
		call program gr_plots2_plot6_sel
	}
	if gr_plots2.lb_plot.iseq("plot7") {
		call program gr_plots2_plot7_sel
	}
	if gr_plots2.lb_plot.iseq("plot8") {
		call program gr_plots2_plot8_sel
	}
END


//** Set Default scripts
SCRIPT gr_plots2_setDefaultScatter
BEGIN
        gr_plots2_defaultType.setstring "scatter"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultLine
BEGIN
        gr_plots2_defaultType.setstring "line"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultConnected
BEGIN
        gr_plots2_defaultType.setstring "connect"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultArea
BEGIN
        gr_plots2_defaultType.setstring "area"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultBar
BEGIN
        gr_plots2_defaultType.setstring "bar"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultSpike
BEGIN
        gr_plots2_defaultType.setstring "spike"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_setDefaultDropline
BEGIN
        gr_plots2_defaultType.setstring "dropline"
	script gr_plots2_resetType
END

SCRIPT gr_plots2_resetType
BEGIN
	gr_plots2.lb_plot_type.withvalue gr_plots2.lb_plot_type.setvalue "@"
END

//** Start selection scripts
PROGRAM gr_plots2_default_sel
BEGIN
	if gr_plots2_defaultType.iseq("scatter") {
		call program gr_plots2_scatter_sel
	}
	if gr_plots2_defaultType.iseq("line") {
		call program gr_plots2_line_sel
	}
	if gr_plots2_defaultType.iseq("connect") {
		call program gr_plots2_connected_sel
	}
	if gr_plots2_defaultType.iseq("area") {
		call program gr_plots2_area_sel
	}
	if gr_plots2_defaultType.iseq("bar") {
		call program gr_plots2_bar_sel
	}
	if gr_plots2_defaultType.iseq("spike") {
		call program gr_plots2_spike_sel
	}
	if gr_plots2_defaultType.iseq("dropline") {
		call program gr_plots2_dropline_sel
	}
END

PROGRAM gr_plots2_scatter_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (scatterplot)"
		call gr_plots2.bu_line.hide
		call gr_plots2.bu_marker.show
		call gr_plots2.bu_marker.setposition 140 30
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.hide
	}
END

PROGRAM gr_plots2_line_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (line plot)"
		call gr_plots2.bu_line.show
		call gr_plots2.bu_marker.hide
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.hide
	}
END

PROGRAM gr_plots2_connected_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (connected-line plot)"
		call gr_plots2.bu_line.show
		call gr_plots2.bu_marker.show
		call gr_plots2.bu_marker.setposition 140  60
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.hide
	}
END

PROGRAM gr_plots2_area_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (line plot with shading)"
		call gr_plots2.bu_line.hide
		call gr_plots2.bu_marker.hide
		call gr_plots2.bu_area.show
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.hide
	}
END

PROGRAM gr_plots2_bar_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (bar plot)"
		call gr_plots2.bu_line.hide
		call gr_plots2.bu_marker.hide
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.show
		call gr_plots2.bu_spike.hide
	}
END

PROGRAM gr_plots2_spike_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (spike plot)"
		call gr_plots2.bu_line.hide
		call gr_plots2.bu_marker.hide
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.show
	}
END

PROGRAM gr_plots2_dropline_sel
BEGIN
	if gr_plots2.lb_plot_type.isvisible() {
		call gr_plots2.tx_plot_type.setlabel "Plot type: (dropline plot)"
		call gr_plots2.bu_line.hide
		call gr_plots2.bu_marker.show
		call gr_plots2.bu_marker.setposition 140 60
		call gr_plots2.bu_area.hide
		call gr_plots2.bu_bar.hide
		call gr_plots2.bu_spike.show
	}
END


//** Buttons for child dialogs
//** MultiView off
SCRIPT gr_plots2_showLineDialog
BEGIN
	create CHILD gr_line_options AS gr_plots2_lineDLG, allowsubmit
	gr_plots2_lineDLG.setExitString gr_plots2_lineResults
	gr_plots2_lineDLG.settitle "Line properties"
	gr_plots2_lineDLG.setExitAction "program gr_plots2_checkLineResults"
	gr_plots2_lineDLG.setSubmitAction "program gr_plots2_lineSubmit"
END
PROGRAM gr_plots2_checkLineResults
BEGIN
	if gr_plots2_lineResults.iseq("") {
		call gr_plots2.bu_line.setlabel "Line properties  "
	}
	if ! gr_plots2_lineResults.iseq("") {
		call gr_plots2.bu_line.setlabel "Line properties *"

	}
END
PROGRAM gr_plots2_lineSubmit
BEGIN
	call program gr_plots2_checkLineResults
	call Submit
END

PROGRAM gr_plots2_showMarkerDialog
BEGIN
	if gr_plots2_noMLabel {
		call create CHILD gr_marker_nolabel_options AS gr_plots2_markerDLG, allowsubmit
	}
	else {
		call create CHILD gr_marker_options AS gr_plots2_markerDLG, allowsubmit
	}
	call gr_plots2_markerDLG.setExitString gr_plots2_markerResults
	call gr_plots2_markerDLG.settitle "Marker properties"
	call gr_plots2_markerDLG.setExitAction "program gr_plots2_checkMarkerResults"
	call gr_plots2_markerDLG.setSubmitAction "program gr_plots2_markerSubmit"
END
PROGRAM gr_plots2_checkMarkerResults
BEGIN
	if gr_plots2_markerResults.iseq("") {
		call gr_plots2.bu_marker.setlabel "Marker properties  "
	}
	else {
		call gr_plots2.bu_marker.setlabel "Marker properties *"
	}
END
PROGRAM gr_plots2_markerSubmit
BEGIN
	call program gr_plots2_checkMarkerResults
	call Submit
END

SCRIPT gr_plots2_showAreaDialog
BEGIN
        create CHILD gr_area_options AS gr_plots2_areaDLG, allowsubmit
        gr_plots2_areaDLG.setExitString gr_plots2_areaResults
        gr_plots2_areaDLG.settitle "Area properties"
        gr_plots2_areaDLG.setExitAction "program gr_plots2_checkAreaResults"
        gr_plots2_areaDLG.setSubmitAction "program gr_plots2_areaSubmit"
END
PROGRAM gr_plots2_checkAreaResults
BEGIN
	if gr_plots2_areaResults.iseq("") {
		call gr_plots2.bu_area.setlabel "Area properties  "
	}
	if ! gr_plots2_areaResults.iseq("") {
		call gr_plots2.bu_area.setlabel "Area properties *"
	}
END
PROGRAM gr_plots2_areaSubmit
BEGIN
	call program gr_plots2_checkAreaResults
	call Submit
END

SCRIPT gr_plots2_showBarDialog
BEGIN
	create CHILD gr_bar_options AS gr_plots2_barDLG, allowsubmit
	gr_plots2_barDLG.setExitString gr_plots2_barResults
	gr_plots2_barDLG.settitle "Bar properties"
	gr_plots2_barDLG.setExitAction "program gr_plots2_checkBarResults"
	gr_plots2_barDLG.setSubmitAction "program gr_plots2_barSubmit"
END
PROGRAM gr_plots2_checkBarResults
BEGIN
	if gr_plots2_barResults.iseq("") {
		call gr_plots2.bu_bar.setlabel "Bar properties  "
	}
	if ! gr_plots2_barResults.iseq("") {
		call gr_plots2.bu_bar.setlabel "Bar properties *"
	}
END
PROGRAM gr_plots2_barSubmit
BEGIN
	call program gr_plots2_checkBarResults
	call Submit
END

SCRIPT gr_plots2_showSpikeDialog
BEGIN
	create CHILD gr_spike_options AS gr_plots2_spikeDLG, allowsubmit
	gr_plots2_spikeDLG.setExitString gr_plots2_spikeResults
	gr_plots2_spikeDLG.settitle "Spike properties"
	gr_plots2_spikeDLG.setExitAction "program gr_plots2_checkSpikeResults"
	gr_plots2_spikeDLG.setSubmitAction "program gr_plots2_spikeSubmit"
END
PROGRAM gr_plots2_checkSpikeResults
BEGIN
	if gr_plots2_spikeResults.iseq("") {
		call gr_plots2.bu_spike.setlabel "Spike properties  "
	}
	if ! gr_plots2_spikeResults.iseq("") {
		call gr_plots2.bu_spike.setlabel "Spike properties *"
	}
END
PROGRAM gr_plots2_spikeSubmit
BEGIN
	call program gr_plots2_checkSpikeResults
	call Submit
END


PROGRAM gr_plots2_plot1_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot1, allowsubmit
	call gr_plots2_plot1.settitle "Properties for plot 1"
	call gr_plots2_plot1.setExitString gr_plots2_result_1
	call gr_plots2_plot1.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot1.setSubmitAction "program gr_plots2_plot1_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot1.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot1.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot1.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot1_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot2_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot2, allowsubmit
	call gr_plots2_plot2.settitle "Properties for plot 2"
	call gr_plots2_plot2.setExitString gr_plots2_result_2
	call gr_plots2_plot2.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot2.setSubmitAction "program gr_plots2_plot2_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot2.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot2.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot2.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot2_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END


PROGRAM gr_plots2_plot3_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot3, allowsubmit
	call gr_plots2_plot3.settitle "Properties for plot 3"
	call gr_plots2_plot3.setExitString gr_plots2_result_3
	call gr_plots2_plot3.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot3.setSubmitAction "program gr_plots2_plot3_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot3.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot3.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot3.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot3_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot4_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot4, allowsubmit
	call gr_plots2_plot4.settitle "Properties for plot 4"
	call gr_plots2_plot4.setExitString gr_plots2_result_4
	call gr_plots2_plot4.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot4.setSubmitAction "program gr_plots2_plot4_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot4.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot4.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot4.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot4_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot5_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot5, allowsubmit
	call gr_plots2_plot5.settitle "Properties for plot 5"
	call gr_plots2_plot5.setExitString gr_plots2_result_5
	call gr_plots2_plot5.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot5.setSubmitAction "program gr_plots2_plot5_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot5.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot5.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot5.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot5_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot6_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot6, allowsubmit
	call gr_plots2_plot6.settitle "Properties for plot 6"
	call gr_plots2_plot6.setExitString gr_plots2_result_6
	call gr_plots2_plot6.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot6.setSubmitAction "program gr_plots2_plot6_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot6.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot6.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot6.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot6_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot7_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot7, allowsubmit
	call gr_plots2_plot7.settitle "Properties for plot 7"
	call gr_plots2_plot7.setExitString gr_plots2_result_7
	call gr_plots2_plot7.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot7.setSubmitAction "program gr_plots2_plot7_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot7.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot7.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot7.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot7_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_plot8_sel
BEGIN
	call create CHILD gr_plots2 AS gr_plots2_plot8, allowsubmit
	call gr_plots2_plot8.settitle "Properties for plot 8"
	call gr_plots2_plot8.setExitString gr_plots2_result_8
	call gr_plots2_plot8.setExitAction "program gr_plots2_rebuildPlotsList"
	call gr_plots2_plot8.setSubmitAction "program gr_plots2_plot8_submit"
	call gr_plots2_defaultType.withvalue 		///
		gr_plots2_plot8.callthru `"gr_plots2_defaultType.setstring "@""'
	call gr_plots2_plot8.callthru "script gr_plots2_resetType"
	if gr_plots2_noMLabel {
		call gr_plots2_plot8.callthru "script gr_plots2_setNoMarkerLabel"
	}
END

PROGRAM gr_plots2_plot8_submit
BEGIN
	call program gr_plots2_rebuildPlotsList
	call Submit
END

PROGRAM gr_plots2_rebuildPlotsList
BEGIN
	call gr_plots2.lb_plot.withvalue gr_plots2_savedValues.setstring "@"
	call gr_plots2.lb_plot.clearlist
	call gr_plots2_plotList.Arrdropall

	if ! gr_plots2_result_1 {
		call gr_plots2.lb_plot.additem "Plot 1"
		call gr_plots2_plotList.Arrpush "Plot 1"
	}
	if gr_plots2_result_1 {
		call gr_plots2.lb_plot.additem "Plot 1 *"
		call gr_plots2_plotList.Arrpush "Plot 1 *"
	}
	if gr_plots2_plotLimit.iseq(1) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_2 {
		call gr_plots2.lb_plot.additem "Plot 2"
		call gr_plots2_plotList.Arrpush "Plot 2"
	}
	if gr_plots2_result_2 {
		call gr_plots2.lb_plot.additem "Plot 2 *"
		call gr_plots2_plotList.Arrpush "Plot 2 *"
	}
	if gr_plots2_plotLimit.iseq(2) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_3 {
		call gr_plots2.lb_plot.additem "Plot 3"
		call gr_plots2_plotList.Arrpush "Plot 3"
	}
	if gr_plots2_result_3 {
		call gr_plots2.lb_plot.additem "Plot 3 *"
		call gr_plots2_plotList.Arrpush "Plot 3 *"
	}
	if gr_plots2_plotLimit.iseq(3) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_4 {
		call gr_plots2.lb_plot.additem "Plot 4"
		call gr_plots2_plotList.Arrpush "Plot 4"
	}
	if gr_plots2_result_4 {
		call gr_plots2.lb_plot.additem "Plot 4 *"
		call gr_plots2_plotList.Arrpush "Plot 4 *"
	}
	if gr_plots2_plotLimit.iseq(4) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_5 {
		call gr_plots2.lb_plot.additem "Plot 5"
		call gr_plots2_plotList.Arrpush "Plot 5"
	}
	if gr_plots2_result_5 {
		call gr_plots2.lb_plot.additem "Plot 5 *"
		call gr_plots2_plotList.Arrpush "Plot 5 *"
	}
	if gr_plots2_plotLimit.iseq(5) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_6 {
		call gr_plots2.lb_plot.additem "Plot 6"
		call gr_plots2_plotList.Arrpush "Plot 6"
	}
	if gr_plots2_result_6 {
		call gr_plots2.lb_plot.additem "Plot 6 *"
		call gr_plots2_plotList.Arrpush "Plot 6 *"
	}
	if gr_plots2_plotLimit.iseq(6) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_7 {
		call gr_plots2.lb_plot.additem "Plot 7"
		call gr_plots2_plotList.Arrpush "Plot 7"
	}
	if gr_plots2_result_7 {
		call gr_plots2.lb_plot.additem "Plot 7 *"
		call gr_plots2_plotList.Arrpush "Plot 7 *"
	}
	if gr_plots2_plotLimit.iseq(7) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
	if ! gr_plots2_result_8 {
		call gr_plots2.lb_plot.additem "Plot 8"
		call gr_plots2_plotList.Arrpush "Plot 8"
	}
	if gr_plots2_result_8 {
		call gr_plots2.lb_plot.additem "Plot 8 *"
		call gr_plots2_plotList.Arrpush "Plot 8 *"
	}
	if gr_plots2_plotLimit.iseq(8) {
		call gr_plots2_savedValues.withvalue gr_plots2.lb_plot.setvalue "@"
		exit
	}
END

SCRIPT gr_plots2_enable
BEGIN
	gr_plots2.tx_plot_type.enable
	gr_plots2.lb_plot_type.enable
	gr_plots2.bu_line.enable
	gr_plots2.bu_marker.enable
	gr_plots2.bu_area.enable
	gr_plots2.bu_bar.enable
	gr_plots2.bu_spike.enable

	gr_plots2.tx_plot.enable
	gr_plots2.lb_plot.enable
	gr_plots2.bu_edit.enable
	gr_plots2.tb_note.enable
END

SCRIPT gr_plots2_disable
BEGIN
	gr_plots2.tx_plot_type.disable
	gr_plots2.lb_plot_type.disable
	gr_plots2.bu_line.disable
	gr_plots2.bu_marker.disable
	gr_plots2.bu_area.disable
	gr_plots2.bu_bar.disable
	gr_plots2.bu_spike.disable

	gr_plots2.tx_plot.disable
	gr_plots2.lb_plot.disable
	gr_plots2.bu_edit.disable
	gr_plots2.tb_note.disable
END

PROGRAM gr_plots2_single_output
BEGIN
	if ! gr_plots2.lb_plot_type.isdefault() {
		put "recast(" gr_plots2.lb_plot_type ") "
	}
	if gr_plots2_lineResults | gr_plots2_markerResults | 	///
	   gr_plots2_areaResults | 				///
	   gr_plots2_barResults | gr_plots2_spikeResults 		///
	{
		if ! H(gr_plots2.bu_marker) {
			put " " gr_plots2_markerResults " "
		}
		if ! H(gr_plots2.bu_line) {
			put " " gr_plots2_lineResults " "
		}
		if ! H(gr_plots2.bu_area) {
			put " " gr_plots2_areaResults " "
		}
		if ! H(gr_plots2.bu_bar) {
			put " " gr_plots2_barResults " "
		}
		if ! H(gr_plots2.bu_spike) {
			put " " gr_plots2_spikeResults " "
		}
	}
END

PROGRAM gr_plots2_output
BEGIN
	if ! gr_plots2.lb_plot_type.isenabled() {
		exit
	}
	if ! gr_plots2_isMultiViewOn {
		call gr_plots2_hasOutput.setfalse
		if ( gr_plots2_outputCmd				 &	///
		   ( gr_plots2.lb_plot_type		 	 |	///
		   gr_plots2_lineResults | gr_plots2_markerResults | 	///
		   gr_plots2_areaResults | 				///
		   gr_plots2_barResults | gr_plots2_spikeResults) )	///
		{
			put gr_plots2_outputCmd "("
			call gr_plots2_hasOutput.settrue
		}
		put /program gr_plots2_single_output
		if gr_plots2_hasOutput {
			put ") "
		}
	}

	if gr_plots2_isMultiViewOn {
		if gr_plots2_result_1 {
			put gr_plots2_outputCmdStub "1opts(" gr_plots2_result_1 ") "
		}
		if gr_plots2_result_2 {
			put gr_plots2_outputCmdStub "2opts(" gr_plots2_result_2 ") "
		}
		if gr_plots2_result_3 {
			put gr_plots2_outputCmdStub "3opts(" gr_plots2_result_3 ") "
		}
		if gr_plots2_result_4 {
			put gr_plots2_outputCmdStub "4opts(" gr_plots2_result_4 ") "
		}
		if gr_plots2_result_5 {
			put gr_plots2_outputCmdStub "5opts(" gr_plots2_result_5 ") "
		}
		if gr_plots2_result_6 {
			put gr_plots2_outputCmdStub "6opts(" gr_plots2_result_6 ") "
		}
		if gr_plots2_result_7 {
			put gr_plots2_outputCmdStub "7opts(" gr_plots2_result_7 ") "
		}
		if gr_plots2_result_8 {
			put gr_plots2_outputCmdStub "8opts(" gr_plots2_result_8 ") "
		}
	}
END
