mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
* 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. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28071 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
500c32c7be
commit
83e65b773e
3 changed files with 39 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2009-03-12 19:47-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* 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 <rfm@gnu.org>
|
||||
|
||||
* Source/NSMatrix.m: GC fixups ... change code that was attempting
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue