Changeset 2039

Show
Ignore:
Timestamp:
10/21/04 14:14:19 (4 years ago)
Author:
timothy
Message:

Latest Adium tab code. Merged our tooltip code in.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/overhaul/AICustomTabDragWindow.h

    r1823 r2039  
    77// 
    88 
    9 @class ESFloater; 
    10 @class AICustomTabsView; 
    11 @class AICustomTabCell; 
     9@class ESFloater, AICustomTabsView, AICustomTabCell; 
    1210 
    1311@interface AICustomTabDragWindow : NSObject { 
  • branches/overhaul/AICustomTabDragWindow.m

    r1823 r2039  
    3434        floaterTabImage = [[self dragTabImageForTabCell:inTabCell inCustomTabsView:inTabView] retain]; 
    3535        floaterWindowImage = [[self dragWindowImageForWindow:[inTabView window] customTabsView:inTabView tabCell:inTabCell] retain]; 
    36         useFancyAnimations = (NSAppKitVersionNumber >= 700. && floaterWindowImage); 
     36        useFancyAnimations = ( floaterWindowImage ? YES : NO ); 
    3737         
    3838        if(useFancyAnimations){ 
    3939                //Create a floating window for our tab 
    40                 dragTabFloater = [ESFloater floaterWithImage:floaterTabImage styleMask:NSBorderlessWindowMask title:nil]; 
    41                 [dragTabFloater setMaxOpacity:( transparent ? 0.75 : 1. )]; 
     40                dragTabFloater = [ESFloater floaterWithImage:floaterTabImage styleMask:NSBorderlessWindowMask]; 
     41                [dragTabFloater setMaxOpacity:1.0]; 
    4242                 
    4343                //Create a floating window for the stand-alone window our tab would produce 
    44                 dragWindowFloater = [ESFloater floaterWithImage:floaterWindowImage styleMask:[[inTabView window] styleMask] title:[[inTabView window] title]]; 
    45                 [dragWindowFloater setMaxOpacity:( transparent ? 0.75 : 1. )]; 
     44                dragWindowFloater = [ESFloater floaterWithImage:floaterWindowImage styleMask:NSTitledWindowMask]; 
     45                [dragWindowFloater setMaxOpacity:(transparent ? 0.75 : 1.00)]; 
    4646        } 
    4747                 
  • trunk/AICustomTabCell.h

    r1720 r2039  
    1414 \------------------------------------------------------------------------------------------------------ */ 
    1515 
    16 @interface NSObject (AICustomTabViewItem) 
     16@protocol AICustomTabViewItem 
    1717- (NSString *)label; 
    1818- (NSImage *)icon; 
    19 - (BOOL) isEnabled; 
    2019@end 
    2120 
     21@class AICustomTabsView; 
     22 
    2223@interface AICustomTabCell : NSCell { 
    23         BOOL                            wasEnabled; 
    24     BOOL                                selected; 
    25     BOOL                                highlighted; 
    26     BOOL                                allowsInactiveTabClosing; 
     24    BOOL                                                                selected; 
     25    BOOL                                                                highlighted; 
     26    BOOL                                                                allowsInactiveTabClosing; 
    2727     
    28     BOOL                                trackingClose; 
    29     BOOL                                hoveringClose; 
     28    BOOL                                                               trackingClose; 
     29    BOOL                                                               hoveringClose; 
    3030     
    31     NSTrackingRectTag   trackingTag; 
    32     NSDictionary        *userData; 
    33     NSTrackingRectTag   closeTrackingTag; 
    34     NSDictionary        *closeUserData; 
    35         NSToolTipTag            toolTipTag; 
     31    NSTrackingRectTag                                   trackingTag; 
     32    NSTrackingRectTag                                   closeTrackingTag; 
     33    NSTrackingRectTag                                   toolTipTag; 
    3634     
    37         NSAttributedString      *attributedLabel; 
    38     NSTabViewItem               *tabViewItem; 
    39     NSRect                              frame; 
     35        NSAttributedString                                      *attributedLabel; 
     36    NSTabViewItem<AICustomTabViewItem>  *tabViewItem; 
     37    NSRect                                                              frame; 
     38         
     39        AICustomTabsView                                        *view; 
    4040} 
    4141 
    42 + (id)customTabForTabViewItem:(NSTabViewItem *)inTabViewItem
     42+ (id)customTabForTabViewItem:(NSTabViewItem<AICustomTabViewItem> *)inTabViewItem customTabsView:(AICustomTabsView *)inView
    4343- (void)setAllowsInactiveTabClosing:(BOOL)inValue; 
    4444- (BOOL)allowsInactiveTabClosing; 
    4545- (void)setSelected:(BOOL)inSelected; 
    4646- (BOOL)isSelected; 
    47 - (void)setHighlighted:(BOOL)inHighlighted; 
     47- (void)setHoveringClose:(BOOL)hovering; 
     48- (void)setHighlighted:(BOOL)inHighlight; 
    4849- (BOOL)isHighlighted; 
    4950- (void)setFrame:(NSRect)inFrame; 
     
    5455- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView; 
    5556- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView ignoreSelection:(BOOL)ignoreSelection; 
    56 - (void)addTrackingRectsInView:(NSView *)view withFrame:(NSRect)trackRect cursorLocation:(NSPoint)cursorLocation; 
    57 - (void)removeTrackingRectsFromView:(NSView *)view
     57- (void)addTrackingRectsWithFrame:(NSRect)trackRect cursorLocation:(NSPoint)cursorLocation; 
     58- (void)removeTrackingRects
    5859- (void)mouseEntered:(NSEvent *)theEvent; 
    5960- (void)mouseExited:(NSEvent *)theEvent; 
  • trunk/AICustomTabCell.m

    r1823 r2039  
    2727static NSImage          *tabCloseFrontPressed = nil; 
    2828static NSImage          *tabCloseFrontRollover = nil; 
     29static NSSize           leftCapSize; 
     30static NSSize           rightCapSize; 
    2931 
    3032#define TAB_CLOSE_LEFTPAD               2               //Padding left of close button 
    3133#define TAB_CLOSE_RIGHTPAD              3               //Padding right of close button 
    3234 
    33 #define TAB_CLOSE_Y_OFFSET              1       //Vertical offset of close button from center 
     35#define TAB_CLOSE_Y_OFFSET              2       //Vertical offset of close button from center 
    3436 
    3537#define TAB_RIGHT_PAD                   5       //Tab right edge padding 
     
    4042 
    4143@interface AICustomTabCell (PRIVATE) 
    42 - (id)initForTabViewItem:(NSTabViewItem *)inTabViewItem
     44- (id)initForTabViewItem:(NSTabViewItem<AICustomTabViewItem> *)inTabViewItem customTabsView:(AICustomTabsView *)inView
    4345- (NSRect)_closeButtonRect; 
    4446@end 
     
    4749 
    4850//Create a new custom tab 
    49 + (id)customTabForTabViewItem:(NSTabViewItem *)inTabViewItem 
    50 { 
    51     return([[[self alloc] initForTabViewItem:inTabViewItem] autorelease]); 
     51+ (id)customTabForTabViewItem:(NSTabViewItem<AICustomTabViewItem> *)inTabViewItem customTabsView:(AICustomTabsView *)inView 
     52{ 
     53    return([[[self alloc] initForTabViewItem:inTabViewItem customTabsView:inView] autorelease]); 
    5254} 
    5355 
    5456//init 
    55 - (id)initForTabViewItem:(NSTabViewItem *)inTabViewItem 
     57- (id)initForTabViewItem:(NSTabViewItem<AICustomTabViewItem> *)inTabViewItem customTabsView:(AICustomTabsView *)inView 
    5658{ 
    5759    static BOOL haveLoadedImages = NO; 
     
    6466                tabFrontMiddle = [[NSImage imageNamed:@"aquaTabMiddle"] retain]; 
    6567                tabFrontRight = [[NSImage imageNamed:@"aquaTabRight"] retain]; 
    66  
    67 //              NSControlTint   tint = [NSColor currentControlTintSupportingJag]; 
     68                 
    6869                tabCloseFront = [[NSImage imageNamed:@"aquaTabClose"] retain]; 
    6970                tabCloseBack = [[NSImage imageNamed:@"aquaTabCloseBack"] retain]; 
     
    7172                tabCloseFrontRollover = [[NSImage imageNamed:@"aquaTabCloseRollover"] retain]; 
    7273 
     74                leftCapSize = [tabFrontLeft size]; 
     75                rightCapSize = [tabFrontRight size]; 
     76                 
    7377        haveLoadedImages = YES; 
    7478    } 
    7579         
    7680    tabViewItem = [inTabViewItem retain]; 
     81        view = inView; 
    7782    allowsInactiveTabClosing = NO; 
    78         wasEnabled = YES; 
    7983    trackingClose = NO; 
    8084    hoveringClose = NO; 
     
    99103- (NSSize)size 
    100104{ 
    101         int width = [tabFrontLeft size].width + [[self attributedLabel] size].width + [tabFrontRight size].width + 
     105        int width = leftCapSize.width + [[self attributedLabel] size].width + rightCapSize.width + 
    102106        (TAB_CLOSE_LEFTPAD + [[tabViewItem icon] size].width + TAB_CLOSE_RIGHTPAD) + TAB_RIGHT_PAD; 
    103107         
    104     return( NSMakeSize((width > TAB_MIN_WIDTH ? width : TAB_MIN_WIDTH), [tabFrontLeft size].height) ); 
     108    return( NSMakeSize((width > TAB_MIN_WIDTH ? width : TAB_MIN_WIDTH), leftCapSize.height) ); 
    105109} 
    106110 
     
    134138        NSSize  iconSize = [[tabViewItem icon] size]; 
    135139        NSSize  closeSize = [tabCloseFront size]; 
    136     int         centeredYPos = frame.origin.y + (frame.size.height - [tabCloseFront size].height) / 2.0; 
    137     return(NSMakeRect(frame.origin.x + [tabFrontLeft size].width + TAB_CLOSE_LEFTPAD + ((iconSize.width - closeSize.width) / 2.0), 
    138                                           centeredYPos + TAB_CLOSE_Y_OFFSET + 1, 
     140    int         centerY = (frame.size.height - [tabCloseFront size].height) / 2.0; 
     141 
     142    return(NSMakeRect(frame.origin.x + leftCapSize.width + TAB_CLOSE_LEFTPAD + ((iconSize.width - closeSize.width) / 2.0), 
     143                                          frame.origin.y + centerY + TAB_CLOSE_Y_OFFSET + 1, 
    139144                                          [tabCloseFront size].width, 
    140145                                          [tabCloseFront size].height)); 
     146} 
     147 
     148//Frame of our tab icon 
     149- (NSRect)_tabIconRect 
     150{ 
     151        NSSize  imageSize = [[tabViewItem icon] size]; 
     152        int             centerY = (frame.size.height - imageSize.height) / 2.0; 
     153         
     154        return(NSMakeRect(frame.origin.x + leftCapSize.width + TAB_CLOSE_LEFTPAD, 
     155                                          frame.origin.y + centerY + TAB_CLOSE_Y_OFFSET, 
     156                                          imageSize.width, 
     157                                          imageSize.height)); 
    141158} 
    142159 
     
    163180 
    164181//When a tab is hovered it should be highlighted.  Highlighted tabs draw differently. 
    165 - (void)setHighlighted:(BOOL)inHighlighted 
    166 
    167     highlighted = inHighlighted; 
     182- (void)setHighlighted:(BOOL)inHighlight 
     183
     184        if(highlighted != inHighlight){ 
     185                highlighted = inHighlight; 
     186        [view setNeedsDisplayInRect:[self frame]]; 
     187        } 
    168188} 
    169189- (BOOL)isHighlighted{ 
    170190    return(highlighted); 
     191} 
     192 
     193//Set whether the close button is currently hovered 
     194- (void)setHoveringClose:(BOOL)hovering 
     195{ 
     196        if(hoveringClose != hovering){ 
     197                hoveringClose = hovering; 
     198        [view setNeedsDisplayInRect:NSUnionRect([self _tabIconRect],[self _closeButtonRect])]; 
     199        } 
    171200} 
    172201 
     
    192221- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView ignoreSelection:(BOOL)ignoreSelection 
    193222{ 
    194     int         leftCapWidth, rightCapWidth, middleSourceWidth, middleRightEdge, middleLeftEdge; 
     223    int         middleSourceWidth, middleRightEdge, middleLeftEdge; 
    195224    NSRect      sourceRect, destRect; 
    196225    NSSize      labelSize; 
     
    199228    //Pre-calc some dimensions 
    200229    labelSize = [tabViewItem sizeOfLabel:NO]; 
    201     leftCapWidth = [tabFrontLeft size].width; 
    202     rightCapWidth = [tabFrontRight size].width; 
    203230    middleSourceWidth = [tabFrontMiddle size].width; 
    204     middleRightEdge = (rect.origin.x + rect.size.width - rightCapWidth); 
    205     middleLeftEdge = (rect.origin.x + leftCapWidth); 
     231    middleRightEdge = (rect.origin.x + rect.size.width - rightCapSize.width); 
     232    middleLeftEdge = (rect.origin.x + leftCapSize.width); 
    206233         
    207234    //Background 
     
    230257    } 
    231258         
    232     //Offset for icon 
    233     rect.origin.x += leftCapWidth; 
    234     rect.size.width -= leftCapWidth + rightCapWidth; 
    235      
    236259        //We'll display our close icon if the user is hovering.  Otherwise, we display the tab specified icon 
    237260        NSImage *leftIcon = [tabViewItem icon]; 
     
    245268 
    246269        }else{ 
    247                 destPoint = NSMakePoint(frame.origin.x + [tabFrontLeft size].width + TAB_CLOSE_LEFTPAD, 
    248                                                                 ((frame.size.height - [leftIcon size].height) / 2.0) + TAB_CLOSE_Y_OFFSET); 
     270                destPoint = [self _tabIconRect].origin; 
    249271        } 
    250  
    251         // Draw at whole pixel points only. 
    252         destPoint.y = ceilf( destPoint.y ); 
    253         destPoint.x = ceilf( destPoint.x ); 
    254  
    255         [leftIcon compositeToPoint:destPoint operation:NSCompositeSourceOver fraction:( [tabViewItem isEnabled] ? 1. : 0.5 )]; 
     272        [leftIcon compositeToPoint:destPoint operation:NSCompositeSourceOver]; 
    256273 
    257274        //Move over for label drawing.  We always move based on the tab icon and not on the close button.  This prevents 
    258275        //tab text from jumping when hovered if the tab icons are a different size from the close button 
    259         NSSize leftIconSize = [[tabViewItem icon] size]; 
    260         rect.origin.x += TAB_CLOSE_LEFTPAD + leftIconSize.width + TAB_CLOSE_RIGHTPAD; 
    261         rect.size.width -= TAB_CLOSE_LEFTPAD + leftIconSize.width + TAB_CLOSE_RIGHTPAD + TAB_RIGHT_PAD; 
    262  
     276        int     offsetX = leftCapSize.width + TAB_CLOSE_LEFTPAD + [self _tabIconRect].size.width + TAB_CLOSE_RIGHTPAD; 
     277        rect.origin.x += offsetX; 
     278        rect.size.width -= offsetX + TAB_RIGHT_PAD; 
    263279         
    264280        //Draw our label 
     
    276292        NSString        *label = [tabViewItem label]; 
    277293         
    278         if(![label isEqualToString:[attributedLabel string]] || wasEnabled != [tabViewItem isEnabled] ){ 
    279                 wasEnabled = [tabViewItem isEnabled]; 
     294        if(![label isEqualToString:[attributedLabel string]]){ 
    280295                //Paragraph Style (Turn off clipping by word) 
    281296                NSMutableParagraphStyle *paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; 
    282297                [paragraphStyle setAlignment:NSCenterTextAlignment]; 
    283298                [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; 
    284  
     299                 
    285300                //Update the attributed string 
    286301                [attributedLabel release]; 
    287                 attributedLabel = [[NSAttributedString alloc] initWithString:label attributes: 
     302                attributedLabel = [[NSAttributedString alloc] initWithString:[tabViewItem label] attributes: 
    288303                        [NSDictionary dictionaryWithObjectsAndKeys: 
    289                                 ( wasEnabled ? [NSColor controlTextColor] : [[NSColor controlTextColor] colorWithAlphaComponent:0.5] ), NSForegroundColorAttributeName, 
     304                                [NSColor controlTextColor], NSForegroundColorAttributeName, 
    290305                                [NSFont systemFontOfSize:11], NSFontAttributeName, 
    291306                                paragraphStyle, NSParagraphStyleAttributeName, 
     
    300315#pragma mark Cursor tracking 
    301316//Install tracking rects for our tab and its close button 
    302 - (void)addTrackingRectsInView:(NSView *)view withFrame:(NSRect)trackRect cursorLocation:(NSPoint)cursorLocation 
    303 
    304     userData = [[NSDictionary dictionaryWithObjectsAndKeys:view, @"view", nil] retain]; //We have to retain and release the userData ourself 
     317- (void)addTrackingRectsWithFrame:(NSRect)trackRect cursorLocation:(NSPoint)cursorLocation 
     318
    305319    trackingTag = [view addTrackingRect:trackRect 
    306320                                  owner:self 
    307                                userData:userData 
     321                               userData:nil 
    308322                           assumeInside:NSPointInRect(cursorLocation, trackRect)]; 
    309     highlighted = NSPointInRect(cursorLocation, trackRect); 
    310          
    311     closeUserData = [[NSDictionary dictionaryWithObjectsAndKeys:view, @"view", [NSNumber numberWithBool:YES], @"close", nil] retain]; //We have to retain and release the userData ourself 
     323    [self setHighlighted:NSPointInRect(cursorLocation, trackRect)]; 
     324         
    312325    closeTrackingTag = [view addTrackingRect:[self _closeButtonRect] 
    313326                                       owner:self 
    314                                     userData:closeUserData 
     327                                    userData:nil 
    315328                                assumeInside:NSPointInRect(cursorLocation, [self _closeButtonRect])]; 
    316     hoveringClose = NSPointInRect(cursorLocation, [self _closeButtonRect])
    317          
     329    [self setHoveringClose:NSPointInRect(cursorLocation, [self _closeButtonRect])]
     330 
    318331        toolTipTag = [view addToolTipRect:trackRect owner:view userData:NULL]; 
    319332} 
    320333 
    321334//Remove our tracking rects 
    322 - (void)removeTrackingRectsFromView:(NSView *)view 
     335- (void)removeTrackingRects 
    323336{ 
    324337    [view removeTrackingRect:trackingTag]; trackingTag = 0; 
    325     [userData autorelease]; userData = nil; 
    326  
    327338    [view removeTrackingRect:closeTrackingTag]; closeTrackingTag = 0; 
    328     [closeUserData autorelease]; closeUserData = nil; 
    329          
    330339        [view removeToolTip:toolTipTag]; toolTipTag = 0; 
    331340} 
     
    334343- (void)mouseEntered:(NSEvent *)theEvent 
    335344{ 
    336     NSDictionary    *eventData = [theEvent userData]; 
    337     NSView          *view = [eventData objectForKey:@"view"]; 
    338  
    339345        //Scrubs the tab if control is down. 
    340 //    if(([theEvent modifierFlags] & NSAlternateKeyMask) && !selected){ 
    341 //            [[tabViewItem tabView] selectTabViewItem:tabViewItem]; 
    342 //    } 
    343          
    344     //Set ourself (or our close button) has hovered 
    345     if((allowsInactiveTabClosing || selected || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask ) ) && [[eventData objectForKey:@"close"] boolValue]){ 
    346         hoveringClose = YES; 
    347         [view setNeedsDisplayInRect:[self frame]]; 
     346      if(([theEvent modifierFlags] & NSAlternateKeyMask) && !selected){ 
     347              [[tabViewItem tabView] selectTabViewItem:tabViewItem]; 
     348      } 
     349         
     350    //Set ourself (or our close button) as hovered 
     351    if((allowsInactiveTabClosing || selected || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask )) && 
     352           ([theEvent trackingNumber] == closeTrackingTag)){ 
     353               [self setHoveringClose:YES]; 
    348354    }else{ 
    349         highlighted = YES; 
    350         [view setNeedsDisplayInRect:[self frame]]; 
    351     } 
    352 
    353  
    354 //Mouse left one of our tabs 
     355                [self setHighlighted:YES]; 
     356    } 
     357
     358 
     359//Mouse left one of our tabs - Set ourself (or our close button) as not hovered 
    355360- (void)mouseExited:(NSEvent *)theEvent 
    356361{ 
    357     NSDictionary    *eventData = [theEvent userData]; 
    358     NSView          *view = [eventData objectForKey:@"view"]; 
    359          
    360     //Set ourself (or our close button) has not hovered 
    361     if([[eventData objectForKey:@"close"] boolValue]){ 
    362         hoveringClose = NO; 
    363         [view setNeedsDisplayInRect:[self frame]]; 
     362    if([theEvent trackingNumber] == closeTrackingTag){ 
     363                [self setHoveringClose:NO]; 
    364364    }else{ 
    365         highlighted = NO; 
    366         [view setNeedsDisplayInRect:[self frame]]; 
     365                [self setHighlighted:NO]; 
    367366    } 
    368367} 
     
    374373- (BOOL)willTrackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView 
    375374{ 
    376     if((allowsInactiveTabClosing || selected || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask ) ) && 
     375    if((allowsInactiveTabClosing || selected || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask )) && 
    377376           (SHOW_CLOSE_BUTTON_FOR_SINGLE_TAB || [[tabViewItem tabView] numberOfTabViewItems] != 1) && 
    378377           NSPointInRect([controlView convertPoint:[theEvent locationInWindow] fromView:nil], [self _closeButtonRect])){ 
  • trunk/AICustomTabDragging.h

    r1660 r2039  
    1212#define AICustomTabDragDidComplete      @"AICustomTabDragDidComplete" 
    1313 
    14 @class AICustomTabDragWindow, AICustomTabsView, AICustomTabCell
     14@class AICustomTabCell,AICustomTabDragWindow, AICustomTabsView
    1515 
    1616@interface AICustomTabDragging : NSObject { 
  • trunk/AICustomTabDragging.m

    r1823 r2039  
    126126        if(sourceWindowWillHide){ 
    127127                [[sourceTabBar window] setAlphaValue:0.0]; 
    128                 [[[sourceTabBar window] drawers] makeObjectsPerformSelector:@selector(close)]; 
    129128        } 
    130129         
     
    202201- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation 
    203202{        
    204         if(operation == 0){ //when dropped on the screen 
     203        if(operation == NSDragOperationNone){ //when dropped on the screen 
    205204                //Sneaky Bug Fix --- 
    206205                //If a drag is done very quickly, the system will fail to send our tab bar a draggingExited event, even though 
  • trunk/AICustomTabsView.h

    r1823 r2039  
    1717#define TAB_CELL_IDENTIFIER     @"Tab Cell Identifier" 
    1818 
    19 @class AICustomTabCell; 
    20 @class AICustomTabsView; 
     19@class AICustomTabCell, AICustomTabsView; 
    2120 
    2221@interface NSObject (AICustomTabsViewDelegate) 
  • trunk/AICustomTabsView.m

    r1823 r2039  
    154154        allowsTabRearranging = inValue; 
    155155} 
    156  
    157156- (BOOL)allowsTabRearranging 
    158157{ 
     
    229228                //Account for shifting 
    230229                if(currentIndex < newIndex) newIndex--; 
    231  
     230                 
    232231                //Move via a remove and add :( 
    233232                [tabCell retain]; 
     
    235234                [tabCellArray insertObject:tabCell atIndex:newIndex]; 
    236235                [tabCell release]; 
    237  
     236                 
    238237                //Move the tab 
    239238                ignoreTabNumberChange = YES; 
     
    356355                 
    357356                //Create a new tab cell 
    358                 tabCell = [AICustomTabCell customTabForTabViewItem:tabViewItem]; 
     357                tabCell = [AICustomTabCell customTabForTabViewItem:tabViewItem customTabsView:self]; 
    359358                [tabCell setSelected:(tabViewItem == [tabView selectedTabViewItem])]; 
    360359                [tabCell setAllowsInactiveTabClosing:allowsInactiveTabClosing]; 
     
    434433    int                         totalTabWidth; 
    435434    int                         reducedWidth = 0; 
    436     float                     reduceThreshold = 1000000; 
     435    int                               reduceThreshold = 1000000; 
    437436 
    438437    //Get the total tab width 
     
    535534                tabDivider = [[NSImage imageNamed:@"aquaTabDivider"] retain]; 
    536535                tabBackground = [[NSImage imageNamed:@"aquaTabBackground"] retain]; 
    537  
    538536        haveLoadedImages = YES; 
    539537    } 
     
    625623    AICustomTabCell     *tabCell = [self tabAtPoint:clickLocation]; 
    626624         
    627         [tabView selectTabViewItem:[tabCell tabViewItem]]; 
    628          
    629625    //Pass this on to our delegate 
    630626    if(tabCell && [delegate respondsToSelector:@selector(customTabView:menuForTabViewItem:)]){ 
     
    633629    return(nil); 
    634630} 
     631 
    635632 
    636633//Tooltip ------------------------------------------------------------------------------------------------------ 
     
    640637        NSPoint         location = [self convertPoint:point fromView:nil]; 
    641638    AICustomTabCell     *tabCell = [self tabAtPoint:location]; 
    642  
    643    //Pass this on to our delegate 
     639         
     640       //Pass this on to our delegate 
    644641    if(tabCell && [delegate respondsToSelector:@selector(customTabView:toolTipForTabViewItem:)]){ 
    645642        return([delegate customTabView:self toolTipForTabViewItem:[tabCell tabViewItem]]); 
     
    661658    if(tabCell = [self tabAtPoint:lastClickLocation]){ 
    662659        if(![tabCell willTrackMouse:theEvent inRect:[tabCell frame] ofView:self]){ 
    663 //                      if(! ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask ) ){ //Allow background dragging 
     660//                      if(!( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask )){ //Allow background dragging 
    664661                [tabView selectTabViewItem:[tabCell tabViewItem]]; 
    665662//            } 
     
    704701} 
    705702 
    706 //Dragging ------------------------------------------------------------------------------------------------------------- 
    707 #pragma mark Dragging 
    708703//Return the drag types we accept 
    709704- (NSArray *)acceptableDragTypes 
     
    824819                [[AICustomTabDragging sharedInstance] setDestinationTabView:nil]; 
    825820                [self smoothlyArrangeTabs]; 
    826                 [self resetCursorTracking]; 
    827821                 
    828822                //Pass event along to the windowController 
     
    907901        while((tabCell = [enumerator nextObject])){             
    908902            NSRect trackRect = [tabCell frame]; 
    909             [tabCell addTrackingRectsInView:self withFrame:trackRect cursorLocation:localPoint]; 
     903            [tabCell addTrackingRectsWithFrame:trackRect cursorLocation:localPoint]; 
    910904        } 
    911905                 
     
    923917                enumerator = [tabCellArray objectEnumerator]; 
    924918                while((tabCell = [enumerator nextObject])){ 
    925                         [tabCell removeTrackingRectsFromView:self]; 
     919                        [tabCell removeTrackingRects]; 
    926920                } 
    927921                 
  • trunk/ESFloater.m

    r1823 r2039  
    1515 
    1616@interface ESFloater (PRIVATE) 
    17 - (id)initWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask title:(NSString *) title
     17- (id)initWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask
    1818- (void)_setWindowOpacity:(float)opacity; 
    1919@end 
     
    2222 
    2323// 
    24 + (id)floaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask title:(NSString *) title 
     24+ (id)floaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask 
    2525{ 
    26     return([[self alloc] initWithImage:inImage styleMask:styleMask title:title]); 
     26    return([[self alloc] initWithImage:inImage styleMask:styleMask]); 
    2727} 
    2828 
    2929// 
    30 - (id)initWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask title:(NSString *) title 
     30- (id)initWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask 
    3131{ 
    3232    NSRect  frame; 
     
    4444                                         backing:NSBackingStoreBuffered 
    4545                                           defer:NO]; 
    46         if( title ) [panel setTitle:title]; 
    4746    [panel setHidesOnDeactivate:NO]; 
    4847    [panel setIgnoresMouseEvents:YES]; 
     
    127126     
    128127    if(windowIsVisible){ 
    129         alphaValue += (maxOpacity - alphaValue) * ([[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSShiftKeyMask ? WINDOW_FADE_SLOW_STEP : WINDOW_FADE_STEP); 
     128        alphaValue += (maxOpacity - alphaValue) * (( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSShiftKeyMask ) ? WINDOW_FADE_SLOW_STEP : WINDOW_FADE_STEP); 
    130129        if(alphaValue > maxOpacity - WINDOW_FADE_SNAP) alphaValue = maxOpacity; 
    131130    }else{ 
    132         alphaValue -= (alphaValue - WINDOW_FADE_MIN) * ([[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSShiftKeyMask ? WINDOW_FADE_SLOW_STEP : WINDOW_FADE_STEP); 
     131        alphaValue -= (alphaValue - WINDOW_FADE_MIN) * (( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSShiftKeyMask ) ? WINDOW_FADE_SLOW_STEP : WINDOW_FADE_STEP); 
    133132        if(alphaValue < WINDOW_FADE_MIN + WINDOW_FADE_SNAP) alphaValue = WINDOW_FADE_MIN; 
    134133    }