Fix compilation warnings in PSMTabBarControl

This also disables icon drawing code in tabs.  The reason being that the
code is unused, caused warnings and looked generally dangerous.
This commit is contained in:
Bjorn Winckler
2011-07-21 15:00:59 +02:00
parent 672bf1f0fc
commit df0c4d770c
4 changed files with 17 additions and 12 deletions
@@ -418,6 +418,7 @@
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
}
#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best.
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
@@ -430,7 +431,8 @@
// scoot label over
labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
}
#endif
// object counter
if([cell count] > 0){
[[NSColor colorWithCalibratedWhite:0.3 alpha:0.45] set];
@@ -451,8 +453,7 @@
counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
[counterString drawInRect:counterStringRect];
}
// label rect
NSRect labelRect;
labelRect.origin.x = labelPosition;
@@ -402,7 +402,8 @@ void MyNSDrawWindowBackground(NSRect rect)
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
}
#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best.
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
@@ -415,7 +416,8 @@ void MyNSDrawWindowBackground(NSRect rect)
// scoot label over
labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
}
#endif
// object counter
if([cell count] > 0){
[[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
@@ -438,7 +440,7 @@ void MyNSDrawWindowBackground(NSRect rect)
counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
[counterString drawInRect:counterStringRect];
}
// label rect
NSRect labelRect;
labelRect.origin.x = labelPosition;
@@ -407,7 +407,7 @@
[[cell indicator] setHidden:YES];
if([item identifier] != nil){
if([[item identifier] respondsToSelector:@selector(content)]){
if([[[[cell representedObject] identifier] content] respondsToSelector:@selector(isProcessing)]){
if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(isProcessing)]){
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"];
[[cell indicator] bind:@"animate" toObject:[item identifier] withKeyPath:@"selection.isProcessing" options:nil];
@@ -421,7 +421,7 @@
[cell setHasIcon:NO];
if([item identifier] != nil){
if([[item identifier] respondsToSelector:@selector(content)]){
if([[[[cell representedObject] identifier] content] respondsToSelector:@selector(icon)]){
if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(icon)]){
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject:NSIsNotNilTransformerName forKey:@"NSValueTransformerName"];
[cell bind:@"hasIcon" toObject:[item identifier] withKeyPath:@"selection.icon" options:bindingOptions];
@@ -434,7 +434,7 @@
[cell setCount:0];
if([item identifier] != nil){
if([[item identifier] respondsToSelector:@selector(content)]){
if([[[[cell representedObject] identifier] content] respondsToSelector:@selector(objectCount)]){
if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(objectCount)]){
[cell bind:@"count" toObject:[item identifier] withKeyPath:@"selection.objectCount" options:nil];
[[item identifier] addObserver:self forKeyPath:@"selection.objectCount" options:0 context:nil];
}
@@ -398,7 +398,8 @@
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
}
#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best.
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
@@ -411,7 +412,8 @@
// scoot label over
labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
}
#endif
// object counter
if([cell count] > 0){
[[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
@@ -433,7 +435,7 @@
counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
[counterString drawInRect:counterStringRect];
}
// label rect
NSRect labelRect;
labelRect.origin.x = labelPosition;