Changeset 3214
- Timestamp:
- 04/20/06 02:30:38 (2 years ago)
- Files:
-
- trunk/Colloquy.xcodeproj/project.pbxproj (modified) (3 diffs)
- trunk/Controllers/JVChatWindowController.m (modified) (1 diff)
- trunk/Panels/JVDirectChatPanel.m (modified) (3 diffs)
- trunk/Views/JVDetailCell.h (modified) (2 diffs)
- trunk/Views/JVDetailCell.m (modified) (6 diffs)
- trunk/Views/JVSideStatusView.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Colloquy.xcodeproj/project.pbxproj
r3208 r3214 650 650 1CBA4E64062CCDA90082D1BF /* infoWidget.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = infoWidget.png; path = Resources/infoWidget.png; sourceTree = SOURCE_ROOT; }; 651 651 1CBA4E65062CCDA90082D1BF /* infoWidgetPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = infoWidgetPressed.png; path = Resources/infoWidgetPressed.png; sourceTree = SOURCE_ROOT; }; 652 1CBB23CD04EFE233000001C8 /* actionWidget.png */ = {isa = PBXFileReference; lastKnownFileType = file; name = actionWidget.png; path = Resources/actionWidget.png; sourceTree = SOURCE_ROOT; };653 1CBB23CE04EFE233000001C8 /* actionWidgetPressed.png */ = {isa = PBXFileReference; lastKnownFileType = file; name = actionWidgetPressed.png; path = Resources/actionWidgetPressed.png; sourceTree = SOURCE_ROOT; };652 1CBB23CD04EFE233000001C8 /* actionWidget.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = actionWidget.png; path = Resources/actionWidget.png; sourceTree = SOURCE_ROOT; }; 653 1CBB23CE04EFE233000001C8 /* actionWidgetPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = actionWidgetPressed.png; path = Resources/actionWidgetPressed.png; sourceTree = SOURCE_ROOT; }; 654 654 1CBB23D504EFE24C000001C8 /* viewAlert.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = viewAlert.png; path = Resources/viewAlert.png; sourceTree = SOURCE_ROOT; }; 655 655 1CBB23D604EFE24C000001C8 /* viewAlertSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = viewAlertSelected.png; path = Resources/viewAlertSelected.png; sourceTree = SOURCE_ROOT; }; … … 2914 2914 baseConfigurationReference = 1C6A13ED08666E62009EE6D2 /* Common Settings.xcconfig */; 2915 2915 buildSettings = { 2916 GCC_ENABLE_FIX_AND_CONTINUE = YES; 2916 2917 GCC_OPTIMIZATION_LEVEL = 0; 2917 2918 GCC_PREFIX_HEADER = Colloquy.pch; … … 2924 2925 PRODUCT_NAME = Colloquy; 2925 2926 WRAPPER_EXTENSION = app; 2927 ZERO_LINK = YES; 2926 2928 }; 2927 2929 name = Development; trunk/Controllers/JVChatWindowController.m
r3207 r3214 675 675 [cell setEnabled:[item isEnabled]]; 676 676 } else [cell setEnabled:YES]; 677 678 if( [item respondsToSelector:@selector( newMessagesWaiting )] ) { 679 [(JVDetailCell *) cell setStatusNumber:[item newMessagesWaiting]]; 680 } else [(JVDetailCell *) cell setStatusNumber:0]; 681 682 if( [item respondsToSelector:@selector( newHighlightMessagesWaiting )] ) { 683 [(JVDetailCell *) cell setImportantStatusNumber:[item newHighlightMessagesWaiting]]; 684 } else [(JVDetailCell *) cell setImportantStatusNumber:0]; 677 685 } 678 686 trunk/Panels/JVDirectChatPanel.m
r3208 r3214 430 430 return ( [_waitingAlerts count] ? [NSImage imageNamed:@"AlertCautionIcon"] : ( _newMessageCount ? ( _newHighlightMessageCount ? [NSImage imageNamed:@"privateChatTabNewMessage"] : [NSImage imageNamed:@"privateChatTabNewMessage"] ) : nil ) ); 431 431 432 return ( [_waitingAlerts count] ? [NSImage imageNamed:@"viewAlert"] : ( _newMessageCount ? ( _newHighlightMessageCount ? [NSImage imageNamed:@"newHighlightMessage"] : [NSImage imageNamed:@"newMessage"] ) : nil ));432 return ( [_waitingAlerts count] ? [NSImage imageNamed:@"viewAlert"] : nil ); 433 433 } 434 434 … … 448 448 } 449 449 450 - (void) willSelect { 451 _newMessageCount = 0; 452 _newHighlightMessageCount = 0; 453 } 454 450 455 - (void) didSelect { 451 456 if( ! [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) { … … 456 461 _newHighlightMessageCount = 0; 457 462 _isActive = YES; 463 458 464 [super didSelect]; 465 459 466 [_windowController reloadListItem:self andChildren:NO]; 460 467 [[[self view] window] makeFirstResponder:send]; 468 461 469 if( [_waitingAlerts count] ) 462 470 [[NSApplication sharedApplication] beginSheet:[_waitingAlerts objectAtIndex:0] modalForWindow:[_windowController window] modalDelegate:self didEndSelector:@selector( _alertSheetDidEnd:returnCode:contextInfo: ) contextInfo:NULL]; trunk/Views/JVDetailCell.h
r3072 r3214 6 6 NSString *_infoText; 7 7 NSLineBreakMode _lineBreakMode; 8 unsigned _statusNumber; 9 unsigned _importantStatusNumber; 8 10 } 9 11 - (void) setStatusImage:(NSImage *) image; … … 21 23 - (void) setLineBreakMode:(NSLineBreakMode) mode; 22 24 - (NSLineBreakMode) lineBreakMode; 25 26 - (void) setStatusNumber:(unsigned) number; 27 - (unsigned) statusNumber; 28 29 - (void) setImportantStatusNumber:(unsigned) number; 30 - (unsigned) importantStatusNumber; 23 31 @end trunk/Views/JVDetailCell.m
r3072 r3214 55 55 #pragma mark - 56 56 57 - (void) setStatusNumber:(unsigned) number { 58 _statusNumber = number; 59 } 60 61 - (unsigned) statusNumber { 62 return _statusNumber; 63 } 64 65 #pragma mark - 66 67 - (void) setImportantStatusNumber:(unsigned) number { 68 _importantStatusNumber = number; 69 } 70 71 - (unsigned) importantStatusNumber { 72 return _importantStatusNumber; 73 } 74 75 #pragma mark - 76 57 77 - (void) setHighlightedImage:(NSImage *) image { 58 78 [_altImage autorelease]; … … 129 149 } 130 150 131 if( [self image] ) switch( [self imageScaling] ) { 132 case NSScaleProportionally: 133 if( NSHeight( cellFrame ) < [[self image] size].height ) 134 imageWidth = ( NSHeight( cellFrame ) / [[self image] size].height ) * [[self image] size].width; 135 else imageWidth = [[self image] size].width; 136 break; 137 default: 138 case NSScaleNone: 139 imageWidth = [[self image] size].width; 140 break; 141 case NSScaleToFit: 142 imageWidth = [[self image] size].width; 143 break; 144 } 145 146 #define JVDetailCellLabelPadding 2. 151 if( [self image] ) { 152 switch( [self imageScaling] ) { 153 case NSScaleProportionally: 154 if( NSHeight( cellFrame ) < [[self image] size].height ) 155 imageWidth = ( NSHeight( cellFrame ) / [[self image] size].height ) * [[self image] size].width; 156 else imageWidth = [[self image] size].width; 157 break; 158 default: 159 case NSScaleNone: 160 imageWidth = [[self image] size].width; 161 break; 162 case NSScaleToFit: 163 imageWidth = [[self image] size].width; 164 break; 165 } 166 } 167 168 #define JVDetailCellLabelPadding 3. 147 169 #define JVDetailCellImageLabelPadding 5. 148 #define JVDetailCellTextLeading 2.170 #define JVDetailCellTextLeading 3. 149 171 #define JVDetailCellStatusImageLeftPadding 2. 150 172 #define JVDetailCellStatusImageRightPadding JVDetailCellStatusImageLeftPadding 151 173 174 float statusWidth = ( _statusImage ? [_statusImage size].width + JVDetailCellStatusImageRightPadding : 0. ); 175 if( ! _statusImage && _statusNumber || _importantStatusNumber ) { 176 NSColor *textColor = [NSColor whiteColor]; 177 NSColor *backgroundColor = [NSColor colorWithCalibratedRed:0.5803921568627451 green:0.6705882352941176 blue:0.7882352941176471 alpha:1.]; 178 NSColor *importantColor = [NSColor colorWithCalibratedRed:0.831372549019608 green:0.572549019607843 blue:0.541176470588235 alpha:1.]; 179 180 if( ! _statusNumber && _importantStatusNumber ) 181 backgroundColor = importantColor; 182 183 if( [self isHighlighted] ) { 184 textColor = [backgroundColor shadowWithLevel:0.2]; 185 backgroundColor = [backgroundColor highlightWithLevel:0.7]; 186 } 187 188 NSFont *font = [[NSFontManager sharedFontManager] fontWithFamily:@"Helvetica" traits:NSBoldFontMask weight:9 size:11.]; 189 NSMutableParagraphStyle *numberParaStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; 190 [numberParaStyle setAlignment:NSCenterTextAlignment]; 191 192 NSDictionary *statusNumberAttributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, numberParaStyle, NSParagraphStyleAttributeName, textColor, NSForegroundColorAttributeName, [NSNumber numberWithFloat:1.0], NSKernAttributeName, nil]; 193 194 NSString *statusText = [NSString stringWithFormat:@"%d", ( _statusNumber ? _statusNumber : _importantStatusNumber )]; 195 NSSize numberSize = [statusText sizeWithAttributes:statusNumberAttributes]; 196 statusWidth = numberSize.width + 12.; 197 198 if( imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ) + statusWidth < NSWidth( cellFrame ) ) { 199 float radius = 8.; 200 NSRect mainRect = NSMakeRect( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth - 2., NSMinY( cellFrame ) + ( ( NSHeight( cellFrame ) / 2 ) - 8 ), statusWidth, 16. ); 201 NSRect pathRect = NSInsetRect( mainRect, radius, radius ); 202 203 NSBezierPath *mainPath = [NSBezierPath bezierPath]; 204 [mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:180. endAngle:270.]; 205 [mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:270. endAngle:360.]; 206 [mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:0. endAngle:90.]; 207 [mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:90. endAngle:180.]; 208 [mainPath closePath]; 209 210 if( _importantStatusNumber ) { 211 NSString *importantStatusText = [NSString stringWithFormat:@"%d", _importantStatusNumber]; 212 numberSize = [importantStatusText sizeWithAttributes:statusNumberAttributes]; 213 float mainStatusWidth = statusWidth; 214 statusWidth += numberSize.width + 10.; 215 radius = 7.; 216 217 NSRect rect = NSMakeRect( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth - 2., NSMinY( cellFrame ) + ( ( NSHeight( cellFrame ) / 2 ) - 7 ), statusWidth - mainStatusWidth + 10., 14. ); 218 pathRect = NSInsetRect( rect, radius, radius ); 219 220 NSBezierPath *path = [NSBezierPath bezierPath]; 221 [path appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:180. endAngle:270.]; 222 [path appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:270. endAngle:360.]; 223 [path appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:0. endAngle:90.]; 224 [path appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:90. endAngle:180.]; 225 [path closePath]; 226 227 if( [self isHighlighted] ) [[NSColor whiteColor] set]; 228 else [[NSColor colorWithCalibratedRed:0.92156862745098 green:0.231372549019608 blue:0.243137254901961 alpha:0.85] set]; 229 [path fill]; 230 231 rect.origin.x -= 3.; 232 [importantStatusText drawInRect:rect withAttributes:statusNumberAttributes]; 233 } 234 235 [backgroundColor set]; 236 [mainPath fill]; 237 238 if( _importantStatusNumber ) { 239 if( [self isHighlighted] ) [[NSColor colorWithCalibratedRed:0.5803921568627451 green:0.6705882352941176 blue:0.7882352941176471 alpha:1.] set]; 240 else [[NSColor whiteColor] set]; 241 242 [mainPath setLineWidth:1.25]; 243 [mainPath stroke]; 244 } 245 246 mainRect.origin.y += 1.; 247 [statusText drawInRect:mainRect withAttributes:statusNumberAttributes]; 248 249 statusWidth += JVDetailCellStatusImageRightPadding + 3.; 250 251 } else statusWidth = 0.; 252 } 253 152 254 if( ( ! [_infoText length] && [_mainText length] ) || ( ( subStringSize.height + mainStringSize.height ) >= NSHeight( cellFrame ) - 2. ) ) { 153 255 float mainYLocation = 0.; … … 155 257 if( NSHeight( cellFrame ) >= mainStringSize.height ) { 156 258 mainYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) - ( mainStringSize.height / 2 ); 157 [_mainText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - ( _statusImage ? [_statusImage size].width + JVDetailCellStatusImageRightPadding : 0. ), [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes];259 [_mainText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes]; 158 260 } 159 261 } else if( [_infoText length] && [_mainText length] ) { … … 162 264 if( NSHeight( cellFrame ) >= mainStringSize.height ) { 163 265 mainYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) - mainStringSize.height + ( JVDetailCellTextLeading / 2. ); 164 [_mainText drawInRect:NSMakeRect( cellFrame.origin.x + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - ( _statusImage ? [_statusImage size].width + JVDetailCellStatusImageRightPadding : 0. ), [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes];266 [_mainText drawInRect:NSMakeRect( cellFrame.origin.x + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes]; 165 267 166 268 subYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) + subStringSize.height - mainStringSize.height + ( JVDetailCellTextLeading / 2. ); 167 [_infoText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), subYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - ( _statusImage ? [_statusImage size].width + JVDetailCellStatusImageRightPadding : 0. ), [_infoText sizeWithAttributes:subAttributes].height ) withAttributes:subAttributes];269 [_infoText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), subYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_infoText sizeWithAttributes:subAttributes].height ) withAttributes:subAttributes]; 168 270 } 169 271 } 170 272 171 273 if( _statusImage && NSHeight( cellFrame ) >= [_statusImage size].height ) { 172 [_statusImage compositeToPoint:NSMakePoint( NSMinX( cellFrame ) + NSWidth( cellFrame ) - [_statusImage size].width - JVDetailCellStatusImageRightPadding, NSMaxY( cellFrame ) - ( ( NSHeight( cellFrame ) / 2 ) - ( [_statusImage size].height / 2 ) ) ) operation:NSCompositeSourceAtop fraction:( [self isEnabled] ? 1. : 0.5)];274 [_statusImage compositeToPoint:NSMakePoint( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth, NSMaxY( cellFrame ) - ( ( NSHeight( cellFrame ) / 2 ) - ( [_statusImage size].height / 2 ) ) ) operation:NSCompositeSourceAtop fraction:( [self isEnabled] ? 1. : 0.5)]; 173 275 } 174 276 } … … 190 292 - (NSLineBreakMode) lineBreakMode { 191 293 return _lineBreakMode; 294 } 295 296 - (void) setStringValue:(NSString *) string { 297 [self setMainText:string]; 192 298 } 193 299 … … 203 309 return _mainText; 204 310 } 205 206 - (void) setStringValue:(NSString *) string {207 [self setMainText:string];208 }209 311 @end trunk/Views/JVSideStatusView.m
r3206 r3214 64 64 newFrame.size.width = MIN( max, newFrame.size.width ); 65 65 } 66 66 67 67 [[self superview] setFrame:newFrame]; 68 68
