/*
  gr_ed_sunflower.idlg

*!  VERSION 1.0.0  21may2007

*/


SCRIPT lbin_PREINIT
BEGIN
	create STRING lbin_fill_color
	create STRING lbin_fill_rgb
	create STRING lbin_intensity
	create STRING lbin_line_color
	create STRING lbin_line_rgb
	create STRING lbin_width
	create STRING lbin_pattern

	create STRING lptl_color
	create STRING lptl_rgb
	create STRING lptl_width
	create STRING lptl_pattern

	program lbin_get_defaults
END

SCRIPT lbin_POSTINIT
BEGIN
	program lbin_initialize_controls
END

DIALOG lbin, tabtitle("Light (bins/petals)")
BEGIN
  GROUPBOX gb_area	_lft	_top	_iwd	_ht17,		///
	label("Bin properties")
  TEXT     tx_fclr	_ilft	_ss	_wd	.,		///
	label("Color:") right
  COMBOBOX cb_fclr	_sep	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(lbin_cl_fclr_sel)
  COLOR    cl_fclr	_cbsep	@	_clwd	.,

  TEXT     tx_intensity	_ilft	_mls	_wd	.,		///
	label("Fill intensity:") right
  COMBOBOX cb_intensity	_sep	@	_cbwd	.,		///
	dropdown contents(_intensity)
  
  TEXT     tx_width	_ilft	 _mls	_wd	.,		///
	label("Outline width:") right
  COMBOBOX cb_width	_sep	@	_cbwd	.,		///
	dropdown 						///
	contents(_linewidths)

  TEXT     tx_pattern	_ilft	_mls	_wd	.,		///
	label("Outline pattern:") right
  COMBOBOX cb_pattern	_sep	@	_cbwd	.,		///
	dropdownlist						///
	contents(_linepatterns)

  CHECKBOX ck_outline	_ilft	_ls	_ibwd	_ht2h,		///
	groupbox						///
	label("Different outline color")			///
	onclickon(script lbin_outline_on)			///
	onclickoff(script lbin_outline_off) nomemory

  TEXT     tx_lclr	_iilft	_ss	_wd2	.,		///
	label("Outline color:") right
  COMBOBOX cb_lclr	_sep2	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(lbin_cl_lclr_sel)
  COLOR    cl_lclr	_cbsep	@	_clwd	.,


  GROUPBOX gb_petal	_lft	+55	_iwd	_ht8,		///
	label("Petal properties")
  TEXT     tx_pclr	_ilft	_ss	_wd	.,		///
	label("Color:") right
  COMBOBOX cb_pclr	_sep	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(lbin_cl_pclr_sel)
  COLOR    cl_pclr	_cbsep	@	_clwd	.,
  
  TEXT     tx_pwidth	_ilft	 _mls	_wd	.,		///
	label("Width:") right
  COMBOBOX cb_pwidth	_sep	@	_cbwd	.,		///
	dropdown 						///
	contents(_linewidths)

  TEXT     tx_ppattern	_ilft	_mls	_wd	.,		///
	label("Pattern:") right
  COMBOBOX cb_ppattern	_sep	@	_cbwd	.,		///
	dropdownlist						///
	contents(_linepatterns) 
END

SCRIPT lbin_outline_on
BEGIN
	lbin.tx_lclr.enable
	lbin.cb_lclr.enable
END

SCRIPT lbin_outline_off
BEGIN
	lbin.tx_lclr.disable
	lbin.cb_lclr.disable
END

LIST lbin_cl_fclr_sel
BEGIN
	lbin.cl_fclr.show
	lbin.cl_fclr.hide
END
LIST lbin_cl_lclr_sel
BEGIN
	lbin.cl_lclr.show
	lbin.cl_lclr.hide
END

LIST lbin_cl_pclr_sel
BEGIN
	lbin.cl_pclr.show
	lbin.cl_pclr.hide
END

PROGRAM lbin_get_defaults
BEGIN
	call G.withvalue index.setvalue class @.style.lighthexbin.shadestyle.color.styledex
	call index.withvalue lbin_fill_color.setvalue class .__STYLES.color[@]
	call lbin.cb_fclr.setdefault class lbin_fill_color.value
	call G.withvalue lbin_fill_rgb.setvalue class @.style.lighthexbin.shadestyle.color.rgb
	call lbin.cl_fclr.setdefault class lbin_fill_rgb.value

	call G.withvalue index.setvalue  class @.style.lighthexbin.shadestyle.intensity.styledex
	call index.withvalue lbin_intensity.setvalue class .__STYLES.intensity[@]
	if ! lbin_intensity {
		call G.withvalue lbin_intensity.setvalue class @.style.lighthexbin.shadestyle.intensity.val
	}
	call lbin.cb_intensity.setdefault class lbin_intensity.value

	call G.withvalue index.setvalue class @.style.lighthexbin.linestyle.color.styledex
	call index.withvalue lbin_line_color.setvalue class .__STYLES.color[@]
	call lbin.cb_lclr.setdefault class lbin_line_color.value
	call G.withvalue lbin_line_rgb.setvalue class @.style.lighthexbin.linestyle.color.rgb
	call lbin.cl_lclr.setdefault class lbin_line_rgb.value

	call G.withvalue index.setvalue class @.style.lighthexbin.linestyle.width.styledex
	call index.withvalue lbin_width.setvalue class .__STYLES.linewidth[@]
	if ! lbin_width {
		call G.withvalue lbin_width.setvalue class @.style.lighthexbin.linestyle.width.val
	}
	call lbin.cb_width.setdefault class lbin_width.value

	call G.withvalue index.setvalue class @.style.lighthexbin.linestyle.pattern.styledex
	call index.withvalue lbin_pattern.setvalue class .__STYLES.linepattern[@]
	call lbin.cb_pattern.setdefault class lbin_pattern.value


	call G.withvalue index.setvalue class @.style.lightflower.color.styledex
	call index.withvalue lptl_color.setvalue class .__STYLES.color[@]
	call lbin.cb_pclr.setdefault class lptl_color.value
	
	call G.withvalue lptl_rgb.setvalue class @.style.lightflower.color.rgb
	call lbin.cl_pclr.setdefault class lptl_rgb.value

	call G.withvalue index.setvalue class @.style.lightflower.width.styledex
	call index.withvalue lptl_width.setvalue class .__STYLES.linewidth[@]
	if ! lptl_width {
		call G.withvalue lptl_width.setvalue class @.style.lightflower.width.val
	}
	call lbin.cb_pwidth.setdefault class lptl_width.value

	call G.withvalue index.setvalue class @.style.lightflower.pattern.styledex
	call index.withvalue lptl_pattern.setvalue class .__STYLES.linepattern[@]
	call lbin.cb_ppattern.setdefault class lptl_pattern.value
END

PROGRAM lbin_initialize_controls
BEGIN
	if lbin_fill_color {
		call lbin.cb_fclr.setvalue class lbin_fill_color.value
	}
	else {
		call lbin.cb_fclr.setvalue "custom"
	}
	call lbin.cl_fclr.setvalue class lbin_fill_rgb.value
	call lbin.cb_intensity.setvalue class lbin_intensity.value

	if lbin_line_color {
		call lbin.cb_lclr.setvalue class lbin_line_color.value
	}
	else {
		call lbin.cb_lclr.setvalue "custom"
	}
	call lbin.cl_lclr.setvalue class lbin_line_rgb.value

	call lbin.cb_width.setvalue class lbin_width.value
	call lbin.cb_pattern.setvalue class lbin_pattern.value

	if lbin_fill_rgb.isneq(lbin_line_rgb) {
		call lbin.ck_outline.seton
	}
	else {
		call lbin.ck_outline.setoff
	}


	if lptl_color {
		call lbin.cb_pclr.setvalue class lptl_color.value
	}
	else {
		call lbin.cb_pclr.setvalue "custom"
	}
	call lbin.cl_pclr.setvalue class lptl_rgb.value

	call lbin.cb_pwidth.setvalue class lptl_width.value
	call lbin.cb_ppattern.setvalue class lptl_pattern.value
END

PROGRAM lbin_output
BEGIN
	call program lbin_get_defaults

	if ! lbin.cl_fclr.isvisible() & ! lbin.cb_fclr.isdefault() {
		put "style(lighthexbin(shadestyle(color(" 
		put lbin.cb_fclr 
		put ")))) "
	}
	if lbin.cl_fclr.isvisible() & ! lbin.cl_fclr.isdefault() {
		put "style(lighthexbin(shadestyle(color("  `"""'
		put lbin.cl_fclr
		put `"""'
		put ")))) "
	}
	if ! lbin.ck_outline & lbin.cb_fclr.isneq(lbin_line_color) {
		if ! lbin.cl_fclr.isvisible() {
			put "style(lighthexbin(linestyle(color(" 
			put lbin.cb_fclr 
			put ")))) "
		}
		if lbin.cl_fclr.isvisible() & lbin.cl_fclr.isneq(lbin_line_rgb) {
			put "style(lighthexbin(linestyle(color("  `"""'
			put lbin.cl_fclr
			put `"""'
			put ")))) "
		}
	}
	if lbin.cb_lclr & lbin.ck_outline {
		if ! lbin.cl_lclr.isvisible() & ! lbin.cb_lclr.isdefault() {
			put "style(lighthexbin(linestyle(color(" 
			put lbin.cb_lclr 
			put ")))) "
		}
		if lbin.cl_lclr.isvisible() & ! lbin.cl_lclr.isdefault() {
			put "style(lighthexbin(linestyle(color("  `"""'
			put lbin.cl_lclr
			put `"""'
			put ")))) "
		}
	}

	if ! lbin.cb_intensity.isdefault() & lbin.cb_intensity {
		put "style(lighthexbin(shadestyle(intensity("
		put lbin.cb_intensity
		put ")))) "
	}

	if ! lbin.cb_width.isdefault() {
		put "style(lighthexbin(linestyle(width("
		put lbin.cb_width
		put ")))) "
	}
	if ! lbin.cb_pattern.isdefault() {
		put "style(lighthexbin(linestyle(pattern("
		put lbin.cb_pattern
		put ")))) "
	}


	if ! lbin.cl_pclr.isvisible() & ! lbin.cb_pclr.isdefault() {
		put "style(lightflower(color(" 
		put lbin.cb_pclr 
		put "))) "
	}
	if lbin.cl_pclr.isvisible() & ! lbin.cl_pclr.isdefault() {
		put "style(lightflower(color("  `"""'
		put lbin.cl_pclr
		put `"""'
		put "))) "
	}
	if ! lbin.cb_pwidth.isdefault() {
		put "style(lightflower(width("
		put lbin.cb_pwidth
		put "))) "
	}
	if ! lbin.cb_ppattern.isdefault() {
		put "style(lightflower(pattern("
		put lbin.cb_ppattern
		put "))) "
	}
END

//*****************************************************************************

SCRIPT dbin_PREINIT
BEGIN
	create STRING dbin_fill_color
	create STRING dbin_fill_rgb
	create STRING dbin_intensity
	create STRING dbin_line_color
	create STRING dbin_line_rgb
	create STRING dbin_width
	create STRING dbin_pattern

	create STRING dptl_color
	create STRING dptl_rgb
	create STRING dptl_width
	create STRING dptl_pattern
	program dbin_get_defaults
END

SCRIPT dbin_POSTINIT
BEGIN
	program dbin_initialize_controls
END

DIALOG dbin, tabtitle("Dark (bins/petals)")
BEGIN
  GROUPBOX gb_area	_lft	_top	_iwd	_ht17,		///
	label("Bin properties")
  TEXT     tx_fclr	_ilft	_ss	_wd	.,		///
	label("Color:") right
  COMBOBOX cb_fclr	_sep	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(dbin_cl_fclr_sel)
  COLOR    cl_fclr	_cbsep	@	_clwd	.,

  TEXT     tx_intensity	_ilft	_mls	_wd	.,		///
	label("Fill intensity:") right
  COMBOBOX cb_intensity	_sep	@	_cbwd	.,		///
	dropdown contents(_intensity)
  
  TEXT     tx_width	_ilft	 _mls	_wd	.,		///
	label("Outline width:") right
  COMBOBOX cb_width	_sep	@	_cbwd	.,		///
	dropdown 						///
	contents(_linewidths)

  TEXT     tx_pattern	_ilft	_mls	_wd	.,		///
	label("Outline pattern:") right
  COMBOBOX cb_pattern	_sep	@	_cbwd	.,		///
	dropdownlist						///
	contents(_linepatterns)

  CHECKBOX ck_outline	_ilft	_ls	_ibwd	_ht2h,		///
	groupbox						///
	label("Different outline color")			///
	onclickon(script dbin_outline_on)			///
	onclickoff(script dbin_outline_off) nomemory

  TEXT     tx_lclr	_iilft	_ss	_wd2	.,		///
	label("Outline color:") right
  COMBOBOX cb_lclr	_sep2	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(dbin_cl_lclr_sel)
  COLOR    cl_lclr	_cbsep	@	_clwd	.,


  GROUPBOX gb_petal	_lft	+55	_iwd	_ht8,		///
	label("Petal properties")
  TEXT     tx_pclr	_ilft	_ss	_wd	.,		///
	label("Color:") right
  COMBOBOX cb_pclr	_sep	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(dbin_cl_pclr_sel)
  COLOR    cl_pclr	_cbsep	@	_clwd	.,
  
  TEXT     tx_pwidth	_ilft	 _mls	_wd	.,		///
	label("Width:") right
  COMBOBOX cb_pwidth	_sep	@	_cbwd	.,		///
	dropdown 						///
	contents(_linewidths)

  TEXT     tx_ppattern	_ilft	_mls	_wd	.,		///
	label("Pattern:") right
  COMBOBOX cb_ppattern	_sep	@	_cbwd	.,		///
	dropdownlist						///
	contents(_linepatterns) 
END

SCRIPT dbin_outline_on
BEGIN
	dbin.tx_lclr.enable
	dbin.cb_lclr.enable
END

SCRIPT dbin_outline_off
BEGIN
	dbin.tx_lclr.disable
	dbin.cb_lclr.disable
END

LIST dbin_cl_fclr_sel
BEGIN
	dbin.cl_fclr.show
	dbin.cl_fclr.hide
END
LIST dbin_cl_lclr_sel
BEGIN
	dbin.cl_lclr.show
	dbin.cl_lclr.hide
END

LIST dbin_cl_pclr_sel
BEGIN
	dbin.cl_pclr.show
	dbin.cl_pclr.hide
END

PROGRAM dbin_get_defaults
BEGIN
	call G.withvalue index.setvalue class @.style.darkhexbin.shadestyle.color.styledex
	call index.withvalue dbin_fill_color.setvalue class .__STYLES.color[@]
	call dbin.cb_fclr.setdefault class dbin_fill_color.value
	call G.withvalue dbin_fill_rgb.setvalue class @.style.darkhexbin.shadestyle.color.rgb
	call dbin.cl_fclr.setdefault class dbin_fill_rgb.value

	call G.withvalue index.setvalue  class @.style.darkhexbin.shadestyle.intensity.styledex
	call index.withvalue dbin_intensity.setvalue class .__STYLES.intensity[@]
	if ! dbin_intensity {
		call G.withvalue dbin_intensity.setvalue class @.style.darkhexbin.shadestyle.intensity.val
	}
	call dbin.cb_intensity.setdefault class dbin_intensity.value

	call G.withvalue index.setvalue class @.style.darkhexbin.linestyle.color.styledex
	call index.withvalue dbin_line_color.setvalue class .__STYLES.color[@]
	call dbin.cb_lclr.setdefault class dbin_line_color.value
	call G.withvalue dbin_line_rgb.setvalue class @.style.darkhexbin.linestyle.color.rgb
	call dbin.cl_lclr.setdefault class dbin_line_rgb.value

	call G.withvalue index.setvalue class @.style.darkhexbin.linestyle.width.styledex
	call index.withvalue dbin_width.setvalue class .__STYLES.linewidth[@]
	if ! dbin_width {
		call G.withvalue dbin_width.setvalue class @.style.darkhexbin.linestyle.width.val
	}
	call dbin.cb_width.setdefault class dbin_width.value

	call G.withvalue index.setvalue class @.style.darkhexbin.linestyle.pattern.styledex
	call index.withvalue dbin_pattern.setvalue class .__STYLES.linepattern[@]
	call dbin.cb_pattern.setdefault class dbin_pattern.value


	call G.withvalue index.setvalue class @.style.darkflower.color.styledex
	call index.withvalue dptl_color.setvalue class .__STYLES.color[@]
	call lbin.cb_pclr.setdefault class dptl_color.value
	
	call G.withvalue dptl_rgb.setvalue class @.style.darkflower.color.rgb
	call lbin.cl_pclr.setdefault class dptl_rgb.value

	call G.withvalue index.setvalue class @.style.darkflower.width.styledex
	call index.withvalue dptl_width.setvalue class .__STYLES.linewidth[@]
	if ! dptl_width {
		call G.withvalue dptl_width.setvalue class @.style.darkflower.width.val
	}
	call dbin.cb_pwidth.setdefault class dptl_width.value

	call G.withvalue index.setvalue class @.style.darkflower.pattern.styledex
	call index.withvalue dptl_pattern.setvalue class .__STYLES.linepattern[@]
	call dbin.cb_ppattern.setdefault class dptl_pattern.value
END

PROGRAM dbin_initialize_controls
BEGIN
	if dbin_fill_color {
		call dbin.cb_fclr.setvalue class dbin_fill_color.value
	}
	else {
		call dbin.cb_fclr.setvalue "custom"
	}
	call dbin.cl_fclr.setvalue class dbin_fill_rgb.value
	call dbin.cb_intensity.setvalue class dbin_intensity.value

	if dbin_line_color {
		call dbin.cb_lclr.setvalue class dbin_line_color.value
	}
	else {
		call dbin.cb_lclr.setvalue "custom"
	}
	call dbin.cl_lclr.setvalue class dbin_line_rgb.value

	call dbin.cb_width.setvalue class dbin_width.value
	call dbin.cb_pattern.setvalue class dbin_pattern.value

	if dbin_fill_rgb.isneq(dbin_line_rgb) {
		call dbin.ck_outline.seton
	}
	else {
		call dbin.ck_outline.setoff
	}


	if dptl_color {
		call dbin.cb_pclr.setvalue class dptl_color.value
	}
	else {
		call dbin.cb_pclr.setvalue "custom"
	}
	call dbin.cl_pclr.setvalue class dptl_rgb.value

	call dbin.cb_pwidth.setvalue class dptl_width.value
	call dbin.cb_ppattern.setvalue class dptl_pattern.value
END

PROGRAM dbin_output
BEGIN
	call program dbin_get_defaults

	if ! dbin.cl_fclr.isvisible() & ! dbin.cb_fclr.isdefault() {
		put "style(darkhexbin(shadestyle(color(" 
		put dbin.cb_fclr 
		put ")))) "
	}
	if dbin.cl_fclr.isvisible() & ! dbin.cl_fclr.isdefault() {
		put "style(darkhexbin(shadestyle(color("  `"""'
		put dbin.cl_fclr
		put `"""'
		put ")))) "
	}
	if ! dbin.ck_outline & dbin.cb_fclr.isneq(dbin_line_color) {
		if ! dbin.cl_fclr.isvisible() {
			put "style(darkhexbin(linestyle(color(" 
			put dbin.cb_fclr 
			put ")))) "
		}
		if dbin.cl_fclr.isvisible() & dbin.cl_fclr.isneq(dbin_line_rgb) {
			put "style(darkhexbin(linestyle(color("  `"""'
			put dbin.cl_fclr
			put `"""'
			put ")))) "
		}
	}
	if dbin.cb_lclr & dbin.ck_outline {
		if ! dbin.cl_lclr.isvisible() & ! dbin.cb_lclr.isdefault() {
			put "style(darkhexbin(linestyle(color(" 
			put dbin.cb_lclr 
			put ")))) "
		}
		if dbin.cl_lclr.isvisible() & ! dbin.cl_lclr.isdefault() {
			put "style(darkhexbin(linestyle(color("  `"""'
			put dbin.cl_lclr
			put `"""'
			put ")))) "
		}
	}

	if ! dbin.cb_intensity.isdefault() & dbin.cb_intensity {
		put "style(darkhexbin(shadestyle(intensity("
		put dbin.cb_intensity
		put ")))) "
	}

	if ! dbin.cb_width.isdefault() {
		put "style(darkhexbin(linestyle(width("
		put dbin.cb_width
		put ")))) "
	}
	if ! dbin.cb_pattern.isdefault() {
		put "style(darkhexbin(linestyle(pattern("
		put dbin.cb_pattern
		put ")))) "
	}


	if ! dbin.cl_pclr.isvisible() & ! dbin.cb_pclr.isdefault() {
		put "style(darkflower(color(" 
		put dbin.cb_pclr 
		put "))) "
	}
	if dbin.cl_pclr.isvisible() & ! dbin.cl_pclr.isdefault() {
		put "style(darkflower(color("  `"""'
		put dbin.cl_pclr
		put `"""'
		put "))) "
	}
	if ! dbin.cb_pwidth.isdefault() {
		put "style(darkflower(width("
		put dbin.cb_pwidth
		put "))) "
	}
	if ! dbin.cb_ppattern.isdefault() {
		put "style(darkflower(pattern("
		put dbin.cb_ppattern
		put "))) "
	}


	if ! dbin.cl_pclr.isvisible() & ! dbin.cb_pclr.isdefault() {
		put "style(darkflower(color(" 
		put dbin.cb_pclr 
		put "))) "
	}
	if dbin.cl_pclr.isvisible() & ! dbin.cl_pclr.isdefault() {
		put "style(darkflower(color("  `"""'
		put dbin.cl_pclr
		put `"""'
		put "))) "
	}
	if ! dbin.cb_pwidth.isdefault() {
		put "style(darkflower(width("
		put dbin.cb_pwidth
		put "))) "
	}
	if ! dbin.cb_ppattern.isdefault() {
		put "style(darkflower(pattern("
		put dbin.cb_ppattern
		put "))) "
	}
END

//*****************************************************************************


PROGRAM sunflower_output
BEGIN
	put " " /program lbin_output
	put " " /program dbin_output
END
