/*
 ts4 -- include file for plot4 of tsline

*!  VERSION 1.1.2  01apr2005

*/

DIALOG p4, label("tsline - Time-Series line plots")  tabtitle("Plot 4")
BEGIN
  RADIO    rb_none     _lft        _top      60          .,		///
  		label("None")						///
  		first							///
  		onclickon(script p4_tsnone_on)
  RADIO    rb_tsline   +65         @         145         .,		///
  		label("Time-Series line plot")				///
  		onclickon(script p4_tsline_on)
  RADIO    rb_tsrline  +150        @         207         .,		///
  		label("Time-Series range plot with lines")		///
  		last							///
  		onclickon(script p4_tsrline_on)

  TEXT     tx_type     +212        @         _txwd       .,		///
                label("Recast to:") 					///
                right
  COMBOBOX cb_tstype   _txsep      @         _vnwd       .,		///
                label("Recast to") contents(graph_tstype)		///
                onselchangelist(p4_tsline_change) 			///
                option(recast)						///
                dropdownlist
  COMBOBOX cb_tsrtype  @           @         _vnwd       .,		///
                label("Recast to") contents(graph_tsrtype)		///
                onselchangelist(p4_tsrline_change) 			///
                option(recast)						///
                dropdownlist

  TEXT     tx_var      _lft        _xls      _yvarwd     .,		///
                label("Y:") right

  VARNAME  vn_var      _yvarsep    @         _vnwd       .,		///
                label("Y variable")

  TEXT     tx_var2     _ilft5_2    @         _yvarwd     .,		///
  		label("Y2:") right
  VARNAME  vn_var2     _yvarsep    @         _vnwd       .,		///
  		label("Y2 variable")


DEFINE holdx @x
  TEXT     tx_if       _ilft5_2    @         _yvarwd     .,		///
 		label("if:") right					///

  EXP      ex_if       _yvarsep    @         _gifwd      .,		///
                label("Create...")

  CHECKBOX ck_rtaxis   +313        @         _vnwd       .,		///
  		option(yaxis(2))					///
  		label("Plot on right")

  TEXT     tx_if2      _ilft5_3    @         _yvarwd     .,		///
 		label("if:") right					///

  EXP      ex_if2      _yvarsep    @         _gifwd      .,		///
                label("Create...")


/* BEGIN Line options */
  GROUPBOX gb_line     _lft        _ls       _gwd1       _ht4h,		///
  		label("Lines")
DEFINE opttop @y
  TEXT     tx_clcol    _igft       _ss       _txwd       .,		///
  		label("Color:") 					///
  		right
DEFINE holdy @y
  COMBOBOX cb_clcol    _txsep      @         _tcr2b4g    .,		///
  		option(lcolor)						///
  		dropdownlist						///
  		contents(colors) 					///
  		onselchangelist(p4_color_clcol)
  COLOR    cl_clcol    _tcr2b4gsep @         _colorwd    .,		///
  		option(lcolor)

  TEXT     tx_clpat    _igft       _ms       _txwd       .,		///
  		label("Pattern:") right
  COMBOBOX cb_clpat    _txsep      @         _txr2b4g    .,		///
  		dropdownlist 						///
  		contents(linepatterns)  				///
  		option(lpattern)

  TEXT     tx_clwidth  _gft4_2     holdy     _txwd       .,		///
  		label("Width:") right
  COMBOBOX cb_clwidth  _txsep      @         _txr2b4g    .,		///
  		dropdownlist						///
  		contents(linewidths) 					///
  		option(lwidth)

  TEXT     tx_conn     _gft4_2     _ms       _txwd       .,		///
  		label("Type:") right
  COMBOBOX cb_conn     _txsep      @         _txr2b4g    .,		///
  		option(connect)						///
  		dropdownlist 						///
  		contents(connecttypes)
/* END Line options */

/* BEGIN Scatter options */
  GROUPBOX gb_marker   _lft        +35       _gwd1       _ht12h,	///
  		label("Markers")
DEFINE ymidopts @y
  TEXT     tx_msym     _igft       _ss       _txwd       .,		///
  		label("Symbol:") right

  COMBOBOX cb_msym     _txsep      @         _txr2b4g    .,		///
  		option(msymbol)						///
  		dropdownlist						///
  		contents(symbols)

  TEXT     tx_mcol     _gft4_2     @         _txwd       .,		///
  		label("Color:") right
  COMBOBOX cb_mcol     _txsep      @         _tcr2b4g    .,		///
  		option(mcolor)						///
  		dropdownlist						///
  		contents(colors) 					///
		onselchangelist(p4_color_mcol)
  COLOR    cl_mcol     _tcr2b4gsep @         _colorwd    .,		///
  		option(mcolor)

  TEXT     tx_msize    _igft       _ms       _txwd       .,		///
  		label("Size:") right
  COMBOBOX cb_msize    _txsep      @         _txr2b4g    .,		///
  		option(msize)						///
  		dropdownlist 						///
  		contents(symbolsizes)


  CHECKBOX ck_mlab     _igft       _ls       _cwd1gb     _ht4h,		///
  		label("Marker labels") groupbox				///
  		onclickon(script p4_mlabel_enable)			///
		onclickoff(script p4_mlabel_disable)
  TEXT     tx_mlab     _iigft      _ss       _txswd      .,		///
  		label("Variable:") right
DEFINE holdy @y
  VARLIST  vl_mlab     _txssep     @         _txr2b4g    .,		///
  		label("Marker labels variable") option(mlabel)
  TEXT     tx_mlsiz    _iigft      _ms       _txswd      .,		///
  		label("Size:") right
  COMBOBOX cb_mlsiz    _txssep     @         _txr2b4g    .,		///
  		option(mlabsize) 					///
  		dropdownlist						///
  		contents(textsizes)

  TEXT     tx_mlcol    _gft4_2     holdy     _txswd      .,		///
  		label("Color:") right
  COMBOBOX cb_mlcol    _txssep     @         _tcr2b4g    .,		///
  		option(mlabcolor)					///
  		dropdownlist						///
  		contents(colors) 					///
  		onselchangelist(p4_color_mlcol)

  COLOR    cl_mlcol    _tcr2b4gsep @         _colorwd    .,		///
  		option(mlabcolor)

  TEXT     tx_mlpos    _gft4_2     _ms       _txswd      .,		///
  		label("Position:") right
  COMBOBOX cb_mlpos    _txssep     @         _txr2b4g    .,		///
  		option(mlabposition) 					///
  		dropdownlist						///
  		contents(clockpos)

/* END Scatter options */

/* BEGIN Orientation options */
  GROUPBOX gb_orient   _lft2g      opttop    _gwd1       _ht4h,		///
		label("Orientation")
  RADIO    rb_vertical _igft4_3    +22       _cwd4_gi    .,		///
   		label("Vertical") 					///
   		first 							///
   		option(vertical)
  DEFINE topy @y
  RADIO    rb_horizontal @         _ss       @           .,		///
   		label("Horizontal") 					///
   		last 							///
   		option(horizontal)
/* END Orientation options */

/* BEGIN Area, Bar, Spike, Dropline options */
  GROUPBOX gb_common   _lft2g      ymidopts  _gwd1       _ht7,		///
		label("Area")
  TEXT     tx_blcol    _igft4_3    _ss       _txwd       .,		///
  		label("Line color:") 					///
  		right
DEFINE holdy @y
  COMBOBOX cb_blcol    _txsep      @         _tcr2b4g    .,		///
  		contents(colors) 					///
  		option(lcolor) 					///
  		dropdownlist						///
		onselchangelist(p4_color_blcol)
  COLOR    cl_blcol    _tcr2b4gsep @         _colorwd    .,		///
  		option(lcolor)

  TEXT     tx_blwid    _igft4_3    _ms       _txwd       .,		///
  		label("Line width:") right
  COMBOBOX cb_blwid    _txsep      @         _txr2b4g    .,		///
  		contents(linewidths) 					///
  		option(lwidth)						///
  		dropdownlist

  TEXT     tx_base     _igft4_3    _ms       _txwd       .,		///
  		label("Base:") right
  EDIT     en_base     _txsep      @         _txr2b4g    .,		///
  		label("Base") 						///
  		default(0) 						///
  		option(base) 						///
  		numonly

// bfcol is used with area and bar
  TEXT     tx_bfcol    _igft4_4    holdy     _txwd       .,		///
  		label("Fill color:") right
  COMBOBOX cb_bfcol    _txsep      @         _tcr2b4g    .,		///
  		contents(colors) 					///
  		option(fcolor)						///
  		dropdownlist 						///
  		onselchangelist(p4_color_bfcol)
  COLOR    cl_bfcol    _tcr2b4gsep @         _colorwd    .,		///
  		option(fcolor)

// blpat is used with area
  TEXT     tx_blpat    _igft4_4    _ms       _txwd       .,		///
  		label("Ln. pattern:") right
  COMBOBOX cb_blpat    _txsep      @         _txr2b4g    .,		///
  		contents(linepatterns) 					///
  		dropdownlist 						///
  		option(lpattern)

// blpat2 is used with spike and dropline
  TEXT     tx_blpat2   _igft4_4    holdy     _txwd       .,		///
  		label("Ln. pattern:") right
  COMBOBOX cb_blpat2   _txsep      @         _txr2b4g    .,		///
  		contents(linepatterns) 					///
  		dropdownlist 						///
  		option(lpattern)

// barwidth is used with bar
  TEXT     tx_barwidth _igft4_4    _ms       _txwd       .,		///
  		label("Bar width:") right
  EDIT     en_barwidth _txsep      @         _txr2b4g    .,		///
  		label("Bar width")					///
  		default(1) 						///
  		option(barwidth) 					///
  		numonly

// capsize is used with tsrline rcap only
  TEXT     tx_capsize  _igft4_4    @         _txwd       .,		///
  		label("Cap size:") right
  COMBOBOX cb_capsize  _txsep      @         _txr2b4g    .,		///
  		option(msize)						///
  		dropdownlist 						///
  		contents(symbolsizes)

/* END Area, Bar, Spike, Dropline options */
END

LIST p4_color_mcol
BEGIN
	p4.cl_mcol.hide
	p4.cl_mcol.show
	p4.cl_mcol.hide
END

LIST p4_color_mlcol
BEGIN
	p4.cl_mlcol.hide
	p4.cl_mlcol.show
	p4.cl_mlcol.hide
END

LIST p4_color_clcol
BEGIN
	p4.cl_clcol.hide
	p4.cl_clcol.show
	p4.cl_clcol.hide
END

LIST p4_color_bfcol
BEGIN
	p4.cl_bfcol.hide
	p4.cl_bfcol.show
	p4.cl_bfcol.hide
END

LIST p4_color_blcol
BEGIN
	p4.cl_blcol.hide
	p4.cl_blcol.show
	p4.cl_blcol.hide
END


LIST p4_tsline_change
BEGIN
	program p4_do_line
	program p4_do_scatter
	program p4_do_connected
	program p4_do_area
	program p4_do_bar
	program p4_do_spike
	program p4_do_dropline
END

LIST p4_tsrline_change
BEGIN
	program p4_do_rline
	program p4_do_rscatter
	program p4_do_rconnected
	program p4_do_area
	program p4_do_bar
	program p4_do_spike
	program p4_do_rcap
	program p4_do_rcapsym
END

SCRIPT p4_tsnone_on
BEGIN
	//set the dialog to the initial state (ie tsline)
	script p4_tsline_on

	script p4_line_opts_off
	script p4_scatter_opts_off
	script p4_orient_opts_off
	script p4_common_area_opts_off
	script p4_area_opts_off
	script p4_bar_opts_off
	script p4_spike_drop_opts_off
	script p4_rcap_opts_off

	p4.tx_type.hide
	p4.cb_tstype.hide
	p4.ck_rtaxis.hide

	// grey out everything else
	p4.tx_var.disable
	p4.vn_var.disable
	p4.tx_if.disable
	p4.ex_if.disable
END

SCRIPT p4_tsline_on
BEGIN
	// enable components that were greyed in SCRIPT p4_tsnone_on
	p4.tx_var.enable
	p4.vn_var.enable
	p4.tx_if.enable
	p4.ex_if.enable

	p4.cb_tsrtype.hide
	p4.tx_var2.hide
	p4.vn_var2.hide
	p4.tx_if2.hide
	p4.ex_if2.hide
	p4.tx_base.enable
	p4.en_base.enable

	p4.tx_type.show
	p4.cb_tstype.show
	p4.cb_tstype.withvalue p4.cb_tstype.setvalue "@"
	p4.tx_if.show
	p4.ex_if.show
	p4.ck_rtaxis.show
	p4.ck_rtaxis.setposition 500 .
END

SCRIPT p4_tsrline_on
BEGIN
	// enable components that were greyed in SCRIPT p4_tsnone_on
	p4.tx_var.enable
	p4.vn_var.enable
	p4.tx_if.enable
	p4.ex_if.enable

	p4.cb_tstype.hide
	p4.tx_if.hide
	p4.ex_if.hide
	p4.ck_rtaxis.show
	p4.ck_rtaxis.setposition 640 .

	p4.tx_type.show
	p4.cb_tsrtype.show
	p4.cb_tsrtype.withvalue p4.cb_tsrtype.setvalue "@"
	p4.tx_var2.show
	p4.vn_var2.show
	p4.tx_if2.show
	p4.ex_if2.show

	// base does not apply to ranges
	p4.tx_base.disable
	p4.en_base.disable
END

SCRIPT p4_line_opts_on
BEGIN
	p4.gb_line.enable
	p4.tx_clcol.enable
	p4.cb_clcol.enable
	p4.cl_clcol.enable
	p4.tx_clpat.enable
	p4.cb_clpat.enable
	p4.tx_clwidth.enable
	p4.cb_clwidth.enable
	p4.tx_conn.enable
	p4.cb_conn.enable
END

SCRIPT p4_line_opts_off
BEGIN
	p4.gb_line.disable
	p4.tx_clcol.disable
	p4.cb_clcol.disable
	p4.cl_clcol.disable
	p4.tx_clpat.disable
	p4.cb_clpat.disable
	p4.tx_clwidth.disable
	p4.cb_clwidth.disable
	p4.tx_conn.disable
	p4.cb_conn.disable
END

SCRIPT p4_mlabel_enable
BEGIN
	p4.tx_mlab.enable
	p4.vl_mlab.enable
	p4.tx_mlsiz.enable
	p4.cb_mlsiz.enable
	p4.tx_mlcol.enable
	p4.cb_mlcol.enable
	p4.cl_mlcol.enable
	p4.tx_mlpos.enable
	p4.cb_mlpos.enable
END

PROGRAM p4_scatter_opts_on
BEGIN
	call p4.gb_marker.enable
	call p4.tx_msym.enable
	call p4.cb_msym.enable
	call p4.tx_mcol.enable
	call p4.cb_mcol.enable
	call p4.cl_mcol.enable
	call p4.tx_msize.enable
	call p4.cb_msize.enable
	call p4.ck_mlab.enable
	if p4.ck_mlab {
		call script p4_mlabel_enable
	}
END


SCRIPT p4_mlabel_disable
BEGIN
	p4.tx_mlab.disable
	p4.vl_mlab.disable
	p4.tx_mlsiz.disable
	p4.cb_mlsiz.disable
	p4.tx_mlcol.disable
	p4.cb_mlcol.disable
	p4.cl_mlcol.disable
	p4.tx_mlpos.disable
	p4.cb_mlpos.disable
END

SCRIPT p4_scatter_opts_off
BEGIN
	p4.gb_marker.disable
	p4.tx_msym.disable
	p4.cb_msym.disable
	p4.tx_mcol.disable
	p4.cb_mcol.disable
	p4.cl_mcol.disable
	p4.tx_msize.disable
	p4.cb_msize.disable
	p4.ck_mlab.disable
	script p4_mlabel_disable

END

SCRIPT p4_orient_opts_on
BEGIN
	p4.gb_orient.show
	p4.rb_vertical.show
	p4.rb_horizontal.show
END

SCRIPT p4_orient_opts_off
BEGIN
	p4.gb_orient.hide
	p4.rb_vertical.hide
	p4.rb_horizontal.hide
END

/* Common opts for area, bar, spike, and dropline */
SCRIPT p4_common_area_opts_on
BEGIN
	p4.gb_common.show
	p4.tx_blcol.show
	p4.cb_blcol.show
	p4.cb_blcol.withvalue p4.cb_blcol.setvalue "@"
	p4.tx_blwid.show
	p4.cb_blwid.show
	p4.tx_base.show
	p4.en_base.show
END

/* Common opts for area, bar, spike, and dropline */
SCRIPT p4_common_area_opts_off
BEGIN
	p4.gb_common.hide
	p4.tx_blcol.hide
	p4.cb_blcol.hide
	p4.cl_blcol.hide
	p4.tx_blwid.hide
	p4.cb_blwid.hide
	p4.tx_base.hide
	p4.en_base.hide
END

SCRIPT p4_area_opts_on
BEGIN
	script p4_common_area_opts_on
	p4.tx_blpat.show
	p4.cb_blpat.show
	p4.tx_bfcol.show
	p4.cb_bfcol.show
	p4.cb_bfcol.withvalue p4.cb_bfcol.setvalue "@"
END

SCRIPT p4_area_opts_off
BEGIN
	script p4_common_area_opts_off
	p4.tx_blpat.hide
	p4.cb_blpat.hide
	p4.tx_bfcol.hide
	p4.cb_bfcol.hide
	p4.cl_bfcol.hide
END

SCRIPT p4_bar_opts_on
BEGIN
	script p4_common_area_opts_on
	p4.tx_bfcol.show
	p4.cb_bfcol.show
	p4.cb_bfcol.withvalue p4.cb_bfcol.setvalue "@"
	p4.tx_barwidth.show
	p4.en_barwidth.show
END

SCRIPT p4_bar_opts_off
BEGIN
	script p4_common_area_opts_off
	p4.tx_bfcol.hide
	p4.cb_bfcol.hide
	p4.cl_bfcol.hide
	p4.tx_barwidth.hide
	p4.en_barwidth.hide
END

SCRIPT p4_spike_drop_opts_on
BEGIN
	script p4_common_area_opts_on
	p4.tx_blpat2.show
	p4.cb_blpat2.show
END

SCRIPT p4_spike_drop_opts_off
BEGIN
	script p4_common_area_opts_off
	p4.tx_blpat2.hide
	p4.cb_blpat2.hide
END

SCRIPT p4_rcap_opts_on
BEGIN
	script p4_common_area_opts_on
	p4.tx_capsize.show
	p4.cb_capsize.show
END

SCRIPT p4_rcap_opts_off
BEGIN
	script p4_common_area_opts_off
	p4.tx_capsize.hide
	p4.cb_capsize.hide
END

PROGRAM p4_do_line
BEGIN
	// test hidden condition to prevent action from LIST on load
	if !H(p4.cb_tstype) {
		call script p4_scatter_opts_off
		call script p4_orient_opts_off
		call script p4_area_opts_off
		call script p4_bar_opts_off
		call script p4_spike_drop_opts_off
		call script p4_rcap_opts_off

		call script p4_line_opts_on
	}
END

PROGRAM p4_do_rline
BEGIN
	// test hidden condition to prevent action from LIST on load
	if !H(p4.cb_tsrtype) {
		call script p4_scatter_opts_off
		call script p4_area_opts_off
		call script p4_bar_opts_off
		call script p4_spike_drop_opts_off
		call script p4_rcap_opts_off

		call script p4_line_opts_on
		call script p4_orient_opts_on
	}
END

PROGRAM p4_do_scatter
BEGIN
	call script p4_line_opts_off
	call script p4_orient_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_spike_drop_opts_off
	call script p4_rcap_opts_off

	call program p4_scatter_opts_on
END

PROGRAM p4_do_rscatter
BEGIN
	call script p4_line_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_spike_drop_opts_off
	call script p4_rcap_opts_off

	call program p4_scatter_opts_on
	call script p4_orient_opts_on
END

PROGRAM p4_do_connected
BEGIN
	call script p4_orient_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_spike_drop_opts_off
	call script p4_rcap_opts_off

	call script p4_line_opts_on
	call program p4_scatter_opts_on
END

PROGRAM p4_do_rconnected
BEGIN
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_spike_drop_opts_off
	call script p4_rcap_opts_off

	call script p4_line_opts_on
	call program p4_scatter_opts_on
	call script p4_orient_opts_on
END

PROGRAM p4_do_area
BEGIN
	call script p4_line_opts_off
	call script p4_scatter_opts_off
	call script p4_bar_opts_off
	call script p4_spike_drop_opts_off
	call script p4_rcap_opts_off

	call script p4_orient_opts_on
	call script p4_area_opts_on
	call p4.gb_common.setlabel "Area"
END


PROGRAM p4_do_bar
BEGIN
	call script p4_line_opts_off
	call script p4_scatter_opts_off
	call script p4_area_opts_off
	call script p4_spike_drop_opts_off

	call script p4_orient_opts_on
	call script p4_bar_opts_on
	call p4.gb_common.setlabel "Bars"
END

PROGRAM p4_do_spike
BEGIN
	call script p4_line_opts_off
	call script p4_scatter_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_rcap_opts_off

	call script p4_orient_opts_on
	call script p4_spike_drop_opts_on
	call p4.gb_common.setlabel "Spikes"
END

PROGRAM p4_do_rcap
BEGIN
	call script p4_line_opts_off
	call script p4_scatter_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off

	call script p4_orient_opts_on
	call script p4_spike_drop_opts_on
	call p4.gb_common.setlabel "Spikes"
	call script p4_rcap_opts_on
END

PROGRAM p4_do_dropline
BEGIN
	call script p4_line_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_rcap_opts_off

	call program p4_scatter_opts_on
	call script p4_orient_opts_on
	call script p4_spike_drop_opts_on
	call p4.gb_common.setlabel "Droplines"
END

PROGRAM p4_do_rcapsym
BEGIN
	call script p4_line_opts_off
	call script p4_area_opts_off
	call script p4_bar_opts_off
	call script p4_rcap_opts_off

	call program p4_scatter_opts_on
	call script p4_orient_opts_on
	call script p4_spike_drop_opts_on
	call p4.gb_common.setlabel "Spikes"
END

PROGRAM p4_line_opts
BEGIN
	if !Hcc(p4.cb_clcol) {
		optionarg /hidedefault p4.cb_clcol
	}
	if Hcc(p4.cb_clcol) {
		optionarg /quoted p4.cl_clcol
	}
	optionarg p4.cb_clpat
	optionarg p4.cb_clwidth
	optionarg p4.cb_conn
END

PROGRAM p4_rline_opts
BEGIN
	// options and optionarg are not used here because tsrline
	// uses different options, therefore they are hard coded
	if !Hcc(p4.cb_clcol) & p4.cb_clcol {
		put " " "lcolor(" p4.cb_clcol ")"
	}
	if Hcc(p4.cb_clcol) {
		put " " `"lcolor(""' p4.cl_clcol `"")"'
	}
	if p4.cb_clpat {
		put " " "lpattern(" p4.cb_clpat ")"
	}
	if p4.cb_clwidth {
		put " " "lwidth(" p4.cb_clwidth ")"
	}
	optionarg p4.cb_conn
END

PROGRAM p4_scatter_opts
BEGIN
	optionarg p4.cb_msym
	if !Hcc(p4.cb_mcol) {
		optionarg /hidedefault p4.cb_mcol
	}
	if Hcc(p4.cb_mcol) {
		optionarg /quoted p4.cl_mcol
	}
	optionarg p4.cb_msize
	if p4.ck_mlab {
		require p4.vl_mlab
		optionarg p4.vl_mlab
		optionarg p4.cb_mlsiz
		if !Hcc(p4.cb_mlcol) {
			optionarg /hidedefault p4.cb_mlcol
		}
		if Hcc(p4.cb_mlcol) {
			optionarg /quoted p4.cl_mlcol
		}
		optionarg p4.cb_mlpos
	}
END


/* Common opts for area, bar, spike, and dropline */
PROGRAM p4_common_area_opts
BEGIN
	if !Hcc(p4.cb_blcol) {
		optionarg /hidedefault p4.cb_blcol
	}
	if Hcc(p4.cb_blcol) {
		optionarg /quoted p4.cl_blcol
	}
  	optionarg p4.cb_blwid
  	optionarg /hidedefault p4.en_base


	// bfcol is used with area and bar
	if !Hcc(p4.cb_bfcol) {
		optionarg /hidedefault p4.cb_bfcol
	}
	if Hcc(p4.cb_bfcol) {
		optionarg /quoted p4.cl_bfcol
	}

	// blpat is used with area
	optionarg p4.cb_blpat

	// blpat2 is used with spike and dropline
	optionarg p4.cb_blpat2

	// barwidth is used with bar
	optionarg /hidedefault p4.en_barwidth

	// capsize is used with tsrline rcap only
	optionarg /hidedefault p4.cb_capsize
END

PROGRAM p4_tsline_sub
BEGIN
	varlist p4.vn_var
	ifexp p4.ex_if
	beginoptions
		optionarg p4.cb_tstype
		put " " /program p4_line_opts
		put " " /program p4_scatter_opts
		option p4.rb_horizontal
		put " " /program p4_common_area_opts
		option p4.ck_rtaxis
	endoptions
END

PROGRAM p4_tsrline_sub
BEGIN
	varlist p4.vn_var
	varlist p4.vn_var2
	ifexp p4.ex_if2
	beginoptions
		optionarg p4.cb_tsrtype
		put " " /program p4_rline_opts
		put " " /program p4_scatter_opts
		option p4.rb_horizontal
		put " " /program p4_common_area_opts
		option p4.ck_rtaxis
	endoptions
END

PROGRAM p4_output
BEGIN
	if p4.rb_tsline {
		put "(tsline "
		put /program p4_tsline_sub
		put ") "
	}
	if p4.rb_tsrline {
		put "(tsrline "
		put /program p4_tsrline_sub
		put ") "
	}
END
