home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************/
- /* ClassX Amiga Rexx script - Copyright © 1997 ClassX Development */
- /******************************************************************/
-
- /*
- $VER: AnimTextGif.rexx 3.1
- */
-
- /*
- #ITA "Animazione Testo (GIF Anim)"
- #INF "Crea un testo animato in formato GIF-Anim."
- #INF "- Descrizione:"
- #INF " La funzione genera un testo animato in formato GIF-Anim agendo"
- #INF " sui settaggi e le tessiture attribuite al font. Almeno una delle"
- #INF " tessiture deve essere composta da più fotogrammi."
- #INF "- Uso:"
- #INF " Dopo aver impostato correttamente l'aspetto del font è sufficiente"
- #INF " seguire le istruzioni a video rispondendo alle richieste del"
- #INF " programma."
- #END
- */
-
- /*
- #ENG "Anim Text (GIF-Anim)"
- #INF "Create an animated text in GIF-Anim format."
- #INF "- Description:"
- #INF " This function generates an animated text in GIF-Anim format,"
- #INF " working with the settings and the textures applied to the font."
- #INF " At least one of the textures must have more than one frame."
- #INF "- Usage:"
- #INF " Simply follow the instructions on screen and answer the questions"
- #INF " which will be asked by the program."
- #END
- */
-
-
- MYPORT = 'FontMachine'
-
- IF ~SHOW('P', MYPORT) THEN DO
- IF EXISTS('FontMachine:FontMachine') THEN DO
- ADDRESS COMMAND 'Run >NIL: FontMachine:FontMachine'
- DO 30 WHILE ~SHOW('P',MYPORT)
- ADDRESS COMMAND 'Wait >NIL: 1 SEC'
- END
- END
- ELSE DO
- SAY "FontMachine could not be loaded."
- EXIT 10
- END
- END
-
- IF ~SHOW('P', MYPORT) THEN DO
- SAY 'FontMachine Rexx port could not be opened.'
- EXIT 10
- END
-
- ADDRESS VALUE MYPORT
- OPTIONS RESULTS
- OPTIONS FAILAT 10000
-
- /* Make sure rexxsupport library is opened */
- IF ~SHOW('L','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30)
-
- SIGNAL ON Break_C
- SIGNAL ON Break_D
-
- /******************************************************************/
-
- /* check font */
-
- GetPrevWinAddress
- if FM_RESULT = 0 then EXIT 0
-
- /* local vars//settings */
-
- FRAMEPATH = "FontMachine:T/frame"
- ANIMPATH = "FontMachine:AnimText/"
-
-
- /* language support */
-
- LockGui
- GetLocale
-
- Select
- /* italiano */
- when FM_RESULT = "ITA" then do
- TXT_01 = '"Digita il testo da animare"'
- TXT_02 = '"Seleziona la tessitura da animare"'
- TXT_03 = '"Fronte|Bordo|Fronte+Bordo|Cancel"'
- TXT_04 = '"Salva Animazione"'
- TXT_05 = '"Quanti fotogrammi di animazione ?"'
- TXT_06 = '"Errore di creazione GIF-Anim"'
- TXT_10 = '"Fine"'
- end
-
- /* english or default language */
- when FM_RESULT = "ENG" then do
- TXT_01 = '"Type the text to animate"'
- TXT_02 = '"Select the texture to animate"'
- TXT_03 = '"Front|Border|Front+Border|Cancel"'
- TXT_04 = '"Save the Animation"'
- TXT_05 = '"How many frames for the AnimText ?"'
- TXT_06 = '"GIF-Anim creation error"'
- TXT_10 = '"End"'
- end
- end
-
-
- /* get texture information */
- GetTextureFrames FRONT
- fframes = FM_RESULT
- GetTextureFrames BORDER
- bframes = FM_RESULT
-
- if (fframes > 1) | (bframes > 1) then do
-
- /* store environment */
- GetPref AUTODRAW
- pref_autodraw = FM_RESULT
- GetPreviewString
- pref_previewstring = FM_RESULT
-
- /* set new environment */
- SetPref AUTODRAW ON
- SetPreviewString '" "'
- call WaitRender
-
- /* cleanup frame path */
- ADDRESS COMMAND 'Delete >NIL: "'FRAMEPATH'#?"'
- ADDRESS COMMAND 'Delete >NIL: FontMachine:t/frm.lst'
-
- AskString '"AnimText"' TXT_01 '"'pref_previewstring'"'
- if FM_RESULT ~= '' then do
- previewstring = FM_RESULT
- SetPreviewString '"'FM_RESULT'"'
- CALL WaitRender
-
- Request '"FontMachine"' TXT_02 TXT_03
- sel = FM_RESULT
-
- Select
- /* Front */
- when sel = 1 then do
- do f=1 to fframes
- LoadTextureFrame FRONT f
- CALL WaitRender
- SavePreview '"'FRAMEPATH || "." || RIGHT(f, 3, "0")'"'
- if RC ~= 0 then do
- Request '"FontMachine"' '"'FM_ERROR'"' '"Ok"'
- break
- end
- end
- end
-
- /* Border */
- when sel = 2 then do
- do f=1 to bframes
- LoadTextureFrame BORDER f
- CALL WaitRender
- SavePreview '"'FRAMEPATH || "." || RIGHT(f, 3, "0")'"'
- if RC ~= 0 then do
- Request '"FontMachine"' '"'FM_ERROR'"' '"Ok"'
- break
- end
- end
- end
-
- /* Front+Border */
- when sel = 3 then do
- totframes = MAX(fframes,bframes)
- AskString '"AnimText"' TXT_05 totframes
- if FM_RESULT ~= 0 then totframes = FM_RESULT
-
- do f=1 to totframes
- LoadTextureFrame FRONT f
- LoadTextureFrame BORDER f
- CALL WaitRender
- SavePreview '"'FRAMEPATH || "." || RIGHT(f, 3, "0")'"'
- if RC ~= 0 then do
- Request '"FontMachine"' '"'FM_ERROR'"' '"Ok"'
- break
- end
- end
- end
-
- /* cancel -> do nothing */
- otherwise nop
- end
-
- if sel ~= 0 then do
- /* convert IFF frames to GIF */
- ADDRESS COMMAND 'List >FontMachine:t/frm.lst "'FRAMEPATH'#?" FILES LFORMAT "FontMachine:c/TapGIF %p%n %p%n.GIF BACK 0 TRAN 0"'
- ADDRESS COMMAND 'Execute >NIL: FontMachine:t/frm.lst'
- if RC = 0 then do
- /* convert to GIF animation */
- RequestFile TXT_04 '"'ANIMPATH || previewstring || ".gif"'"' SAVEMODE
- ANIMPATH = FM_RESULT
- if ANIMPATH ~= "" then do
- /* build GIF framelist */
- ADDRESS COMMAND 'List >FontMachine:t/frm.lst "'FRAMEPATH'#?.GIF" FILES LFORMAT "%p%n"'
- ADDRESS COMMAND 'Sort FontMachine:t/frm.lst FontMachine:t/frm.lst'
- /* make the GIF-Anim */
- ADDRESS COMMAND 'FontMachine:c/WhirlGif >NIL: -o "'ANIMPATH'" -loop -time 10 -disp back -trans 0 -i FontMachine:t/frm.lst'
- end
- end
- else do
- Request '"FontMachine"' TXT_06 'Ok'
- end
-
- /* cleanup frame path */
- ADDRESS COMMAND 'Delete >NIL: "'FRAMEPATH'#?"'
- ADDRESS COMMAND 'Delete >NIL: FontMachine:t/frm.lst'
- end
- end
- /* restore environment */
- LoadTextureFrame BORDER 1
- LoadTextureFrame FRONT 1
- SetPref AUTODRAW pref_autodraw
- SetPreviewString '"'pref_previewstring'"'
- CALL WaitRender
-
- end
-
- /* end */
- Request '"FontMachine"' TXT_10 'Ok'
- UnLockGui
- EXIT
-
- /******************************************************************/
-
- WaitRender: PROCEDURE
- /* wait the rendering of the font */
- DO FOREVER
- CheckRedraw
- if FM_RESULT ~= 0 then ADDRESS COMMAND 'Wait >NIL: 1 SEC'
- else LEAVE
- END
- RETURN
-
- /******************************************************************/
-
- /* break handlers */
- Break_C:
- Break_D:
- UnLockGui
- Request '"FontMachine"' '"Procedure Stopped"' 'Ok'
- RETURN
-
- /******************************************************************/
-