darling-cocotron/AppKit/NSPrintPanel.m
Christopher Lloyd a08967f04c - -[NSView print:] and -[NSDocument printDocument:] functional (if you implement printOperationWithSettings:error in NSDocument), brings up the print panel and paginates. Some NSView printing methods added, work on NSPrintOperation to autopaginate. There are a number of problems to sort out still.
- NSDocument initWithContentsOfURL,  printDocument:, printDocumentWithSettings:, printOperationWithSettings:error: implemented
- NSDocumentController recent document menu implemented, and some of the URL based methods.
-[NSURL isEqual:], -[NSURL isFileURL] implemented within the limits of the current capabilities
-[NSApplication windowsMenu] corrected (finds menu by name in nib)
+[NSMenuItem separatorItem] fixed (was returning broken separator)
- NSMenu loads special name (windows, font, recent doc.s, etc.) from nib and private API for locating by name
- Most NSPrintInfo getters/setters implemented.
- NSPrintPanel added
- Split KGRenderingContext into KGRenderingContext and KGDeviceContext and cleaned up around these classes
- Fixed page locating bug in KGPDFDocument
2007-07-19 16:16:41 +00:00

39 lines
924 B
Objective-C

#import <AppKit/NSPrintPanel.h>
#import <AppKit/NSPrintOperation.h>
#import <AppKit/NSPrintInfo.h>
#import <AppKit/NSPanel.h>
#import <AppKit/NSDisplay.h>
#import <Foundation/NSDictionary.h>
@implementation NSPrintPanel
+(NSPrintPanel *)printPanel {
return [[[self alloc] init] autorelease];
}
-(int)runModal {
int result;
[self updateFromPrintInfo];
result=[[NSDisplay currentDisplay] runModalPrintPanelWithPrintInfoDictionary:_attributes];
if(result==NSOKButton)
[self finalWritePrintInfo];
return result;
}
-(void)updateFromPrintInfo {
NSDictionary *source=[[[NSPrintOperation currentOperation] printInfo] dictionary];
[_attributes release];
_attributes=[source mutableCopy];
}
-(void)finalWritePrintInfo {
NSMutableDictionary *destination=[[[NSPrintOperation currentOperation] printInfo] dictionary];
[destination addEntriesFromDictionary:_attributes];
}
@end