home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / WINDOWS / TOOLS / FCG / TEST.PRG < prev    next >
Text File  |  1993-12-01  |  30KB  |  750 lines

  1. * This is the template main program
  2. * Upon code generation, it is placed in the file with the .MPG extension.
  3. * From there it is included in the .PRG file along with other generated
  4. * procedures.
  5. * You should modify this main program to add necessary statements for
  6. * opening databases, initializing and increment variables, etc. Make all
  7. * changes to the .MPG File and NOT the .PRG file. Also, after you have
  8. * modified the .MPG file, un-check the "Generate Template Main Program"
  9. * from the File->PageSetup dialog box. This will keep the .MPG file from
  10. * being overwritten by FromCode/Gen
  11.  
  12. SET TALK OFF
  13. * Comment out the next line for debugging.
  14. SET CONSOLE OFF
  15. SET PROCEDURE TO TEST
  16. DO FCGINIT
  17. SET PRINT ON
  18. DO FCGSTART WITH 1, 0, 2, 4, 300
  19.  
  20. FCGPAGE = 1
  21. DO WHILE FCGPAGE <= 1
  22.     DO FCGFIXOBJ
  23.     DO FCGVAROBJ
  24. *   Do all variable re-assignments, file pointer movements, etc, here.
  25.     ?? chr(12)
  26.     FCGPAGE = FCGPAGE + 1
  27. ENDDO
  28. DO FCGEND
  29. SET PRINT OFF
  30. SET CONSOLE ON
  31. RETURN
  32.  
  33. * Following are all the program procedures. This is the fixed part of the
  34. * program so do not modify it. Changes will be lost when code is re-generated.
  35.  
  36. PROCEDURE FCGINIT
  37. PUBLIC FCGEXTVAR, FCGGTOVAR, FCGMOVVAR
  38. PUBLIC FCGFNT1S
  39. FCGFNT1S = "(0N(s3t0b0s10.00v12.00h0P*p0X*p32Y"
  40. RETURN
  41.  
  42. PROCEDURE FCGFIXOBJ
  43. DO FCGBOX WITH 85, 121, 155, 171, 1, 3, 4, 0, 0
  44. DO FCGBOX WITH 253, 122, 323, 172, 0, 2, 99, 0, 0
  45. DO FCGBOX WITH 100, 255, 170, 305, 5, 2, 2, 0, 0
  46. DO FCGBOX WITH 421, 86, 491, 136, 1, 2, 10, 0, 1
  47. DO FCGBOX WITH 627, 85, 697, 135, 2, 2, 10, 1, 0
  48. DO FCGBOX WITH 290, 245, 401, 324, 10, 2, 2, 1, 0
  49. DO FCGBOX WITH 518, 227, 738, 365, 20, 4, 0, 1, 0
  50. DO FCGBOX WITH 39, 447, 153, 518, 1, 1, 0, 0, 0
  51. DO FCGBOX WITH 165, 447, 279, 518, 1, 3, 1, 1, 0
  52. DO FCGBOX WITH 290, 448, 404, 519, 1, 3, 2, 0, 0
  53. DO FCGBOX WITH 414, 448, 528, 519, 1, 3, 3, 1, 0
  54. DO FCGBOX WITH 540, 448, 654, 519, 1, 3, 4, 0, 0
  55. DO FCGBOX WITH 664, 449, 778, 520, 1, 3, 5, 1, 0
  56. DO FCGBOX WITH 44, 542, 158, 613, 1, 3, 6, 0, 0
  57. DO FCGBOX WITH 169, 542, 283, 613, 1, 2, 2, 1, 0
  58. DO FCGBOX WITH 295, 543, 409, 614, 1, 2, 10, 0, 0
  59. DO FCGBOX WITH 419, 543, 533, 614, 1, 2, 20, 1, 0
  60. DO FCGBOX WITH 545, 543, 659, 614, 1, 2, 35, 0, 0
  61. DO FCGBOX WITH 669, 544, 783, 615, 1, 2, 55, 1, 0
  62. DO FCGBOX WITH 42, 627, 156, 698, 1, 2, 80, 0, 0
  63. DO FCGBOX WITH 50, 739, 161, 814, 1, 1, 0, 0, 0
  64. DO FCGBOX WITH 121, 775, 236, 854, 1, 3, 1, 0, 0
  65. DO FCGBOX WITH 211, 739, 321, 814, 1, 3, 2, 0, 0
  66. DO FCGBOX WITH 304, 779, 400, 861, 1, 3, 3, 0, 0
  67. DO FCGBOX WITH 488, 649, 648, 783, 1, 4, 0, 0, 0
  68. DO FCGBOX WITH 620, 635, 784, 773, 1, 4, 0, 0, 0
  69. DO FCGBOX WITH 447, 805, 607, 939, 1, 4, 0, 0, 0
  70. DO FCGBOX WITH 444, 802, 610, 942, 1, 4, 0, 0, 0
  71. DO FCGBOX WITH 636, 801, 796, 935, 1, 4, 0, 0, 0
  72. DO FCGBOX WITH 632, 797, 800, 939, 1, 4, 0, 0, 0
  73. DO FCGBOX WITH 76, 833, 149, 906, 1, 1, 0, 0, 1
  74. DO FCGBOX WITH 261, 830, 340, 921, 1, 4, 0, 0, 1
  75. DO FCGBOX WITH 168, 627, 282, 698, 1, 0, 0, 0, 0
  76. DO FCGBOX WITH 311, 633, 461, 723, 1, 4, 0, 0, 0
  77. DO FCGLINE WITH 40, 120, 200, 120, 1
  78. DO FCGLINE WITH 156, 90, 156, 221, 1
  79. DO FCGLINE WITH 47, 172, 192, 172, 1
  80. DO FCGLINE WITH 84, 91, 84, 231, 1
  81. DO FCGLINE WITH 208, 121, 356, 121, 1
  82. DO FCGLINE WITH 324, 82, 324, 222, 1
  83. DO FCGLINE WITH 213, 173, 356, 173, 1
  84. DO FCGLINE WITH 252, 91, 252, 232, 1
  85. DO FCGLINE WITH 55, 251, 215, 251, 1
  86. DO FCGLINE WITH 174, 214, 174, 354, 1
  87. DO FCGLINE WITH 60, 309, 240, 309, 1
  88. DO FCGLINE WITH 96, 204, 96, 364, 1
  89. DO FCGLINE WITH 376, 85, 536, 85, 1
  90. DO FCGLINE WITH 492, 46, 492, 173, 1
  91. DO FCGLINE WITH 381, 137, 561, 137, 1
  92. DO FCGLINE WITH 420, 36, 420, 173, 1
  93. DO FCGLINE WITH 582, 84, 742, 84, 1
  94. DO FCGLINE WITH 698, 45, 698, 185, 1
  95. DO FCGLINE WITH 587, 136, 767, 136, 1
  96. DO FCGLINE WITH 626, 35, 626, 195, 1
  97. DO FCGLINE WITH 211, 238, 440, 238, 1
  98. DO FCGLINE WITH 407, 201, 407, 378, 1
  99. DO FCGLINE WITH 230, 330, 460, 330, 1
  100. DO FCGLINE WITH 283, 194, 283, 366, 1
  101. DO FCGLINE WITH 506, 179, 506, 425, 2
  102. DO FCGLINE WITH 451, 215, 809, 215, 2
  103. DO FCGLINE WITH 750, 179, 750, 416, 2
  104. DO FCGLINE WITH 454, 377, 802, 377, 2
  105. DO FCGLINE WITH 26, 1073, 818, 1073, 1
  106. DO FCGLINE WITH 822, 32, 822, 1077, 1
  107. DO FCGLINE WITH 27, 52, 27, 1068, 1
  108. DO FCGCHKBOX WITH 444, 635,  .T.
  109. DO FCGCHKBOX WITH 313, 635,  .T.
  110. DO FCGCHKBOX WITH 313, 675,  .T.
  111. DO FCGCHKBOX WITH 373, 635,  .T.
  112. DO FCGCHKBOX WITH 444, 706,  .T.
  113. DO FCGCHKBOX WITH 313, 706,  .T.
  114. DO FCGBOX WITH 32, 957, 407, 985, 1, 4, 0, 0, 0
  115. DO FCGLTXT WITH FCGFNT1S, 32, 968, "This text sould be left justified in its box.", ;
  116.     0, 0
  117. DO FCGLTXT WITH FCGFNT1S, 32, 982, "The box border should be touching the text.", ;
  118.     0, 0
  119. DO FCGBOX WITH 522, 959, 788, 984, 1, 4, 0, 0, 0
  120. DO FCGLTXT WITH FCGFNT1S, 568, 975, "Center justified text", ;
  121.     0, 0
  122. DO FCGBOX WITH 44, 1001, 442, 1029, 1, 4, 0, 0, 0
  123. DO FCGLRSTXT WITH FCGFNT1S, 44, 1012, "This text sould be L/R justified in its box.", ;
  124.     0, 0, 32, 8, 32
  125. DO FCGLRSTXT WITH FCGFNT1S, 44, 1026, "The box border should be touching the text.", ;
  126.     0, 0, 41, 7, 32
  127. DO FCGBOX WITH 522, 997, 791, 1024, 1, 4, 0, 0, 0
  128. DO FCGLTXT WITH FCGFNT1S, 625, 1014, "Right justified text", ;
  129.     0, 0
  130. DO FCGBOX WITH 48, 30, 398, 72, 1, 4, 0, 0, 0
  131. DO FCGLTXT WITH FCGFNT1S, 48, 41, "This is test design. Use it to test your", ;
  132.     0, 0
  133. DO FCGLTXT WITH FCGFNT1S, 48, 55, "instalation & printer. It should work with", ;
  134.     0, 0
  135. DO FCGLTXT WITH FCGFNT1S, 48, 69, "most  HP laser printers, even older ones.", ;
  136.     0, 0
  137. RETURN
  138.  
  139. PROCEDURE FCGVAROBJ
  140. RETURN
  141.  
  142.  
  143. * The following procedures have been appended from file PCLDRV.PRG.
  144.  
  145. *****************************************************************************
  146. *   This file contains all the printer driver routines. These routines
  147. *   are called by the functions that FormCode/Gen generates for your design
  148. *   namely FCGFIXOBJ, FIXVAROBJ, etc. There are two ways these routines can
  149. *   be made accesible to these procedures:
  150. *       1) By appending them to the file that contains the generated code.
  151. *          FormCode/Gen does this for you if you select the Append Procedures
  152. *          From PCLDRV option from the Page Setup dialog box.
  153. *       2) By making these routines accesible to the generated procedures by
  154. *          issuing a SET PROCEDURE TO. This is what FormCode/Gen does if you
  155. *          do not check the Append Procedures From PCLDRV check box.
  156. *
  157. *   NOTE: The routines in this library can be called directly by code that you
  158. *   write yourself also. To do this, make sure you call FCGSTART before any
  159. *   other routines and call FCGEND after printing is done. You will also
  160. *   need to declare the following global variables (use the PUBLIC statement):
  161. *       FCGRSTVAR, FCGGTOVAR, FCGLINVAR, FCGRCTVAR, FCGMOVVAR, FCGEXTVAR
  162. *  The best way to hand write code is to use generated code as a starting point.
  163. *****************************************************************************
  164.  
  165. *****************************************************************************
  166. *   Function: Initializes printer and sets up job paramets. Must be called
  167. *          before the start of a job
  168. *   Parameters: fcgcopies - (numeric) number of copies (1-99)
  169. *           fcgorient - (numeric) sheet orientation. 0 means portrait,
  170. *                one means landscape
  171. *        fcgsize - (numeric) paper size. Must be one of the following:
  172. *            1 for Executive Size (7 1/4 x 10 1/2 in)
  173. *            2 for Letter Size (8 1/2 x 11 in)
  174. *            3 for Legal Size (8 1/2 x 14 in)
  175. *               26 for A4 Size (210mm x 297mm)
  176. *               80 for Monarch Size Envelope (3 7/8 x 7 1/2 in)
  177. *               81 for COM 10 Size Envelope (4 1/8 x 9 1/2 in)
  178. *               90 for DL Size Envelope (110mm x 220mm)
  179. *               91 for C5 Size Envelope (162mm 229mm)
  180. *        fcgbin - (numeric) paper bin to use. Must be one of the following:
  181. *            1 for Upper Tray
  182. *            2 for Manual Feed
  183. *            3 for Manual Envelope Feed
  184. *            4 for Lower Tray
  185. *            5 for Paper Deck
  186. *            6 for Envelope Feeder
  187. *        fcgres - (numeric) Raster Graphics Resolution (Dots Per Inch)
  188. *            Must be one of the following values:
  189. *            75, 100, 150, 300
  190. *****************************************************************************
  191. procedure fcgstart
  192. parameters fcgcopies,fcgorient,fcgsize,fcgbin,fcgres
  193.  
  194. ?? chr(27)+"E"+chr(27)+"&l"+ltrim(str(fcgcopies))+"x"+ ;
  195.    ltrim(str(fcgorient))+"o"+ltrim(str(fcgsize))+"a4d1e42f"+ ;
  196.    ltrim(str(fcgbin))+"h"+ltrim(str(fcgres))+"R"
  197. ?? chr(27)+"*v1O"
  198. return
  199.  
  200.  
  201. *****************************************************************************
  202. *   Function: End the job by resetting the printer.
  203. *****************************************************************************
  204. procedure fcgend
  205. ?? chr(27)+"E"
  206. return
  207.  
  208.  
  209. *****************************************************************************
  210. *   Function: Sets the public variable FCGGTOVAR to PCL cursor position
  211. *             command to move cursor to specified coordinate position.
  212. *          Coordinates are specified in hundredths of inches, and point 0,0
  213. *          corresponds to the upper left corner of the physical page.
  214. *   Parameters: fcgx,fcgy - (numeric) cursor position
  215. *****************************************************************************
  216. procedure fcggoto
  217. parameters fcgx, fcgy
  218.  
  219. fcggtovar =  chr(27)+"*p"+ltrim(str(3*fcgx-75))+"x"+ltrim(str(3*fcgy-75))+"Y"
  220. return
  221.  
  222.  
  223. *****************************************************************************
  224. *   Function: Sets the public variable FCGMOVVAR to PCL cusror position command
  225. *             to move the PCL cursor horizontaly by specified relative ammount.
  226. *          Coordinates are specified in hundredths of inches, and point 0,0
  227. *          corresponds to the upper left corner of the physical page.
  228. *   Parameters: fcgx, - (numeric) ammount to move cursor by
  229. *****************************************************************************
  230. procedure fcgmovby
  231. parameters fcgx
  232.  
  233. fcgmovvar =  chr(27)+"*p+"+ltrim(str(3*fcgx))+"X"
  234. return
  235.  
  236.  
  237. *****************************************************************************
  238. *   Function: Calculates extent of text based on font metric information.
  239. *             Stores the calculated value in public variable FCGEXTVAR
  240. *   Parameters: fcgfntl,fcgfntu - (character) font metric arrays (upper/lower)
  241. *               fcgfntf - (numeric) first character in character set
  242. *               fcgstr - (character) the character string
  243. *   NOTE: The font metric information is generated by FormCode/Gen for fonts
  244. *   that need this information.
  245. *****************************************************************************
  246. procedure fcgtxtext
  247. parameters fcgfntl, fcgfntu, fcgfntf, fcgstr
  248. private fcglen, fcgidx, fcgchidx
  249.  
  250. fcgextvar = 0
  251. fcgidx = 1
  252. fcglen = len(fcgstr)
  253. do while fcgidx <= fcglen
  254.     fcgchidx = asc(substr(fcgstr,fcgidx,1)) - fcgfntf + 1
  255.     fcgextvar = fcgextvar + asc(substr(fcgfntl,fcgchidx,1)) + ;
  256.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  257.     fcgidx = fcgidx + 1
  258. *    @0,0 say fcgfntf+chr(fcgchidx+fcgfntf-1)+fcgextvar
  259. *    suspend
  260. enddo
  261. fcgextvar = int(fcgextvar / 10)
  262. return
  263.  
  264.  
  265. *****************************************************************************
  266. *   Function: Draws a verticle or horizontal line between specified points.
  267. *          Coordinates are specified in hundredths of inches, and point 0,0
  268. *          corresponds to the upper left corner of the physical page. Line
  269. *          coordinates specify center line for thick lines.
  270. *   Parameters: fcgx1,fcgy1 - (numeric) line starting position
  271. *        fcgx2,fcgy2 - (numeric) line ending position
  272. *        fcgthick - (numeric) line width in hundredths of inches
  273. *   NOTE: The ending position must specify coordinates that are larger than
  274. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  275. *****************************************************************************
  276. procedure fcgline
  277. parameters fcgx1, fcgy1, fcgx2, fcgy2, fcgthick
  278. private fcgposx,fcgposy,fcgsizex,fcgsizey,fcgtmp
  279.  
  280. if fcgx1 = fcgx2
  281.     fcgposx = fcgx1 - int(fcgthick/2)
  282.     fcgposy = fcgy1
  283.     fcgsizex = fcgthick
  284.     fcgsizey = fcgy2 - fcgy1 + 1
  285. else
  286.     fcgposy = fcgy1 - int(fcgthick/2)
  287.     fcgposx = fcgx1
  288.     fcgsizey = fcgthick
  289.     fcgsizex = fcgx2 - fcgx1 + 1
  290. endif
  291.  
  292. do fcggoto with fcgposx,fcgposy
  293. ?? fcggtovar+chr(27)+"*c"+ltrim(str(3*fcgsizex))+"a" + ;
  294.    ltrim(str(3*fcgsizey))+"b0P"
  295. return
  296.  
  297.  
  298. *****************************************************************************
  299. *   Function: Draws a rectangle with or without a border and with or without a
  300. *             fill. Coordinates are specified in hundredths of inches, and
  301. *             point 0,0 corresponds to the upper left corner of the physical page.
  302. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  303. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  304. *        fcgthick - (numeric) border width in hundredths of inches
  305. *        fcgfillt - (numeric) fill type. Must be one of the following:
  306. *            0 for black fill
  307. *            1 for white fill
  308. *            2 for HP defined gray shading pattern
  309. *            3 for HP defined cross-hatched pattern
  310. *                       4 for no fill
  311. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  312. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  313. *            for fcgfillt = 2, a gray shading percentage value from
  314. *            the following (2,10,15,30,45,70,90,100)
  315. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  316. *                       to the six predefined patterns.
  317. *   NOTE: The ending position must specify coordinates that are larger than
  318. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  319. *****************************************************************************
  320. procedure fcgrect
  321. parameters fcgleft,fcgtop,fcgright,fcgbot,fcgthick,fcgfillt,fcgfillp
  322.  
  323. if fcgfillt <> 4
  324.     do fcggoto with fcgleft, fcgtop
  325. ?? fcggtovar+chr(27)+"*c"+ltrim(str(fcgfillp))+"g"+;
  326.    ltrim(str((fcgright-fcgleft+1)*3))+"a"+ltrim(str((fcgbot-fcgtop+1)*3))+"b"+;
  327.    ltrim(str(fcgfillt))+"P"
  328. endif
  329.  
  330. if fcgthick > 0
  331.     do fcgline with fcgleft,fcgtop,fcgright,fcgtop,fcgthick
  332.     do fcgline with fcgleft,fcgbot,fcgright,fcgbot,fcgthick
  333.     do fcgline with fcgleft,fcgtop-int(fcgthick/2),fcgleft, ;
  334.             fcgbot+int((fcgthick-1)/2),fcgthick
  335.     do fcgline with fcgright,fcgtop-int(fcgthick/2),fcgright, ;
  336.             fcgbot+int((fcgthick-1)/2),fcgthick
  337. endif
  338. return
  339.  
  340.  
  341. *****************************************************************************
  342. *   Function: Draws a box with specified border width, type, sahdow, etc.
  343. *          Coordinates are specified in hundredths of inches, and point 0,0
  344. *          corresponds to the upper left corner of the physical page.
  345. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  346. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  347. *        fcgthick - (numeric) border width in hundredths of inches
  348. *        fcgfillt - (numeric) fill type. Must be one of the following:
  349. *            0 for black fill
  350. *            1 for white fill
  351. *            2 for HP defined gray shading pattern
  352. *            3 for HP defined cross-hatched pattern
  353. *                       4 for no fill
  354. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  355. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  356. *            for fcgfillt = 2, a gray shading percentage value from
  357. *            the following (2,10,15,30,45,70,90,100)
  358. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  359. *                       to the six predefined patterns.
  360. *        fcgborder - (numeric) if = 0, specifies a single border. If = 1
  361. *            specifies a double border.
  362. *        fcgshadow - (numeric) if = 0, specifies no shadow. If = 1
  363. *            specifies a shadow.
  364. *   NOTE: The ending position must specify coordinates that are larger than
  365. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  366. *****************************************************************************
  367. procedure fcgbox
  368. parameters fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgbfillt, ;
  369.     fcgbfillp, fcgbborder, fcgbshadow
  370. private fcgbmargin,fcgft
  371.  
  372. fcgft = fcgbfillt
  373. fcgbmargin = 2 * fcgbthick
  374. if fcgbborder = 1
  375.     do fcgrect with fcgbleft+fcgbmargin, fcgbtop+fcgbmargin, fcgbright-fcgbmargin, ;
  376.     fcgbbot-fcgbmargin, fcgbthick, fcgft, fcgbfillp
  377.     fcgft = 4
  378. endif
  379.  
  380. do fcgrect with fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgft, fcgbfillp
  381.  
  382. if fcgbshadow = 1
  383.     do fcgrect with fcgbleft+5-int(fcgbthick/2), fcgbbot+int(fcgbthick/2), ;
  384.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  385.     do fcgrect with fcgbright+int(fcgbthick/2), fcgbtop+5-int(fcgbthick/2), ;
  386.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  387. endif
  388. return
  389.  
  390.  
  391. *****************************************************************************
  392. *   Function: Prints left justified text at specified position
  393. *   Parameters:
  394. *    fcgfnts - (character) Font selection string
  395. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  396. *    fcgtext - (numeric) The text string to print
  397. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  398. *                           parametrs are interpreted the same as in FCGBOX
  399. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  400. *****************************************************************************
  401. procedure fcgltxt
  402. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp
  403.  
  404. if len(fcgtext) = 0
  405.     return
  406. endif
  407.  
  408. do fcggoto with fcgtlft, fcgttop
  409. ?? fcgfnts
  410. if (fcgfillt <> 0)
  411.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  412. endif
  413. ?? fcggtovar+fcgtext
  414. if (fcgfillt <> 0)
  415.    ?? chr(27)+"*v0T"
  416. endif
  417. return
  418.  
  419.  
  420. *****************************************************************************
  421. *   Function: Prints L/R justified single line text at specified position
  422. *   Parameters:
  423. *    fcgfnts - (character) Font selection string
  424. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  425. *    fcgtext - (numeric) The text string to print
  426. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  427. *                            parametrs are interpreted the same as in FCGBOX
  428. *    fcgbrkxtra - (numeric) The break extra ammount to spread in breaks
  429. *    fcgbrkcnt - (numeric) The number of break characters in string
  430. *    fcgbrkch - (numeric) The actual break character for symbol set
  431. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  432. *****************************************************************************
  433. procedure fcglrstxt
  434. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, ;
  435.     fcgbrkxtra, fcgbrkcnt, fcgbrk
  436. private fcgbrkamt, fcgbrkrm, fcgstpos, fcgtmpstr, fcgbrkch, fcgamt, fcgcurch
  437. private fcgstrlen
  438.  
  439. if len(fcgtext) = 0
  440.     return
  441. endif
  442.  
  443. fcgbrkch = chr(fcgbrk)
  444. if fcgbrkcnt <> 0
  445.     fcgbrkamt = int(fcgbrkxtra/fcgbrkcnt)
  446.     fcgbrkrm = int(fcgbrkxtra - (fcgbrkamt * fcgbrkcnt))
  447. endif
  448. fcgstrlen = len(fcgtext)
  449. fcgstpos = 1
  450. do fcggoto with fcgtlft, fcgttop
  451. fcgtmpstr = fcgfnts+fcggtovar
  452. do while fcgstpos <= fcgstrlen
  453.     fcgcurch = substr(fcgtext,fcgstpos,1)
  454.     if fcgcurch = fcgbrkch
  455.         fcgamt = fcgbrkamt
  456.     if fcgbrkrm > 0
  457.         fcgamt = fcgamt + 1
  458.         fcgbrkrm = fcgbrkrm - 1
  459.     endif
  460.         if fcgamt > 0
  461.         do fcgmovby with fcgamt
  462.         endif
  463.     endif
  464.     if fcgcurch = fcgbrkch .AND. fcgamt > 0
  465.         fcgtmpstr = fcgtmpstr + fcgcurch + fcgmovvar
  466.     else
  467.         fcgtmpstr = fcgtmpstr + fcgcurch
  468.     endif
  469.     fcgstpos = fcgstpos + 1
  470. enddo
  471. if (fcgfillt <> 0)
  472.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  473. endif
  474. ?? fcgtmpstr
  475. if (fcgfillt <> 0)
  476.    ?? chr(27)+"*v0T"
  477. endif
  478. return
  479.  
  480. *****************************************************************************
  481. *   Function: Prints multi line L/R justified dynamic text at specified position
  482. *   Parameters:
  483. *    fcgfnts - (character) Font selection string
  484. *    fcgtlft, fcgttop - (numeric) center position of string
  485. *    fcgtext - (numeric) The text string to print
  486. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  487. *                           parameters are interpreted the same as in FCGBOX
  488. *       fcgfntl, fcgfntu - (character) text metric arrays
  489. *       fcgfntf - (numeric) first character position in character set
  490. *       fcgfnth - (numeric) font height
  491. *       fcgfntbrk - (numeric) ascii value of the font break character
  492. *       fcgextent - (numeric) text extent in hundredths of inches
  493. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  494. *****************************************************************************
  495. procedure fcglrtxt
  496. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  497.     fcgfntu, fcgfntf, fcgfnth, fcgfntbrk, fcgextent
  498. private fcgcurpos, fcgendpos, fcgtmp, fcgword, fcgstrlen, fcgcurch, fcgbrkch
  499. private fcgcurext, fcgwrdext, fcgchidx, fcgbrkext, fcgspxtra, fcgbrkcnt, fcgdone, ;
  500.         fcglinend
  501.  
  502. if len(fcgtext) = 0
  503.     return
  504. endif
  505.  
  506. fcgcurpos = 1
  507. fcgcurext = 0
  508. fcgbrkcnt = 0
  509. fcgextent = fcgextent * 10
  510. fcgtmp = ""
  511. fcgstrlen = len(fcgtext)
  512. fcgbrkch = chr(fcgfntbrk)
  513. fcgdone = .F.
  514. fcgbrkext = asc(substr(fcgfntl,fcgfntbrk-fcgfntf+1,1)) + ;
  515.         (asc(substr(fcgfntu,fcgfntbrk-fcgfntf+1,1))-1) * 256
  516. ?? fcgfnts
  517. if (fcgfillt <> 0)
  518.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  519. endif
  520. do while .T.
  521. *    suspend
  522.     do while fcgcurpos <= fcgstrlen
  523.         fcgcurch = substr(fcgtext,fcgcurpos,1)
  524.         if fcgcurch <>  fcgbrkch
  525.             exit
  526.         endif
  527.         fcgcurpos = fcgcurpos + 1
  528.     enddo
  529.     fcgendpos = fcgcurpos
  530.     fcgwrdext = 0
  531.     do while fcgendpos <= fcgstrlen
  532.         fcgcurch = substr (fcgtext,fcgendpos,1)
  533.         if fcgcurch = fcgbrkch .OR. fcgcurch = chr(13) .OR. fcgcurch = chr(10)
  534.             exit
  535.         endif
  536.         fcgchidx = asc(fcgcurch) - fcgfntf + 1
  537.         fcgwrdext = fcgwrdext + asc(substr(fcgfntl,fcgchidx,1)) + ;
  538.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  539.         fcgendpos = fcgendpos + 1
  540.     enddo
  541.     if fcgcurext = 0
  542.         fcgspxtra = 0
  543.     else
  544.         fcgspxtra = fcgbrkext
  545.     endif
  546.     if (fcgcurext + fcgwrdext + fcgspxtra <= fcgextent) .OR. ;
  547.         (fcgcurext = 0 .AND. fcgwrdext >= fcgextent)
  548.         if fcgcurext <> 0
  549.             fcgtmp = fcgtmp + fcgbrkch
  550.             fcgbrkcnt = fcgbrkcnt + 1
  551.             fcgcurext = fcgcurext + fcgbrkext
  552.         endif
  553.         fcgtmp = fcgtmp + substr(fcgtext,fcgcurpos,fcgendpos-fcgcurpos)
  554.         if fcgcurch = chr(10) .OR. fcgcurch = chr(13)
  555.             fcglinend = .T.
  556.         else
  557.             fcglinend = .F.
  558.         endif
  559. *        @3, 5 say fcgtmp + "    CurCh["+fcgcurch+"]"
  560. *        suspend
  561.         fcgcurext = fcgcurext + fcgwrdext
  562.         fcgcurpos = fcgendpos + 1
  563.         if fcgcurch = chr(13) .AND. fcgcurpos <= fcgstrlen .AND. substr(fcgtext,fcgcurpos,1) = chr(10)
  564.             fcgcurpos = fcgcurpos + 1
  565.         endif
  566.     else
  567.         fcglinend = .F.
  568.         fcgdone = .T.
  569.     endif
  570.     if fcgcurext >= fcgextent .OR. fcglinend .OR. fcgcurpos > fcgstrlen .OR. fcgdone
  571. *        clear
  572. *        @4,5 say fcgtmp
  573. *        @6,5 say str(fcgextent,6)+str(fcgcurext,6)+str(fcgbrkcnt,6)
  574. *        @7,5 say "CurCh["+fcgcurch+"]  Pos: "+str(fcgcurpos,4)+"  Len: "+str(fcgstrlen,4)
  575. *        suspend
  576.         if fcgcurpos > fcgstrlen .OR. fcglinend
  577.         do fcgltxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0
  578.     else
  579.         do fcglrstxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0, ;
  580.             (fcgextent-fcgcurext)/10, fcgbrkcnt, fcgfntbrk
  581.         endif
  582.         fcgdone = .F.
  583.         fcgcurext = 0
  584.         fcgtmp = ""
  585.         fcgbrkcnt = 0
  586.         fcgttop = fcgttop + fcgfnth
  587.         if fcgcurpos > fcgstrlen
  588.             exit
  589.         endif
  590.     endif
  591. if (fcgfillt <> 0)
  592.    ?? chr(27)+"*v0T"
  593. endif
  594. enddo
  595.  
  596.  
  597. *****************************************************************************
  598. *   Function: Prints center justified text at specified position
  599. *   Parameters:
  600. *    fcgfnts - (character) Font selection string
  601. *    fcgtcnt, fcgttop - (numeric) center position of string
  602. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  603. *                           parameters are interpreted the same as in FCGBOX
  604. *    fcgtext - (numeric) The text string to print
  605. *       fcgfntl, fcgfntu - (character) text metric arrays
  606. *       fcgfntf - (numeric) first character position in character set
  607. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  608. *****************************************************************************
  609. procedure fcgctxt
  610. parameters fcgfnts, fcgtcnt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  611.     fcgfntu, fcgfntf
  612. private fcgtmp
  613.  
  614. if len(fcgtext) = 0
  615.     return
  616. endif
  617.  
  618. fcgtmp = trim(fcgtext)
  619. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  620. fcgtcnt = fcgtcnt - fcgextvar/2
  621. do fcggoto with fcgtcnt, fcgttop
  622. ?? fcgfnts
  623. if (fcgfillt <> 0)
  624.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  625. endif
  626. ?? fcggtovar+fcgtmp
  627. if (fcgfillt <> 0)
  628.    ?? chr(27)+"*v0T"
  629. endif
  630. return
  631.  
  632. *****************************************************************************
  633. *   Function: Prints right justified text at specified position
  634. *   Parameters:
  635. *    fcgfnts - (character) Font selection string
  636. *    fcgtrt, fcgttop - (numeric) center position of string
  637. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  638. *                           parameters are interpreted the same as in FCGBOX.
  639. *    fcgtext - (numeric) The text string to print
  640. *       fcgfntl, fcgfntu - (character) text metric arrays
  641. *       fcgfntf - (numeric) first character position in character set
  642. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  643. *****************************************************************************
  644. procedure fcgrtxt
  645. parameters fcgfnts, fcgtrt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  646.     fcgfntu, fcgfntf
  647. private fcgtmp
  648.  
  649. if len(fcgtext) = 0
  650.     return
  651. endif
  652.  
  653. fcgtmp = trim(fcgtext)
  654. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  655. fcgtrt = fcgtrt - fcgextvar
  656. do fcggoto with fcgtrt, fcgttop
  657. ?? fcgfnts
  658. if (fcgfillt <> 0)
  659.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  660. endif
  661. ?? fcggtovar+fcgtmp
  662. if (fcgfillt <> 0)
  663.    ?? chr(27)+"*v0T"
  664. endif
  665. return
  666.  
  667. *****************************************************************************
  668. *   Function: Defines printer macro with specified ID
  669. *   Parameters:
  670. *    fcgmacid - (character) macro id
  671. *****************************************************************************
  672. procedure fcgdefmac
  673. parameters fcgmacid
  674. ?? chr(27)+"&f"+fcgmacid+"y0X"
  675. return
  676.  
  677. *****************************************************************************
  678. *   Function: Ends definition for a printer macro
  679. *   Parameters: none
  680. *****************************************************************************
  681. procedure fcgendmac
  682. ?? chr(27)+"&f1X"
  683. return
  684.  
  685. *****************************************************************************
  686. *   Function: Executes printer macro with last ID
  687. *   Parameters: none
  688. *****************************************************************************
  689. procedure fcgdomac
  690. parameters fcgmacid
  691. ?? chr(27)+"&f2X"
  692. return
  693.  
  694. *****************************************************************************
  695. *   Function: Draws check box at specified location
  696. *   Parameters: fcgleft, fcgtop (numeric) top left corner of box
  697. *               fcgcheck (logical) check box checked or not ?
  698. *****************************************************************************
  699. procedure fcgchkbox
  700. parameters fcgleft, fcgtop, fcgcheck
  701. do fcgrect with fcgleft, fcgtop, fcgleft+15, fcgtop+15, 1, 4, 0
  702. if .NOT. fcgcheck
  703.     return
  704. endif
  705.  
  706. do fcggoto with fcgleft+1, fcgtop+1
  707. fcgbitmap = fcggtovar+chr(27)+"*t75R"+chr(27)+"*r11t11s1A"+chr(27)+"*b0M"
  708. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  709. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  710. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  711. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  712. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  713. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(4)
  714. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  715. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  716. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  717. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  718. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  719. ?? fcgbitmap+chr(27)+"*rB"
  720. return
  721.  
  722.  
  723. *****************************************************************************
  724. *   Function: Draws bitmap image at specified position
  725. *   Parameters: fcgleft, fcgtop (numeric) top left corner of image
  726. *               fcgname (character) name of bitmap file (must be in curr dir)
  727. *   WARNING: This function uses the DOS COPY command (with the /b switch for
  728. *   binary data) to copy the bitmap file to the printer. On systems other than
  729. *   DOS (e.g Novel, Unix, etc) this needs to be changed. Also the file is
  730. *   copied to standard printer PRN. If your printer is connected to a different
  731. *   port you need to change this also !!!
  732. *****************************************************************************
  733. procedure fcgimage
  734. parameters fcgleft, fcgtop, fcgname
  735.  
  736. * The following lines are dummy lines. They must be deleted by the user.
  737. * Their only porpose is to serve as a reminder for the new user
  738. *clear
  739. *@12, 10 say "PCLDRV.PRG has not been modified as described in the users manual."
  740. *@13, 10 say "Please read the section on Printing Bitmaps to acomplish this."
  741. *return
  742.  
  743. do fcggoto with fcgleft, fcgtop
  744. ?? fcggtovar
  745. * The next line should be changed so that it copies the file &fcgname to
  746. * your printer port. The copy command works for DOS but may need to be
  747. * changed for other systems such as Unix, Novel, etc.
  748. run copy /b &fcgname prn
  749. return
  750.