diff --git a/ChangeLog b/ChangeLog index 3c0bd65c3..8541ec54a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-03-12 19:47-EDT Gregory John Casamento + + * Source/NSPrintOperation.m: Correct issues with handling of + rectangle passed back from rectForPage: callback in NSView + subclasses. This rect should override existing calculations + when it is passed in. + * Source/NSView.m: Change to use NSPrintPaperBounds if and only if + aRect is passed in as a blank rect. Previously the code was + using the NSPrintPaperBounds value and ignoring the passed in + value. + 2009-03-11 Richard Frith-Macdonald * Source/NSMatrix.m: GC fixups ... change code that was attempting diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m index d27a84b6e..deebf6351 100644 --- a/Source/NSPrintOperation.m +++ b/Source/NSPrintOperation.m @@ -121,7 +121,8 @@ typedef struct _page_info_t { @interface NSView (NSPrintOperation) - (void) _displayPageInRect: (NSRect)pageRect - withInfo: (page_info_t)info; + withInfo: (page_info_t)info + knowsPageRange: (BOOL)knowsPageRange; @end @interface NSView (NPrintOperationPrivate) @@ -1045,7 +1046,8 @@ scaleRect(NSRect rect, double scale) /* Draw using our special view routine */ [_view _displayPageInRect: pageRect - withInfo: info]; + withInfo: info + knowsPageRange: knowsPageRange]; // We could end up in this case for each row/column not just the lase page. if (!knowsPageRange && dir > 0 && _currentPage == info.last && allPages == YES) @@ -1093,6 +1095,7 @@ scaleRect(NSRect rect, double scale) - (void) _displayPageInRect: (NSRect)pageRect withInfo: (page_info_t)info + knowsPageRange: (BOOL)knowsPageRange { int currentPage; int numberOnSheet; @@ -1109,6 +1112,12 @@ scaleRect(NSRect rect, double scale) if (numberOnSheet == 0) { NSString *label; + NSRect boundsForPage = info.sheetBounds; + + if(knowsPageRange) + { + boundsForPage = pageRect; + } label = nil; if (info.nup == 1) @@ -1116,15 +1125,19 @@ scaleRect(NSRect rect, double scale) [self beginPage: floor((currentPage - info.first)/info.nup)+1 label: label - bBox: info.sheetBounds + bBox: boundsForPage fonts: nil]; if (info.orient == NSLandscapeOrientation) { DPSrotate(ctxt, 90); DPStranslate(ctxt, 0, -info.paperSize.height); } - /* Also offset by margins */ - DPStranslate(ctxt, NSMinX(info.paperBounds), NSMinY(info.paperBounds)); + + if(!knowsPageRange) + { + /* Also offset by margins */ + DPStranslate(ctxt, NSMinX(info.paperBounds), NSMinY(info.paperBounds)); + } /* End page setup for multi page */ if (info.nup != 1) diff --git a/Source/NSView.m b/Source/NSView.m index 3863efd2e..93cbf1e80 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -4247,11 +4247,16 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) NSGraphicsContext *ctxt = [printOp context]; NSDictionary *dict = [[printOp printInfo] dictionary]; - if ([dict objectForKey: @"NSPrintPaperBounds"]) - bounds = [[dict objectForKey: @"NSPrintPaperBounds"] rectValue]; + if (NSIsEmptyRect(aRect)) + { + if ([dict objectForKey: @"NSPrintPaperBounds"]) + bounds = [[dict objectForKey: @"NSPrintPaperBounds"] rectValue]; + } else - bounds = aRect; - + { + bounds = aRect; + } + nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue]; if (nup > 1) { @@ -4285,7 +4290,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) } /* Translate to placement */ - if (location.x != 0 || location.y != 0) + if (location.x != 0 || location.y != 0 && NSIsEmptyRect(aRect) == YES) DPStranslate(ctxt, location.x, location.y); // FIXME: Need to place this correctly. Maybe it isn't needed at all,