mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
Updated PSMTabBarControl (warning fixes)
svn path=/trunk/netsurf/; revision=11560
This commit is contained in:
parent
899c2e3305
commit
f98bdddd09
@ -564,7 +564,7 @@
|
||||
// add to collection
|
||||
[_cells addObject:cell];
|
||||
[cell release];
|
||||
if([_cells count] == [tabView numberOfTabViewItems]) {
|
||||
if([_cells count] == (NSUInteger)[tabView numberOfTabViewItems]) {
|
||||
[self update]; // don't update unless all are accounted for!
|
||||
}
|
||||
}
|
||||
@ -923,7 +923,7 @@
|
||||
|
||||
- (void)update:(BOOL)animate {
|
||||
// make sure all of our tabs are accounted for before updating
|
||||
if([[self tabView] numberOfTabViewItems] != [_cells count]) {
|
||||
if((NSUInteger)[[self tabView] numberOfTabViewItems] != [_cells count]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -952,7 +952,7 @@
|
||||
if(animate) {
|
||||
NSMutableArray *targetFrames = [NSMutableArray arrayWithCapacity:[_cells count]];
|
||||
|
||||
for(NSInteger i = 0; i < [_cells count]; i++) {
|
||||
for(NSUInteger i = 0; i < [_cells count]; i++) {
|
||||
currentCell = [_cells objectAtIndex:i];
|
||||
|
||||
//we're going from NSRect -> NSValue -> NSRect -> NSValue here - oh well
|
||||
@ -973,7 +973,7 @@
|
||||
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
|
||||
[self _animateCells:_animationTimer];
|
||||
} else {
|
||||
for(NSInteger i = 0; i < [_cells count]; i++) {
|
||||
for(NSUInteger i = 0; i < [_cells count]; i++) {
|
||||
currentCell = [_cells objectAtIndex:i];
|
||||
[currentCell setFrame:[_controller cellFrameAtIndex:i]];
|
||||
|
||||
@ -992,11 +992,11 @@
|
||||
NSAnimation *animation = [[timer userInfo] objectAtIndex:1];
|
||||
NSArray *targetFrames = [[timer userInfo] objectAtIndex:0];
|
||||
PSMTabBarCell *currentCell;
|
||||
NSInteger cellCount = [_cells count];
|
||||
NSUInteger cellCount = [_cells count];
|
||||
|
||||
if((cellCount > 0) && [animation isAnimating]) {
|
||||
//compare our target position with the current position and move towards the target
|
||||
for(NSInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
|
||||
for(NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
|
||||
currentCell = [_cells objectAtIndex:i];
|
||||
NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
|
||||
CGFloat sizeChange;
|
||||
@ -1032,7 +1032,7 @@
|
||||
} else {
|
||||
//put all the cells where they should be in their final position
|
||||
if(cellCount > 0) {
|
||||
for(NSInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
|
||||
for(NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
|
||||
PSMTabBarCell *currentCell = [_cells objectAtIndex:i];
|
||||
NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
|
||||
|
||||
@ -1064,7 +1064,7 @@
|
||||
[_animationTimer invalidate];
|
||||
[_animationTimer release]; _animationTimer = nil;
|
||||
|
||||
for(NSInteger i = 0; i < cellCount; i++) {
|
||||
for(NSUInteger i = 0; i < cellCount; i++) {
|
||||
currentCell = [_cells objectAtIndex:i];
|
||||
|
||||
//we've hit the cells that are in overflow, stop setting up tracking rects
|
||||
@ -1618,7 +1618,7 @@
|
||||
- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
|
||||
// here's a weird one - this message is sent before the "tabViewDidChangeNumberOfTabViewItems"
|
||||
// message, thus I can end up updating when there are no cells, if no tabs were (yet) present
|
||||
NSInteger tabIndex = [aTabView indexOfTabViewItem:tabViewItem];
|
||||
NSUInteger tabIndex = [aTabView indexOfTabViewItem:tabViewItem];
|
||||
|
||||
if([_cells count] > 0 && tabIndex < [_cells count]) {
|
||||
PSMTabBarCell *thisCell = [_cells objectAtIndex:tabIndex];
|
||||
@ -1930,7 +1930,7 @@
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfVisibleTabs {
|
||||
NSInteger i, cellCount = 0;
|
||||
NSUInteger i, cellCount = 0;
|
||||
PSMTabBarCell *nextCell;
|
||||
|
||||
for(i = 0; i < [_cells count]; i++) {
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
- (NSRect)addButtonRect;
|
||||
- (NSMenu *)overflowMenu;
|
||||
- (NSRect)cellTrackingRectAtIndex:(NSInteger)index;
|
||||
- (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index;
|
||||
- (NSRect)cellFrameAtIndex:(NSInteger)index;
|
||||
- (NSRect)cellTrackingRectAtIndex:(NSUInteger)index;
|
||||
- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)index;
|
||||
- (NSRect)cellFrameAtIndex:(NSUInteger)index;
|
||||
|
||||
- (void)setSelectedCell:(PSMTabBarCell *)cell;
|
||||
|
||||
|
@ -78,9 +78,9 @@
|
||||
@returns The tracking rect of the cell at the requested index.
|
||||
*/
|
||||
|
||||
- (NSRect)cellTrackingRectAtIndex:(NSInteger)index {
|
||||
- (NSRect)cellTrackingRectAtIndex:(NSUInteger)index {
|
||||
NSRect rect;
|
||||
if(index > -1 && index < [_cellTrackingRects count]) {
|
||||
if(index < [_cellTrackingRects count]) {
|
||||
rect = [[_cellTrackingRects objectAtIndex:index] rectValue];
|
||||
} else {
|
||||
NSLog(@"cellTrackingRectAtIndex: Invalid index (%ld)", (long)index);
|
||||
@ -97,9 +97,9 @@
|
||||
@returns The close button tracking rect of the cell at the requested index.
|
||||
*/
|
||||
|
||||
- (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index {
|
||||
- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)index {
|
||||
NSRect rect;
|
||||
if(index > -1 && index < [_closeButtonTrackingRects count]) {
|
||||
if(index < [_closeButtonTrackingRects count]) {
|
||||
rect = [[_closeButtonTrackingRects objectAtIndex:index] rectValue];
|
||||
} else {
|
||||
NSLog(@"closeButtonTrackingRectAtIndex: Invalid index (%ld)", (long)index);
|
||||
@ -116,10 +116,10 @@
|
||||
@returns The frame of the cell at the requested index.
|
||||
*/
|
||||
|
||||
- (NSRect)cellFrameAtIndex:(NSInteger)index {
|
||||
- (NSRect)cellFrameAtIndex:(NSUInteger)index {
|
||||
NSRect rect;
|
||||
|
||||
if(index > -1 && index < [_cellFrames count]) {
|
||||
if(index < [_cellFrames count]) {
|
||||
rect = [[_cellFrames objectAtIndex:index] rectValue];
|
||||
} else {
|
||||
NSLog(@"cellFrameAtIndex: Invalid index (%ld)", (long)index);
|
||||
@ -160,7 +160,7 @@
|
||||
[cell setTabState:PSMTab_SelectedMask];
|
||||
|
||||
if(![cell isInOverflowMenu]) {
|
||||
NSInteger cellIndex = [cells indexOfObject:cell];
|
||||
NSUInteger cellIndex = [cells indexOfObject:cell];
|
||||
|
||||
if(cellIndex > 0) {
|
||||
nextCell = [cells objectAtIndex:cellIndex - 1];
|
||||
@ -501,7 +501,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum){
|
||||
*/
|
||||
|
||||
- (void)_setupCells:(NSArray *)cells withWidths:(NSArray *)widths {
|
||||
NSInteger i, tabState, cellCount = [cells count];
|
||||
NSUInteger i, tabState, cellCount = [cells count];
|
||||
NSRect cellRect = [_control genericCellRect];
|
||||
PSMTabBarCell *cell;
|
||||
NSTabViewItem *selectedTabViewItem = [[_control tabView] selectedTabViewItem];
|
||||
|
@ -22,7 +22,7 @@
|
||||
PSMTabBarControl *_destinationTabBar;
|
||||
NSMutableSet *_participatingTabBars;
|
||||
PSMTabBarCell *_draggedCell;
|
||||
NSInteger _draggedCellIndex; // for snap back
|
||||
NSUInteger _draggedCellIndex; // for snap back
|
||||
BOOL _isDragging;
|
||||
|
||||
// Support for dragging into new windows
|
||||
|
@ -298,7 +298,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
|
||||
|
||||
- (void)performDragOperation {
|
||||
// move cell
|
||||
NSInteger destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]];
|
||||
NSUInteger destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]];
|
||||
|
||||
//there is the slight possibility of the targetCell now being set properly, so avoid errors
|
||||
if(destinationIndex >= [[[self destinationTabBar] cells] count]) {
|
||||
@ -315,7 +315,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
|
||||
[[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]];
|
||||
[[self sourceTabBar] removeTabForCell:[self draggedCell]];
|
||||
|
||||
NSInteger i, insertIndex;
|
||||
NSUInteger i, insertIndex;
|
||||
NSArray *cells = [[self destinationTabBar] cells];
|
||||
|
||||
//find the index of where the dragged cell was just dropped
|
||||
@ -350,9 +350,8 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
|
||||
NSTabView *tabView = [[self sourceTabBar] tabView];
|
||||
NSTabViewItem *item = [[self draggedCell] representedObject];
|
||||
BOOL reselect = ([tabView selectedTabViewItem] == item);
|
||||
NSInteger index;
|
||||
NSArray *cells = [[self sourceTabBar] cells];
|
||||
|
||||
NSUInteger index;
|
||||
//find the index of where the dragged cell was just dropped
|
||||
for(index = 0; index < [cells count] && [cells objectAtIndex:index] != [self draggedCell]; index++) {
|
||||
;
|
||||
@ -767,7 +766,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
|
||||
}
|
||||
|
||||
- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control {
|
||||
NSInteger i, numVisibleTabs = [control numberOfVisibleTabs];
|
||||
NSUInteger i, numVisibleTabs = [control numberOfVisibleTabs];
|
||||
for(i = 0; i < numVisibleTabs; i++) {
|
||||
PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
|
||||
[[control cells] insertObject:pc atIndex:(2 * i)];
|
||||
|
Loading…
Reference in New Issue
Block a user