Skip to content

Commit

Permalink
Merge remote-tracking branch 'galaxas0/upstream' (pull request github#85
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jspahrsummers committed Oct 1, 2012
2 parents 33e3fde + 2fe3834 commit 638c596
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 171 deletions.
8 changes: 0 additions & 8 deletions ExampleProject/Example/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,5 @@

int main(int argc, char *argv[])
{
SInt32 major = 0;
SInt32 minor = 0;
Gestalt(gestaltSystemVersionMajor, &major);
Gestalt(gestaltSystemVersionMinor, &minor);
if((major == 10 && minor >= 7) || major >= 11) {
AtLeastLion = YES;
}

return NSApplicationMain(argc, (const char **)argv);
}
30 changes: 1 addition & 29 deletions TwUI.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions lib/UIKit/TUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#import "TUIScrollView+TUIBridgedScrollView.h"
#import "TUIStretchableImage.h"
#import "TUIStringDrawing.h"
#import "TUIStyledView.h"
#import "TUITableView+Additions.h"
#import "TUITableView.h"
#import "TUITableViewCell.h"
Expand All @@ -58,5 +57,3 @@
#import "TUIViewController.h"
#import "TUIViewNSViewContainer.h"
#import "NSFont+TUIExtensions.h"

extern BOOL AtLeastLion; // set at launch
17 changes: 0 additions & 17 deletions lib/UIKit/TUIKit.m

This file was deleted.

1 change: 1 addition & 0 deletions lib/UIKit/TUILayoutManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
*/
- (void)addLayoutConstraint:(TUILayoutConstraint *)constraint toView:(TUIView *)view;
- (void)removeLayoutConstraint:(TUILayoutConstraint *)constraint fromView:(TUIView *)view;
- (void)removeLayoutConstraintsFromView:(TUIView *)view;

- (NSArray *)layoutConstraintsOnView:(TUIView *)view;
Expand Down
10 changes: 10 additions & 0 deletions lib/UIKit/TUILayoutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ - (void)addLayoutConstraint:(TUILayoutConstraint *)constraint toView:(TUIView *)
[self beginProcessingView:view];
}

- (void)removeLayoutConstraint:(TUILayoutConstraint *)constraint fromView:(TUIView *)view {
TUILayoutContainer *viewContainer = [self.constraints objectForKey:view];
if(viewContainer == nil) {
return;
}

[[viewContainer layoutConstraints] removeObject:constraint];
[self beginProcessingView:view];
}

- (void)removeLayoutConstraintsFromView:(TUIView *)view {
TUILayoutContainer *viewContainer = [self.constraints objectForKey:view];
[[viewContainer layoutConstraints] removeAllObjects];
Expand Down
2 changes: 0 additions & 2 deletions lib/UIKit/TUINSView.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
- (BOOL)isHoveringSubviewOfView:(TUIView *)v; // v or subview of v
- (BOOL)isHoveringView:(TUIView *)v; // only v

- (void)ab_setIsOpaque:(BOOL)o __attribute__((deprecated)); // don't use this

- (void)tui_setOpaque:(BOOL)o;

- (BOOL)isWindowKey;
Expand Down
5 changes: 0 additions & 5 deletions lib/UIKit/TUINSView.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ - (void)resetCursorRects
f.origin = NSZeroPoint;
[self addCursorRect:f cursor:[NSCursor arrowCursor]];
}

- (void)ab_setIsOpaque:(BOOL)o
{
opaque = o;
}

- (void)tui_setOpaque:(BOOL)o
{
Expand Down
29 changes: 22 additions & 7 deletions lib/UIKit/TUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
limitations under the License.
*/

#import <CoreServices/CoreServices.h>
#import "TUIScrollView.h"
#import "TUIKit.h"
#import "TUIScrollKnob.h"
Expand Down Expand Up @@ -59,6 +60,22 @@ @implementation TUIScrollView
@synthesize decelerationRate;
@synthesize resizeKnobSize;

// Default to non-Lion behavior to prevent breakage.
static BOOL isAtleastLion = NO;

+ (void)initialize {
if(self.class != TUIScrollView.class)
return;

SInt32 major = 0;
SInt32 minor = 0;

Gestalt(gestaltSystemVersionMajor, &major);
Gestalt(gestaltSystemVersionMinor, &minor);

isAtleastLion = ((major == 10 && minor >= 7) || major > 11);
}

+ (Class)layerClass
{
return [CAScrollLayer class];
Expand All @@ -72,7 +89,7 @@ - (id)initWithFrame:(CGRect)frame

decelerationRate = 0.88;

_scrollViewFlags.bounceEnabled = (FORCE_ENABLE_BOUNCE || AtLeastLion || [[NSUserDefaults standardUserDefaults] boolForKey:@"ForceEnableScrollBouncing"]);
_scrollViewFlags.bounceEnabled = (FORCE_ENABLE_BOUNCE || isAtleastLion || [[NSUserDefaults standardUserDefaults] boolForKey:@"ForceEnableScrollBouncing"]);
_scrollViewFlags.alwaysBounceVertical = FALSE;
_scrollViewFlags.alwaysBounceHorizontal = FALSE;

Expand Down Expand Up @@ -332,11 +349,8 @@ - (CGPoint)_fixProposedContentOffset:(CGPoint)offset

- (void)setResizeKnobSize:(CGSize)s
{
if(AtLeastLion) {
// ignore
} else {
if(!isAtleastLion)
resizeKnobSize = s;
}
}

- (BOOL)_verticalScrollKnobNeededForContentSize:(CGSize)size {
Expand Down Expand Up @@ -1002,7 +1016,8 @@ - (void)endGestureWithEvent:(NSEvent *)event
if(_scrollViewFlags.bounceEnabled) {
_scrollViewFlags.gestureBegan = 0;
[self _startThrow];
if(AtLeastLion) {

if(isAtleastLion) {
_scrollViewFlags.ignoreNextScrollPhaseNormal_10_7 = 1;
}
}
Expand All @@ -1019,7 +1034,7 @@ - (void)scrollWheel:(NSEvent *)event
{
int phase = ScrollPhaseNormal;

if(AtLeastLion) {
if(isAtleastLion) {
SEL s = @selector(momentumPhase);
if([event respondsToSelector:s]) {
NSInteger (*imp)(id,SEL) = (NSInteger(*)(id,SEL))[event methodForSelector:s];
Expand Down
17 changes: 0 additions & 17 deletions lib/UIKit/TUIStyledView.h

This file was deleted.

40 changes: 0 additions & 40 deletions lib/UIKit/TUIStyledView.m

This file was deleted.

1 change: 1 addition & 0 deletions lib/UIKit/TUIView+Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@property (nonatomic, copy) NSString *layoutName;

- (void)addLayoutConstraint:(TUILayoutConstraint *)constraint;
- (void)removeLayoutConstraint:(TUILayoutConstraint *)constraint;
- (NSArray *)layoutConstraints;
- (void)removeAllLayoutConstraints;

Expand Down
4 changes: 4 additions & 0 deletions lib/UIKit/TUIView+Layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ - (void)addLayoutConstraint:(TUILayoutConstraint *)constraint {
[[TUILayoutManager sharedLayoutManager] addLayoutConstraint:constraint toView:self];
}

- (void)removeLayoutConstraint:(TUILayoutConstraint *)constraint {
[[TUILayoutManager sharedLayoutManager] removeLayoutConstraint:constraint fromView:self];
}

- (NSArray *)layoutConstraints {
return [[TUILayoutManager sharedLayoutManager] layoutConstraintsOnView:self];
}
Expand Down
21 changes: 0 additions & 21 deletions lib/UIKit/TUIView+NSTextInputClient.h

This file was deleted.

21 changes: 0 additions & 21 deletions lib/UIKit/TUIView+NSTextInputClient.m

This file was deleted.

2 changes: 1 addition & 1 deletion lib/UIKit/TUIView.m
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ - (void)displayLayer:(CALayer *)layer
CGContextSetRGBFillColor(context, 0, 1, 0, 0.3);
} else {
CGContextSetRGBFillColor(context, 1, 0, 0, 0.3);
CGContextFillRect(context, rectToDraw);
}
CGContextFillRect(context, rectToDraw);
#endif

layer.contents = TUIGraphicsGetImageFromCurrentImageContext();
Expand Down

0 comments on commit 638c596

Please sign in to comment.