Changeset 2558
- Timestamp:
- 04/20/05 19:37:46 (3 years ago)
- Files:
-
- trunk/AICustomTabCell.h (modified) (1 diff)
- trunk/AICustomTabCell.m (modified) (22 diffs)
- trunk/AICustomTabDragWindow.h (modified) (1 diff)
- trunk/AICustomTabDragWindow.m (modified) (8 diffs)
- trunk/AICustomTabDragging.m (modified) (14 diffs)
- trunk/AICustomTabsView.h (modified) (1 diff)
- trunk/AICustomTabsView.m (modified) (45 diffs)
- trunk/ESFloater.m (modified) (7 diffs)
- trunk/JVAppearancePreferences.m (modified) (4 diffs)
- trunk/JVBehaviorPreferences.m (modified) (1 diff)
- trunk/JVChatConsolePanel.m (modified) (2 diffs)
- trunk/JVChatController.h (modified) (1 diff)
- trunk/JVChatController.m (modified) (3 diffs)
- trunk/JVChatEvent.m (modified) (1 diff)
- trunk/JVChatMemberInspector.m (modified) (1 diff)
- trunk/JVChatMessage.m (modified) (2 diffs)
- trunk/JVChatRoomBrowser.m (modified) (2 diffs)
- trunk/JVChatRoomInspector.m (modified) (1 diff)
- trunk/JVChatRoomMember.h (modified) (1 diff)
- trunk/JVChatRoomMember.m (modified) (2 diffs)
- trunk/JVChatRoomPanel.m (modified) (1 diff)
- trunk/JVChatTabItem.m (modified) (1 diff)
- trunk/JVChatTranscript.m (modified) (9 diffs)
- trunk/JVChatTranscriptPanel.m (modified) (5 diffs)
- trunk/JVChatWindowController.m (modified) (14 diffs)
- trunk/JVColorWellCell.m (modified) (2 diffs)
- trunk/JVConnectionInspector.m (modified) (1 diff)
- trunk/JVDetailCell.m (modified) (1 diff)
- trunk/JVDirectChatPanel.h (modified) (2 diffs)
- trunk/JVDirectChatPanel.m (modified) (11 diffs)
- trunk/JVEmoticonSet.m (modified) (2 diffs)
- trunk/JVGetCommand.m (modified) (1 diff)
- trunk/JVInspectorController.m (modified) (1 diff)
- trunk/JVMixedTableColumn.m (modified) (1 diff)
- trunk/JVNotificationController.m (modified) (1 diff)
- trunk/JVNotificationPreferences.m (modified) (4 diffs)
- trunk/JVSmartTranscriptPanel.h (modified) (1 diff)
- trunk/JVSmartTranscriptPanel.m (modified) (6 diffs)
- trunk/JVSplitView.m (modified) (1 diff)
- trunk/JVStyle.m (modified) (4 diffs)
- trunk/JVStyleView.m (modified) (6 diffs)
- trunk/JVTabbedChatWindowController.m (modified) (3 diffs)
- trunk/JVTranscriptCriterionController.m (modified) (3 diffs)
- trunk/JVTranscriptFindWindowController.m (modified) (1 diff)
- trunk/KABubbleWindowController.m (modified) (1 diff)
- trunk/KABubbleWindowView.m (modified) (1 diff)
- trunk/MVApplicationController.m (modified) (4 diffs)
- trunk/MVBuddyListController.m (modified) (4 diffs)
- trunk/MVConnectionsController.h (modified) (1 diff)
- trunk/MVConnectionsController.m (modified) (14 diffs)
- trunk/MVFileTransferController.m (modified) (5 diffs)
- trunk/MVTableView.m (modified) (1 diff)
- trunk/MVTextView.m (modified) (2 diffs)
- trunk/NSImageAdditions.m (modified) (1 diff)
- trunk/Plug-Ins/Standard Commands/JVStandardCommands.m (modified) (2 diffs)
- trunk/Resources/Agenda.rtf (modified) (2 diffs)
- trunk/Resources/Changes.rtf (modified) (12 diffs)
- trunk/Resources/GPL.txt (modified) (1 diff)
- trunk/Resources/Read Me.rtf (modified) (2 diffs)
- trunk/Resources/Styles/Bubbles.colloquyStyle/Contents/Resources/main.xsl (modified) (2 diffs)
- trunk/Resources/Styles/DecafBland.colloquyStyle/Contents/Resources/Variants/Inverted.css (modified) (1 diff)
- trunk/Resources/Styles/DecafBland.colloquyStyle/Contents/Resources/main.css (modified) (2 diffs)
- trunk/Resources/Styles/DecafBland.colloquyStyle/Contents/Resources/main.xsl (modified) (1 diff)
- trunk/Resources/Styles/DecafBland.colloquyStyle/Contents/Resources/supplement.html (modified) (2 diffs)
- trunk/Resources/Styles/Fiat.colloquyStyle/Contents/Resources/main.css (modified) (4 diffs)
- trunk/Resources/Styles/Fiat.colloquyStyle/Contents/Resources/main.xsl (modified) (1 diff)
- trunk/Resources/Styles/Novel.colloquyStyle/Contents/Resources/main.xsl (modified) (3 diffs)
- trunk/Resources/Styles/Synapse.colloquyStyle/Contents/Resources/main.css (modified) (1 diff)
- trunk/Resources/verbs.plist (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/AICustomTabCell.h
r2041 r2558 27 27 BOOL highlighted; 28 28 BOOL allowsInactiveTabClosing; 29 29 30 30 BOOL trackingClose; 31 31 BOOL hoveringClose; 32 32 33 33 NSTrackingRectTag trackingTag; 34 34 NSTrackingRectTag closeTrackingTag; 35 35 NSTrackingRectTag toolTipTag; 36 36 37 37 NSAttributedString *attributedLabel; 38 38 NSTabViewItem<AICustomTabViewItem> *tabViewItem; 39 39 NSRect frame; 40 40 41 41 AICustomTabsView *view; 42 42 } trunk/AICustomTabCell.m
r2054 r2558 58 58 { 59 59 static BOOL haveLoadedImages = NO; 60 60 61 61 [super init]; 62 62 63 63 //Share these images between all AICustomTabCell instances 64 64 if(!haveLoadedImages){ … … 66 66 tabFrontMiddle = [[NSImage imageNamed:@"aquaTabMiddle"] retain]; 67 67 tabFrontRight = [[NSImage imageNamed:@"aquaTabRight"] retain]; 68 68 69 69 tabCloseFront = [[NSImage imageNamed:@"aquaTabClose"] retain]; 70 70 tabCloseBack = [[NSImage imageNamed:@"aquaTabCloseBack"] retain]; … … 74 74 leftCapSize = [tabFrontLeft size]; 75 75 rightCapSize = [tabFrontRight size]; 76 76 77 77 haveLoadedImages = YES; 78 78 } 79 79 80 80 tabViewItem = [inTabViewItem retain]; 81 81 view = inView; … … 88 88 closeTrackingTag = 0; 89 89 toolTipTag = 0; 90 90 91 91 return(self); 92 92 } … … 106 106 int width = leftCapSize.width + [[self attributedLabel] size].width + rightCapSize.width + 107 107 (TAB_CLOSE_LEFTPAD + [[tabViewItem icon] size].width + TAB_CLOSE_RIGHTPAD) + TAB_RIGHT_PAD; 108 108 109 109 return( NSMakeSize((width > TAB_MIN_WIDTH ? width : TAB_MIN_WIDTH), leftCapSize.height) ); 110 110 } … … 115 115 int tabWidth = [tab size].width; 116 116 int ourWidth = [self size].width; 117 117 118 118 if(tabWidth > ourWidth){ 119 119 return(NSOrderedAscending); 120 120 121 121 }else if(tabWidth < ourWidth){ 122 122 return(NSOrderedDescending); 123 123 124 124 }else{ 125 125 return(NSOrderedSame); 126 126 127 127 } 128 128 } … … 152 152 NSSize imageSize = [[tabViewItem icon] size]; 153 153 int centerY = (frame.size.height - imageSize.height) / 2.0; 154 154 155 155 return(NSMakeRect(frame.origin.x + leftCapSize.width + TAB_CLOSE_LEFTPAD, 156 156 frame.origin.y + centerY + TAB_CLOSE_Y_OFFSET, … … 226 226 NSSize labelSize; 227 227 NSPoint destPoint; 228 228 229 229 //Pre-calc some dimensions 230 230 labelSize = [tabViewItem sizeOfLabel:NO]; … … 232 232 middleRightEdge = (rect.origin.x + rect.size.width - rightCapSize.width); 233 233 middleLeftEdge = (rect.origin.x + leftCapSize.width); 234 234 235 235 //Background 236 236 if(selected && !ignoreSelection){ 237 237 //Draw the left cap 238 238 [tabFrontLeft compositeToPoint:NSMakePoint(rect.origin.x, rect.origin.y) operation:NSCompositeSourceOver]; 239 239 240 240 //Draw the middle 241 241 sourceRect = NSMakeRect(0, 0, [tabFrontMiddle size].width, [tabFrontMiddle size].height); 242 242 destRect = NSMakeRect(middleLeftEdge, rect.origin.y, sourceRect.size.width, sourceRect.size.height); 243 243 244 244 while(destRect.origin.x < middleRightEdge){ 245 245 if((destRect.origin.x + destRect.size.width) > middleRightEdge){ … … 249 249 destRect.origin.x += destRect.size.width; 250 250 } 251 251 252 252 //Draw the right cap 253 253 [tabFrontRight compositeToPoint:NSMakePoint(middleRightEdge, rect.origin.y) operation:NSCompositeSourceOver]; 254 254 255 255 }else if(highlighted){ 256 256 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; 257 257 [NSBezierPath fillRect:NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)]; 258 258 } 259 259 260 260 //We'll display our close icon if the user is hovering. Otherwise, we display the tab specified icon 261 261 NSImage *leftIcon = [tabViewItem icon]; 262 if((hoveringClose && (selected || allowsInactiveTabClosing || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask ))) || !leftIcon){ 262 if((hoveringClose && (selected || allowsInactiveTabClosing || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask ))) || !leftIcon){ 263 263 if(hoveringClose){ 264 264 leftIcon = (trackingClose ? tabCloseFrontPressed : tabCloseFrontRollover); … … 278 278 rect.origin.x += offsetX; 279 279 rect.size.width -= offsetX + TAB_RIGHT_PAD; 280 280 281 281 //Draw our label 282 282 destRect = NSMakeRect(rect.origin.x, … … 285 285 rect.size.height - ((rect.size.height - labelSize.height) / 2.0)); 286 286 if(TAB_SELECTED_HIGHER && !ignoreSelection && selected) destRect.origin.y += 1.0; 287 [[self attributedLabel] drawInRect:destRect]; 287 [[self attributedLabel] drawInRect:destRect]; 288 288 } 289 289 … … 292 292 { 293 293 NSString *label = [tabViewItem label]; 294 294 295 295 if(![label isEqualToString:[attributedLabel string]] || wasEnabled != [tabViewItem isEnabled] ){ 296 296 wasEnabled = [tabViewItem isEnabled]; … … 299 299 [paragraphStyle setAlignment:NSCenterTextAlignment]; 300 300 [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; 301 301 302 302 //Update the attributed string 303 303 [attributedLabel release]; … … 309 309 nil]]; 310 310 } 311 311 312 312 return(attributedLabel); 313 313 } … … 324 324 assumeInside:NSPointInRect(cursorLocation, trackRect)]; 325 325 [self setHighlighted:NSPointInRect(cursorLocation, trackRect)]; 326 326 327 327 closeTrackingTag = [view addTrackingRect:[self _closeButtonRect] 328 328 owner:self … … 349 349 // [[tabViewItem tabView] selectTabViewItem:tabViewItem]; 350 350 // } 351 351 352 352 //Set ourself (or our close button) as hovered 353 353 if((allowsInactiveTabClosing || selected || ( [[[NSApplication sharedApplication] currentEvent] modifierFlags] & NSCommandKeyMask )) && … … 378 378 (SHOW_CLOSE_BUTTON_FOR_SINGLE_TAB || [[tabViewItem tabView] numberOfTabViewItems] != 1) && 379 379 NSPointInRect([controlView convertPoint:[theEvent locationInWindow] fromView:nil], [self _closeButtonRect])){ 380 380 381 381 [self trackMouse:theEvent inRect:[self _closeButtonRect] ofView:controlView untilMouseUp:YES]; 382 382 return(YES); 383 383 384 384 }else{ 385 385 return(NO); 386 386 387 387 } 388 388 } … … 394 394 hoveringClose = YES; 395 395 [controlView setNeedsDisplayInRect:[self _closeButtonRect]]; 396 396 397 397 return(YES); 398 398 } … … 402 402 { 403 403 BOOL hovering = NSPointInRect(currentPoint, [self _closeButtonRect]); 404 404 405 405 if(hoveringClose != hovering){ 406 406 hoveringClose = hovering; 407 407 [controlView setNeedsDisplayInRect:[self _closeButtonRect]]; 408 408 } 409 409 410 410 return(YES); 411 411 } … … 415 415 { 416 416 BOOL hovering = NSPointInRect(stopPoint, [self _closeButtonRect]); 417 417 418 418 //Closes all the other tabs in the current window if option is held down (And we have more than one tab) 419 419 if(hovering && ([[[controlView window] currentEvent] modifierFlags] & NSAlternateKeyMask) && [[tabViewItem tabView] numberOfTabViewItems] > 1){ … … 422 422 [(AICustomTabsView *)controlView closeTab:self]; 423 423 } 424 424 425 425 hoveringClose = NO; 426 426 trackingClose = NO; trunk/AICustomTabDragWindow.h
r1823 r2558 17 17 ESFloater *dragWindowFloater; 18 18 BOOL fullWindow; 19 19 20 20 BOOL useFancyAnimations; 21 21 } trunk/AICustomTabDragWindow.m
r2046 r2558 31 31 { 32 32 [super init]; 33 33 34 34 floaterTabImage = [[self dragTabImageForTabCell:inTabCell inCustomTabsView:inTabView] retain]; 35 35 floaterWindowImage = [[self dragWindowImageForWindow:[inTabView window] customTabsView:inTabView tabCell:inTabCell] retain]; 36 36 useFancyAnimations = ( floaterWindowImage ? YES : NO ); 37 37 38 38 if(useFancyAnimations){ 39 39 //Create a floating window for our tab 40 40 dragTabFloater = [ESFloater floaterWithImage:floaterTabImage styleMask:NSBorderlessWindowMask title:nil]; 41 41 [dragTabFloater setMaxOpacity:1.0]; 42 42 43 43 //Create a floating window for the stand-alone window our tab would produce 44 44 dragWindowFloater = [ESFloater floaterWithImage:floaterWindowImage styleMask:NSTitledWindowMask title:[[inTabView window] title]]; 45 45 [dragWindowFloater setMaxOpacity:(transparent ? 0.75 : 1.00)]; 46 46 } 47 47 48 48 return(self); 49 49 } … … 62 62 [dragTabFloater close:nil]; 63 63 [dragWindowFloater close:nil]; 64 64 65 65 [super dealloc]; 66 66 } … … 85 85 } 86 86 } 87 88 87 88 89 89 //Tab Imaging ---------------------------------------------------------------------------------------------------------- 90 90 #pragma mark Drag Images … … 93 93 { 94 94 NSImage *dragTabImage = nil; 95 95 96 96 if([customTabsView canDraw]){ 97 97 dragTabImage = [[[NSImage alloc] init] autorelease]; 98 98 [customTabsView lockFocus]; 99 99 [dragTabImage addRepresentation:[[[NSBitmapImageRep alloc] initWithFocusedViewRect:[tabCell frame]] autorelease]]; 100 [customTabsView unlockFocus]; 100 [customTabsView unlockFocus]; 101 101 } 102 102 103 103 return(dragTabImage); 104 104 } … … 109 109 NSView *contentView = [[tabCell tabViewItem] view]; 110 110 NSImage *dragWindowImage = nil; 111 NSImage *contentImage, *tabImage; 111 NSImage *contentImage, *tabImage; 112 112 NSPoint insertPoint; 113 113 114 114 if([customTabsView canDraw] && [contentView canDraw]){ 115 115 //Get an image of the tab … … 118 118 [tabImage addRepresentation:[[[NSBitmapImageRep alloc] initWithFocusedViewRect:[tabCell frame]] autorelease]]; 119 119 [customTabsView unlockFocus]; 120 120 121 121 //Get an image of the tabView content view 122 122 contentImage = [[[NSImage alloc] init] autorelease]; … … 124 124 [contentImage addRepresentation:[[[NSBitmapImageRep alloc] initWithFocusedViewRect:[contentView frame]] autorelease]]; 125 125 [contentView unlockFocus]; 126 126 127 127 //Create a drag image the size of the window 128 128 dragWindowImage = [[[NSImage alloc] initWithSize:[[window contentView] frame].size] autorelease]; 129 129 [dragWindowImage setBackgroundColor:[NSColor clearColor]]; 130 130 [dragWindowImage lockFocus]; 131 131 132 132 //Draw the tabbar and tab 133 133 [customTabsView drawBackgroundInRect:[customTabsView frame] withFrame:[customTabsView frame] selectedTabRect:NSMakeRect(0,0,0,0)]; … … 135 135 insertPoint.x += CUSTOM_TABS_INDENT; //Line the tab up a bit more realistically 136 136 [tabImage compositeToPoint:insertPoint operation:NSCompositeCopy]; 137 137 138 138 //Draw the content 139 139 NSPoint frameOrigin = [[[tabCell tabViewItem] tabView] frame].origin; 140 140 [contentImage compositeToPoint:NSMakePoint(frameOrigin.x + CONTENT_OFFSET_X, frameOrigin.y) operation:NSCompositeCopy]; 141 141 142 142 [dragWindowImage unlockFocus]; 143 143 } 144 144 145 145 return(dragWindowImage); 146 146 } trunk/AICustomTabDragging.m
r2039 r2558 38 38 destTabBar = nil; 39 39 tabDragWindow = nil; 40 40 41 41 return(self); 42 42 } … … 86 86 NSPoint startPoint; 87 87 BOOL sourceWindowWillHide; 88 88 89 89 //Post the dragging will begin notification 90 90 [[NSNotificationCenter defaultCenter] postNotificationName:AICustomTabDragWillBegin object:self]; 91 91 92 92 //Setup 93 93 [destTabBar release]; destTabBar = nil; … … 95 95 dragTabCell = [inTabCell retain]; 96 96 selectTabAfterDrag = shouldSelect; 97 97 98 98 //Determine if the source window will hide as a result of this drag 99 99 sourceWindowWillHide = ([sourceTabBar removingLastTabHidesWindow] && [sourceTabBar numberOfTabViewItems] == 1); … … 101 101 destTabBar = [sourceView retain]; 102 102 } 103 103 104 104 //Adjust the drag offset so the cursor is atleast always touching the tab drag image 105 105 int width = [inTabCell frame].size.width; 106 106 int height = [inTabCell frame].size.height; 107 107 108 108 dragOffset = NSMakeSize([inTabCell frame].origin.x - clickLocation.x, [inTabCell frame].origin.y - clickLocation.y); 109 109 if(dragOffset.width > width) dragOffset.width = width; … … 111 111 if(dragOffset.height > height) dragOffset.height = height; 112 112 if(dragOffset.height < -height) dragOffset.height = -height; 113 113 114 114 //Create the drag window for our custom drag tracking 115 115 tabDragWindow = [AICustomTabDragWindow dragWindowForCustomTabView:sourceView … … 117 117 transparent:!([sourceTabBar removingLastTabHidesWindow])]; 118 118 [tabDragWindow setDisplayingFullWindow:sourceWindowWillHide animate:NO]; 119 119 120 120 //Position the drag window 121 121 startPoint = [[inEvent window] convertBaseToScreen:[inEvent locationInWindow]]; 122 122 startPoint = NSMakePoint(startPoint.x + dragOffset.width, startPoint.y + dragOffset.height); 123 123 [tabDragWindow moveToPoint:startPoint]; 124 124 125 125 //Hide the source window 126 126 if(sourceWindowWillHide){ 127 127 [[sourceTabBar window] setAlphaValue:0.0]; 128 128 } 129 129 130 130 //Perform the drag 131 131 pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; … … 139 139 source:self 140 140 slideBack:NO]; 141 141 142 142 //Sneaky Bug Fix --- 143 143 //After dropping a tab into a tab bar, the tabbar's cursor tracking is rebuilt. Unfortunately, since the floating 144 //window (With an image of the tab) used for dragging is still over the tab bar, any cursor rects we attempt to 144 //window (With an image of the tab) used for dragging is still over the tab bar, any cursor rects we attempt to 145 145 //install below it will not work. A sneaky solution to this is to remember the destination tab bar of the drag, 146 146 //and reset it's cursor tracking again, after the drag window has closed. … … 150 150 [_destinationOfLastDrag release]; _destinationOfLastDrag= nil; 151 151 } 152 152 153 153 } 154 154 155 155 //End a drag 156 156 - (void)acceptDragIntoTabView:(AICustomTabsView *)destTabView atIndex:(int)destIndex 157 { 157 { 158 158 if(destTabView == sourceTabBar){ 159 159 //Tab re-arranging we handle internally … … 170 170 } 171 171 } 172 172 173 173 //Remember the dest tab bar so we can reset cursor tracking (see dragTabCell:fromCustomTabsView:withEvent:) 174 174 _destinationOfLastDrag = [destTabBar retain]; … … 192 192 { 193 193 [tabDragWindow setDisplayingFullWindow:(!destTabBar) animate:YES]; 194 194 195 195 if(!destTabBar){ 196 196 [tabDragWindow moveToPoint:screenPoint]; … … 200 200 //Invoked in the dragging source as the drag ends 201 201 - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation 202 { 202 { 203 203 if(operation == NSDragOperationNone){ //when dropped on the screen 204 204 //Sneaky Bug Fix --- … … 208 208 //we can assume it's a tab bar the system failed to send a draggingExited event, and send it ourself. 209 209 if(destTabBar) [destTabBar draggingExited:nil]; 210 210 211 211 screenPoint.x -= CUSTOM_TABS_INDENT; 212 212 if([[sourceTabBar delegate] respondsToSelector:@selector(customTabView:didMoveTabViewItem:toCustomTabView:index:screenPoint:)]){ … … 214 214 } 215 215 } 216 216 217 217 //Cleanup drag 218 218 [self cleanupDrag]; … … 230 230 [dragTabCell release]; dragTabCell = nil; 231 231 [destTabBar release]; destTabBar = nil; 232 [sourceTabBar release]; sourceTabBar = nil; 232 [sourceTabBar release]; sourceTabBar = nil; 233 233 } 234 234 trunk/AICustomTabsView.h
r2039 r2558 40 40 BOOL trackingCursor; //Tracking rects are installed 41 41 BOOL ignoreTabNumberChange; //Ignore tab count changes, used for re-arranging 42 42 43 43 //Tab Dragging 44 44 BOOL removingLastTabHidesWindow; //Removing the last tab hides our window 45 45 int tabGapWidth; //Gap in our tabs 46 46 int tabGapIndex; //Location of the gap 47 NSPoint lastClickLocation; //Last click location 47 NSPoint lastClickLocation; //Last click location 48 48 NSTimer *arrangeCellTimer; //Timer for tab animations 49 49 50 50 //Guarded. Access these using the internal accessors 51 51 NSMutableArray *tabCellArray; 52 52 AICustomTabCell *selectedCustomTabCell; 53 53 54 54 // 55 55 AICustomTabCell *dragCell; trunk/AICustomTabsView.m
r2039 r2558 33 33 - (id)initWithFrame:(NSRect)frameRect; 34 34 35 //Positioning 35 //Positioning 36 36 - (void)arrangeTabs; 37 37 - (void)smoothlyArrangeTabs; … … 109 109 { 110 110 delegate = inDelegate; 111 111 112 112 //Update our accepted drag types 113 113 [self unregisterDraggedTypes]; … … 134 134 NSEnumerator *enumerator; 135 135 AICustomTabCell *tabCell; 136 136 137 137 //Save the value 138 138 allowsInactiveTabClosing = inValue; 139 139 140 140 //Pass it onto our tabs 141 141 enumerator = [tabCellArray objectEnumerator]; 142 while((tabCell = [enumerator nextObject])){ 142 while((tabCell = [enumerator nextObject])){ 143 143 [tabCell setAllowsInactiveTabClosing:allowsInactiveTabClosing]; 144 144 } … … 203 203 NSEnumerator *enumerator = [tabCellArray objectEnumerator]; 204 204 AICustomTabCell *tabCell; 205 205 206 206 while(tabCell = [enumerator nextObject]){ 207 207 if(tabCell != targetCell){ … … 221 221 //Ignore the 'shouldSelect' choice if this cell is already selected 222 222 if(tabViewItem == [tabView selectedTabViewItem]) shouldSelect = YES; 223 223 224 224 //Move the tab cell 225 225 int currentIndex = [tabCellArray indexOfObject:tabCell]; 226 226 int newIndex = index; 227 227 228 228 //Account for shifting 229 229 if(currentIndex < newIndex) newIndex--; 230 230 231 231 //Move via a remove and add :( 232 232 [tabCell retain]; … … 234 234 [tabCellArray insertObject:tabCell atIndex:newIndex]; 235 235 [tabCell release]; 236 236 237 237 //Move the tab 238 238 ignoreTabNumberChange = YES; … … 243 243 [tabViewItem release]; 244 244 ignoreTabNumberChange = NO; 245 245 246 246 //Inform our delegate of the re-order 247 247 if([delegate respondsToSelector:@selector(customTabViewDidChangeOrderOfTabViewItems:)]){ 248 248 [delegate customTabViewDidChangeOrderOfTabViewItems:self]; 249 249 } 250 250 251 251 //Smoothly animate into place 252 252 if(animate){ … … 256 256 } 257 257 } 258 258 259 259 if(shouldSelect) [tabView selectTabViewItem:tabViewItem]; 260 260 } … … 265 265 NSEnumerator *enumerator; 266 266 AICustomTabCell *tabCell; 267 267 268 268 enumerator = [tabCellArray objectEnumerator]; 269 269 while((tabCell = [enumerator nextObject])){ 270 270 if(tabCell != dragCell && NSPointInRect(clickLocation, [tabCell frame])) break; 271 271 } 272 272 273 273 return(tabCell); 274 274 } … … 280 280 NSEnumerator *enumerator = [tabCellArray objectEnumerator]; 281 281 AICustomTabCell *tabCell; 282 282 283 283 while((tabCell = [enumerator nextObject])){ 284 284 if(tabCell != dragCell) totalWidth += [tabCell size].width + CUSTOM_TABS_GAP; 285 285 } 286 286 287 287 return(totalWidth); 288 288 } … … 294 294 AICustomTabCell *tabCell; 295 295 NSTabViewItem *selectedTab = [inTabView selectedTabViewItem]; 296 296 297 297 //Set old cell for a redisplay 298 298 [self setNeedsDisplayInRect:NSInsetRect([selectedCustomTabCell frame], -(CUSTOM_TABS_GAP * 2), 0)]; 299 299 300 300 //Record the new selected tab cell, and correctly set it as selected 301 301 enumerator = [tabCellArray objectEnumerator]; … … 308 308 } 309 309 } 310 310 311 311 //Redisplay new cell 312 312 [self setNeedsDisplayInRect:NSInsetRect([selectedCustomTabCell frame], -(CUSTOM_TABS_GAP * 2), 0)]; 313 313 314 314 //Inform our delegate of the selection change 315 315 if([delegate respondsToSelector:@selector(customTabView:didSelectTabViewItem:)]){ … … 323 323 if(!ignoreTabNumberChange){ 324 324 //Reset our tab list 325 [self rebuildTabCells]; 326 325 [self rebuildTabCells]; 326 327 327 //Inform our delegate of the tab count change 328 328 if([delegate respondsToSelector:@selector(customTabViewDidChangeNumberOfTabViewItems:)]){ … … 347 347 [tabCellArray release]; tabCellArray = [[NSMutableArray alloc] init]; 348 348 selectedCustomTabCell = nil; 349 349 350 350 //Create a tab cell for each tabViewItem 351 351 int loop; … … 353 353 NSTabViewItem *tabViewItem = [tabView tabViewItemAtIndex:loop]; 354 354 AICustomTabCell *tabCell; 355 355 356 356 //Create a new tab cell 357 357 tabCell = [AICustomTabCell customTabForTabViewItem:tabViewItem customTabsView:self]; 358 358 [tabCell setSelected:(tabViewItem == [tabView selectedTabViewItem])]; 359 359 [tabCell setAllowsInactiveTabClosing:allowsInactiveTabClosing]; 360 360 361 361 //Update our direct reference to the selected cell 362 362 if(tabViewItem == [tabView selectedTabViewItem]){ 363 363 selectedCustomTabCell = tabCell; 364 364 } 365 365 366 366 //Add the tab cell to our array 367 367 [tabCellArray addObject:tabCell]; 368 368 } 369 369 370 370 [self arrangeTabs]; 371 371 [self startCursorTracking]; … … 376 376 NSEnumerator *enumerator = [tabCellArray objectEnumerator]; 377 377 AICustomTabCell *tabCell; 378 378 379 379 while((tabCell = [enumerator nextObject]) && [tabCell tabViewItem] != tabViewItem); 380 380 381 381 return(tabCell); 382 382 } … … 404 404 tabGapWidth = width; 405 405 tabGapIndex = index; 406 407 if(!arrangeCellTimer){ //Ignore the request if animation is already occuring 408 arrangeCellTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0/CUSTOM_TABS_FPS) 409 target:self 410 selector:@selector(_arrangeCellTimer:) 411 userInfo:nil 406 407 if(!arrangeCellTimer){ //Ignore the request if animation is already occuring 408 arrangeCellTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0/CUSTOM_TABS_FPS) 409 target:self 410 selector:@selector(_arrangeCellTimer:) 411 userInfo:nil 412 412 repeats:YES] retain]; 413 413 [self _arrangeCellsAbsolute:NO]; … … 417 417 //Animation timer. Continue arranging cells until they are in the correct position 418 418 - (void)_arrangeCellTimer:(NSTimer *)inTimer 419 { 419 { 420 420 if([self _arrangeCellsAbsolute:NO]){ 421 421 [arrangeCellTimer invalidate]; [arrangeCellTimer release]; arrangeCellTimer = nil; … … 473 473 NSSize size; 474 474 NSPoint origin; 475 475 476 476 //Make a gap to signify that the dragged cell can be dropped here 477 477 if(index == tabGapIndex) xLocation += tabGapWidth; 478 478 479 479 //Get the object's size 480 480 size = [tabCell size]; 481 481 482 482 //If this tab is > next biggest, use the 'reduced' width calculated above 483 483 if(size.width > reduceThreshold){ 484 484 &
