Index: src/apps/deskbar/BarMenuBar.cpp =================================================================== --- src/apps/deskbar/BarMenuBar.cpp (revision 29046) +++ src/apps/deskbar/BarMenuBar.cpp (working copy) @@ -35,6 +35,7 @@ All rights reserved. #include #include #include +#include #include #include "icons.h" @@ -127,6 +128,13 @@ void TBarMenuBar::Draw(BRect rect) { // want to skip the fancy BMenuBar drawing code. + rgb_color c = LowColor(); + BRect bounds = Bounds(); + + BGradientLinear gradient(bounds.LeftTop(), bounds.LeftBottom()); + gradient.AddColor(tint_color(c, B_LIGHTEN_2_TINT), 0); + gradient.AddColor(c, 255); + FillRect(bounds & rect, gradient); BMenu::Draw(rect); } Index: src/servers/app/DesktopSettings.cpp =================================================================== --- src/servers/app/DesktopSettings.cpp (revision 29046) +++ src/servers/app/DesktopSettings.cpp (working copy) @@ -63,7 +63,7 @@ DesktopSettingsPrivate::_SetDefaults() strlcpy(fMenuInfo.f_family, fPlainFont.Family(), B_FONT_FAMILY_LENGTH); strlcpy(fMenuInfo.f_style, fPlainFont.Style(), B_FONT_STYLE_LENGTH); fMenuInfo.font_size = fPlainFont.Size(); - fMenuInfo.background_color.set_to(216, 216, 216); + fMenuInfo.background_color.set_to(226, 226, 226); fMenuInfo.separator = 0; // look of the separator (R5: (0, 1, 2), default 0) Index: src/kits/interface/Button.cpp =================================================================== --- src/kits/interface/Button.cpp (revision 29046) +++ src/kits/interface/Button.cpp (working copy) @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include #include @@ -110,344 +112,95 @@ BButton::Draw(BRect updateRect) const bool enabled = IsEnabled(); const bool pushed = Value() == B_CONTROL_ON; -#if 0 + + SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + FillRect(rect); + // Default indicator if (IsDefault()) rect = DrawDefault(rect, enabled); - else - rect.InsetBy(1.0f, 1.0f); BRect fillArea = rect; - fillArea.InsetBy(3.0f, 3.0f); - - BString text = Label(); - -#if 1 - // Label truncation - BFont font; - GetFont(&font); - font.TruncateString(&text, B_TRUNCATE_END, fillArea.Width()); -#endif + fillArea.InsetBy(3.0, 3.0); - // Label position - const float stringWidth = StringWidth(text.String()); - const float x = (bounds.right - stringWidth) / 2.0f; - const float labelY = bounds.top - + ((bounds.Height() - fh.ascent - fh.descent) / 2.0f) - + fh.ascent + 1.0f; - const float focusLineY = labelY + fh.descent; - - /* speed trick: - if the focus changes but the button is not pressed then we can - redraw only the focus line, - if the focus changes and the button is pressed invert the internal rect - this block takes care of all the focus changes - */ - if (IsFocusChanging()) { - if (pushed) { - rect.InsetBy(2.0, 2.0); - InvertRect(rect); - } else - DrawFocusLine(x, focusLineY, stringWidth, IsFocus() && Window()->IsActive()); + rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color textColor = ui_color(B_CONTROL_TEXT_COLOR); - return; + if (!enabled) { + bg = tint_color(bg, B_LIGHTEN_2_TINT); + textColor = tint_color(textColor, B_DISABLED_LABEL_TINT); + } + + rgb_color light = tint_color(bg, B_LIGHTEN_1_TINT); + rgb_color dark1 = tint_color(bg, B_DARKEN_1_TINT); + rgb_color dark = tint_color(bg, B_DARKEN_2_TINT); + rgb_color darker = tint_color(bg, B_DARKEN_4_TINT); + + BeginLineArray(6); + + if (pushed) { + rect.left += 1.0; + rect.top += 1.0; + SetHighColor(darker); + StrokeRect(rect); + } else { + // Shadow + rect.left += 1.0; + rect.top += 1.0; + + AddLine(rect.LeftBottom(), rect.RightBottom(), dark); + AddLine(rect.RightBottom(), rect.RightTop(), dark); + + // Frame + rect.left -= 1.0; + rect.top -= 1.0; + rect.right -= 1.0; + rect.bottom -= 1.0; + + AddLine(rect.LeftTop(), BPoint(rect.right - 1.0, rect.top), dark); + AddLine(rect.LeftTop(), BPoint(rect.left, rect.bottom - 1.0), dark); + AddLine(rect.LeftBottom(), rect.RightBottom(), darker); + AddLine(rect.RightBottom(), rect.RightTop(), darker); } - // Colors - const rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); - const rgb_color buttonBgColor=tint_color(panelBgColor, B_LIGHTEN_1_TINT); - const rgb_color maxLightColor=tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); - const rgb_color maxShadowColor=tint_color(panelBgColor, B_DARKEN_MAX_TINT); - const rgb_color darkBorderColor = tint_color(panelBgColor, - enabled ? B_DARKEN_4_TINT : B_DARKEN_2_TINT); - const rgb_color firstBevelColor = enabled ? tint_color(panelBgColor, B_DARKEN_2_TINT) - : panelBgColor; - const rgb_color cornerColor = IsDefault() ? firstBevelColor : panelBgColor; - - // Fill the button area - SetHighColor(buttonBgColor); - FillRect(fillArea); + EndLineArray(); - // external border - SetHighColor(darkBorderColor); + rect.InsetBy(1.0, 1.0); + SetHighColor(pushed ? dark : light); StrokeRect(rect); - BeginLineArray(14); - - // Corners - AddLine(rect.LeftTop(), rect.LeftTop(), cornerColor); - AddLine(rect.LeftBottom(), rect.LeftBottom(), cornerColor); - AddLine(rect.RightTop(), rect.RightTop(), cornerColor); - AddLine(rect.RightBottom(), rect.RightBottom(), cornerColor); - - rect.InsetBy(1.0f,1.0f); - - // Shadow - AddLine(rect.LeftBottom(), rect.RightBottom(), firstBevelColor); - AddLine(rect.RightBottom(), rect.RightTop(), firstBevelColor); - // Light - AddLine(rect.LeftTop(), rect.LeftBottom(),buttonBgColor); - AddLine(rect.LeftTop(), rect.RightTop(), buttonBgColor); - - rect.InsetBy(1.0f, 1.0f); - - // Shadow - AddLine(rect.LeftBottom(), rect.RightBottom(), panelBgColor); - AddLine(rect.RightBottom(), rect.RightTop(), panelBgColor); - // Light - AddLine(rect.LeftTop(), rect.LeftBottom(),maxLightColor); - AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); - - rect.InsetBy(1.0f,1.0f); - - // Light - AddLine(rect.LeftTop(), rect.LeftBottom(),maxLightColor); - AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); - - EndLineArray(); - - // Invert if clicked - if (enabled && pushed) { - rect.InsetBy(-2.0f, -2.0f); - InvertRect(rect); - } + rect.InsetBy(1.0, 1.0); + BGradientLinear gradient(rect.LeftTop(), rect.LeftBottom()); - // Label color - if (enabled) { - if (pushed) { - SetHighColor(maxLightColor); - SetLowColor(maxShadowColor); - } else { - SetHighColor(maxShadowColor); - SetLowColor(tint_color(panelBgColor, B_LIGHTEN_2_TINT)); - } + if (pushed) { + gradient.AddColor(bg, 0); + gradient.AddColor(dark1, 255); } else { - SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT)); - SetLowColor(tint_color(panelBgColor, B_LIGHTEN_2_TINT)); + gradient.AddColor(light, 0); + gradient.AddColor(bg, 255); } - // Draw the label - DrawString(text.String(), BPoint(x, labelY)); - - // Focus line - if (enabled && IsFocus() && Window()->IsActive() && !pushed) - DrawFocusLine(x,focusLineY,stringWidth,true); -#else - // Default indicator - if (IsDefault()) - rect = DrawDefault(rect, enabled); - - BRect fillArea = rect; - fillArea.InsetBy(3.0, 3.0); + FillRect(rect, gradient); BString text = Label(); -#if 1 // Label truncation BFont font; GetFont(&font); font.TruncateString(&text, B_TRUNCATE_END, fillArea.Width() - 4); -#endif // Label position const float stringWidth = StringWidth(text.String()); const float x = (rect.right - stringWidth) / 2.0; - const float labelY = bounds.top - + ((bounds.Height() - fh.ascent - fh.descent) / 2.0) + const float labelY = rect.top + + ((rect.Height() - fh.ascent - fh.descent) / 2.0) + fh.ascent + 1.0; - const float focusLineY = labelY + fh.descent; - - /* speed trick: - if the focus changes but the button is not pressed then we can - redraw only the focus line, - if the focus changes and the button is pressed invert the internal rect - this block takes care of all the focus changes - */ - if (IsFocusChanging()) { - if (pushed) { - rect.InsetBy(2.0, 2.0); - InvertRect(rect); - } else { - DrawFocusLine(x, focusLineY, stringWidth, IsFocus() - && Window()->IsActive()); - } - - return; - } - // colors - rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); - rgb_color lightColor; - rgb_color maxLightColor; - rgb_color maxShadowColor = tint_color(panelBgColor, B_DARKEN_MAX_TINT); - - rgb_color dark1BorderColor; - rgb_color dark2BorderColor; - - rgb_color bevelColor1; - rgb_color bevelColor2; - rgb_color bevelColorRBCorner; - - rgb_color borderBevelShadow; - rgb_color borderBevelLight; - - if (enabled) { - lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); - maxLightColor = tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); - - dark1BorderColor = tint_color(panelBgColor, B_DARKEN_3_TINT); - dark2BorderColor = tint_color(panelBgColor, B_DARKEN_4_TINT); - - bevelColor1 = tint_color(panelBgColor, B_DARKEN_2_TINT); - bevelColor2 = panelBgColor; - - if (IsDefault()) { - borderBevelShadow = tint_color(dark1BorderColor, - (B_NO_TINT + B_DARKEN_1_TINT) / 2); - borderBevelLight = tint_color(dark1BorderColor, B_LIGHTEN_1_TINT); - - borderBevelLight.red = (borderBevelLight.red + panelBgColor.red) - / 2; - borderBevelLight.green = (borderBevelLight.green - + panelBgColor.green) / 2; - borderBevelLight.blue = (borderBevelLight.blue - + panelBgColor.blue) / 2; - - dark1BorderColor = tint_color(dark1BorderColor, B_DARKEN_3_TINT); - dark2BorderColor = tint_color(dark1BorderColor, B_DARKEN_4_TINT); - - bevelColorRBCorner = borderBevelShadow; - } else { - borderBevelShadow = tint_color(panelBgColor, - (B_NO_TINT + B_DARKEN_1_TINT) / 2); - borderBevelLight = buttonBgColor; - - bevelColorRBCorner = dark1BorderColor; - } - } else { - lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); - maxLightColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); - - dark1BorderColor = tint_color(panelBgColor, B_DARKEN_1_TINT); - dark2BorderColor = tint_color(panelBgColor, B_DARKEN_2_TINT); - - bevelColor1 = panelBgColor; - bevelColor2 = buttonBgColor; - - if (IsDefault()) { - borderBevelShadow = dark1BorderColor; - borderBevelLight = panelBgColor; - dark1BorderColor = tint_color(dark1BorderColor, B_DARKEN_1_TINT); - dark2BorderColor = tint_color(dark1BorderColor, 1.16); - - } else { - borderBevelShadow = panelBgColor; - borderBevelLight = panelBgColor; - } - - bevelColorRBCorner = tint_color(panelBgColor, 1.08);; - } - - // fill the button area - SetHighColor(buttonBgColor); - FillRect(fillArea); - - BeginLineArray(22); - // bevel around external border - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), borderBevelShadow); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right, rect.top), borderBevelShadow); - - AddLine(BPoint(rect.right, rect.top + 1), - BPoint(rect.right, rect.bottom), borderBevelLight); - AddLine(BPoint(rect.left + 1, rect.bottom), - BPoint(rect.right - 1, rect.bottom), borderBevelLight); - - rect.InsetBy(1.0, 1.0); - - // external border - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), dark1BorderColor); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right, rect.top), dark1BorderColor); - AddLine(BPoint(rect.right, rect.top + 1), - BPoint(rect.right, rect.bottom), dark2BorderColor); - AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left + 1, rect.bottom), dark2BorderColor); - - rect.InsetBy(1.0, 1.0); - - // Light - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.left, rect.top), buttonBgColor); - AddLine(BPoint(rect.left, rect.top + 1), - BPoint(rect.left, rect.bottom - 1), lightColor); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.bottom), bevelColor2); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right - 1, rect.top), lightColor); - AddLine(BPoint(rect.right, rect.top), - BPoint(rect.right, rect.top), bevelColor2); - // Shadow - AddLine(BPoint(rect.left + 1, rect.bottom), - BPoint(rect.right - 1, rect.bottom), bevelColor1); - AddLine(BPoint(rect.right, rect.bottom), - BPoint(rect.right, rect.bottom), bevelColorRBCorner); - AddLine(BPoint(rect.right, rect.bottom - 1), - BPoint(rect.right, rect.top + 1), bevelColor1); - - rect.InsetBy(1.0, 1.0); - - // Light - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.left, rect.bottom - 1), maxLightColor); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.bottom), buttonBgColor); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right - 1, rect.top), maxLightColor); - AddLine(BPoint(rect.right, rect.top), - BPoint(rect.right, rect.top), buttonBgColor); - // Shadow - AddLine(BPoint(rect.left + 1, rect.bottom), - BPoint(rect.right, rect.bottom), bevelColor2); - AddLine(BPoint(rect.right, rect.bottom - 1), - BPoint(rect.right, rect.top + 1), bevelColor2); - - rect.InsetBy(1.0,1.0); - - EndLineArray(); - - // Invert if clicked - if (enabled && pushed) { - rect.InsetBy(-2.0, -2.0); - InvertRect(rect); - } - - // Label color - if (enabled) { - if (pushed) { - SetHighColor(maxLightColor); - SetLowColor(255 - buttonBgColor.red, - 255 - buttonBgColor.green, - 255 - buttonBgColor.blue); - } else { - SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); - SetLowColor(buttonBgColor); - } - } else { - SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT)); - SetLowColor(buttonBgColor); - } - - // Draw the label + SetDrawingMode(B_OP_OVER); + SetHighColor(textColor); + SetLowColor(B_TRANSPARENT_COLOR); DrawString(text.String(), BPoint(x, labelY)); - - // Focus line - if (enabled && IsFocus() && Window()->IsActive() && !pushed) - DrawFocusLine(x, focusLineY, stringWidth, true); -#endif + SetDrawingMode(B_OP_COPY); } @@ -868,13 +621,11 @@ BButton::DrawDefault(BRect bounds, bool SetHighColor(focusColor); - StrokeRect(bounds, B_SOLID_LOW); - bounds.InsetBy(1.0, 1.0); - StrokeRect(bounds); bounds.InsetBy(1.0, 1.0); - StrokeRect(bounds); - bounds.InsetBy(1.0, 1.0); - + StrokeRoundRect(bounds, + 2.0 * (bounds.Width() / (bounds.Width() + 2.0)), + 2.0 * (bounds.Width() / (bounds.Width() + 2.0))); + bounds.InsetBy(2.0, 2.0); return bounds; #endif } Index: src/kits/interface/ScrollBar.cpp =================================================================== --- src/kits/interface/ScrollBar.cpp (revision 29046) +++ src/kits/interface/ScrollBar.cpp (working copy) @@ -12,6 +12,7 @@ #include +#include #include #include #include @@ -753,31 +754,15 @@ BScrollBar::Draw(BRect updateRect) // (independent of enabled state) SetHighColor(tint_color(normal, B_DARKEN_2_TINT)); StrokeRect(bounds); - bounds.InsetBy(1.0, 1.0); bool enabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0 && fProportion >= 0.0; - rgb_color light, light1, dark, dark1, dark2, dark4; - if (enabled) { - light = tint_color(normal, B_LIGHTEN_MAX_TINT); - light1 = tint_color(normal, B_LIGHTEN_1_TINT); - dark = tint_color(normal, B_DARKEN_3_TINT); - dark1 = tint_color(normal, B_DARKEN_1_TINT); - dark2 = tint_color(normal, B_DARKEN_2_TINT); - dark4 = tint_color(normal, B_DARKEN_4_TINT); - } else { - light = tint_color(normal, B_LIGHTEN_MAX_TINT); - light1 = normal; - dark = tint_color(normal, B_DARKEN_2_TINT); - dark1 = tint_color(normal, B_LIGHTEN_2_TINT); - dark2 = tint_color(normal, B_LIGHTEN_1_TINT); - dark4 = tint_color(normal, B_DARKEN_3_TINT); - } - SetDrawingMode(B_OP_OVER); BRect thumbBG = bounds; + thumbBG.InsetBy(1.0, 1.0); + bool doubleArrows = _DoubleArrows(); // Draw arrows @@ -789,20 +774,20 @@ BScrollBar::Draw(BRect updateRect) enabled, fPrivateData->fButtonDown == ARROW1); if (doubleArrows) { - buttonFrame.OffsetBy(bounds.Height() + 1, 0.0); + buttonFrame.OffsetBy(bounds.Height(), 0.0); _DrawArrowButton(ARROW_RIGHT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW2); - buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1), + buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2)), bounds.top); _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW3); - thumbBG.left += bounds.Height() * 2 + 2; - thumbBG.right -= bounds.Height() * 2 + 2; + thumbBG.left += bounds.Height() * 2; + thumbBG.right -= bounds.Height() * 2; } else { - thumbBG.left += bounds.Height() + 1; - thumbBG.right -= bounds.Height() + 1; + thumbBG.left += bounds.Height(); + thumbBG.right -= bounds.Height(); } buttonFrame.OffsetTo(bounds.right - bounds.Height(), bounds.top); @@ -816,20 +801,20 @@ BScrollBar::Draw(BRect updateRect) enabled, fPrivateData->fButtonDown == ARROW1); if (doubleArrows) { - buttonFrame.OffsetBy(0.0, bounds.Width() + 1); + buttonFrame.OffsetBy(0.0, bounds.Width()); _DrawArrowButton(ARROW_DOWN, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW2); buttonFrame.OffsetTo(bounds.left, bounds.bottom - - ((bounds.Width() * 2) + 1)); + - ((bounds.Width() * 2))); _DrawArrowButton(ARROW_UP, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW3); - thumbBG.top += bounds.Width() * 2 + 2; - thumbBG.bottom -= bounds.Width() * 2 + 2; + thumbBG.top += bounds.Width() * 2; + thumbBG.bottom -= bounds.Width() * 2; } else { - thumbBG.top += bounds.Width() + 1; - thumbBG.bottom -= bounds.Width() + 1; + thumbBG.top += bounds.Width(); + thumbBG.bottom -= bounds.Width(); } buttonFrame.OffsetTo(bounds.left, bounds.bottom - bounds.Width()); @@ -842,210 +827,71 @@ BScrollBar::Draw(BRect updateRect) // background for thumb area BRect rect(fPrivateData->fThumbFrame); - // frame - if (fOrientation == B_HORIZONTAL) { - int32 totalLines = 0; - if (rect.left > thumbBG.left) - totalLines += 1; - if (rect.left > thumbBG.left + 1) - totalLines += 3; - if (rect.right < thumbBG.right - 1) - totalLines += 3; - if (rect.right < thumbBG.right) - totalLines += 1; - - if (totalLines > 0) { - BeginLineArray(totalLines); - if (rect.left > thumbBG.left) { - AddLine(BPoint(thumbBG.left, thumbBG.bottom), - BPoint(thumbBG.left, thumbBG.top), - rect.left > thumbBG.left + 1 ? dark4 : dark); - } - if (rect.left > thumbBG.left + 1) { - AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1), - BPoint(thumbBG.left + 1, thumbBG.bottom), dark2); - AddLine(BPoint(thumbBG.left + 1, thumbBG.top), - BPoint(rect.left - 1, thumbBG.top), dark2); - AddLine(BPoint(rect.left - 1, thumbBG.bottom), - BPoint(thumbBG.left + 2, thumbBG.bottom), normal); - } - - if (rect.right < thumbBG.right - 1) { - AddLine(BPoint(rect.right + 2, thumbBG.top + 1), - BPoint(rect.right + 2, thumbBG.bottom), dark2); - AddLine(BPoint(rect.right + 1, thumbBG.top), - BPoint(thumbBG.right, thumbBG.top), dark2); - AddLine(BPoint(thumbBG.right - 1, thumbBG.bottom), - BPoint(rect.right + 3, thumbBG.bottom), normal); - } - if (rect.right < thumbBG.right) { - AddLine(BPoint(thumbBG.right, thumbBG.top), - BPoint(thumbBG.right, thumbBG.bottom), dark); - } - EndLineArray(); - } - } else { - int32 totalLines = 0; - if (rect.top > thumbBG.top) - totalLines += 1; - if (rect.top > thumbBG.top + 1) - totalLines += 3; - if (rect.bottom < thumbBG.bottom - 1) - totalLines += 3; - if (rect.bottom < thumbBG.bottom) - totalLines += 1; - - if (totalLines > 0) { - BeginLineArray(totalLines); - if (rect.top > thumbBG.top) { - AddLine(BPoint(thumbBG.left, thumbBG.top), - BPoint(thumbBG.right, thumbBG.top), - rect.top > thumbBG.top + 1 ? dark4 : dark); - } - if (rect.top > thumbBG.top + 1) { - AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1), - BPoint(thumbBG.right, thumbBG.top + 1), dark2); - AddLine(BPoint(thumbBG.left, rect.top - 1), - BPoint(thumbBG.left, thumbBG.top + 1), dark2); - AddLine(BPoint(thumbBG.right, rect.top - 1), - BPoint(thumbBG.right, thumbBG.top + 2), normal); - } + // Draw scroll thumb and background area - if (rect.bottom < thumbBG.bottom - 1) { - AddLine(BPoint(thumbBG.left + 1, rect.bottom + 2), - BPoint(thumbBG.right, rect.bottom + 2), dark2); - AddLine(BPoint(thumbBG.left, rect.bottom + 1), - BPoint(thumbBG.left, thumbBG.bottom - 1), dark2); - AddLine(BPoint(thumbBG.right, rect.bottom + 3), - BPoint(thumbBG.right, thumbBG.bottom - 1), normal); - } - if (rect.bottom < thumbBG.bottom) { - AddLine(BPoint(thumbBG.left, thumbBG.bottom), - BPoint(thumbBG.right, thumbBG.bottom), dark); - } - EndLineArray(); - } + rgb_color bgDark, bgLight, thumbDark, thumbLight; + if (enabled) { + bgDark = tint_color(normal, (1.0 + B_DARKEN_1_TINT) / 2); + bgLight = thumbDark = normal; + thumbLight = tint_color(normal, B_LIGHTEN_1_TINT); + } else { + bgDark = normal; + bgLight = thumbDark = tint_color(normal, B_LIGHTEN_1_TINT); + thumbLight = tint_color(normal, B_LIGHTEN_2_TINT); } - SetHighColor(dark1); + BGradientLinear gradient; + gradient.SetStart(thumbBG.LeftTop()); + gradient.AddColor(bgDark, 0); + gradient.AddColor(bgLight, 255); - // Draw scroll thumb - if (enabled) { - // fill and additional dark lines - thumbBG.InsetBy(1.0, 1.0); - if (fOrientation == B_HORIZONTAL) { - BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1, - thumbBG.bottom); - if (leftOfThumb.IsValid()) - FillRect(leftOfThumb); - - BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right, - thumbBG.bottom); - if (rightOfThumb.IsValid()) - FillRect(rightOfThumb); - - // dark lines before and after thumb - if (rect.left > thumbBG.left) { - SetHighColor(dark); - StrokeLine(BPoint(rect.left - 1, rect.top), - BPoint(rect.left - 1, rect.bottom)); - } - if (rect.right < thumbBG.right) { - SetHighColor(dark4); - StrokeLine(BPoint(rect.right + 1, rect.top), - BPoint(rect.right + 1, rect.bottom)); - } - } else { - BRect topOfThumb(thumbBG.left, thumbBG.top + 1, - thumbBG.right, rect.top - 1); - if (topOfThumb.IsValid()) - FillRect(topOfThumb); - - BRect bottomOfThumb(thumbBG.left, rect.bottom + 3, - thumbBG.right, thumbBG.bottom); - if (bottomOfThumb.IsValid()) - FillRect(bottomOfThumb); - - // dark lines before and after thumb - if (rect.top > thumbBG.top) { - SetHighColor(dark); - StrokeLine(BPoint(rect.left, rect.top - 1), - BPoint(rect.right, rect.top - 1)); - } - if (rect.bottom < thumbBG.bottom) { - SetHighColor(dark4); - StrokeLine(BPoint(rect.left, rect.bottom + 1), - BPoint(rect.right, rect.bottom + 1)); + if (fOrientation == B_HORIZONTAL) { + gradient.SetEnd(thumbBG.LeftBottom()); + + BRect leftOfThumb(thumbBG.left, thumbBG.top, rect.left - 1, + thumbBG.bottom); + if (leftOfThumb.IsValid()) + FillRect(leftOfThumb, gradient); + + BRect rightOfThumb(rect.right + 2, thumbBG.top, thumbBG.right, + thumbBG.bottom); + if (rightOfThumb.IsValid()) { + if (rightOfThumb.Width() >= 2.0) { + // thumb shadow + SetHighColor(tint_color(normal, B_DARKEN_1_TINT)); + StrokeLine(rightOfThumb.LeftTop(), rightOfThumb.LeftBottom()); + rightOfThumb.left += 1.0; } + FillRect(rightOfThumb, gradient); } - - BeginLineArray(4); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), light); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right, rect.top), light); - AddLine(BPoint(rect.right, rect.top + 1), - BPoint(rect.right, rect.bottom), dark1); - AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left + 1, rect.bottom), dark1); - EndLineArray(); - - // fill - rect.InsetBy(1.0, 1.0); - /*if (fPrivateData->fButtonDown == THUMB) - SetHighColor(tint_color(normal, (B_NO_TINT + B_DARKEN_1_TINT) / 2)); - else*/ - SetHighColor(normal); - - FillRect(rect); - - // TODO: Add the other thumb styles - dots and lines } else { - if (fMin >= fMax || fProportion >= 1.0 || fProportion < 0.0) { - // we cannot scroll at all - _DrawDisabledBackground(thumbBG, light, dark, dark1); - } else { - // we could scroll, but we're simply disabled - float bgTint = 1.06; - rgb_color bgLight = tint_color(light, bgTint * 3); - rgb_color bgShadow = tint_color(dark, bgTint); - rgb_color bgFill = tint_color(dark1, bgTint); - if (fOrientation == B_HORIZONTAL) { - // left of thumb - BRect besidesThumb(thumbBG); - besidesThumb.right = rect.left - 1; - _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); - // right of thumb - besidesThumb.left = rect.right + 1; - besidesThumb.right = thumbBG.right; - _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); - } else { - // above thumb - BRect besidesThumb(thumbBG); - besidesThumb.bottom = rect.top - 1; - _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); - // below thumb - besidesThumb.top = rect.bottom + 1; - besidesThumb.bottom = thumbBG.bottom; - _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); + gradient.SetEnd(thumbBG.RightTop()); + + BRect topOfThumb(thumbBG.left, thumbBG.top, + thumbBG.right, rect.top - 1); + if (topOfThumb.IsValid()) + FillRect(topOfThumb, gradient); + + BRect bottomOfThumb(thumbBG.left, rect.bottom + 2, + thumbBG.right, thumbBG.bottom); + if (bottomOfThumb.IsValid()) { + if (bottomOfThumb.Height() >= 2.0) { + // thumb shadow + SetHighColor(tint_color(normal, B_DARKEN_1_TINT)); + StrokeLine(bottomOfThumb.LeftTop(), bottomOfThumb.RightTop()); + bottomOfThumb.top += 1.0; } - // thumb bevel - BeginLineArray(4); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), light); - AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right, rect.top), light); - AddLine(BPoint(rect.right, rect.top + 1), - BPoint(rect.right, rect.bottom), dark2); - AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left + 1, rect.bottom), dark2); - EndLineArray(); - // thumb fill - rect.InsetBy(1.0, 1.0); - SetHighColor(dark1); - FillRect(rect); + FillRect(bottomOfThumb, gradient); } } + + gradient.SetColor(0, thumbLight); + gradient.SetColor(1, thumbDark); + FillRect(rect, gradient); + + SetHighColor(tint_color(normal, B_DARKEN_2_TINT)); + rect.InsetBy(-1.0, -1.0); + StrokeRect(rect); } @@ -1636,42 +1482,42 @@ BScrollBar::_DrawArrowButton(int32 direc if (!updateRect.Intersects(r)) return; - rgb_color c = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color light, dark, darker, normal, arrow; + rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color dark, light, arrow; if (down && fPrivateData->fDoRepeat) { - light = tint_color(c, (B_DARKEN_1_TINT + B_DARKEN_2_TINT) / 2.0); - dark = darker = c; - normal = tint_color(c, B_DARKEN_1_TINT); - arrow = tint_color(c, B_DARKEN_MAX_TINT); - + dark = tint_color(normal, B_DARKEN_1_TINT); + light = normal; + arrow = tint_color(normal, B_DARKEN_MAX_TINT); } else { - // Add a usability perk - disable buttons if they would not do anything - // - like a left arrow if the value == fMin -// NOTE: disabled because of too much visual noise/distraction -/* if ((direction == ARROW_LEFT || direction == ARROW_UP) - && (fValue == fMin)) { - use_enabled_colors = false; - } else if ((direction == ARROW_RIGHT || direction == ARROW_DOWN) - && (fValue == fMax)) { - use_enabled_colors = false; - }*/ - if (enabled) { - light = tint_color(c, B_LIGHTEN_MAX_TINT); - dark = tint_color(c, B_DARKEN_1_TINT); - darker = tint_color(c, B_DARKEN_2_TINT); - normal = c; - arrow = tint_color(c, (B_DARKEN_MAX_TINT + B_DARKEN_4_TINT) / 2.0); + dark = normal; + light = tint_color(normal, B_LIGHTEN_1_TINT); + arrow = tint_color(normal, (B_DARKEN_MAX_TINT + B_DARKEN_4_TINT) / 2.0); } else { - light = tint_color(c, B_LIGHTEN_MAX_TINT); - dark = tint_color(c, B_LIGHTEN_1_TINT); - darker = tint_color(c, B_DARKEN_2_TINT); - normal = tint_color(c, B_LIGHTEN_2_TINT); - arrow = tint_color(c, B_DARKEN_1_TINT); + dark = tint_color(normal, B_LIGHTEN_1_TINT); + light = tint_color(normal, B_LIGHTEN_2_TINT); + arrow = tint_color(normal, B_DARKEN_1_TINT); } } + // draw button frame + SetHighColor(tint_color(normal, B_DARKEN_2_TINT)); + StrokeRect(r); + r.InsetBy(1.0, 1.0); + + BGradientLinear gradient; + gradient.SetStart(r.LeftTop()); + gradient.AddColor(light, 0); + gradient.AddColor(dark, 255); + + if (fOrientation == B_HORIZONTAL) + gradient.SetEnd(r.LeftBottom()); + else + gradient.SetEnd(r.RightTop()); + + FillRect(r, gradient); + BPoint tri1, tri2, tri3; float hInset = r.Width() / 3; float vInset = r.Height() / 3; @@ -1707,10 +1553,6 @@ BScrollBar::_DrawArrowButton(int32 direc tri3 = tri3 + offset; } - r.InsetBy(-(hInset - 1), -(vInset - 1)); - SetHighColor(normal); - FillRect(r); - BShape arrowShape; arrowShape.MoveTo(tri1); arrowShape.LineTo(tri2); @@ -1720,49 +1562,6 @@ BScrollBar::_DrawArrowButton(int32 direc SetPenSize(ceilf(hInset / 2.0)); StrokeShape(&arrowShape); SetPenSize(1.0); - - r.InsetBy(-1, -1); - BeginLineArray(4); - if (direction == ARROW_LEFT || direction == ARROW_RIGHT) { - // horizontal - if (doubleArrows && direction == ARROW_LEFT) { - // draw in such a way that the arrows are - // more visually separated - AddLine(BPoint(r.left + 1, r.top), - BPoint(r.right - 1, r.top), light); - AddLine(BPoint(r.right, r.top), - BPoint(r.right, r.bottom), darker); - } else { - AddLine(BPoint(r.left + 1, r.top), - BPoint(r.right, r.top), light); - AddLine(BPoint(r.right, r.top + 1), - BPoint(r.right, r.bottom), dark); - } - AddLine(BPoint(r.left, r.bottom), - BPoint(r.left, r.top), light); - AddLine(BPoint(r.right - 1, r.bottom), - BPoint(r.left + 1, r.bottom), dark); - } else { - // vertical - if (doubleArrows && direction == ARROW_UP) { - // draw in such a way that the arrows are - // more visually separated - AddLine(BPoint(r.left, r.bottom - 1), - BPoint(r.left, r.top), light); - AddLine(BPoint(r.right, r.bottom), - BPoint(r.left, r.bottom), darker); - } else { - AddLine(BPoint(r.left, r.bottom), - BPoint(r.left, r.top), light); - AddLine(BPoint(r.right, r.bottom), - BPoint(r.left + 1, r.bottom), dark); - } - AddLine(BPoint(r.left + 1, r.top), - BPoint(r.right, r.top), light); - AddLine(BPoint(r.right, r.top + 1), - BPoint(r.right, r.bottom - 1), dark); - } - EndLineArray(); } Index: src/kits/interface/TextControl.cpp =================================================================== --- src/kits/interface/TextControl.cpp (revision 29046) +++ src/kits/interface/TextControl.cpp (working copy) @@ -325,7 +325,7 @@ BTextControl::Draw(BRect updateRect) rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT); rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); - bool enabled = IsEnabled(); + //bool enabled = IsEnabled(); bool active = false; if (fText->IsFocus() && Window()->IsActive()) @@ -336,42 +336,15 @@ BTextControl::Draw(BRect updateRect) BRect rect = fText->Frame(); rect.InsetBy(-2, -2); - if (enabled) - SetHighColor(darken1); - else - SetHighColor(noTint); - - StrokeLine(rect.LeftBottom(), rect.LeftTop()); - StrokeLine(rect.RightTop()); - - if (enabled) - SetHighColor(lighten2); - else - SetHighColor(lighten1); + SetHighColor(darken2); + StrokeRect(rect); - StrokeLine(BPoint(rect.left + 1.0f, rect.bottom), rect.RightBottom()); - StrokeLine(BPoint(rect.right, rect.top + 1.0f), rect.RightBottom()); - - // inner bevel - - rect.InsetBy(1.0f, 1.0f); - - if (active) { - SetHighColor(navigationColor); - StrokeRect(rect); - } else { - if (enabled) - SetHighColor(darken4); - else - SetHighColor(darken2); - - StrokeLine(rect.LeftTop(), rect.LeftBottom()); - StrokeLine(rect.LeftTop(), rect.RightTop()); - - SetHighColor(noTint); - StrokeLine(BPoint(rect.left + 1.0f, rect.bottom), rect.RightBottom()); - StrokeLine(BPoint(rect.right, rect.top + 1.0f)); - } + rect.InsetBy(1, 1); + SetHighColor(fText->ViewColor()); + StrokeRect(rect); + SetHighColor(noTint); + StrokeLine(rect.LeftTop(), rect.RightTop()); + StrokeLine(rect.LeftTop(), rect.LeftBottom()); // label Index: src/kits/interface/MenuWindow.cpp =================================================================== --- src/kits/interface/MenuWindow.cpp (revision 29046) +++ src/kits/interface/MenuWindow.cpp (working copy) @@ -206,18 +206,10 @@ BMenuFrame::Draw(BRect updateRect) font_height height; GetFontHeight(&height); - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT)); + SetHighColor(tint_color(ui_color(B_PANEL_TEXT_COLOR), B_DISABLED_LABEL_TINT)); BPoint where((Bounds().Width() - fMenu->StringWidth(kEmptyMenuLabel)) / 2, ceilf(height.ascent + 1)); DrawString(kEmptyMenuLabel, where); } - - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT)); - BRect bounds(Bounds()); - - StrokeLine(BPoint(bounds.right, bounds.top), - BPoint(bounds.right, bounds.bottom - 1)); - StrokeLine(BPoint(bounds.left + 1, bounds.bottom), - BPoint(bounds.right, bounds.bottom)); } Index: src/kits/interface/CheckBox.cpp =================================================================== --- src/kits/interface/CheckBox.cpp (revision 29046) +++ src/kits/interface/CheckBox.cpp (working copy) @@ -135,35 +135,30 @@ BCheckBox::Draw(BRect updateRect) EndLineArray(); } else { - BeginLineArray(6); + SetHighColor(darken2); + StrokeRect(rect); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), darken1); - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.top), darken1); - rect.InsetBy(1, 1); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), darken4); - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.top), darken4); - AddLine(BPoint(rect.left + 1.0f, rect.bottom), - BPoint(rect.right, rect.bottom), noTint); - AddLine(BPoint(rect.right, rect.bottom), - BPoint(rect.right, rect.top + 1.0f), noTint); - - EndLineArray(); + SetHighColor(noTint); + StrokeLine(BPoint(rect.left + 1, rect.top + 1), + BPoint(rect.right - 1, rect.top + 1)); + StrokeLine(BPoint(rect.left + 1, rect.top + 1), + BPoint(rect.left + 1, rect.bottom - 1)); } // Checkmark if (Value() == B_CONTROL_ON) { rect.InsetBy(3, 3); - SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR)); + rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); SetPenSize(2); - StrokeLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.bottom)); - StrokeLine(BPoint(rect.left, rect.bottom), - BPoint(rect.right, rect.top)); + BeginLineArray(2); + AddLine(BPoint(rect.left, (rect.top + rect.bottom) / 2), + BPoint((rect.left + rect.right) / 2, rect.bottom), + markColor); + AddLine(BPoint((rect.left + rect.right) / 2, rect.bottom), + BPoint(rect.right, rect.top), + markColor); + EndLineArray(); SetPenSize(1); } @@ -186,40 +181,35 @@ BCheckBox::Draw(BRect updateRect) FillRect(rect); // Box - BeginLineArray(6); - - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), noTint); - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.top), noTint); - rect.InsetBy(1, 1); - AddLine(BPoint(rect.left, rect.bottom), - BPoint(rect.left, rect.top), darken2); - AddLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.top), darken2); - AddLine(BPoint(rect.left + 1.0f, rect.bottom), - BPoint(rect.right, rect.bottom), darken1); - AddLine(BPoint(rect.right, rect.bottom), - BPoint(rect.right, rect.top + 1.0f), darken1); + SetHighColor(darken2); + StrokeRect(rect); - EndLineArray(); + SetHighColor(noTint); + StrokeLine(BPoint(rect.left + 1, rect.top + 1), + BPoint(rect.right - 1, rect.top + 1)); + StrokeLine(BPoint(rect.left + 1, rect.top + 1), + BPoint(rect.left + 1, rect.bottom - 1)); // Checkmark if (Value() == B_CONTROL_ON) { rect.InsetBy(3, 3); - SetHighColor(tint_color(ui_color(B_KEYBOARD_NAVIGATION_COLOR), - B_DISABLED_MARK_TINT)); + rgb_color markColor = tint_color(ui_color(B_KEYBOARD_NAVIGATION_COLOR), + B_DISABLED_MARK_TINT); SetPenSize(2); - StrokeLine(BPoint(rect.left, rect.top), - BPoint(rect.right, rect.bottom)); - StrokeLine(BPoint(rect.left, rect.bottom), - BPoint(rect.right, rect.top)); + BeginLineArray(2); + AddLine(BPoint(rect.left, (rect.top + rect.bottom) / 2), + BPoint((rect.left + rect.right) / 2, rect.bottom), + markColor); + AddLine(BPoint((rect.left + rect.right) / 2, rect.bottom), + BPoint(rect.right, rect.top), + markColor); + EndLineArray(); SetPenSize(1); } // Label - SetHighColor(tint_color(noTint, B_DISABLED_LABEL_TINT)); + SetHighColor(tint_color(darkenmax, B_DISABLED_LABEL_TINT)); DrawString(Label(), BPoint((float)ceil(10.0f + fontHeight.ascent), 3.0f + (float)ceil(fontHeight.ascent))); } @@ -551,8 +541,10 @@ BCheckBox::_CheckBoxFrame() const font_height fontHeight; GetFontHeight(&fontHeight); - return BRect(1.0f, 3.0f, ceilf(3.0f + fontHeight.ascent), + BRect rect(1.0f, 3.0f, ceilf(3.0f + fontHeight.ascent), ceilf(5.0f + fontHeight.ascent)); + rect.InsetBy(1, 1); + return rect; } Index: src/kits/interface/RadioButton.cpp =================================================================== --- src/kits/interface/RadioButton.cpp (revision 29046) +++ src/kits/interface/RadioButton.cpp (working copy) @@ -113,83 +113,58 @@ BRadioButton::Draw(BRect updateRect) // colors rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color lightenmax; - rgb_color lighten1; - rgb_color darken1; rgb_color darken2; rgb_color darken3; rgb_color darkenmax; rgb_color naviColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); rgb_color knob; - rgb_color knobDark; - rgb_color knobLight; if (IsEnabled()) { lightenmax = tint_color(bg, B_LIGHTEN_MAX_TINT); - lighten1 = tint_color(bg, B_LIGHTEN_1_TINT); - darken1 = tint_color(bg, B_DARKEN_1_TINT); darken2 = tint_color(bg, B_DARKEN_2_TINT); darken3 = tint_color(bg, B_DARKEN_3_TINT); darkenmax = tint_color(bg, B_DARKEN_MAX_TINT); knob = naviColor; - knobDark = tint_color(naviColor, B_DARKEN_3_TINT); - knobLight = tint_color(naviColor, 0.15); } else { lightenmax = tint_color(bg, B_LIGHTEN_2_TINT); - lighten1 = bg; - darken1 = bg; darken2 = tint_color(bg, B_DARKEN_1_TINT); darken3 = tint_color(bg, B_DARKEN_2_TINT); - darkenmax = tint_color(bg, B_DISABLED_LABEL_TINT); + darkenmax = tint_color(ui_color(B_PANEL_TEXT_COLOR), B_DISABLED_LABEL_TINT); knob = tint_color(naviColor, B_LIGHTEN_2_TINT); - knobDark = tint_color(naviColor, B_LIGHTEN_1_TINT); - knobLight = tint_color(naviColor, (B_LIGHTEN_2_TINT - + B_LIGHTEN_MAX_TINT) / 2.0); } // dot if (Value() == B_CONTROL_ON) { // full - SetHighColor(knobDark); + SetHighColor(lightenmax); FillEllipse(rect); SetHighColor(knob); - FillEllipse(BRect(rect.left + 2, rect.top + 2, rect.right - 3, - rect.bottom - 3)); - - SetHighColor(knobLight); - FillEllipse(BRect(rect.left + 3, rect.top + 3, rect.right - 5, - rect.bottom - 5)); + FillEllipse(rect.InsetByCopy(2, 2)); } else { // empty SetHighColor(lightenmax); FillEllipse(rect); } - rect.InsetBy(-1.0, -1.0); + rect.InsetBy(-1, -1); - // outer circle + // circle if (fOutlined) { // indicating "about to change value" SetHighColor(darken3); StrokeEllipse(rect); + rect.InsetBy(1, 1); + StrokeEllipse(rect); } else { - SetHighColor(darken1); - StrokeArc(rect, 45.0, 180.0); - SetHighColor(lightenmax); - StrokeArc(rect, 45.0, -180.0); + SetHighColor(darken2); + StrokeEllipse(rect); + rect.InsetBy(1, 1); } - rect.InsetBy(1, 1); - - // inner circle - SetHighColor(darken3); - StrokeArc(rect, 45.0, 180.0); - SetHighColor(bg); - StrokeArc(rect, 45.0, -180.0); - // for faster font rendering, we can restore B_OP_COPY SetDrawingMode(B_OP_COPY); Index: src/kits/interface/InterfaceDefs.cpp =================================================================== --- src/kits/interface/InterfaceDefs.cpp (revision 29046) +++ src/kits/interface/InterfaceDefs.cpp (working copy) @@ -62,14 +62,14 @@ menu_info *_menu_info_ptr_; extern "C" const char B_NOTIFICATION_SENDER[] = "be:sender"; static const rgb_color _kDefaultColors[kNumColors] = { - {216, 216, 216, 255}, // B_PANEL_BACKGROUND_COLOR - {216, 216, 216, 255}, // B_MENU_BACKGROUND_COLOR + {226, 226, 226, 255}, // B_PANEL_BACKGROUND_COLOR + {234, 234, 234, 255}, // B_MENU_BACKGROUND_COLOR {255, 203, 0, 255}, // B_WINDOW_TAB_COLOR - {0, 0, 229, 255}, // B_KEYBOARD_NAVIGATION_COLOR + {96, 148, 202, 255}, // B_KEYBOARD_NAVIGATION_COLOR {51, 102, 152, 255}, // B_DESKTOP_COLOR - {153, 153, 153, 255}, // B_MENU_SELECTED_BACKGROUND_COLOR + {96, 148, 202, 255}, // B_MENU_SELECTED_BACKGROUND_COLOR {0, 0, 0, 255}, // B_MENU_ITEM_TEXT_COLOR - {0, 0, 0, 255}, // B_MENU_SELECTED_ITEM_TEXT_COLOR + {255, 255, 255, 255}, // B_MENU_SELECTED_ITEM_TEXT_COLOR {0, 0, 0, 255}, // B_MENU_SELECTED_BORDER_COLOR {0, 0, 0, 255}, // B_PANEL_TEXT_COLOR {255, 255, 255, 255}, // B_DOCUMENT_BACKGROUND_COLOR Index: src/kits/interface/TabView.cpp =================================================================== --- src/kits/interface/TabView.cpp (revision 29046) +++ src/kits/interface/TabView.cpp (working copy) @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -262,66 +263,60 @@ BTab::DrawLabel(BView *owner, BRect fram void BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full) { - rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT); - rgb_color darken2 = tint_color(no_tint, B_DARKEN_2_TINT); - rgb_color darken3 = tint_color(no_tint, B_DARKEN_3_TINT); - rgb_color darken4 = tint_color(no_tint, B_DARKEN_4_TINT); - rgb_color darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT); - - owner->SetHighColor(darkenmax); - owner->SetLowColor(no_tint); - // NOTE: "frame" goes from the beginning of the left slope to the beginning - // of the right slope - "lableFrame" is the frame between both slopes - BRect lableFrame = frame; - lableFrame.left = lableFrame.left + frame.Height() / 2.0; - DrawLabel(owner, lableFrame); + rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color border = tint_color(noTint, B_DARKEN_2_TINT); + rgb_color lightBorder = tint_color(noTint, B_LIGHTEN_2_TINT); + rgb_color bgStart; + rgb_color bgEnd; + + if (position == B_TAB_FRONT) { + bgStart = tint_color(noTint, B_LIGHTEN_1_TINT); + bgEnd = noTint; + } else { + bgStart = noTint; + bgEnd = tint_color(noTint, (1.0 + B_DARKEN_1_TINT) / 2); + } - owner->SetDrawingMode(B_OP_OVER); + if (position != B_TAB_FRONT) + frame.top += 2; - owner->BeginLineArray(12); + owner->BeginLineArray(6); - int32 slopeWidth = (int32)ceilf(frame.Height() / 2.0); + // Outer border + owner->AddLine(BPoint(frame.left, frame.bottom), + BPoint(frame.left, frame.top), + border); + owner->AddLine(BPoint(frame.left, frame.top), + BPoint(frame.right, frame.top), + border); + owner->AddLine(BPoint(frame.right, frame.top), + BPoint(frame.right, frame.bottom), + border); + + frame.InsetBy(1, 1); + + // Inner border + owner->AddLine(BPoint(frame.left, frame.bottom), + BPoint(frame.left, frame.top), + (position == B_TAB_FRONT) ? lightBorder : noTint); + owner->AddLine(BPoint(frame.left, frame.top), + BPoint(frame.right, frame.top), + (position == B_TAB_FRONT) ? lightBorder : noTint); + owner->AddLine(BPoint(frame.right, frame.top), + BPoint(frame.right, frame.bottom), + (position == B_TAB_FRONT) ? lightBorder : noTint); - if (position != B_TAB_ANY) { - // full height left side - owner->AddLine(BPoint(frame.left, frame.bottom), - BPoint(frame.left + slopeWidth, frame.top), darken3); - owner->AddLine(BPoint(frame.left, frame.bottom + 1), - BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax); - } else { - // upper half of left side - owner->AddLine(BPoint(frame.left + slopeWidth / 2, - frame.bottom - slopeWidth), - BPoint(frame.left + slopeWidth, frame.top), darken3); - owner->AddLine(BPoint(frame.left + slopeWidth / 2 + 2, - frame.bottom - slopeWidth - 1), - BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax); - } + owner->EndLineArray(); - // lines along the top - owner->AddLine(BPoint(frame.left + slopeWidth, frame.top), - BPoint(frame.right, frame.top), darken3); - owner->AddLine(BPoint(frame.left + slopeWidth, frame.top + 1), - BPoint(frame.right, frame.top + 1), lightenmax); - - if (full) { - // full height right side - owner->AddLine(BPoint(frame.right, frame.top), - BPoint(frame.right + slopeWidth + 2, frame.bottom), darken2); - owner->AddLine(BPoint(frame.right, frame.top + 1), - BPoint(frame.right + slopeWidth + 1, frame.bottom), darken4); - } else { - // upper half of right side - owner->AddLine(BPoint(frame.right, frame.top), - BPoint(frame.right + slopeWidth / 2 + 1, - frame.bottom - slopeWidth), darken2); - owner->AddLine(BPoint(frame.right, frame.top + 1), - BPoint(frame.right + slopeWidth / 2, - frame.bottom - slopeWidth), darken4); - } + frame.InsetBy(1, 1); - owner->EndLineArray(); + BGradientLinear bg(frame.LeftTop(), frame.LeftBottom()); + bg.AddColor(bgStart, 0); + bg.AddColor(bgEnd, 255); + owner->FillRect(frame, bg); + + owner->SetDrawingMode(B_OP_OVER); + DrawLabel(owner, frame); } @@ -809,57 +804,54 @@ void BTabView::DrawBox(BRect selTabRect) { BRect rect = Bounds(); - BRect lastTabRect = TabFrame(CountTabs() - 1); rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color lightenMax = tint_color(noTint, B_LIGHTEN_MAX_TINT); + rgb_color lighten2 = tint_color(noTint, B_LIGHTEN_2_TINT); rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT); rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT); rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT); BeginLineArray(12); - int32 offset = (int32)ceilf(selTabRect.Height() / 2.0); - // outer lines - AddLine(BPoint(rect.left, rect.bottom - 1), + AddLine(BPoint(rect.left, rect.bottom - 2), BPoint(rect.left, selTabRect.bottom), darken2); if (selTabRect.left >= rect.left + 1) AddLine(BPoint(rect.left + 1, selTabRect.bottom), BPoint(selTabRect.left, selTabRect.bottom), darken2); - if (lastTabRect.right + offset + 1 <= rect.right - 1) - AddLine(BPoint(lastTabRect.right + offset + 1, selTabRect.bottom), - BPoint(rect.right - 1, selTabRect.bottom), darken2); + if (selTabRect.right + 1 <= rect.right - 1) + AddLine(BPoint(selTabRect.right + 1, selTabRect.bottom), + BPoint(rect.right - 2, selTabRect.bottom), darken2); AddLine(BPoint(rect.right, selTabRect.bottom + 2), BPoint(rect.right, rect.bottom), darken2); AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left + 2, rect.bottom), darken2); + BPoint(rect.left + 1, rect.bottom), darken2); // inner lines rect.InsetBy(1, 1); selTabRect.bottom += 1; AddLine(BPoint(rect.left, rect.bottom - 2), - BPoint(rect.left, selTabRect.bottom), lightenMax); + BPoint(rect.left, selTabRect.bottom), lighten2); if (selTabRect.left >= rect.left + 1) AddLine(BPoint(rect.left + 1, selTabRect.bottom), - BPoint(selTabRect.left, selTabRect.bottom), lightenMax); - if (selTabRect.right + offset + 1 <= rect.right - 2) - AddLine(BPoint(selTabRect.right + offset + 1, selTabRect.bottom), - BPoint(rect.right - 2, selTabRect.bottom), lightenMax); - AddLine(BPoint(rect.right, selTabRect.bottom), + BPoint(selTabRect.left, selTabRect.bottom), lighten2); + if (selTabRect.right + 1 <= rect.right - 2) + AddLine(BPoint(selTabRect.right + 1, selTabRect.bottom), + BPoint(rect.right - 2, selTabRect.bottom), lighten2); + AddLine(BPoint(rect.right, selTabRect.bottom - 1), BPoint(rect.right, rect.bottom), darken4); AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left, rect.bottom), darken4); + BPoint(rect.left - 1, rect.bottom), darken4); // soft inner bevel at right/bottom rect.right--; rect.bottom--; AddLine(BPoint(rect.right, selTabRect.bottom + 1), - BPoint(rect.right, rect.bottom), darken1); + BPoint(rect.right, rect.bottom), lighten2); AddLine(BPoint(rect.right - 1, rect.bottom), - BPoint(rect.left + 1, rect.bottom), darken1); + BPoint(rect.left + 1, rect.bottom), lighten2); EndLineArray(); } @@ -1128,7 +1120,7 @@ BTabView::ViewForTab(int32 tabIndex) con void BTabView::_InitObject(bool layouted, button_width width) { - SetFont(be_bold_font); + //SetFont(be_bold_font); fTabList = new BList; Index: src/kits/interface/Menu.cpp =================================================================== --- src/kits/interface/Menu.cpp (revision 29046) +++ src/kits/interface/Menu.cpp (working copy) @@ -926,6 +926,7 @@ BMenu::Draw(BRect updateRect) return; } + DrawBackground(updateRect); _DrawItems(updateRect); } @@ -1410,12 +1411,6 @@ BMenu::_Show(bool selectFirstItem) return false; } - // Move the BMenu to 1, 1, if it's attached to a BMenuWindow, - // (that means it's a BMenu, BMenuBars are attached to regular BWindows). - // This is needed to be able to draw the frame around the BMenu. - if (dynamic_cast(window) != NULL) - MoveTo(1, 1); - _UpdateWindowViewSize(true); window->Show(); @@ -2584,19 +2579,19 @@ BMenu::_UpdateWindowViewSize(bool update if (fItems.CountItems() > 0) { if (!scroll) { - window->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2); + window->ResizeTo(Bounds().Width(), Bounds().Height()); } else { BScreen screen(window); // If we need scrolling, resize the window to fit the screen and // attach scrollers to our cached BMenuWindow. if (dynamic_cast(Supermenu()) == NULL) { - window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom); + window->ResizeTo(Bounds().Width(), screen.Frame().bottom); frame.top = 0; } else { // Or, in case our parent was a BMenuBar enable scrolling with // normal size. - window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom + window->ResizeTo(Bounds().Width(), screen.Frame().bottom - frame.top); } Index: src/kits/interface/ColorControl.cpp =================================================================== --- src/kits/interface/ColorControl.cpp (revision 29046) +++ src/kits/interface/ColorControl.cpp (working copy) @@ -425,33 +425,14 @@ BColorControl::_DrawColorArea(BView* tar bool enabled = IsEnabled(); - // First bevel - if (enabled) - target->SetHighColor(darken1); - else - target->SetHighColor(noTint); - target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); - target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); - if (enabled) - target->SetHighColor(lightenmax); - else - target->SetHighColor(lighten1); - target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom()); - target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f)); - - bevelRect.InsetBy(1.0f, 1.0f); - - // Second bevel - if (enabled) - target->SetHighColor(darken4); - else - target->SetHighColor(darken2); - target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); - target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); + // Bevel + target->SetHighColor(darken2); + target->StrokeRect(bevelRect); + + bevelRect.InsetBy(1.0, 1.0); target->SetHighColor(noTint); - target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom()); - target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f)); - + target->StrokeRect(bevelRect); + if (fPaletteMode) { int colBegin = max_c(0, -1 + int(update.left) / int(fCellSize)); int colEnd = min_c(fColumns, 2 + int(update.right) / int(fCellSize)); Index: src/kits/interface/SeparatorItem.cpp =================================================================== --- src/kits/interface/SeparatorItem.cpp (revision 29046) +++ src/kits/interface/SeparatorItem.cpp (working copy) @@ -85,9 +85,6 @@ BSeparatorItem::Draw() rgb_color lowColor = menu->LowColor(); menu->SetHighColor(tint_color(lowColor, B_DARKEN_1_TINT)); - menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f), - BPoint(bounds.right - 1.0f, bounds.top + 4.0f)); - menu->SetHighColor(tint_color(lowColor, B_LIGHTEN_2_TINT)); menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f), BPoint(bounds.right - 1.0f, bounds.top + 5.0f)); Index: src/kits/interface/MenuItem.cpp =================================================================== --- src/kits/interface/MenuItem.cpp (revision 29046) +++ src/kits/interface/MenuItem.cpp (working copy) @@ -16,6 +16,8 @@ #include #include +#include +#include #include #include #include @@ -481,24 +483,42 @@ BMenuItem::Draw() // rgb_color noTint = ui_color(B_MENU_BACKGROUND_COLOR); // TODO: the above is currently broken, because ui_color is // not informed of changes to the app_server palette yet - rgb_color noTint = fSuper->LowColor(); + rgb_color noTint = ui_color(B_MENU_BACKGROUND_COLOR); rgb_color bgColor = noTint; + rgb_color textColor = ui_color(B_MENU_ITEM_TEXT_COLOR); // set low color and fill background if selected if (selected && (enabled || Submenu()) /*&& fSuper->fRedrawAfterSticky*/) { -// bgColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR); + bgColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR); // see above - bgColor = tint_color(bgColor, B_DARKEN_3_TINT); - fSuper->SetLowColor(bgColor); - fSuper->FillRect(Frame(), B_SOLID_LOW); - } else - fSuper->SetLowColor(bgColor); +// bgColor = tint_color(bgColor, B_DARKEN_3_TINT); + + BGradientLinear gradient(Frame().LeftTop(), Frame().LeftBottom()); + gradient.AddColor(tint_color(bgColor, B_LIGHTEN_1_TINT), 0); + gradient.AddColor(bgColor, 255); + fSuper->FillRect(Frame(), gradient); + + fSuper->SetHighColor(tint_color(bgColor, B_DARKEN_2_TINT)); + + if (dynamic_cast(fSuper) != NULL) { + fSuper->StrokeRect(Frame()); + } else { + fSuper->StrokeLine(Frame().LeftTop(), Frame().RightTop()); + fSuper->StrokeLine(Frame().LeftBottom(), Frame().RightBottom()); + } + + fSuper->SetDrawingMode(B_OP_OVER); + } // set high color - if (enabled) - fSuper->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); + if (enabled) { + if (selected) + fSuper->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR)); + else + fSuper->SetHighColor(textColor); + } else - fSuper->SetHighColor(tint_color(bgColor, B_DISABLED_LABEL_TINT)); + fSuper->SetHighColor(tint_color(textColor, B_DISABLED_LABEL_TINT)); // draw content fSuper->MovePenTo(ContentLocation()); Index: src/kits/interface/MenuBar.cpp =================================================================== --- src/kits/interface/MenuBar.cpp (revision 29046) +++ src/kits/interface/MenuBar.cpp (working copy) @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -151,21 +152,20 @@ BMenuBar::Draw(BRect updateRect) // TODO: implement additional border styles rgb_color color = HighColor(); - BRect bounds(Bounds()); - // Restore the background of the previously selected menuitem - DrawBackground(bounds & updateRect); rgb_color noTint = LowColor(); + // Restore the background of the previously selected menuitem + BGradientLinear gradient(bounds.LeftTop(), bounds.LeftBottom()); + gradient.AddColor(tint_color(noTint, B_LIGHTEN_1_TINT), 0); + gradient.AddColor(noTint, 255); + FillRect(bounds & updateRect, gradient); + SetHighColor(tint_color(noTint, B_LIGHTEN_2_TINT)); StrokeLine(BPoint(0.0f, bounds.bottom - 2.0f), BPoint(0.0f, 0.0f)); StrokeLine(BPoint(bounds.right, 0.0f)); - SetHighColor(tint_color(noTint, B_DARKEN_1_TINT)); - StrokeLine(BPoint(1.0f, bounds.bottom - 1.0f), - BPoint(bounds.right, bounds.bottom - 1.0f)); - SetHighColor(tint_color(noTint, B_DARKEN_2_TINT)); StrokeLine(BPoint(0.0f, bounds.bottom), BPoint(bounds.right, bounds.bottom)); StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom));