Revision: 3715
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3715&view=rev
Author:   hofman
Date:     2008-04-12 04:37:34 -0700 (Sat, 12 Apr 2008)

Log Message:
-----------
Don't prepare for drag operation, as the code was wrong and it's not necessary 
anyway. Check for insertion or highlight index when performing the drag 
operation, as these should already be updated at this point.

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

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2008-04-12 11:15:11 UTC (rev 3714)
+++ trunk/SKColorSwatch.m       2008-04-12 11:37:34 UTC (rev 3715)
@@ -418,7 +418,7 @@
 #pragma mark NSDraggingSource protocol 
 
 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal {
-    return isLocal ? NSDragOperationGeneric : NSDragOperationGeneric | 
NSDragOperationDelete;
+    return isLocal ? NSDragOperationGeneric : NSDragOperationDelete;
 }
 
 - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint 
operation:(NSDragOperation)operation {
@@ -453,6 +453,10 @@
 #pragma mark NSDraggingDestination protocol 
 
 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
+    return [self draggingUpdated:sender];
+}
+
+- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender {
     NSPoint mouseLoc = [self convertPoint:[sender draggingLocation] 
fromView:nil];
     BOOL isCopy = GetCurrentKeyModifiers() == optionKey;
     int i = isCopy ? [self insertionIndexAtPoint:mouseLoc] : [self 
colorIndexAtPoint:mouseLoc];
@@ -476,10 +480,6 @@
     return dragOp;
 }
 
-- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender {
-    return [self draggingEntered:sender];
-}
-
 - (void)draggingExited:(id <NSDraggingInfo>)sender {
     highlightedIndex = -1;
     insertionIndex = -1;
@@ -487,24 +487,11 @@
     [self setNeedsDisplay:YES];
 }
 
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
-    NSPoint mouseLoc = [self convertPoint:[sender draggingLocation] 
fromView:nil];
-    int i = [self colorIndexAtPoint:mouseLoc];
-    BOOL isCopy = GetCurrentKeyModifiers() == optionKey;
-    if ([self isEnabled] == NO || i == -1)
-        return NO;
-    else if (isCopy || [sender draggingSource] != self || draggedIndex != i)
-        return YES;
-    else
-        return NO;
-} 
-
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender{
     NSPasteboard *pboard = [sender draggingPasteboard];
     NSColor *color = [NSColor colorFromPasteboard:pboard];
-    NSPoint mouseLoc = [self convertPoint:[sender draggingLocation] 
fromView:nil];
-    BOOL isCopy = GetCurrentKeyModifiers() == optionKey;
-    int i = isCopy ? [self insertionIndexAtPoint:mouseLoc] : [self 
colorIndexAtPoint:mouseLoc];
+    BOOL isCopy = insertionIndex != -1;
+    int i = isCopy ? insertionIndex : highlightedIndex;
     
     if (i != -1 && color) {
         [self willChangeValueForKey:SKColorSwatchColorsKey];


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

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to