[haiku-commits] haiku: hrev50163 - src/kits/interface

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 24 Mar 2016 00:23:36 +0100 (CET)

hrev50163 adds 7 changesets to branch 'master'
old head: 846a5b0272281bbcf83b328f55aca9f3a02b5193
new head: 6a8276c4643accc4b70cbb80de2df6c978f2d231
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=6a8276c4643a+%5E846a5b027228

----------------------------------------------------------------------------

59e1b2f4cee6: BMenuField: Change label to panel text color
  
  ...instead of menu item text color when the label is unselected.
  
  Menu item text color seems to make sense when the control is unselected
  because we use selected menu item text color when the control is
  selected, but, this isn't the case. We color the label background using
  the menu item color because we are reproducing similar behavior of
  BeOS R5. However, when the menu field is unselected the label needs to
  draw so that it goes on the panel bg color.

5b2aa7f8562e: ControlLook: style changes only
  
  whitespace
  indent fix (tiny)

8b902d940af2: IK: Use panel text color for select control labels
  
  NOTE: This should have no effect on the colors of these labels unless
  you have changed the panel text color and control text colors to be
  different. Both are black by default.
  
  In the case of the menu field, spinner, check box, radio button,
  slider, and text control labels we want to draw these labels using
  the panel text color instead of the control text color because they
  are drawn on top of the panel color. (the menu field label color was
  changed in a previous commit in this push).
  
  In all cases except the menu field the label color is specified by
  temporarily unsetting the B_IS_CONTROL flag while drawing the label.
  All use control look to draw the label.
  
  The control text color is meant to be used for text INSIDE the control,
  not the label text that accompanies the control -- at least that's the
  way I understand it.

5f6a4730cb4a: Appearance: Live update antialiasing text color
  
  ...when panel text color changes in addition to panel bg color.

8be1a5f08294: Slider: Style fixes
  
  Pointer style
  Newlines
  Indentation
  Compare against NULL or 0 explicitly
  use single floating point precision for float literals (i.e. use 0.0f)

8e7b383abfc1: Slider: Replace min_c and max_c with std::min and std::max

6a8276c4643a: BSlider: Remove non be_control_look drawing code

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

9 files changed, 210 insertions(+), 618 deletions(-)
headers/os/interface/Slider.h                    |   2 +-
src/kits/interface/AbstractSpinner.cpp           |   8 +-
src/kits/interface/CheckBox.cpp                  |   4 +
src/kits/interface/ControlLook.cpp               |  14 +-
src/kits/interface/MenuField.cpp                 |   2 +-
src/kits/interface/RadioButton.cpp               |   4 +
src/kits/interface/Slider.cpp                    | 786 +++++--------------
src/kits/interface/TextControl.cpp               |   4 +
.../appearance/AntialiasingSettingsView.cpp      |   4 +-

############################################################################

Commit:      59e1b2f4cee698cf58d6610c62880512ebd755db
URL:         http://cgit.haiku-os.org/haiku/commit/?id=59e1b2f4cee6
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 16:29:19 2016 UTC

BMenuField: Change label to panel text color

...instead of menu item text color when the label is unselected.

Menu item text color seems to make sense when the control is unselected
because we use selected menu item text color when the control is
selected, but, this isn't the case. We color the label background using
the menu item color because we are reproducing similar behavior of
BeOS R5. However, when the menu field is unselected the label needs to
draw so that it goes on the panel bg color.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp
index 62aa993..ae3812f 100644
--- a/src/kits/interface/MenuField.cpp
+++ b/src/kits/interface/MenuField.cpp
@@ -1089,7 +1089,7 @@ BMenuField::_DrawLabel(BRect updateRect)
                FillRect(fillRect, B_SOLID_LOW);
                textColor = ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR);
        } else
-               textColor = ui_color(B_MENU_ITEM_TEXT_COLOR);
+               textColor = ui_color(B_PANEL_TEXT_COLOR);
 
        be_control_look->DrawLabel(this, label, rect, updateRect, LowColor(), 
flags,
                BAlignment(fAlign, B_ALIGN_MIDDLE), &textColor);

############################################################################

Commit:      5b2aa7f8562e43143795cce54ded1ea18444016e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5b2aa7f8562e
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:05:38 2016 UTC

ControlLook: style changes only

whitespace
indent fix (tiny)

----------------------------------------------------------------------------

diff --git a/src/kits/interface/ControlLook.cpp 
b/src/kits/interface/ControlLook.cpp
index 252e400..7446d80 100644
--- a/src/kits/interface/ControlLook.cpp
+++ b/src/kits/interface/ControlLook.cpp
@@ -1777,7 +1777,7 @@ BControlLook::DrawLabel(BView* view, const char* label, 
BRect rect,
        const BAlignment& alignment, const rgb_color* textColor)
 {
        DrawLabel(view, label, NULL, rect, updateRect, base, flags, alignment,
-                       textColor);
+               textColor);
 }
 
 
@@ -1795,9 +1795,9 @@ BControlLook::DrawLabel(BView* view, const char* label, 
const rgb_color& base,
                && view->Parent()->Parent() == NULL
                && (flags & B_IGNORE_OUTLINE) == 0;
 
-       rgb_color       low;
-       rgb_color       color;
-       rgb_color       glowColor;
+       rgb_color low;
+       rgb_color color;
+       rgb_color glowColor;
 
        if (textColor != NULL)
                glowColor = *textColor;
@@ -1822,14 +1822,16 @@ BControlLook::DrawLabel(BView* view, const char* label, 
const rgb_color& base,
        drawing_mode oldMode = view->DrawingMode();
 
        if (isDesktop) {
-               // Enforce proper use of desktop label colors.
-               if(low.Brightness() < 100) {
+               // enforce proper use of desktop label colors
+               if (low.Brightness() < 100) {
                        if (textColor == NULL)
                                color = make_color(255, 255, 255);
+
                        glowColor = make_color(0, 0, 0);
                } else {
                        if (textColor == NULL)
                                color = make_color(0, 0, 0);
+
                        glowColor = make_color(255, 255, 255);
                }
 

############################################################################

Commit:      8b902d940af2d62c2dca094d0d7eb4f3649262e1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8b902d940af2
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:06:28 2016 UTC

IK: Use panel text color for select control labels

NOTE: This should have no effect on the colors of these labels unless
you have changed the panel text color and control text colors to be
different. Both are black by default.

In the case of the menu field, spinner, check box, radio button,
slider, and text control labels we want to draw these labels using
the panel text color instead of the control text color because they
are drawn on top of the panel color. (the menu field label color was
changed in a previous commit in this push).

In all cases except the menu field the label color is specified by
temporarily unsetting the B_IS_CONTROL flag while drawing the label.
All use control look to draw the label.

The control text color is meant to be used for text INSIDE the control,
not the label text that accompanies the control -- at least that's the
way I understand it.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/AbstractSpinner.cpp 
b/src/kits/interface/AbstractSpinner.cpp
index ecccc88..d623960 100644
--- a/src/kits/interface/AbstractSpinner.cpp
+++ b/src/kits/interface/AbstractSpinner.cpp
@@ -1453,9 +1453,11 @@ BAbstractSpinner::_DrawLabel(BRect updateRect)
                        - fontHeight.descent) / 2.0f)
                + fontHeight.ascent + kFrameMargin * 2;
 
-       uint32 flags = 0;
-       if (!IsEnabled())
-               flags |= BControlLook::B_DISABLED;
+       uint32 flags = be_control_look->Flags(this);
+
+       // erase the is control flag before drawing the label so that the label
+       // will get drawn using B_PANEL_TEXT_COLOR.
+       flags &= ~BControlLook::B_IS_CONTROL;
 
        be_control_look->DrawLabel(this, label, LowColor(), flags, BPoint(x, 
y));
 }
diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp
index fc17585..8e20d6b 100644
--- a/src/kits/interface/CheckBox.cpp
+++ b/src/kits/interface/CheckBox.cpp
@@ -113,6 +113,10 @@ BCheckBox::Draw(BRect updateRect)
        BRect rect(checkBoxRect);
        be_control_look->DrawCheckBox(this, rect, updateRect, base, flags);
 
+       // erase the is control flag before drawing the label so that the label
+       // will get drawn using B_PANEL_TEXT_COLOR
+       flags &= ~BControlLook::B_IS_CONTROL;
+
        BRect labelRect(Bounds());
        labelRect.left = checkBoxRect.right + 1
                + be_control_look->DefaultLabelSpacing();
diff --git a/src/kits/interface/RadioButton.cpp 
b/src/kits/interface/RadioButton.cpp
index 6893ea4..0469833 100644
--- a/src/kits/interface/RadioButton.cpp
+++ b/src/kits/interface/RadioButton.cpp
@@ -99,6 +99,10 @@ BRadioButton::Draw(BRect updateRect)
        BRect rect(knobRect);
        be_control_look->DrawRadioButton(this, rect, updateRect, base, flags);
 
+       // erase the is control flag before drawing the label so that the label
+       // will get drawn using B_PANEL_TEXT_COLOR.
+       flags &= ~BControlLook::B_IS_CONTROL;
+
        BRect labelRect(Bounds());
        labelRect.left = knobRect.right + 1
                + be_control_look->DefaultLabelSpacing();
diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp
index bcd7edd..7888f5f 100644
--- a/src/kits/interface/Slider.cpp
+++ b/src/kits/interface/Slider.cpp
@@ -1150,9 +1150,14 @@ BSlider::DrawText()
                } else {
                        view->SetHighColor(tint_color(LowColor(), 
B_DISABLED_LABEL_TINT));
                }
-       } else
+       } else {
                flags = be_control_look->Flags(this);
 
+               // erase the is control flag before drawing the label so that 
the label
+               // will get drawn using B_PANEL_TEXT_COLOR
+               flags &= ~BControlLook::B_IS_CONTROL;
+       }
+
        font_height fontHeight;
        GetFontHeight(&fontHeight);
        if (Orientation() == B_HORIZONTAL) {
diff --git a/src/kits/interface/TextControl.cpp 
b/src/kits/interface/TextControl.cpp
index c05a1bc..16b528f 100644
--- a/src/kits/interface/TextControl.cpp
+++ b/src/kits/interface/TextControl.cpp
@@ -376,6 +376,10 @@ BTextControl::Draw(BRect updateRect)
                        rect.right = fDivider - kLabelInputSpacing;
                }
 
+               // erase the is control flag before drawing the label so that 
the label
+               // will get drawn using B_PANEL_TEXT_COLOR
+               flags &= ~BControlLook::B_IS_CONTROL;
+
                be_control_look->DrawLabel(this, Label(), rect, updateRect,
                        base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
        }

############################################################################

Commit:      5f6a4730cb4a2eaa2aacb0b8ea8e7eb972258c4d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5f6a4730cb4a
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:18:30 2016 UTC

Appearance: Live update antialiasing text color

...when panel text color changes in addition to panel bg color.

----------------------------------------------------------------------------

diff --git a/src/preferences/appearance/AntialiasingSettingsView.cpp 
b/src/preferences/appearance/AntialiasingSettingsView.cpp
index fbe6dca..ad3df75 100644
--- a/src/preferences/appearance/AntialiasingSettingsView.cpp
+++ b/src/preferences/appearance/AntialiasingSettingsView.cpp
@@ -221,8 +221,10 @@ AntialiasingSettingsView::MessageReceived(BMessage *msg)
                }
                case B_COLORS_UPDATED:
                {
-                       if 
(msg->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR)))
+                       if 
(msg->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR))
+                               || 
msg->HasColor(ui_color_name(B_PANEL_TEXT_COLOR))) {
                                _UpdateColors();
+                       }
                        break;
                }
                default:

############################################################################

Commit:      8be1a5f08294de84bebb26a52808ccf5fde0ed10
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8be1a5f08294
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:40:06 2016 UTC

Slider: Style fixes

Pointer style
Newlines
Indentation
Compare against NULL or 0 explicitly
use single floating point precision for float literals (i.e. use 0.0f)

----------------------------------------------------------------------------

diff --git a/headers/os/interface/Slider.h b/headers/os/interface/Slider.h
index 888bb8f..5f28d3d 100644
--- a/headers/os/interface/Slider.h
+++ b/headers/os/interface/Slider.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2015, Haiku, Inc. All rights reserved.
+ * Copyright 2001-2016 Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _SLIDER_H
diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp
index 7888f5f..fad0df0 100644
--- a/src/kits/interface/Slider.cpp
+++ b/src/kits/interface/Slider.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2015 Haiku, Inc.
+ * Copyright 2001-2016 Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -30,10 +30,12 @@
 #define USE_OFF_SCREEN_VIEW 0
 
 
-BSlider::BSlider(BRect frame, const char* name, const char* label,
-                       BMessage* message, int32 minValue, int32 maxValue,
-                       thumb_style thumbType, uint32 resizingMode, uint32 
flags)
-       : BControl(frame, name, label, message, resizingMode, flags),
+BSlider::BSlider(
+       BRect frame, const char* name, const char* label, BMessage* message,
+       int32 minValue, int32 maxValue, thumb_style thumbType, uint32 
resizingMode,
+       uint32 flags)
+       :
+       BControl(frame, name, label, message, resizingMode, flags),
        fModificationMessage(NULL),
        fSnoozeAmount(20000),
 
@@ -59,11 +61,11 @@ BSlider::BSlider(BRect frame, const char* name, const char* 
label,
 }
 
 
-BSlider::BSlider(BRect frame, const char *name, const char *label,
-                       BMessage *message, int32 minValue, int32 maxValue,
-                       orientation posture, thumb_style thumbType, uint32 
resizingMode,
-                       uint32 flags)
-       : BControl(frame, name, label, message, resizingMode, flags),
+BSlider::BSlider(BRect frame, const char* name, const char* label,
+       BMessage* message, int32 minValue, int32 maxValue, orientation posture,
+       thumb_style thumbType, uint32 resizingMode, uint32 flags)
+       :
+       BControl(frame, name, label, message, resizingMode, flags),
        fModificationMessage(NULL),
        fSnoozeAmount(20000),
 
@@ -89,10 +91,11 @@ BSlider::BSlider(BRect frame, const char *name, const char 
*label,
 }
 
 
-BSlider::BSlider(const char *name, const char *label, BMessage *message,
-                       int32 minValue, int32 maxValue, orientation posture,
-                       thumb_style thumbType, uint32 flags)
-       : BControl(name, label, message, flags),
+BSlider::BSlider(const char* name, const char* label, BMessage* message,
+       int32 minValue, int32 maxValue, orientation posture, thumb_style 
thumbType,
+       uint32 flags)
+       :
+       BControl(name, label, message, flags),
        fModificationMessage(NULL),
        fSnoozeAmount(20000),
 
@@ -118,8 +121,9 @@ BSlider::BSlider(const char *name, const char *label, 
BMessage *message,
 }
 
 
-BSlider::BSlider(BMessage *archive)
-       : BControl(archive)
+BSlider::BSlider(BMessage* archive)
+       :
+       BControl(archive)
 {
        fModificationMessage = NULL;
 
@@ -135,7 +139,7 @@ BSlider::BSlider(BMessage *archive)
                SetSnoozeAmount(20000);
 
        rgb_color color;
-       if (archive->FindInt32("_fcolor", (int32 *)&color) == B_OK)
+       if (archive->FindInt32("_fcolor", (int32*)&color) == B_OK)
                UseFillColor(true, &color);
        else
                UseFillColor(false);
@@ -181,7 +185,7 @@ BSlider::BSlider(BMessage *archive)
        else
                fStyle = B_BLOCK_THUMB;
 
-       if (archive->FindInt32("_bcolor", (int32 *)&color) != B_OK)
+       if (archive->FindInt32("_bcolor", (int32*)&color) != B_OK)
                color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 
B_DARKEN_4_TINT);
        SetBarColor(color);
 
@@ -242,7 +246,7 @@ BSlider::_InitObject()
 
 
 BArchivable*
-BSlider::Instantiate(BMessage *archive)
+BSlider::Instantiate(BMessage* archive)
 {
        if (validate_instantiation(archive, "BSlider"))
                return new BSlider(archive);
@@ -252,7 +256,7 @@ BSlider::Instantiate(BMessage *archive)
 
 
 status_t
-BSlider::Archive(BMessage *archive, bool deep) const
+BSlider::Archive(BMessage* archive, bool deep) const
 {
        status_t ret = BControl::Archive(archive, deep);
 
@@ -261,33 +265,40 @@ BSlider::Archive(BMessage *archive, bool deep) const
 
        if (ret == B_OK)
                ret = archive->AddInt32("_sdelay", fSnoozeAmount);
+
        if (ret == B_OK)
-               ret = archive->AddInt32("_bcolor", (const uint32 &)fBarColor);
+               ret = archive->AddInt32("_bcolor", (const uint32&)fBarColor);
 
        if (FillColor(NULL) && ret == B_OK)
-               ret = archive->AddInt32("_fcolor", (const uint32 &)fFillColor);
+               ret = archive->AddInt32("_fcolor", (const uint32&)fFillColor);
 
-       if (ret == B_OK && fMinLimitLabel)
+       if (ret == B_OK && fMinLimitLabel != NULL)
                ret = archive->AddString("_minlbl", fMinLimitLabel);
 
-       if (ret == B_OK && fMaxLimitLabel)
+       if (ret == B_OK && fMaxLimitLabel != NULL)
                ret = archive->AddString("_maxlbl", fMaxLimitLabel);
 
        if (ret == B_OK)
                ret = archive->AddInt32("_min", fMinValue);
+
        if (ret == B_OK)
                ret = archive->AddInt32("_max", fMaxValue);
 
        if (ret == B_OK)
                ret = archive->AddInt32("_incrementvalue", fKeyIncrementValue);
+
        if (ret == B_OK)
                ret = archive->AddInt32("_hashcount", fHashMarkCount);
+
        if (ret == B_OK)
                ret = archive->AddInt16("_hashloc", fHashMarks);
+
        if (ret == B_OK)
                ret = archive->AddInt16("_sstyle", fStyle);
+
        if (ret == B_OK)
                ret = archive->AddInt32("_orient", fOrientation);
+
        if (ret == B_OK)
                ret = archive->AddFloat("_bthickness", fBarThickness);
 
@@ -300,25 +311,28 @@ BSlider::Perform(perform_code code, void* _data)
 {
        switch (code) {
                case PERFORM_CODE_MIN_SIZE:
-                       ((perform_data_min_size*)_data)->return_value
-                               = BSlider::MinSize();
+                       ((perform_data_min_size*)_data)->return_value = 
BSlider::MinSize();
                        return B_OK;
+
                case PERFORM_CODE_MAX_SIZE:
-                       ((perform_data_max_size*)_data)->return_value
-                               = BSlider::MaxSize();
+                       ((perform_data_max_size*)_data)->return_value = 
BSlider::MaxSize();
                        return B_OK;
+
                case PERFORM_CODE_PREFERRED_SIZE:
                        ((perform_data_preferred_size*)_data)->return_value
                                = BSlider::PreferredSize();
                        return B_OK;
+
                case PERFORM_CODE_LAYOUT_ALIGNMENT:
                        ((perform_data_layout_alignment*)_data)->return_value
                                = BSlider::LayoutAlignment();
                        return B_OK;
+
                case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
                        
((perform_data_has_height_for_width*)_data)->return_value
                                = BSlider::HasHeightForWidth();
                        return B_OK;
+
                case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
                {
                        perform_data_get_height_for_width* data
@@ -327,12 +341,14 @@ BSlider::Perform(perform_code code, void* _data)
                                &data->preferred);
                        return B_OK;
                }
+
                case PERFORM_CODE_SET_LAYOUT:
                {
                        perform_data_set_layout* data = 
(perform_data_set_layout*)_data;
                        BSlider::SetLayout(data->layout);
                        return B_OK;
                }
+
                case PERFORM_CODE_LAYOUT_INVALIDATED:
                {
                        perform_data_layout_invalidated* data
@@ -340,11 +356,13 @@ BSlider::Perform(perform_code code, void* _data)
                        BSlider::LayoutInvalidated(data->descendants);
                        return B_OK;
                }
+
                case PERFORM_CODE_DO_LAYOUT:
                {
                        BSlider::DoLayout();
                        return B_OK;
                }
+
                case PERFORM_CODE_SET_ICON:
                {
                        perform_data_set_icon* data = 
(perform_data_set_icon*)_data;
@@ -392,12 +410,13 @@ BSlider::AttachedToWindow()
        BControl::AttachedToWindow();
 
        BView* view = OffscreenView();
-       if (view && view->LockLooper()) {
+       if (view != NULL && view->LockLooper()) {
                view->SetViewColor(B_TRANSPARENT_COLOR);
                if (LowUIColor() != B_NO_COLOR)
                        view->SetLowUIColor(LowUIColor());
                else
                        view->SetLowColor(LowColor());
+
                view->UnlockLooper();
        }
 
@@ -446,9 +465,9 @@ BSlider::DetachedFromWindow()
 
 
 void
-BSlider::MessageReceived(BMessage *msg)
+BSlider::MessageReceived(BMessage* message)
 {
-       BControl::MessageReceived(msg);
+       BControl::MessageReceived(message);
 }
 
 
@@ -486,7 +505,7 @@ BSlider::FrameResized(float w,float h)
 
 
 void
-BSlider::KeyDown(const char *bytes, int32 numBytes)
+BSlider::KeyDown(const char* bytes, int32 numBytes)
 {
        if (!IsEnabled() || IsHidden())
                return;
@@ -507,6 +526,7 @@ BSlider::KeyDown(const char *bytes, int32 numBytes)
                case B_HOME:
                        newValue = fMinValue;
                        break;
+
                case B_END:
                        newValue = fMaxValue;
                        break;
@@ -518,6 +538,7 @@ BSlider::KeyDown(const char *bytes, int32 numBytes)
 
        if (newValue < fMinValue)
                newValue = fMinValue;
+
        if (newValue > fMaxValue)
                newValue = fMaxValue;
 
@@ -529,7 +550,7 @@ BSlider::KeyDown(const char *bytes, int32 numBytes)
 }
 
 void
-BSlider::KeyUp(const char *bytes, int32 numBytes)
+BSlider::KeyUp(const char* bytes, int32 numBytes)
 {
        if (fInitialLocation != _Location()) {
                // The last KeyDown event triggered the modification message or 
no
@@ -594,7 +615,8 @@ BSlider::MouseDown(BPoint point)
 
        if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
                SetTracking(true);
-               SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | 
B_NO_POINTER_HISTORY);
+               SetMouseEventMask(B_POINTER_EVENTS,
+                       B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
        } else {
                // synchronous mouse tracking
                BPoint prevPoint;
@@ -633,7 +655,7 @@ BSlider::MouseUp(BPoint point)
 
 
 void
-BSlider::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
+BSlider::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
 {
        if (IsTracking()) {
                if (_ConstrainPoint(point, _Location())) {
@@ -656,14 +678,14 @@ BSlider::Pulse()
 
 
 void
-BSlider::SetLabel(const char *label)
+BSlider::SetLabel(const char* label)
 {
        BControl::SetLabel(label);
 }
 
 
 void
-BSlider::SetLimitLabels(const char *minLabel, const char *maxLabel)
+BSlider::SetLimitLabels(const char* minLabel, const char* maxLabel)
 {
        free(fMinLimitLabel);
        fMinLimitLabel = minLabel ? strdup(minLabel) : NULL;
@@ -702,6 +724,7 @@ BSlider::SetValue(int32 value)
 {
        if (value < fMinValue)
                value = fMinValue;
+
        if (value > fMaxValue)
                value = fMaxValue;
 
@@ -761,10 +784,12 @@ BSlider::ValueForPoint(BPoint location) const
 
        if (position < min)
                position = min;
+
        if (position > max)
                position = max;
 
-       return (int32)roundf(((position - min) * (fMaxValue - fMinValue) / (max 
- min)) + fMinValue);
+       return (int32)roundf(((position - min) * (fMaxValue - fMinValue)
+               / (max - min)) + fMinValue);
 }
 
 
@@ -799,10 +824,11 @@ BSlider::SetEnabled(bool on)
 
 
 void
-BSlider::GetLimits(int32 *minimum, int32 *maximum) const
+BSlider::GetLimits(int32* minimum, int32* maximum) const
 {
        if (minimum != NULL)
                *minimum = fMinValue;
+
        if (maximum != NULL)
                *maximum = fMaxValue;
 }
@@ -818,7 +844,7 @@ BSlider::Draw(BRect updateRect)
        BRegion background(updateRect);
        background.Exclude(BarFrame());
        bool drawBackground = true;
-       if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
+       if (Parent() != NULL && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
                // This view is embedded somewhere, most likely the Tracker 
Desktop
                // shelf.
                drawBackground = false;
@@ -851,8 +877,9 @@ BSlider::DrawSlider()
 {
        if (LockLooper()) {
 #if USE_OFF_SCREEN_VIEW
-               if (!fOffScreenBits)
+               if (fOffScreenBits == NULL)
                        return;
+
                if (fOffScreenBits->Lock()) {
 #endif
                        DrawBar();
@@ -877,7 +904,7 @@ void
 BSlider::DrawBar()
 {
        BRect frame = BarFrame();
-       BView *view = OffscreenView();
+       BView* view = OffscreenView();
 
        if (be_control_look != NULL) {
                uint32 flags = be_control_look->Flags(this);
@@ -974,31 +1001,31 @@ BSlider::DrawBar()
 
        view->SetHighColor(darken1);
        view->StrokeLine(BPoint(frame.left, frame.top),
-                                        BPoint(frame.left + 1.0f, frame.top));
+               BPoint(frame.left + 1.0f, frame.top));
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.left + 1.0f, 
frame.bottom));
+               BPoint(frame.left + 1.0f, frame.bottom));
        view->StrokeLine(BPoint(frame.right - 1.0f, frame.top),
-                                        BPoint(frame.right, frame.top));
+               BPoint(frame.right, frame.top));
 
        view->SetHighColor(darken2);
        view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-                                        BPoint(frame.right - 1.0f, frame.top));
+               BPoint(frame.right - 1.0f, frame.top));
        view->StrokeLine(BPoint(frame.left, frame.bottom - 1.0f),
-                                        BPoint(frame.left, frame.top + 1.0f));
+               BPoint(frame.left, frame.top + 1.0f));
 
        view->SetHighColor(lightenmax);
        view->StrokeLine(BPoint(frame.left + 1.0f, frame.bottom),
-                                        BPoint(frame.right, frame.bottom));
+               BPoint(frame.right, frame.bottom));
        view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-                                        BPoint(frame.right, frame.top + 1.0f));
+               BPoint(frame.right, frame.top + 1.0f));
 
        frame.InsetBy(1.0f, 1.0f);
 
        view->SetHighColor(darkenmax);
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.left, frame.top));
+               BPoint(frame.left, frame.top));
        view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-                                        BPoint(frame.right, frame.top));
+               BPoint(frame.right, frame.top));
 
        if (Style() == B_BLOCK_THUMB)
                PopState();
@@ -1040,8 +1067,7 @@ BSlider::DrawHashMarks()
                // fHashMarks != B_HASH_MARKS_NONE
        float factor = (_MaxPosition() - pos) / (hashMarkCount - 1);
 
-       if (fHashMarks & B_HASH_MARKS_TOP) {
-
+       if ((fHashMarks & B_HASH_MARKS_TOP) != 0) {
                view->BeginLineArray(hashMarkCount * 2);
 
                if (fOrientation == B_HORIZONTAL) {
@@ -1069,8 +1095,7 @@ BSlider::DrawHashMarks()
 
        pos = _MinPosition();
 
-       if (fHashMarks & B_HASH_MARKS_BOTTOM) {
-
+       if ((fHashMarks & B_HASH_MARKS_BOTTOM) != 0) {
                view->BeginLineArray(hashMarkCount * 2);
 
                if (fOrientation == B_HORIZONTAL) {
@@ -1140,16 +1165,15 @@ void
 BSlider::DrawText()
 {
        BRect bounds(Bounds());
-       BView *view = OffscreenView();
+       BView* view = OffscreenView();
 
        rgb_color base = LowColor();
        uint32 flags = 0;
        if (be_control_look == NULL) {
-               if (IsEnabled()) {
+               if (IsEnabled())
                        view->SetHighColor(0, 0, 0);
-               } else {
+               else
                        view->SetHighColor(tint_color(LowColor(), 
B_DISABLED_LABEL_TINT));
-               }
        } else {
                flags = be_control_look->Flags(this);
 
@@ -1161,7 +1185,7 @@ BSlider::DrawText()
        font_height fontHeight;
        GetFontHeight(&fontHeight);
        if (Orientation() == B_HORIZONTAL) {
-               if (Label()) {
+               if (Label() != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(Label(),
                                        BPoint(0.0, ceilf(fontHeight.ascent)));
@@ -1183,7 +1207,7 @@ BSlider::DrawText()
                        }
                }
 
-               if (fMinLimitLabel) {
+               if (fMinLimitLabel != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(fMinLimitLabel, BPoint(0.0, 
bounds.bottom
                                        - fontHeight.descent));
@@ -1193,7 +1217,7 @@ BSlider::DrawText()
                        }
                }
 
-               if (fMaxLimitLabel) {
+               if (fMaxLimitLabel != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(fMaxLimitLabel, 
BPoint(bounds.right
                                        - StringWidth(fMaxLimitLabel), 
bounds.bottom
@@ -1209,7 +1233,7 @@ BSlider::DrawText()
                        + ceilf(fontHeight.leading);
                float baseLine = ceilf(fontHeight.ascent);
 
-               if (Label()) {
+               if (Label() != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(Label(), BPoint((bounds.Width()
                                        - StringWidth(Label())) / 2.0, 
baseLine));
@@ -1221,7 +1245,7 @@ BSlider::DrawText()
                        baseLine += lineHeight;
                }
 
-               if (fMaxLimitLabel) {
+               if (fMaxLimitLabel != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(fMaxLimitLabel, 
BPoint((bounds.Width()
                                        - StringWidth(fMaxLimitLabel)) / 2.0, 
baseLine));
@@ -1234,7 +1258,7 @@ BSlider::DrawText()
 
                baseLine = bounds.bottom - ceilf(fontHeight.descent);
 
-               if (fMinLimitLabel) {
+               if (fMinLimitLabel != NULL) {
                        if (be_control_look == NULL) {
                                view->DrawString(fMinLimitLabel, 
BPoint((bounds.Width()
                                        - StringWidth(fMinLimitLabel)) / 2.0, 
baseLine));
@@ -1301,8 +1325,9 @@ BSlider::UpdateTextChanged()
                        if (!updateTextOnOff) {
                                invalid.left = (invalid.left + invalid.right - 
width) / 2;
                                invalid.right = invalid.left + width;
-                               if (fMinLimitLabel)
+                               if (fMinLimitLabel != NULL)
                                        invalid.bottom -= lineHeight;
+
                                invalid.top = invalid.bottom - height;
                        }
                }
@@ -1341,9 +1366,10 @@ BSlider::BarFrame() const
        } else {
                frame.left = floorf((frame.Width() - fBarThickness) / 2.0);
                frame.top = thumbInset;
-               if (Label())
+               if (Label() != NULL)
                        frame.top += textHeight;
-               if (fMaxLimitLabel) {
+
+               if (fMaxLimitLabel != NULL) {
                        frame.top += textHeight;
                        if (Label())
                                frame.top += leading;
@@ -1351,11 +1377,12 @@ BSlider::BarFrame() const
 
                frame.right = frame.left + fBarThickness;
                frame.bottom = frame.bottom - thumbInset;
-               if (fMinLimitLabel)
+               if (fMinLimitLabel != NULL)
                        frame.bottom -= textHeight;
-               if (fUpdateText) {
+
+               if (fUpdateText != NULL) {
                        frame.bottom -= textHeight;
-                       if (fMinLimitLabel)
+                       if (fMinLimitLabel != NULL)
                                frame.bottom -= leading;
                }
        }
@@ -1488,7 +1515,7 @@ BSlider::Invoke(BMessage* message)
 
 BHandler*
 BSlider::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
-       int32 command, const char *property)
+       int32 command, const char* property)
 {
        return BControl::ResolveSpecifier(message, index, specifier, command,
                property);
@@ -1701,7 +1728,7 @@ BSlider::SetBarThickness(float thickness)
 
 
 void
-BSlider::SetFont(const BFont *font, uint32 properties)
+BSlider::SetFont(const BFont* font, uint32 properties)
 {
        BControl::SetFont(font, properties);
 
@@ -1729,9 +1756,8 @@ BSlider::SetLimits(int32 minimum, int32 maximum)
                value = max_c(minimum, value);
                value = min_c(maximum, value);
 
-               if (value != Value()) {
+               if (value != Value())
                        SetValue(value);
-               }
        }
 }
 
@@ -1748,6 +1774,7 @@ BSlider::MaxUpdateTextWidth()
        // in case the derived class uses a fixed buffer, the contents
        // should be reset for the old value
        UpdateText();
+
        return width;
 }
 
@@ -1758,8 +1785,7 @@ BSlider::MaxUpdateTextWidth()
 BSize
 BSlider::MinSize()
 {
-       return BLayoutUtils::ComposeSize(ExplicitMinSize(),
-               _ValidateMinSize());
+       return BLayoutUtils::ComposeSize(ExplicitMinSize(), _ValidateMinSize());
 }
 
 
@@ -1771,6 +1797,7 @@ BSlider::MaxSize()
                maxSize.width = B_SIZE_UNLIMITED;
        else
                maxSize.height = B_SIZE_UNLIMITED;
+
        return BLayoutUtils::ComposeSize(ExplicitMaxSize(), maxSize);
 }
 
@@ -1804,11 +1831,12 @@ BSlider::LayoutInvalidated(bool descendants)
 
 // #pragma mark - private
 
+
 void
 BSlider::_DrawBlockThumb()
 {
        BRect frame = ThumbFrame();
-       BView *view = OffscreenView();
+       BView* view = OffscreenView();
 
        if (be_control_look != NULL) {
                rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
@@ -1840,101 +1868,102 @@ BSlider::_DrawBlockThumb()
        }
 
        // blank background for shadow
-       // ToDo: this also draws over the hash marks (though it's not *that* 
noticeable)
+       // ToDo: this also draws over the hash marks
+       //       (though it's not *that* noticeable)
        view->SetHighColor(no_tint);
        view->StrokeLine(BPoint(frame.left, frame.top),
-                                        BPoint(frame.left, frame.top));
+               BPoint(frame.left, frame.top));
 
        BRect barFrame = BarFrame();
        if (barFrame.right >= frame.right) {
                // leave out barFrame from shadow background clearing
                view->StrokeLine(BPoint(frame.right, frame.top),
-                                                BPoint(frame.right, 
barFrame.top - 1.0f));
+                       BPoint(frame.right, barFrame.top - 1.0f));
                view->StrokeLine(BPoint(frame.right, barFrame.bottom + 1.0f),
-                                                BPoint(frame.right, 
frame.bottom));
+                       BPoint(frame.right, frame.bottom));
        } else {
                view->StrokeLine(BPoint(frame.right, frame.top),
-                                                BPoint(frame.right, 
frame.bottom));
+                       BPoint(frame.right, frame.bottom));
        }
 
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.right - 1.0f, 
frame.bottom));
+               BPoint(frame.right - 1.0f, frame.bottom));
        view->StrokeLine(BPoint(frame.left, frame.bottom - 1.0f),
-                                        BPoint(frame.left, frame.bottom - 
1.0f));
+               BPoint(frame.left, frame.bottom - 1.0f));
        view->StrokeLine(BPoint(frame.right - 1.0f, frame.top),
-                                        BPoint(frame.right - 1.0f, frame.top));
+               BPoint(frame.right - 1.0f, frame.top));
 
-       // Outline (top, left)
+       // outline (top, left)
        view->SetHighColor(darken3);
        view->StrokeLine(BPoint(frame.left, frame.bottom - 2.0f),
-                                        BPoint(frame.left, frame.top + 1.0f));
+               BPoint(frame.left, frame.top + 1.0f));
        view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-                                        BPoint(frame.right - 2.0f, frame.top));
+               BPoint(frame.right - 2.0f, frame.top));
 
-       // Shadow
+       // shadow
        view->SetHighColor(0, 0, 0, IsEnabled() ? 100 : 50);
        view->SetDrawingMode(B_OP_ALPHA);
        view->StrokeLine(BPoint(frame.right, frame.top + 2.0f),
-                                        BPoint(frame.right, frame.bottom - 
1.0f));
+               BPoint(frame.right, frame.bottom - 1.0f));
        view->StrokeLine(BPoint(frame.left + 2.0f, frame.bottom),
-                                        BPoint(frame.right - 1.0f, 
frame.bottom));
+               BPoint(frame.right - 1.0f, frame.bottom));
 
        view->SetDrawingMode(B_OP_COPY);
        view->SetHighColor(darken3);
        view->StrokeLine(BPoint(frame.right - 1.0f, frame.bottom - 1.0f),
-                                        BPoint(frame.right - 1.0f, 
frame.bottom - 1.0f));
+               BPoint(frame.right - 1.0f, frame.bottom - 1.0f));
 
-
-       // First bevel
+       // first bevel
        frame.InsetBy(1.0f, 1.0f);
 
        view->SetHighColor(darkenmax);
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.right - 1.0f, 
frame.bottom));
+               BPoint(frame.right - 1.0f, frame.bottom));
        view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-                                        BPoint(frame.right, frame.top));
+               BPoint(frame.right, frame.top));
 
        view->SetHighColor(lighten2);
        view->StrokeLine(BPoint(frame.left, frame.top),
-                                        BPoint(frame.left, frame.bottom - 
1.0f));
+               BPoint(frame.left, frame.bottom - 1.0f));
        view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-                                        BPoint(frame.right - 1.0f, frame.top));
+               BPoint(frame.right - 1.0f, frame.top));
 
        frame.InsetBy(1.0f, 1.0f);
 
-       view->FillRect(BRect(frame.left, frame.top, frame.right - 1.0f, 
frame.bottom - 1.0f));
+       view->FillRect(BRect(frame.left, frame.top, frame.right - 1.0f,
+               frame.bottom - 1.0f));
 
-       // Second bevel and center dots
+       // second bevel and center dots
        view->SetHighColor(darken2);
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.right, frame.bottom));
+               Point(frame.right, frame.bottom));
        view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-                                        BPoint(frame.right, frame.top));
+               Point(frame.right, frame.top));
 
        if (Orientation() == B_HORIZONTAL) {
                view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 2.0f),
-                                                BPoint(frame.left + 6.0f, 
frame.top + 2.0f));
+                       Point(frame.left + 6.0f, frame.top + 2.0f));
                view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 4.0f),
-                                                BPoint(frame.left + 6.0f, 
frame.top + 4.0f));
+                       Point(frame.left + 6.0f, frame.top + 4.0f));
                view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 6.0f),
-                                                BPoint(frame.left + 6.0f, 
frame.top + 6.0f));
+                       BPoint(frame.left + 6.0f, frame.top + 6.0f));
        } else {
                view->StrokeLine(BPoint(frame.left + 2.0f, frame.top + 6.0f),
-                                                BPoint(frame.left + 2.0f, 
frame.top + 6.0f));
+                       BPoint(frame.left + 2.0f, frame.top + 6.0f));
                view->StrokeLine(BPoint(frame.left + 4.0f, frame.top + 6.0f),
-                                                BPoint(frame.left + 4.0f, 
frame.top + 6.0f));
+                       BPoint(frame.left + 4.0f, frame.top + 6.0f));
                view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 6.0f),
-                                                BPoint(frame.left + 6.0f, 
frame.top + 6.0f));
+                       BPoint(frame.left + 6.0f, frame.top + 6.0f));
        }
 
        frame.InsetBy(1.0f, 1.0f);
 
-       // Third bevel
+       // third bevel
        view->SetHighColor(lighten1);
        view->StrokeLine(BPoint(frame.left, frame.bottom),
-                                        BPoint(frame.right, frame.bottom));
+               BPoint(frame.right, frame.bottom));
        view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-                                        BPoint(frame.right, frame.top));
+               BPoint(frame.right, frame.top));
 }
 
 
@@ -1942,7 +1971,7 @@ void
 BSlider::_DrawTriangleThumb()
 {
        BRect frame = ThumbFrame();
-       BView *view = OffscreenView();
+       BView* view = OffscreenView();
 
        if (be_control_look != NULL) {
                rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
@@ -2106,36 +2135,38 @@ BSlider::_ValidateMinSize()
        font_height fontHeight;
        GetFontHeight(&fontHeight);
 
-       float width = 0.0;
-       float height = 0.0;
+       float width = 0.0f;
+       float height = 0.0f;
 
-       if (fMaxUpdateTextWidth < 0.0)
+       if (fMaxUpdateTextWidth < 0.0f)
                fMaxUpdateTextWidth = MaxUpdateTextWidth();
 
        if (Orientation() == B_HORIZONTAL) {
-               height = 12.0 + fBarThickness;
+               height = 12.0f + fBarThickness;
                int32 rows = 0;
 
                float labelWidth = 0;
                int32 labelRows = 0;
                float labelSpacing = StringWidth("M") * 2;
-               if (Label()) {
+               if (Label() != NULL) {
                        labelWidth = StringWidth(Label());
                        labelRows = 1;
                }
-               if (fMaxUpdateTextWidth > 0.0) {
+               if (fMaxUpdateTextWidth > 0.0f) {
                        if (labelWidth > 0)
                                labelWidth += labelSpacing;
+
                        labelWidth += fMaxUpdateTextWidth;
                        labelRows = 1;
                }
                rows += labelRows;
 
-               if (MinLimitLabel())
+               if (MinLimitLabel() != NULL)
                        width = StringWidth(MinLimitLabel());
-               if (MaxLimitLabel()) {
+
+               if (MaxLimitLabel() != NULL) {
                        // some space between the labels
-                       if (MinLimitLabel())
+                       if (MinLimitLabel() != NULL)
                                width += labelSpacing;
 
                        width += StringWidth(MaxLimitLabel());
@@ -2143,8 +2174,9 @@ BSlider::_ValidateMinSize()
 
                if (labelWidth > width)
                        width = labelWidth;
-               if (width < 32.0)
-                       width = 32.0;
+
+               if (width < 32.0f)
+                       width = 32.0f;
 
                if (MinLimitLabel() || MaxLimitLabel())
                        rows++;
@@ -2153,8 +2185,8 @@ BSlider::_ValidateMinSize()
                        + ceilf(fontHeight.descent) + 4.0);
        } else {
                // B_VERTICAL
-               width = 12.0 + fBarThickness;
-               height = 32.0;
+               width = 12.0f + fBarThickness;
+               height = 32.0f;
 
                float lineHeightNoLeading = ceilf(fontHeight.ascent)
                        + ceilf(fontHeight.descent);
@@ -2162,19 +2194,19 @@ BSlider::_ValidateMinSize()
 
                // find largest label
                float labelWidth = 0;
-               if (Label()) {
+               if (Label() != NULL) {
                        labelWidth = StringWidth(Label());
                        height += lineHeightNoLeading;
                }
-               if (MaxLimitLabel()) {
+               if (MaxLimitLabel() != NULL) {
                        labelWidth = max_c(labelWidth, 
StringWidth(MaxLimitLabel()));
                        height += Label() ? lineHeight : lineHeightNoLeading;
                }
-               if (MinLimitLabel()) {
+               if (MinLimitLabel() != NULL) {
                        labelWidth = max_c(labelWidth, 
StringWidth(MinLimitLabel()));
                        height += lineHeightNoLeading;
                }
-               if (fMaxUpdateTextWidth > 0.0) {
+               if (fMaxUpdateTextWidth > 0.0f) {
                        labelWidth = max_c(labelWidth, fMaxUpdateTextWidth);
                        height += MinLimitLabel() ? lineHeight : 
lineHeightNoLeading;
                }
@@ -2202,8 +2234,8 @@ void BSlider::_ReservedSlider11() {}
 void BSlider::_ReservedSlider12() {}
 
 
-BSlider &
-BSlider::operator=(const BSlider &)
+BSlider&
+BSlider::operator=(const BSlider&)
 {
        return *this;
 }
@@ -2222,13 +2254,13 @@ GetLimits__7BSliderPlT1(BSlider* slider, int32* 
minimum, int32* maximum)
 
 
 extern "C" void
-_ReservedSlider4__7BSlider(BSlider *slider, int32 minimum, int32 maximum)
+_ReservedSlider4__7BSlider(BSlider* slider, int32 minimum, int32 maximum)
 {
        slider->BSlider::SetLimits(minimum, maximum);
 }
 
 extern "C" float
-_ReservedSlider5__7BSlider(BSlider *slider)
+_ReservedSlider5__7BSlider(BSlider* slider)
 {
        return slider->BSlider::MaxUpdateTextWidth();
 }
@@ -2268,4 +2300,3 @@ B_IF_GCC_2(InvalidateLayout__7BSliderb, 
_ZN7BSlider16InvalidateLayoutEb)(
 
        view->Perform(PERFORM_CODE_LAYOUT_INVALIDATED, &data);
 }
-

############################################################################

Commit:      8e7b383abfc1e2ed4640665122169bd926db044a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8e7b383abfc1
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:45:21 2016 UTC

Slider: Replace min_c and max_c with std::min and std::max

----------------------------------------------------------------------------

diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp
index fad0df0..bd74cc2 100644
--- a/src/kits/interface/Slider.cpp
+++ b/src/kits/interface/Slider.cpp
@@ -11,6 +11,8 @@
 
 #include <Slider.h>
 
+#include <algorithm>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1062,7 +1064,7 @@ BSlider::DrawHashMarks()
        }
 
        float pos = _MinPosition();
-       int32 hashMarkCount = max_c(fHashMarkCount, 2);
+       int32 hashMarkCount = std::max(fHashMarkCount, (int32)2);
                // draw at least two hashmarks at min/max if
                // fHashMarks != B_HASH_MARKS_NONE
        float factor = (_MaxPosition() - pos) / (hashMarkCount - 1);
@@ -1311,7 +1313,7 @@ BSlider::UpdateTextChanged()
        if (fUpdateText != NULL)
                newWidth = StringWidth(fUpdateText);
 
-       float width = ceilf(max_c(newWidth, oldWidth)) + 2.0f;
+       float width = ceilf(std::max(newWidth, oldWidth)) + 2.0f;
        if (width != 0) {
                font_height fontHeight;
                GetFontHeight(&fontHeight);
@@ -1480,7 +1482,7 @@ BSlider::GetPreferredSize(float* _width, float* _height)
                        // NOTE: For compatibility reasons, a horizontal BSlider
                        // never shrinks horizontally. This only affects 
applications
                        // which do not use the new layout system.
-                       *_width = max_c(Bounds().Width(), preferredSize.width);
+                       *_width = std::max(Bounds().Width(), 
preferredSize.width);
                }
 
                if (_height != NULL)
@@ -1493,7 +1495,7 @@ BSlider::GetPreferredSize(float* _width, float* _height)
                        // NOTE: Similarly, a vertical BSlider never shrinks
                        // vertically. This only affects applications which do 
not
                        // use the new layout system.
-                       *_height = max_c(Bounds().Height(), 
preferredSize.height);
+                       *_height = std::max(Bounds().Height(), 
preferredSize.height);
                }
        }
 }
@@ -1753,8 +1755,8 @@ BSlider::SetLimits(int32 minimum, int32 maximum)
                fMaxValue = maximum;
 
                int32 value = Value();
-               value = max_c(minimum, value);
-               value = min_c(maximum, value);
+               value = std::max(minimum, value);
+               value = std::min(maximum, value);
 
                if (value != Value())
                        SetValue(value);
@@ -1807,9 +1809,10 @@ BSlider::PreferredSize()
 {
        BSize preferredSize = _ValidateMinSize();
        if (fOrientation == B_HORIZONTAL)
-               preferredSize.width = max_c(100.0, preferredSize.width);
+               preferredSize.width = std::max(100.0f, preferredSize.width);
        else
-               preferredSize.height = max_c(100.0, preferredSize.height);
+               preferredSize.height = std::max(100.0f, preferredSize.height);
+
        return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), 
preferredSize);
 }
 
@@ -2199,19 +2202,19 @@ BSlider::_ValidateMinSize()
                        height += lineHeightNoLeading;
                }
                if (MaxLimitLabel() != NULL) {
-                       labelWidth = max_c(labelWidth, 
StringWidth(MaxLimitLabel()));
+                       labelWidth = std::max(labelWidth, 
StringWidth(MaxLimitLabel()));
                        height += Label() ? lineHeight : lineHeightNoLeading;
                }
                if (MinLimitLabel() != NULL) {
-                       labelWidth = max_c(labelWidth, 
StringWidth(MinLimitLabel()));
+                       labelWidth = std::max(labelWidth, 
StringWidth(MinLimitLabel()));
                        height += lineHeightNoLeading;
                }
                if (fMaxUpdateTextWidth > 0.0f) {
-                       labelWidth = max_c(labelWidth, fMaxUpdateTextWidth);
+                       labelWidth = std::max(labelWidth, fMaxUpdateTextWidth);
                        height += MinLimitLabel() ? lineHeight : 
lineHeightNoLeading;
                }
 
-               width = max_c(labelWidth, width);
+               width = std::max(labelWidth, width);
        }
 
        fMinSize.width = width;

############################################################################

Revision:    hrev50163
Commit:      6a8276c4643accc4b70cbb80de2df6c978f2d231
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6a8276c4643a
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar 22 18:53:46 2016 UTC

BSlider: Remove non be_control_look drawing code

----------------------------------------------------------------------------

diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp
index bd74cc2..da1ecb4 100644
--- a/src/kits/interface/Slider.cpp
+++ b/src/kits/interface/Slider.cpp
@@ -216,14 +216,8 @@ BSlider::~BSlider()
 void
 BSlider::_InitBarColor()
 {
-       if (be_control_look != NULL) {
-               SetBarColor(be_control_look->SliderBarColor(
-                       ui_color(B_PANEL_BACKGROUND_COLOR)));
-       } else {
-               SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
-                       B_DARKEN_4_TINT));
-       }
-
+       SetBarColor(be_control_look->SliderBarColor(
+               ui_color(B_PANEL_BACKGROUND_COLOR)));
        UseFillColor(false, NULL);
 }
 
@@ -908,129 +902,12 @@ BSlider::DrawBar()
        BRect frame = BarFrame();
        BView* view = OffscreenView();
 
-       if (be_control_look != NULL) {
-               uint32 flags = be_control_look->Flags(this);
-               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-               rgb_color rightFillColor = fBarColor;
-               rgb_color leftFillColor = fUseFillColor ? fFillColor : 
fBarColor;
-               be_control_look->DrawSliderBar(view, frame, frame, base, 
leftFillColor,
-                       rightFillColor, Position(), flags, fOrientation);
-               return;
-       }
-
-       rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       rgb_color lightenmax;
-       rgb_color darken1;
-       rgb_color darken2;
-       rgb_color darkenmax;
-
-       rgb_color barColor;
-       rgb_color fillColor;
-
-       if (IsEnabled()) {
-               lightenmax      = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
-               darken1         = tint_color(no_tint, B_DARKEN_1_TINT);
-               darken2         = tint_color(no_tint, B_DARKEN_2_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_MAX_TINT);
-               barColor        = fBarColor;
-               fillColor       = fFillColor;
-       } else {
-               lightenmax      = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
-               darken1         = no_tint;
-               darken2         = tint_color(no_tint, B_DARKEN_1_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_3_TINT);
-
-               barColor.red    = (fBarColor.red + no_tint.red) / 2;
-               barColor.green  = (fBarColor.green + no_tint.green) / 2;
-               barColor.blue   = (fBarColor.blue + no_tint.blue) / 2;
-               barColor.alpha  = 255;
-
-               fillColor.red   = (fFillColor.red + no_tint.red) / 2;
-               fillColor.green = (fFillColor.green + no_tint.green) / 2;
-               fillColor.blue  = (fFillColor.blue + no_tint.blue) / 2;
-               fillColor.alpha = 255;
-       }
-
-       // exclude the block thumb from the bar filling
-
-       BRect lowerFrame = frame.InsetByCopy(1, 1);
-       lowerFrame.top++;
-       lowerFrame.left++;
-       BRect upperFrame = lowerFrame;
-       BRect thumbFrame;
-
-       if (Style() == B_BLOCK_THUMB) {
-               thumbFrame = ThumbFrame();
-
-               if (fOrientation == B_HORIZONTAL) {
-                       lowerFrame.right = thumbFrame.left;
-                       upperFrame.left = thumbFrame.right;
-               } else {
-                       lowerFrame.top = thumbFrame.bottom;
-                       upperFrame.bottom = thumbFrame.top;
-               }
-       } else if (fUseFillColor) {
-               if (fOrientation == B_HORIZONTAL) {
-                       lowerFrame.right = floor(lowerFrame.left - 1 + 
Position()
-                               * (lowerFrame.Width() + 1));
-                       upperFrame.left = lowerFrame.right;
-               } else {
-                       lowerFrame.top = floor(lowerFrame.bottom + 1 - 
Position()
-                               * (lowerFrame.Height() + 1));
-                       upperFrame.bottom = lowerFrame.top;
-               }
-       }
-
-       view->SetHighColor(barColor);
-       view->FillRect(upperFrame);
-
-       if (Style() == B_BLOCK_THUMB || fUseFillColor) {
-               if (fUseFillColor)
-                       view->SetHighColor(fillColor);
-               view->FillRect(lowerFrame);
-       }
-
-       if (Style() == B_BLOCK_THUMB) {
-               // We don't want to stroke the lines over the thumb
-
-               PushState();
-
-               BRegion region;
-               GetClippingRegion(&region);
-               region.Exclude(thumbFrame);
-               ConstrainClippingRegion(&region);
-       }
-
-       view->SetHighColor(darken1);
-       view->StrokeLine(BPoint(frame.left, frame.top),
-               BPoint(frame.left + 1.0f, frame.top));
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               BPoint(frame.left + 1.0f, frame.bottom));
-       view->StrokeLine(BPoint(frame.right - 1.0f, frame.top),
-               BPoint(frame.right, frame.top));
-
-       view->SetHighColor(darken2);
-       view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-               BPoint(frame.right - 1.0f, frame.top));
-       view->StrokeLine(BPoint(frame.left, frame.bottom - 1.0f),
-               BPoint(frame.left, frame.top + 1.0f));
-
-       view->SetHighColor(lightenmax);
-       view->StrokeLine(BPoint(frame.left + 1.0f, frame.bottom),
-               BPoint(frame.right, frame.bottom));
-       view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-               BPoint(frame.right, frame.top + 1.0f));
-
-       frame.InsetBy(1.0f, 1.0f);
-
-       view->SetHighColor(darkenmax);
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               BPoint(frame.left, frame.top));
-       view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-               BPoint(frame.right, frame.top));
-
-       if (Style() == B_BLOCK_THUMB)
-               PopState();
+       uint32 flags = be_control_look->Flags(this);
+       rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+       rgb_color rightFillColor = fBarColor;
+       rgb_color leftFillColor = fUseFillColor ? fFillColor : fBarColor;
+       be_control_look->DrawSliderBar(view, frame, frame, base, leftFillColor,
+               rightFillColor, Position(), flags, fOrientation);
 }
 
 
@@ -1043,85 +920,10 @@ BSlider::DrawHashMarks()
        BRect frame = HashMarksFrame();
        BView* view = OffscreenView();
 
-       if (be_control_look != NULL) {
-               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-               uint32 flags = be_control_look->Flags(this);
-               be_control_look->DrawSliderHashMarks(view, frame, frame, base,
-                       fHashMarkCount, fHashMarks, flags, fOrientation);
-               return;
-       }
-
-       rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       rgb_color lightenmax;
-       rgb_color darken2;
-
-       if (IsEnabled()) {
-               lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
-               darken2 = tint_color(no_tint, B_DARKEN_2_TINT);
-       } else {
-               lightenmax = tint_color(no_tint, B_LIGHTEN_2_TINT);
-               darken2 = tint_color(no_tint, B_DARKEN_1_TINT);
-       }
-
-       float pos = _MinPosition();
-       int32 hashMarkCount = std::max(fHashMarkCount, (int32)2);
-               // draw at least two hashmarks at min/max if
-               // fHashMarks != B_HASH_MARKS_NONE
-       float factor = (_MaxPosition() - pos) / (hashMarkCount - 1);
-
-       if ((fHashMarks & B_HASH_MARKS_TOP) != 0) {
-               view->BeginLineArray(hashMarkCount * 2);
-
-               if (fOrientation == B_HORIZONTAL) {
-                       for (int32 i = 0; i < hashMarkCount; i++) {
-                               view->AddLine(BPoint(pos, frame.top),
-                                                         BPoint(pos, frame.top 
+ 5), darken2);
-                               view->AddLine(BPoint(pos + 1, frame.top),
-                                                         BPoint(pos + 1, 
frame.top + 5), lightenmax);
-
-                               pos += factor;
-                       }
-               } else {
-                       for (int32 i = 0; i < hashMarkCount; i++) {
-                               view->AddLine(BPoint(frame.left, pos),
-                                                         BPoint(frame.left + 
5, pos), darken2);
-                               view->AddLine(BPoint(frame.left, pos + 1),
-                                                         BPoint(frame.left + 
5, pos + 1), lightenmax);
-
-                               pos += factor;
-                       }
-               }
-
-               view->EndLineArray();
-       }
-
-       pos = _MinPosition();
-
-       if ((fHashMarks & B_HASH_MARKS_BOTTOM) != 0) {
-               view->BeginLineArray(hashMarkCount * 2);
-
-               if (fOrientation == B_HORIZONTAL) {
-                       for (int32 i = 0; i < hashMarkCount; i++) {
-                               view->AddLine(BPoint(pos, frame.bottom - 5),
-                                                         BPoint(pos, 
frame.bottom), darken2);
-                               view->AddLine(BPoint(pos + 1, frame.bottom - 5),
-                                                         BPoint(pos + 1, 
frame.bottom), lightenmax);
-
-                               pos += factor;
-                       }
-               } else {
-                       for (int32 i = 0; i < hashMarkCount; i++) {
-                               view->AddLine(BPoint(frame.right - 5, pos),
-                                                         BPoint(frame.right, 
pos), darken2);
-                               view->AddLine(BPoint(frame.right - 5, pos + 1),
-                                                         BPoint(frame.right, 
pos + 1), lightenmax);
-
-                               pos += factor;
-                       }
-               }
-
-               view->EndLineArray();
-       }
+       rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+       uint32 flags = be_control_look->Flags(this);
+       be_control_look->DrawSliderHashMarks(view, frame, frame, base,
+               fHashMarkCount, fHashMarks, flags, fOrientation);
 }
 
 
@@ -1170,65 +972,36 @@ BSlider::DrawText()
        BView* view = OffscreenView();
 
        rgb_color base = LowColor();
-       uint32 flags = 0;
-       if (be_control_look == NULL) {
-               if (IsEnabled())
-                       view->SetHighColor(0, 0, 0);
-               else
-                       view->SetHighColor(tint_color(LowColor(), 
B_DISABLED_LABEL_TINT));
-       } else {
-               flags = be_control_look->Flags(this);
+       uint32 flags = be_control_look->Flags(this);
 
-               // erase the is control flag before drawing the label so that 
the label
-               // will get drawn using B_PANEL_TEXT_COLOR
-               flags &= ~BControlLook::B_IS_CONTROL;
-       }
+       // erase the is control flag before drawing the label so that the label
+       // will get drawn using B_PANEL_TEXT_COLOR
+       flags &= ~BControlLook::B_IS_CONTROL;
 
        font_height fontHeight;
        GetFontHeight(&fontHeight);
        if (Orientation() == B_HORIZONTAL) {
                if (Label() != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(Label(),
-                                       BPoint(0.0, ceilf(fontHeight.ascent)));
-                       } else {
-                               be_control_look->DrawLabel(view, Label(), base, 
flags,
-                                       BPoint(0.0, ceilf(fontHeight.ascent)));
-                       }
+                       be_control_look->DrawLabel(view, Label(), base, flags,
+                               BPoint(0.0f, ceilf(fontHeight.ascent)));
                }
 
                // the update text is updated in SetValue() only
                if (fUpdateText != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fUpdateText, 
BPoint(bounds.right
-                                       - StringWidth(fUpdateText), 
ceilf(fontHeight.ascent)));
-                       } else {
-                               be_control_look->DrawLabel(view, fUpdateText, 
base, flags,
-                                       BPoint(bounds.right - 
StringWidth(fUpdateText),
-                                               ceilf(fontHeight.ascent)));
-                       }
+                       be_control_look->DrawLabel(view, fUpdateText, base, 
flags,
+                               BPoint(bounds.right - StringWidth(fUpdateText),
+                                       ceilf(fontHeight.ascent)));
                }
 
                if (fMinLimitLabel != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fMinLimitLabel, BPoint(0.0, 
bounds.bottom
-                                       - fontHeight.descent));
-                       } else {
-                               be_control_look->DrawLabel(view, 
fMinLimitLabel, base, flags,
-                                       BPoint(0.0, bounds.bottom - 
fontHeight.descent));
-                       }
+                       be_control_look->DrawLabel(view, fMinLimitLabel, base, 
flags,
+                               BPoint(0.0f, bounds.bottom - 
fontHeight.descent));
                }
 
                if (fMaxLimitLabel != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fMaxLimitLabel, 
BPoint(bounds.right
-                                       - StringWidth(fMaxLimitLabel), 
bounds.bottom
-                                       - fontHeight.descent));
-                       } else {
-                               be_control_look->DrawLabel(view, 
fMaxLimitLabel, base, flags,
-                                       BPoint(bounds.right - 
StringWidth(fMaxLimitLabel),
-                                               bounds.bottom - 
fontHeight.descent));
-                       }
+                       be_control_look->DrawLabel(view, fMaxLimitLabel, base, 
flags,
+                               BPoint(bounds.right - 
StringWidth(fMaxLimitLabel),
+                                       bounds.bottom - fontHeight.descent));
                }
        } else {
                float lineHeight = ceilf(fontHeight.ascent) + 
ceilf(fontHeight.descent)
@@ -1236,51 +1009,31 @@ BSlider::DrawText()
                float baseLine = ceilf(fontHeight.ascent);
 
                if (Label() != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(Label(), BPoint((bounds.Width()
-                                       - StringWidth(Label())) / 2.0, 
baseLine));
-                       } else {
-                               be_control_look->DrawLabel(view, Label(), base, 
flags,
-                                       BPoint((bounds.Width() - 
StringWidth(Label())) / 2.0,
-                                               baseLine));
-                       }
+                       be_control_look->DrawLabel(view, Label(), base, flags,
+                               BPoint((bounds.Width() - StringWidth(Label())) 
/ 2.0,
+                                       baseLine));
                        baseLine += lineHeight;
                }
 
                if (fMaxLimitLabel != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fMaxLimitLabel, 
BPoint((bounds.Width()
-                                       - StringWidth(fMaxLimitLabel)) / 2.0, 
baseLine));
-                       } else {
-                               be_control_look->DrawLabel(view, 
fMaxLimitLabel, base, flags,
-                                       BPoint((bounds.Width()
-                                               - StringWidth(fMaxLimitLabel)) 
/ 2.0, baseLine));
-                       }
+                       be_control_look->DrawLabel(view, fMaxLimitLabel, base, 
flags,
+                               BPoint((bounds.Width() - 
StringWidth(fMaxLimitLabel)) / 2.0,
+                                       baseLine));
                }
 
                baseLine = bounds.bottom - ceilf(fontHeight.descent);
 
                if (fMinLimitLabel != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fMinLimitLabel, 
BPoint((bounds.Width()
-                                       - StringWidth(fMinLimitLabel)) / 2.0, 
baseLine));
-                       } else {
-                               be_control_look->DrawLabel(view, 
fMinLimitLabel, base, flags,
-                                       BPoint((bounds.Width()
-                                               - StringWidth(fMinLimitLabel)) 
/ 2.0, baseLine));
-                       }
-                       baseLine -= lineHeight;
+                       be_control_look->DrawLabel(view, fMinLimitLabel, base, 
flags,
+                               BPoint((bounds.Width() - 
StringWidth(fMinLimitLabel)) / 2.0,
+                                       baseLine));
+                               baseLine -= lineHeight;
                }
 
                if (fUpdateText != NULL) {
-                       if (be_control_look == NULL) {
-                               view->DrawString(fUpdateText, 
BPoint((bounds.Width()
-                                       - StringWidth(fUpdateText)) / 2.0, 
baseLine));
-                       } else {
-                               be_control_look->DrawLabel(view, fUpdateText, 
base, flags,
-                                       BPoint((bounds.Width()
-                                               - StringWidth(fUpdateText)) / 
2.0, baseLine));
-                       }
+                       be_control_look->DrawLabel(view, fUpdateText, base, 
flags,
+                               BPoint((bounds.Width() - 
StringWidth(fUpdateText)) / 2.0,
+                                       baseLine));
                }
        }
 }
@@ -1841,132 +1594,10 @@ BSlider::_DrawBlockThumb()
        BRect frame = ThumbFrame();
        BView* view = OffscreenView();
 
-       if (be_control_look != NULL) {
-               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-               uint32 flags = be_control_look->Flags(this);
-               be_control_look->DrawSliderThumb(view, frame, frame, base, 
flags,
-                       fOrientation);
-               return;
-       }
-
-       rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       rgb_color lighten2;
-       rgb_color lighten1;
-       rgb_color darken2;
-       rgb_color darken3;
-       rgb_color darkenmax;
-
-       if (IsEnabled()) {
-               lighten2        = tint_color(no_tint, B_LIGHTEN_2_TINT);
-               lighten1        = no_tint;
-               darken2         = tint_color(no_tint, B_DARKEN_2_TINT);
-               darken3         = tint_color(no_tint, B_DARKEN_3_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_MAX_TINT);
-       } else {
-               lighten2        = tint_color(no_tint, B_LIGHTEN_2_TINT);
-               lighten1        = tint_color(no_tint, B_LIGHTEN_1_TINT);
-               darken2         = tint_color(no_tint, (B_NO_TINT + 
B_DARKEN_1_TINT) / 2.0);
-               darken3         = tint_color(no_tint, B_DARKEN_1_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_3_TINT);
-       }
-
-       // blank background for shadow
-       // ToDo: this also draws over the hash marks
-       //       (though it's not *that* noticeable)
-       view->SetHighColor(no_tint);
-       view->StrokeLine(BPoint(frame.left, frame.top),
-               BPoint(frame.left, frame.top));
-
-       BRect barFrame = BarFrame();
-       if (barFrame.right >= frame.right) {
-               // leave out barFrame from shadow background clearing
-               view->StrokeLine(BPoint(frame.right, frame.top),
-                       BPoint(frame.right, barFrame.top - 1.0f));
-               view->StrokeLine(BPoint(frame.right, barFrame.bottom + 1.0f),
-                       BPoint(frame.right, frame.bottom));
-       } else {
-               view->StrokeLine(BPoint(frame.right, frame.top),
-                       BPoint(frame.right, frame.bottom));
-       }
-
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               BPoint(frame.right - 1.0f, frame.bottom));
-       view->StrokeLine(BPoint(frame.left, frame.bottom - 1.0f),
-               BPoint(frame.left, frame.bottom - 1.0f));
-       view->StrokeLine(BPoint(frame.right - 1.0f, frame.top),
-               BPoint(frame.right - 1.0f, frame.top));
-
-       // outline (top, left)
-       view->SetHighColor(darken3);
-       view->StrokeLine(BPoint(frame.left, frame.bottom - 2.0f),
-               BPoint(frame.left, frame.top + 1.0f));
-       view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-               BPoint(frame.right - 2.0f, frame.top));
-
-       // shadow
-       view->SetHighColor(0, 0, 0, IsEnabled() ? 100 : 50);
-       view->SetDrawingMode(B_OP_ALPHA);
-       view->StrokeLine(BPoint(frame.right, frame.top + 2.0f),
-               BPoint(frame.right, frame.bottom - 1.0f));
-       view->StrokeLine(BPoint(frame.left + 2.0f, frame.bottom),
-               BPoint(frame.right - 1.0f, frame.bottom));
-
-       view->SetDrawingMode(B_OP_COPY);
-       view->SetHighColor(darken3);
-       view->StrokeLine(BPoint(frame.right - 1.0f, frame.bottom - 1.0f),
-               BPoint(frame.right - 1.0f, frame.bottom - 1.0f));
-
-       // first bevel
-       frame.InsetBy(1.0f, 1.0f);
-
-       view->SetHighColor(darkenmax);
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               BPoint(frame.right - 1.0f, frame.bottom));
-       view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-               BPoint(frame.right, frame.top));
-
-       view->SetHighColor(lighten2);
-       view->StrokeLine(BPoint(frame.left, frame.top),
-               BPoint(frame.left, frame.bottom - 1.0f));
-       view->StrokeLine(BPoint(frame.left + 1.0f, frame.top),
-               BPoint(frame.right - 1.0f, frame.top));
-
-       frame.InsetBy(1.0f, 1.0f);
-
-       view->FillRect(BRect(frame.left, frame.top, frame.right - 1.0f,
-               frame.bottom - 1.0f));
-
-       // second bevel and center dots
-       view->SetHighColor(darken2);
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               Point(frame.right, frame.bottom));
-       view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-               Point(frame.right, frame.top));
-
-       if (Orientation() == B_HORIZONTAL) {
-               view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 2.0f),
-                       Point(frame.left + 6.0f, frame.top + 2.0f));
-               view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 4.0f),
-                       Point(frame.left + 6.0f, frame.top + 4.0f));
-               view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 6.0f),
-                       BPoint(frame.left + 6.0f, frame.top + 6.0f));
-       } else {
-               view->StrokeLine(BPoint(frame.left + 2.0f, frame.top + 6.0f),
-                       BPoint(frame.left + 2.0f, frame.top + 6.0f));
-               view->StrokeLine(BPoint(frame.left + 4.0f, frame.top + 6.0f),
-                       BPoint(frame.left + 4.0f, frame.top + 6.0f));
-               view->StrokeLine(BPoint(frame.left + 6.0f, frame.top + 6.0f),
-                       BPoint(frame.left + 6.0f, frame.top + 6.0f));
-       }
-
-       frame.InsetBy(1.0f, 1.0f);
-
-       // third bevel
-       view->SetHighColor(lighten1);
-       view->StrokeLine(BPoint(frame.left, frame.bottom),
-               BPoint(frame.right, frame.bottom));
-       view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0f),
-               BPoint(frame.right, frame.top));
+       rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+       uint32 flags = be_control_look->Flags(this);
+       be_control_look->DrawSliderThumb(view, frame, frame, base, flags,
+               fOrientation);
 }
 
 
@@ -1975,106 +1606,10 @@ BSlider::_DrawTriangleThumb()
 {
        BRect frame = ThumbFrame();
        BView* view = OffscreenView();
-
-       if (be_control_look != NULL) {
-               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-               uint32 flags = be_control_look->Flags(this);
-               be_control_look->DrawSliderTriangle(view, frame, frame, base, 
flags,
-                       fOrientation);
-               return;
-       }
-
-       rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       rgb_color lightenmax;
-       rgb_color lighten1;
-       rgb_color darken2;
-       rgb_color darken3;
-       rgb_color darkenmax;
-
-       if (IsEnabled()) {
-               lightenmax      = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
-               lighten1        = no_tint;
-               darken2         = tint_color(no_tint, B_DARKEN_2_TINT);
-               darken3         = tint_color(no_tint, B_DARKEN_3_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_MAX_TINT);
-       } else {
-               lightenmax      = tint_color(no_tint, B_LIGHTEN_2_TINT);
-               lighten1        = tint_color(no_tint, B_LIGHTEN_1_TINT);
-               darken2         = tint_color(no_tint, (B_NO_TINT + 
B_DARKEN_1_TINT) / 2);
-               darken3         = tint_color(no_tint, B_DARKEN_1_TINT);
-               darkenmax       = tint_color(no_tint, B_DARKEN_3_TINT);
-       }
-
-       if (Orientation() == B_HORIZONTAL) {
-               view->SetHighColor(lighten1);
-               view->FillTriangle(
-                       BPoint(frame.left + 1, frame.bottom - 3),
-                       BPoint((frame.left + frame.right) / 2, frame.top + 1),
-                       BPoint(frame.right - 1, frame.bottom - 3));
-
-               view->SetHighColor(no_tint);
-               view->StrokeLine(BPoint(frame.right - 2, frame.bottom - 3),
-                       BPoint(frame.left + 3, frame.bottom - 3));
-
-               view->SetHighColor(darkenmax);
-               view->StrokeLine(BPoint(frame.left, frame.bottom - 1),
-                       BPoint(frame.right, frame.bottom - 1));
-               view->StrokeLine(BPoint(frame.right, frame.bottom - 2),
-                       BPoint((frame.left + frame.right) / 2, frame.top));
-
-               view->SetHighColor(darken2);
-               view->StrokeLine(BPoint(frame.right - 1, frame.bottom - 2),
-                       BPoint(frame.left + 1, frame.bottom - 2));
-               view->SetHighColor(darken3);
-               view->StrokeLine(BPoint(frame.left, frame.bottom - 2),
-                       BPoint((frame.left + frame.right) / 2 - 1, frame.top + 
1));
-
-               view->SetHighColor(lightenmax);
-               view->StrokeLine(BPoint(frame.left + 2, frame.bottom - 3),
-                       BPoint((frame.left + frame.right) / 2, frame.top + 1));
-
-               // Shadow
-               view->SetHighColor(0, 0, 0, IsEnabled() ? 80 : 40);
-               view->SetDrawingMode(B_OP_ALPHA);
-               view->StrokeLine(BPoint(frame.left + 1, frame.bottom),
-                       BPoint(frame.right, frame.bottom));
-       } else {
-               view->SetHighColor(lighten1);
-               view->FillTriangle(
-                       BPoint(frame.left, (frame.top + frame.bottom) / 2),
-                       BPoint(frame.right - 1, frame.top + 1),
-                       BPoint(frame.right - 1, frame.bottom - 1));
-
-               view->SetHighColor(darkenmax);
-               view->StrokeLine(BPoint(frame.right - 1, frame.top),
-                       BPoint(frame.right - 1, frame.bottom));
-               view->StrokeLine(BPoint(frame.right - 1, frame.bottom),
-                       BPoint(frame.right - 2, frame.bottom));
-
-               view->SetHighColor(darken2);
-               view->StrokeLine(BPoint(frame.right - 2, frame.top + 2),
-                       BPoint(frame.right - 2, frame.bottom - 1));
-               view->StrokeLine(
-                       BPoint(frame.left, (frame.top + frame.bottom) / 2),
-                       BPoint(frame.right - 2, frame.top));
-               view->SetHighColor(darken3);
-               view->StrokeLine(
-                       BPoint(frame.left + 1, (frame.top + frame.bottom) / 2 + 
1),
-                       BPoint(frame.right - 3, frame.bottom - 1));
-
-               view->SetHighColor(lightenmax);
-               view->StrokeLine(
-                       BPoint(frame.left + 1, (frame.top + frame.bottom) / 2),
-                       BPoint(frame.right - 2, frame.top + 1));
-
-               // Shadow
-               view->SetHighColor(0, 0, 0, IsEnabled() ? 80 : 40);
-               view->SetDrawingMode(B_OP_ALPHA);
-               view->StrokeLine(BPoint(frame.right, frame.top + 1),
-                       BPoint(frame.right, frame.bottom));
-       }
-
-       view->SetDrawingMode(B_OP_COPY);
+       rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+       uint32 flags = be_control_look->Flags(this);
+       be_control_look->DrawSliderTriangle(view, frame, frame, base, flags,
+               fOrientation);
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev50163 - src/kits/interface - jscipione