
! script name: draft.d/doubleballoon
! topic: construct two text in a balloon

!A
!A NAME:
!A
!A 	Double  Balloon
!A
!A DESCRIPTION:
!A
!A 	This script allows two lines of text to be placed inside a balloon.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT UPPER TEXT: Enter the line of text to be placed in the top half
!B 		of the balloon.
!B
!B 	INPUT LOWER TEXT: Enter the line of text to be placed in the lower half
!B 		of the balloon.
!B
!B 	LEADER START ABS X,Y: Enter the X,Y coordinates for the starting
!B 		 position of the line of text.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	LEADER MIDDLE ABS X,Y: Enter the X,Y coordinates for the middle
!B 		 of the leader line.
!B
!B 	LEADER END ABS X,Y: Enter the X,Y coordinates for the position
!B 		 of the balloon.
!B
!# see also - htdocs/help.d/dynamicdim.htm
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: double balloon ")

DIM Answer$[256]
DIM Text1$[256]
DIM Text2$[256]
DIM Destination$[256]
DEG

ActivateUndo
Start:!
Dynamic_position=1
Dim_type= WsTextBalloon
! Dim_type= WsLeaderBalloon


Dim_loop:!

Stat=SetInputFormat("a99","",0)
Stat=GetValue("INPUT UPPER TEXT",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat= BackSlashChars(Answer$,Text1$)

Stat=SetInputFormat("a99","",0)
Stat=GetValue("INPUT LOWER TEXT",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat= BackSlashChars(Answer$,Text2$)

stat= SetInputFormat("n4","")
Pstart=XyzInput("LEADER START",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pstart) THEN Dim_loop

Pmid=XyzInput("LEADER MIDDLE",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pmid) THEN Dim_loop

Pick_point:IF Dynamic_position THEN
        Pend= ParameterPt(Pmid,0)
ELSE
	Stat=SetInputFormat("n4","")
        Pend=XyzInput("LEADER END",WsXyOnly)
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT ValidGeometry(Pend) THEN Pick_point
END IF


PlotOff
E1= OverUnderBalloon(Dim_type,Text1$,Text2$,Pstart,Pmid,Pend)
PlotOn
Stat=DeleteEntity(Pstart)
Stat=DeleteEntity(Pend)
Stat=DeleteEntity(Pmid)
IF Dynamic_position THEN
        Which_end=1
        Vnum= LastPickView
        Stat= DynamicDimEdit(Vnum,E1,Which_end,"PICK LEADER END",WsFalse)
	IF (ExitScript(Destination$)) THEN
                Stat= DeleteEntity(E1)
                GOTO Leave
        END IF
END IF

ActivateUndo
Stat= AdvanceUndoNumber("balloon")
Stat= AddDimToUndo(WsUBCreateMode,E1)

GOTO Dim_loop

Leave:!
Stat=SetInputFormat("n4","")
Stat=DeleteEntity(Pstart)
Stat=DeleteEntity(Pend)
Stat=DeleteEntity(Pmid)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	IF Destination$= "SCRIPTSTART" THEN Start
        IF Destination$= "BACKUP" THEN Start
	 LOAD Destination$
END IF
END
