diff options
| author | Tomáš Znamenáček | 2014-08-07 14:04:32 +0200 |
|---|---|---|
| committer | Tomáš Znamenáček | 2015-01-07 15:42:22 +0100 |
| commit | 6128e529ea5c0d09de65dcbbc00a299f6b871735 (patch) | |
| tree | 319c8bd2a99055a6185c3c742fb1caa9531cecd9 | |
| parent | 80808eb6d7590dc2f4ed0bd3f5873c7472010a7b (diff) | |
| download | MASShortcut-6128e529ea5c0d09de65dcbbc00a299f6b871735.tar.bz2 | |
Whitespace fixes.
| -rw-r--r-- | Framework/MASKeyCodes.h | 28 | ||||
| -rw-r--r-- | Framework/MASShortcutMonitor.m | 8 | ||||
| -rw-r--r-- | Framework/MASShortcutValidator.m | 4 | ||||
| -rw-r--r-- | Framework/MASShortcutView+Bindings.m | 2 | ||||
| -rw-r--r-- | Framework/MASShortcutView.m | 80 | ||||
| -rw-r--r-- | README.md | 2 |
6 files changed, 62 insertions, 62 deletions
diff --git a/Framework/MASKeyCodes.h b/Framework/MASKeyCodes.h index 9fb5b02..8c1ce06 100644 --- a/Framework/MASKeyCodes.h +++ b/Framework/MASKeyCodes.h @@ -4,22 +4,22 @@ enum { kMASShortcutGlyphEject = 0x23CF, kMASShortcutGlyphClear = 0x2715, - kMASShortcutGlyphDeleteLeft = 0x232B, - kMASShortcutGlyphDeleteRight = 0x2326, + kMASShortcutGlyphDeleteLeft = 0x232B, + kMASShortcutGlyphDeleteRight = 0x2326, kMASShortcutGlyphLeftArrow = 0x2190, - kMASShortcutGlyphRightArrow = 0x2192, - kMASShortcutGlyphUpArrow = 0x2191, - kMASShortcutGlyphDownArrow = 0x2193, - kMASShortcutGlyphEscape = 0x238B, - kMASShortcutGlyphHelp = 0x003F, + kMASShortcutGlyphRightArrow = 0x2192, + kMASShortcutGlyphUpArrow = 0x2191, + kMASShortcutGlyphDownArrow = 0x2193, + kMASShortcutGlyphEscape = 0x238B, + kMASShortcutGlyphHelp = 0x003F, kMASShortcutGlyphPageDown = 0x21DF, - kMASShortcutGlyphPageUp = 0x21DE, - kMASShortcutGlyphTabRight = 0x21E5, - kMASShortcutGlyphReturn = 0x2305, - kMASShortcutGlyphReturnR2L = 0x21A9, - kMASShortcutGlyphPadClear = 0x2327, - kMASShortcutGlyphNorthwestArrow = 0x2196, - kMASShortcutGlyphSoutheastArrow = 0x2198, + kMASShortcutGlyphPageUp = 0x21DE, + kMASShortcutGlyphTabRight = 0x21E5, + kMASShortcutGlyphReturn = 0x2305, + kMASShortcutGlyphReturnR2L = 0x21A9, + kMASShortcutGlyphPadClear = 0x2327, + kMASShortcutGlyphNorthwestArrow = 0x2196, + kMASShortcutGlyphSoutheastArrow = 0x2198, } MASShortcutGlyph; NS_INLINE NSString* NSStringFromMASKeyCode(unsigned short ch) diff --git a/Framework/MASShortcutMonitor.m b/Framework/MASShortcutMonitor.m index d175b82..cb89ce1 100644 --- a/Framework/MASShortcutMonitor.m +++ b/Framework/MASShortcutMonitor.m @@ -71,13 +71,13 @@ static OSStatus MASCarbonEventCallback(EventHandlerCallRef, EventRef, void*); - (void) handleEvent: (EventRef) event { - if (GetEventClass(event) != kEventClassKeyboard) { + if (GetEventClass(event) != kEventClassKeyboard) { return; } - EventHotKeyID hotKeyID; - OSStatus status = GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotKeyID), NULL, &hotKeyID); - if (status != noErr || hotKeyID.signature != MASHotKeySignature) { + EventHotKeyID hotKeyID; + OSStatus status = GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotKeyID), NULL, &hotKeyID); + if (status != noErr || hotKeyID.signature != MASHotKeySignature) { return; } diff --git a/Framework/MASShortcutValidator.m b/Framework/MASShortcutValidator.m index 4fcba9b..1db3ed9 100644 --- a/Framework/MASShortcutValidator.m +++ b/Framework/MASShortcutValidator.m @@ -80,8 +80,8 @@ - (BOOL) isShortcutAlreadyTakenBySystem: (MASShortcut*) shortcut explanation: (NSString**) explanation { - CFArrayRef globalHotKeys; - if (CopySymbolicHotKeys(&globalHotKeys) == noErr) { + CFArrayRef globalHotKeys; + if (CopySymbolicHotKeys(&globalHotKeys) == noErr) { // Enumerate all global hotkeys and check if any of them matches current shortcut for (CFIndex i = 0, count = CFArrayGetCount(globalHotKeys); i < count; i++) { diff --git a/Framework/MASShortcutView+Bindings.m b/Framework/MASShortcutView+Bindings.m index 7a6064c..d8e10bc 100644 --- a/Framework/MASShortcutView+Bindings.m +++ b/Framework/MASShortcutView+Bindings.m @@ -4,7 +4,7 @@ - (NSString*) associatedUserDefaultsKey { - NSDictionary* bindingInfo = [self infoForBinding:MASShortcutBinding]; + NSDictionary* bindingInfo = [self infoForBinding:MASShortcutBinding]; if (bindingInfo != nil) { NSString *keyPath = [bindingInfo objectForKey:NSObservedKeyPathKey]; NSString *key = [keyPath stringByReplacingOccurrencesOfString:@"values." withString:@""]; diff --git a/Framework/MASShortcutView.m b/Framework/MASShortcutView.m index 61df2d0..716edba 100644 --- a/Framework/MASShortcutView.m +++ b/Framework/MASShortcutView.m @@ -462,46 +462,46 @@ void *kUserDataHint = &kUserDataHint; // http://tomdalling.com/blog/cocoa/implementing-your-own-cocoa-bindings/ -(void) propagateValue:(id)value forBinding:(NSString*)binding; { - NSParameterAssert(binding != nil); - - //WARNING: bindingInfo contains NSNull, so it must be accounted for - NSDictionary* bindingInfo = [self infoForBinding:binding]; - if(!bindingInfo) - return; //there is no binding - - //apply the value transformer, if one has been set - NSDictionary* bindingOptions = [bindingInfo objectForKey:NSOptionsKey]; - if(bindingOptions){ - NSValueTransformer* transformer = [bindingOptions valueForKey:NSValueTransformerBindingOption]; - if(!transformer || (id)transformer == [NSNull null]){ - NSString* transformerName = [bindingOptions valueForKey:NSValueTransformerNameBindingOption]; - if(transformerName && (id)transformerName != [NSNull null]){ - transformer = [NSValueTransformer valueTransformerForName:transformerName]; - } - } - - if(transformer && (id)transformer != [NSNull null]){ - if([[transformer class] allowsReverseTransformation]){ - value = [transformer reverseTransformedValue:value]; - } else { - NSLog(@"WARNING: binding \"%@\" has value transformer, but it doesn't allow reverse transformations in %s", binding, __PRETTY_FUNCTION__); - } - } - } - - id boundObject = [bindingInfo objectForKey:NSObservedObjectKey]; - if(!boundObject || boundObject == [NSNull null]){ - NSLog(@"ERROR: NSObservedObjectKey was nil for binding \"%@\" in %s", binding, __PRETTY_FUNCTION__); - return; - } - - NSString* boundKeyPath = [bindingInfo objectForKey:NSObservedKeyPathKey]; - if(!boundKeyPath || (id)boundKeyPath == [NSNull null]){ - NSLog(@"ERROR: NSObservedKeyPathKey was nil for binding \"%@\" in %s", binding, __PRETTY_FUNCTION__); - return; - } - - [boundObject setValue:value forKeyPath:boundKeyPath]; + NSParameterAssert(binding != nil); + + //WARNING: bindingInfo contains NSNull, so it must be accounted for + NSDictionary* bindingInfo = [self infoForBinding:binding]; + if(!bindingInfo) + return; //there is no binding + + //apply the value transformer, if one has been set + NSDictionary* bindingOptions = [bindingInfo objectForKey:NSOptionsKey]; + if(bindingOptions){ + NSValueTransformer* transformer = [bindingOptions valueForKey:NSValueTransformerBindingOption]; + if(!transformer || (id)transformer == [NSNull null]){ + NSString* transformerName = [bindingOptions valueForKey:NSValueTransformerNameBindingOption]; + if(transformerName && (id)transformerName != [NSNull null]){ + transformer = [NSValueTransformer valueTransformerForName:transformerName]; + } + } + + if(transformer && (id)transformer != [NSNull null]){ + if([[transformer class] allowsReverseTransformation]){ + value = [transformer reverseTransformedValue:value]; + } else { + NSLog(@"WARNING: binding \"%@\" has value transformer, but it doesn't allow reverse transformations in %s", binding, __PRETTY_FUNCTION__); + } + } + } + + id boundObject = [bindingInfo objectForKey:NSObservedObjectKey]; + if(!boundObject || boundObject == [NSNull null]){ + NSLog(@"ERROR: NSObservedObjectKey was nil for binding \"%@\" in %s", binding, __PRETTY_FUNCTION__); + return; + } + + NSString* boundKeyPath = [bindingInfo objectForKey:NSObservedKeyPathKey]; + if(!boundKeyPath || (id)boundKeyPath == [NSNull null]){ + NSLog(@"ERROR: NSObservedKeyPathKey was nil for binding \"%@\" in %s", binding, __PRETTY_FUNCTION__); + return; + } + + [boundObject setValue:value forKeyPath:boundKeyPath]; } @end @@ -13,7 +13,7 @@ I hope, it is really easy: // and its height to 19. If you select another appearance style, // look up the correct height values in MASShortcutView.h. @property (nonatomic, weak) IBOutlet MASShortcutView *shortcutView; - + // Pick a preference key to store the shortcut between launches static NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut"; |
