Revision: 15244
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15244&view=rev
Author:   hofman
Date:     2009-04-29 22:05:24 +0000 (Wed, 29 Apr 2009)

Log Message:
-----------
improve group cell mouse down, ignore clicks outside editable area

Modified Paths:
--------------
    trunk/bibdesk/BDSKGroupOutlineView.m

Modified: trunk/bibdesk/BDSKGroupOutlineView.m
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.m        2009-04-29 21:34:36 UTC (rev 
15243)
+++ trunk/bibdesk/BDSKGroupOutlineView.m        2009-04-29 22:05:24 UTC (rev 
15244)
@@ -115,18 +115,26 @@
     NSPoint point = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     NSInteger row = [self rowAtPoint:point];
     NSInteger column = [self columnAtPoint:point];
-    if (row != -1 && column == 0) {
-        BDSKGroupCell *cell = [[[self tableColumns] objectAtIndex:0] 
dataCellForRow:row];
-        if ([cell respondsToSelector:@selector(iconRectForBounds:)]) {
-            NSRect iconRect = [cell iconRectForBounds:[self 
frameOfCellAtColumn:column row:row]];
-            if (NSMouseInRect(point, iconRect, [self isFlipped])) {
-                if ([theEvent clickCount] == 2) {
-                    if ([[self delegate] 
respondsToSelector:@selector(outlineView:doubleClickedOnIconOfItem:)])
-                        [[self delegate] outlineView:self 
doubleClickedOnIconOfItem:[self itemAtRow:row]];
-                    return;
-                } else if ([self isRowSelected:row]) {
-                    return;
-                }
+    if (row != -1 && column == 0 && [self isRowSelected:row]) {
+        id cell = nil;
+        if ([self respondsToSelector:@selector(preparedCellAtColumn:row:)])
+            cell = [self preparedCellAtColumn:column row:row];
+        else
+            cell = [[[self tableColumns] objectAtIndex:0] dataCellForRow:row];
+        if ([cell isKindOfClass:[BDSKGroupCell class]]) {
+            NSRect cellFrame = [self frameOfCellAtColumn:column row:row];
+            NSUInteger hit = NSCellHitNone;
+            if ([NSCell 
instancesRespondToSelector:@selector(hitTestForEvent:inRect:ofView:)])
+                hit = [cell hitTestForEvent:theEvent inRect:cellFrame 
ofView:self];
+            else if (NSMouseInRect(point, [cell iconRectForBounds:cellFrame], 
[self isFlipped]))
+                hit = NSCellHitContentArea;
+            else if (NSMouseInRect(point, [cell textRectForBounds:cellFrame], 
[self isFlipped]))
+                hit = NSCellHitContentArea | NSCellHitEditableTextArea;
+            if ((hit & NSCellHitEditableTextArea) == 0) {
+                if ((hit & NSCellHitContentArea) != 0 && [theEvent clickCount] 
== 2 && 
+                    [[self delegate] 
respondsToSelector:@selector(outlineView:doubleClickedOnIconOfItem:)])
+                    [[self delegate] outlineView:self 
doubleClickedOnIconOfItem:[self itemAtRow:row]];
+                return;
             }
         }
     }


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

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to