Fix nasty mouse-over bug with NSTokenFieldCell

This commit is contained in:
Matthias Neeracher 2011-08-14 23:56:35 +02:00
parent 514fffddbd
commit 61cb6c09e2
4 changed files with 44 additions and 1 deletions

View File

@ -26,6 +26,7 @@
950BB7A713F467A400D8E669 /* MAAddMedia.xib in Resources */ = {isa = PBXBuildFile; fileRef = 950BB7A513F467A400D8E669 /* MAAddMedia.xib */; }; 950BB7A713F467A400D8E669 /* MAAddMedia.xib in Resources */ = {isa = PBXBuildFile; fileRef = 950BB7A513F467A400D8E669 /* MAAddMedia.xib */; };
950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.mm */; }; 950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.mm */; };
950BB7AD13F46ECF00D8E669 /* MAAppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */; }; 950BB7AD13F46ECF00D8E669 /* MAAppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */; };
95B3748713F87B17009BB79A /* MATokenFieldCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B3748613F87B17009BB79A /* MATokenFieldCell.mm */; };
95BCFA2113F76A04000F650F /* app.icns in Resources */ = {isa = PBXBuildFile; fileRef = 95BCFA1F13F76A04000F650F /* app.icns */; }; 95BCFA2113F76A04000F650F /* app.icns in Resources */ = {isa = PBXBuildFile; fileRef = 95BCFA1F13F76A04000F650F /* app.icns */; };
95BCFA2213F76A04000F650F /* doc.icns in Resources */ = {isa = PBXBuildFile; fileRef = 95BCFA2013F76A04000F650F /* doc.icns */; }; 95BCFA2213F76A04000F650F /* doc.icns in Resources */ = {isa = PBXBuildFile; fileRef = 95BCFA2013F76A04000F650F /* doc.icns */; };
95C534E013F732A200A07932 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95C534DE13F732A200A07932 /* Localizable.strings */; }; 95C534E013F732A200A07932 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95C534DE13F732A200A07932 /* Localizable.strings */; };
@ -63,6 +64,8 @@
950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAddMediaSheet.mm; sourceTree = "<group>"; }; 950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAddMediaSheet.mm; sourceTree = "<group>"; };
950BB7AB13F46ECF00D8E669 /* MAAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAAppController.h; sourceTree = "<group>"; }; 950BB7AB13F46ECF00D8E669 /* MAAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAAppController.h; sourceTree = "<group>"; };
950BB7AC13F46ECF00D8E669 /* MAAppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAppController.mm; sourceTree = "<group>"; }; 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAppController.mm; sourceTree = "<group>"; };
95B3748513F87B17009BB79A /* MATokenFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MATokenFieldCell.h; sourceTree = "<group>"; };
95B3748613F87B17009BB79A /* MATokenFieldCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MATokenFieldCell.mm; sourceTree = "<group>"; };
95BCFA1F13F76A04000F650F /* app.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = app.icns; path = Resources/app.icns; sourceTree = "<group>"; }; 95BCFA1F13F76A04000F650F /* app.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = app.icns; path = Resources/app.icns; sourceTree = "<group>"; };
95BCFA2013F76A04000F650F /* doc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = doc.icns; path = Resources/doc.icns; sourceTree = "<group>"; }; 95BCFA2013F76A04000F650F /* doc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = doc.icns; path = Resources/doc.icns; sourceTree = "<group>"; };
95C534DF13F732A200A07932 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; 95C534DF13F732A200A07932 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -175,6 +178,8 @@
950BB7AC13F46ECF00D8E669 /* MAAppController.mm */, 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */,
950BB78413F2D95500D8E669 /* MADocWindow.h */, 950BB78413F2D95500D8E669 /* MADocWindow.h */,
950BB78513F2D95500D8E669 /* MADocWindow.mm */, 950BB78513F2D95500D8E669 /* MADocWindow.mm */,
95B3748513F87B17009BB79A /* MATokenFieldCell.h */,
95B3748613F87B17009BB79A /* MATokenFieldCell.mm */,
); );
name = Classes; name = Classes;
sourceTree = "<group>"; sourceTree = "<group>";
@ -258,6 +263,7 @@
950BB78613F2D95500D8E669 /* MADocWindow.mm in Sources */, 950BB78613F2D95500D8E669 /* MADocWindow.mm in Sources */,
950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */, 950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */,
950BB7AD13F46ECF00D8E669 /* MAAppController.mm in Sources */, 950BB7AD13F46ECF00D8E669 /* MAAppController.mm in Sources */,
95B3748713F87B17009BB79A /* MATokenFieldCell.mm in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -12,6 +12,7 @@
#import "MAAddMediaSheet.h" #import "MAAddMediaSheet.h"
#import "MADocument.h" #import "MADocument.h"
#import "MAAnno.h" #import "MAAnno.h"
#import "MATokenFieldCell.h"
@implementation MADocWindow @implementation MADocWindow
@ -28,7 +29,7 @@
[mediaController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES]]]; [mediaController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES]]];
[annotationController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES]]]; [annotationController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES]]];
NSTokenFieldCell * tokenCellProto = [tokenFieldProto cell]; NSTokenFieldCell * tokenCellProto = [tokenFieldProto cell];
NSTokenFieldCell * tokenCell = [[NSTokenFieldCell alloc] init]; NSTokenFieldCell * tokenCell = [[MATokenFieldCell alloc] init];
[tokenCell setDelegate:self]; [tokenCell setDelegate:self];
[tokenCell setFont:[tokenCellProto font]]; [tokenCell setFont:[tokenCellProto font]];
[tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]]; [tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]];

View File

@ -0,0 +1,13 @@
//
// MATokenFieldCell.h
// Medianno
//
// Created by Matthias Neeracher on 8/14/11.
// Copyright 2011 Matthias Neeracher. All rights reserved.
//
#import <AppKit/AppKit.h>
@interface MATokenFieldCell : NSTokenFieldCell
@end

View File

@ -0,0 +1,23 @@
//
// MATokenFieldCell.mm
// Medianno
//
// Created by Matthias Neeracher on 8/14/11.
// Copyright 2011 Matthias Neeracher. All rights reserved.
//
#import "MATokenFieldCell.h"
@implementation MATokenFieldCell
- (void)updateTrackingAreaWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
//
// Sorry for this horrible hack. We override this so our superclass doesn't get it.
// If it does, and -[NSTableView updateTrackingAreas] is called while this cell is
// selected, it will set up a tracking area covering the entire table view, with
// nasty consequences. Ignoring the call doesn't seem to have adverse consequences.
//
}
@end