source: trunk/ICeCoffEE/ICeCoffEE/ICeCoffEETrigger.m@ 388

Last change on this file since 388 was 388, checked in by Nicholas Riley, 16 years ago

APEMain.m: Note missing Xcode 3 support. Add Terminal 2.0 support.

English.lproj/APE Manager plugin.nib:

English.lproj/APEInfo.rtfd:

ICeCoffEE.[hm]: Bring triggering window and app to front if error
dialog displayed in ICCF_HandleException. Remove initial word
selection. Launch preexisting selection if present. Remove 10.3
support. Update for new ICeCoffEETrigger API. Rename downEvent
parameter for consistency.

ICeCoffEE.xcodeproj: Added files.

ICeCoffEEParser.m: Handle multiline URLs.

ICeCoffEETTView.[hm]: Terminal 2.0 support (thank you for having a
usable NSTextInput implementation!)

ICeCoffEETTViewTrigger.[hm]: ICeCoffEETrigger implementation for
TTView. Can't set range as we do for NSTextView because you can't
have an arbitrary empty selection range in Terminal, so we pass it
directly to ICCF_LaunchURLFromTTView.

ICeCoffEETerminal.[hm]: Fix capitalization on ICeCoffEETermSubviewSuper.
Pass downEvent to ICCF_HandleException so it can bring the triggering
window to the front.

ICeCoffEETextViewTrigger.[hm]: Moved from ICeCoffEETrigger.

ICeCoffEETrigger.[hm]: Now an abstract superclass. Replace direct
access to ICCF_sharedTrigger with +cancel. Create 0-character range
(if click outside selectedRange) or save selectedRange. Move
debugging logs here from ICeCoffEE.m. Add description method.

ICeCoffEEWebKit.m: Pass downEvent to ICCF_HandleException so it can
bring the triggering window to the front.

Installer components/ui/ui.plist: Updated for 1.5d3.

TestParser.m: Handle multiline URLs; newlines are printed as \ and
tabs as >. Implement ICCF_StringByRemovingCharactersInSet, which will
move elsewhere once Internet Config support is removed.

VERSION.xcconfig: Updated for 1.5d3.

urls.plist: Test for multiline URLs.

File size: 2.2 KB
RevLine 
[183]1//
2// ICeCoffEETrigger.m
3// ICeCoffEE APE
4//
5// Created by Nicholas Riley on 5/14/05.
6// Copyright 2005 Nicholas Riley. All rights reserved.
7//
8
9#import "ICeCoffEETrigger.h"
[388]10#import "ICeCoffEEShared.h"
11#include <Carbon/Carbon.h>
[183]12
[388]13static ICeCoffEETrigger *ICCF_sharedTrigger = nil;
[183]14
15@implementation ICeCoffEETrigger
16
[388]17- (id)initForEvent:(NSEvent *)anEvent onTarget:(NSView<NSTextInput> *)aTarget;
[183]18{
19 if ( (self = [super init]) != nil) {
20 target = [aTarget retain];
21 event = [anEvent retain];
[388]22 unsigned characterIndex = [aTarget characterIndexForPoint:
23 [[aTarget window] convertBaseToScreen: [anEvent locationInWindow]]];
24 range = [aTarget selectedRange];
25 ICLog(@"ICeCoffEETrigger characterIndex %u selectedRange %@", characterIndex, NSStringFromRange(range));
26 if (range.location == NSNotFound || range.length == 0 ||
27 !NSLocationInRange(characterIndex, range)) {
28 range.location = characterIndex;
29 range.length = 0;
30 }
31 // no typical definition of Command-Option-double-click, so we don't need to delay
32 NSTimeInterval interval = ([anEvent modifierFlags] & NSAlternateKeyMask) ? 0 :
33 TicksToEventTime(GetDblTime());
34 timer = [NSTimer scheduledTimerWithTimeInterval: interval
[183]35 target: self
36 selector: @selector(timerFired:)
37 userInfo: nil
38 repeats: NO];
39 }
40 return self;
41}
42
[388]43+ (void)setTriggerForEvent:(NSEvent *)anEvent onTarget:(NSView<NSTextInput> *)aTarget;
[183]44{
[256]45 ICCF_sharedTrigger = [[self alloc] initForEvent: anEvent onTarget: aTarget];
[183]46 [ICCF_sharedTrigger release];
[388]47 ICLog(@"set %@", ICCF_sharedTrigger);
[183]48}
49
50- (void)dealloc;
51{
[388]52 ICLog(@"DEALLOC %@", self);
[183]53 timer = nil;
54 [target release];
55 target = nil;
56 [event release];
57 event = nil;
58 [super dealloc];
59}
60
[388]61- (void)timerFired:(NSTimer *)aTimer;
[183]62{
63 ICCF_sharedTrigger = nil;
64}
65
66- (void)cancel;
67{
[388]68 ICLog(@"%@ cancelling", self);
[183]69 ICCF_sharedTrigger = nil;
70 [timer invalidate]; // we get dealloced inside here, so don't do anything else
71}
72
[388]73+ (BOOL)cancel;
74{
75 if (ICCF_sharedTrigger == nil)
76 return NO;
77
78 [ICCF_sharedTrigger cancel];
79 return YES;
80}
81
82- (NSString *)description;
83{
84 return [NSString stringWithFormat: @"<%@ on %@ for %@ %@>", [self className],
85 target, event, NSStringFromRange(range)];
86}
87
[183]88@end
Note: See TracBrowser for help on using the repository browser.