home *** CD-ROM | disk | FTP | other *** search
- global gOpSys -- the local operating system
-
-
- --PRINTING PROCEDURES
- --from GREY MATTER DESIGN
- on PrintBitmap theCast
-
- -- a Lingo script for printing a castmember bitmap
- -- using the PrintOMatic Xtra
- -- the parameter "theCast" represents the castmember you want to print
-
- -- This script prints the castmember at up to 100% size,
- -- centered on the page. It will change the page
- -- orientation to landscape mode if it will result in a bigger printout.
-
- -- PARAMETERS:
- -- theCast is the number or name of a bitmapped castmember
-
- if the Type of member theCast <> #bitmap then
- -- alert "PrintBitmap can only print bitmapped castmembers."
- exit
- end if
-
- -- if the machineType = 256 then
- -- put "pmatic.dll" into XObjFile
- -- else
- -- put "BLENDER1:FILES:pmatic.xobj" into XObjFile
- -- end if
-
- set doc = new(xtra "PrintOMatic")
- if not objectP(doc) then exit
-
- -- openxlib XObjFile
-
- -- put PrintOMatic(mNew) into printer
-
- -- if not objectP(printer) then
- -- -- something went wrong, the Xtra was not instantiated
- -- Alert "There is no currently selected printer. Printing features are disabled."
- -- else
-
- -- register your Xtra here!
- -- printer(mRegister,"PMAT130-925-01031")
- register(xtra "PrintOMatic", "PMAT130-925-01031")
-
- -- get the page size
- -- put printer(mGetPageWidth) into pw
- -- put printer(mGetPageHeight) into ph
- set w = getPageWidth(doc)
- set h = getPageHeight(doc)
-
- -- figure out scaling
- put the width of member theCast into w
- put the height of member theCast into h
- put min(float(pw)/float(w),float(ph)/float(h)) into scaling
-
- -- see if we can print bigger by switching to landscape mode
- if scaling < 1.0 and w > h then
- -- printer(mSetLandscapeMode,TRUE)
- setLandscapeMode(doc, TRUE)
- set pw = getPageWidth(doc)
- set ph = getPageHeight(doc)
- -- put printer(mGetPageWidth) into pw
- -- put printer(mGetPageHeight) into ph
- put min(float(pw)/float(w),float(ph)/float(h)) into scaling
- end if
-
- -- fix scaling not to exceed 100 percent
- put min(scaling,1.0) into scaling
-
- -- figure out the printed size and page location
- put integer(w*scaling) into w
- put integer(h*scaling) into h
- put (pw-w)/2 into left
- put (ph-h)/2 into top
-
- -- now make a page and put the image on it
- -- printer(mNewPage)
- newPage(doc)
-
- -- printer(mPicture,the picture of cast theCast, rect(left,top,left+w,top+h))
- drawPicture doc, member theCast, rect(left,top,left+w,top+h)
-
- -- and print
-
- -- if printer (mDoJobSetup) = true then
- if doJobSetup(doc) = TRUE then
- updateStage
- -- printer (mPrint)
- print(doc)
- end if
-
- -- printer(mDispose)
- set doc = 0
- --end if
-
-
- -- close the PrintOMatic Xtra
- --closexlib XObjFile
-
- end PrintBitmap
-
-
- on PrintBitmap_W_Text theCast, theText
-
- -- a Lingo script for printing a castmember bitmap
- -- using the PrintOMatic Xtra
- -- the parameter "theCast" represents the castmember you want to print
-
- -- PARAMETERS:
- -- theCast is the number or name of a bitmapped castmember
-
- -- Modified 8/21 -- top justify the bitmap and
- -- print a textbox under it
-
- if the castType of cast theCast <> #bitmap then
- -- alert "PrintBitmap can only print bitmapped castmembers."
- exit
- end if
-
- set doc = new(xtra "PrintOMatic")
- if not objectP(doc) then exit
-
- if the machineType = 256 then
- -- put "pmatic.dll" into XObjFile
- -- put "arial" into printingFont
- setTextFont doc, "arial"
- else
- -- put "BLENDER1:FILES:pmatic.xobj" into XObjFile
- -- put "helvetica" into printingFont
- setTextFont doc, "helvetica"
- end if
-
- -- openxlib XObjFile
-
- -- put PrintOMatic(mNew) into printer
-
- -- if not objectP(printer) then
- -- -- something went wrong, the Xtra was not instantiated
- -- Alert "There is no currently selected printer. Printing features are disabled."
- -- else
-
- -- register your Xtra here!
- -- printer(mRegister,"PMAT130-925-01031")
-
- register(xtra "PrintOMatic", "PMAT130-925-01031")
-
-
- -- get the page size
- -- put printer(mGetPageWidth) into pw
- -- put printer(mGetPageHeight) into ph
- set w = getPageWidth(doc)
- set h = getPageHeight(doc)
-
- -- figure out scaling
- put the width of cast theCast into w
- put the height of cast theCast into h
-
- -- new 8/21
- set left = 0
- set top = 0
- -- now make a page and put the image on it
- -- printer(mNewPage)
- newPage(doc)
- -- printer(mPicture,the picture of cast theCast,left,top,left+w,top+h)
- drawPicture doc, the picture of cast theCast,left,top,left+w,top+h
-
- set bitmapBottom = top + h + 16
-
- -- put printer (mGetPageWidth) into w
- -- put printer (mGetPageHeight) into h
- set w = getPageWidth(doc)
- set h = getPageHeight(doc)
-
-
- -- printer (mSetTextFont,printingFont)
- -- printer (mSetTextSize,7)
- setTextFont doc, "printingFont"
- setTextSize doc, 7
-
- -- printer (mSetTextStyle,"normal")
- setTextStyle doc, "normal"
-
- -- start the first text box at the bottom of the bitmap
- -- printer (mTextBox,0,bitmapBottom,w,h,true)
- newFrame doc, Rect(0,bitmapBottom,w,h), TRUE
-
- -- place the text onto the first page
- -- with the "autoAppend" parameter set to false
- -- printer (mSetText, theText, false)
- append doc, theText, FALSE
-
- -- guess the number of pages based on font
- -- size 7: one line = 7.28 pixels
- set numLines = the number of lines in theText
- set totEstPixels = numLines * 7.28
- -- allow for first page
- set totEstPixels = totEstPixels - (h-bitMapBottom)
- set totFractionalPages = totEstPixels/h
- set totAddlPages = integer(totFractionalPages)
- -- make sure we have not added and extra page
- -- due to the integer rounding up from a >.5 decimal
- if (totFractionalPages > integer(totFractionalPages))then
- -- the decimal place was < .5
- set totAddlPages = totAddlPages + 1
- end if
-
- repeat with n = 1 to totAddlPages
- -- printer(mNewPage)
- newPage(doc)
- -- printer (mTextBox,0,72,w,h,true)
- newFrame doc, Rect(0,72,w,h), TRUE
- -- printer (mSetText, theText, false)
- append doc, theText, FALSE
- end repeat
-
- -- and print
-
- if doJobSetup(doc) = TRUE then
- updateStage
- -- printer (mPrint)
- print(doc)
- end if
-
- -- if printer (mDoJobSetup) = true then
- -- updateStage
- -- if the optionDown then
- -- printer (mPrintPreview)
- -- else
- -- printer (mPrint)
- -- end if
- --
- --end if
-
-
- set doc = 0
-
- -- printer(mDispose)
-
- --end if
-
-
- -- close the PrintOMatic Xtra
- --closexlib XObjFile
-
- end PrintBitmap_W_Text
-
-
- on min a,b
- -- a little script that returns the lesser of two values
- if a<b then
- return a
- else
- return b
- end if
- end
-
-
- on PrintTexta textStringBig, textStringLittle
-
- -- a Lingo script for printing an arbitrary quantity of text
- -- using the PrintOMatic Xtra
-
- -- 2/15/96 Modify handler to print two blocks of text
- -- using different font sizes
-
- -- PARAMETERS:
- -- textString is a string value, the text you want to print
-
- -- if the machineType = 256 then
- -- put "arial" into printingFont
- -- put "pmatic.dll" into XObjFile
- -- else
- -- put "helvetica" into printingFont
- -- put "BLENDER1:FILES:pmatic.xobj" into XObjFile
- -- end if
- set doc = new(xtra "PrintOMatic")
- if not objectP(doc) then exit
-
- if the machineType = 256 then
- setTextFont doc, "arial"
- else
- setTextFont doc, "helvetica"
- end if
-
- -- openxlib XObjFile
- -- put PrintOMatic(mnew) into printer
-
- -- if not objectP(printer) then
- -- -- something went wrong, the Xtra was not instantiated
- -- Alert "There is no currently selected printer. Printing features are disabled."
- -- else
-
- -- register your Xtra here!
- -- printer(mRegister,"PMAT130-925-01031")
- register(xtra "PrintOMatic", "PMAT130-925-01031")
-
- -- set the page margins
- -- printer (mSetMargins,72,72,72,72)
- setMargins doc, rect(72,72,72,72)
-
- -- put printer (mGetPageWidth) into w
- -- put printer (mGetPageHeight) into h
- set w = getPageWidth(doc)
- set h = getPageHeight(doc)
-
- -- printer (mSetTextFont,printingFont)
- -- setTextFont doc, printingFont
-
- -- printer (mSetTextSize,10)
- setTextSize doc, 10
-
- -- printer (mSetTextStyle,"normal")
- setTextStyle doc, "normal"
-
- -- set up our first page and text box
- -- printer (mNewPage)
- newPage(doc)
- -- printer (mTextBox,0,0,w,h,false)
- newFrame doc, Rect(0,0,w,h), FALSE
-
- -- and place the appropriate text (the first block) onto it
- -- with the "autoAppend" parameter set to true
- -- printer (mSetText, textStringBig, true)
- append doc, textStringBig, TRUE
-
- -- add the second block of text
- -- note use of "mAppendText"
- -- printer (mSetTextSize,7)
- setTextSize doc, 7
- printer (mAppendText, textStringLittle, true)
- append doc, textStringLittle, TRUE
-
- if doJobSetup(doc) = TRUE then
- updateStage
- if the optionDown then
- printPreview(doc)
- else
- print(doc)
- end if
- end if
-
- -- if printer (mDoJobSetup) = true then
- -- updateStage
- -- if the optionDown then
- -- printer (mPrintPreview)
- -- else
- -- printer (mPrint)
- -- end if
-
- --end if
-
- --printer(mDispose)
-
- set doc = 0
-
- --end if
-
-
- -- close the PrintOMatic Xtra
- -- closexlib XObjFile
-
-
- end printTexta
-
-
- on PrintText textString
-
- -- a Lingo script for printing an arbitrary quantity of text
- -- using the PrintOMatic Xtra
-
- -- PARAMETERS:
- -- textString is a string value, the text you want to print
- set doc = new(xtra "PrintOMatic")
- if not objectP(doc) then exit
-
- if the machineType = 256 then
- setTextFont doc, "arial"
- else
- setTextFont doc, "helvetica"
- end if
-
-
- -- if the machineType = 256 then
- -- put "arial" into printingFont
- -- put "pmatic.dll" into XObjFile
- -- else
- -- put "helvetica" into printingFont
- -- put "BLENDER1:FILES:pmatic.xobj" into XObjFile
- -- end if
- --
- -- openxlib XObjFile
- -- put PrintOMatic(mnew) into printer
-
- -- if not objectP(printer) then
- -- -- something went wrong, the Xtra was not instantiated
- -- Alert "There is no currently selected printer. Printing features are disabled."
- -- else
-
- -- register your Xtra here!
- -- printer(mRegister,"PMAT130-925-01031")
- register(xtra "PrintOMatic", "PMAT130-925-01031")
-
- -- set the page margins
- -- printer (mSetMargins,72,72,72,72)
- setMargins doc, rect(72,72,72,72)
-
- -- put printer (mGetPageWidth) into w
- -- put printer (mGetPageHeight) into h
- set w = getPageWidth(doc)
- set h = getPageHeight(doc)
-
- -- printer (mSetTextFont,printingFont)
- -- setTextFont doc, printingFont
-
- -- printer (mSetTextSize,10)
- -- printer (mSetTextStyle,"normal")
- setTextSize doc, 10
- setTextStyle doc, "normal"
-
- -- set up our first page and text box
- -- printer (mNewPage)
- newPage(doc)
- -- printer (mTextBox,0,0,w,100,false)
- newFrame doc, Rect(0,0,w,h), FALSE
-
- -- and place the appropriate text onto it
- -- with the "autoAppend" parameter set to true
- -- printer (mSetText, textString, true)
- append doc, textString, TRUE
-
- if doJobSetup(doc) = TRUE then
- updateStage
- if the optionDown then
- printPreview(doc)
- else
- print(doc)
- end if
- end if
-
- -- printer(mDispose)
- set doc = 0
-
- --end if
-
-
- -- close the PrintOMatic Xtra
- --closexlib XObjFile
-
- end printText