Adium

Changeset 24544

Show
Ignore:
Timestamp:
07/31/2008 11:51:51 PM (4 months ago)
Author:
evands
Message:

Don't allow disclosure triangle area clicks on metacontacts to expand/collapse them. Fixes #9979 for real, yo.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/AIUtilities Framework/Source/AIMultiCellOutlineView.m

    r24088 r24544  
    8282 * Called from mouseDown; separated out to let subclasses have finer granularity of control 
    8383 * 
     84 * @param theEvent The triggerring event 
     85 * @param needsExpandCollapseSuppression Pointer to a BOOL which, on return, will be YES if we need to prevent NSOutlineView from trying to expand/collapse a group. 
     86 * 
    8487 * @result YES if the event was handled; NO if it should be processed normally 
    8588 */ 
    86 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 
     89- (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent needsExpandCollapseSuppression:(BOOL *)needsExpandCollapseSuppression 
    8790{ 
    8891        NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];  
     
    9295 
    9396        //Expand/Collapse groups on mouse DOWN instead of mouse up (Makes it feel a ton faster)  
    94         if (item && [[self delegate] outlineView:self isGroup:item] &&  
     97        if (item && [self isExpandable:item] &&  
    9598                (viewPoint.x < NSHeight([self frameOfCellAtColumn:0 row:row]))) {  
    9699                /* XXX - This is kind of a hack.  We need to check < WidthOfDisclosureTriangle, and are using the fact that  
    97100                 *       the disclosure width is about the same as the height of the row to fudge it. -ai  
    98101                 */ 
    99                 if ([self isItemExpanded:item]) {  
    100                         [self collapseItem:item];  
    101                 } else {  
    102                         [self expandItem:item];  
     102                if ([[self delegate] outlineView:self isGroup:item]) { 
     103                        /* For a group, perform the expand/collapse */ 
     104                        if ([self isItemExpanded:item]) {  
     105                                [self collapseItem:item];  
     106                        } else {  
     107                                [self expandItem:item];  
     108                        } 
     109                        handled = YES; 
     110                } else { 
     111                        /* If it's not a group, we'll need to suppress NSOutlineView from trying to do an expand/contract */ 
     112                        if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = YES; 
     113                        handled = NO; 
    103114                } 
    104                 handled = YES; 
    105115                 
    106116        } else { 
     117                if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = NO; 
    107118                handled = NO; 
    108119        } 
  • trunk/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.h

    r24493 r24544  
    2020        BOOL    drawHighlightOnlyWhenMain; 
    2121        BOOL    drawsSelectedRowHighlight; 
     22         
     23        BOOL    suppressExpandCollapseRequests; 
    2224} 
    2325 
  • trunk/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m

    r24493 r24544  
    8080 * Called from mouseDown; separated out to let subclasses have finer granularity of control 
    8181 * 
     82 * @param theEvent The triggerring event 
     83 * @param needsExpandCollapseSuppression Pointer to a BOOL which, on return, will be YES if we need to prevent NSOutlineView from trying to expand/collapse a group. 
     84 * 
    8285 * @result YES if the event was handled; NO if it should be processed normally 
    8386 */ 
    84 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 
     87- (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent needsExpandCollapseSuppression:(BOOL *)needsExpandCollapseSuppression 
    8588{ 
    8689        NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];  
     
    106109        } 
    107110         
     111        if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = NO; 
     112         
    108113        return handled; 
     114} 
     115 
     116- (void)collapseItem:(id)item collapseChildren:(BOOL)collapseChildren 
     117{ 
     118        if (!suppressExpandCollapseRequests) 
     119                [super collapseItem:item collapseChildren:collapseChildren]; 
     120} 
     121 
     122- (void)expandItem:(id)item expandChildren:(BOOL)expandChildren; 
     123{ 
     124        if (!suppressExpandCollapseRequests) 
     125                [super expandItem:item expandChildren:expandChildren]; 
    109126} 
    110127 
     
    112129- (void)mouseDown:(NSEvent *)theEvent  
    113130{  
    114         if (![self handleExpandedStateToggleForEvent:theEvent]) 
     131        BOOL needsExpandCollapseSuppression; 
     132        if (![self handleExpandedStateToggleForEvent:theEvent needsExpandCollapseSuppression:&needsExpandCollapseSuppression]) { 
     133                suppressExpandCollapseRequests = needsExpandCollapseSuppression; 
    115134                [super mouseDown:theEvent];  
     135                suppressExpandCollapseRequests = NO; 
     136        } 
    116137}  
    117138