Revision: 6540
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6540&view=rev
Author:   hofman
Date:     2010-05-17 17:27:52 +0000 (Mon, 17 May 2010)

Log Message:
-----------
simplify drop validation on bookmarks table, just refuse drops on items rather 
than redirecting

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

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2010-05-16 21:35:11 UTC (rev 6539)
+++ trunk/SKBookmarkController.m        2010-05-17 17:27:52 UTC (rev 6540)
@@ -647,22 +647,15 @@
 - (NSDragOperation)outlineView:(NSOutlineView *)ov validateDrop:(id 
<NSDraggingInfo>)info proposedItem:(id)item 
proposedChildIndex:(NSInteger)anIndex {
     NSPasteboard *pboard = [info draggingPasteboard];
     NSString *type = [pboard availableTypeFromArray:[NSArray 
arrayWithObjects:SKBookmarkRowsPboardType, NSFilenamesPboardType, nil]];
+    NSDragOperation dragOp = NSDragOperationNone;
     
-    if ([type isEqualToString:SKBookmarkRowsPboardType]) {
-        if (anIndex == NSOutlineViewDropOnItemIndex) {
-            if ([item bookmarkType] == SKBookmarkTypeFolder && [outlineView 
isItemExpanded:item]) {
-                [ov setDropItem:item dropChildIndex:0];
-            } else if (item) {
-                [ov setDropItem:(SKBookmark *)[item parent] == bookmarkRoot ? 
nil : [item parent] dropChildIndex:[[[item parent] children] 
indexOfObject:item] + 1];
-            } else {
-                [ov setDropItem:nil dropChildIndex:[bookmarkRoot 
countOfChildren]];
-            }
-        }
-        return [item isDescendantOfArray:[self draggedBookmarks]] ? 
NSDragOperationNone : NSDragOperationMove;
-    } else if ([type isEqualToString:NSFilenamesPboardType]) {
-        return anIndex == NSOutlineViewDropOnItemIndex ? NSDragOperationNone : 
NSDragOperationEvery;
+    if (anIndex != NSOutlineViewDropOnItemIndex) {
+        if ([type isEqualToString:NSFilenamesPboardType])
+            dragOp = NSDragOperationEvery;
+        else if ([type isEqualToString:SKBookmarkRowsPboardType] && [item 
isDescendantOfArray:[self draggedBookmarks]])
+            dragOp = NSDragOperationMove;
     }
-    return NSDragOperationNone;
+    return dragOp;
 }
 
 - (BOOL)outlineView:(NSOutlineView *)ov acceptDrop:(id <NSDraggingInfo>)info 
item:(id)item childIndex:(NSInteger)anIndex {


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