Revision: 26746
          http://sourceforge.net/p/bibdesk/svn/26746
Author:   hofman
Date:     2021-08-26 09:42:27 +0000 (Thu, 26 Aug 2021)
Log Message:
-----------
Supply dragging source operation mask from delegate in person controller, and 
default to the one for the address field, so the address field does not need to 
be delegate.

Modified Paths:
--------------
    trunk/bibdesk/BDSKAddressTextField.m
    trunk/bibdesk/BDSKDragImageView.m
    trunk/bibdesk/BDSKPersonController.m

Modified: trunk/bibdesk/BDSKAddressTextField.m
===================================================================
--- trunk/bibdesk/BDSKAddressTextField.m        2021-08-26 09:38:53 UTC (rev 
26745)
+++ trunk/bibdesk/BDSKAddressTextField.m        2021-08-26 09:42:27 UTC (rev 
26746)
@@ -44,9 +44,6 @@
 #define CONTROL_SIZE 16.0
 #define CONTROL_MARGIN 3.0
 
-@interface BDSKAddressTextField () <BDSKDragImageViewDelegate>
-@end
-
 @implementation BDSKAddressTextField
 
 @synthesize imageView, button, URL;
@@ -63,7 +60,6 @@
         [imageView setImageScaling:NSImageScaleProportionallyUpOrDown];
         [imageView setRefusesFirstResponder:YES];
         [imageView setTranslatesAutoresizingMaskIntoConstraints:NO];
-        [(BDSKDragImageView *)imageView setDelegate:self];
         [imageView addConstraints:[NSArray arrayWithObjects:
             [NSLayoutConstraint constraintWithWidth:CONTROL_SIZE 
forItem:imageView],
             [NSLayoutConstraint constraintWithHeight:CONTROL_SIZE 
forItem:imageView], nil]];
@@ -181,8 +177,4 @@
     return [super setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
 }
 
-- (NSDragOperation)dragImageView:(BDSKDragImageView *)view 
sourceOperationMaskForDraggingContext:(NSDraggingContext)context {
-    return NSDragOperationCopy | NSDragOperationLink | NSDragOperationGeneric 
| NSDragOperationPrivate;
-}
-
 @end

Modified: trunk/bibdesk/BDSKDragImageView.m
===================================================================
--- trunk/bibdesk/BDSKDragImageView.m   2021-08-26 09:38:53 UTC (rev 26745)
+++ trunk/bibdesk/BDSKDragImageView.m   2021-08-26 09:42:27 UTC (rev 26746)
@@ -103,7 +103,7 @@
 - (NSDragOperation)draggingSession:(NSDraggingSession *)session 
sourceOperationMaskForDraggingContext:(NSDraggingContext)context {
     if ([[self delegate] 
respondsToSelector:@selector(dragImageView:sourceOperationMaskForDraggingContext:)])
         return [[self delegate] dragImageView:self 
sourceOperationMaskForDraggingContext:context];
-    return context == NSDraggingContextWithinApplication ? NSDragOperationNone 
: NSDragOperationCopy;
+    return NSDragOperationCopy | NSDragOperationLink | NSDragOperationGeneric;
 }
 
 // flag changes during a drag are not forwarded to the application, so we fix 
that at the end of the drag

Modified: trunk/bibdesk/BDSKPersonController.m
===================================================================
--- trunk/bibdesk/BDSKPersonController.m        2021-08-26 09:38:53 UTC (rev 
26745)
+++ trunk/bibdesk/BDSKPersonController.m        2021-08-26 09:42:27 UTC (rev 
26746)
@@ -495,6 +495,10 @@
        return [[[NSWorkspace sharedWorkspace] iconForFileType:@"vcf"] 
dragImageWithCount:1];
 }
 
+- (NSDragOperation)dragImageView:(BDSKDragImageView *)view 
sourceOperationMaskForDraggingContext:(NSDraggingContext)context {
+    return context == NSDraggingContextWithinApplication ? NSDragOperationNone 
: NSDragOperationCopy;
+}
+
 - (void)pasteboard:(NSPasteboard *)pboard item:(NSPasteboardItem *)item 
provideDataForType:(NSString *)type {
     if ([type isEqualToString:(NSString *)kPasteboardTypeFileURLPromise]) {
         NSURL *dropDestination = [pboard pasteLocationURL];

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

Reply via email to