home *** CD-ROM | disk | FTP | other *** search
- /* CMD: ½CreateArcText */
- /* By Brett Evan Hester 13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
- MacrosName = "CreateArcText"
- /* Macro Type: */
- /* CREATES * TEXT * LAYER NEEDED * REMEMBERS */
- /* Description: */
-
- Info1A = "!Create Arc Text © Information 1 of 2"
- Info1B = ""
- Info1C = "@This macro creates an object out of text in the "
- Info1D = "@shape of an arc, curve, or circle. "
- Info1E = ""
- Info1F = "UPPER ARC bends text on the TopSide of a circle."
- Info1G = "LOWER ARC bends text on the BtmSide of a circle."
- Info1H = "WRAP AROUND bends text around the equater of a "
- Info1I = "globe. "
- Info1J = ""
- Info1K = "RADIUS refers to the inner edge of the circle, "
- Info1L = "where the text is closest to the center. "
- Info1M = ""
- Info1N = "LOAD FONT will display a file req. to add a font"
-
- Info2A = "!Create Arc Text © Information 2 of 2"
- Info2B = "@ Plug-Ins and Go! © "
- Info2C = " Hester and associates"
- Info2D = " 13032 Copenhill Road "
- Info2E = " Dallas, Texas 75240 "
- Info2F = "@Special Thanks to: "
- Info2G = "Arnie Cachelin Henry Ribron Mark J. Holland "
- Info2H = "J. Phil Kelso Terry Wester Steven K. Simms "
- Info2I = "Kevin DeRita Greg Glaser William S. Hawes"
- Info2J = "NewTek © Commodore © INOVAtronics © "
- Info2K = ""
- Info2L = "@This macro represents a lot of time & hard work."
- Info2M = "@Encourage people to create new ones and not kill"
- Info2N = "@that possibility by stealing those that are out."
-
- /* -------------------------------------------------------------------- */
- /* Start Error Detection (See End) */
- SIGNAL ON ERROR
- SIGNAL ON SYNTAX
- /* Address LightWave */
- VT3DLib = ADDLIB("LWModelerARexx.port",0)
- ADDRESS "LWModelerARexx.port"
- /* Add Math Functions */
- MATHLIB="rexxmathlib.library"
- IF POS(MATHLIB , SHOW('L')) = 0 THEN
- IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
- CALL Notify(1,"!Can't find "MATHLIB)
- EXIT
- END
-
- /* -------------------------------------------------------------------- */
- /* Empty Layer Setup */
- Empty = EmptyLayers()
- IF (WORDS(Empty) < 2) THEN DO
- CALL Notify(1,"!Sorry!","@This macro needs two empty layers.")
- CALL Exiting
- END
- MainLayer = WORD(Empty, 1)
- WorkLayer = WORD(Empty, 2)
-
- /* -------------------------------------------------------------------- */
- /* Setting Fixed Variables */
- PI = 3.141592653589793238462643
- RadToDeg = 180 / PI ; DegToRad = PI / 180
-
- /* -------------------------------------------------------------------- */
- /* Reading Global Macro Preferences */
- BEHDefaultFilePath = "Sys:"
- BEHSettingsSavedTo = "T:"
- BEHSpeechAndSound = "1"
-
- IF (EXISTS("S:PlugInPrefs")) THEN DO
- IF (~OPEN(PlugInPrefs, "S:PlugInPrefs", 'R')) THEN BREAK
- IF (READLN(PlugInPrefs) ~= "PlugInPrefs") THEN BREAK
- BEHDefaultFilePath = READLN(PlugInPrefs)
- BEHSettingsSavedTo = READLN(PlugInPrefs)
- BEHSpeechAndSound = READLN(PlugInPrefs)
- CALL CLOSE PlugInPrefs
- END
- /* -------------------------------------------------------------------- */
- /* Recalling Macro Settings */
- ReqStyle = "1"
- ReqText = "Welcome"
- ReqFont = "0"
- ReqRadius = "5"
- FilePath = "/ToasterFonts"
-
- PrefsFileName = BEHSettingsSavedTo||MacrosName||".PLUG"
-
- IF (EXISTS(PrefsFileName)) THEN DO
- IF (~OPEN(PrefsFile, PrefsFileName, 'R')) THEN BREAK
- IF (READLN(PrefsFile) ~= MacrosName) THEN BREAK
-
- ReqStyle = READLN(PrefsFile)
- ReqText = READLN(PrefsFile)
- ReqFont = READLN(PrefsFile)
- ReqRadius = READLN(PrefsFile)
- FilePath = READLN(PrefsFile)
- FileName = READLN(PrefsFile)
-
- CALL CLOSE PrefsFile
- END
-
- /* ******************************************************************** */
- /* Main Body Of Code */
- OKtoContinueA = 0
- DO UNTIL OKtoContinueA = 1
- OKtoContinueA = 1
- OKtoContinueB = 0
- DO UNTIL OKtoContinueB = 1
- OKtoContinueB = 1
- CALL MenuRequester
- IF BEHInfo = 1 THEN CALL LoadingFont
- IF BEHInfo = 2 THEN CALL InformationWindows
- END
- CALL VerifyInput
- END
- CALL CreationStage
- CALL SaveSettings
- CALL Exiting
-
- /* ******************************************************************** */
- /* User Interface */
- MenuRequester:
-
- CALL Req_Begin("Create Arc Text © by Brett Hester")
-
- ReqA = Req_AddControl("Style",'CH', "UpperArc LowerArc WrapAround")
- ReqB = Req_AddControl("Text:",'S',"32")
- ReqC = Req_AddControl("Font",'F')
- ReqD = Req_AddControl("Radius",'N',1)
- CALL Req_AddControl("",'T', "")
- ReqE = Req_AddControl("",'CH', " Load Font Information")
-
- CALL Req_SetVal(ReqA, ReqStyle)
- CALL Req_SetVal(ReqB, ReqText)
- CALL Req_SetVal(ReqC, ReqFont)
- CALL Req_SetVal(ReqD, ReqRadius)
- CALL Req_SetVal(ReqE, 0)
-
- IF Req_Post() = 0 THEN CALL Exiting
-
- ReqStyle = Req_GetVal(ReqA)
- ReqText = Req_GetVal(ReqB)
- ReqFont = Req_GetVal(ReqC)
- ReqRadius = ABS(Req_GetVal(ReqD))
- BEHInfo = Req_GetVal(ReqE)
-
- IF ReqRadius < 1 THEN ReqRadius = 1
-
- CALL Req_End()
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Loading Font */
- LoadingFont:
-
- FileReq = GetFileName("--- Load Font ---", FilePath, FileName)
- IF FileReq ~= "(none)" THEN DO
- /* Extracting File Name and Path from Requester */
- FileReqLength = LENGTH(FileReq)
- FileDivider = LASTPOS("/",FileReq)
- IF FileDivider = 0 THEN FileDivider = LASTPOS(":",FileReq)
- FileNameLength = FileReqLength - FileDivider
-
- FilePath = STRIP(LEFT(FileReq, FileDivider),"T","/")
- FileName = RIGHT(FileReq, FileNameLength)
-
- ReqFont = FontLoad(FileReq)
- IF ReqFont = 0 THEN CALL Notify(1,"!Sorry!,",'@Cannot load font "'FileReq'"')
- END
- OKtoContinueB = 0
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Verify Input */
- VerifyInput:
-
- IF ReqText = "" THEN DO
- CALL Notify(1,"!Text must be provided!")
- OKtoContinueA = 0
- END
- IF ReqFont = 0 THEN DO
- CALL Notify(1,"!A font must be loaded!")
- OKtoContinueA = 0
- END
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Creation Stage */
- CreationStage:
-
- Total = 0
- DO i=1 TO LENGTH(ReqText)
- CALL SetLayer(WorkLayer)
-
- Width = MakeText(SUBSTR(ReqText,i,1), ReqFont)
- PARSE VALUE BoundingBox() WITH N X1 X2 Y1 Y2 Z1 Z2
- Width = Width + X1
- /* Side Side Side Formula */
- Angle = (ACOS(((ReqRadius*ReqRadius*2)-(Width*Width))/(2*ReqRadius*ReqRadius)))*RadToDeg
- Total = Total + Angle
-
- IF ReqStyle = 1 THEN DO
- CALL Rotate((90-((180-Angle)/2)), "Z", 0 0 0)
- CALL Move(0 ReqRadius 0)
- END
- IF ReqStyle = 2 THEN DO
- CALL Rotate(((90-((180-Angle)/2))*-1), "Z", 0 0 0)
- CALL Move(0 ((-1*ReqRadius)-0.75) 0)
- END
- IF ReqStyle = 3 THEN DO
- CALL Rotate((90-((180-Angle)/2)), "Y", 0 0 0)
- CALL Move(0 0 (-1*ReqRadius))
- END
-
- CALL Cut() ; CALL SetLayer(MainLayer) ; CALL Paste()
-
- IF ReqStyle = 1 THEN CALL Rotate((-1*Angle), "Z", 0 0 0)
- IF ReqStyle = 2 THEN CALL Rotate(Angle, "Z", 0 0 0)
- IF ReqStyle = 3 THEN CALL Rotate((-1*Angle), "Y", 0 0 0)
- END
-
- IF ReqStyle = 1 THEN CALL Rotate((Total/2), "Z", 0 0 0)
- IF ReqStyle = 2 THEN CALL Rotate(((Total/2)*-1), "Z", 0 0 0)
- IF ReqStyle = 3 THEN CALL Rotate((Total/2), "Y", 0 0 0)
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Recording Macro Settings */
- SaveSettings:
-
- IF (OPEN(PrefsFile, PrefsFileName, 'W')) THEN DO
- CALL WRITELN(PrefsFile, MacrosName)
-
- CALL WRITELN(PrefsFile, ReqStyle)
- CALL WRITELN(PrefsFile, ReqText)
- CALL WRITELN(PrefsFile, ReqFont)
- CALL WRITELN(PrefsFile, ReqRadius)
- CALL WRITELN(PrefsFile, FilePath)
- CALL WRITELN(PrefsFile, FileName)
-
- CALL CLOSE PrefsFile
- END
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Ending */
- Exiting:
-
- IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
- EXIT
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Information Windows */
- InformationWindows:
-
- OKorCancel = Notify(2, Info1A, Info1B, Info1C, Info1D, Info1E, Info1F, Info1G, Info1H, Info1I, Info1J, Info1K, Info1L, Info1M, Info1N)
- IF OKorCancel = 1 THEN CALL Notify(1, Info2A, Info2B, Info2C, Info2D, Info2E, Info2F, Info2G, Info2H, Info2I, Info2J, Info2K, Info2L, Info2M, Info2N)
- OKtoContinueB = 0
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Error Handling */
- SYNTAX:
- ERROR:
-
- ErrCode = RC
- ErrLine = SIGL
- ErrInfo = ERRORTEXT(ErrCode)
-
- Err1 = "!Sorry!"
- Err2 = "An Error has been detected"
- Err3 = "@þ Macro - "
- Err4 = "@þ Line Number - "
- Err5 = "@þ Error Code - "
- Err6 = "@þ Error Description -"
- Err7 = "@¤ Please Inform - "
- Err8 = ' "Error Notice" '
- Err9 = " 13032 Copenhill Rd."
- Err10 = " Dallas, TX. 75240 "
-
- Call Notify(1,Err1,Err2,Err3,MacrosName,Err4,ErrLine,Err5,ErrCode,Err6,ErrInfo,Err7,Err8,Err9,Err10)
-
- /* -------------------------------------------------------------------- */
- /* Advanced Error Handling */
- CALL SETCLIP("ErrorMacro",MacrosName)
- CALL SETCLIP("ErrorLine",ErrLine)
- CALL SETCLIP("ErrorCode",ErrCode)
- CALL SETCLIP("ErrorDesc",ErrInfo)
-
- PARSE SOURCE TempA TempB ErrFile TempC TempD TempE
-
- CALL SETCLIP("ErrorFile",ErrFile)
-
- /* -------------------------------------------------------------------- */
-
- IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
- EXIT
-