Revision: 29110 http://sourceforge.net/p/bibdesk/svn/29110 Author: hofman Date: 2025-04-16 08:47:15 +0000 (Wed, 16 Apr 2025) Log Message: ----------- Save whether drag for drop has URLs in drop highlight view, create highlight view in draggingEntered
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 21:40:16 UTC (rev 29109) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2025-04-16 08:47:15 UTC (rev 29110) @@ -234,7 +234,6 @@ 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 21:40:16 UTC (rev 29109) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-16 08:47:15 UTC (rev 29110) @@ -163,11 +163,13 @@ #pragma mark - @interface FVDropHighlightView : FVDisplayView { - NSUInteger _dropIndex; - FVDropOperation _dropOperation; + NSUInteger _dropIndex; + FVDropOperation _dropOperation; + BOOL _dragHasURLs; } @property (nonatomic) NSUInteger dropIndex; @property (nonatomic) FVDropOperation dropOperation; +@property (nonatomic) BOOL dragHasURLs; @end #pragma mark - @@ -2818,7 +2820,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 (_fvFlags.dragHasURLs == NO) { + if ([_dropHighlightView 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; } @@ -2849,10 +2851,6 @@ dragOp = NSDragOperationLink; } - if (_dropHighlightView == nil) { - _dropHighlightView = [[FVDropHighlightView alloc] initWithFrame:[_contentView bounds] delegate:self]; - [_contentView addSubview:_dropHighlightView]; - } [_dropHighlightView setDropIndex:dropIndex]; [_dropHighlightView setDropOperation:dropOp]; @@ -2863,7 +2861,7 @@ // make sure we're consistent, also see comment above if (dragOp == NSDragOperationNone) { [_dropHighlightView setDropIndex:NSNotFound]; - [_dropHighlightView setDropOperation:FVDropBefore]; + [_dropHighlightView setDropOperation:FVDropAfter]; } [_dropHighlightView setNeedsDisplay:YES]; @@ -2873,8 +2871,12 @@ // 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 { + if (_dropHighlightView == nil) { + _dropHighlightView = [[FVDropHighlightView alloc] initWithFrame:[_contentView bounds] delegate:self]; + [_contentView addSubview:_dropHighlightView]; + } // !!! this is quite expensive to call repeatedly in -draggingUpdated - _fvFlags.dragHasURLs = FVPasteboardHasURL([sender draggingPasteboard]); + [_dropHighlightView setDragHasURLs:FVPasteboardHasURL([sender draggingPasteboard])]; return [self draggingUpdated:sender]; } @@ -2882,7 +2884,6 @@ { [_dropHighlightView removeFromSuperview]; _dropHighlightView = nil; - _fvFlags.dragHasURLs = NO; if (_fvFlags.needsReload) [self reloadIcons]; } @@ -2892,7 +2893,6 @@ { [_dropHighlightView removeFromSuperview]; _dropHighlightView = nil; - _fvFlags.dragHasURLs = NO; [self reloadIcons]; } @@ -5098,5 +5098,15 @@ @synthesize dropIndex=_dropIndex; @synthesize dropOperation=_dropOperation; +@synthesize dragHasURLs=_dragHasURLs; +- (id)initWithFrame:(NSRect)frameRect { + self = [super initWithFrame:frameRect]; + if (self) { + _dropIndex = NSNotFound; + _dropOperation = FVDropAfter; + } + return self; +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit