Re: NSPrintInfo and updateChangeCount problems
Re: NSPrintInfo and updateChangeCount problems
- Subject: Re: NSPrintInfo and updateChangeCount problems
- From: Manfred Lippert <email@hidden>
- Date: Sat, 5 Oct 2002 11:04:19 +0200
Every time the document is opened, I unarchive the NSPrintInfo and
call setPrintInfo for my NSDocument.
The problem: This changes the updateChangeCount of the document. So
every "fresh" loaded document is in "dirty" state. I tried to call
[self updateChangeCount:NSChangeCleared] for my NSDocument, but
unfortunately this does not clear the dirty state! Why is this? How
can I make my document state "clean" after loading it and setting its
NSPrintInfo?
I finally found a solution for myself:
I have to override "setPrintInfo" and "printInfo" with my own
implementation. Seems that the standard implementation of setPrintInfo
of NSDocument does some strange delayed things here which set my
document state to "dirty" even if I set it to "clean" directly after
the setPrintInfo call ...
But this way it works fine:
- (NSPrintInfo *)printInfo {
if (printInfo == nil) {
[self setPrintInfo:[super printInfo]];
}
return printInfo;
}
- (void) setPrintInfo:(NSPrintInfo *)info {
[printInfo autorelease];
printInfo = [info copyWithZone:[self zone]];
[self updateChangeCount:NSChangeDone];
}
After loading my document and setting my archived NSPrintInfo with
"setPrintInfo" I can call [self updateChangeCount:NSChangeCleared] and
now this works as espected - the document state is "clean" after
loading the document.
And document state ist correctly set to dirty, if the user changes the
Paper Format etc ...
Regards,
Mani
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.