Changeset 14837
- Timestamp:
- 01/08/2006 07:44:24 PM (3 years ago)
- Files:
-
- trunk/Frameworks/Adium Framework/ESFileTransfer.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/ESFileTransfer.m
r14274 r14837 21 21 static NSBezierPath *arrowPath = nil; 22 22 23 #define MAGIC_ARROW_SCALE 0.85 24 #define MAGIC_ARROW_TRANSLATE_X 2.85 25 #define MAGIC_ARROW_TRANSLATE_Y 0.75 26 23 27 @implementation ESFileTransfer 24 28 //Init … … 268 272 } 269 273 270 - (NSBezierPath *)arrowPathInSize:(NSSize)arrowSize pointingDown:(BOOL)pointItDown 274 - (NSBezierPath *)arrowPathInSize:(NSSize)arrowSize pointingDown:(BOOL)pointItDown shaftLengthMultiplier:(float)shaftLengthMulti 271 275 { 272 276 if(!arrowPath) { … … 284 288 # define TWO_THIRDS (2.0/3.0) 285 289 # define ONE_HALF 0.5 290 const float shaftLength = ONE_HALF * shaftLengthMulti; 291 const float shaftEndY = -(shaftLength - ONE_HALF); //the end of the arrow shaft (points 1-2). 286 292 287 293 //start with the bottom vertex. 288 [arrowPath moveToPoint:NSMakePoint(ONE_THIRD, 0.0)]; //1289 [arrowPath lineToPoint:NSMakePoint(TWO_THIRDS, 0.0)]; //2294 [arrowPath moveToPoint:NSMakePoint(ONE_THIRD, shaftEndY)]; //1 295 [arrowPath lineToPoint:NSMakePoint(TWO_THIRDS, shaftEndY)]; //2 290 296 //up to the inner right corner. 291 [arrowPath relativeLineToPoint:NSMakePoint(0.0, ONE_HALF)]; //3297 [arrowPath relativeLineToPoint:NSMakePoint(0.0, shaftLength)]; //3 292 298 //far right. 293 299 [arrowPath relativeLineToPoint:NSMakePoint(ONE_THIRD, 0.0)]; //4 … … 323 329 } 324 330 331 - (NSBezierPath *)arrowPathInSize:(NSSize)arrowSize pointingDown:(BOOL)pointItDown 332 { 333 return [self arrowPathInSize:arrowSize pointingDown:pointItDown shaftLengthMultiplier:1.0f]; 334 } 335 325 336 - (NSImage *)iconImage 326 337 { … … 368 379 //and the arrow on top of it. 369 380 if(drawArrow) { 370 NSBezierPath *arrow = [self arrowPathInSize:bottomRight.size pointingDown:pointingDown ];381 NSBezierPath *arrow = [self arrowPathInSize:bottomRight.size pointingDown:pointingDown shaftLengthMultiplier:5.0f]; 371 382 372 383 //bring it into position. … … 375 386 [arrow transformUsingAffineTransform:transform]; 376 387 377 NSLog(@"arrow bounds (after): %@", NSStringFromRect([arrow bounds])); 388 //fine-tune size. 389 transform = [NSAffineTransform transform]; 390 [transform scaleBy:MAGIC_ARROW_SCALE]; 391 [arrow transformUsingAffineTransform:transform]; 392 393 //fine-tune position. 394 transform = [NSAffineTransform transform]; 395 [transform translateXBy:MAGIC_ARROW_TRANSLATE_X yBy:MAGIC_ARROW_TRANSLATE_Y]; 396 [arrow transformUsingAffineTransform:transform]; 397 398 [circle addClip]; 378 399 [[NSColor alternateSelectedControlColor] setFill]; 379 400 [arrow fill];