Small reorganization of code: scroll header view and rulers in reflectedScrolledClipView:

method, rather than when generating the scroll command to the clipview


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15763 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2003-01-30 02:15:02 +00:00
parent 9d81314a7f
commit 98413373e6

View file

@ -317,32 +317,15 @@ static float scrollerWidth;
/* If view is flipped reverse the scroll direction */ /* If view is flipped reverse the scroll direction */
amount = -amount; amount = -amount;
} }
NSDebugLLog (@"NSScrollView", @"increment/decrement: amount = %f, flipped = %d", NSDebugLLog (@"NSScrollView",
amount, _contentView ? _contentView->_rFlags.flipped_view : 0); @"increment/decrement: amount = %f, flipped = %d",
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
point.y = clipViewBounds.origin.y + amount; point.y = clipViewBounds.origin.y + amount;
if (_hasHeaderView)
{
NSPoint scrollTo;
scrollTo = [_headerClipView bounds].origin; /* scrollToPoint: will call reflectScrolledClipView:, which will
scrollTo.x += point.x - clipViewBounds.origin.x; * update rules, headers, and scrollers. */
[_headerClipView scrollToPoint: scrollTo];
}
[_contentView scrollToPoint: point]; [_contentView scrollToPoint: point];
if (_rulersVisible == YES)
{
if (_hasHorizRuler)
{
[_horizRuler setNeedsDisplay: YES];
}
if (_hasVertRuler)
{
[_vertRuler setNeedsDisplay: YES];
}
}
} }
/** /**
@ -387,10 +370,6 @@ static float scrollerWidth;
} }
point.y = clipViewBounds.origin.y - amount; point.y = clipViewBounds.origin.y - amount;
[_contentView scrollToPoint: point]; [_contentView scrollToPoint: point];
if (_rulersVisible == YES && _hasVertRuler == YES)
{
[_vertRuler setNeedsDisplay: YES];
}
} }
/** /**
@ -434,11 +413,6 @@ static float scrollerWidth;
} }
point.y = clipViewBounds.origin.y + amount; point.y = clipViewBounds.origin.y + amount;
[_contentView scrollToPoint: point]; [_contentView scrollToPoint: point];
if (_rulersVisible == YES && _hasVertRuler == YES)
{
[_vertRuler setNeedsDisplay: YES];
}
} }
- (void) _doScroll: (NSScroller*)scroller - (void) _doScroll: (NSScroller*)scroller
@ -545,28 +519,9 @@ static float scrollerWidth;
} }
} }
if (_hasHeaderView) /* scrollToPoint will call reflectScrollerClipView, and that will
{ * update scrollers, rulers and headers */
NSPoint scrollTo;
scrollTo = [_headerClipView bounds].origin;
scrollTo.x += point.x - clipViewBounds.origin.x;
[_headerClipView scrollToPoint: scrollTo];
}
[_contentView scrollToPoint: point]; [_contentView scrollToPoint: point];
if (_rulersVisible == YES)
{
if (_hasHorizRuler)
{
[_horizRuler setNeedsDisplay: YES];
}
if (_hasVertRuler)
{
[_vertRuler setNeedsDisplay: YES];
}
}
} }
- (void) reflectScrolledClipView: (NSClipView *)aClipView - (void) reflectScrolledClipView: (NSClipView *)aClipView
@ -645,16 +600,25 @@ static float scrollerWidth;
headerClipViewOrigin = [_headerClipView bounds].origin; headerClipViewOrigin = [_headerClipView bounds].origin;
// If needed, scroll the headerview too /* If needed, scroll the headerview too. */
if (headerClipViewOrigin.x != clipViewBounds.origin.x) if (headerClipViewOrigin.x != clipViewBounds.origin.x)
{ {
headerClipViewOrigin.x = clipViewBounds.origin.x; headerClipViewOrigin.x = clipViewBounds.origin.x;
headerClipViewOrigin = [_headerClipView constrainScrollPoint:
headerClipViewOrigin];
[_headerClipView scrollToPoint: headerClipViewOrigin]; [_headerClipView scrollToPoint: headerClipViewOrigin];
} }
} }
if (_rulersVisible == YES)
{
if (_hasHorizRuler)
{
[_horizRuler setNeedsDisplay: YES];
}
if (_hasVertRuler)
{
[_vertRuler setNeedsDisplay: YES];
}
}
} }
- (void) setHorizontalRulerView: (NSRulerView *)aRulerView - (void) setHorizontalRulerView: (NSRulerView *)aRulerView