| 573 | #endif // MSG_WRAP_TEXT |
| 574 | |
| 575 | COLORREF |
| 576 | setMsgTextColor(HDC hdc, int gray) |
| 577 | { |
| 578 | COLORREF fg, color1, color2; |
| 579 | if (gray) { |
| 580 | if (message_bg_brush) { |
| 581 | color1 = message_bg_color; |
| 582 | color2 = message_fg_color; |
| 583 | } else { |
| 584 | color1 = (COLORREF) GetSysColor(DEFAULT_COLOR_BG_MSG); |
| 585 | color2 = (COLORREF) GetSysColor(DEFAULT_COLOR_FG_MSG); |
| 586 | } |
| 587 | /* Make a "gray" color by taking the average of the individual R,G,B |
| 588 | components of two colors. Thanks to Jonathan del Strother */ |
| 589 | fg = RGB((GetRValue(color1) + GetRValue(color2)) / 2, |
| 590 | (GetGValue(color1) + GetGValue(color2)) / 2, |
| 591 | (GetBValue(color1) + GetBValue(color2)) / 2); |
| 592 | } else { |
| 593 | fg = message_fg_brush ? message_fg_color |
| 594 | : (COLORREF) GetSysColor(DEFAULT_COLOR_FG_MSG); |
| 595 | } |
| 596 | |
| 597 | return SetTextColor(hdc, fg); |
| 598 | } |
| 599 | |
| 600 | void |
| 601 | onPaint(HWND hWnd) |