Changeset 106 for trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
- Timestamp:
- 03/08/03 03:15:01 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
r88 r106 22 22 #include <unistd.h> 23 23 #import "ICeCoffEESuper.h" 24 #import "ICeCoffEEActionMenu.h"25 24 26 25 iccfPrefRec ICCF_prefs; … … 58 57 59 58 BOOL ICCF_EventIsCommandMouseDown(NSEvent *e) { 60 unsigned int modifierFlags = [e modifierFlags]; 61 return ([e type] == NSLeftMouseDown && 62 (modifierFlags == NSCommandKeyMask || modifierFlags == (NSCommandKeyMask | NSAlternateKeyMask)) 63 && [e clickCount] == 1); 64 } 65 66 BOOL ICCF_OptionKeyIsDown() { 59 return ([e type] == NSLeftMouseDown && ([e modifierFlags] & NSCommandKeyMask) != 0 && [e clickCount] == 1); 60 } 61 62 iccfURLAction ICCF_KeyboardAction() { 67 63 unsigned int modifierFlags = [[NSApp currentEvent] modifierFlags]; 68 return (modifierFlags & NSAlternateKeyMask) != 0; 64 iccfURLAction action; 65 action.presentMenu = (modifierFlags & NSAlternateKeyMask) != 0; 66 action.launchInBackground = (modifierFlags & NSShiftKeyMask) != 0; 67 return action; 69 68 } 70 69 … … 233 232 } 234 233 235 void ICCF_LaunchURL(NSString *string, BOOL chooseApp) {234 void ICCF_LaunchURL(NSString *string, iccfURLAction action) { 236 235 OSStatus err; 237 236 long selStart, selEnd; … … 259 258 } 260 259 261 if (chooseApp) { 262 err = ICCF_DoURLActionMenu(ICCF_GetInst(), hint, *h, selStart, selEnd); 263 ICCF_OSErrCAssert(err, @"ICCF_DoURLActionMenu"); 264 } else { 265 err = ICLaunchURL(ICCF_GetInst(), hint, *h, len, &selStart, &selEnd); 266 ICCF_OSErrCAssert(err, @"ICLaunchURL"); 267 } 260 err = ICCF_DoURLAction(ICCF_GetInst(), hint, *h, selStart, selEnd, action); 261 ICCF_OSErrCAssert(err, @"ICCF_DoURLAction"); 268 262 269 263 NS_HANDLER … … 276 270 277 271 // XXX not sure what to do if there's already a selection; BBEdit and MLTE extend it, Tex-Edit Plus doesn't. 278 // RFC-ordained max URL length, just to avoid passing IC multi-megabyte documents272 // RFC-ordained max URL length, just to avoid passing IC/LS multi-megabyte documents 279 273 #if ICCF_DEBUG 280 const long ICCF_MAX_URL_LEN = 1024; // XXX change later274 const long ICCF_MAX_URL_LEN = 60; // XXX change later 281 275 #else 282 276 const long ICCF_MAX_URL_LEN = 1024; … … 369 363 [self display]; 370 364 371 ICCF_LaunchURL([s substringWithRange: range], ICCF_ OptionKeyIsDown());365 ICCF_LaunchURL([s substringWithRange: range], ICCF_KeyboardAction()); 372 366 373 367 if (ICCF_prefs.textBlinkEnabled) { … … 473 467 ICLog(@"ICeCoffEE down: %@", e); 474 468 #endif 475 // we don't actually get a mouseUp event, just wait for mouseDown to return 476 [super mouseDown: e]; 477 if (!ICCF_enabled || !ICCF_prefs.commandClickEnabled) { 478 #if ICCF_DEBUG 479 down = NO; 480 #endif 481 return; 482 } 483 // don't want command-shift-click, etc. to trigger 484 if (ICCF_EventIsCommandMouseDown(e)) { 469 if (ICCF_enabled && ICCF_prefs.commandClickEnabled && ICCF_EventIsCommandMouseDown(e)) { 470 // don't want to trigger selection extension or anything else; pass through as a plain click 471 [super mouseDown: [NSEvent mouseEventWithType: NSLeftMouseDown location: [e locationInWindow] modifierFlags: 0 timestamp: [e timestamp] windowNumber: [e windowNumber] context: [e context] eventNumber: [e eventNumber] clickCount: 1 pressure: 0]]; 472 // we don't actually get a mouseUp event, just wait for mouseDown to return 485 473 NSEvent *upEvent = [[self window] currentEvent]; 486 474 NSPoint downPt = [e locationInWindow]; … … 491 479 ICCF_LaunchURLFromTextView(self); 492 480 } 481 } else { 482 [super mouseDown: e]; 493 483 } 494 484 #if ICCF_DEBUG
Note:
See TracChangeset
for help on using the changeset viewer.