Anonymous avatar Anonymous committed 7e3013b

Replaced ": " with ":" throughout this class. When combined with shortcut recorder having ": " may throw errors.

Comments (0)

Files changed (6)

 	EventHotKeyRef	mCarbonEventHotKeyRef;
 }
 
-- (id)initWithIdentifier: (id)identifier keyCombo: (PTKeyCombo*)combo;
+- (id)initWithIdentifier:(id)identifier keyCombo:(PTKeyCombo*)combo;
 - (id)init;
 
-- (void)setIdentifier: (id)ident;
+- (void)setIdentifier:(id)ident;
 - (id)identifier;
 
-- (void)setName: (NSString*)name;
+- (void)setName:(NSString*)name;
 - (NSString*)name;
 
-- (void)setKeyCombo: (PTKeyCombo*)combo;
+- (void)setKeyCombo:(PTKeyCombo*)combo;
 - (PTKeyCombo*)keyCombo;
 
-- (void)setTarget: (id)target;
+- (void)setTarget:(id)target;
 - (id)target;
-- (void)setAction: (SEL)action;
+- (void)setAction:(SEL)action;
 - (SEL)action;
 
 - (NSUInteger)carbonHotKeyID;
-- (void)setCarbonHotKeyID: (NSUInteger)hotKeyID;
+- (void)setCarbonHotKeyID:(NSUInteger)hotKeyID;
 
 - (EventHotKeyRef)carbonEventHotKeyRef;
 - (void)setCarbonEventHotKeyRef:(EventHotKeyRef)hotKeyRef;
 
 - (id)init
 {
-	return [self initWithIdentifier: nil keyCombo: nil];
+	return [self initWithIdentifier:nil keyCombo:nil];
 }
 
-- (id)initWithIdentifier: (id)identifier keyCombo: (PTKeyCombo*)combo
+- (id)initWithIdentifier:(id)identifier keyCombo:(PTKeyCombo*)combo
 {
 	self = [super init];
 
 	if( self )
 	{
-		[self setIdentifier: identifier];
-		[self setKeyCombo: combo];
+		[self setIdentifier:identifier];
+		[self setKeyCombo:combo];
 	}
 
 	return self;
 
 - (NSString*)description
 {
-	return [NSString stringWithFormat: @"<%@: %@, %@>", NSStringFromClass( [self class] ), [self identifier], [self keyCombo]];
+	return [NSString stringWithFormat:@"<%@:%@, %@>", NSStringFromClass( [self class] ), [self identifier], [self keyCombo]];
 }
 
 #pragma mark -
 
-- (void)setIdentifier: (id)ident
+- (void)setIdentifier:(id)ident
 {
 	[ident retain];
 	[mIdentifier release];
 	return mIdentifier;
 }
 
-- (void)setKeyCombo: (PTKeyCombo*)combo
+- (void)setKeyCombo:(PTKeyCombo*)combo
 {
 	if( combo == nil )
 		combo = [PTKeyCombo clearKeyCombo];
 	return mKeyCombo;
 }
 
-- (void)setName: (NSString*)name
+- (void)setName:(NSString*)name
 {
 	[name retain];
 	[mName release];
 	return mName;
 }
 
-- (void)setTarget: (id)target
+- (void)setTarget:(id)target
 {
 	mTarget = target;
 }
 	return mTarget;
 }
 
-- (void)setAction: (SEL)action
+- (void)setAction:(SEL)action
 {
 	mAction = action;
 }
 	return mCarbonHotKeyID;
 }
 
-- (void)setCarbonHotKeyID: (NSUInteger)hotKeyID;
+- (void)setCarbonHotKeyID:(NSUInteger)hotKeyID;
 {
 	mCarbonHotKeyID = hotKeyID;
 }
 	return mCarbonEventHotKeyRef;
 }
 
-- (void)setCarbonEventHotKeyRef: (EventHotKeyRef)hotKeyRef
+- (void)setCarbonEventHotKeyRef:(EventHotKeyRef)hotKeyRef
 {
 	mCarbonEventHotKeyRef = hotKeyRef;
 }
 
 - (void)invoke
 {
-	[mTarget performSelector: mAction withObject: self];
+	[mTarget performSelector:mAction withObject:self];
 }
 
 @end
 
 + (PTHotKeyCenter *)sharedCenter;
 
-- (BOOL)registerHotKey: (PTHotKey*)hotKey;
-- (void)unregisterHotKey: (PTHotKey*)hotKey;
+- (BOOL)registerHotKey:(PTHotKey*)hotKey;
+- (void)unregisterHotKey:(PTHotKey*)hotKey;
 
 - (NSArray*)allHotKeys;
-- (PTHotKey*)hotKeyWithIdentifier: (id)ident;
+- (PTHotKey*)hotKeyWithIdentifier:(id)ident;
 
-- (void)sendEvent: (NSEvent*)event;
+- (void)sendEvent:(NSEvent*)event;
 
 @end
 #import <Carbon/Carbon.h>
 
 @interface PTHotKeyCenter (Private)
-- (PTHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKey;
-- (PTHotKey*)_hotKeyForCarbonHotKeyID: (EventHotKeyID)hotKeyID;
+- (PTHotKey*)_hotKeyForCarbonHotKey:(EventHotKeyRef)carbonHotKey;
+- (PTHotKey*)_hotKeyForCarbonHotKeyID:(EventHotKeyID)hotKeyID;
 
 - (void)_updateEventHandler;
-- (void)_hotKeyDown: (PTHotKey*)hotKey;
-- (void)_hotKeyUp: (PTHotKey*)hotKey;
+- (void)_hotKeyDown:(PTHotKey*)hotKey;
+- (void)_hotKeyUp:(PTHotKey*)hotKey;
 static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon );
 @end
 
 
 #pragma mark -
 
-- (BOOL)registerHotKey: (PTHotKey*)hotKey
+- (BOOL)registerHotKey:(PTHotKey*)hotKey
 {
 	OSStatus err;
 	EventHotKeyID hotKeyID;
 	EventHotKeyRef carbonHotKey;
 
-	if( [[self allHotKeys] containsObject: hotKey] == YES )
-		[self unregisterHotKey: hotKey];
+	if( [[self allHotKeys] containsObject:hotKey] == YES )
+		[self unregisterHotKey:hotKey];
 
 	if( [[hotKey keyCombo] isValidHotKeyCombo] == NO )
 		return YES;
 	[hotKey setCarbonEventHotKeyRef:carbonHotKey];
 
 	if( hotKey )
-		[mHotKeys setObject: hotKey forKey: [NSNumber numberWithInteger:hotKeyID.id]];
+		[mHotKeys setObject:hotKey forKey:[NSNumber numberWithInteger:hotKeyID.id]];
 
 	[self _updateEventHandler];
 
 	return YES;
 }
 
-- (void)unregisterHotKey: (PTHotKey*)hotKey
+- (void)unregisterHotKey:(PTHotKey*)hotKey
 {
 	EventHotKeyRef carbonHotKey;
 
-	if( [[self allHotKeys] containsObject: hotKey] == NO )
+	if( [[self allHotKeys] containsObject:hotKey] == NO )
 		return;
 
 	carbonHotKey = [hotKey carbonEventHotKeyRef];
 		UnregisterEventHotKey( carbonHotKey );
 		//Watch as we ignore 'err':
 
-		[mHotKeys removeObjectForKey: [NSNumber numberWithInteger:[hotKey carbonHotKeyID]]];
+		[mHotKeys removeObjectForKey:[NSNumber numberWithInteger:[hotKey carbonHotKeyID]]];
 
 		[hotKey setCarbonHotKeyID:0];
 		[hotKey setCarbonEventHotKeyRef:NULL];
 	return [mHotKeys allValues];
 }
 
-- (PTHotKey*)hotKeyWithIdentifier: (id)ident
+- (PTHotKey*)hotKeyWithIdentifier:(id)ident
 {
 	NSEnumerator* hotKeysEnum = [[self allHotKeys] objectEnumerator];
 	PTHotKey* hotKey;
 
 	while( (hotKey = [hotKeysEnum nextObject]) != nil )
 	{
-		if( [[hotKey identifier] isEqual: ident] )
+		if( [[hotKey identifier] isEqual:ident] )
 			return hotKey;
 	}
 
 
 #pragma mark -
 
-- (PTHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKeyRef
+- (PTHotKey*)_hotKeyForCarbonHotKey:(EventHotKeyRef)carbonHotKeyRef
 {
 	NSEnumerator *e = [mHotKeys objectEnumerator];
 	PTHotKey *hotkey = nil;
 	return nil;
 }
 
-- (PTHotKey*)_hotKeyForCarbonHotKeyID: (EventHotKeyID)hotKeyID
+- (PTHotKey*)_hotKeyForCarbonHotKeyID:(EventHotKeyID)hotKeyID
 {
 	return [mHotKeys objectForKey:[NSNumber numberWithInteger:hotKeyID.id]];
 }
 	}
 }
 
-- (void)_hotKeyDown: (PTHotKey*)hotKey
+- (void)_hotKeyDown:(PTHotKey*)hotKey
 {
 	[hotKey invoke];
 }
 
-- (void)_hotKeyUp: (PTHotKey*)hotKey
+- (void)_hotKeyUp:(PTHotKey*)hotKey
 {
 }
 
-- (void)sendEvent: (NSEvent*)event
+- (void)sendEvent:(NSEvent*)event
 {
 	// Not sure why this is needed? - Andy Kim (Aug 23, 2009)
 
 			carbonHotKey= (EventHotKeyRef)[event data1]; //data1 is our hot key ref
 			if( carbonHotKey != nil )
 			{
-				PTHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
-				[self _hotKeyDown: hotKey];
+				PTHotKey* hotKey = [self _hotKeyForCarbonHotKey:carbonHotKey];
+				[self _hotKeyDown:hotKey];
 			}
 		}
 		else if( subType == 9 ) //9 is hot key up
 			carbonHotKey= (EventHotKeyRef)[event data1];
 			if( carbonHotKey != nil )
 			{
-				PTHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
-				[self _hotKeyUp: hotKey];
+				PTHotKey* hotKey = [self _hotKeyForCarbonHotKey:carbonHotKey];
+				[self _hotKeyUp:hotKey];
 			}
 		}
 	}
 }
 
-- (OSStatus)sendCarbonEvent: (EventRef)event
+- (OSStatus)sendCarbonEvent:(EventRef)event
 {
 	OSStatus err;
 	EventHotKeyID hotKeyID;
 	switch( GetEventKind( event ) )
 	{
 		case kEventHotKeyPressed:
-			[self _hotKeyDown: hotKey];
+			[self _hotKeyDown:hotKey];
 		break;
 
 		case kEventHotKeyReleased:
-			[self _hotKeyUp: hotKey];
+			[self _hotKeyUp:hotKey];
 		break;
 
 		default:
 
 static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon )
 {
-	return [[PTHotKeyCenter sharedCenter] sendCarbonEvent: inEvent];
+	return [[PTHotKeyCenter sharedCenter] sendCarbonEvent:inEvent];
 }
 
 @end
 }
 
 + (id)clearKeyCombo;
-+ (id)keyComboWithKeyCode: (NSInteger)keyCode modifiers: (NSUInteger)modifiers;
-- (id)initWithKeyCode: (NSInteger)keyCode modifiers: (NSUInteger)modifiers;
++ (id)keyComboWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers;
+- (id)initWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers;
 
-- (id)initWithPlistRepresentation: (id)plist;
+- (id)initWithPlistRepresentation:(id)plist;
 - (id)plistRepresentation;
 
-- (BOOL)isEqual: (PTKeyCombo*)combo;
+- (BOOL)isEqual:(PTKeyCombo*)combo;
 
 - (NSInteger)keyCode;
 - (NSUInteger)modifiers;
 
 + (id)clearKeyCombo
 {
-	return [self keyComboWithKeyCode: -1 modifiers: -1];
+	return [self keyComboWithKeyCode:-1 modifiers:-1];
 }
 
-+ (id)keyComboWithKeyCode: (NSInteger)keyCode modifiers: (NSUInteger)modifiers
++ (id)keyComboWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers
 {
-	return [[[self alloc] initWithKeyCode: keyCode modifiers: modifiers] autorelease];
+	return [[[self alloc] initWithKeyCode:keyCode modifiers:modifiers] autorelease];
 }
 
-- (id)initWithKeyCode: (NSInteger)keyCode modifiers: (NSUInteger)modifiers
+- (id)initWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers
 {
 	self = [super init];
 
 	return self;
 }
 
-- (id)initWithPlistRepresentation: (id)plist
+- (id)initWithPlistRepresentation:(id)plist
 {
 	int keyCode, modifiers;
 
 	}
 	else
 	{
-		keyCode = [[plist objectForKey: @"keyCode"] intValue];
+		keyCode = [[plist objectForKey:@"keyCode"] intValue];
 		if( keyCode < 0 ) keyCode = -1;
 
-		modifiers = [[plist objectForKey: @"modifiers"] intValue];
+		modifiers = [[plist objectForKey:@"modifiers"] intValue];
 		if( modifiers <= 0 ) modifiers = -1;
 	}
 
-	return [self initWithKeyCode: keyCode modifiers: modifiers];
+	return [self initWithKeyCode:keyCode modifiers:modifiers];
 }
 
 - (id)plistRepresentation
 {
 	return [NSDictionary dictionaryWithObjectsAndKeys:
-				[NSNumber numberWithInteger: [self keyCode]], @"keyCode",
-				[NSNumber numberWithInteger: [self modifiers]], @"modifiers",
+				[NSNumber numberWithInteger:[self keyCode]], @"keyCode",
+				[NSNumber numberWithInteger:[self modifiers]], @"modifiers",
 				nil];
 }
 
 	return [self retain];
 }
 
-- (BOOL)isEqual: (PTKeyCombo*)combo
+- (BOOL)isEqual:(PTKeyCombo*)combo
 {
 	return	[self keyCode] == [combo keyCode] &&
 			[self modifiers] == [combo modifiers];
 
 @implementation PTKeyCombo (UserDisplayAdditions)
 
-+ (NSString*)_stringForModifiers: (long)modifiers
++ (NSString*)_stringForModifiers:(long)modifiers
 {
 	static unichar modToChar[4][2] =
 	{
 	for( i = 0; i < 4; i++ )
 	{
 		if( modifiers & modToChar[i][0] )
-			str = [str stringByAppendingString: [NSString stringWithCharacters: &modToChar[i][1] length: 1]];
+			str = [str stringByAppendingString:[NSString stringWithCharacters:&modToChar[i][1] length:1]];
 	}
 
 	return str;
 
 	if( keyCodes == nil )
 	{
-		NSURL *url = [NSURL fileURLWithPath:[[NSBundle bundleForClass: self] pathForResource: @"PTKeyCodes" ofType: @"plist"]];
+		NSURL *url = [NSURL fileURLWithPath:[[NSBundle bundleForClass:self] pathForResource:@"PTKeyCodes" ofType:@"plist"]];
 		NSString *contents = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:NULL];
 		keyCodes = [[contents propertyList] retain];
 	}
 	return keyCodes;
 }
 
-+ (NSString*)_stringForKeyCode: (short)keyCode legacyKeyCodeMap: (NSDictionary*)dict
++ (NSString*)_stringForKeyCode:(short)keyCode legacyKeyCodeMap:(NSDictionary*)dict
 {
 	id key;
 	NSString* str;
 
-	key = [NSString stringWithFormat: @"%d", keyCode];
-	str = [dict objectForKey: key];
+	key = [NSString stringWithFormat:@"%d", keyCode];
+	str = [dict objectForKey:key];
 
 	if( !str )
-		str = [NSString stringWithFormat: @"%X", keyCode];
+		str = [NSString stringWithFormat:@"%X", keyCode];
 
 	return str;
 }
 
-+ (NSString*)_stringForKeyCode: (short)keyCode newKeyCodeMap: (NSDictionary*)dict
++ (NSString*)_stringForKeyCode:(short)keyCode newKeyCodeMap:(NSDictionary*)dict
 {
 	NSString* result;
 	NSString* keyCodeStr;
 	NSDictionary* unmappedKeys;
 	NSArray* padKeys;
 
-	keyCodeStr = [NSString stringWithFormat: @"%d", keyCode];
+	keyCodeStr = [NSString stringWithFormat:@"%d", keyCode];
 
 	//Handled if its not handled by translator
 	unmappedKeys = [dict objectForKey:@"unmappedKeys"];
-	result = [unmappedKeys objectForKey: keyCodeStr];
+	result = [unmappedKeys objectForKey:keyCodeStr];
 	if( result )
 		return result;
 
 
 	//Handle if its a key-pad key
 	padKeys = [dict objectForKey:@"padKeys"];
-	if( [padKeys indexOfObject: keyCodeStr] != NSNotFound )
+	if( [padKeys indexOfObject:keyCodeStr] != NSNotFound )
 	{
 		result = [NSString stringWithFormat:@"%@ %@", [dict objectForKey:@"padKeyString"], result];
 	}
 	return result;
 }
 
-+ (NSString*)_stringForKeyCode: (short)keyCode
++ (NSString*)_stringForKeyCode:(short)keyCode
 {
 	NSDictionary* dict;
 
 	dict = [self _keyCodesDictionary];
-	if( [[dict objectForKey: @"version"] intValue] <= 0 )
-		return [self _stringForKeyCode: keyCode legacyKeyCodeMap: dict];
+	if( [[dict objectForKey:@"version"] intValue] <= 0 )
+		return [self _stringForKeyCode:keyCode legacyKeyCodeMap:dict];
 
-	return [self _stringForKeyCode: keyCode newKeyCodeMap: dict];
+	return [self _stringForKeyCode:keyCode newKeyCodeMap:dict];
 }
 
 - (NSString*)keyCodeString
 {
-	// special case: the modifiers for the "clear" key are 0x0
+	// special case:the modifiers for the "clear" key are 0x0
 	if ( [self isClearCombo] ) return @"";
 
     return [[self class] _stringForKeyCode:[self keyCode]];
 
 - (NSUInteger)modifierMask
 {
-	// special case: the modifiers for the "clear" key are 0x0
+	// special case:the modifiers for the "clear" key are 0x0
 	if ( [self isClearCombo] ) return 0;
 
 	static NSUInteger modToChar[4][2] =
 
 	if( [self isValidHotKeyCombo] ) //This might have to change
 	{
-		desc = [NSString stringWithFormat: @"%@%@",
-				[[self class] _stringForModifiers: [self modifiers]],
-				[[self class] _stringForKeyCode: [self keyCode]]];
+		desc = [NSString stringWithFormat:@"%@%@",
+				[[self class] _stringForModifiers:[self modifiers]],
+				[[self class] _stringForKeyCode:[self keyCode]]];
 	}
 	else
 	{
-		desc = NSLocalizedString( @"(None)", @"Hot Keys: Key Combo text for 'empty' combo" );
+		desc = NSLocalizedString( @"(None)", @"Hot Keys:Key Combo text for 'empty' combo" );
 	}
 
 	return desc;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.