From 925b645993e3db048315b3af79ff96436770c8f7 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Thu, 18 Aug 2011 02:37:29 +0200 Subject: [PATCH] Switch to view based tables --- Medianno.xcodeproj/project.pbxproj | 23 +- Medianno/MADocWindow.h | 2 - Medianno/MADocWindow.mm | 7 - Medianno/MATokenFieldCell.mm | 19 +- Medianno/en.lproj/MADocument.xib | 508 +++++++++++++++++++++-------- 5 files changed, 390 insertions(+), 169 deletions(-) diff --git a/Medianno.xcodeproj/project.pbxproj b/Medianno.xcodeproj/project.pbxproj index a070e73..66ac7d3 100644 --- a/Medianno.xcodeproj/project.pbxproj +++ b/Medianno.xcodeproj/project.pbxproj @@ -25,11 +25,11 @@ 950BB7A713F467A400D8E669 /* MAAddMedia.xib in Resources */ = {isa = PBXBuildFile; fileRef = 950BB7A513F467A400D8E669 /* MAAddMedia.xib */; }; 950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.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 */; }; 95BCFA2213F76A04000F650F /* doc.icns in Resources */ = {isa = PBXBuildFile; fileRef = 95BCFA2013F76A04000F650F /* doc.icns */; }; 95BCFA2E13F8A3AD000F650F /* MAShortenQTTime.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95BCFA2D13F8A3AD000F650F /* MAShortenQTTime.mm */; }; 95C534E013F732A200A07932 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95C534DE13F732A200A07932 /* Localizable.strings */; }; + 95CA841113FC149B00AE5AC4 /* MATokenFieldCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95CA841013FC149B00AE5AC4 /* MATokenFieldCell.mm */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -62,13 +62,13 @@ 950BB7A913F46BAF00D8E669 /* MAAddMediaSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAddMediaSheet.mm; sourceTree = ""; }; 950BB7AB13F46ECF00D8E669 /* MAAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAAppController.h; sourceTree = ""; }; 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAAppController.mm; sourceTree = ""; }; - 95B3748513F87B17009BB79A /* MATokenFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MATokenFieldCell.h; sourceTree = ""; }; - 95B3748613F87B17009BB79A /* MATokenFieldCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MATokenFieldCell.mm; sourceTree = ""; }; 95BCFA1F13F76A04000F650F /* app.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = app.icns; path = Resources/app.icns; sourceTree = ""; }; 95BCFA2013F76A04000F650F /* doc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = doc.icns; path = Resources/doc.icns; sourceTree = ""; }; 95BCFA2C13F8A3AD000F650F /* MAShortenQTTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MAShortenQTTime.h; sourceTree = ""; }; 95BCFA2D13F8A3AD000F650F /* MAShortenQTTime.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MAShortenQTTime.mm; sourceTree = ""; }; 95C534DF13F732A200A07932 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 95CA840F13FC149B00AE5AC4 /* MATokenFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MATokenFieldCell.h; sourceTree = ""; }; + 95CA841013FC149B00AE5AC4 /* MATokenFieldCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MATokenFieldCell.mm; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -168,6 +168,8 @@ 950BB7B013F4803500D8E669 /* Classes */ = { isa = PBXGroup; children = ( + 95CA840F13FC149B00AE5AC4 /* MATokenFieldCell.h */, + 95CA841013FC149B00AE5AC4 /* MATokenFieldCell.mm */, 950BB67C13F1F26200D8E669 /* MADocument.h */, 950BB67D13F1F26200D8E669 /* MADocument.mm */, 950BB7A813F46BAF00D8E669 /* MAAddMediaSheet.h */, @@ -176,8 +178,6 @@ 950BB7AC13F46ECF00D8E669 /* MAAppController.mm */, 950BB78413F2D95500D8E669 /* MADocWindow.h */, 950BB78513F2D95500D8E669 /* MADocWindow.mm */, - 95B3748513F87B17009BB79A /* MATokenFieldCell.h */, - 95B3748613F87B17009BB79A /* MATokenFieldCell.mm */, 95BCFA2C13F8A3AD000F650F /* MAShortenQTTime.h */, 95BCFA2D13F8A3AD000F650F /* MAShortenQTTime.mm */, ); @@ -210,6 +210,7 @@ 950BB65D13F1F26200D8E669 /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0410; ORGANIZATIONNAME = "Matthias Neeracher"; }; buildConfigurationList = 950BB66013F1F26200D8E669 /* Build configuration list for PBXProject "Medianno" */; @@ -262,8 +263,8 @@ 950BB78613F2D95500D8E669 /* MADocWindow.mm in Sources */, 950BB7AA13F46BAF00D8E669 /* MAAddMediaSheet.mm in Sources */, 950BB7AD13F46ECF00D8E669 /* MAAppController.mm in Sources */, - 95B3748713F87B17009BB79A /* MATokenFieldCell.mm in Sources */, 95BCFA2E13F8A3AD000F650F /* MAShortenQTTime.mm in Sources */, + 95CA841113FC149B00AE5AC4 /* MATokenFieldCell.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -346,7 +347,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; + SDKROOT = macosx10.7; }; name = Debug; }; @@ -365,7 +366,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; + SDKROOT = macosx10.7; }; name = Release; }; @@ -376,8 +377,9 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Medianno/Medianno-Prefix.pch"; INFOPLIST_FILE = "Medianno/Medianno-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; WRAPPER_EXTENSION = app; }; name = Debug; @@ -389,8 +391,9 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Medianno/Medianno-Prefix.pch"; INFOPLIST_FILE = "Medianno/Medianno-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/Medianno/MADocWindow.h b/Medianno/MADocWindow.h index 6e5a5f9..6cdf45b 100644 --- a/Medianno/MADocWindow.h +++ b/Medianno/MADocWindow.h @@ -12,10 +12,8 @@ IBOutlet NSArrayController* mediaController; IBOutlet NSArrayController* annotationController; IBOutlet QTMovieView * movieView; - IBOutlet NSTokenField * tokenFieldProto; IBOutlet NSTableView * mediaTable; IBOutlet NSTableView * annotationTable; - IBOutlet NSTableColumn * tokenColumn; QTTime lastMovieTime; } diff --git a/Medianno/MADocWindow.mm b/Medianno/MADocWindow.mm index de3d7a9..c8347ad 100644 --- a/Medianno/MADocWindow.mm +++ b/Medianno/MADocWindow.mm @@ -12,7 +12,6 @@ #import "MAAddMediaSheet.h" #import "MADocument.h" #import "MAAnno.h" -#import "MATokenFieldCell.h" @implementation MADocWindow @@ -28,12 +27,6 @@ [super windowDidLoad]; [mediaController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES]]]; [annotationController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES]]]; - NSTokenFieldCell * tokenCellProto = [tokenFieldProto cell]; - NSTokenFieldCell * tokenCell = [[MATokenFieldCell alloc] init]; - [tokenCell setDelegate:self]; - [tokenCell setFont:[tokenCellProto font]]; - [tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]]; - [tokenColumn setDataCell:tokenCell]; [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(updateMovieTime:) userInfo:nil repeats:YES]; } diff --git a/Medianno/MATokenFieldCell.mm b/Medianno/MATokenFieldCell.mm index dde3c07..c0585fa 100644 --- a/Medianno/MATokenFieldCell.mm +++ b/Medianno/MATokenFieldCell.mm @@ -8,16 +8,21 @@ #import "MATokenFieldCell.h" +static NSCharacterSet * sOverrideTokenizingCharacters; + @implementation MATokenFieldCell -- (void)updateTrackingAreaWithFrame:(NSRect)cellFrame inView:(NSView *)controlView +- (NSCharacterSet *)tokenizingCharacterSet { - // - // 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. - // + if (!sOverrideTokenizingCharacters) + sOverrideTokenizingCharacters = [[NSCharacterSet characterSetWithCharactersInString:@";"] retain]; + + return sOverrideTokenizingCharacters; +} + +- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView +{ + [super drawInteriorWithFrame:cellFrame inView:controlView]; } @end diff --git a/Medianno/en.lproj/MADocument.xib b/Medianno/en.lproj/MADocument.xib index 16691f1..d6a42ae 100644 --- a/Medianno/en.lproj/MADocument.xib +++ b/Medianno/en.lproj/MADocument.xib @@ -2,7 +2,7 @@ 1070 - 11A511 + 11B26 1617 1138 566.00 @@ -21,25 +21,27 @@ YES - NSScroller - NSSplitView + NSButton + NSCustomObject NSArrayController - NSTableHeaderView - NSScrollView - QTMovieView - NSTextFieldCell - NSBox + NSSplitView NSDateFormatter NSTableView - NSTokenField - NSTokenFieldCell - NSButton - NSButtonCell - NSCustomObject - NSView + NSTableCellView + NSTextField NSWindowTemplate - NSUserDefaultsController + NSTextFieldCell + NSButtonCell NSTableColumn + NSBox + NSView + NSTokenFieldCell + NSScrollView + QTMovieView + NSUserDefaultsController + NSScroller + NSTableHeaderView + NSTokenField YES @@ -61,57 +63,6 @@ FirstResponder - - - -2147483380 - - YES - - YES - NSStringPboardType - - - {550, 22} - - - - _NS:3123 - YES - - 341966336 - 0 - - LucidaGrande - 12 - 16 - - _NS:3123 - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - 0.0 - 0 - - 2 - 15 2 @@ -190,7 +141,10 @@ 6 System headerTextColor - + + 3 + MAA + @@ -207,12 +161,17 @@ 6 System controlBackgroundColor - + 3 MC42NjY2NjY2NjY3AA - + + 6 + System + controlTextColor + + 3 YES @@ -258,7 +217,10 @@ 6 System headerColor - + + 3 + MQA + @@ -436,7 +398,7 @@ {1278, 565} - + _NS:1197 YES @@ -543,7 +505,7 @@ 2 - 19 + 17 -71270400 @@ -616,12 +578,12 @@ - QSAAAEEgAABBqAAAQagAAA + QSAAAEEgAABBmAAAQZgAAA 268 - {{0, 582}, {103, 18}} + {{0, 582}, {103, 20}} @@ -661,7 +623,12 @@ 0 Box - + + 6 + System + textBackgroundColor + + 3 MCAwLjgwMDAwMDAxMTkAA @@ -687,7 +654,7 @@ - {{0, 0}, {1440, 878}} + {{0, 0}, {2560, 1418}} {450, 422} {10000000000000, 10000000000000} 128 @@ -703,7 +670,6 @@ MAMedia YES - YES YES YES YES @@ -878,30 +844,6 @@ 100160 - - - tokenFieldProto - - - - 100173 - - - - tokenColumn - - - - 100174 - - - - delegate - - - - 100175 - annotationTable @@ -958,14 +900,6 @@ 100180 - - - delegate - - - - 100181 - value: arrangedObjects.location @@ -1045,6 +979,203 @@ 100201 + + + textField + + + 274 + + YES + + + 266 + {100, 17} + + + YES + + 67239488 + 71305216 + Table View Cell + + + + 6 + System + controlColor + + + + + + + {{1, 1}, {100, 17}} + + + + + 100205 + + + + textField + + + 274 + + YES + + + 266 + {620, 17} + + + YES + + 337772097 + 272631808 + Table View Cell + + + + + + + + {{656, 1}, {620, 17}} + + + + + 100213 + + + + content: arrangedObjects + + + + + + content: arrangedObjects + content + arrangedObjects + 2 + + + 100217 + + + + value: objectValue.notes + + + + + + value: objectValue.notes + value + objectValue.notes + 2 + + + 100219 + + + + value: objectValue.location + + + + + + value: objectValue.location + value + objectValue.location + + NSValueTransformerName + MAShortenQTTime + + 2 + + + 100220 + + + + delegate + + 337772032 + 4194304 + + LucidaGrande + 12 + 16 + + _NS:3123 + + YES + + + + 0.0 + 0 + + + + 100223 + + + + value: objectValue.tagDescriptions + + + 268 + + YES + + YES + NSStringPboardType + + + {549, 17} + + + _NS:3123 + YES + + 2 + + + + 274 + + YES + + + {{104, 1}, {549, 17}} + + + + + + value: objectValue.tagDescriptions + value + objectValue.tagDescriptions + 2 + + + 100225 + + + + delegate + + + + 100228 + @@ -1187,6 +1318,7 @@ YES + @@ -1196,6 +1328,7 @@ YES + @@ -1205,6 +1338,7 @@ YES + @@ -1217,7 +1351,6 @@ 100041 - Token Field Cell - Text Cell 100042 @@ -1308,20 +1441,6 @@ AnnotationController - - 100161 - - - YES - - - - - - 100162 - - - 100197 @@ -1336,6 +1455,76 @@ + + 100202 + + + YES + + + + + + 100203 + + + YES + + + + + + 100204 + + + + + 100206 + + + YES + + + + + + 100210 + + + YES + + + + Table Cell View + + + 100211 + + + YES + + + + + + 100212 + + + + + 100221 + + + YES + + + + + + 100222 + + + @@ -1364,11 +1553,18 @@ 100036.IBPluginDependency 100037.IBPluginDependency 100038.IBPluginDependency + 100038.ibExternalAutomaticallyCalculatesRowSizeFromViewHeight 100039.IBPluginDependency + 100039.isInViewBasedMode + 100039.prototypeCellViews 100040.IBPluginDependency + 100040.isInViewBasedMode + 100040.prototypeCellViews 100041.IBPluginDependency 100042.IBPluginDependency 100043.IBPluginDependency + 100043.isInViewBasedMode + 100043.prototypeCellViews 100044.IBPluginDependency 100086.IBPluginDependency 100086.ibExternalFetchPredicateFormat @@ -1376,10 +1572,18 @@ 100129.IBPluginDependency 100130.IBPluginDependency 100148.IBPluginDependency - 100161.IBPluginDependency - 100162.IBPluginDependency 100197.IBPluginDependency 100198.IBPluginDependency + 100202.IBPluginDependency + 100203.IBPluginDependency + 100204.IBPluginDependency + 100206.IBPluginDependency + 100210.IBPluginDependency + 100211.IBPluginDependency + 100212.IBPluginDependency + 100221.IBPluginDependency + 100222.CustomClassName + 100222.IBPluginDependency 5.IBNSWindowAutoPositionCentersHorizontal 5.IBNSWindowAutoPositionCentersVertical 5.IBPluginDependency @@ -1410,11 +1614,27 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1426,6 +1646,14 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + MATokenFieldCell + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1445,7 +1673,7 @@ - 100201 + 100228 @@ -1522,8 +1750,6 @@ mediaController mediaTable movieView - tokenColumn - tokenFieldProto YES @@ -1532,8 +1758,6 @@ NSArrayController NSTableView QTMovieView - NSTableColumn - NSTokenField @@ -1545,8 +1769,6 @@ mediaController mediaTable movieView - tokenColumn - tokenFieldProto YES @@ -1570,14 +1792,6 @@ movieView QTMovieView - - tokenColumn - NSTableColumn - - - tokenFieldProto - NSTokenField - @@ -1593,6 +1807,14 @@ ./Classes/MADocumentWindow.h + + MATokenFieldCell + NSTokenFieldCell + + IBProjectSource + ./Classes/MATokenFieldCell.h + + 0