Implement deleting tags

This commit is contained in:
Matthias Neeracher 2011-08-22 01:24:09 +02:00
parent 9b42529dc3
commit 8c9f0ae12d
4 changed files with 43 additions and 5 deletions

View File

@ -273,6 +273,9 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
{ {
if ([[self tagPanel] validateUserInterfaceItem:item])
return YES;
if ([item action] == @selector(addMediaFiles:) if ([item action] == @selector(addMediaFiles:)
|| [item action] == @selector(exportText:) || [item action] == @selector(exportText:)
|| [item action] == @selector(importText:) || [item action] == @selector(importText:)

View File

@ -16,5 +16,6 @@
@property (assign) NSDocument * currentDocument; @property (assign) NSDocument * currentDocument;
- (IBAction)toggleWindow:(id)sender; - (IBAction)toggleWindow:(id)sender;
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item;
@end @end

View File

@ -35,4 +35,23 @@
} }
} }
- (IBAction)delete:(id)sender
{
[tagController remove:sender];
}
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
{
if ([item action] == @selector(toggleWindow:))
return YES;
if (![self isWindowLoaded] || ![[self window] isVisible])
return NO;
if ([item action] == @selector(delete:))
return [tagController selectionIndex] != NSNotFound;
return NO;
}
@end @end

View File

@ -76,7 +76,7 @@
<string key="NSFrameSize">{806, 432}</string> <string key="NSFrameSize">{806, 432}</string>
<reference key="NSSuperview" ref="43006809"/> <reference key="NSSuperview" ref="43006809"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="233033100"/> <reference key="NSNextKeyView" ref="687601302"/>
<string key="NSReuseIdentifierKey">_NS:1197</string> <string key="NSReuseIdentifierKey">_NS:1197</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="818285608"> <object class="NSTableHeaderView" key="NSHeaderView" id="818285608">
@ -238,7 +238,6 @@
<string key="NSFrame">{{1, 434}, {798, 15}}</string> <string key="NSFrame">{{1, 434}, {798, 15}}</string>
<reference key="NSSuperview" ref="296418393"/> <reference key="NSSuperview" ref="296418393"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:1216</string> <string key="NSReuseIdentifierKey">_NS:1216</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<int key="NSsFlags">1</int> <int key="NSsFlags">1</int>
@ -266,7 +265,7 @@
<string key="NSFrameSize">{800, 450}</string> <string key="NSFrameSize">{800, 450}</string>
<reference key="NSSuperview" ref="19986666"/> <reference key="NSSuperview" ref="19986666"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="687601302"/> <reference key="NSNextKeyView" ref="43006809"/>
<string key="NSReuseIdentifierKey">_NS:1193</string> <string key="NSReuseIdentifierKey">_NS:1193</string>
<int key="NSsFlags">133810</int> <int key="NSsFlags">133810</int>
<reference key="NSVScroller" ref="233033100"/> <reference key="NSVScroller" ref="233033100"/>
@ -282,7 +281,7 @@
<reference key="NSNextKeyView" ref="296418393"/> <reference key="NSNextKeyView" ref="296418393"/>
<string key="NSReuseIdentifierKey">_NS:2837</string> <string key="NSReuseIdentifierKey">_NS:2837</string>
</object> </object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMinSize">{250, 116}</string> <string key="NSMinSize">{250, 116}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string> <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool> <bool key="NSWindowIsRestorable">YES</bool>
@ -435,6 +434,22 @@
</object> </object>
<int key="connectionID">40</int> <int key="connectionID">40</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1011577982"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">41</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1011577982"/>
</object>
<int key="connectionID">42</int>
</object>
</object> </object>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
@ -611,7 +626,7 @@
<reference key="dict.values" ref="0"/> <reference key="dict.values" ref="0"/>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">40</int> <int key="maxID">42</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">