home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today (BR) Volume 2 #9 / CDRTV2N9.iso / progs / vearth / shared.dir / 00559.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  5.4 KB  |  192 lines

  1. on mouseUp
  2.   global myXobj
  3.   puppetSound(2, 0)
  4.   set the blend of sprite the clickOn to 60
  5.   updateStage()
  6.   if objectp(myXobj) then
  7.     myXobj(mdispose)
  8.   end if
  9.   if the machineType < 256 then
  10.     openXLib("misc_x Xobj")
  11.   else
  12.     openXLib("misc_x")
  13.   end if
  14.   set myXobj to MISC_X(mnew)
  15.   set text1 to "If you want to print the text or the picture click on PRINT"
  16.   set text2 to "If you want to save the heading and main text to a file then click on SAVE TEXT"
  17.   set CR to numToChar(13)
  18.   set text to text1 & CR & text2
  19.   set answer to myXobj(mAnswer, text, "Print", "Save Text", "Cancel")
  20.   myXobj(mdispose)
  21.   if the machineType < 256 then
  22.     closeXLib("misc_X Xobj")
  23.   else
  24.     closeXLib("misc_x")
  25.   end if
  26.   if answer = "Cancel" then
  27.     exit
  28.   end if
  29.   if answer = "Print" then
  30.     myPrint()
  31.   end if
  32.   if answer = "Save Text" then
  33.     myCopy()
  34.   end if
  35.   set the blend of sprite the clickOn to 100
  36.   updateStage()
  37. end
  38.  
  39. on myPrint
  40.   global myXobj, printer
  41.   if objectp(myXobj) then
  42.     myXobj(mdispose)
  43.   end if
  44.   if the machineType < 256 then
  45.     openXLib("misc_x Xobj")
  46.   else
  47.     openXLib("misc_x")
  48.   end if
  49.   set myXobj to MISC_X(mnew)
  50.   set text1 to "You can now print the full screen or only the text."
  51.   set text2 to "Click on the button of your choice."
  52.   set CR to numToChar(13)
  53.   set text to CR & text1 & CR & CR & text2
  54.   set answer to myXobj(mAnswer, text, "Print Screen", "Print Text", "Cancel")
  55.   myXobj(mdispose)
  56.   if the machineType < 256 then
  57.     closeXLib("misc_X Xobj")
  58.   else
  59.     closeXLib("misc_x")
  60.   end if
  61.   if answer = "Cancel" then
  62.     exit
  63.   end if
  64.   if the machineType = 256 then
  65.     openXLib("pmatic.dll")
  66.     set printer to pmatic(mnew)
  67.     if not objectp(printer) then
  68.       alert("There is no currently selected printer. Printing features are disabled.")
  69.     else
  70.       if answer = "Print Screen" then
  71.         printer(mRegister, "10031909-181")
  72.         printer(mReset)
  73.         printer(mNewPage)
  74.         printer(mTextBox, 0, 0, printer(mGetPageWidth), 30, 0)
  75.         printer(mStagePicture)
  76.         printer(mTextBox, 0, 400, printer(mGetPageWidth), printer(mGetPageHeight), 0)
  77.         printer(mSetTextSize, 10)
  78.         printer(mSetTextStyle, "normal")
  79.         if printer(mDoJobSetup) = 1 then
  80.           printer(mPrint)
  81.         end if
  82.       else
  83.         printTextPC()
  84.       end if
  85.     end if
  86.   else
  87.     openXLib("PrintShop XObj")
  88.     set printer to PrintShop(mnew)
  89.     if not objectp(printer) then
  90.       alert("There is no currently selected printer. Printing features are disabled.")
  91.       set the blend of sprite the clickOn to 100
  92.       updateStage()
  93.       exit
  94.     end if
  95.     if answer = "Print Screen" then
  96.       set ok to printer(mDoPageSetup)
  97.       if printer(mDoJobSetup) = 1 then
  98.         updateStage()
  99.         printer(mSetProgressMsg, "Printing Violent Earth in progress. Press 'Command + .' to cancel.")
  100.         printer(mPrint, the picture of cast the castNum of sprite 1)
  101.       end if
  102.       printer(mdispose)
  103.     else
  104.       printText()
  105.     end if
  106.   end if
  107. end
  108.  
  109. on printText
  110.   global printer
  111.   set page to the name of cast the castNum of sprite 1
  112.   if (page contains "t0") or (page contains "t1") or (page contains "t2") or (page contains "t3") then
  113.     set num to 8
  114.   else
  115.     set num to 6
  116.   end if
  117.   set pag to char 1 to num of page
  118.   put ".txt" after pag
  119.   set txt to the text of cast pag
  120.   printer(mSetTextFont, "palatino")
  121.   printer(mSetTextSize, 12)
  122.   printer(mSetTextStyle, "normal")
  123.   printer(mSetText, txt)
  124.   printer(mSetProgressMsg, "Printing Violent Earth in progress. Press 'Command + .' to cancel.")
  125.   if printer(mDoJobSetup) = 1 then
  126.     updateStage()
  127.     printer(mPrint)
  128.   end if
  129.   printer(mdispose)
  130. end
  131.  
  132. on printTextPC
  133.   global printer
  134.   printer(mRegister, "10031909-181")
  135.   printer(mReset)
  136.   printer(mNewPage)
  137.   printer(mTextBox, 0, 0, printer(mGetPageWidth), 30, 0)
  138.   set page to the name of cast the castNum of sprite 1
  139.   if (page contains "t0") or (page contains "t1") or (page contains "t2") or (page contains "t3") then
  140.     set num to 8
  141.   else
  142.     set num to 6
  143.   end if
  144.   set pag to char 1 to num of page
  145.   put ".txt" after pag
  146.   set txt to the text of cast pag
  147.   printer(mSetTextFont, "arial")
  148.   printer(mSetTextStyle, "normal")
  149.   printer(mSetTextSize, 12)
  150.   printer(mSetMargins, 60, 60, 60, 60)
  151.   set w to printer(mGetPageWidth)
  152.   set h to printer(mGetPageHeight)
  153.   set charsPrinted to 0
  154.   repeat while charsPrinted < the number of chars in txt
  155.     printer(mNewPage)
  156.     printer(mTextBox, 0, 0, w, h, 0)
  157.     set charsPrinted to charsPrinted + printer(mSetText, char charsPrinted + 1 to the number of chars in txt of txt)
  158.   end repeat
  159.   if printer(mDoJobSetup) = 1 then
  160.     updateStage()
  161.     printer(mPrint)
  162.   end if
  163.   printer(mdispose)
  164. end
  165.  
  166. on myCopy
  167.   if the machineType = 256 then
  168.     openXLib("fileio.dll")
  169.   end if
  170.   set writeObject to FileIO(mnew, "?write", "Wayland.txt")
  171.   if not objectp(writeObject) then
  172.     set theProblem to string(writeObject)
  173.     if theProblem = -43 then
  174.       exit
  175.     else
  176.       alert("Wayland Error. FileIO object was not made." & RETURN & RETURN & "Error: " & string(theProblem))
  177.     end if
  178.     exit
  179.   end if
  180.   set page to the name of cast the castNum of sprite 1
  181.   if (page contains "t0") or (page contains "t1") or (page contains "t2") or (page contains "t3") then
  182.     set num to 8
  183.   else
  184.     set num to 6
  185.   end if
  186.   set pag to char 1 to num of page
  187.   put ".txt" after pag
  188.   set myText to the text of cast pag
  189.   writeObject(mWriteString, string(myText))
  190.   writeObject(mdispose)
  191. end
  192.