/*
  gcaption.idlg Include for graphics captions

*!  VERSION 1.1.1  10mar2005

*/

DIALOG gcaption, tabtitle("Caption")
BEGIN

  /* LEFT SIDE-- Caption */
  GROUPBOX gb_caption  _lft        _top      _gwd1       _ht30,	///
	label("Caption ")
  EDIT     ed_caption  _lft1g      _ss       _cwd1gb     .,	///
	option(caption)
  /* LEFT SIDE-- Caption col(1) */
  TEXT     tx_size     _igft       _ms       _txwd       .,	///
	label("Size:") right
  DEFINE   y @y
  COMBOBOX cb_size     _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(textsizes) option(size)
  TEXT     tx_clr      _igft       _ms       _txwd       .,	///
	label("Color:") right
  COMBOBOX cb_clr      _txsep      @         _tcr2b4g    .,	///
	dropdownlist contents(colors) option(color)		///
	onselchangelist(gcaption_cl_clr_sel)
  COLOR    cl_clr      _tcr2b4gsep @         _colorwd    ., option(color)
  TEXT     tx_posit    _igft       _ms       _txwd       .,	///
	label("Position:") right
  COMBOBOX cb_posit    _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(clockpos)	option(position)
  TEXT     tx_orient   _igft       _ms       _txwd       .,	///
	label("Orientation:") right
  COMBOBOX cb_orient   _txsep      @         _txr2b4g    .,	///
	dropdownlist option(orientation)			///
	contents(orientation) values(orientation_values)
  CHECKBOX ck_ring     @           _ms       _txr2gi     .,	///
	label("Inside plot region") option(ring(0))		///
	onclickon(program gcaption_ring_check)			///
	onclickoff(program gcaption_ring_check)
  CHECKBOX ck_span     @           _ms       _txr2gi     .,	///
	label("Span width of graph") option(span)		///
	onclickon(program gcaption_span_check)			///
	onclickoff(program gcaption_span_check)
  TEXT     tx_mark     _igft       _ms       _txr2b4g    0,
  DEFINE   y2 @y

  /* LEFT SIDE-- Caption upper col(2)*/

  TEXT     tx_just     _lft4_2g    y         _txwd       .,	///
	label("Justify:") right
  COMBOBOX cb_just     _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(justification) option(justification)
  TEXT     tx_align    _lft4_2g    _ms       _txwd       .,	///
	label("Alignment:") right
  COMBOBOX cb_align    _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(alignment) option(alignment)
  TEXT     tx_margin   _lft4_2g    _ms       _txwd       .,	///
	label("Margin:") right
  COMBOBOX cb_margin   _txsep      @         _txr2b4g    .,	///
	dropdown contents(margin) option(margin)
  TEXT     tx_lgap     _lft4_2g    _ms       _txwd       .,	///
	label("Line gap:") right
  EDIT     ed_lgap     _txsep      @         _txr2b4g    .,	///
	option(linegap)
  /* LEFT SIDE-- Caption lower*/
  CHECKBOX ck_box      _igft       y2        _cwd1gb     _ht10,	///
	groupbox label("Box") option(box)			///
	onclickon(program gcaption_box_on)			///
	onclickoff(script gcaption_box_off)
  /* LEFT SIDE-- Caption lower col(1)*/
  TEXT     tx_bclr     _iigft      _ms       _txswd      .,	///
	label("Fill color:") right
  COMBOBOX cb_bclr     _txssep     @         _tcr2b4g    .,	///
	dropdownlist contents(colors) option(fcolor)		///
	onselchangelist(gcaption_cl_bclr_sel)
  COLOR    cl_bclr     _tcr2b4gsep @         _colorwd    ., option(fcolor)
  DEFINE y3 @y
  TEXT     tx_blclr    _iigft      _ms       _txswd      .,	///
	label("Line color:") right
  COMBOBOX cb_blclr    _txssep     @         _tcr2b4g    .,	///
	dropdownlist contents(colors) option(lcolor)		///
	onselchangelist(gcaption_cl_blclr_sel)
  COLOR    cl_blclr    _tcr2b4gsep @         _colorwd    ., option(lcolor)
  TEXT     tx_bmargin  _iigft      _ms       _txswd      .,	///
	label("Margin:") right
  COMBOBOX cb_bmargin  _txssep     @         _txr2b4g    .,	///
	dropdown contents(margin) option(bmargin)
  CHECKBOX ck_expand   @           _ms       _txr2gia    .,	///
	label("Ignore text size")  option(bexpand)

  /* RIGHT SIDE-- Note */
  GROUPBOX gb_note     _lft2g      _top      _gwd1       _ht30,	///
	label("Note ")
  EDIT     ed_note     _igft2      _ss       _cwd1gb     .,	///
	option(note)
  /* RIGHT SIDE-- Note col(1)*/
  TEXT     tx_nsize    _igft2      _ms       _txwd       .,	///
	label("Size:") right
  DEFINE   y @y
  COMBOBOX cb_nsize    _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(textsizes) option(size)
  TEXT     tx_nclr     _igft2      _ms       _txwd       .,	///
	label("Color:") right
  COMBOBOX cb_nclr     _txsep      @         _tcr2b4g    .,	///
	dropdownlist contents(colors) option(color)		///
	onselchangelist(gcaption_cl_nclr_sel)
  COLOR    cl_nclr     _tcr2b4gsep @         _colorwd    ., option(color)
  TEXT     tx_nposit   _igft2      _ms       _txwd       .,	///
	label("Position:")  right
  COMBOBOX cb_nposit   _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(clockpos) option(position)
  TEXT     tx_norient  _igft2      _ms       _txwd       .,	///
	label("Orientation:") right
  COMBOBOX cb_norient  _txsep      @         _txr2b4g    .,	///
	dropdownlist option(orientation)			///
	contents(orientation) values(orientation_values)
  CHECKBOX ck_nring    @           _ms       _txr2gi     .,	///
	label("Inside plot region") option(ring(0))		///
	onclickon(program gcaption_nring_check)			///
	onclickoff(program gcaption_nring_check)
  CHECKBOX ck_nspan    @           _ms       _txr2gi     .,	///
	label("Span width of graph") option(span)		///
	onclickon(program gcaption_nspan_check)			///
	onclickoff(program gcaption_nspan_check)
  TEXT     tx_nmark    _igft2      _ms       _txr2b4g     0,
  DEFINE   y2 @y

  /* RIGHT SIDE-- Note upper col(2)*/

  TEXT     tx_njust    _gft4_4     y         _txwd       .,	///
	label("Justify:") right
  COMBOBOX cb_njust    _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(justification) option(justification)
  TEXT     tx_nalign   _gft4_4     _ms       _txwd       .,	///
	label("Alignment:") right
  COMBOBOX cb_nalign   _txsep      @         _txr2b4g    .,	///
	dropdownlist contents(alignment) option(alignment)
  TEXT     tx_nmargin  _gft4_4     _ms       _txwd       .,	///
	label("Margin:") right
  COMBOBOX cb_nmargin  _txsep      @         _txr2b4g    .,	///
	dropdown contents(margin) option(margin)
  TEXT     tx_nlgap    _gft4_4     _ms       _txwd       .,	///
	label("Line gap:") right
  EDIT     ed_nlgap    _txsep      @         _txr2b4g    .,	///
	option(linegap)
  /* RIGHT SIDE-- Note lower*/
  CHECKBOX ck_nbox     _igft2      y2        _cwd1gb     _ht10,	///
	groupbox label("Box") option(box)			///
	onclickon(program gcaption_nbox_on)			///
	onclickoff(script gcaption_nbox_off)
  /* RIGHT SIDE-- Note lower col(1)*/
  TEXT     tx_nbclr    _iigft2     _ms       _txswd      .,	///
	label("Fill color:") right
  COMBOBOX cb_nbclr    _txssep     @         _tcr2b4g    ., 	///
	dropdownlist contents(colors) option(fcolor)		///
	onselchangelist(gcaption_cl_nbclr_sel)
  COLOR    cl_nbclr    _tcr2b4gsep @         _colorwd    ., option(fcolor)
  DEFINE y3 @y
  TEXT     tx_nblclr   _iigft2     _ms       _txswd      .,	///
	label("Line color:") right
  COMBOBOX cb_nblclr   _txssep     @         _tcr2b4g    .,	///
	dropdownlist contents(colors) option(lcolor)		///
	onselchangelist(gcaption_cl_nblclr_sel)
  COLOR    cl_nblclr   _tcr2b4gsep @         _colorwd    ., option(lcolor)
  TEXT     tx_nbmargin _iigft2     _ms       _txswd      .,	///
	label("Margin:") right
  COMBOBOX cb_nbmargin _txssep     @         _txr2b4g    .,	///
	dropdown contents(margin) option(bmargin)
  CHECKBOX ck_nexpand  @           _ms       _txr2gia    .,	///
	label("Ignore text size") option(bexpand)
END

LIST gcaption_cl_clr_sel
BEGIN
	gcaption.cl_clr.hide
	gcaption.cl_clr.show
	gcaption.cl_clr.hide
END

LIST gcaption_cl_bclr_sel
BEGIN
	gcaption.cl_bclr.hide
	gcaption.cl_bclr.show
	gcaption.cl_bclr.hide
END

LIST gcaption_cl_blclr_sel
BEGIN
	gcaption.cl_blclr.hide
	gcaption.cl_blclr.show
	gcaption.cl_blclr.hide
END

LIST gcaption_cl_nclr_sel
BEGIN
	gcaption.cl_nclr.hide
	gcaption.cl_nclr.show
	gcaption.cl_nclr.hide
END

LIST gcaption_cl_nbclr_sel
BEGIN
	gcaption.cl_nbclr.hide
	gcaption.cl_nbclr.show
	gcaption.cl_nbclr.hide
END
LIST gcaption_cl_nblclr_sel
BEGIN
	gcaption.cl_nblclr.hide
	gcaption.cl_nblclr.show
	gcaption.cl_nblclr.hide
END

PROGRAM gcaption_box_on
BEGIN
	call gaction gcaption.tx_bclr.enable
	call gaction gcaption.cb_bclr.enable
	call gaction gcaption.cl_bclr.enable
	call gaction gcaption.tx_blclr.enable
	call gaction gcaption.cb_blclr.enable
	call gaction gcaption.cl_blclr.enable
	call gaction gcaption.tx_bmargin.enable
	call gaction gcaption.cb_bmargin.enable
	if !gcaption.ck_ring {
		call gaction gcaption.ck_expand.enable
	}
END

SCRIPT gcaption_box_off
BEGIN
	gcaption.tx_bclr.disable
	gcaption.cb_bclr.disable
	gcaption.cl_bclr.disable
	gcaption.tx_blclr.disable
	gcaption.cb_blclr.disable
	gcaption.cl_blclr.disable
	gcaption.tx_bmargin.disable
	gcaption.cb_bmargin.disable
	gcaption.ck_expand.disable
END

PROGRAM gcaption_ring_check
BEGIN
	if !H(gcaption.ck_ring) {
		if gcaption.ck_ring {
			call script gcaption_ring_on
		}
		if !gcaption.ck_ring {
			call program gcaption_ring_off
		}
	}
END

PROGRAM gcaption_span_check
BEGIN
	if !H(gcaption.ck_span) {
		if gcaption.ck_span {
			call gaction gcaption.ck_ring.disable
		}
		if !gcaption.ck_span {
			call gaction gcaption.ck_ring.enable
		}
	}
END

PROGRAM gcaption_nring_check
BEGIN
	if !H(gcaption.ck_nring) {
		if gcaption.ck_nring {
			call script gcaption_nring_on
		}
		if !gcaption.ck_nring {
			call program gcaption_nring_off
		}
	}
END

PROGRAM gcaption_nspan_check
BEGIN
	if !H(gcaption.ck_nspan) {
		if gcaption.ck_nspan {
			call gaction gcaption.ck_nring.disable
		}
		if !gcaption.ck_nspan {
			call gaction gcaption.ck_nring.enable
		}
	}
END

SCRIPT gcaption_ring_on
BEGIN
	gcaption.ck_span.disable
	gcaption.ck_expand.disable
END

PROGRAM gcaption_ring_off
BEGIN
	call gaction gcaption.ck_span.enable
	if gcaption.ck_box {
		call gaction gcaption.ck_expand.enable
	}
END

SCRIPT gcaption_nring_on
BEGIN
	gcaption.ck_nspan.disable
	gcaption.ck_nexpand.disable
END
PROGRAM gcaption_nring_off
BEGIN
	call gaction gcaption.ck_nspan.enable
	if gcaption.ck_nbox {
		call gaction gcaption.ck_nexpand.enable
	}
END

PROGRAM gcaption_nbox_on
BEGIN
	call gaction gcaption.tx_nbclr.enable
	call gaction gcaption.cb_nbclr.enable
	call gaction gcaption.cl_nbclr.enable
	call gaction gcaption.tx_nblclr.enable
	call gaction gcaption.cb_nblclr.enable
	call gaction gcaption.cl_nblclr.enable
	call gaction gcaption.tx_nbmargin.enable
	call gaction gcaption.cb_nbmargin.enable
	if !gcaption.ck_nring {
		call gaction gcaption.ck_nexpand.enable
	}
END

SCRIPT gcaption_nbox_off
BEGIN
	gcaption.tx_nbclr.disable
	gcaption.cb_nbclr.disable
	gcaption.cl_nbclr.disable
	gcaption.tx_nblclr.disable
	gcaption.cb_nblclr.disable
	gcaption.cl_nblclr.disable
	gcaption.tx_nbmargin.disable
	gcaption.cb_nbmargin.disable
	gcaption.ck_nexpand.disable
END


/* Script to enable this tab */
SCRIPT gcaption_enable
BEGIN
	program gcaption_enable_pr
END

PROGRAM gcaption_enable_pr
BEGIN
	call gaction gcaption.gb_caption.enable
	call gaction gcaption.ed_caption.enable
	call gaction gcaption.tx_size.enable
	call gaction gcaption.cb_size.enable
	call gaction gcaption.tx_clr.enable
	call gaction gcaption.cb_clr.enable
	call gaction gcaption.cl_clr.enable
	call gaction gcaption.tx_posit.enable
	call gaction gcaption.cb_posit.enable
	call gaction gcaption.tx_orient.enable
	call gaction gcaption.cb_orient.enable
	if !gcaption.ck_span {
		call gaction gcaption.ck_ring.enable
	}
	if !gcaption.ck_ring {
		call gaction gcaption.ck_span.enable
	}
	call gaction gcaption.tx_just.enable
	call gaction gcaption.cb_just.enable
	call gaction gcaption.tx_align.enable
	call gaction gcaption.cb_align.enable
	call gaction gcaption.tx_margin.enable
	call gaction gcaption.cb_margin.enable
	call gaction gcaption.tx_lgap.enable
	call gaction gcaption.ed_lgap.enable
	call gaction gcaption.ck_box.enable
	if gcaption.ck_box {
		call program gcaption_box_on
	}

	call gaction gcaption.gb_note.enable
	call gaction gcaption.ed_note.enable
	call gaction gcaption.tx_nsize.enable
	call gaction gcaption.cb_nsize.enable
	call gaction gcaption.tx_nclr.enable
	call gaction gcaption.cb_nclr.enable
	call gaction gcaption.cl_nclr.enable
	call gaction gcaption.tx_nposit.enable
	call gaction gcaption.cb_nposit.enable
	call gaction gcaption.tx_norient.enable
	call gaction gcaption.cb_norient.enable
	if !gcaption.ck_nspan {
		call gaction gcaption.ck_nring.enable
	}
	if !gcaption.ck_nring {
		call gaction gcaption.ck_nspan.enable
	}
	call gaction gcaption.tx_njust.enable
	call gaction gcaption.cb_njust.enable
	call gaction gcaption.tx_nalign.enable
	call gaction gcaption.cb_nalign.enable
	call gaction gcaption.tx_nmargin.enable
	call gaction gcaption.cb_nmargin.enable
	call gaction gcaption.tx_nlgap.enable
	call gaction gcaption.ed_nlgap.enable
	call gaction gcaption.ck_nbox.enable
	if gcaption.ck_nbox {
		call program gcaption_nbox_on
	}

END

/* Script to disable this tab */
SCRIPT gcaption_disable
BEGIN
	gcaption.gb_caption.disable
	gcaption.ed_caption.disable
	gcaption.tx_size.disable
	gcaption.cb_size.disable
	gcaption.tx_clr.disable
	gcaption.cb_clr.disable
	gcaption.cl_clr.disable
	gcaption.tx_posit.disable
	gcaption.cb_posit.disable
	gcaption.tx_orient.disable
	gcaption.cb_orient.disable
	gcaption.ck_ring.disable
	gcaption.ck_span.disable
	gcaption.tx_just.disable
	gcaption.cb_just.disable
	gcaption.tx_align.disable
	gcaption.cb_align.disable
	gcaption.tx_margin.disable
	gcaption.cb_margin.disable
	gcaption.tx_lgap.disable
	gcaption.ed_lgap.disable
	gcaption.ck_box.disable
	script gcaption_box_off

	gcaption.gb_note.disable
	gcaption.ed_note.disable
	gcaption.tx_nsize.disable
	gcaption.cb_nsize.disable
	gcaption.tx_nclr.disable
	gcaption.cb_nclr.disable
	gcaption.cl_nclr.disable
	gcaption.tx_nposit.disable
	gcaption.cb_nposit.disable
	gcaption.tx_norient.disable
	gcaption.cb_norient.disable
	gcaption.ck_nring.disable
	gcaption.ck_nspan.disable
	gcaption.tx_njust.disable
	gcaption.cb_njust.disable
	gcaption.tx_nalign.disable
	gcaption.cb_nalign.disable
	gcaption.tx_nmargin.disable
	gcaption.cb_nmargin.disable
	gcaption.tx_nlgap.disable
	gcaption.ed_nlgap.disable
	gcaption.ck_nbox.disable
	script gcaption_nbox_off
END

PROGRAM gcaption_caption_pr
BEGIN
/* Caption */
    if !H(gcaption.ed_caption) & 					 ///
        ( gcaption.ed_caption | gcaption.cb_size | gcaption.cb_clr	 ///
        | gcaption.cb_posit | gcaption.cb_orient | gcaption.ck_ring	 ///
        | gcaption.ck_span  | gcaption.cb_just | gcaption.cb_align	 ///
        | gcaption.cb_margin | gcaption.ed_lgap | gcaption.ck_box ) {
	put "caption(" gcaption.ed_caption
	put /program gcaption_caption_opt_pr
	put ") "
    }

END

PROGRAM gcaption_caption_opt_pr
BEGIN
	beginoptions
		optionarg /hidedefault gcaption.cb_size
      		if H(gcaption.cl_clr) {
			optionarg /hidedefault gcaption.cb_clr
      		}
      		if !H(gcaption.cl_clr) {
			optionarg /quoted gcaption.cl_clr
		}
		optionarg /hidedefault gcaption.cb_posit
		optionarg /hidedefault gcaption.cb_orient
		option gcaption.ck_ring
		option gcaption.ck_span
		optionarg /hidedefault gcaption.cb_just
		optionarg /hidedefault gcaption.cb_align
		optionarg /hidedefault gcaption.cb_margin
		optionarg gcaption.ed_lgap
		option gcaption.ck_box
		if H(gcaption.cl_bclr) {
			optionarg /hidedefault gcaption.cb_bclr
		}
		if !H(gcaption.cl_bclr) {
			optionarg /quoted gcaption.cl_bclr
		}
		if H(gcaption.cl_blclr) {
			optionarg /hidedefault gcaption.cb_blclr
		}
		if !H(gcaption.cl_blclr) {
			optionarg /quoted gcaption.cl_blclr
		}
		optionarg /hidedefault gcaption.cb_bmargin
		option gcaption.ck_expand
	endoptions
END

PROGRAM gcaption_note_pr
BEGIN

/* Note */
   if !H(gcaption.ed_note) & 						 ///
        ( gcaption.ed_note | gcaption.cb_nsize | gcaption.cb_nclr	 ///
        | gcaption.cb_nposit | gcaption.cb_norient | gcaption.ck_nring	 ///
        | gcaption.ck_nspan  | gcaption.cb_njust | gcaption.cb_nalign	 ///
        | gcaption.cb_nmargin | gcaption.ed_nlgap | gcaption.ck_nbox ) {
	put "note(" gcaption.ed_note
	put /program gcaption_note_opt_pr
	put ") "
    }
END

PROGRAM gcaption_note_opt_pr
BEGIN
	beginoptions
		optionarg /hidedefault gcaption.cb_nsize
      		if H(gcaption.cl_nclr) {
      			optionarg /hidedefault gcaption.cb_nclr
      		}
      		if !H(gcaption.cl_nclr) {
      			optionarg /quoted gcaption.cl_nclr
		}
		optionarg /hidedefault gcaption.cb_nposit
		optionarg /hidedefault gcaption.cb_norient
		option gcaption.ck_nring
		option gcaption.ck_nspan
		optionarg /hidedefault gcaption.cb_njust
		optionarg /hidedefault gcaption.cb_nalign
		optionarg /hidedefault gcaption.cb_nmargin
		optionarg gcaption.ed_nlgap
		option gcaption.ck_nbox
		if H(gcaption.cl_nbclr) {
		      	optionarg /hidedefault gcaption.cb_nbclr
		}
		if !H(gcaption.cl_nbclr) {
			optionarg /quoted gcaption.cl_nbclr
		}
		if H(gcaption.cl_nblclr) {
		      	optionarg /hidedefault gcaption.cb_nblclr
		}
		if !H(gcaption.cl_nblclr) {
			optionarg /quoted gcaption.cl_nblclr
		}
		optionarg /hidedefault gcaption.cb_nbmargin
		option gcaption.ck_nexpand
	endoptions
END

PROGRAM gcaption_output
BEGIN
	put " "  /program gcaption_caption_pr
	put " "  /program gcaption_note_pr
END
