Ignore:
Timestamp:
03/08/03 03:15:01 (21 years ago)
Author:
Nicholas Riley
Message:

ICeCoffEE 1.3.2b1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m

    r88 r106  
    2222#include <unistd.h>
    2323#import "ICeCoffEESuper.h"
    24 #import "ICeCoffEEActionMenu.h"
    2524
    2625iccfPrefRec ICCF_prefs;
     
    5857
    5958BOOL 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
     62iccfURLAction ICCF_KeyboardAction() {
    6763    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;
    6968}
    7069
     
    233232}
    234233
    235 void ICCF_LaunchURL(NSString *string, BOOL chooseApp) {
     234void ICCF_LaunchURL(NSString *string, iccfURLAction action) {
    236235    OSStatus err;
    237236    long selStart, selEnd;
     
    259258        }
    260259
    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");
    268262       
    269263    NS_HANDLER
     
    276270
    277271// 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 documents
     272// RFC-ordained max URL length, just to avoid passing IC/LS multi-megabyte documents
    279273#if ICCF_DEBUG
    280 const long ICCF_MAX_URL_LEN = 1024; // XXX change later
     274const long ICCF_MAX_URL_LEN = 60; // XXX change later
    281275#else
    282276const long ICCF_MAX_URL_LEN = 1024;
     
    369363        [self display];
    370364
    371         ICCF_LaunchURL([s substringWithRange: range], ICCF_OptionKeyIsDown());
     365        ICCF_LaunchURL([s substringWithRange: range], ICCF_KeyboardAction());
    372366
    373367        if (ICCF_prefs.textBlinkEnabled) {
     
    473467    ICLog(@"ICeCoffEE down: %@", e);
    474468#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
    485473        NSEvent *upEvent = [[self window] currentEvent];
    486474        NSPoint downPt = [e locationInWindow];
     
    491479            ICCF_LaunchURLFromTextView(self);
    492480        }
     481    } else {
     482        [super mouseDown: e];
    493483    }
    494484#if ICCF_DEBUG
Note: See TracChangeset for help on using the changeset viewer.