home *** CD-ROM | disk | FTP | other *** search
- /*
- A simple Intuition front-end for the Rend24 program.
-
- Requirements:
-
- o Arexx 1.10+
- o Rexxarplib.Library 2.0+
- o Rend24 1.0+
-
- Useage:
-
- 1> Rx RendFE
- */
-
- /*
- The following should be configured by the user:
- */
-
- /* Path and filename of the Rend24 program... */
- rend24 = 'Rend24'
-
- /* Path and filename of the Arexx WaitForPort program... */
- waitforport = 'SYS:Rexxc/WaitForPort'
-
- /* Default input, output, and animation filenames and directories... */
- inpath = 'Pic24:*.24' /* Input IFF24 path */
- infile = '' /* Input IFF24 file */
- outpath = 'RAM:' /* Output IFF path */
- outfile = '*.pic' /* Output IFF pattern */
- apath = 'RAM:' /* Output ANIM path */
- afile = '' /* Output ANIM file */
-
- /*
- Program starts here.
- */
-
- CALL Init
- CALL HandleWindow
-
- CALL Exit('Unexpected end!')
-
- /*
- Clean exit from the program with a message. This function
- does not return.
- */
-
- ERROR:
- Exit:
-
- PARSE ARG msg
-
- CALL Quit(RendHost)
-
- IF SHOW('Libraries','rexxarplib.library') THEN
- CALL REMLIB('rexxarplib.library')
-
- IF SHOW('Libraries','rexxsupport.library') THEN
- CALL REMLIB('rexxsupport.library')
-
- IF msg ~= '' THEN say msg
-
- EXIT 0
-
- /*
- Init() - Initialize the Front-End program.
- */
-
- Init:
-
- /*
- Setup some variables. These can be modified by the
- user as neccessary.
- */
-
- /* Color preferences: */
- color.back = 0
- color.block = 1
- color.detail = 2
- color.shine = 2
- color.shadow = 1
- color.prompt = 1
-
- finput = ''
- foutput = ''
- aoutput = ''
- frames = '0'
-
- /* Options Defaults (0=off, 1=on) */
- tog.lo = 10; tog.hi = 22
- tog.10 = 0 ; opt.10 = '-6' /* 18-bit */
- tog.11 = 0 ; opt.11 = '-c' /* Convert */
- tog.12 = 0 ; opt.12 = '-d' /* Dither */
- tog.13 = 0 ; opt.13 = '-e' /* HAM-E */
- tog.14 = 1 ; opt.14 = '-n' /* NoWait */
- tog.15 = 0 ; opt.15 = '-p' /* Lock Palette */
- tog.16 = 0 ; opt.16 = '-r' /* Delete Files */
- tog.17 = 0 ; opt.17 = '-t' /* NTSC Limit */
- tog.18 = 1 ; opt.18 = '-v' /* Hide View */
- tog.19 = 0 ; opt.19 = '-w' /* Wait For Files */
- tog.20 = 1 ; opt.20 = '-x' /* Scale Width */
- tog.21 = 0 ; opt.21 = '-y' /* Scale Height */
- tog.22 = 0 ; opt.22 = '-z' /* Rotate -90 */
-
- /* Default conversion type: (L=Luma,G=Grey,C=Color,H=Ham) */
- convert = 'C'
-
- /*
- First open the libraries we will be needing.
- */
-
- IF ~SHOW('Libraries','rexxsupport.library') THEN
- IF ~ADDLIB('rexxsupport.library',0,-30,0) THEN
- CALL Exit('Cannot open rexxsupport.library')
-
- IF ~SHOW('Libraries','rexxarplib.library') THEN
- IF ~ADDLIB('rexxarplib.library',0,-30,0) THEN
- CALL Exit('Render.REXX requires RexxArpLib.Library')
-
- /*
- Initialize the Rexxarp stuff.
- */
-
- CALL OPENPORT(RendPort)
-
- /* This next line is why we need Arexx 1.10+ */
- ADDRESS AREXX "'CALL CreateHost(RendHost,RendPort)'"
- ADDRESS COMMAND waitforport 'RENDHOST'
-
- CALL SetReqColor(RendHost,BLOCKPEN,color.block)
- CALL SetReqColor(RendHost,DETAILPEN,color.detail)
- CALL SetReqColor(RendHost,BACKGROUNDPEN,color.back)
- CALL SetReqColor(RendHost,PROMPTPEN,color.prompt)
- CALL SetReqColor(RendHost,BOXPEN,color.shine)
- CALL SetReqColor(RendHost,SHADOWPEN,color.shadow)
- CALL SetReqColor(RendHost,OKAYPEN,color.prompt)
- CALL SetReqColor(RendHost,CANCELPEN,color.prompt)
-
- widcmp = 'CLOSEWINDOW+GADGETUP'
- wflags = 'ACTIVATE+WINDOWCLOSE+WINDOWDEPTH+WINDOWDRAG+BACKFILL'
- wtitle = 'Rend24 Arexx Front-End © 1991 TEKSoft'
- wwid = 480
- wht = 120
-
- CALL OpenWindow(RendHost,100,40,wwid,wht,widcmp,wflags,wtitle)
-
- CALL AddGadget(RendHost,10,16,1,' Source IFF24 ','INPAT')
- CALL AddGadget(RendHost,10,29,2,' Target IFF ','OUTPAT')
- CALL AddGadget(RendHost,10,42,3,' Target ANIM ','OUTANIM')
- CALL Print(140,17,color.prompt,'(None)')
- CALL Print(140,30,color.prompt,'(None)')
- CALL Print(140,43,color.prompt,'(None)')
-
- CALL Print(8,57,color.prompt,'Frames:')
- CALL AddGadget(RendHost,78,56,4,frames,'FRAMES %g',48)
-
- CALL Print(160,57,color.prompt,'Format:')
- CALL AddGadget(RendHost,232,56,30,' Luma ','MODE L')
- CALL AddGadget(RendHost,292,56,31,' Grey ','MODE G')
- CALL AddGadget(RendHost,352,56,32,'Color ','MODE C')
- CALL AddGadget(RendHost,412,56,33,' HAM ','MODE H')
- SELECT
- WHEN convert = 'L' THEN CALL SetGadget(RendHost,30,'ON')
- WHEN convert = 'G' THEN CALL SetGadget(RendHost,31,'ON')
- WHEN convert = 'C' THEN CALL SetGadget(RendHost,32,'ON')
- WHEN convert = 'H' THEN CALL SetGadget(RendHost,33,'ON')
- OTHERWISE NOP
- END
-
- CALL AddGadget(RendHost, 10,72,10,'18-Bit ','TOGGLE %d')
- CALL AddGadget(RendHost, 76,72,11,'Convert','TOGGLE %d')
- CALL AddGadget(RendHost,142,72,12,'Dither ','TOGGLE %d')
- CALL AddGadget(RendHost,208,72,13,' HAM-E ','TOGGLE %d')
- CALL AddGadget(RendHost,274,72,14,'NoPause','TOGGLE %d')
- CALL AddGadget(RendHost,340,72,15,' LockP ','TOGGLE %d')
- CALL AddGadget(RendHost, 10,85,16,'Delete ','TOGGLE %d')
- CALL AddGadget(RendHost, 76,85,17,' Limit ','TOGGLE %d')
- CALL AddGadget(RendHost,142,85,18,' Hide ','TOGGLE %d')
- CALL AddGadget(RendHost,208,85,19,' Wait ','TOGGLE %d')
- CALL AddGadget(RendHost,274,85,20,'Scale X','TOGGLE %d')
- CALL AddGadget(RendHost,340,85,21,'Scale Y','TOGGLE %d')
- CALL AddGadget(RendHost,406,85,22,'Rotate ','TOGGLE %d')
-
- DO i = tog.lo TO tog.hi
- IF tog.i THEN CALL SetGadget(RendHost,i,'ON')
- END
-
- CALL AddGadget(RendHost,160,104,99,' Begin Conversion ','BEGIN')
-
- RETURN 0
-
- /*
- Wait for and handle all messages from our window. This function
- never returns, actually. It just goes directly to Exit().
- */
-
- HandleWindow:
-
- DO FOREVER
- CALL WAITPKT(RendPort)
- packet = GETPKT(RendPort)
- DO WHILE packet ~= NULL()
- PARSE VALUE GETARG(packet) WITH arg0 arg1 .
- CALL REPLY(packet)
- SELECT
- WHEN arg0 = 'CLOSEWINDOW' THEN DO
- CALL Exit('User exit.')
- END
- WHEN arg0 = 'INPAT' THEN DO
- tmp = GetFile(,,inpath,infile,'Input File Pattern:')
- IF tmp ~= '' THEN DO
- finput = tmp
- CALL Print(140,17,color.prompt,finput)
- END
- END
- WHEN arg0 = 'OUTPAT' THEN DO
- foutput = GetFile(,,outpath,outfile,'Ouput File Pattern:')
- IF fouput = '' THEN CALL Print(140,30,color.prompt,'(None)')
- ELSE CALL Print(140,30,color.prompt,foutput)
- END
- WHEN arg0 = 'OUTANIM' THEN DO
- aoutput = GetFile(,,apath,afile,'Output Animation:')
- IF aoutput = '' THEN CALL Print(140,43,color.prompt,'(None)')
- ELSE CALL Print(140,43,color.prompt,aoutput)
- END
- WHEN arg0 = 'FRAMES' THEN DO
- frames = arg1
- END
- WHEN arg0 = 'TOGGLE' THEN DO
- IF tog.arg1 THEN DO
- CALL SetGadget(RendHost,arg1,'OFF')
- tog.arg1 = 0
- END
- ELSE DO
- CALL SetGadget(RendHost,arg1,'ON')
- tog.arg1 = 1
- END
- END
- WHEN arg0 = 'MODE' THEN DO
- convert = arg1
- SELECT
- WHEN arg1 = 'L' THEN DO
- CALL SetGadget(RendHost,30,'ON')
- CALL SetGadget(RendHost,31,'OFF')
- CALL SetGadget(RendHost,32,'OFF')
- CALL SetGadget(RendHost,33,'OFF')
- END
- WHEN arg1 = 'G' THEN DO
- CALL SetGadget(RendHost,30,'OFF')
- CALL SetGadget(RendHost,31,'ON')
- CALL SetGadget(RendHost,32,'OFF')
- CALL SetGadget(RendHost,33,'OFF')
- END
- WHEN arg1 = 'C' THEN DO
- CALL SetGadget(RendHost,30,'OFF')
- CALL SetGadget(RendHost,31,'OFF')
- CALL SetGadget(RendHost,32,'ON')
- CALL SetGadget(RendHost,33,'OFF')
- END
- WHEN arg1 = 'H' THEN DO
- CALL SetGadget(RendHost,30,'OFF')
- CALL SetGadget(RendHost,31,'OFF')
- CALL SetGadget(RendHost,32,'OFF')
- CALL SetGadget(RendHost,33,'ON')
- END
- OTHERWISE NOP
- END
- END
- WHEN arg0 = 'BEGIN' THEN DO
- IF finput = '' THEN DO
- ECHO 'Need to specify an input file at least.'
- LEAVE
- END
- command = rend24
- SELECT
- WHEN convert = 'L' THEN command = command || ' -l'
- WHEN convert = 'G' THEN command = command || ' -g'
- WHEN convert = 'H' THEN command = command || ' -h'
- OTHERWISE NOP
- END
- DO i = tog.lo TO tog.hi
- IF tog.i THEN command = command||' '||opt.i
- END
- IF foutput ~= '' THEN command = command || ' -o'||foutput
- IF aoutput ~= '' THEN command = command || ' -a'||aoutput
- IF frames ~= '0' THEN command = command || ' -f'||frames
- command = command || ' '||finput
- CALL WindowToBack(RendHost)
- ECHO command
- ADDRESS COMMAND command
- CALL WindowToFront(RendHost)
- END
-
- OTHERWISE NOP
- END
- packet = GETPKT(RendPort)
- END
- END
-
- Print:
-
- xpos = ARG(1)
- ypos = ARG(2) + 6
- pen = ARG(3)
- text = ARG(4)
- CALL SetAPen(RendHost,pen)
- CALL Move(RendHost,xpos,ypos)
- CALL Text(RendHost,text)
-
- RETURN 0
-
- /*
- All done.
- */