Revision: 6956
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6956&view=rev
Author:   hofman
Date:     2010-12-09 21:37:52 +0000 (Thu, 09 Dec 2010)

Log Message:
-----------
shift selection for pasted or dropped bookmarks not at root level

Modified Paths:
--------------
    trunk/SKBookmarkController.m

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2010-12-09 18:17:24 UTC (rev 6955)
+++ trunk/SKBookmarkController.m        2010-12-09 21:37:52 UTC (rev 6956)
@@ -651,10 +651,13 @@
         if ([newBookmarks count] > 0) {
             [self endEditing];
             if (item == nil) item = bookmarkRoot;
-            NSIndexSet *indexes = [NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(anIndex, [newBookmarks count])];
+            NSMutableIndexSet *indexes = [NSMutableIndexSet 
indexSetWithIndexesInRange:NSMakeRange(anIndex, [newBookmarks count])];
             [[item mutableArrayValueForKey:@"children"] 
insertObjects:newBookmarks atIndexes:indexes];
-            if (item == bookmarkRoot || [outlineView isItemExpanded:item])
+            if (item == bookmarkRoot || [outlineView isItemExpanded:item]) {
+                if (item != bookmarkRoot)
+                    [indexes shiftIndexesStartingAtIndex:0 by:[outlineView 
rowForItem:item] + 1];
                 [outlineView selectRowIndexes:indexes byExtendingSelection:NO];
+            }
             return YES;
         }
         return NO;
@@ -740,10 +743,13 @@
             SKBookmark *item = nil;
             NSUInteger anIndex = 0;
             [self getInsertionFolder:&item childIndex:&anIndex];
-            NSIndexSet *indexes = [NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(anIndex, [newBookmarks count])];
+            NSMutableIndexSet *indexes = [NSMutableIndexSet 
indexSetWithIndexesInRange:NSMakeRange(anIndex, [newBookmarks count])];
             [[item mutableArrayValueForKey:@"children"] 
insertObjects:newBookmarks atIndexes:indexes];
-            if (item == bookmarkRoot || [outlineView isItemExpanded:item])
+            if (item == bookmarkRoot || [outlineView isItemExpanded:item]) {
+                if (item != bookmarkRoot)
+                    [indexes shiftIndexesStartingAtIndex:0 by:[outlineView 
rowForItem:item] + 1];
                 [outlineView selectRowIndexes:indexes byExtendingSelection:NO];
+            }
         } else NSBeep();
     } else NSBeep();
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to