mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 05:30:53 +00:00
More corrections to bounds transformation, based on the new test code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27042 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
09d4ded47d
commit
b9044f81bb
2 changed files with 31 additions and 33 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-11-13 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSView.m (-setBounds:, -setBoundsSize:, -setFrame:,
|
||||||
|
-setFrameSize): Some more adjustments on the bounds transformation.
|
||||||
|
|
||||||
2008-11-12 05:31-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
2008-11-12 05:31-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/GSNibCompatibility.m: Conditionally call setToolTip if it
|
* Source/GSNibCompatibility.m: Conditionally call setToolTip if it
|
||||||
|
|
|
@ -1167,13 +1167,28 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
|
|
||||||
if (_is_rotated_or_scaled_from_base)
|
if (_is_rotated_or_scaled_from_base)
|
||||||
{
|
{
|
||||||
float sx = _bounds.size.width / _frame.size.width;
|
if (_boundsMatrix == nil)
|
||||||
float sy = _bounds.size.height / _frame.size.height;
|
{
|
||||||
|
float sx = _bounds.size.width / _frame.size.width;
|
||||||
_frame.size = newSize;
|
float sy = _bounds.size.height / _frame.size.height;
|
||||||
_bounds.size.width = _frame.size.width * sx;
|
|
||||||
_bounds.size.height = _frame.size.height * sy;
|
_frame.size = newSize;
|
||||||
// FIXME: May need to update the bounds matrix.
|
_bounds.size.width = _frame.size.width * sx;
|
||||||
|
_bounds.size.height = _frame.size.height * sy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSAffineTransform *matrix;
|
||||||
|
NSRect frame;
|
||||||
|
|
||||||
|
_frame.size = newSize;
|
||||||
|
frame = _frame;
|
||||||
|
frame.origin = NSMakePoint(0, 0);
|
||||||
|
matrix = [_boundsMatrix copy];
|
||||||
|
[matrix invert];
|
||||||
|
[matrix boundingRectFor: frame result: &_bounds];
|
||||||
|
RELEASE(matrix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1198,7 +1213,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
/* no frame matrix, create one since it is needed for rotation */
|
/* no frame matrix, create one since it is needed for rotation */
|
||||||
if (_frameMatrix == nil)
|
if (_frameMatrix == nil)
|
||||||
{
|
{
|
||||||
// Map fromsuperview to frame
|
// Map from superview to frame
|
||||||
_frameMatrix = [NSAffineTransform new];
|
_frameMatrix = [NSAffineTransform new];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1253,7 +1268,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
|
|
||||||
- (void) setBounds: (NSRect)aRect
|
- (void) setBounds: (NSRect)aRect
|
||||||
{
|
{
|
||||||
// FIXME: This implementation needs to be changed similar to setBoundsOrigin:
|
|
||||||
NSDebugLLog(@"NSView", @"setBounds %@", NSStringFromRect(aRect));
|
NSDebugLLog(@"NSView", @"setBounds %@", NSStringFromRect(aRect));
|
||||||
if (aRect.size.width < 0)
|
if (aRect.size.width < 0)
|
||||||
{
|
{
|
||||||
|
@ -1295,12 +1309,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
|
|
||||||
[_boundsMatrix translateXBy: oldOrigin.x - aRect.origin.x
|
[_boundsMatrix translateXBy: oldOrigin.x - aRect.origin.x
|
||||||
yBy: oldOrigin.y - aRect.origin.y];
|
yBy: oldOrigin.y - aRect.origin.y];
|
||||||
/*
|
|
||||||
FIXME: We need to adjust the size as well, but the computation in
|
|
||||||
_updateBoundsMatrix is wrong for this case.
|
|
||||||
_bounds.size = aRect.size;
|
|
||||||
[self _updateBoundsMatrix];
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Adjust bounds
|
// Adjust bounds
|
||||||
matrix = [_boundsMatrix copy];
|
matrix = [_boundsMatrix copy];
|
||||||
|
@ -1364,21 +1372,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"NSView", @"%@ setBoundsSize: %@", self,
|
NSDebugLLog(@"NSView", @"%@ setBoundsSize: %@", self,
|
||||||
NSStringFromSize(newSize));
|
NSStringFromSize(newSize));
|
||||||
/*
|
|
||||||
NSSize scale;
|
|
||||||
|
|
||||||
if (_boundsMatrix == nil)
|
|
||||||
{
|
|
||||||
scale = [self _computeScale];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scale = [_boundsMatrix transformSize: NSMakeSize(1, 1)];
|
|
||||||
}
|
|
||||||
// Wrong, this would change the origin as well.
|
|
||||||
[self scaleUnitSquareToSize: NSMakeSize(newSize.width / scale.width,
|
|
||||||
newSize.height / scale.height)];
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (newSize.width < 0)
|
if (newSize.width < 0)
|
||||||
{
|
{
|
||||||
|
@ -1390,8 +1383,9 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
NSWarnMLog(@"given negative height", 0);
|
NSWarnMLog(@"given negative height", 0);
|
||||||
newSize.height = 0;
|
newSize.height = 0;
|
||||||
}
|
}
|
||||||
// FIXME: What to do in the rotation case?
|
// This may seem strange, but Cocoa only adjusts the bounds, when there
|
||||||
if (NSEqualSizes(_bounds.size, newSize) == NO)
|
// is no rotation
|
||||||
|
if (!_is_rotated_from_base)
|
||||||
{
|
{
|
||||||
if (_coordinates_valid)
|
if (_coordinates_valid)
|
||||||
{
|
{
|
||||||
|
@ -1399,7 +1393,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
}
|
}
|
||||||
|
|
||||||
_bounds.size = newSize;
|
_bounds.size = newSize;
|
||||||
[self _updateBoundsMatrix];
|
|
||||||
[self resetCursorRects];
|
[self resetCursorRects];
|
||||||
if (_post_bounds_changes)
|
if (_post_bounds_changes)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue