Small error corrections for printing.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24971 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-04-10 00:30:53 +00:00
parent a799363d1b
commit 6c03eac7b8
4 changed files with 104 additions and 104 deletions

View file

@ -1,14 +1,22 @@
2007-04-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSClipView.m (-setBoundsOrigin:): Use NSView method
scrollRect:by:.
* Source/NSPrintOperation.m (NSView
-_displayPageInRect:atPlacement:withInfo:): Release the temporary matrixes.
* Source/GSEPSPrintOperation.m (_print): Call endPage on the view.
2007-04-05 Xavier Glattard <xavier.glattard@online.fr> 2007-04-05 Xavier Glattard <xavier.glattard@online.fr>
* Headers/AppKit/NSAnimation.h * Headers/AppKit/NSAnimation.h
* Source/NSAnimation.m * Source/NSAnimation.m
* Headers/Additions/GNUstepGUI/GSAnimator.h * Headers/Additions/GNUstepGUI/GSAnimator.h
* Source/GSAnimator.m * Source/GSAnimator.m
Implementation of NSAnimation and NSViewAnimation classes : Implementation of NSAnimation and NSViewAnimation classes :
- only NSAnimationNonBlocking mode is implemented - only NSAnimationNonBlocking mode is implemented
- runLoopModesForAnimating is not used - runLoopModesForAnimating is not used
GSAnimator class is in alpha stage : interface may be changed GSAnimator class is in alpha stage : interface may be changed
See gnustep-examples/GSTest for demos. See gnustep-examples/GSTest for demos.
2007-04-04 Fred Kiefer <FredKiefer@gmx.de> 2007-04-04 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -102,11 +102,12 @@
forKey: @"NSPrintSheetBounds"]; forKey: @"NSPrintSheetBounds"];
[_view beginDocument]; [_view beginDocument];
[_view beginPageInRect: _rect [_view beginPageInRect: _rect
atPlacement: NSMakePoint(0,0)]; atPlacement: NSMakePoint(0,0)];
[_view displayRectIgnoringOpacity: _rect]; [_view displayRectIgnoringOpacity: _rect];
[_view endPage];
[_view endDocument]; [_view endDocument];
} }
@ -123,7 +124,7 @@
eps = [NSString stringWithContentsOfFile: _path]; eps = [NSString stringWithContentsOfFile: _path];
[_data setData: [eps dataUsingEncoding:NSASCIIStringEncoding]]; [_data setData: [eps dataUsingEncoding: NSASCIIStringEncoding]];
} }
return YES; return YES;

View file

@ -248,8 +248,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
if (_copiesOnScroll && _window && [_window gState]) if (_copiesOnScroll && _window && [_window gState])
{ {
/* Copy the portion of the view that is common before and after /* Copy the portion of the view that is common before and after
scrolling. Then, document view needs to redraw the remaining scrolling. Then, document view needs to redraw the remaining
areas. */ areas. */
@ -258,110 +258,99 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
intersection = NSIntersectionRect (originalBounds, newBounds); intersection = NSIntersectionRect (originalBounds, newBounds);
/* but we must make sure we only copy from visible rect - we /* but we must make sure we only copy from visible rect - we
can't copy bits which have been clipped (ie discarded) */ can't copy bits which have been clipped (ie discarded) */
intersection = NSIntersectionRect (intersection, [self visibleRect]); intersection = NSIntersectionRect (intersection, [self visibleRect]);
/* Copying is done in device space so we only can copy by /* Copying is done in device space so we only can copy by
integral rects in device space - adjust our copy rect */ integral rects in device space - adjust our copy rect */
intersection = integralRect (intersection, self); intersection = integralRect (intersection, self);
/* At this point, intersection is the rectangle containing the /* At this point, intersection is the rectangle containing the
image we can recycle from the old to the new situation. We image we can recycle from the old to the new situation. We
must not make any assumption on its position/size, because it must not make any assumption on its position/size, because it
has been intersected with visible rect, which is an arbitrary has been intersected with visible rect, which is an arbitrary
rectangle as far as we know. */ rectangle as far as we know. */
if (NSEqualRects (intersection, NSZeroRect)) if (NSEqualRects (intersection, NSZeroRect))
{ {
// no recyclable part -- docview should redraw everything // no recyclable part -- docview should redraw everything
// from scratch // from scratch
[super setBoundsOrigin: newBounds.origin]; [super setBoundsOrigin: newBounds.origin];
[_documentView setNeedsDisplayInRect: [_documentView setNeedsDisplayInRect:
[self documentVisibleRect]]; [self documentVisibleRect]];
} }
else else
{ {
/* Copy the intersection to the new position */ /* It is assumed these dx and dy will be integer in device
NSPoint destPoint = intersection.origin; space because they are the difference of the bounds
float dx = newBounds.origin.x - originalBounds.origin.x; origins, both of which should be integers in device space
float dy = newBounds.origin.y - originalBounds.origin.y; because of the code at the end of
NSRect redrawRect; constrainScrollPoint:. */
float dx = newBounds.origin.x - originalBounds.origin.x;
/* It is assumed these dx and dy will be integer in device float dy = newBounds.origin.y - originalBounds.origin.y;
space because they are the difference of the bounds NSRect redrawRect;
origins, both of which should be integers in device space
because of the code at the end of /* Copy the intersection to the new position */
constrainScrollPoint:. */ [self scrollRect: intersection by: NSMakeSize(dx, dy)];
destPoint.x -= dx;
destPoint.y -= dy;
/* Now copy ! */ /* Change coordinate system to the new one */
[self lockFocus]; [super setBoundsOrigin: newBounds.origin];
/* NB: Because of all the previous comments, we are sure the
following is copying an integer rectangle by an integer /* Get the rectangle representing intersection in the new
amount (`integer' in device space) - which should cause
no problems */
NSCopyBits (0, intersection, destPoint);
[self unlockFocus];
/* Change coordinate system to the new one */
[super setBoundsOrigin: newBounds.origin];
/* Get the rectangle representing intersection in the new
bounds (mainly to keep code readable) */ bounds (mainly to keep code readable) */
intersection.origin.x = destPoint.x; intersection.origin.x -= dx;
intersection.origin.y = destPoint.y; intersection.origin.y -= dy;
// intersection.size is the same // intersection.size is the same
/* Now mark everything which is outside intersection as /* Now mark everything which is outside intersection as
needing to be redrawn by hand. NB: During simple usage - needing to be redrawn by hand. NB: During simple usage -
scrolling in a single direction (left/rigth/up/down) - scrolling in a single direction (left/rigth/up/down) -
and a normal visible rect, only one of the following and a normal visible rect, only one of the following
rects will be non-empty. */ rects will be non-empty. */
/* To the left of intersection */ /* To the left of intersection */
redrawRect = NSMakeRect (NSMinX (_bounds), _bounds.origin.y, redrawRect = NSMakeRect(NSMinX(_bounds), _bounds.origin.y,
NSMinX (intersection) - NSMinX (_bounds), NSMinX(intersection) - NSMinX(_bounds),
_bounds.size.height); _bounds.size.height);
if (NSIsEmptyRect (redrawRect) == NO) if (NSIsEmptyRect(redrawRect) == NO)
{ {
[_documentView setNeedsDisplayInRect: [_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect [self convertRect: redrawRect
toView: _documentView]]; toView: _documentView]];
} }
/* Right */ /* Right */
redrawRect = NSMakeRect (NSMaxX (intersection), _bounds.origin.y, redrawRect = NSMakeRect(NSMaxX(intersection), _bounds.origin.y,
NSMaxX (_bounds) - NSMaxX (intersection), NSMaxX(_bounds) - NSMaxX(intersection),
_bounds.size.height); _bounds.size.height);
if (NSIsEmptyRect (redrawRect) == NO) if (NSIsEmptyRect(redrawRect) == NO)
{ {
[_documentView setNeedsDisplayInRect: [_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect [self convertRect: redrawRect
toView: _documentView]]; toView: _documentView]];
} }
/* Up (or Down according to whether it's flipped or not) */ /* Up (or Down according to whether it's flipped or not) */
redrawRect = NSMakeRect (_bounds.origin.x, NSMinY (_bounds), redrawRect = NSMakeRect(_bounds.origin.x, NSMinY(_bounds),
_bounds.size.width, _bounds.size.width,
NSMinY (intersection) - NSMinY (_bounds)); NSMinY(intersection) - NSMinY(_bounds));
if (NSIsEmptyRect (redrawRect) == NO) if (NSIsEmptyRect(redrawRect) == NO)
{ {
[_documentView setNeedsDisplayInRect: [_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect [self convertRect: redrawRect
toView: _documentView]]; toView: _documentView]];
} }
/* Down (or Up) */ /* Down (or Up) */
redrawRect = NSMakeRect (_bounds.origin.x, NSMaxY (intersection), redrawRect = NSMakeRect(_bounds.origin.x, NSMaxY(intersection),
_bounds.size.width, _bounds.size.width,
NSMaxY (_bounds) - NSMaxY (intersection)); NSMaxY(_bounds) - NSMaxY(intersection));
if (NSIsEmptyRect (redrawRect) == NO) if (NSIsEmptyRect(redrawRect) == NO)
{ {
[_documentView setNeedsDisplayInRect: [_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect [self convertRect: redrawRect
toView: _documentView]]; toView: _documentView]];
} }
} }
} }
else else
{ {

View file

@ -1098,9 +1098,9 @@ scaleRect(NSRect rect, double scale)
{ {
NSAffineTransformStruct ats = { 1, 0, 0, -1, 0, NSHeight(_bounds) }; NSAffineTransformStruct ats = { 1, 0, 0, -1, 0, NSHeight(_bounds) };
NSAffineTransform *matrix, *flip; NSAffineTransform *matrix, *flip;
flip = [NSAffineTransform new]; flip = [NSAffineTransform new];
matrix = [NSAffineTransform new]; matrix = [NSAffineTransform new];
[matrix makeIdentityMatrix];
[matrix prependTransform: _boundsMatrix]; [matrix prependTransform: _boundsMatrix];
/* /*
* The flipping process must result in a coordinate system that * The flipping process must result in a coordinate system that
@ -1110,6 +1110,8 @@ scaleRect(NSRect rect, double scale)
[flip setTransformStruct: ats]; [flip setTransformStruct: ats];
[matrix prependTransform: flip]; [matrix prependTransform: flip];
[matrix concat]; [matrix concat];
RELEASE(flip);
RELEASE(matrix);
yoffset = NSHeight(_frame) - NSMaxY(pageRect); yoffset = NSHeight(_frame) - NSMaxY(pageRect);
} }
else else