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