From 8c9f0ae12dc06218ec86c0e3a20674b7d35120d2 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Mon, 22 Aug 2011 01:24:09 +0200 Subject: [PATCH] Implement deleting tags --- Medianno/MADocWindow.mm | 3 +++ Medianno/MATagWindow.h | 1 + Medianno/MATagWindow.mm | 19 +++++++++++++++++++ Medianno/en.lproj/MATag.xib | 25 ++++++++++++++++++++----- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Medianno/MADocWindow.mm b/Medianno/MADocWindow.mm index 992fdf5..d8bb2f2 100644 --- a/Medianno/MADocWindow.mm +++ b/Medianno/MADocWindow.mm @@ -273,6 +273,9 @@ static const char * kMADocWindowObserver = "MADocWindowObserver"; - (BOOL)validateUserInterfaceItem:(id )item { + if ([[self tagPanel] validateUserInterfaceItem:item]) + return YES; + if ([item action] == @selector(addMediaFiles:) || [item action] == @selector(exportText:) || [item action] == @selector(importText:) diff --git a/Medianno/MATagWindow.h b/Medianno/MATagWindow.h index 374b171..aa01d05 100644 --- a/Medianno/MATagWindow.h +++ b/Medianno/MATagWindow.h @@ -16,5 +16,6 @@ @property (assign) NSDocument * currentDocument; - (IBAction)toggleWindow:(id)sender; +- (BOOL)validateUserInterfaceItem:(id )item; @end diff --git a/Medianno/MATagWindow.mm b/Medianno/MATagWindow.mm index 7c39b63..36e00af 100644 --- a/Medianno/MATagWindow.mm +++ b/Medianno/MATagWindow.mm @@ -35,4 +35,23 @@ } } +- (IBAction)delete:(id)sender +{ + [tagController remove:sender]; +} + +- (BOOL)validateUserInterfaceItem:(id )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 diff --git a/Medianno/en.lproj/MATag.xib b/Medianno/en.lproj/MATag.xib index 6cc9d9d..338b474 100644 --- a/Medianno/en.lproj/MATag.xib +++ b/Medianno/en.lproj/MATag.xib @@ -76,7 +76,7 @@ {806, 432} - + _NS:1197 YES @@ -238,7 +238,6 @@ {{1, 434}, {798, 15}} - _NS:1216 YES 1 @@ -266,7 +265,7 @@ {800, 450} - + _NS:1193 133810 @@ -282,7 +281,7 @@ _NS:2837 - {{0, 0}, {1440, 878}} + {{0, 0}, {2560, 1418}} {250, 116} {10000000000000, 10000000000000} YES @@ -435,6 +434,22 @@ 40 + + + delegate + + + + 41 + + + + window + + + + 42 + @@ -611,7 +626,7 @@ - 40 + 42