/*
    gr_ed_scatter.dlg
    
*!  VERSION 1.0.1  14mar2007

*/

VERSION 10.0
MODAL

INCLUDE _std_vsmall
DEFINE _dlght 250
INCLUDE header_gr_ed

DEFINE _clwd	15
DEFINE _wd	110
DEFINE _sep	+115
DEFINE _wd2	100
DEFINE _sep2	+105
DEFINE _cbwd	130
DEFINE _cbsep	+135

SCRIPT PREINIT
BEGIN
	settitle "Scatter properties"
	create STRING G
	create STRING J
	create STRING style
	create STRING Gstyle
	create ARRAY  ARGS
	program setupGOBJECT
	create DOUBLE index

	create DOUBLE drawview
END

SCRIPT POSTINIT
BEGIN
	marker.ck_hide.show
	
	program get_defaults
	program initialize_controls
END

PROGRAM setupGOBJECT
BEGIN
	if ! __MESSAGE {
		stopbox stop 	///
			"An unexpected error has occurred." "Object not found."
		exit 198
	}
	call G.setvalue class __MESSAGE.value
	call __MESSAGE.tokenize ARGS
	call G.setvalue class ARGS[1]
	call J.setvalue class ARGS[2]
	call Gstyle.setvalue class G.value
	if J.iseq("") {
		call Gstyle.append ".style"
	}
	else {
		call create BOOLEAN customstyle
		call J.withvalue Gstyle.append ".obs_styles[@]"
		call Gstyle.withvalue customstyle.storeClsObjectExists @
		if ! customstyle {
			call Gstyle.setvalue class G.value
			call Gstyle.append ".style"
		}
	}
END

INCLUDE gr_ed_marker

PROGRAM get_defaults
BEGIN
	call G.withvalue drawview.setvalue class @.draw_view.istrue
	if drawview {
		call marker.ck_hide.setdefault 0
	}
	else {
		call marker.ck_hide.setdefault 1
	}
END

PROGRAM initialize_controls
BEGIN
	if drawview {
		call marker.ck_hide.setoff
	}
	else {
		call marker.ck_hide.seton
	}
END

PROGRAM command
BEGIN
	call program get_defaults
	
	put "_gm_dlg_edits"
	beginoptions
		put " object(" G ") "
		put " " /program marker_output
		if J {
			put " jindex(" J ") "
		}
		put " epilog(_gedi toolbar scatter " G " " J ")"
	endoptions
END
