From 67ce98df170f162820a662fc8ab7c3bc7a188546 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 13 Aug 2011 21:43:02 +0200 Subject: [PATCH] Autoselect new annotation --- Medianno/MADocWindow.h | 1 + Medianno/MADocWindow.mm | 6 +- Medianno/MADocument.h | 3 +- Medianno/MADocument.mm | 5 +- Medianno/en.lproj/MADocument.xib | 154 +++++-------------------------- 5 files changed, 34 insertions(+), 135 deletions(-) diff --git a/Medianno/MADocWindow.h b/Medianno/MADocWindow.h index 18370dd..7e2cd1f 100644 --- a/Medianno/MADocWindow.h +++ b/Medianno/MADocWindow.h @@ -13,6 +13,7 @@ IBOutlet NSArrayController* annotationController; IBOutlet QTMovieView * movieView; IBOutlet NSTokenField * tokenFieldProto; + IBOutlet NSTableView * annotationTable; IBOutlet NSTableColumn * tokenColumn; } diff --git a/Medianno/MADocWindow.mm b/Medianno/MADocWindow.mm index 8157859..39f2886 100644 --- a/Medianno/MADocWindow.mm +++ b/Medianno/MADocWindow.mm @@ -89,7 +89,11 @@ - (IBAction)addAnnotation:(id)sender { QTTime location = [[movieView movie] currentTime]; - [[self document] addAnnotationForMedia:[[mediaController selectedObjects] objectAtIndex:0] location:location]; + MAAnno * anno = [[self document] addAnnotationForMedia:[[mediaController selectedObjects] objectAtIndex:0] location:location]; + [annotationController setSelectedObjects:[NSArray arrayWithObject:anno]]; + [annotationTable editColumn:[annotationTable columnWithIdentifier:@"tags"] + row:[annotationController selectionIndex] + withEvent:nil select:YES]; } #pragma mark Tag token manipulation diff --git a/Medianno/MADocument.h b/Medianno/MADocument.h index ba73f59..245e0a3 100644 --- a/Medianno/MADocument.h +++ b/Medianno/MADocument.h @@ -11,13 +11,14 @@ @class MAMedia; @class MATagDescription; +@class MAAnno; @interface MADocument : NSPersistentDocument { NSFileWrapper * mediaWrapper; } - (void)addMediaURL:(NSURL *)url name:(NSString *)name date:(NSDate *)date copying:(BOOL)copying; -- (void)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location; +- (MAAnno *)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location; - (MATagDescription *)tagDescriptionForName:(NSString *)name; - (NSArray *)tagNamesMatchingPrefix:(NSString *)prefix; diff --git a/Medianno/MADocument.mm b/Medianno/MADocument.mm index 0004f30..3edb2c8 100644 --- a/Medianno/MADocument.mm +++ b/Medianno/MADocument.mm @@ -79,14 +79,15 @@ #pragma mark Annotation management -- (void)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location +- (MAAnno *)addAnnotationForMedia:(MAMedia *)media location:(QTTime)location { NSManagedObjectContext *moc = [self managedObjectContext]; MAAnno * annotation = [NSEntityDescription insertNewObjectForEntityForName:@"MAAnno" inManagedObjectContext:moc]; annotation.media = media; annotation.location = QTStringFromTime(location); annotation.notes = @""; - [moc processPendingChanges]; + + return annotation; } #pragma mark Tag management diff --git a/Medianno/en.lproj/MADocument.xib b/Medianno/en.lproj/MADocument.xib index 7578659..1fbd43d 100644 --- a/Medianno/en.lproj/MADocument.xib +++ b/Medianno/en.lproj/MADocument.xib @@ -60,7 +60,7 @@ FirstResponder - + -2147483380 @@ -72,11 +72,10 @@ {550, 22} - _NS:3123 YES - + 341966336 0 @@ -85,9 +84,9 @@ 16 _NS:3123 - + YES - + 6 System textBackgroundColor @@ -105,7 +104,7 @@ MAA - + 0.0 0 @@ -146,7 +145,6 @@ 256 {1279, 183} - _NS:1197 YES @@ -155,7 +153,6 @@ 256 {1279, 17} - _NS:1199 @@ -323,7 +320,6 @@ {{1, 17}, {1279, 183}} - _NS:1195 @@ -335,7 +331,6 @@ -2147483392 {{224, 17}, {15, 102}} - _NS:1214 @@ -348,7 +343,6 @@ -2147483392 {{1, 185}, {1278, 15}} - _NS:1216 1 @@ -365,7 +359,6 @@ {{1, 0}, {1279, 17}} - _NS:1200 @@ -375,7 +368,6 @@ {1281, 201} - _NS:1193 133682 @@ -410,7 +402,6 @@ {{0, 581}, {1281, 16}} - _NS:46 @@ -434,7 +425,6 @@ 256 {1279, 564} - _NS:1197 YES @@ -443,7 +433,6 @@ 256 {1279, 17} - _NS:1199 @@ -485,6 +474,7 @@ + tags 550 200 2000 @@ -556,7 +546,6 @@ {{1, 17}, {1279, 564}} - _NS:1195 @@ -568,7 +557,6 @@ -2147483392 {{224, 17}, {15, 102}} - _NS:1214 @@ -580,7 +568,6 @@ -2147483392 {{1, 566}, {1279, 15}} - _NS:1216 1 @@ -597,7 +584,6 @@ {{1, 0}, {1279, 17}} - @@ -606,7 +592,6 @@ {{0, -1}, {1281, 582}} - _NS:1193 133682 @@ -619,14 +604,12 @@ {1281, 599} - _NS:11 {{0, 211}, {1281, 599}} - _NS:9 {0, 0} @@ -635,7 +618,7 @@ 0 Box - + 3 MCAwLjgwMDAwMDAxMTkAA @@ -651,14 +634,12 @@ {1281, 810} - 3 {1280, 809} - {{0, 0}, {2560, 1418}} @@ -999,7 +980,7 @@ tokenFieldProto - + 100173 @@ -1014,11 +995,19 @@ delegate - + 100175 + + + annotationTable + + + + 100176 + @@ -1289,17 +1278,17 @@ 100161 - + YES - + 100162 - - + + @@ -1406,106 +1395,9 @@ - 100175 - - - - YES - - MADocWindow - NSWindowController - - YES - - YES - addAnnotation: - addMediaFiles: - - - YES - id - id - - - - YES - - YES - addAnnotation: - addMediaFiles: - - - YES - - addAnnotation: - id - - - addMediaFiles: - id - - - - - YES - - YES - annotationController - mediaController - movieView - tokenColumn - tokenFieldProto - - - YES - NSArrayController - NSArrayController - QTMovieView - NSTableColumn - NSTokenField - - - - YES - - YES - annotationController - mediaController - movieView - tokenColumn - tokenFieldProto - - - YES - - annotationController - NSArrayController - - - mediaController - NSArrayController - - - movieView - QTMovieView - - - tokenColumn - NSTableColumn - - - tokenFieldProto - NSTokenField - - - - - IBProjectSource - ./Classes/MADocWindow.h - - - + 100176 + 0 IBCocoaFramework