Adium

Changeset 24064

Show
Ignore:
Timestamp:
06/24/2008 07:33:04 PM (5 months ago)
Author:
evands
Message:

Toggle between the minimum width and the previous width when double clicking the resizing bar or thumb of a shelf view rather than hiding it permanently. Fixes #10127

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/KNShelfSplitView.h

    r20915 r24064  
    4747        NSColor *                                       shelfBackgroundColor; 
    4848        float                                           currentShelfWidth; 
     49        float                                           prevShelfWidthBeforeDoubleClick; 
    4950        BOOL                                            isShelfVisible; 
    5051        NSMenu *                                        contextButtonMenu; 
  • trunk/Source/KNShelfSplitView.m

    r22238 r24064  
    8585                 
    8686                currentShelfWidth = DEFAULT_SHELF_WIDTH; //change this 
     87                prevShelfWidthBeforeDoubleClick = currentShelfWidth; 
    8788                isShelfVisible = YES; 
    8889                shouldHilite = NO; 
     
    221222} 
    222223 
     224-(float)minimumShelfWidth 
     225{ 
     226        // The shelf can never be completely closed. We always have at least enough to show our resize thumb, otherwise 
     227        // if the delegate responds to shelfSplitView:validateWidth:, we use that width as our minimum shelf size 
     228        float                           minShelf = THUMB_WIDTH; 
     229        if( delegateHasValidateWidth ){ 
     230                float                           requestedWidth = [delegate shelfSplitView:self validateWidth: 0]; 
     231                if( requestedWidth > minShelf ){ 
     232                        minShelf = requestedWidth; 
     233                } 
     234        } 
     235         
     236        return minShelf; 
     237} 
     238 
    223239-(void)setShelfWidth:(float)aWidth{ 
    224         float                           newWidth = aWidth; 
    225          
    226          
     240        float newWidth = aWidth; 
     241 
    227242        // The shelf can never be completely closed. We always have at least enough to show our resize thumb, otherwise 
    228243        // if the delegate responds to shelfSplitView:validateWidth:, we use that width as our minimum shelf size 
     
    234249                } 
    235250        } 
     251         
    236252        if( minShelf > newWidth ){ 
    237253                newWidth = minShelf; 
     
    412428        if( activeControlPart != CONTROL_PART_NONE ){ 
    413429                if([anEvent clickCount] == 2){ 
    414                         [self setShelfIsVisible: NO]; 
     430                        if( (activeControlPart == CONTROL_PART_RESIZE_THUMB) || (activeControlPart == CONTROL_PART_RESIZE_BAR) ){ 
     431                                float minShelfWidth = [self minimumShelfWidth]; 
     432                                if (currentShelfWidth > minShelfWidth) { 
     433                                        prevShelfWidthBeforeDoubleClick = currentShelfWidth; 
     434                                        [self setShelfWidth:minShelfWidth]; 
     435                                } else { 
     436                                        [self setShelfWidth:prevShelfWidthBeforeDoubleClick]; 
     437                                } 
     438                        } 
     439 
    415440                } else { 
    416441                while( stillMouseDown ){