Text preview for : 09_Printing.pdf part of apple 09 Printing apple lisa toolkit_3.0 Package_2_Examples 09_Printing.pdf



Back to : 09_Printing.pdf | Home

PRINTING
--------...-----------------------------~-----
From:
To: ToolKit Users
Date: 12 May 1984 - - Draft: 00:30
Subject: ToolKit Printing - Notes


Printing in the ToolKit is organized around the concept of the View. Every panel's View is
either "printable" or "not printable". The actual code to image a view on the printed page
is the same TView.Draw which is used to image the view on the screen; the ToolKit takes
care of differences between the resolution of the printer and that of the screen.form8tted
Printing issues for a printable view are handled by its PrintManager. Each printable view
in an appl ication has its own PrintManager, but usually an application which has more than
one printable view wi II use an instance of the same TPrintManager subclass for each of its
printable views.
When creating a view (using TPanel.NewView or, in special cases, TView.CREATE), the
application specifies the PrintManager to be used with it. Specifying NIL for the
PrintManager indicates that the view is not to be printable.
If a view is to be printable, there are three basic choices for its PrintManager:
(1) The vanilla printManager, obtained by calling TPrintManager.CREATE - - this gives
you printing but no faci lity for speCifying headings or margins.
(2) The 'standard' printManager, of class TStdPrintManager, obtained by can ing
TStdPrintManager.CREATE. This printManager gives the user of the apprication an
interactive Headings and Margins facility. An application wishing to use this
PrintManager must USE the Dialog Building Block, UDialog.
(3) If an appl ication is not content with either of the above, it can define its own subclass
of TPrintManager (or of TStdPrintManager).



Class: TPrintt1anager
SUperClass: TObject
Defined Subclass: TStdPrintnanager (defined in the Dialog Building Block)

Data fields:
view: TView The view Whose printing is "anaged
pageView: TView The view which draws the headings in the "argins of the page {the
size of this view is the size Of one page}
breakS: ARRAY(vhSelect] Of TArray {of LONGINT}
The vertical and horizontal pagebreaks which parti tion the view up
into pieces WhiCh will fit onto indivldual pages. (note:
breaks[v) hOlds infor"ation for page bre~kS w~ich When
drawn on the screen. are represented by verucalllnes).
The represe~tation is; the absolute value gives ~he location in
the vlew; the Slon tells Whether the break 1S an autOf'auc
one (nonnegative) or a "anual (user-set) one (negative)
The page Aargins to use when fitting view pieces onto pages; top and
left are positive and botto" and right are negative. These



ToolKit Printing Notes - 12 Kay 1084 - 00: 30 - Page 1 of 5
nuPtbers are in View resolution. hence the LRect even though
the actual nURbers involvecl will be very Sf'all.
headings: Tust {of THeacling} The heaclings to be printed on the pages
canEdi tPages: BOOLEAN fALSE by ~fault; the. StdPrintttal)ager .set.s this true. since
headlngs and ~arglnS can be eell teel Wl th 1t.
layoutDialogBox:TDialogBox NIL by def~ul t; the StdPrint"anager places a reference to a dialog
bOx 1t creates here.
fra"eBody: BOOLEAN fALSE by default; client can set to TRUE directly, in whiCh the page
bOdy will be separated fro" the page Rarglns on the printed
page by a bOx. "ostly for debugging purposes.
paperLRect: LRect The physical bOunds of a single page on the printer currently
fOI.-atted for. in view resolution.
printableLRect: LRect The printable area ~f a. single page on the printer currently
for.-atted for, 1n Vlew resolutlon.
contentLRect: LRect The area on a page into WhiCh the body (i. e., chunks of the view)
~ill ~ s~uffed. obtained by.t.king the paperLRe~t a~d
1nsettlng 1t by the Mount specl flecl1n the pagenarglns; 1n
view resolution.
The undigested n~bers characterizing the physical properties of
the printer currently for ..atted for; this is a Record whose
fields are: paperRect. printableReet (the eonterparts of
paperLRect and printableLRect. but in device coordlnates).
and res (the resolutions of the device, paCkaged into a
Point).
pageRiseDirection: YhSelect Whether page ntMbers should be rise fastest left-to-right (h) or
top-to-botto" (v)

nethoels client ~ wish to call directly:
PROCEDURE Changenargins(newnargins: LRect) Install a new set of Rargins into the printltaOager

nethOds client ~ wish to redefine in! subClass:
PROCEDURE Dr awP age Dr aw the page whose page-nuAber is indicated by
thenarglnPad.pageN~ber.

PROCEDURE fnterPageEditing Enter into whatever Rethod the printHanager has of allowing the
user to edit page headings and ~argins
PROCEDURE GetpageLiRi ts(pageNu~ber: LONG 1NT : VAR viewLRect: LRect)
Gi ven the page n~ber. returns the bOunds of the subset of the view
Which will be Rapped into that page.
fUNClION NewPaginatedView(object: TObject): TPaginatedView
Launch a Paginated View. Default: the ToolKit's standard
Page-preview ROde is entered into.
fUNCTION Newpageview(oDject: lODject): lVlew
Launch the PageView to be used. Defaul t: an object of the
ToolKi t' s standard TPageView class is launched.
fUNCTION PageWith(VAR lPtlnView: LPoint; VAR strip: Point): LONGINT
Given a point in the view, returns the page nu"ber into which that
point falls as the value of the function, and also returns,
1n 'strip' , Which vertical and horizontal strip of pages the
point falls into.
PROCEDURE Print Does the actual printing. Client Right Subclass in order to dO
sOfllething special before or after printing, While deferring
to SUP[RSELf for the actual printlng; clients wiShing to do
TPrintnanager. Print all by the~sel ves Rust have direct
access to the underlying Lisa Printing software. as well as a
sense of aclventure.
PROCEDURE ReactToPrinterChange Reacts to Change in printer specification; the generic
TPrintnanager.ReactToPrinterChange gets fresh printer


ToolKi t Printing Motes - 12 "ay 1984 - 00: 30 - Page 2 of S
Retries. recoRputes the printableLRect. paperLRect. and
contentLRect, resizes the View if necessary, reco"J)utes the
bounds of the Pageview. and calls Red08reaks.
PROCEDURE Red08reakS; Reco"pute page-breaks
PROCEDURE SetOn tHeadings: Sets the default headings; called by TPrintHanager.lnit so that
the prin~anager can create desired default headings and
install the" in its list of headings.
PROCEDURE Skippage(pageNu"ber: LONGINT) Do whatever the application wishes to if it knows that the indicated
page-nu"ber. at printing ti ..e, is not going to be printed
(but so..e large page-nUfitber will be); this allows an
application to cycle throu9h its data structures to the
start of the next page. If it needs to. The generic
TPrin~anager. SkipPage does nothing.



Miscellaneous notes and clarifications

Printable Views and the "Format For Printer ..... dialog
The Lisa User Interface Standard specifies that a document be formatted for one
. particular printer at any one time, The record which contains information about the
printer formatted for is called a "Print Preference", and such an object is stored in
TDocManager objects, under the alias type 'TPrReserve', A default specification is
provided by the generic TDocManager .CREATE method. In a cl ient's own
DocManager .CREATE, cl ient after call ing SUPERSELF .CREATE may want to change
detai Is of this default print preference, but this requires sinful knowledge of the innards of
this record, coerced from type TPrReserve to TPrPrf.
More commonly, an appl ication accepts the default print preference, and its user changes
the specification through the 'Format For Printer ...