Revision: 28298
          http://sourceforge.net/p/bibdesk/svn/28298
Author:   hofman
Date:     2023-06-06 21:33:58 +0000 (Tue, 06 Jun 2023)
Log Message:
-----------
Track icon indexes rather than URLs from point

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2023-06-06 
21:25:31 UTC (rev 28297)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2023-06-06 
21:33:58 UTC (rev 28298)
@@ -3279,12 +3279,6 @@
     [self _hideArrows];
 }
 
-- (NSURL *)_URLAtPoint:(NSPoint)point;
-{
-    NSUInteger anIndex = [self _indexAtPoint:point dropOperation:NULL];
-    return NSNotFound == anIndex ? nil : [self URLAtIndex:anIndex];
-}
-
 - (void)_openURLs:(NSArray *)URLs
 {
     NSEnumerator *e = [URLs objectEnumerator];
@@ -3440,7 +3434,7 @@
         // change selection first, as Finder does
         if ([event clickCount] > 1 && i != NSNotFound) {
             if (flags & NSAlternateKeyMask) {
-                [self _previewURL:[self _URLAtPoint:p] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
+                [self _previewURL:[self URLAtIndex:i] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
             } else {
                 [self openSelectedURLs:self];
             }
@@ -3523,34 +3517,31 @@
     // in mouseDragged:, we're either tracking an arrow button, drawing a 
rubber band selection, or initiating a drag
     
     NSPoint p = [self convertPoint:[event locationInWindow] fromView:nil];
-    NSURL *pointURL = [self _URLAtPoint:p];
+    NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
     
     // _fvFlags.isMouseDown tells us if the mouseDown: event originated in 
this view; if not, just ignore it
     
-    if (NSEqualRects(_rubberBandRect, NSZeroRect) && nil != pointURL && 
_fvFlags.isMouseDown) {
+    if (NSEqualRects(_rubberBandRect, NSZeroRect) && NSNotFound != i && 
_fvFlags.isMouseDown) {
         // No previous rubber band selection, so check to see if we're 
dragging an icon at this point.
         // The condition is also false when we're getting a repeated call to 
mouseDragged: for rubber band drawing.
         
-        NSArray *selectedURLs = nil;
+        NSIndexSet *selectionIndexes = nil;
                 
         // we may have a selection based on a previous rubber band, but only 
use that if we dragged one of the icons in it
-        selectedURLs = [self _selectedURLs];
-        if ([selectedURLs containsObject:pointURL] == NO) {
-            selectedURLs = nil;
+        selectionIndexes = [self selectionIndexes];
+        if ([selectionIndexes containsIndex:i] == NO) {
+            selectionIndexes = nil;
             [self _setSelectionIndexes:[NSIndexSet indexSet]];
         }
         
         // not using a rubber band, so select and use the clicked URL if 
available (mouseDown: should have already done this)
-        if (0 == [selectedURLs count] && nil != pointURL) {
-            NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
-            if (i != NSNotFound) {
-                selectedURLs = [NSArray arrayWithObject:pointURL];
-                [self _setSelectionIndexes:[NSIndexSet indexSetWithIndex:i]];
-            }
+        if (0 == [selectionIndexes count] && NSNotFound != i) {
+            selectionIndexes = [NSIndexSet indexSetWithIndex:i];
+            [self _setSelectionIndexes:selectionIndexes];
         }
         
         // if we have anything to drag, start a drag session
-        if ([selectedURLs count]) {
+        if ([selectionIndexes count]) {
             
             // add all URLs (file and other schemes)
             // Finder will create weblocs for us unless schemes are mixed 
(gives a stupid file busy error message)

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to