home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDSavers / SaveToPREFPRINTER.fred.pre < prev    next >
Encoding:
Text File  |  1994-01-31  |  5.8 KB  |  250 lines

  1. /*
  2. ** SaveToPREFPRINTER.fred.pre
  3. **
  4. ** $VER: SaveToPREFPRINTER.fred.pre 1.3.0 (31.10.93)
  5. **
  6. ** If the SaveToPREFPRINTER.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user to enter the print parameters.
  8. ** These parameters will be stuffed into REXX clips.
  9. **
  10. ** If they fail to answer, the InvokeADPro list will be aborted.
  11. **
  12. ** Clips Exported:
  13. **    FREDPREFPRINTERUseDefaults    -    ~0 to use current settings
  14. **                        0 to specify new settings
  15. **    FREDPREFPRINTEROrientation    -    Orientation of print
  16. **    FREDPREFPRINTERDither        -    Dither method to use
  17. **    FREDPREFPRINTERMaskSize        -    Dither mask size
  18. **    FREDPREFPRINTERDensity        -    Density
  19. **    FREDPREFPRINTERPrintWidth    -    Print Width
  20. **    FREDPREFPRINTERPrintHeight    -    Print Height
  21. **    FREDPREFPRINTERPrintLeft    -    Print Left Offset
  22. **    FREDPREFPRINTERPrintTop        -    Print Top Offset
  23. **    FREDPREFPRINTERPageWidth    -    Page Width
  24. **    FREDPREFPRINTERPageHeight    -    Page Height
  25. **    FREDPREFPRINTERPageLeft        -    Page Left Margin
  26. **    FREDPREFPRINTERPageTop        -    Page Top Margin
  27. **    FREDPREFPRINTERPaperHeight    -    Paper Height
  28. **
  29. ** NOTE: Clip names are case sensitive.
  30. **
  31. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  32. ** ADPro v2.5.0 (or higher).
  33. **
  34. ** Copyright © 1992-1993 ASDG, Incorporated
  35. ** All Rights Reserved
  36. */
  37.  
  38.  
  39. ADDRESS "ADPro"
  40. OPTIONS RESULTS
  41.  
  42. PARSE ARG NumberOfCells NumberOfFrames
  43.  
  44. NL = '0A'X
  45. SQ = '27'X
  46. DQ = '22'X
  47. TRUE  = 1
  48. FALSE = 0
  49.  
  50.  
  51. /*
  52. ** Ask the user if the current settings are adequate.
  53. */
  54.  
  55. ADPRO_TO_FRONT
  56.  
  57. OKAYN '"SaveToPREFPRINTER.fred"' '"Select Settings?"' '"Redefine|Use Current|Cancel"'
  58. IF (RC = 0) THEN DO
  59.     SCREEN_TO_FRONT "FRED"
  60.     EXIT 10
  61. END
  62. ELSE IF (RC = 2) THEN DO
  63.     SETCLIP( "FREDPREFPRINTERUseDefaults", 1 )
  64.     EXIT 0
  65. END
  66. ELSE IF (RC = 1) THEN DO
  67.     ADPRO_TO_FRONT
  68.  
  69.     OKAYN '"SaveToPREFPRINTER.fred"' '"Choose orientation."' '"Horizontal|Vertical|Cancel"'
  70.     IF (RC = 0) THEN DO
  71.         SCREEN_TO_FRONT "FRED"
  72.         EXIT 10
  73.     END
  74.     ELSE IF (RC = 1) THEN
  75.         Orientation = "HORIZONTAL"
  76.     ELSE IF (RC = 2) THEN
  77.         Orientation = "VERTICAL"
  78. END
  79.  
  80. SETCLIP( "FREDPREFPRINTEROrientation", Orientation )
  81.  
  82.  
  83. /*
  84. ** Set the Dither type and Mask Size (if necessary).
  85. */
  86.  
  87. MaskSize = 2    /* If 2, we'll ask for new one */
  88.         /* Set to 0 if no mask size is required */
  89.  
  90. DitherType.1  = "Floyd"
  91. DitherType.2  = "Ordered"
  92. DitherType.3  = "Horizontal"
  93. DitherType.4  = "Vertical"
  94. DitherType.5  = "Forward Brick"
  95. DitherType.6  = "Backward Brick"
  96. DitherType.7  = "Forward Diagonal"
  97. DitherType.8  = "Backward Diagonal"
  98. DitherType.9  = "Halftone A"
  99. DitherType.10 = "Halftone B"
  100. DitherType.11 = "ASCII"
  101. MinDitherType = 1
  102. MaxDitherType = 11
  103. DefDitherType = 1
  104.  
  105. String = '"' || DitherType.DefDitherType || '"'
  106. DO LoopCounter = MinDitherType TO MaxDitherType
  107.     String = String '"' || DitherType.LoopCounter || '"'
  108. END
  109.  
  110. MaskSizeID.1 = 2
  111. MaskSizeID.2 = 4
  112. MaskSizeID.3 = 8
  113. MaskSizeID.4 = 16
  114.  
  115. continue = 0
  116. DO UNTIL (continue = 1)
  117.     ADPRO_TO_FRONT
  118.  
  119.     LISTVIEW '"Dither Modes:"' (MaxDitherType-MinDitherType+1) ITEMS String
  120.     LISTVIEW_RC = RC
  121.     PARSE VAR ADPRO_RESULT '"'DitherTypeStr'"' scratch
  122.  
  123.     DitherMode = MinDitherType
  124.     DO WHILE (DitherMode <= MaxDitherType) & (COMPARE( DitherTypeStr, DitherType.DitherMode ) ~= 0)
  125.         DitherMode = DitherMode + 1
  126.     END
  127.  
  128.     IF (LISTVIEW_RC ~= 0) & (LISTVIEW_RC ~= 1) THEN DO
  129.         ADPRO_TO_FRONT
  130.  
  131.         OKAYN '"SaveToPREFPRINTER.fred"' '"This value is required."' '"Retry|Cancel"'
  132.         IF (RC = 0) THEN
  133.             EXIT 10
  134.     END
  135.     ELSE DO
  136.         IF (DitherMode ~= 1) & (DitherMode ~= 11) THEN DO
  137.             ADPRO_TO_FRONT
  138.  
  139.             OKAYN '"SaveToPREFPRINTER.fred"' '"Select Mask Size"' '"2|4|8|16|Cancel"'
  140.             IF (RC = 0) THEN DO
  141.                 SCREEN_TO_FRONT "FRED"
  142.                 EXIT 10
  143.             END
  144.             ELSE
  145.                 MaskSize = MaskSizeID.RC
  146.         END
  147.         ELSE
  148.             MaskSize = 0
  149.  
  150.         continue = 1
  151.     END
  152. END
  153.  
  154. SETCLIP( "FREDPREFPRINTERDither", DitherMode )
  155. SETCLIP( "FREDPREFPRINTERMaskSize", MaskSize )
  156.  
  157.  
  158. /*
  159. ** Set the Print Density.
  160. */
  161.  
  162. CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Print Density"' 1 1 7 TRUE
  163. IF (RESULT = (1-1)) THEN
  164.     EXIT 10
  165. Density = RESULT
  166.  
  167. SETCLIP( "FREDPREFPRINTERDensity", Density )
  168.  
  169.  
  170. /*
  171. ** Set the Print Dimension.
  172. */
  173.  
  174. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Print Width?"' 1.0 0.1 999.0 TRUE
  175. IF (RESULT = "CANCEL") THEN
  176.     EXIT 10
  177. PrintWidth = RESULT
  178.  
  179. SETCLIP( "FREDPREFPRINTERPrintWidth", PrintWidth )
  180.  
  181. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Print Height"' 1.0 0.1 999.0 TRUE
  182. IF (RESULT = "CANCEL") THEN
  183.     EXIT 10
  184. PrintHeight = RESULT
  185.  
  186. SETCLIP( "FREDPREFPRINTERPrintHeight", PrintHeight )
  187.  
  188. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Print Left Offset"' 1.0 0.1 PrintWidth TRUE
  189. IF (RESULT = "CANCEL") THEN
  190.     EXIT 10
  191. PrintLeft = RESULT
  192.  
  193. SETCLIP( "FREDPREFPRINTERPrintLeft", PrintLeft )
  194.  
  195. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Print Top Offset"' 1.0 0.1 PrintHeight TRUE
  196. IF (RESULT = "CANCEL") THEN
  197.     EXIT 10
  198. PrintTop = RESULT
  199.  
  200. SETCLIP( "FREDPREFPRINTERPrintTop", PrintTop )
  201.  
  202.  
  203. /*
  204. ** Set the Page Definition.
  205. */
  206.  
  207. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Page Width"' 1.0 0.1 999.0 TRUE
  208. IF (RESULT = "CANCEL") THEN
  209.     EXIT 10
  210. PageWidth = RESULT
  211.  
  212. SETCLIP( "FREDPREFPRINTERPageWidth", PageWidth )
  213.  
  214. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Page Height"' 1.0 0.1 999.0 TRUE
  215. IF (RESULT = "CANCEL") THEN
  216.     EXIT 10
  217. PageHeight = RESULT
  218.  
  219. SETCLIP( "FREDPREFPRINTERPageHeight", PageHeight )
  220.  
  221. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Page Left Offset"' 1.0 0.1 PageWidth TRUE
  222. IF (RESULT = "CANCEL") THEN
  223.     EXIT 10
  224. PageLeft = RESULT
  225.  
  226. SETCLIP( "FREDPREFPRINTERPageLeft", PageLeft )
  227.  
  228. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Page Top Offset"' 1.0 0.1 PageHeight TRUE
  229. IF (RESULT = "CANCEL") THEN
  230.     EXIT 10
  231. PageTop = RESULT
  232.  
  233. SETCLIP( "FREDPREFPRINTERPageTop", PageTop )
  234.  
  235.  
  236. /*
  237. ** Set the Paper Dimension.
  238. */
  239.  
  240. CALL "FREDSCRIPTS:FREDFunctions/GetAFloat" '"Enter Paper Height"' 1.0 0.1 999.0 TRUE
  241. IF (RESULT = "CANCEL") THEN
  242.     EXIT 10
  243. PaperHeight = RESULT
  244.  
  245. SETCLIP( "FREDPREFPRINTERPaperHeight", PaperHeight )
  246.  
  247. SCREEN_TO_FRONT "FRED"
  248.  
  249. EXIT 0
  250.