10 Commits

Author SHA1 Message Date
Vadim Shpakovski a3a459b4e4 Merge pull request #52 from starkos/flat-button-style
Flat button style
2014-11-24 17:33:12 +03:00
Jason Perkins 443e2db73d Fix indentation on previous commits: tabs to four spaces 2014-11-24 08:15:24 -05:00
Jason Perkins 5c7dd53380 Add new "flat" button style
Hides the button border and background; good for placing several shortcut buttons into a table view.
2014-11-24 08:07:41 -05:00
Vadim Shpakovski 72904d4dde Merge pull request #51 from starkos/userdefaults-semicolon-fix
Fix "Parse issue: Semicolon before method body is ignored"
2014-11-21 16:21:47 +03:00
Jason Perkins aa6c9fbab9 Fix "Parse issue: Semicolon before method body is ignored" 2014-11-21 07:54:39 -05:00
Vadim Shpakovski 7308a0927d Fixes possible memory leak. 2014-11-03 15:46:37 +03:00
Vadim Shpakovski d95c03289c Final touches to Podspec. 2014-09-22 14:06:03 +02:00
Vadim Shpakovski 14a9a4c4a6 Fixed Podspec. 2014-09-22 14:02:19 +02:00
Vadim Shpakovski 9266e38517 Polished Pod spec. 2014-09-22 13:59:45 +02:00
Vadim Shpakovski ddab66d2c0 Updated podspec. 2014-09-22 13:47:40 +02:00
6 changed files with 30 additions and 26 deletions
+1 -7
View File
@@ -25,7 +25,7 @@
return shared;
}
+ (void)registerGlobalShortcutWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler;
+ (void)registerGlobalShortcutWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler
{
MASShortcutUserDefaultsHotKey *hotKey = [[MASShortcutUserDefaultsHotKey alloc] initWithUserDefaultsKey:userDefaultsKey handler:handler];
[[self registeredUserDefaultsHotKeys] setObject:hotKey forKey:userDefaultsKey];
@@ -54,12 +54,6 @@
NSString *_observableKeyPath;
}
@synthesize monitor = _monitor;
@synthesize handler = _handler;
@synthesize userDefaultsKey = _userDefaultsKey;
#pragma mark -
void *MASShortcutUserDefaultsContext = &MASShortcutUserDefaultsContext;
- (id)initWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler
+4 -2
View File
@@ -320,6 +320,7 @@ BOOL MASShortcutAllowsAnyHotkeyWithOptionModifier = NO;
- (BOOL)isTakenError:(NSError **)outError
{
CFArrayRef globalHotKeys;
BOOL isTaken = NO;
if (CopySymbolicHotKeys(&globalHotKeys) == noErr) {
// Enumerate all global hotkeys and check if any of them matches current shortcut
@@ -341,12 +342,13 @@ BOOL MASShortcutAllowsAnyHotkeyWithOptionModifier = NO;
NSDictionary *info = [NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey];
*outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:info];
}
return YES;
isTaken = YES;
break;
}
}
CFRelease(globalHotKeys);
}
return [self isKeyEquivalent:self.keyCodeStringForKeyEquivalent flags:self.modifierFlags takenInMenu:[NSApp mainMenu] error:outError];
return (isTaken || [self isKeyEquivalent:self.keyCodeStringForKeyEquivalent flags:self.modifierFlags takenInMenu:[NSApp mainMenu] error:outError]);
}
@end
+12 -11
View File
@@ -1,13 +1,14 @@
Pod::Spec.new do |s|
s.name = 'MASShortcut'
s.version = '1.2.3'
s.summary = 'Modern framework for managing global keyboard shortcuts compatible with Mac App Store'
s.homepage = 'https://github.com/sonoramac/MASShortcut'
s.authors = { 'Vadim Shpakovski' => 'vadim@shpakovski.com' }
s.license = 'BSD 2-clause'
s.source = { :git => 'git@github.com:shpakovski/MASShortcut.git', :tag => '1.2.3' }
s.source_files = '*.{h,m}'
s.framework = 'Carbon'
s.requires_arc = true
s.platform = :osx
s.osx.deployment_target = "10.7"
s.name = 'MASShortcut'
s.version = '1.3.1'
s.summary = 'Modern framework for managing global keyboard shortcuts compatible with Mac App Store'
s.homepage = 'https://github.com/shpakovski/MASShortcut'
s.authors = { 'Vadim Shpakovski' => 'vadim@shpakovski.com' }
s.license = 'BSD 2-clause'
s.source = { :git => 'https://github.com/shpakovski/MASShortcut.git', :tag => '1.3.1' }
s.source_files = '*.{h,m}'
s.osx.frameworks = 'Carbon', 'AppKit'
s.requires_arc = true
end
-5
View File
@@ -45,11 +45,6 @@ void *MASAssociatedDefaultsObserver = &MASAssociatedDefaultsObserver;
BOOL _internalShortcutChange;
}
@synthesize userDefaultsKey = _userDefaultsKey;
@synthesize shortcutView = _shortcutView;
#pragma mark -
- (id)initWithShortcutView:(MASShortcutView *)shortcutView userDefaultsKey:(NSString *)userDefaultsKey
{
self = [super init];
+2 -1
View File
@@ -5,7 +5,8 @@
typedef enum {
MASShortcutViewAppearanceDefault = 0, // Height = 19 px
MASShortcutViewAppearanceTexturedRect, // Height = 25 px
MASShortcutViewAppearanceRounded // Height = 43 px
MASShortcutViewAppearanceRounded, // Height = 43 px
MASShortcutViewAppearanceFlat
} MASShortcutViewAppearance;
@interface MASShortcutView : NSView
+11
View File
@@ -107,6 +107,12 @@
_shortcutCell.bezelStyle = NSRoundedBezelStyle;
break;
}
case MASShortcutViewAppearanceFlat: {
self.wantsLayer = YES;
_shortcutCell.backgroundColor = [NSColor clearColor];
_shortcutCell.bordered = NO;
break;
}
}
}
@@ -176,6 +182,10 @@
[_shortcutCell drawWithFrame:CGRectOffset(frame, 0.0, 1.0) inView:self];
break;
}
case MASShortcutViewAppearanceFlat: {
[_shortcutCell drawWithFrame:frame inView:self];
break;
}
}
}
@@ -227,6 +237,7 @@
switch (self.appearance) {
case MASShortcutViewAppearanceTexturedRect: hintButtonWidth += 2.0; break;
case MASShortcutViewAppearanceRounded: hintButtonWidth += 3.0; break;
case MASShortcutViewAppearanceFlat: hintButtonWidth -= 8.0 - (_shortcutCell.font.pointSize - BUTTON_FONT_SIZE); break;
default: break;
}
CGRectDivide(self.bounds, &hintRect, &shortcutRect, hintButtonWidth, CGRectMaxXEdge);