Revision: 4483
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4483&view=rev
Author:   hofman
Date:     2008-08-30 17:58:02 +0000 (Sat, 30 Aug 2008)

Log Message:
-----------
Don't eat up mouse events when the user clicks in a resize area of a note table 
row but does not actually resize. This will call super with an invalid event 
queue, because we've already eaten up the mouseUp event. Instead peek the next 
mouse event and only resize when it's a mouseDragged. Also only resize on a 
first click, as a double-click is always expected to be an edit or selection. 

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

Modified: trunk/SKNoteOutlineView.m
===================================================================
--- trunk/SKNoteOutlineView.m   2008-08-30 16:41:47 UTC (rev 4482)
+++ trunk/SKNoteOutlineView.m   2008-08-30 17:58:02 UTC (rev 4483)
@@ -59,12 +59,11 @@
         [self setFont:[NSFont systemFontOfSize:[fontSize floatValue]]];
 }
 
-- (BOOL)resizeRow:(int)row withEvent:(NSEvent *)theEvent {
+- (void)resizeRow:(int)row withEvent:(NSEvent *)theEvent {
     id item = [self itemAtRow:row];
     NSPoint startPoint = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     float startHeight = [[self delegate] outlineView:self 
heightOfRowByItem:item];
        BOOL keepGoing = YES;
-    BOOL dragged = NO;
        
     [[NSCursor resizeUpDownCursor] push];
     
@@ -79,8 +78,6 @@
                 [[self delegate] outlineView:self setHeightOfRow:currentHeight 
byItem:item];
                 [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndex:row]];
                 
-                dragged = YES;
-                
                 break;
                        }
             
@@ -93,20 +90,20 @@
         }
     }
     [NSCursor pop];
-    
-    return dragged;
 }
 
 - (void)mouseDown:(NSEvent *)theEvent {
-    if ([[self delegate] 
respondsToSelector:@selector(outlineView:canResizeRowByItem:)] && [[self 
delegate] respondsToSelector:@selector(outlineView:setHeightOfRow:byItem:)]) {
+    if ([theEvent clickCount] == 1 && [[self delegate] 
respondsToSelector:@selector(outlineView:canResizeRowByItem:)] && [[self 
delegate] respondsToSelector:@selector(outlineView:setHeightOfRow:byItem:)]) {
         NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
         int row = [self rowAtPoint:mouseLoc];
         
         if (row != -1 && [[self delegate] outlineView:self 
canResizeRowByItem:[self itemAtRow:row]]) {
-            NSRect ignored, rect = [self rectOfRow:row];
-            NSDivideRect(rect, &rect, &ignored, 5.0, [self isFlipped] ? 
NSMaxYEdge : NSMinYEdge);
-            if (NSPointInRect(mouseLoc, rect) && [self resizeRow:row 
withEvent:theEvent])
+            NSRect ignored, rect;
+            NSDivideRect([self rectOfRow:row], &rect, &ignored, 5.0, [self 
isFlipped] ? NSMaxYEdge : NSMinYEdge);
+            if (NSPointInRect(mouseLoc, rect) && NSLeftMouseDragged == [[NSApp 
nextEventMatchingMask:(NSLeftMouseUpMask | NSLeftMouseDraggedMask) 
untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:NO] type]) 
{
+                [self resizeRow:row withEvent:theEvent];
                 return;
+            }
         }
     }
     [super mouseDown:theEvent];


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 Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to