home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / arexx / ole1v10a.lha / OLE_System / modules / fw3 / DrawPRTSetup.fw < prev    next >
Encoding:
Text File  |  1995-02-10  |  4.7 KB  |  229 lines

  1. /*
  2.  * DrawPRTSetup.fw
  3.  *
  4.  * USAGE: DrawPRTSetup.fw
  5.  *
  6.  * A usefull tool making and checking setup of printers.
  7.  *
  8.  * HISTORY:
  9.  * v1.01    Added the support for the progress indicator
  10.  *
  11.  * v1.02    aligned with the new server design v1.10
  12.  *
  13.  * v1.03    minor bug fixed
  14.  *
  15.  * $(C): (1994, Rocco Coluccelli, Bologna)
  16.  * $VER: DrawPRTSetup.fw 1.03 (03.Feb.1995)
  17.  */
  18.  
  19. OPTIONS RESULTS
  20. NUMERIC DIGITS 6
  21.  
  22. PARSE ARG oleclip
  23. PARSE VALUE GETCLIP(oleclip) WITH jobID modID . . . . . oleport . . userport olepipe locale .
  24. PARSE VALUE GETCLIP(olepipe) WITH density colors .
  25.  
  26.  
  27. ADDRESS VALUE userport
  28.  
  29. micro2mm    = 2.54 / 720
  30. micro2inch    = 1 / 720
  31.  
  32. pfontsize   = 80
  33. plinecolor  = 'BLACK'
  34. plineweight = 'Hairline'
  35. pboxfill    = 'Transparent'
  36. pcolorfile  = 'OLE:misc/ColorPalette.iff'
  37.  
  38. SetMeasure 'MICROPOINTS'
  39. GraphicTool
  40. View 50
  41.  
  42.  
  43. /*
  44.  *    Get current setup of page, store boxprefs and lineprefs
  45.  */
  46. Status 'Page'
  47. page = result
  48.  
  49. GetBoxPrefs 'LineWt' 'LineColor' 'Fill'
  50. PARSE VAR result bwidth bcolor bfill .
  51. BoxPrefs 'LineWt' plineweight 'LineColor' plinecolor 'Fill' pboxfill
  52.  
  53. GetLinePrefs 'LineWt' 'LineColor'
  54. PARSE VAR result lwidth lcolor .
  55. LinePrefs 'LineWt' plineweight 'LineColor' plinecolor
  56.  
  57. TextBlockTypePrefs "Size" pfontsize % 10
  58.  
  59.  
  60. /*
  61.  *    Draw boxes around print and editable area
  62.  */
  63. GetPageSetup 'Width' 'Height' 'Top' 'Bottom' 'Left' 'Right'
  64. PARSE VAR result pwidth pheight pup pdown pleft pright .
  65. DrawBox page pleft pup (pwidth - pleft - pright) (pheight - pup - pdown)
  66.  
  67. GetSectionSetUp 'Top' 'Bottom' 'Inside' 'Outside'
  68. PARSE VAR result sup sdown sleft sright .
  69. DrawBox page sleft sup (pwidth - sleft - sright) (pheight - sup - sdown)
  70.  
  71.  
  72.     CALL Complete(10)
  73.     CALL CheckOffset()
  74.     CALL Complete(20)
  75.     CALL BorderScale()
  76.     CALL Complete(40)
  77.  
  78. IF density THEN
  79.     CALL CheckDensity()
  80.  
  81. IF colors THEN
  82.     CALL CheckColors()
  83.  
  84.     CALL Complete(100)
  85.  
  86.  
  87. ReDraw
  88. BoxPrefs 'LineWt' bwidth 'LineColor' bcolor 'Fill' bfill
  89. LinePrefs 'LineWt' lwidth 'LineColor' lcolor
  90.  
  91. ADDRESS VALUE oleport
  92. SETJOB jobID 'end'
  93.  
  94. EXIT 0
  95.  
  96.  
  97. CheckOffset:
  98.  
  99.     x0 = pwidth % 2 + 360; x1 = x0 + 100; y0 = pup + 360
  100.  
  101.     DrawTextBlock page x0 y0 GetLocale(1)
  102.     y0 = y0 + pfontsize + 20
  103.     in = pwidth * micro2inch
  104.     mm = pwidth * micro2mm
  105.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  106.     y0 = y0 + pfontsize + 40
  107.  
  108.     DrawTextBlock page x0 y0 GetLocale(2)
  109.     y0 = y0 + pfontsize + 20
  110.     in = pheight * micro2inch
  111.     mm = pheight * micro2mm
  112.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  113.     y0 = y0 + pfontsize + 40
  114.  
  115.     DrawTextBlock page x0 y0 GetLocale(3)
  116.     y0 = y0 + pfontsize + 20
  117.     in = (pwidth - sleft - sright) * micro2inch
  118.     mm = (pwidth - sleft - sright) * micro2mm
  119.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  120.     y0 = y0 + pfontsize + 40
  121.  
  122.     DrawTextBlock page x0 y0 GetLocale(4)
  123.     y0 = y0 + pfontsize + 20
  124.     in = (pheight - sup - sdown) * micro2inch
  125.     mm = (pheight - sup - sdown) * micro2mm
  126.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  127.     y0 = y0 + pfontsize + 40
  128.  
  129.     DrawTextBlock page x0 y0 GetLocale(7)
  130.     y0 = y0 + pfontsize + 20
  131.     in = sleft * micro2inch
  132.     mm = sleft * micro2mm
  133.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  134.     y0 = y0 + pfontsize + 40
  135.  
  136.     DrawTextBlock page x0 y0 GetLocale(8)
  137.     y0 = y0 + pfontsize + 20
  138.     in = sup * micro2inch
  139.     mm = sup * micro2mm
  140.     DrawTextBlock page x1 y0 in GetLocale(5) '  ' mm GetLocale(6)
  141.     y0 = y0 + pfontsize + 40
  142.  
  143. RETURN
  144.  
  145.  
  146. BorderScale:
  147.  
  148.     CALL DrawScale(1,sleft,1,sup)
  149.     CALL DrawScale(pwidth - sright,pwidth,pheight - sdown,pheight)
  150.  
  151.     DrawLine page 1 1 sleft sup
  152.     DrawLine page (pwidth - sright) sup pwidth 1
  153.     DrawLine page (pwidth - sright) (pheight - sdown) pwidth pheight
  154.     DrawLine page 1 pheight sleft (pheight - sdown)
  155.  
  156. RETURN
  157.  
  158.  
  159. DrawScale:
  160.  
  161.     y0 = pheight % 2 - 70; y1 = y0 + 140
  162.     DO i = ARG(1) TO ARG(2) BY 72
  163.         DrawLine page i y0 i y1
  164.     END
  165.  
  166.     y0 = pheight % 2 - 50; y1 = y0 + 100
  167.     DO i = 36 + ARG(1) TO ARG(2) BY 72
  168.         DrawLine page i y0 i y1
  169.     END
  170.  
  171.     x0 = pwidth % 2 - 70; x1 = x0 + 140
  172.     DO i = ARG(3) TO ARG(4) BY 72
  173.         DrawLine page x0 i x1 i
  174.     END
  175.  
  176.     x0 = pwidth % 2 - 50; x1 = x0 + 100
  177.     DO i = 36 + ARG(3) TO ARG(4) BY 72
  178.         DrawLine page x0 i x1 i
  179.     END
  180.  
  181. RETURN
  182.  
  183.  
  184. CheckColors:
  185.  
  186.     x0 = pwidth % 2 + 360
  187.     y0 = 3 * pheight % 4 - pdown - 360
  188.     InsertImage pcolorfile 'POSITION' page x0 y0 (pwidth % 4) (pheight % 4)
  189.  
  190. RETURN
  191.  
  192.  
  193. CheckDensity:
  194.  
  195.     y1 = pup + 360; y2 = y1 + pheight % 20
  196.     DO i = 9 TO 0 BY - 1
  197.  
  198.         x0 = pleft + 360
  199.         DO FOR 72
  200.             DrawLine page x0 y1 x0 y2
  201.             x0 = x0 + i
  202.         END
  203.         DrawTextBlock page (x0 + 50) y1 (720 % (i + 1)) 'lpi'
  204.  
  205.         IF i = 5 THEN y2 = pheight % 2 + 360
  206.         y1 = y2 + 100; y2 = y1 + pheight % 20
  207.  
  208.         CALL Complete(90 - 4 * (i + 1))
  209.     END
  210.  
  211. RETURN
  212.  
  213.  
  214. GetLocale: PROCEDURE EXPOSE locale
  215. ARG strID
  216.  
  217.     strID = 'þ'strID'þ'; PARSE VALUE GETCLIP(locale) WITH (strID)text'Þ'
  218.  
  219. RETURN text
  220.  
  221.  
  222. Complete:
  223.  
  224.     ADDRESS VALUE oleport
  225.     COMPLETE jobID modID ARG(1)
  226.     ADDRESS
  227.  
  228. RETURN
  229.