/*
  gr_ed_dot.idlg

*!  VERSION 1.0.0  05dec2006

*/

SCRIPT dots_PREINIT
BEGIN
	create STRING color
	create STRING rgb
	create STRING size
	create STRING symbol
	program dots_get_defaults
END

SCRIPT dots_POSTINIT
BEGIN
	program dots_initialize_controls
END

DIALOG dots, tabtitle("Dots")
BEGIN
  GROUPBOX gb_dots	_lft	_top	_iwd	_ht8,		///
	label("Dot properties")
  TEXT     tx_size	_ilft	_ss	_wd	.,		///
	label("Size:") right
  COMBOBOX cb_size	_sep	@	_cbwd	.,		///
	dropdown						///
	contents(_symbolsizes)
  
  TEXT     tx_symbol	_ilft	_mls	_wd	.,		///
	label("Symbol:") right
  COMBOBOX cb_symbol	_sep	@	_cbwd	.,		///
	dropdownlist 						///
	contents(_symbols)

  TEXT     tx_clr	_ilft	_mls	_wd	.,		///
	label("Color:") right
  COMBOBOX cb_clr	_sep	@	_cbwd	.,		///
	dropdownlist contents(_colors) 				///
	onselchangelist(dots_cl_clr_sel)
  COLOR    cl_clr	_cbsep	@	_clwd	.,
END

LIST dots_cl_clr_sel
BEGIN
	dots.cl_clr.show
	dots.cl_clr.hide
END

PROGRAM dots_get_defaults
BEGIN
	call G.withvalue index.setvalue class @.style.dots.size.styledex
	call index.withvalue size.setstring class .__STYLES.symbolsize[@]
	if ! size {
		call G.withvalue size.setstring class @.style.dots.size.val
	}
	call dots.cb_size.setdefault class size.value

	call G.withvalue index.setvalue class @.style.dots.symbol.styledex
	call index.withvalue symbol.setstring class .__STYLES.symbol[@]
	call dots.cb_symbol.setdefault class symbol.value

	call G.withvalue index.setvalue class @.style.dots.linestyle.color.styledex
	call index.withvalue color.setvalue class .__STYLES.color[@]
	call dots.cb_clr.setdefault class color.value
	call G.withvalue rgb.setvalue class @.style.dots.linestyle.color.rgb
	call dots.cl_clr.setdefault class rgb.value
END

PROGRAM dots_initialize_controls
BEGIN
	call dots.cb_size.setvalue class size.value
	call dots.cb_symbol.setvalue class symbol.value
	
	if color {
		call color.withvalue dots.cb_clr.setvalue "@"
	}
	if ! color {
		call dots.cb_clr.setvalue "custom"
	}
	call dots.cl_clr.setvalue class rgb.value
END

PROGRAM dot_output
BEGIN
	if ! dots.cb_size.isdefault() {
		put "style(dots(size("
		put dots.cb_size
		put "))) "
	}
	if ! dots.cb_symbol.isdefault() {
		put "style(dots(symbol("
		put dots.cb_symbol
		put "))) "
	}

	if ! dots.cl_clr.isvisible() & ! dots.cb_clr.isdefault() {
		put "style(dots(linestyle(color(" 
		put dots.cb_clr 
		put ")))) "
	}
	if dots.cl_clr.isvisible() & ! dots.cl_clr.isdefault() {
		put "style(dots(linestyle(color("  `"""'
		put dots.cl_clr
		put `"""'
		put ")))) "
	}
END
