This is NSPrintOperation.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s4 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSPrintOperation pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSObject (NSObject) fs20 fs28 s7 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSPrintOperation.h fs20 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 NSPrintOperation controls operations that generate Encapsulated PostScript (EPS) code or PostScript print jobs. Generally, EPS code is used to transfer images between applications, which happens when the user copies and pastes graphics, uses a Service, or uses ObjectLinks. PostScript print jobs are generated when the user prints and faxes documents. An NSPrintOperation does not generate PostScript code itself; it just controls the overall process, relying on an NSView object to generate the actual code. fs16 fs28 NSPrintOperation relies mainly on two other objects: an NSPrintInfo object, which specifies how the code should be generated, and an NSView object, which performs the actual code generation. You specify these two objects in the method you use to create the NSPrintOperation. If no NSPrintInfo is specified, NSPrintOperation uses the shared NSPrintInfo, which contains default values. The shared NSPrintInfo works well for applications that are not document-based. Document-based applications should create an NSPrintInfo for each document that might be printed or copied and use that object instead. fs16 fs28 You should create an NSPrintOperation in any method that is invoked when a user executes a Print command or a Copy command. That method also must send NSPrintOperation a b runOperationb0 message to start the operation. A b print:b0 method for a document-based application might look like this: fs16 fs28 pard s5 li1231 fi0 ri1007 ql f2 fs20 - (void)print:sender { fi0 tab [[NSPrintOperation printOperationWithView:[self myView] printInfo:[document fi0 tab tab docPrintInfo]] runOperation]; fi0 } pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 fs16 fs28 This method creates an NSPrintOperation for a print job that uses the document'27s NSPrintInfo. Because this is a print job, a Print panel (NSPrintPanel object) is displayed to allow the user to select printing options. The NSPrintOperation copies the NSPrintInfo, updates this copy with information from the Print panel, and uses the specified NSView to perform the operation. fs16 fs28 The information stored in an NSPrintInfo that'27s retained between operations is information that'27s likely to remain constant for a document, such as its page size. All information that'27s likely to change between operations is set to a default value in the NSPrintInfo before the operation begins. In this way, even though NSPrintOperation updates the NSPrintInfo with information from the Print panel for print jobs, that information is reset back to the default values for each print job. Because NSPrintOperation keeps a copy of the NSPrintInfo it uses, you could duplicate a specific print job by storing that copy and reusing it. fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Creating and Initializing an NSPrintOperation Object fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSPrintOperation *)b EPSOperationWithView:b0 (NSView *)i aViewi0 tab s9 li7030 fi-6553 fi-5796 b insideRect:b0 (NSRect)i recti0 tab Returns a new NSPrintOperation that controls the b toData:b0 (NSMutableData *)i datai0 tab tab copying of EPS graphics from the area specified by i recti0 in i aViewi0 , using the parameters in the default NSPrintInfo. The code is written to i datai0 . Raises NSPrintOperationExistsException if there is already a print operation in progress. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPrintOperation *)b EPSOperationWithView:b0 (NSView *)i aViewi0 tab s9 li7030 fi-6553 fi-5796 b insideRect:b0 (NSRect)i recti0 tab Returns a new NSPrintOperation that controls the b toData:b0 (NSMutableData *)i datai0 tab tab copying of EPS graphics from the area specified by i rect i0 b printInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab tab in i aViewi0 , using the parameters in i aPrintInfoi0 . The code is written to i datai0 . Raises NSPrintOperationExistsException if there is already a print operation in progress. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPrintOperation *)b EPSOperationWithView:b0 (NSView *)i aViewi0 tab s9 li7030 fi-6553 fi-5796 b insideRect:b0 (NSRect)i recti0 tab Returns a new NSPrintOperation that controls the b toPath:b0 (NSString *)i pathi0 tab tab copying of EPS graphics from the area specified by i rect i0 b printInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab tab in i aViewi0 , using the parameters in i aPrintInfoi0 . The code is written to i pathi0 . Raises NSPrintOperationExistsException if there is already a print operation in progress. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPrintOperation *)b printOperationWithView:b0 (NSView *)i aView s9 li7030 fi-6553 fi-5796 i0 tab Returns a new NSPrintOperation thati i0 controls the printing of i aViewi0 , using the parameters in the shared NSPrintInfo object. Raises NSPrintOperationExistsException if there is already a print operation in progress. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSPrintOperation *)b printOperationWithView:b0 (NSView *)i aViewi0 tab s9 li7030 fi-6553 fi-5796 b printInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab Returns a new NSPrintOperation thati i0 controls the printing of i aViewi0 , using the parameters in i aPrintInfoi0 . Raises NSPrintOperationExistsException if there is already a print operation in progress. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initEPSOperationWithView:b0 (NSView *)i aViewi0 tab Initializes a newly allocated NSPrintOperation to s9 li7030 fi-6553 fi-5796 b insideRect:b0 (NSRect)i recti0 tab tab control the copying of EPS graphics from the area b toData:b0 (NSMutableData *)i datai0 tab tab specified by i recti0 in i aViewi0 , using the parameters in b printInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab tab i aPrintInfoi0 . The code is written to i datai0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithView:b0 (NSView *)i aViewi0 tab Initializes a newly allocated NSPrintOperation to s9 li7030 fi-6553 fi-5796 b printInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab tab control the printing of i aViewi0 , using the parameters in i aPrintInfoi0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Setting the Print Operation fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSPrintOperation *)b currentOperationb0 tab Returns the NSPrintOperation that represents the current operationi i0 or b nilb0 if there is no such operation. fi-6552 fs16 fs28 fi-6552 + (void)b setCurrentOperation:b0 (NSPrintOperation *)i operation s9 li7030 fi-6553 fi-5796 i0 tab Sets the NSPrintOperation that represents the current operation. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Determining the Type of Operation fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (BOOL)b isEPSOperationb0 tab Returns YES if the receiver controls an EPS operation and NO if the receiver controls a printing operation. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Controlling the User Interface fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSPrintPanel *)b printPanelb0 tab Returns the NSPrintPanel object that'27s used when the operation is run. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b showPanelsb0 tab Returns whether the Print panel will appear when the operation is run. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b setPrintPanel:b0 (NSPrintPanel *)i paneli0 tab Sets the NSPrintPanel object that'27s used when the operation is run. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b setShowPanels:b0 (BOOL)i flagi0 tab Sets whether the Print panel appears when the operation is run. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Managing the DPS Context fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSDPSContext *)b createContextb0 tab Used by the NSPrintOperation object to create the DPS context for output generation, using the current NSPrintInfo settings. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSDPSContext *)b contextb0 tab Returns the DPS context used for the receiver'27s operation. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b destroyContextb0 tab Used by the NSPrintOperation object to destroy the DPS context at the end of the operation. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Page Information fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (int)b currentPageb0 tab Returns the page number of the page being printed. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSPrintingPageOrder)b pageOrderb0 tab Returns the order in which pages will be printed. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b setPageOrder:b0 (NSPrintingPageOrder)i orderi0 tab Sets the order in which pages will be printed. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Running a Print Operation fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (void)b cleanUpOperationb0 tab Invoked at end of an operation'27s run to set the current operation to b nilb0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b deliverResultb0 tab Delivers the results generated by b runOperationb0 to the intended destination: the print spooler, preview application, etc. Returns YES upon successful delivery and NO otherwise. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b runOperationb0 tab Causes the operation (copying EPS graphics or printing) to take place. Returns YES upon successful completion and NO otherwise. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting the NSPrintInfo Object fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSPrintInfo *)b printInfob0 tab Returns the receiver'27s NSPrintInfo object. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b setPrintInfo:b0 (NSPrintInfo *)i aPrintInfoi0 tab Sets the receiver'27s NSPrintInfo object to i aPrintInfoi0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting the NSView Object fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSView *)b viewb0 tab Returns the NSView object that performs the operation controlled by the receiving object. fi-6552 fs16 fs28 fi-6552 }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.