* Source/NSView.m (-_rebuildCoordinates): Check if the flipped

state of the view has changed. Call this method all the times
        instead of checking _coordinates_valid.
        This change allows views to dynamically change their flipped
state.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35928 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2012-12-31 18:55:36 +00:00
parent 5b4985096a
commit 003dcb8149
3 changed files with 23 additions and 20 deletions

View file

@ -1,3 +1,10 @@
2012-12-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-_rebuildCoordinates): Check if the flipped
state of the view has changed. Call this method all the times
instead of checking _coordinates_valid.
This change allows views to dynamically change their flipped state.
2012-12-31 Fred Kiefer <FredKiefer@gmx.de> 2012-12-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSFont.m (-setInContext:): Remove usage of * Source/NSFont.m (-setInContext:): Remove usage of

View file

@ -124,7 +124,7 @@ PACKAGE_SCOPE
* Flags for internal use by NSView and it's subclasses. * Flags for internal use by NSView and it's subclasses.
*/ */
struct _rFlagsType { struct _rFlagsType {
unsigned flipped_view:1; /* Deprecated and unused. */ unsigned flipped_view:1; /* Flipped state the last time we checked. */
unsigned has_subviews:1; /* The view has subviews. */ unsigned has_subviews:1; /* The view has subviews. */
unsigned has_currects:1; /* The view has cursor rects. */ unsigned has_currects:1; /* The view has cursor rects. */
unsigned has_trkrects:1; /* The view has tracking rects. */ unsigned has_trkrects:1; /* The view has tracking rects. */

View file

@ -257,11 +257,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
* All coordinate transformations use this matrix. * All coordinate transformations use this matrix.
*/ */
- (NSAffineTransform*) _matrixFromWindow - (NSAffineTransform*) _matrixFromWindow
{
if (_coordinates_valid == NO)
{ {
[self _rebuildCoordinates]; [self _rebuildCoordinates];
}
return _matrixFromWindow; return _matrixFromWindow;
} }
@ -273,11 +270,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
* All coordinate transformations use this matrix. * All coordinate transformations use this matrix.
*/ */
- (NSAffineTransform*) _matrixToWindow - (NSAffineTransform*) _matrixToWindow
{
if (_coordinates_valid == NO)
{ {
[self _rebuildCoordinates]; [self _rebuildCoordinates];
}
return _matrixToWindow; return _matrixToWindow;
} }
@ -288,9 +282,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
*/ */
- (void) _rebuildCoordinates - (void) _rebuildCoordinates
{ {
if (_coordinates_valid == NO) BOOL isFlipped = [self isFlipped];
BOOL lastFlipped = _rFlags.flipped_view;
if ((_coordinates_valid == NO) || (isFlipped != lastFlipped))
{ {
_coordinates_valid = YES; _coordinates_valid = YES;
_rFlags.flipped_view = isFlipped;
if (!_window) if (!_window)
{ {
_visibleRect = NSZeroRect; _visibleRect = NSZeroRect;
@ -300,18 +299,18 @@ GSSetDragTypes(NSView* obj, NSArray *types)
else else
{ {
NSRect superviewsVisibleRect; NSRect superviewsVisibleRect;
BOOL wasFlipped; BOOL superFlipped;
NSAffineTransform *pMatrix; NSAffineTransform *pMatrix;
NSAffineTransformStruct ts; NSAffineTransformStruct ts;
if (_super_view != nil) if (_super_view != nil)
{ {
wasFlipped = [_super_view isFlipped]; superFlipped = [_super_view isFlipped];
pMatrix = [_super_view _matrixToWindow]; pMatrix = [_super_view _matrixToWindow];
} }
else else
{ {
wasFlipped = NO; superFlipped = NO;
pMatrix = [NSAffineTransform transform]; pMatrix = [NSAffineTransform transform];
} }
@ -328,7 +327,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
(*preImp)(_matrixToWindow, preSel, _frameMatrix); (*preImp)(_matrixToWindow, preSel, _frameMatrix);
} }
if ([self isFlipped] != wasFlipped) if (isFlipped != superFlipped)
{ {
/* /*
* The flipping process must result in a coordinate system that * The flipping process must result in a coordinate system that
@ -2540,15 +2539,12 @@ static void autoresize(CGFloat oldContainerSize,
if (context == wContext) if (context == wContext)
{ {
NSRect neededRect; NSRect neededRect;
NSRect visibleRect = [self visibleRect];
flush = YES; flush = YES;
[_window disableFlushWindow]; [_window disableFlushWindow];
if (_coordinates_valid == NO) aRect = NSIntersectionRect(aRect, visibleRect);
{ neededRect = NSIntersectionRect(_invalidRect, visibleRect);
[self _rebuildCoordinates];
}
aRect = NSIntersectionRect(aRect, _visibleRect);
neededRect = NSIntersectionRect(_invalidRect, _visibleRect);
/* /*
* If the rect we are going to display contains the _invalidRect * If the rect we are going to display contains the _invalidRect