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

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