Revision: 2922
http://skim-app.svn.sourceforge.net/skim-app/?rev=2922&view=rev
Author: hofman
Date: 2007-09-13 15:25:15 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
Edit new bookmark folder. End editing bookmarks before removing one.
Modified Paths:
--------------
trunk/SKBookmarkController.h
trunk/SKBookmarkController.m
Modified: trunk/SKBookmarkController.h
===================================================================
--- trunk/SKBookmarkController.h 2007-09-13 21:14:39 UTC (rev 2921)
+++ trunk/SKBookmarkController.h 2007-09-13 22:25:15 UTC (rev 2922)
@@ -66,6 +66,7 @@
- (void)addBookmarkForPath:(NSString *)path pageIndex:(unsigned)pageIndex
label:(NSString *)label;
- (void)saveBookmarks;
- (void)handleBookmarkChangedNotification:(NSNotification *)notification;
+- (void)handleBookmarkWillBeRemovedNotification:(NSNotification *)notification;
- (NSString *)bookmarksFilePath;
- (void)openBookmarks:(NSArray *)items;
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2007-09-13 21:14:39 UTC (rev 2921)
+++ trunk/SKBookmarkController.m 2007-09-13 22:25:15 UTC (rev 2922)
@@ -48,6 +48,7 @@
static NSString *SKBookmarkRowsPboardType = @"SKBookmarkRowsPboardType";
static NSString *SKBookmarkChangedNotification =
@"SKBookmarkChangedNotification";
+static NSString *SKBookmarkWillBeRemovedNotification =
@"SKBookmarkWillBeRemovedNotification";
@implementation SKBookmarkController
@@ -100,6 +101,10 @@
selector:@selector(handleBookmarkChangedNotification:)
name:SKBookmarkChangedNotification
object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+
selector:@selector(handleBookmarkWillBeRemovedNotification:)
+
name:SKBookmarkWillBeRemovedNotification
+ object:nil];
}
return self;
}
@@ -152,6 +157,7 @@
- (void)removeObjectFromBookmarksAtIndex:(unsigned)index {
[[[self undoManager] prepareWithInvocationTarget:self]
insertObject:[bookmarks objectAtIndex:index] inBookmarksAtIndex:index];
+ [self handleBookmarkWillBeRemovedNotification:nil];
[bookmarks removeObjectAtIndex:index];
[self handleBookmarkChangedNotification:nil];
}
@@ -280,6 +286,11 @@
}
}
+- (void)handleBookmarkWillBeRemovedNotification:(NSNotification *)notification
{
+ if ([outlineView editedRow] && [[self window]
makeFirstResponder:outlineView] == NO)
+ [[self window] endEditingFor:nil];
+}
+
- (void)handleBookmarkChangedNotification:(NSNotification *)notification {
[self saveBookmarks];
[outlineView reloadData];
@@ -359,6 +370,10 @@
}
}
[self bookmark:item insertChildBookmark:folder atIndex:index];
+
+ int row = [outlineView rowForItem:folder];
+ [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
byExtendingSelection:NO];
+ [outlineView editColumn:0 row:row withEvent:nil select:YES];
}
#pragma mark Undo support
@@ -402,7 +417,8 @@
- (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
NSString *tcID = [tableColumn identifier];
if ([tcID isEqualToString:@"label"]) {
- [item setLabel:object];
+ if ([object isEqualToString:[item label]] == NO)
+ [item setLabel:object];
}
}
@@ -695,6 +711,7 @@
- (void)removeChild:(SKBookmark *)child {
NSUndoManager *undoManager = [[SKBookmarkController
sharedBookmarkController] undoManager];
[(SKBookmark *)[undoManager prepareWithInvocationTarget:self]
insertChild:child atIndex:[[self children] indexOfObject:child]];
+ [[NSNotificationCenter defaultCenter]
postNotificationName:SKBookmarkWillBeRemovedNotification object:self];
[child setParent:nil];
[children removeObject:child];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKBookmarkChangedNotification object:self];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit