Changeset 435
- Timestamp:
- 03/04/08 17:29:41 (17 years ago)
- Location:
- trunk/ICeCoffEE/ICeCoffEE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/APEMain.m
r393 r435 129 129 if (ICCF_CFBundleIDMatches(bundleID, CFSTR("com.apple.xcode"))) { 130 130 if (ICCF_PatchMethod("XCTextView", "ICeCoffEE", "ICeCoffEESuper", "mouseDown:")) { 131 ICCF_PatchMethod("XCTextView", "ICeCoffEE", "ICeCoffEESuper", "clickedOnLink:atIndex:"); 131 132 ICCF_PatchMethod("XCSourceCodeTextView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:"); 132 133 ICCF_PatchMethod("XCDiffTextView", "ICeCoffEE", "ICeCoffEESuper", "mouseDown:"); 134 ICCF_PatchMethod("XCDiffTextView", "ICeCoffEE", "ICeCoffEESuper", "clickedOnLink:atIndex:"); 133 135 ICCF_PatchMethod("XCDiffTextView", "ICeCoffEE", "ICeCoffEESuper", "menuForEvent:"); // subclass of PBXTextView; patching both is bad 134 136 } else { … … 166 168 if (shouldLoadInNSTextView) { 167 169 ICCF_PatchMethod("NSTextView", "ICeCoffEE", "ICeCoffEESuper", "mouseDown:") && 170 ICCF_PatchMethod("NSTextView", "ICeCoffEE", "ICeCoffEESuper", "clickedOnLink:atIndex:") && 168 171 ICCF_PatchMethod("NSTextView", "ICeCoffEE", "ICeCoffEESuper", "menuForEvent:"); 169 172 ICapeprintf("ICeCoffEE APE: loaded generic NSTextView support\n"); -
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
r388 r435 224 224 NSRange range = [self selectedRange]; 225 225 NSCAssert(range.location != NSNotFound, ICCF_LocalizedString(@"There is no insertion point or selection in the text field where you clicked")); 226 227 if (range.length == 0) { 228 if (range.location == length) range.location--; 229 range.length = 1; 230 range = ICCF_URLEnclosingRange(s, range); 231 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 232 } 233 234 if (ICCF_LaunchURL([s substringWithRange: range], ICCF_KeyboardAction(triggeringEvent)) && ICCF_prefs.textBlinkEnabled) { 226 NSString *url = nil; 227 228 if ([[self textStorage] attribute: NSLinkAttributeName atIndex: range.location 229 effectiveRange: NULL] != nil) { 230 NSRange linkRange; 231 id link = [[self textStorage] attribute: NSLinkAttributeName atIndex: range.location longestEffectiveRange: &linkRange inRange: NSMakeRange(0, length)]; 232 if (NSMaxRange(range) <= NSMaxRange(linkRange)) { 233 // selection is entirely within link range 234 url = [link isKindOfClass: [NSURL class]] ? [link absoluteString] : link; 235 range = linkRange; 236 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 237 } 238 } 239 if (url == nil) { 240 if (range.length == 0) { 241 if (range.location == length) range.location--; 242 range.length = 1; 243 range = ICCF_URLEnclosingRange(s, range); 244 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 245 } 246 247 url = [s substringWithRange: range]; 248 } 249 250 if (ICCF_LaunchURL(url, ICCF_KeyboardAction(triggeringEvent)) && ICCF_prefs.textBlinkEnabled) { 235 251 for (unsigned i = 0 ; i < ICCF_prefs.textBlinkCount ; i++) { 236 252 NSRange emptyRange = {range.location, 0}; … … 384 400 } 385 401 386 387 402 @implementation ICeCoffEE 388 403 … … 412 427 NSMenu *myMenu = [super menuForEvent: e]; 413 428 return ICCF_MenuForEvent(self, myMenu, e); 429 } 430 431 static BOOL ICCF_inMouseDown; 432 433 - (void)clickedOnLink:(id)link atIndex:(unsigned)charIndex; 434 { 435 if (!ICCF_inMouseDown) 436 [super clickedOnLink: link atIndex: charIndex]; 414 437 } 415 438 … … 428 451 429 452 if (ICCF_enabled && ICCF_prefs.commandClickEnabled && ICCF_EventIsCommandMouseDown(downEvent)) { 430 [super mouseDown: ICCF_MouseDownEventWithModifierFlags(downEvent, YES)]; 453 ICCF_inMouseDown = YES; 454 @try { 455 [super mouseDown: ICCF_MouseDownEventWithModifierFlags(downEvent, YES)]; 456 } @finally { 457 ICCF_inMouseDown = NO; 458 } 431 459 // we don't actually get a mouseUp event, just wait for mouseDown to return 432 460 NSEvent *upEvent = [[self window] currentEvent]; -
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEESuper.m
r66 r435 17 17 } 18 18 19 - (void)clickedOnLink:(id)link atIndex:(unsigned)charIndex; 20 { 21 [super clickedOnLink: link atIndex: charIndex]; 22 } 23 19 24 - (void)mouseDown:(NSEvent *)e; 20 25 {
Note:
See TracChangeset
for help on using the changeset viewer.