home *** CD-ROM | disk | FTP | other *** search
/ PC Direkt 1998 #11 / PCDIREKT_1198.bin / SHOWDATA / ECKESHOP.DXR / 00152_print3.ls < prev    next >
Encoding:
Text File  |  1998-03-20  |  5.4 KB  |  170 lines

  1. on totalfield R, txtcast, wt
  2.   global printer
  3.   printer(msetpensize, wt, wt)
  4.   printer(mstrokedroundrect, the left of R, the top of R, the right of R, the bottom of R, (the bottom of R - the top of R) / 2)
  5.   printer(msettextfont, the textFont of char 1 of member txtcast)
  6.   printer(msettextsize, the textSize of char 1 of member txtcast)
  7.   printer(msettextstyle, the textStyle of char 1 of member txtcast)
  8.   printer(msettextjust, "right")
  9.   printer(mdrawtext, the text of field txtcast, the left of R - 6, the bottom of R - 5)
  10.   printer(msettextjust, "left")
  11. end
  12.  
  13. on myTotalField R, txtcast, wt
  14.   global printer
  15.   printer(msetpensize, wt, wt)
  16.   printer(mstrokedroundrect, the left of R, the top of R, the right of R, the bottom of R, (the bottom of R - the top of R) / 2)
  17.   printer(msettextfont, the textFont of char 1 of member txtcast)
  18.   printer(msettextsize, the textSize of char 1 of member txtcast)
  19.   printer(msettextstyle, the textStyle of char 1 of member txtcast)
  20.   printer(msettextjust, "left")
  21.   printer(mdrawtext, the text of field txtcast, the left of R + 25, the bottom of R - 5)
  22.   printer(msettextjust, "right")
  23. end
  24.  
  25. on appendtitletext txt
  26.   global printer, gpropfont
  27.   printer(msettextfont, gpropfont)
  28.   printer(msettextstyle, "normal,bold")
  29.   printer(msettextsize, 14)
  30.   printer(mappendtext, txt & RETURN)
  31.   printer(msettextstyle, "normal")
  32.   printer(msettextsize, 10)
  33.   printer(mappendtext, the text of cast "macversion" & RETURN)
  34.   printer(mappendtext, the text of cast "winversion" & RETURN)
  35. end
  36.  
  37. on appendsectiontext txt
  38.   global printer, gpropfont
  39.   printer(msettextfont, gpropfont)
  40.   printer(msettextstyle, "normal,bold")
  41.   printer(msettextsize, 12)
  42.   printer(mappendtext, RETURN & line 1 of txt & RETURN, 1)
  43.   printer(msettextstyle, "normal")
  44.   printer(msettextsize, 10)
  45.   printer(mappendtext, line 2 to the number of lines in txt of txt, 1)
  46. end
  47.  
  48. on appendmethodlisttext txt
  49.   global printer, gmonofont
  50.   printer(msettextfont, gmonofont)
  51.   printer(msettextstyle, "normal")
  52.   printer(msettextsize, 9)
  53.   printer(mappendtext, txt, 1)
  54. end
  55.  
  56. on appendmethodtext txt
  57.   global printer, gpropfont
  58.   printer(msettextfont, gpropfont)
  59.   printer(msettextstyle, "normal,bold")
  60.   printer(msettextsize, 10)
  61.   printer(mappendtext, word 1 of txt & " ", 1)
  62.   printer(msettextstyle, "normal")
  63.   printer(mappendtext, word 2 to the number of words in txt of txt & RETURN & RETURN, 1)
  64. end
  65.  
  66. on appendnotetext txt
  67.   global printer, gpropfont
  68.   printer(msettextfont, gpropfont)
  69.   printer(msettextstyle, "normal,italic")
  70.   printer(msettextsize, 10)
  71.   printer(mappendtext, txt, 1)
  72. end
  73.  
  74. on appendtext txt
  75.   global printer, gpropfont
  76.   printer(msetgray, 100)
  77.   printer(msettextfont, gpropfont)
  78.   printer(msettextstyle, "normal")
  79.   printer(msettextsize, 10)
  80.   printer(mappendtext, txt, 1)
  81. end
  82.  
  83. on printstyledtext castlist
  84.   if not listp(castlist) then
  85.     exit
  86.   end if
  87.   if the machineType = 256 then
  88.     set xobjfile to "pmatic.dll"
  89.   else
  90.     set xobjfile to "pmatic.xobj"
  91.   end if
  92.   openXLib(xobjfile)
  93.   set printer to PrintOMatic(mnew)
  94.   if not objectp(printer) then
  95.     alert("There is no currently selected printer. Printing features are disabled.")
  96.   else
  97.     printer(msetmargins, 72, 72, 72, 72)
  98.     set w to printer(mgetpagewidth)
  99.     set h to printer(mgetpageheight)
  100.     printer(mnewpage)
  101.     printer(mtextbox, 0, 0, w, h, 0)
  102.     repeat with cnt = 1 to count(castlist)
  103.       appendstyledtext(printer, getAt(castlist, cnt), 1)
  104.     end repeat
  105.     if printer(mdojobsetup) = 1 then
  106.       updateStage()
  107.       printer(mprint)
  108.     end if
  109.     printer(mdispose)
  110.   end if
  111.   closeXLib(xobjfile)
  112. end
  113.  
  114. on appendstyledtext obj, thecast, autoappend
  115.   if not objectp(obj) then
  116.     exit
  117.   end if
  118.   if not integerp(thecast) and not stringp(thecast) then
  119.     exit
  120.   end if
  121.   if the type of member thecast <> #field then
  122.     exit
  123.   end if
  124.   if not (the number of chars in field thecast) then
  125.     exit
  126.   end if
  127.   if not integerp(autoappend) then
  128.     set autoappend to 0
  129.   end if
  130.   set stylelist to buildstylelist(thecast)
  131.   repeat with cnt = 1 to count(stylelist)
  132.     set stylerun to getAt(stylelist, cnt)
  133.     obj(msettextfont, getaProp(stylerun, #font))
  134.     obj(msettextsize, getaProp(stylerun, #size))
  135.     obj(msettextstyle, getaProp(stylerun, #style))
  136.     set charsadded to obj(mappendtext, char getaProp(stylerun, #start) to getaProp(stylerun, #end) of field thecast, autoappend)
  137.     if charsadded = 0 then
  138.       exit
  139.     end if
  140.   end repeat
  141. end
  142.  
  143. on buildstylelist thecast
  144.   if the castType of cast thecast <> #text then
  145.     return []
  146.   end if
  147.   if not (the number of chars in field thecast) then
  148.     return []
  149.   end if
  150.   set stylelist to []
  151.   set curfont to EMPTY
  152.   set cursize to 0
  153.   set curstyle to EMPTY
  154.   repeat with cnt = 1 to the number of chars in field thecast
  155.     if (the textFont of char cnt of member thecast <> curfont) or (the textSize of char cnt of member thecast <> cursize) or (the textStyle of char cnt of member thecast <> curstyle) then
  156.       if count(stylelist) then
  157.         setaProp(getAt(stylelist, count(stylelist)), #end, cnt - 1)
  158.       end if
  159.       set curfont to the textFont of char cnt of member thecast
  160.       set cursize to the textSize of char cnt of member thecast
  161.       set curstyle to the textStyle of char cnt of member thecast
  162.       add(stylelist, [#font: curfont, #size: cursize, #style: curstyle, #start: cnt, #end: cnt])
  163.     end if
  164.   end repeat
  165.   if count(stylelist) then
  166.     setaProp(getAt(stylelist, count(stylelist)), #end, the number of chars in field thecast)
  167.   end if
  168.   return stylelist
  169. end
  170.