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

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 10 Jan 2021 07:04:24 -0500 (EST)

hrev54866 adds 1 changeset to branch 'master'
old head: c37693ddac4766c9686f53b31957925dab7d0cd9
new head: e3927d6ad470a7f6c9df51aaddbbddc991b4a5ed
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=e3927d6ad470+%5Ec37693ddac47

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

e3927d6ad470: Haiku control look: bring back the tab seams
  
  They were accidentally removed in hrev54634 in an attempt to clean up
  the code.
  
  Reintroduce the old logic with some cleanup and improvements:
  - There was a mixup of "tab side" vs "border". The constant values for
    the two are the same, so it still worked as designed, but it made the
    code harder to follow since it deals with both borders and tab sides.
  - Define an isVertical boolean to decide if the tab view is vertical,
    avoiding repeated tests for specific tabview sides.
  
  Fixes #16640.

               [ Adrien Destugues <adrien.destugues@xxxxxxxxxxxxxxxxxxxxx> ]

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

Revision:    hrev54866
Commit:      e3927d6ad470a7f6c9df51aaddbbddc991b4a5ed
URL:         https://git.haiku-os.org/haiku/commit/?id=e3927d6ad470
Author:      Adrien Destugues <adrien.destugues@xxxxxxxxxxxxxxxxxxxxx>
Date:        Sun Jan 10 12:01:05 2021 UTC

Ticket:      https://dev.haiku-os.org/ticket/16640

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

1 file changed, 25 insertions(+), 16 deletions(-)
src/kits/interface/HaikuControlLook.cpp | 41 ++++++++++++++++++-----------

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

diff --git a/src/kits/interface/HaikuControlLook.cpp 
b/src/kits/interface/HaikuControlLook.cpp
index b77c091ad3..55ebae9dfb 100644
--- a/src/kits/interface/HaikuControlLook.cpp
+++ b/src/kits/interface/HaikuControlLook.cpp
@@ -1874,26 +1874,31 @@ HaikuControlLook::DrawInactiveTab(BView* view, BRect& 
rect,
        }
 
        BRect background = rect;
+       bool isVertical;
        switch (side) {
                default:
-               case B_TOP_BORDER:
+               case BTabView::kTopSide:
                        rect.top += 4;
                        background.bottom = rect.top;
+                       isVertical = false;
                        break;
 
-               case B_BOTTOM_BORDER:
+               case BTabView::kBottomSide:
                        rect.bottom -= 4;
                        background.top = rect.bottom;
+                       isVertical = false;
                        break;
 
-               case B_LEFT_BORDER:
+               case BTabView::kLeftSide:
                        rect.left += 4;
                        background.right = rect.left;
+                       isVertical = true;
                        break;
 
-               case B_RIGHT_BORDER:
+               case BTabView::kRightSide:
                        rect.right -= 4;
                        background.left = rect.right;
+                       isVertical = true;
                        break;
        }
 
@@ -1902,26 +1907,30 @@ HaikuControlLook::DrawInactiveTab(BView* view, BRect& 
rect,
        view->FillRect(background);
 
        // frame and fill
+       // Note that _DrawFrame also insets the rect, so each of the calls here
+       // operate on a smaller rect than the previous ones
        _DrawFrame(view, rect, edgeShadowColor, edgeShadowColor, edgeLightColor,
                edgeLightColor, borders);
 
        _DrawFrame(view, rect, frameLightColor, frameLightColor, 
frameShadowColor,
                frameShadowColor, borders);
 
-       if ((side == B_TOP_BORDER || side == B_BOTTOM_BORDER)
-               && (borders & B_LEFT_BORDER) != 0) {
-               if (rect.IsValid()) {
-                       _DrawFrame(view, rect, bevelShadowColor, 
bevelShadowColor,
-                               bevelLightColor, bevelLightColor, B_LEFT_BORDER 
& ~borders);
-               } else if ((B_LEFT_BORDER & ~borders) != 0)
-                       rect.left++;
-       } else if ((side == B_LEFT_BORDER || side == B_RIGHT_BORDER)
-               && (borders & B_TOP_BORDER) != 0) {
-               if (rect.IsValid()) {
+       if (rect.IsValid()) {
+               if (isVertical) {
                        _DrawFrame(view, rect, bevelShadowColor, 
bevelShadowColor,
                                bevelLightColor, bevelLightColor, B_TOP_BORDER 
& ~borders);
-               } else if ((B_TOP_BORDER & ~borders) != 0)
-                       rect.top++;
+               } else {
+                       _DrawFrame(view, rect, bevelShadowColor, 
bevelShadowColor,
+                               bevelLightColor, bevelLightColor, B_LEFT_BORDER 
& ~borders);
+               }
+       } else {
+               if (isVertical) {
+                       if ((B_LEFT_BORDER & ~borders) != 0)
+                               rect.left++;
+               } else {
+                       if ((B_TOP_BORDER & ~borders) != 0)
+                               rect.top++;
+               }
        }
 
        view->FillRect(rect, fillGradient);


Other related posts:

  • » [haiku-commits] haiku: hrev54866 - src/kits/interface - Adrien Destugues