Autoselect new annotation

This commit is contained in:
Matthias Neeracher 2011-08-13 21:43:02 +02:00
parent 652a867716
commit 67ce98df17
5 changed files with 34 additions and 135 deletions

View File

@ -13,6 +13,7 @@
IBOutlet NSArrayController* annotationController;
IBOutlet QTMovieView * movieView;
IBOutlet NSTokenField * tokenFieldProto;
IBOutlet NSTableView * annotationTable;
IBOutlet NSTableColumn * tokenColumn;
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -60,7 +60,7 @@
<object class="NSCustomObject" id="613418571">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSTokenField" id="10327397">
<object class="NSTokenField" id="398992771">
<reference key="NSNextResponder"/>
<int key="NSvFlags">-2147483380</int>
<object class="NSMutableSet" key="NSDragTypes">
@ -72,11 +72,10 @@
</object>
<string key="NSFrameSize">{550, 22}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:3123</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTokenFieldCell" key="NSCell" id="630657535">
<object class="NSTokenFieldCell" key="NSCell" id="194508126">
<int key="NSCellFlags">341966336</int>
<int key="NSCellFlags2">0</int>
<object class="NSFont" key="NSSupport">
@ -85,9 +84,9 @@
<int key="NSfFlags">16</int>
</object>
<string key="NSCellIdentifier">_NS:3123</string>
<reference key="NSControlView" ref="10327397"/>
<reference key="NSControlView" ref="398992771"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="10728307">
<object class="NSColor" key="NSBackgroundColor" id="853682264">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
@ -105,7 +104,7 @@
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
<reference key="NSDelegate" ref="10327397"/>
<reference key="NSDelegate" ref="398992771"/>
<double key="NSCompletionDelay">0.0</double>
<int key="NSTokenStyle">0</int>
</object>
@ -146,7 +145,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 183}</string>
<reference key="NSSuperview" ref="204692115"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="332479500"/>
<string key="NSReuseIdentifierKey">_NS:1197</string>
<bool key="NSEnabled">YES</bool>
@ -155,7 +153,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 17}</string>
<reference key="NSSuperview" ref="502749411"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="204692115"/>
<string key="NSReuseIdentifierKey">_NS:1199</string>
<reference key="NSTableView" ref="215129609"/>
@ -323,7 +320,6 @@
</object>
<string key="NSFrame">{{1, 17}, {1279, 183}}</string>
<reference key="NSSuperview" ref="726433129"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="215129609"/>
<string key="NSReuseIdentifierKey">_NS:1195</string>
<reference key="NSDocView" ref="215129609"/>
@ -335,7 +331,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
<reference key="NSSuperview" ref="726433129"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="728144490"/>
<string key="NSReuseIdentifierKey">_NS:1214</string>
<reference key="NSTarget" ref="726433129"/>
@ -348,7 +343,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 185}, {1278, 15}}</string>
<reference key="NSSuperview" ref="726433129"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="475349496"/>
<string key="NSReuseIdentifierKey">_NS:1216</string>
<int key="NSsFlags">1</int>
@ -365,7 +359,6 @@
</object>
<string key="NSFrame">{{1, 0}, {1279, 17}}</string>
<reference key="NSSuperview" ref="726433129"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="117432108"/>
<string key="NSReuseIdentifierKey">_NS:1200</string>
<reference key="NSDocView" ref="117432108"/>
@ -375,7 +368,6 @@
</object>
<string key="NSFrameSize">{1281, 201}</string>
<reference key="NSSuperview" ref="196617426"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="502749411"/>
<string key="NSReuseIdentifierKey">_NS:1193</string>
<int key="NSsFlags">133682</int>
@ -410,7 +402,6 @@
</object>
<string key="NSFrame">{{0, 581}, {1281, 16}}</string>
<reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1054473103"/>
<string key="NSReuseIdentifierKey">_NS:46</string>
<reference key="kCoderFillColor" ref="1064784368"/>
@ -434,7 +425,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 564}</string>
<reference key="NSSuperview" ref="51131752"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="715872882"/>
<string key="NSReuseIdentifierKey">_NS:1197</string>
<bool key="NSEnabled">YES</bool>
@ -443,7 +433,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 17}</string>
<reference key="NSSuperview" ref="794153134"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="51131752"/>
<string key="NSReuseIdentifierKey">_NS:1199</string>
<reference key="NSTableView" ref="620291245"/>
@ -485,6 +474,7 @@
<reference key="NSTableView" ref="620291245"/>
</object>
<object class="NSTableColumn" id="995592652">
<string key="NSIdentifier">tags</string>
<double key="NSWidth">550</double>
<double key="NSMinWidth">200</double>
<double key="NSMaxWidth">2000</double>
@ -556,7 +546,6 @@
</object>
<string key="NSFrame">{{1, 17}, {1279, 564}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="620291245"/>
<string key="NSReuseIdentifierKey">_NS:1195</string>
<reference key="NSDocView" ref="620291245"/>
@ -568,7 +557,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="387598056"/>
<string key="NSReuseIdentifierKey">_NS:1214</string>
<reference key="NSTarget" ref="1054473103"/>
@ -580,7 +568,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 566}, {1279, 15}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:1216</string>
<int key="NSsFlags">1</int>
@ -597,7 +584,6 @@
</object>
<string key="NSFrame">{{1, 0}, {1279, 17}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="995480265"/>
<reference key="NSDocView" ref="995480265"/>
<reference key="NSBGColor" ref="1040976304"/>
@ -606,7 +592,6 @@
</object>
<string key="NSFrame">{{0, -1}, {1281, 582}}</string>
<reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="794153134"/>
<string key="NSReuseIdentifierKey">_NS:1193</string>
<int key="NSsFlags">133682</int>
@ -619,14 +604,12 @@
</object>
<string key="NSFrameSize">{1281, 599}</string>
<reference key="NSSuperview" ref="475349496"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="56699403"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
</object>
</object>
<string key="NSFrame">{{0, 211}, {1281, 599}}</string>
<reference key="NSSuperview" ref="196617426"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1058980817"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSOffsets">{0, 0}</string>
@ -635,7 +618,7 @@
<int key="NSCellFlags2">0</int>
<string key="NSContents">Box</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSBackgroundColor" ref="10728307"/>
<reference key="NSBackgroundColor" ref="853682264"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
@ -651,14 +634,12 @@
</object>
<string key="NSFrameSize">{1281, 810}</string>
<reference key="NSSuperview" ref="568628114"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="726433129"/>
<int key="NSDividerStyle">3</int>
</object>
</object>
<string key="NSFrameSize">{1280, 809}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="196617426"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
@ -999,7 +980,7 @@
<object class="IBOutletConnection" key="connection">
<string key="label">tokenFieldProto</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="10327397"/>
<reference key="destination" ref="398992771"/>
</object>
<int key="connectionID">100173</int>
</object>
@ -1014,11 +995,19 @@
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="630657535"/>
<reference key="source" ref="194508126"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">100175</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">annotationTable</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="620291245"/>
</object>
<int key="connectionID">100176</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -1289,17 +1278,17 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">100161</int>
<reference key="object" ref="10327397"/>
<reference key="object" ref="398992771"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="630657535"/>
<reference ref="194508126"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100162</int>
<reference key="object" ref="630657535"/>
<reference key="parent" ref="10327397"/>
<reference key="object" ref="194508126"/>
<reference key="parent" ref="398992771"/>
</object>
</object>
</object>
@ -1406,106 +1395,9 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">100175</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">MADocWindow</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addAnnotation:</string>
<string>addMediaFiles:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addAnnotation:</string>
<string>addMediaFiles:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">addAnnotation:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">addMediaFiles:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>annotationController</string>
<string>mediaController</string>
<string>movieView</string>
<string>tokenColumn</string>
<string>tokenFieldProto</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSArrayController</string>
<string>NSArrayController</string>
<string>QTMovieView</string>
<string>NSTableColumn</string>
<string>NSTokenField</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>annotationController</string>
<string>mediaController</string>
<string>movieView</string>
<string>tokenColumn</string>
<string>tokenFieldProto</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">annotationController</string>
<string key="candidateClassName">NSArrayController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mediaController</string>
<string key="candidateClassName">NSArrayController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">movieView</string>
<string key="candidateClassName">QTMovieView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tokenColumn</string>
<string key="candidateClassName">NSTableColumn</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tokenFieldProto</string>
<string key="candidateClassName">NSTokenField</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MADocWindow.h</string>
</object>
</object>
</object>
<int key="maxID">100176</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">