From 2e9684e9a7662adc7d2235c96bfbf59271097908 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Wed, 3 Nov 2010 10:37:51 -0700 Subject: [PATCH] Fix for bottom corner view of CPScrollView being broken in CPCoding circumstances (normal coding, nib2cibing, Atlas, etc.). Reviewed by me. --- AppKit/CPScrollView.j | 32 ++++++++++++++++---------------- Tools/nib2cib/NSScrollView.j | 5 ++++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j index b3def44bc..69d128edb 100644 --- a/AppKit/CPScrollView.j +++ b/AppKit/CPScrollView.j @@ -1008,19 +1008,20 @@ @end -var CPScrollViewContentViewKey = "CPScrollViewContentView", - CPScrollViewHeaderClipViewKey = "CPScrollViewHeaderClipViewKey", - CPScrollViewVLineScrollKey = "CPScrollViewVLineScroll", - CPScrollViewHLineScrollKey = "CPScrollViewHLineScroll", - CPScrollViewVPageScrollKey = "CPScrollViewVPageScroll", - CPScrollViewHPageScrollKey = "CPScrollViewHPageScroll", - CPScrollViewHasVScrollerKey = "CPScrollViewHasVScroller", - CPScrollViewHasHScrollerKey = "CPScrollViewHasHScroller", - CPScrollViewVScrollerKey = "CPScrollViewVScroller", - CPScrollViewHScrollerKey = "CPScrollViewHScroller", - CPScrollViewAutohidesScrollerKey = "CPScrollViewAutohidesScroller", - CPScrollViewCornerViewKey = "CPScrollViewCornerViewKey", - CPScrollViewBorderTypeKey = "CPScrollViewBorderTypeKey"; +var CPScrollViewContentViewKey = @"CPScrollViewContentView", + CPScrollViewHeaderClipViewKey = @"CPScrollViewHeaderClipViewKey", + CPScrollViewVLineScrollKey = @"CPScrollViewVLineScroll", + CPScrollViewHLineScrollKey = @"CPScrollViewHLineScroll", + CPScrollViewVPageScrollKey = @"CPScrollViewVPageScroll", + CPScrollViewHPageScrollKey = @"CPScrollViewHPageScroll", + CPScrollViewHasVScrollerKey = @"CPScrollViewHasVScroller", + CPScrollViewHasHScrollerKey = @"CPScrollViewHasHScroller", + CPScrollViewVScrollerKey = @"CPScrollViewVScroller", + CPScrollViewHScrollerKey = @"CPScrollViewHScroller", + CPScrollViewAutohidesScrollerKey = @"CPScrollViewAutohidesScroller", + CPScrollViewCornerViewKey = @"CPScrollViewCornerViewKey", + CPScrollViewBottomCornerViewKey = @"CPScrollViewBottomCornerViewKey", + CPScrollViewBorderTypeKey = @"CPScrollViewBorderTypeKey"; @implementation CPScrollView (CPCoding) @@ -1043,9 +1044,6 @@ var CPScrollViewContentViewKey = "CPScrollViewContentView", [self addSubview:_headerClipView]; } - _bottomCornerView = [[CPView alloc] init]; - [self addSubview:_bottomCornerView]; - _verticalScroller = [aCoder decodeObjectForKey:CPScrollViewVScrollerKey]; _horizontalScroller = [aCoder decodeObjectForKey:CPScrollViewHScrollerKey]; @@ -1056,6 +1054,7 @@ var CPScrollViewContentViewKey = "CPScrollViewContentView", _borderType = [aCoder decodeIntForKey:CPScrollViewBorderTypeKey]; _cornerView = [aCoder decodeObjectForKey:CPScrollViewCornerViewKey]; + _bottomCornerView = [aCoder decodeObjectForKey:CPScrollViewBottomCornerViewKey]; // Do to the anything goes nature of decoding, our subviews may not exist yet, so layout at the end of the run loop when we're sure everything is in a correct state. [[CPRunLoop currentRunLoop] performSelector:@selector(reflectScrolledClipView:) target:self argument:_contentView order:0 modes:[CPDefaultRunLoopMode]]; @@ -1084,6 +1083,7 @@ var CPScrollViewContentViewKey = "CPScrollViewContentView", [aCoder encodeBool:_autohidesScrollers forKey:CPScrollViewAutohidesScrollerKey]; [aCoder encodeObject:_cornerView forKey:CPScrollViewCornerViewKey]; + [aCoder encodeObject:_bottomCornerView forKey:CPScrollViewBottomCornerViewKey]; [aCoder encodeInt:_borderType forKey:CPScrollViewBorderTypeKey]; } diff --git a/Tools/nib2cib/NSScrollView.j b/Tools/nib2cib/NSScrollView.j index a39fdbf4d..e1e7759e6 100644 --- a/Tools/nib2cib/NSScrollView.j +++ b/Tools/nib2cib/NSScrollView.j @@ -37,7 +37,10 @@ _headerClipView = [aCoder decodeObjectForKey:"NSHeaderClipView"]; _cornerView = [aCoder decodeObjectForKey:"NSCornerView"]; - + _bottomCornerView = [[CPView alloc] init]; + + [self addSubview:_bottomCornerView]; + _hasVerticalScroller = !!(flags & (1 << 4)); _hasHorizontalScroller = !!(flags & (1 << 5)); _autohidesScrollers = !!(flags & (1 << 9));