mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:20:38 +00:00
* Source/NSPrinter.m:
* Source/NSPrintOperation.m:
* Source/NSPageLayout.m:
* Source/NSPrintInfo.m:
* Headers/AppKit/NSPrintInfo.h: Migrate printing code to CGFloat
or double.
* Source/NSTextView.m: Rewrite -adjustPageHeightNew🔝bottom:limit:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34288 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
30826f63ee
commit
aefc51b5bb
7 changed files with 81 additions and 56 deletions
|
@ -4218,12 +4218,12 @@ Figure out how the additional layout stuff is supposed to work.
|
|||
|
||||
/**** Pagination *****/
|
||||
|
||||
- (void) adjustPageHeightNew: (float*)newBottom
|
||||
top: (float)oldTop
|
||||
bottom: (float)oldBottom
|
||||
limit: (float)bottomLimit
|
||||
- (void) adjustPageHeightNew: (CGFloat*)newBottom
|
||||
top: (CGFloat)oldTop
|
||||
bottom: (CGFloat)oldBottom
|
||||
limit: (CGFloat)bottomLimit
|
||||
{
|
||||
// FIXME: This assumes we are printing a vertical column
|
||||
BOOL needsToMoveBottom = NO;
|
||||
|
||||
NSRect proposedPage = NSMakeRect([self bounds].origin.x,
|
||||
oldTop,
|
||||
|
@ -4233,6 +4233,8 @@ Figure out how the additional layout stuff is supposed to work.
|
|||
NSRange pageGlyphRange = [_layoutManager glyphRangeForBoundingRect: proposedPage
|
||||
inTextContainer: _textContainer];
|
||||
|
||||
CGFloat actualTextBottom = oldBottom; // the maximum Y value of text less than oldBottom
|
||||
|
||||
NSInteger i;
|
||||
for (i = NSMaxRange(pageGlyphRange) - 1; i >= (NSInteger)pageGlyphRange.location; )
|
||||
{
|
||||
|
@ -4240,20 +4242,34 @@ Figure out how the additional layout stuff is supposed to work.
|
|||
NSRect lineFragRect = [_layoutManager lineFragmentRectForGlyphAtIndex: i
|
||||
effectiveRange: &lineFragGlyphRange];
|
||||
|
||||
if (NSContainsRect(proposedPage, lineFragRect))
|
||||
if (NSMaxY(lineFragRect) <= NSMaxY(proposedPage))
|
||||
{
|
||||
*newBottom = NSMaxY(lineFragRect);
|
||||
return;
|
||||
actualTextBottom = NSMaxY(lineFragRect);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We encountered a visible glyph fragment which extents below
|
||||
// the bottom of the page
|
||||
needsToMoveBottom = YES;
|
||||
}
|
||||
|
||||
i = lineFragGlyphRange.location - 1;
|
||||
}
|
||||
|
||||
NSLog(@"Error -[NSTextView adjustPageHeightNew:top:bottom:limit:] failed to find a line fragment completely inside the page");
|
||||
*newBottom = oldBottom;
|
||||
if (needsToMoveBottom)
|
||||
{
|
||||
*newBottom = actualTextBottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
*newBottom = oldBottom;
|
||||
}
|
||||
|
||||
// FIXME: Do we need a special case so text attachments aren't split in half?
|
||||
}
|
||||
|
||||
- (float)heightAdjustLimit
|
||||
- (CGFloat)heightAdjustLimit
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue