From 3c63c097165b59ea0b848a492603eef01b88a9be Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 15 Oct 2006 15:30:27 +0000 Subject: [PATCH] Applied patch given by Mark Tracy for printing improvements. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23877 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 18 ++++++++++++++++++ Source/NSPageLayout.m | 10 +++++++--- Source/NSPrintOperation.m | 8 +++++++- Source/NSView.m | 2 +- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56ec044b2..37343987a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-10-15 11:23-EDT Mark Tracy + + * Source/NSPageLayout.m: NSPageLayout was setting a default page + scale of 100 cause: pageScale factor is displayed as percentage fix: + pageScale*100 sent to textfield and textfield/100 stored in pageScale. + NSPageLayout had different limits on scaling than NSPrintPanel fix: + adjust formatter max. + * Source/NSPrintOperation.m: NSPrintOperation would loop randomly + if a custom view replies YES to -knowsPageRange cause: + -_printPaginateWithInfo did not initialize info->pageScale, + info->xpages, info->ypages fix: in -_printPaginateWithInfo + set default pageScale=1.0 outside conditional fix: in -_print + set xpages and ypages from viewPageRange as reported by custom view. + * Source/NSView.m: -beginDocument was misplacing subviews when + generating PostScript for printing fix: force regeneration of + coordinates. + Patch Applied by Gregory Casamento + 2006-10-15 Richard Frith-Macdonald * Source/NSBrowser.m: diff --git a/Source/NSPageLayout.m b/Source/NSPageLayout.m index 75704fb53..c0e0bd291 100644 --- a/Source/NSPageLayout.m +++ b/Source/NSPageLayout.m @@ -451,7 +451,7 @@ enum { [NSDecimalNumber decimalNumberWithString: @"1.0"]]; [scaleFormatter setMaximum: - [NSDecimalNumber decimalNumberWithString: @"100000.0"]]; + [NSDecimalNumber decimalNumberWithString: @"1000.0"]]; [scaleFormatter setHasThousandSeparators: NO]; [scaleTextField setFormatter: scaleFormatter]; @@ -836,6 +836,10 @@ enum { NSLog(@"NSPrintScalingFactor was nil in NSPrintInfo"); scaleNumber = [NSNumber numberWithFloat: 100.0]; } + else + { + scaleNumber = [NSNumber numberWithDouble: (100.0*[scaleNumber doubleValue])]; + } [scaleTextField setObjectValue: scaleNumber]; @@ -909,8 +913,8 @@ enum { [_printInfo setOrientation: NSLandscapeOrientation]; } - //Write scaling - scaleNumber = [NSNumber numberWithFloat: [scaleTextField floatValue]]; + //Write scaling and don't forget to convert from percent + scaleNumber = [NSNumber numberWithDouble: [scaleTextField doubleValue]/100.0]; [[_printInfo dictionary] setObject: scaleNumber forKey: NSPrintScalingFactor]; diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m index 0ad93a508..4e3f9e185 100644 --- a/Source/NSPrintOperation.m +++ b/Source/NSPrintOperation.m @@ -734,11 +734,11 @@ scaleRect(NSRect rect, double scale) /* Scale bounds by the user specified scaling */ info->scaledBounds = scaleRect(_rect, info->printScale); + info->pageScale = 1; // default if (knowsRange == NO) { /* Now calculate page fitting to get page scale */ - info->pageScale = 1; if ([_printInfo horizontalPagination] == NSFitPagination) info->pageScale = info->paperBounds.size.width / NSWidth(info->scaledBounds); @@ -879,6 +879,12 @@ scaleRect(NSRect rect, double scale) { viewPageRange = NSMakeRange(1, (info.xpages * info.ypages)); } + else + { + info.xpages = 1; + info.ypages = viewPageRange.length; + } + [dict setObject: NSNUMBER(NSMaxRange(viewPageRange)) forKey: @"NSPrintTotalPages"]; if (allPages == YES) diff --git a/Source/NSView.m b/Source/NSView.m index 39201ff37..499422c8b 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -3826,7 +3826,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) [ctxt resetUsedFonts]; /* Make sure we set the visible rect so everything is printed. */ - [self _rebuildCoordinates]; + [self _invalidateCoordinates]; _visibleRect = _bounds; }