Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples building with latest xcode #77

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "1BE2EC80BAFB45464F850DCF6C22CB755957A826",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"74A9F3FD7617A9D8DBE0A59D7180A8FB90CAF746" : 9223372036854775807,
"1BE2EC80BAFB45464F850DCF6C22CB755957A826" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "C5D60C9A-8331-4F11-AB25-B2A5E1F71B98",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"74A9F3FD7617A9D8DBE0A59D7180A8FB90CAF746" : "",
"1BE2EC80BAFB45464F850DCF6C22CB755957A826" : "Butter\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Butter",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Butter.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/ButterKit\/Butter.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "1BE2EC80BAFB45464F850DCF6C22CB755957A826"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "ssh:\/\/xyndl.de:7451\/opt\/git\/avirem_mac",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "74A9F3FD7617A9D8DBE0A59D7180A8FB90CAF746"
}
]
}
6 changes: 3 additions & 3 deletions Butter/BTRActivityIndicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ typedef NS_ENUM(NSInteger, BTRActivityIndicatorStyle) {
@interface BTRActivityIndicator : BTRView

// Returns an activity indicator sized to the default indicator size.
- (instancetype)initWithActivityIndicatorStyle:(BTRActivityIndicatorStyle)style;
- (id)initWithActivityIndicatorStyle:(BTRActivityIndicatorStyle)style;

// Initializes the activity indicator with the default indicator style (BTRActivityIndicatorStyleGray).
- (instancetype)initWithFrame:(NSRect)frameRect;
- (id)initWithFrame:(NSRect)frameRect;

- (instancetype)initWithFrame:(NSRect)frameRect activityIndicatorStyle:(BTRActivityIndicatorStyle)style NS_DESIGNATED_INITIALIZER;
- (id)initWithFrame:(NSRect)frameRect activityIndicatorStyle:(BTRActivityIndicatorStyle)style;

// Starts and ends the animation of the activity indicator.
- (void)startAnimating;
Expand Down
51 changes: 24 additions & 27 deletions Butter/BTRActivityIndicator.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,39 @@ @interface BTRActivityIndicator()
@implementation BTRActivityIndicator
@synthesize progressShapeLayer = _progressShapeLayer;

//- (instancetype)initWithFrame:(NSRect)frame layerHosted:(BOOL)hostsLayer {
// return [super initWithFrame:frame layerHosted:hostsLayer];
//}

- (instancetype)initWithFrame:(NSRect)frame {
return [self initWithFrame:frame activityIndicatorStyle:BTRActivityIndicatorStyleGray];
return [self initWithFrame:frame activityIndicatorStyle:BTRActivityIndicatorStyleGray];
}

- (instancetype)initWithActivityIndicatorStyle:(BTRActivityIndicatorStyle)style {
CGFloat length = BTRActivityIndicatorDefaultFrameLength;
return [self initWithFrame:CGRectMake(0, 0, length, length) activityIndicatorStyle:style];
CGFloat length = BTRActivityIndicatorDefaultFrameLength;
return [self initWithFrame:CGRectMake(0, 0, length, length) activityIndicatorStyle:style];
}

- (instancetype)initWithFrame:(NSRect)frame activityIndicatorStyle:(BTRActivityIndicatorStyle)style {
self = [super initWithFrame:frame layerHosted:YES];
if (self == nil) return nil;
_activityIndicatorStyle = style;
_progressShapeColor = (style == BTRActivityIndicatorStyleGray ? [NSColor grayColor] : [NSColor whiteColor]);
_progressShapeCount = 12;
CGFloat minLength = fminf(CGRectGetWidth(frame), CGRectGetHeight(frame));
_progressShapeLength = ceilf(minLength / 4);
_progressShapeThickness = ceilf(minLength / _progressShapeCount);
_progressShapeSpread = _progressShapeLength;
_progressAnimationDuration = 1.f;
[self.layer addSublayer:self.replicatorLayer];
self.progressShapeLayer.opacity = 0.f;
[self accessibilitySetOverrideValue:NSAccessibilityProgressIndicatorRole forAttribute:NSAccessibilityRoleAttribute];
[self accessibilitySetOverrideValue:NSAccessibilityRoleDescription(NSAccessibilityProgressIndicatorRole, nil) forAttribute:NSAccessibilityRoleDescriptionAttribute];
return self;
self = [super initWithFrame:frame layerHosted:YES];
if (self == nil) return nil;
_activityIndicatorStyle = style;
_progressShapeColor = (style == BTRActivityIndicatorStyleGray ? [NSColor grayColor] : [NSColor whiteColor]);
_progressShapeCount = 12;
CGFloat minLength = fminf(CGRectGetWidth(frame), CGRectGetHeight(frame));
_progressShapeLength = ceilf(minLength / 4);
_progressShapeThickness = ceilf(minLength / _progressShapeCount);
_progressShapeSpread = _progressShapeLength;
_progressAnimationDuration = 1.f;
[self.layer addSublayer:self.replicatorLayer];
self.progressShapeLayer.opacity = 0.f;
[self accessibilitySetOverrideValue:NSAccessibilityProgressIndicatorRole forAttribute:NSAccessibilityRoleAttribute];
[self accessibilitySetOverrideValue:NSAccessibilityRoleDescription(NSAccessibilityProgressIndicatorRole, nil) forAttribute:NSAccessibilityRoleDescriptionAttribute];
return self;
}


- (void)setActivityIndicatorStyle:(BTRActivityIndicatorStyle)style {
self.progressShapeColor = (style == BTRActivityIndicatorStyleGray ? [NSColor grayColor] : [NSColor whiteColor]);
}
Expand Down
6 changes: 3 additions & 3 deletions Butter/BTRButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
@property (nonatomic, assign) BTRViewContentMode imageContentMode;

// Subclassing hooks
@property (readonly) CGRect backgroundImageFrame;
@property (readonly) CGRect imageFrame;
@property (readonly) CGRect labelFrame;
- (CGRect)backgroundImageFrame;
- (CGRect)imageFrame;
- (CGRect)labelFrame;

@end
4 changes: 2 additions & 2 deletions Butter/BTRButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ static void BTRButtonCommonInit(BTRButton *self) {
[self accessibilitySetOverrideValue:NSAccessibilityRoleDescription(NSAccessibilityButtonRole, nil) forAttribute:NSAccessibilityRoleDescriptionAttribute];
}

- (instancetype)initWithFrame:(NSRect)frameRect {
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self == nil) return nil;
BTRButtonCommonInit(self);
return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self == nil) return nil;
BTRButtonCommonInit(self);
Expand Down
4 changes: 2 additions & 2 deletions Butter/BTRControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ static void BTRControlCommonInit(BTRControl *self) {
self.content = [NSMutableDictionary dictionary];
}

- (instancetype)initWithFrame:(NSRect)frame {
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self == nil) return nil;
BTRControlCommonInit(self);
return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self == nil) return nil;
BTRControlCommonInit(self);
Expand Down
2 changes: 1 addition & 1 deletion Butter/BTRImageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef NS_ENUM(NSInteger, BTRViewContentMode) {

// The dedicated initializer. The bounds of the image view will
// be adjusted to match the size of the image.
- (instancetype)initWithImage:(NSImage *)image;
- (id)initWithImage:(NSImage *)image;

// The image displayed in the image view.
@property (nonatomic, strong) NSImage *image;
Expand Down
6 changes: 3 additions & 3 deletions Butter/BTRImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ @implementation BTRImageView {
NSTimer *_animationTimer;
}

- (instancetype)initWithFrame:(NSRect)frame {
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame layerHosted:YES];
if (self == nil) return nil;
BTRImageViewCommonInit(self);
return self;
}

- (instancetype)initWithImage:(NSImage *)image {
- (id)initWithImage:(NSImage *)image {
self = [self initWithFrame:(CGRect){ .size = image.size }];
self.image = image;
return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self == nil) return nil;
self.layer = [CALayer layer];
Expand Down
4 changes: 2 additions & 2 deletions Butter/BTRLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ static void BTRLabelCommonInit(BTRLabel *self) {
self.selectable = NO;
}

- (instancetype)initWithFrame:(NSRect)frame {
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self == nil) return nil;
BTRLabelCommonInit(self);
return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self == nil) return nil;
BTRLabelCommonInit(self);
Expand Down
14 changes: 7 additions & 7 deletions Butter/BTRPopUpButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@property (nonatomic, assign) NSTextAlignment textAlignment;

- (void)selectItemAtIndex:(NSUInteger)index;
@property (readonly) NSUInteger indexOfSelectedItem;
- (NSUInteger)indexOfSelectedItem;

// Adjust the width of the view to fit the content
- (void)sizeToFit;
Expand All @@ -35,22 +35,22 @@

// Can be overriden by subclasses to customize layout
// The frame of the image view
@property (readonly) NSRect imageFrame;
- (NSRect)imageFrame;

// The frame of the text label
@property (readonly) NSRect labelFrame;
- (NSRect)labelFrame;

// The frame of the arrow image view
@property (readonly) NSRect arrowFrame;
- (NSRect)arrowFrame;

// The padding between each element (between image and label, and label and arrow)
@property (readonly) CGFloat interElementSpacing;
- (CGFloat)interElementSpacing;

// The distance between the pop up button content and the view edges
@property (readonly) CGFloat edgeInset;
- (CGFloat)edgeInset;

// The width to fit all the content in the view (used by -sizeToFit)
@property (readonly) CGFloat widthToFit;
- (CGFloat)widthToFit;

// Returns the arrow image for the current `BTRControlState`
@property (nonatomic, strong, readonly) NSImage *currentArrowImage;
Expand Down
13 changes: 9 additions & 4 deletions Butter/BTRPopUpButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@interface BTRPopUpButtonLabel : BTRLabel
@end

@interface BTRPopUpButtonImageView : BTRImageView
@end

Expand All @@ -29,8 +30,7 @@ @interface BTRPopUpButtonContent : BTRControlContent
@end

@implementation BTRPopUpButton

@dynamic menu;
@synthesize menu = _menu;

#pragma mark - Initialization

Expand Down Expand Up @@ -153,6 +153,7 @@ - (NSUInteger)indexOfSelectedItem {

#pragma mark - Accessors

/*
- (void)setMenu:(NSMenu *)menu {
if (self.menu != menu) {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
Expand All @@ -162,7 +163,10 @@ - (void)setMenu:(NSMenu *)menu {
}
self.selectedItem = nil;
super.menu = menu;
if (self.menu) {

//NSLog(@"%@", self.menu);
if (self.menu)
{
self.menu.autoenablesItems = self.autoenablesItems;
// Register for notifications for when the menu closes. This is important
// because mouseUp: and mouseExited: are not normally called if the menu is closed
Expand All @@ -181,8 +185,9 @@ - (void)setMenu:(NSMenu *)menu {
// Force a menu update from the delegate once the menu is initially set
[self forceMenuUpdate];
}
//self.menu = menu;
}
}
}*/

- (void)setSelectedItem:(NSMenuItem *)selectedItem {
if (_selectedItem != selectedItem) {
Expand Down
2 changes: 1 addition & 1 deletion Butter/BTRScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@

// Returns the scroll view's content view that is an instance of BTRClipView, or
// nil if it does not exist.
@property (readonly, strong) BTRClipView *clipView;
- (BTRClipView *)clipView;

@end
2 changes: 1 addition & 1 deletion Butter/BTRScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @implementation BTRScrollView

#pragma mark Lifecycle

- (instancetype)initWithFrame:(NSRect)frameRect {
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self == nil) return nil;

Expand Down
24 changes: 17 additions & 7 deletions Butter/BTRSecureTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ @implementation BTRSecureTextField {
@synthesize state = _state;
@synthesize clickCount = _clickCount;

- (instancetype)initWithFrame:(NSRect)frame {
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self == nil) return nil;
BTRSecureTextFieldCommonInit(self);
return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self == nil) return nil;
BTRSecureTextFieldCommonInit(self);
Expand Down Expand Up @@ -438,7 +438,7 @@ - (void)sendActionsForControlEvents:(BTRControlEvents)events {
if (action.block != nil) {
action.block(events);
} else if (action.action != nil) { // the target can be nil
[NSApp sendAction:action.action to:action.target];
[NSApp sendAction:action.action to:action.target from:self];
}
}
}
Expand All @@ -452,15 +452,25 @@ - (BOOL)isFirstResponder {
}

- (BOOL)becomeFirstResponder {
[self.layer addAnimation:[self shadowOpacityAnimation] forKey:nil];
self.layer.shadowOpacity = 1.f;
self.highlighted = YES;
return [super becomeFirstResponder];

BOOL success = [super becomeFirstResponder];
if (success){
[self.layer addAnimation:[self shadowOpacityAnimation] forKey:nil];
self.layer.shadowOpacity = 1.f;
self.highlighted = YES;

NSTextView* textField = (NSTextView*) [self currentEditor];
if( [textField respondsToSelector: @selector(setInsertionPointColor:)] )
[textField setInsertionPointColor: [NSColor whiteColor]];
}

return success;
}

- (void)textDidEndEditing:(NSNotification *)notification {
[self.layer addAnimation:[self shadowOpacityAnimation] forKey:nil];
self.layer.shadowOpacity = 0.f;
[self sendActionsForControlEvents:BTRControlEventValueChanged];
[super textDidEndEditing:notification];
self.highlighted = NO;
}
Expand Down
Loading