Changeset 111 for Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarEventBase.cp
- Timestamp:
- 10/28/07 23:29:14 (1 year ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarEventBase.cp
r97 r111 41 41 Default constructor */ 42 42 43 const float body_transparency = 0.75; 44 const float line_transparency = 1.0; 45 const float text_transparency = 0.9; 46 43 47 CCalendarEventBase::CCalendarEventBase(const SPaneInfo &inPaneInfo) : 44 48 LPane(inPaneInfo) … … 85 89 86 90 // Force immediate redraw 87 Draw(NULL); 91 Rect refreshRect; 92 93 if (CalcPortExposedRect(refreshRect)) { 94 StRegion update = refreshRect; 95 mTable->Draw(update); 96 } 88 97 } 89 98 } … … 212 221 box.bottom = box.top + 16; 213 222 } 214 ::CGContextSetGrayFillColor(inContext, mIsSelected && !IsFreeBusy() ? 1.0 : 0.0, 1.0); 223 224 // Use white colour for selected item 225 float red = CGUtils::GetCGRed(mColour); 226 float green = CGUtils::GetCGGreen(mColour); 227 float blue = CGUtils::GetCGBlue(mColour); 228 if (mIsSelected) 229 { 230 ::CGContextSetGrayFillColor(inContext, (red + green + blue > 2.5) ? 0.0 : 1.0, 1.0); 231 } 232 else 233 { 234 CGUtils::DarkenColours(red, green, blue); 235 ::CGContextSetRGBFillColor(inContext, red, green, blue, text_transparency); 236 } 237 215 238 MyCFString trunc(mTitle, kCFStringEncodingUTF8); 216 239 if (mHoriz) … … 236 259 ::CGContextAddLineToPoint(inContext, rect.origin.x, rect.origin.y + rect.size.height); 237 260 } 238 ::CGContextSetGrayStrokeColor(inContext, 0.0, 1.0); 261 239 262 ::CGContextStrokePath(inContext); 240 ::CGContextClosePath(inContext);263 //::CGContextClosePath(inContext); 241 264 } 242 265 } … … 261 284 else 262 285 rect.size.width -= 1; 286 rect.size.height -= 1; 263 287 264 288 CGMutablePathRef path = ::CGPathCreateMutable(); 265 289 266 290 // Draw left end (rounded if starts, flat otherwise) 291 ::CGPathMoveToPoint(path, NULL, rect.origin.x + rect.size.width / 2.0, rect.origin.y + rect.size.height); 267 292 if (mStartsInCol) 268 293 { 269 294 if (mAllDay) 270 295 { 271 ::CGPath MoveToPoint(path, NULL, rect.origin.x + rect.size.height / 2.0, rect.origin.y + rect.size.height);272 ::CGPathAddArc (path, NULL, rect.origin.x + rect.size.height/ 2.0, rect.origin.y + rect.size.height/ 2.0, rect.size.height/ 2.0, pi / 2.0, 1.5 * pi,0);296 ::CGPathAddArcToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height, rect.origin.x, rect.origin.y + rect.size.height / 2.0, rect.size.height/ 2.0); 297 ::CGPathAddArcToPoint(path, NULL, rect.origin.x, rect.origin.y, rect.origin.x + rect.size.width / 2.0, rect.origin.y, rect.size.height/ 2.0); 273 298 } 274 299 else 275 300 { 276 ::CGPath MoveToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height);301 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height); 277 302 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y); 278 } 279 } 280 else 281 { 282 ::CGPathMoveToPoint(path, NULL, rect.origin.x + rect.size.height / 2.0, rect.origin.y + rect.size.height); 303 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width / 2.0, rect.origin.y); 304 } 305 } 306 else 307 { 308 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.height / 2.0, rect.origin.y + rect.size.height); 283 309 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height); 284 310 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.height / 6.0, rect.origin.y + rect.size.height * 5.0 / 6.0); … … 288 314 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.height / 6.0, rect.origin.y + rect.size.height / 6.0); 289 315 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y); 290 } 291 292 // Draw top line 293 if (mAllDay) 294 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width - rect.size.height / 2.0, rect.origin.y); 295 else 296 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y); 316 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width / 2.0, rect.origin.y); 317 } 297 318 298 319 // Draw right end (rounded if starts, flat otherwise) … … 300 321 { 301 322 if (mAllDay) 302 ::CGPathAddArc(path, NULL, rect.origin.x + rect.size.width - rect.size.height/ 2.0, rect.origin.y + rect.size.height/ 2.0, rect.size.height/ 2.0, 1.5 * pi, pi / 2.0, 0); 323 { 324 ::CGPathAddArcToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height / 2.0, rect.size.height/ 2.0); 325 ::CGPathAddArcToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, rect.origin.x + rect.size.width / 2.0, rect.origin.y + rect.size.height, rect.size.height/ 2.0); 326 } 303 327 else 328 { 329 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y); 304 330 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); 331 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width / 2.0, rect.origin.y + rect.size.height); 332 } 305 333 } 306 334 else … … 313 341 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height * 5.0 / 6.0); 314 342 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width - rect.size.height / 6.0, rect.origin.y + rect.size.height); 315 } 316 317 // Draw bottom line 318 if (mAllDay) 319 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.height / 2.0, rect.origin.y + rect.size.height); 320 else 321 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height); 343 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width / 2.0, rect.origin.y + rect.size.height); 344 } 322 345 323 346 // Close path … … 328 351 float green = CGUtils::GetCGGreen(mColour); 329 352 float blue = CGUtils::GetCGBlue(mColour); 330 float line_factor = IsFreeBusy() ? 1.0 : 0.6;353 float line_factor = IsFreeBusy() ? 1.0 : 1.0; 331 354 if (mIsSelected) 332 355 { 333 CGUtils::UnflattenColours(red, green, blue);356 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 334 357 if (IsFreeBusy()) 335 358 ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 336 359 else 337 360 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 338 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 339 } 340 else 341 { 361 } 362 else 363 { 364 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, line_transparency); 365 CGUtils::LightenColours(red, green, blue); 342 366 if (IsFreeBusy()) 343 ::CGContextSetGrayFillColor(inContext, 1.0, 1.0);367 ::CGContextSetGrayFillColor(inContext, 1.0, body_transparency); 344 368 else 345 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 346 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 347 } 348 369 ::CGContextSetRGBFillColor(inContext, red, green, blue, body_transparency); 370 } 371 372 ::CGContextSetLineWidth(inContext, 0.75); 373 if (!mAllDay) 374 ::CGContextSetShouldAntialias(inContext, false); 375 349 376 ::CGContextAddPath(inContext, path); 350 377 ::CGContextDrawPath(inContext, kCGPathFillStroke); 351 378 ::CGContextSetShouldAntialias(inContext, true); 379 380 ::CGContextSetLineWidth(inContext, 1.0); 381 352 382 // Check for now marker 353 383 if (!mAllDay && mIsNow) 354 384 { 355 ::CGContextSetRGBStrokeColor(inContext, 0.95, 0.0, 0.0, 1.0);385 ::CGContextSetRGBStrokeColor(inContext, 0.95, 0.0, 0.0, mIsSelected ? 1.0 : line_transparency); 356 386 ::CGContextAddPath(inContext, path); 357 387 ::CGContextStrokePath(inContext); … … 441 471 CGMutablePathRef path = ::CGPathCreateMutable(); 442 472 473 ::CGPathMoveToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height / 2.0); 443 474 if (mStartsInCol) 444 475 { 445 // Top-left corner 446 ::CGPathMoveToPoint(path, NULL, rect.origin.x, rect.origin.y + radius); 447 ::CGPathAddArc(path, NULL, rect.origin.x + radius, rect.origin.y + radius, radius, pi, 1.5 * pi, 0); 448 449 // Top line 450 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width - radius, rect.origin.y); 451 452 // Top-right corner 453 ::CGPathAddArc(path, NULL, rect.origin.x + rect.size.width - radius, rect.origin.y + radius, radius, 1.5 * pi, 0.0, 0); 454 } 455 else 456 { 476 // Top-left, top-right corners 477 ::CGPathAddArcToPoint(path, NULL, rect.origin.x, rect.origin.y, rect.origin.x + rect.size.width / 2.0, rect.origin.y, radius); 478 ::CGPathAddArcToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height / 2.0, radius); 479 } 480 else 481 { 482 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + radius); 483 457 484 // Draw jagged top edge 458 ::CGPathMoveToPoint(path, NULL, rect.origin.x, rect.origin.y + radius);459 485 uint32_t ctr = 0; 460 486 for(float x_pos = rect.origin.x; x_pos < rect.origin.x + rect.size.width; x_pos += cJaggedEdgeHeight, ctr++) … … 463 489 // Draw last segment 464 490 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + ((ctr % 2 == 1) ? 0.0 : cJaggedEdgeHeight)); 465 } 466 467 // Right line 468 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - radius); 491 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height / 2.0); 492 } 469 493 470 494 if (mEndsInCol) 471 495 { 472 // Bottom-right corner 473 ::CGPathAddArc(path, NULL, rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height - radius, radius, 0.0, pi / 2.0, 0); 474 475 // Bottom line 476 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + radius, rect.origin.y + rect.size.height); 477 478 // Bottom-left corner 479 ::CGPathAddArc(path, NULL, rect.origin.x + radius, rect.origin.y + rect.size.height - radius, radius, pi / 2.0, pi, 0); 480 } 481 else 482 { 496 // Bottom-right, bottom-left corners 497 ::CGPathAddArcToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, rect.origin.x + rect.size.width / 2.0, rect.origin.y + rect.size.height, radius); 498 ::CGPathAddArcToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height, rect.origin.x, rect.origin.y + rect.size.height / 2.0, radius); 499 } 500 else 501 { 502 ::CGPathAddLineToPoint(path, NULL, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - radius); 503 483 504 // Draw jagged bottom edge 484 505 uint32_t ctr = 0; … … 486 507 ::CGPathAddLineToPoint(path, NULL, x_pos, rect.origin.y + rect.size.height - ((ctr % 2 == 1) ? 0.0 : cJaggedEdgeHeight)); 487 508 488 // Draw last segment 509 // Draw last segments 489 510 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height - ((ctr % 2 == 0) ? 0.0 : cJaggedEdgeHeight)); 490 } 491 492 // Left line 493 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + radius); 511 ::CGPathAddLineToPoint(path, NULL, rect.origin.x, rect.origin.y + rect.size.height / 2.0); 512 } 494 513 495 514 // Close the path … … 500 519 float green = CGUtils::GetCGGreen(mColour); 501 520 float blue = CGUtils::GetCGBlue(mColour); 502 float line_factor = IsFreeBusy() ? 1.0 : 0.6;521 float line_factor = IsFreeBusy() ? 1.0 : 1.0; 503 522 if (mIsSelected) 504 523 { 505 CGUtils::UnflattenColours(red, green, blue);524 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 506 525 if (IsFreeBusy()) 507 526 ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 508 527 else 509 528 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 510 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 511 } 512 else 513 { 529 } 530 else 531 { 532 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, line_transparency); 533 CGUtils::LightenColours(red, green, blue); 514 534 if (IsFreeBusy()) 515 ::CGContextSetGrayFillColor(inContext, 1.0, 1.0);535 ::CGContextSetGrayFillColor(inContext, 1.0, body_transparency); 516 536 else 517 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 518 ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 537 ::CGContextSetRGBFillColor(inContext, red, green, blue, body_transparency); 519 538 } 520 539 521 540 if (IsFreeBusy()) 522 541 ::CGContextSetLineWidth(inContext, 5.0); 542 else 543 ::CGContextSetLineWidth(inContext, 0.5); 523 544 524 545 ::CGContextAddPath(inContext, path); 525 546 ::CGContextDrawPath(inContext, kCGPathFillStroke); 526 547 527 if (IsFreeBusy()) 528 ::CGContextSetLineWidth(inContext, 1.0); 548 ::CGContextSetLineWidth(inContext, 1.0); 529 549 530 550 // Check for now marker 531 551 if (mIsNow) 532 552 { 533 ::CGContextSetRGBStrokeColor(inContext, 0.95, 0.0, 0.0, 1.0);553 ::CGContextSetRGBStrokeColor(inContext, 0.95, 0.0, 0.0, mIsSelected ? 1.0 : line_transparency); 534 554 ::CGContextAddPath(inContext, path); 535 555 ::CGContextStrokePath(inContext);