
! script name: colors.d/colorcontour
! topic: assign color to contour

!A
!A NAME:
!A
!A 	Color Contour
!A
!A DESCRIPTION:
!A
!A 	This script allows a contour to be colored.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CONTOUR TO BE COLORED: Pick the contour that will be colored.
!B
!B OPTIONS:
!B
!B 	The color selection box will automatically appear to allow a color to
!B 	be selected.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: color contour ")

DIM Destination$[256]
DIM Answer$[256]

ActivateUndo
Pen_color= CurrentColor
IF ARGC<2 THEN RaiseColorBox

Ploop:!
Stat=SetInputFormat("n4a1",",N,")
E1=PickEntity("PICK CONTOUR TO BE COLORED, Name",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="N" THEN
	GOSUB Get_named_grp

	ActivateUndo
	Stat= AdvanceUndoNumber("color contour")
	Stat= AddGroupToUndo(WsUBModifyMode,Group,2,WsTrue)

	Stat=ColorContour(Group)
	GOTO Ploop
END IF
IF NOT ValidGeometry(E1) THEN Ploop

Group= ParentGroup(E1)
ActivateUndo
Stat= AdvanceUndoNumber("color contour")
Stat= AddGroupToUndo(WsUBModifyMode,Group,0,WsFalse)

Stat=ColorContour(E1)

GOTO Ploop

Get_named_grp:!
Stat=ListGrpNames("CONTOUR NAMES","selected group","",0)
IF Stat=1 THEN Leave
Stat=SetInputFormat("a99","")
Stat=GetValue("CONTOUR NAME",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Group=FindNamedGrp(Answer$)
IF NOT ValidGeometry(Group) THEN Get_named_grp
Stat=SetInputFormat("n4","")
LowerSelectBox
RETURN

Leave:!
LowerColorBox
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
