Revision: 29107
http://sourceforge.net/p/bibdesk/svn/29107
Author: hofman
Date: 2025-04-15 16:30:56 +0000 (Tue, 15 Apr 2025)
Log Message:
-----------
Check for urls in drag only in draggingEntered: and cache in ivar
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2025-04-15
15:55:01 UTC (rev 29106)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2025-04-15
16:30:56 UTC (rev 29107)
@@ -234,6 +234,7 @@
unsigned int needsReload:1;
unsigned int controllingSharedPreviewer:1;
unsigned int controllingQLPreviewPanel:1;
+ unsigned int dragHasURLs:1;
} _fvFlags;
NSSize _padding;
NSSize _iconSize;
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-15
15:55:01 UTC (rev 29106)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-15
16:30:56 UTC (rev 29107)
@@ -1519,6 +1519,11 @@
return NSNotFound;
}
+- (NSUInteger)_indexAtPoint:(NSPoint)point
+{
+ return [self _indexAtPoint:point dropOperation:NULL];
+}
+
#pragma mark Slider
- (void)_sliderAction:(id)sender {
@@ -2800,9 +2805,6 @@
NSUInteger dropIndex = NSNotFound;
FVDropOperation dropOp = FVDropBefore;
- // !!! this is quite expensive to call repeatedly in -draggingUpdated
- BOOL hasURLs = FVPasteboardHasURL([sender draggingPasteboard]);
-
// First determine the drop location, drop between rows in column mode,
and between columns otherwise
dropIndex = [self _indexAtPoint:p dropOperation:&dropOp];
// Check whether the index is not NSNotFound, because the grid cell can be
empty
@@ -2811,7 +2813,7 @@
// We won't reset the drop location info when we propose
NSDragOperationNone, because the delegate may want to override our decision, we
will reset it at the end
- if (hasURLs == NO) {
+ if (_fvFlags.dragHasURLs == NO) {
// We have to make sure the pasteboard really has a URL here, since
most NSStrings aren't valid URLs, but the delegate may accept other types
dragOp = NSDragOperationNone;
}
@@ -2866,6 +2868,8 @@
// this is called as soon as the mouse is moved to start a drag, or enters the
window from outside
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
+ // !!! this is quite expensive to call repeatedly in -draggingUpdated
+ _fvFlags.dragHasURLs = FVPasteboardHasURL([sender draggingPasteboard]);
return [self draggingUpdated:sender];
}
@@ -2873,6 +2877,7 @@
{
[_dropHighlightView removeFromSuperview];
_dropHighlightView = nil;
+ _fvFlags.dragHasURLs = NO;
if (_fvFlags.needsReload)
[self reloadIcons];
}
@@ -2882,6 +2887,7 @@
{
[_dropHighlightView removeFromSuperview];
_dropHighlightView = nil;
+ _fvFlags.dragHasURLs = NO;
[self reloadIcons];
}
@@ -3125,7 +3131,7 @@
if ([_trackingAreas containsObject:area]) {
NSRect rect = [area rect];
- NSUInteger idx = [self _indexAtPoint:NSMakePoint(NSMidX(rect),
NSMidY(rect)) dropOperation:NULL];
+ NSUInteger idx = [self _indexAtPoint:NSMakePoint(NSMidX(rect),
NSMidY(rect))];
if (idx != NSNotFound)
[self _showArrowsForIconAtIndex:idx];
} else if (_fvFlags.displayMode == FVDisplayModeGrid && ([area
isEqual:_topSliderArea] || [area isEqual:_bottomSliderArea])) {
@@ -3206,12 +3212,12 @@
// this method and shouldDelayWindowOrderingForEvent: are overriden to allow
dragging from the view without making our window key
- (BOOL)acceptsFirstMouse:(NSEvent *)event
{
- return ([self _indexAtPoint:[self convertPoint:[event locationInWindow]
fromView:nil] dropOperation:NULL] != NSNotFound);
+ return ([self _indexAtPoint:[self convertPoint:[event locationInWindow]
fromView:nil]] != NSNotFound);
}
- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)event
{
- return ([self _indexAtPoint:[self convertPoint:[event locationInWindow]
fromView:nil] dropOperation:NULL] != NSNotFound);
+ return ([self _indexAtPoint:[self convertPoint:[event locationInWindow]
fromView:nil]] != NSNotFound);
}
- (void)keyDown:(NSEvent *)event
@@ -3390,7 +3396,7 @@
// 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];
- NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
+ NSUInteger i = [self _indexAtPoint:p];
// _fvFlags.isMouseDown tells us if the mouseDown: event originated in
this view; if not, just ignore it
@@ -3971,7 +3977,7 @@
{
_lastMouseDownLocInView = [self convertPoint:[event locationInWindow]
fromView:nil];
- NSUInteger idx = [self _indexAtPoint:_lastMouseDownLocInView
dropOperation:NULL];
+ NSUInteger idx = [self _indexAtPoint:_lastMouseDownLocInView];
return [self menuForIconAtIndex:idx];
}
@@ -4553,7 +4559,7 @@
- (BOOL)accessibilityPerformShowMenu {
NSRect rect = [self visibleRect];
NSPoint p = NSMakePoint(NSMidX(rect), NSMinY(rect) + 10.0);
- NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
+ NSUInteger i = [self _indexAtPoint:p];
[[self menuForIconAtIndex:i] popUpMenuPositioningItem:nil atLocation:p
inView:self];
return YES;
}
@@ -4624,7 +4630,7 @@
#else
localPoint = [self convertPoint:[[self window] convertScreenToBase:point]
fromView:nil];
#endif
- NSUInteger i = [self _indexAtPoint:localPoint dropOperation:NULL];
+ NSUInteger i = [self _indexAtPoint:localPoint];
if (i != NSNotFound)
return [[_accessibilityIcons objectAtIndex:i]
accessibilityHitTest:point];
return NSAccessibilityUnignoredAncestor(self);
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