mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:04:20 +00:00
Replaced _rFlags.flipped_view use with -isFlipped and deprecated
_rFlagsType.flipped_view. Still needs some work to automatically invalidate coordinates when the flipping changes e.g. between two drawing sessions. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31233 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dda6652e85
commit
a7ca2b775f
6 changed files with 38 additions and 40 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-09-03 Quentin Mathe <quentin.mathe@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSView.h:
|
||||
* Source/NSView.m:
|
||||
* Source/NSClipView.m:
|
||||
* Source/NSScrollView.m:
|
||||
* Source/NSSplitView.m:
|
||||
Replaced _rFlags.flipped_view use with -isFlipped and deprecated
|
||||
_rFlagsType.flipped_view.
|
||||
Still needs some work to automatically invalidate coordinates when the
|
||||
flipping changes e.g. between two drawing sessions.
|
||||
|
||||
2010-09-02 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSPopUpButtonCell.m:
|
||||
|
|
|
@ -124,14 +124,7 @@ PACKAGE_SCOPE
|
|||
* Flags for internal use by NSView and it's subclasses.
|
||||
*/
|
||||
struct _rFlagsType {
|
||||
/*
|
||||
* 'flipped_view' is set in NSViews designated initialiser (and other
|
||||
* methods that create views) to be the value returned by [-isFlipped]
|
||||
* This caching assumes that the value returned by [-isFlipped] will
|
||||
* not change during the views lifetime - if it does, the view must
|
||||
* be sure to change the flag accordingly.
|
||||
*/
|
||||
unsigned flipped_view:1;
|
||||
unsigned flipped_view:1; /* Deprecated and unused. */
|
||||
unsigned has_subviews:1; /* The view has subviews. */
|
||||
unsigned has_currects:1; /* The view has cursor rects. */
|
||||
unsigned has_trkrects:1; /* The view has tracking rects. */
|
||||
|
|
|
@ -158,8 +158,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
/* Don't retain this since it's stored in our subviews. */
|
||||
_documentView = aView;
|
||||
|
||||
/* Call this before doing anything else ! */
|
||||
_rFlags.flipped_view = [self isFlipped];
|
||||
/* Update the view hierarchy coordinates if -isFlipped has changed.
|
||||
Call this before doing anything else! */
|
||||
[self _invalidateCoordinates];
|
||||
|
||||
if (_documentView)
|
||||
|
|
|
@ -368,7 +368,7 @@ static float scrollerWidth;
|
|||
|
||||
[self setVerticalScroller: scroller];
|
||||
RELEASE(scroller);
|
||||
if (_contentView && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView && ![_contentView isFlipped])
|
||||
[_vertScroller setFloatValue: 1];
|
||||
}
|
||||
[self addSubview: _vertScroller];
|
||||
|
@ -448,14 +448,14 @@ static float scrollerWidth;
|
|||
amount = - _vLineScroll * deltaY;
|
||||
}
|
||||
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
/* If view is flipped reverse the scroll direction */
|
||||
amount = -amount;
|
||||
}
|
||||
NSDebugLLog (@"NSScrollView",
|
||||
@"increment/decrement: amount = %f, flipped = %d",
|
||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||
amount, _contentView ? [_contentView isFlipped] : 0);
|
||||
|
||||
point.y = clipViewBounds.origin.y + amount;
|
||||
|
||||
|
@ -512,7 +512,7 @@ static float scrollerWidth;
|
|||
}
|
||||
point = clipViewBounds.origin;
|
||||
amount = _vLineScroll;
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ static float scrollerWidth;
|
|||
}
|
||||
point = clipViewBounds.origin;
|
||||
amount = _vLineScroll;
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ static float scrollerWidth;
|
|||
amount = clipViewBounds.size.height - _vPageScroll;
|
||||
amount = (amount < 0) ? 0 : amount;
|
||||
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ static float scrollerWidth;
|
|||
*/
|
||||
amount = clipViewBounds.size.height - _vPageScroll;
|
||||
amount = (amount < 0) ? 0 : amount;
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
@ -710,14 +710,14 @@ static float scrollerWidth;
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
/* If view is flipped reverse the scroll direction */
|
||||
amount = -amount;
|
||||
}
|
||||
NSDebugLLog (@"NSScrollView",
|
||||
@"increment/decrement: amount = %f, flipped = %d",
|
||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||
amount, _contentView ? [_contentView isFlipped] : 0);
|
||||
point.y = clipViewBounds.origin.y + amount;
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ static float scrollerWidth;
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
floatValue = 1 - floatValue;
|
||||
point.y = floatValue * (documentRect.size.height
|
||||
- clipViewBounds.size.height);
|
||||
|
@ -760,7 +760,7 @@ static float scrollerWidth;
|
|||
documentRect = [_contentView documentRect];
|
||||
}
|
||||
point = documentRect.origin;
|
||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView != nil && ![_contentView isFlipped])
|
||||
{
|
||||
point.y = NSMaxY(documentRect) - NSHeight(clipViewBounds);
|
||||
if (point.y < 0)
|
||||
|
@ -785,7 +785,7 @@ static float scrollerWidth;
|
|||
documentRect = [_contentView documentRect];
|
||||
}
|
||||
point = documentRect.origin;
|
||||
if (_contentView == nil || _contentView->_rFlags.flipped_view)
|
||||
if (_contentView == nil || [_contentView isFlipped])
|
||||
{
|
||||
point.y = NSMaxY(documentRect) - NSHeight(clipViewBounds);
|
||||
if (point.y < 0)
|
||||
|
@ -857,7 +857,7 @@ static float scrollerWidth;
|
|||
floatValue = (clipViewBounds.origin.y - documentFrame.origin.y)
|
||||
/ (documentFrame.size.height - clipViewBounds.size.height);
|
||||
|
||||
if (!_contentView->_rFlags.flipped_view)
|
||||
if (![_contentView isFlipped])
|
||||
{
|
||||
floatValue = 1 - floatValue;
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ static float scrollerWidth;
|
|||
}
|
||||
|
||||
/* Determine edge positions. */
|
||||
if (_rFlags.flipped_view)
|
||||
if ([self isFlipped])
|
||||
{
|
||||
topEdge = NSMinYEdge;
|
||||
bottomEdge = NSMaxYEdge;
|
||||
|
@ -1283,7 +1283,7 @@ static float scrollerWidth;
|
|||
float ypos;
|
||||
float scrollerY = [_horizScroller frame].origin.y;
|
||||
|
||||
if (_rFlags.flipped_view)
|
||||
if ([self isFlipped])
|
||||
{
|
||||
ypos = scrollerY - 1;
|
||||
}
|
||||
|
@ -1337,7 +1337,7 @@ static float scrollerWidth;
|
|||
{
|
||||
[_contentView setDocumentView: aView];
|
||||
|
||||
if (_contentView && !_contentView->_rFlags.flipped_view)
|
||||
if (_contentView && ![_contentView isFlipped])
|
||||
{
|
||||
[_vertScroller setFloatValue: 1];
|
||||
}
|
||||
|
|
|
@ -956,7 +956,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
* Images are always drawn with their bottom-left corner at the origin
|
||||
* so we must adjust the position to take account of a flipped view.
|
||||
*/
|
||||
if (_rFlags.flipped_view)
|
||||
if ([self isFlipped])
|
||||
{
|
||||
dimpleOrigin.y += dimpleSize.height;
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
else
|
||||
{
|
||||
NSRect superviewsVisibleRect;
|
||||
BOOL wasFlipped = _super_view->_rFlags.flipped_view;
|
||||
BOOL wasFlipped = [_super_view isFlipped];
|
||||
NSAffineTransform *pMatrix = [_super_view _matrixToWindow];
|
||||
NSAffineTransformStruct ts = [pMatrix transformStruct];
|
||||
|
||||
|
@ -321,7 +321,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
(*preImp)(_matrixToWindow, preSel, _frameMatrix);
|
||||
}
|
||||
|
||||
if (_rFlags.flipped_view != wasFlipped)
|
||||
if ([self isFlipped] != wasFlipped)
|
||||
{
|
||||
/*
|
||||
* The flipping process must result in a coordinate system that
|
||||
|
@ -604,9 +604,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
//_nextKeyView = 0;
|
||||
//_previousKeyView = 0;
|
||||
|
||||
// cache as optimization
|
||||
_rFlags.flipped_view = [self isFlipped];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1953,7 +1950,7 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
|
|||
}
|
||||
if (_autoresizingMask & (NSViewMaxYMargin | NSViewMinYMargin))
|
||||
{
|
||||
if (_super_view && _super_view->_rFlags.flipped_view == YES)
|
||||
if (_super_view && [_super_view isFlipped])
|
||||
{
|
||||
if (_autoresizingMask & NSViewMaxYMargin)
|
||||
{
|
||||
|
@ -2014,7 +2011,7 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
|
|||
@"\t frame %@, flip %d",
|
||||
NSStringFromRect(wrect),
|
||||
self, _window, NSStringFromRect([_window frame]),
|
||||
NSStringFromRect(_frame),_rFlags.flipped_view);
|
||||
NSStringFromRect(_frame), [self isFlipped]);
|
||||
if (viewIsPrinting == nil)
|
||||
{
|
||||
[_window->_rectsBeingDrawn addObject: [NSValue valueWithRect: wrect]];
|
||||
|
@ -2110,7 +2107,7 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
|
|||
|
||||
/* Tell backends that images are drawn upside down. Obsolete?
|
||||
This is needed when a backend is able to handle full image transformation. */
|
||||
GSWSetViewIsFlipped(ctxt, _rFlags.flipped_view);
|
||||
GSWSetViewIsFlipped(ctxt, [self isFlipped]);
|
||||
}
|
||||
|
||||
- (void) _setIgnoresBacking: (BOOL) flag
|
||||
|
@ -3362,7 +3359,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
*/
|
||||
- (BOOL) mouse: (NSPoint)aPoint inRect: (NSRect)aRect
|
||||
{
|
||||
return NSMouseInRect (aPoint, aRect, _rFlags.flipped_view);
|
||||
return NSMouseInRect (aPoint, aRect, [self isFlipped]);
|
||||
}
|
||||
|
||||
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
|
||||
|
@ -4568,8 +4565,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
* _previousKeyView = 0;
|
||||
*/
|
||||
|
||||
_rFlags.flipped_view = [self isFlipped];
|
||||
|
||||
// previous and next key views...
|
||||
prevKeyView = [aDecoder decodeObjectForKey: @"NSPreviousKeyView"];
|
||||
nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||
|
@ -4653,8 +4648,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
[self setNextKeyView: [aDecoder decodeObject]];
|
||||
[[aDecoder decodeObject] setNextKeyView: self];
|
||||
|
||||
_rFlags.flipped_view = [self isFlipped];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
||||
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue