[haiku-commits] haiku: hrev51368 - data/artwork/sticker src/kits/interface

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 20 Aug 2017 09:54:36 +0200 (CEST)

hrev51368 adds 5 changesets to branch 'master'
old head: dd645828666c3c2e870efd0144abe0352c08837a
new head: d47dec93566d7224797b3d33d6338ea7981247dd
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=d47dec93566d+%5Edd645828666c

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

a34769a0ccfd: BTabView: cleanup draw function.
  
  * Slightly changes how tabs look.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

                                  [ Kacper Kasper <kacperkasper@xxxxxxxxx> ]

173e8195a4ad: BTabView: remove dead code.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

                                  [ Kacper Kasper <kacperkasper@xxxxxxxxx> ]

cb13fce8785a: BTabView: implement drawing tabs on all sides.
  
  Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

                                  [ Kacper Kasper <kacperkasper@xxxxxxxxx> ]

1e80caa3094c: Add a white background version of the sticker
  
  - Uses the Haiku URL instead of "inspired by the BeOS"
  - Tweaked dimensions to match lastickerie.com templates (45x80mm + cutting 
margin)

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

d47dec93566d: Make gcc2 happy.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

4 files changed, 289 insertions(+), 118 deletions(-)
data/artwork/sticker/haiku-sticker-80x45mm | Bin 0 -> 175203 bytes
headers/os/interface/TabView.h             |  14 +-
src/kits/interface/ControlLook.cpp         |   9 +-
src/kits/interface/TabView.cpp             | 384 ++++++++++++++++++-------

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

Commit:      a34769a0ccfd7645d9bca6afff475c796772d97e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a34769a0ccfd
Author:      Kacper Kasper <kacperkasper@xxxxxxxxx>
Date:        Thu Aug 17 04:08:09 2017 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sun Aug 20 07:03:52 2017 UTC

BTabView: cleanup draw function.

* Slightly changes how tabs look.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

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

diff --git a/src/kits/interface/ControlLook.cpp 
b/src/kits/interface/ControlLook.cpp
index fbaadad..60ab9ae 100644
--- a/src/kits/interface/ControlLook.cpp
+++ b/src/kits/interface/ControlLook.cpp
@@ -1570,25 +1570,20 @@ BControlLook::DrawInactiveTab(BView* view, BRect& rect, 
const BRect& updateRect,
        }
 
        BRect background = rect;
-       uint32 bordersToDraw = 0;
        switch (side) {
                case B_TOP_BORDER:
-                       bordersToDraw = (B_LEFT_BORDER | B_TOP_BORDER | 
B_RIGHT_BORDER);
                        rect.top += 4;
                        background.bottom = rect.top;
                        break;
                case B_BOTTOM_BORDER:
-                       bordersToDraw = (B_LEFT_BORDER | B_BOTTOM_BORDER | 
B_RIGHT_BORDER);
                        rect.bottom -= 4;
                        background.top = rect.bottom;
                        break;
                case B_LEFT_BORDER:
-                       bordersToDraw = (B_LEFT_BORDER | B_BOTTOM_BORDER | 
B_TOP_BORDER);
                        rect.left += 4;
                        background.right = rect.left;
                        break;
                case B_RIGHT_BORDER:
-                       bordersToDraw = (B_RIGHT_BORDER | B_BOTTOM_BORDER | 
B_TOP_BORDER);
                        rect.right -= 4;
                        background.left = rect.right;
                break;
@@ -1600,10 +1595,10 @@ BControlLook::DrawInactiveTab(BView* view, BRect& rect, 
const BRect& updateRect,
 
        // frame and fill
        _DrawFrame(view, rect, edgeShadowColor, edgeShadowColor, edgeLightColor,
-               edgeLightColor, borders & bordersToDraw);
+               edgeLightColor, borders);
 
        _DrawFrame(view, rect, frameLightColor, frameLightColor, 
frameShadowColor,
-               frameShadowColor, borders & bordersToDraw);
+               frameShadowColor, borders);
 
        if (rect.IsValid()) {
                if (side == B_TOP_BORDER || side == B_BOTTOM_BORDER) {
diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index 590b4b9..030649d 100644
--- a/src/kits/interface/TabView.cpp
+++ b/src/kits/interface/TabView.cpp
@@ -274,7 +274,7 @@ BTab::DrawTab(BView* owner, BRect frame, tab_position 
position, bool full)
                borders |= BControlLook::B_RIGHT_BORDER;
 
        if (position == B_TAB_FRONT) {
-               frame.bottom += 1.0f;
+               frame.bottom -= 1.0f;
                be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0,
                        borders);
        } else {
@@ -789,8 +789,8 @@ BTabView::FocusTab() const
 void
 BTabView::Draw(BRect updateRect)
 {
-       DrawBox(TabFrame(fSelection));
        DrawTabs();
+       DrawBox(TabFrame(fSelection));
 
        if (IsFocus() && fFocus != -1)
                TabAt(fFocus)->DrawFocusMark(this, TabFrame(fFocus));
@@ -800,8 +800,6 @@ BTabView::Draw(BRect updateRect)
 BRect
 BTabView::DrawTabs()
 {
-       // TODO: Rewrite this method
-
        // draw an inactive tab frame behind all tabs
        BRect bounds(Bounds());
        bounds.bottom = fTabHeight;
@@ -813,13 +811,13 @@ BTabView::DrawTabs()
        } else
                borders |= BControlLook::B_LEFT_BORDER | 
BControlLook::B_RIGHT_BORDER;
 
-       // TODO: Why do we have to do this?
+       // DrawInactiveTab draws 2px border
+       // draw a little wider tab frame to align B_PLAIN_BORDER with it
        if (fBorderStyle == B_PLAIN_BORDER) {
                bounds.left -= 1;
                bounds.right += 1;
        }
 
-       // TODO: Doesn't draw bottom border, why?
        be_control_look->DrawInactiveTab(this, bounds, bounds, base, 0, 
borders);
 
        // draw the tabs on top of the inactive tab bounds
@@ -847,28 +845,6 @@ BTabView::DrawTabs()
                        BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER);
        }
 
-       // TODO: Why do we have to do this?
-       // TODO: Why don't we have to do this for B_FANCY_BORDER?
-       // TODO: Why does this draw the wrong color (152 instead of 151)
-       if (fBorderStyle != B_FANCY_BORDER) {
-               // draw the bottom border of the tabs
-               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-
-               // draw the bottom border left of the active tab
-               bounds = Bounds();
-               bounds.top = bounds.bottom = fTabHeight;
-               bounds.right = activeTabFrame.left;
-               be_control_look->DrawBorder(this, bounds, bounds, base, 
B_PLAIN_BORDER,
-                       0, BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER);
-
-               // draw the bottom border right of the active tab
-               bounds = Bounds();
-               bounds.top = bounds.bottom = fTabHeight;
-               bounds.left = activeTabFrame.right;
-               be_control_look->DrawBorder(this, bounds, bounds, base, 
B_PLAIN_BORDER,
-                       0, BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER);
-       }
-
        return fSelection < CountTabs() ? TabFrame(fSelection) : BRect();
 }
 
@@ -880,11 +856,12 @@ BTabView::DrawBox(BRect selectedTabRect)
        rect.top = fTabHeight;
 
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-       if (fBorderStyle == B_FANCY_BORDER)
-               be_control_look->DrawGroupFrame(this, rect, rect, base);
-       else if (fBorderStyle == B_PLAIN_BORDER) {
+       if (fBorderStyle == B_FANCY_BORDER) {
+               be_control_look->DrawGroupFrame(this, rect, rect, base,
+                       BControlLook::B_ALL_BORDERS & 
~BControlLook::B_TOP_BORDER);
+       } else if (fBorderStyle == B_PLAIN_BORDER) {
                be_control_look->DrawBorder(this, rect, rect, base, 
B_PLAIN_BORDER,
-                       0, BControlLook::B_ALL_BORDERS);
+                       0, BControlLook::B_ALL_BORDERS & 
~BControlLook::B_TOP_BORDER);
        } else
                ; // B_NO_BORDER draws no box
 }

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

Commit:      173e8195a4ad1d8acf932f363f12913e85851890
URL:         http://cgit.haiku-os.org/haiku/commit/?id=173e8195a4ad
Author:      Kacper Kasper <kacperkasper@xxxxxxxxx>
Date:        Sat Aug 19 13:41:35 2017 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sun Aug 20 07:04:05 2017 UTC

BTabView: remove dead code.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

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

diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index 030649d..1d589b1 100644
--- a/src/kits/interface/TabView.cpp
+++ b/src/kits/interface/TabView.cpp
@@ -904,39 +904,6 @@ BTabView::TabFrame(int32 index) const
                        return BRect(offset + index * width, 0.0f,
                                offset + index * width + width, height);
        }
-
-       // TODO: fix to remove "offset" in DrawTab and DrawLabel ...
-       switch (fTabWidthSetting) {
-               case B_WIDTH_FROM_LABEL:
-               {
-                       float x = 6.0f;
-                       for (int32 i = 0; i < index; i++){
-                               x += StringWidth(TabAt(i)->Label()) + 20.0f;
-                       }
-
-                       return BRect(x - fTabOffset, 0.0f,
-                               x - fTabOffset + 
StringWidth(TabAt(index)->Label()) + 20.0f,
-                               fTabHeight);
-               }
-
-               case B_WIDTH_FROM_WIDEST:
-               {
-                       float width = 0.0f;
-
-                       for (int32 i = 0; i < CountTabs(); i++) {
-                               float tabWidth = StringWidth(TabAt(i)->Label()) 
+ 20.0f;
-                               if (tabWidth > width)
-                                       width = tabWidth;
-                       }
-                       return BRect((6.0f + index * width) - fTabOffset, 0.0f,
-                               (6.0f + index * width + width) - fTabOffset, 
fTabHeight);
-               }
-
-               case B_WIDTH_AS_USUAL:
-               default:
-                       return BRect((6.0f + index * 100.0f) - fTabOffset, 0.0f,
-                               (6.0f + index * 100.0f + 100.0f) - fTabOffset, 
fTabHeight);
-       }
 }
 
 

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

Commit:      cb13fce8785a0d0fa5b5249dbd3737ecf920b875
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cb13fce8785a
Author:      Kacper Kasper <kacperkasper@xxxxxxxxx>
Date:        Sat Aug 19 17:32:31 2017 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sun Aug 20 07:04:05 2017 UTC

BTabView: implement drawing tabs on all sides.

Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

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

diff --git a/headers/os/interface/TabView.h b/headers/os/interface/TabView.h
index 1547610..03b485e 100644
--- a/headers/os/interface/TabView.h
+++ b/headers/os/interface/TabView.h
@@ -86,6 +86,13 @@ private:
 
 class BTabView : public BView {
 public:
+                       enum tab_side {
+                               kLeftSide       = 1 << 0,
+                               kRightSide      = 1 << 1,
+                               kTopSide        = 1 << 2,
+                               kBottomSide     = 1 << 3
+                       };
+
                                                                BTabView(const 
char* name,
                                                                        
button_width width = B_WIDTH_AS_USUAL,
                                                                        uint32 
flags = B_FULL_UPDATE_ON_RESIZE
@@ -165,6 +172,9 @@ public:
        virtual void                            SetBorder(border_style 
borderStyle);
                        border_style            Border() const;
 
+       virtual void                            SetTabSide(tab_side tabSide);
+                       tab_side                        TabSide() const;
+
                        BView*                          ContainerView() const;
 
                        int32                           CountTabs() const;
@@ -172,7 +182,6 @@ public:
 
 private:
        // FBC padding and forbidden methods
-       virtual void                            _ReservedTabView2();
        virtual void                            _ReservedTabView3();
        virtual void                            _ReservedTabView4();
        virtual void                            _ReservedTabView5();
@@ -205,8 +214,9 @@ private:
                        int32                           fFocus;
                        float                           fTabOffset;
                        border_style            fBorderStyle;
+                       tab_side                        fTabSide;
 
-                       uint32                          _reserved[10];
+                       uint32                          _reserved[9];
 };
 
 #endif // _TAB_VIEW_H
diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index 1d589b1..ddc4823 100644
--- a/src/kits/interface/TabView.cpp
+++ b/src/kits/interface/TabView.cpp
@@ -243,20 +243,74 @@ BTab::DrawFocusMark(BView* owner, BRect frame)
        owner->SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
 
        float offset = IsSelected() ? 3 : 2;
-       owner->StrokeLine(BPoint((frame.left + frame.right - width) / 2.0,
-                       frame.bottom - offset),
-               BPoint((frame.left + frame.right + width) / 2.0,
-                       frame.bottom - offset));
+       switch (fTabView->TabSide()) {
+               case BTabView::kTopSide:
+                       owner->StrokeLine(BPoint((frame.left + frame.right - 
width) / 2.0,
+                                       frame.bottom - offset),
+                               BPoint((frame.left + frame.right + width) / 2.0,
+                                       frame.bottom - offset));
+                       break;
+               case BTabView::kBottomSide:
+                       owner->StrokeLine(BPoint((frame.left + frame.right - 
width) / 2.0,
+                                       frame.top + offset),
+                               BPoint((frame.left + frame.right + width) / 2.0,
+                                       frame.top + offset));
+                       break;
+               case BTabView::kLeftSide:
+                       owner->StrokeLine(BPoint(frame.right - offset,
+                                       (frame.top + frame.bottom - width) / 
2.0),
+                               BPoint(frame.right - offset,
+                                       (frame.top + frame.bottom + width) / 
2.0));
+                       break;
+               case BTabView::kRightSide:
+                       owner->StrokeLine(BPoint(frame.left + offset,
+                                       (frame.top + frame.bottom - width) / 
2.0),
+                               BPoint(frame.left + offset,
+                                       (frame.top + frame.bottom + width) / 
2.0));
+                       break;
+       }
 }
 
 
 void
 BTab::DrawLabel(BView* owner, BRect frame)
 {
+       float rotation;
+       BPoint center(frame.left + frame.Width() / 2,
+               frame.top + frame.Height() / 2);
+       switch (fTabView->TabSide()) {
+               case BTabView::kTopSide:
+               case BTabView::kBottomSide:
+                       rotation = 0.0f;
+                       break;
+               case BTabView::kLeftSide:
+                       rotation = 270.0f;
+                       break;
+               case BTabView::kRightSide:
+                       rotation = 90.0f;
+                       break;
+       }
+
+       if (rotation != 0.0f) {
+               // DrawLabel doesn't allow rendering rotated text
+               // rotate frame first and BAffineTransform will handle the 
rotation
+               // we can't give "unrotated" frame because it comes from
+               // BTabView::TabFrame and it is also used to handle mouse clicks
+               BRect originalFrame(frame);
+               frame.top = center.y - originalFrame.Width() / 2;
+               frame.bottom = center.y + originalFrame.Width() / 2;
+               frame.left = center.x - originalFrame.Height() / 2;
+               frame.right = center.x + originalFrame.Height() / 2;
+       }
+
+       BAffineTransform transform;
+       transform.RotateBy(center, rotation * M_PI / 180.0f);
+       owner->SetTransform(transform);
        be_control_look->DrawLabel(owner, Label(), frame, frame,
                ui_color(B_PANEL_BACKGROUND_COLOR),
                IsEnabled() ? 0 : BPrivate::BControlLook::B_DISABLED,
                BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));
+       owner->SetTransform(BAffineTransform());
 }
 
 
@@ -264,22 +318,47 @@ void
 BTab::DrawTab(BView* owner, BRect frame, tab_position position, bool full)
 {
        rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       uint32 borders = BControlLook::B_TOP_BORDER
-               | BControlLook::B_BOTTOM_BORDER;
+       uint32 borders;
+       if (fTabView->TabSide() == BTabView::kTopSide
+               || fTabView->TabSide() == BTabView::kBottomSide) {
+               borders = BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER;
 
-       if (frame.left == owner->Bounds().left)
-               borders |= BControlLook::B_LEFT_BORDER;
+               if (frame.left == owner->Bounds().left)
+                       borders |= BControlLook::B_LEFT_BORDER;
 
-       if (frame.right == owner->Bounds().right)
-               borders |= BControlLook::B_RIGHT_BORDER;
+               if (frame.right == owner->Bounds().right)
+                       borders |= BControlLook::B_RIGHT_BORDER;
+       } else if (fTabView->TabSide() == BTabView::kLeftSide
+               || fTabView->TabSide() == BTabView::kRightSide) {
+               borders = BControlLook::B_LEFT_BORDER | 
BControlLook::B_RIGHT_BORDER;
+
+               if (frame.top == owner->Bounds().top)
+                       borders |= BControlLook::B_TOP_BORDER;
+
+               if (frame.bottom == owner->Bounds().bottom)
+                       borders |= BControlLook::B_BOTTOM_BORDER;
+       }
 
        if (position == B_TAB_FRONT) {
-               frame.bottom -= 1.0f;
+               switch (fTabView->TabSide()) {
+                       case BTabView::kTopSide:
+                               frame.bottom -= 1.0f;
+                               break;
+                       case BTabView::kBottomSide:
+                               frame.top += 1.0f;
+                               break;
+                       case BTabView::kLeftSide:
+                               frame.right -= 1.0f;
+                               break;
+                       case BTabView::kRightSide:
+                               frame.left += 1.0f;
+                               break;
+               }
                be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0,
-                       borders);
+                       borders, fTabView->TabSide());
        } else {
                be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 
0,
-                       borders);
+                       borders, fTabView->TabSide());
        }
 
        DrawLabel(owner, frame);
@@ -365,6 +444,9 @@ BTabView::BTabView(BMessage* archive)
        if (archive->FindInt32("_border_style", (int32*)&fBorderStyle) != B_OK)
                fBorderStyle = B_FANCY_BORDER;
 
+       if (archive->FindInt32("_TabSide", (int32*)&fTabSide) != B_OK)
+               fTabSide = kTopSide;
+
        int32 i = 0;
        BMessage tabMsg;
 
@@ -426,6 +508,8 @@ BTabView::Archive(BMessage* archive, bool deep) const
                result = archive->AddInt32("_sel", fSelection);
        if (result == B_OK && fBorderStyle != B_FANCY_BORDER)
                result = archive->AddInt32("_border_style", fBorderStyle);
+       if (result == B_OK && fTabSide != kTopSide)
+               result = archive->AddInt32("_TabSide", fTabSide);
 
        if (result == B_OK && deep) {
                for (int32 i = 0; i < CountTabs(); i++) {
@@ -642,9 +726,6 @@ BTabView::KeyDown(const char* bytes, int32 numBytes)
 void
 BTabView::MouseDown(BPoint where)
 {
-       if (where.y > fTabHeight)
-               return;
-
        for (int32 i = 0; i < CountTabs(); i++) {
                if (TabFrame(i).Contains(where)
                        && i != Selection()) {
@@ -800,28 +881,64 @@ BTabView::Draw(BRect updateRect)
 BRect
 BTabView::DrawTabs()
 {
-       // draw an inactive tab frame behind all tabs
        BRect bounds(Bounds());
-       bounds.bottom = fTabHeight;
+       BRect tabsBounds;
+       uint32 borders;
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-       uint32 borders = BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER;
-       if (fBorderStyle == B_NO_BORDER) {
-               // removes left border that is an artifact of DrawInactiveTab()
-               bounds.left -= 1;
-       } else
-               borders |= BControlLook::B_LEFT_BORDER | 
BControlLook::B_RIGHT_BORDER;
+       if (fTabSide == kTopSide || fTabSide == kBottomSide) {
+               if (fTabSide == kTopSide)
+                       bounds.bottom = fTabHeight;
+               else
+                       bounds.top = bounds.bottom - fTabHeight;
+               tabsBounds = bounds;
+                       // make a copy for later
+
+               // draw an inactive tab frame behind all tabs
+               borders = BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER;
+               if (fBorderStyle == B_NO_BORDER) {
+                       // removes left border that is an artifact of 
DrawInactiveTab()
+                       bounds.left -= 1;
+               } else {
+                       borders |= BControlLook::B_LEFT_BORDER
+                               | BControlLook::B_RIGHT_BORDER;
+               }
+
+               // DrawInactiveTab draws 2px border
+               // draw a little wider tab frame to align B_PLAIN_BORDER with it
+               if (fBorderStyle == B_PLAIN_BORDER) {
+                       bounds.left -= 1;
+                       bounds.right += 1;
+               }
+       } else if (fTabSide == kLeftSide || fTabSide == kRightSide) {
+               if (fTabSide == kLeftSide)
+                       bounds.right = fTabHeight;
+               else
+                       bounds.left = bounds.right - fTabHeight;
+               tabsBounds = bounds;
+                       // make a copy for later
+
+               // draw an inactive tab frame behind all tabs
+               borders = BControlLook::B_LEFT_BORDER | 
BControlLook::B_RIGHT_BORDER;
+               if (fBorderStyle == B_NO_BORDER) {
+                       // removes top border that is an artifact of 
DrawInactiveTab()
+                       bounds.top -= 1;
+               } else {
+                       borders |= BControlLook::B_TOP_BORDER
+                               | BControlLook::B_BOTTOM_BORDER;
+               }
 
-       // DrawInactiveTab draws 2px border
-       // draw a little wider tab frame to align B_PLAIN_BORDER with it
-       if (fBorderStyle == B_PLAIN_BORDER) {
-               bounds.left -= 1;
-               bounds.right += 1;
+               // DrawInactiveTab draws 2px border
+               // draw a little wider tab frame to align B_PLAIN_BORDER with it
+               if (fBorderStyle == B_PLAIN_BORDER) {
+                       bounds.top -= 1;
+                       bounds.bottom += 1;
+               }
        }
 
-       be_control_look->DrawInactiveTab(this, bounds, bounds, base, 0, 
borders);
+       be_control_look->DrawInactiveTab(this, bounds, bounds, base, 0,
+               borders, fTabSide);
 
        // draw the tabs on top of the inactive tab bounds
-       float right = 0.0f;
        BRect activeTabFrame;
        int32 tabCount = CountTabs();
        for (int32 i = 0; i < tabCount; i++) {
@@ -830,19 +947,29 @@ BTabView::DrawTabs()
                        activeTabFrame = tabFrame;
 
                TabAt(i)->DrawTab(this, tabFrame,
-                       i == fSelection ? B_TAB_FRONT : (i == 0) ? B_TAB_FIRST 
: B_TAB_ANY,
+                       i == fSelection ? B_TAB_FRONT :
+                               (i == 0) ? B_TAB_FIRST : B_TAB_ANY,
                        i + 1 != fSelection);
-               right = tabFrame.right;
        }
 
-       if (right < bounds.right) {
+       float last = 0.0f;
+       float lastTab = 0.0f;
+       if (fTabSide == kTopSide || fTabSide == kBottomSide) {
+               lastTab = TabFrame(tabCount - 1).right;
+               last = bounds.right;
+               tabsBounds.left = tabsBounds.right = lastTab;
+               borders = BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER;
+       } else if (fTabSide == kLeftSide || fTabSide == kRightSide) {
+               lastTab = TabFrame(tabCount - 1).bottom;
+               last = bounds.bottom;
+               tabsBounds.top = tabsBounds.bottom = lastTab;
+               borders = BControlLook::B_LEFT_BORDER | 
BControlLook::B_RIGHT_BORDER;
+       }
+
+       if (lastTab < last) {
                // draw a 1px right border on the last tab
-               bounds = Bounds();
-               bounds.left = bounds.right = right;
-               bounds.bottom = fTabHeight;
-               borders = BControlLook::B_TOP_BORDER;
-               be_control_look->DrawInactiveTab(this, bounds, bounds, base, 0,
-                       BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER);
+               be_control_look->DrawInactiveTab(this, tabsBounds, tabsBounds, 
base, 0,
+                       borders, fTabSide);
        }
 
        return fSelection < CountTabs() ? TabFrame(fSelection) : BRect();
@@ -853,15 +980,32 @@ void
 BTabView::DrawBox(BRect selectedTabRect)
 {
        BRect rect(Bounds());
-       rect.top = fTabHeight;
+       uint32 bordersToDraw = BControlLook::B_ALL_BORDERS;
+       switch (fTabSide) {
+               case kTopSide:
+                       bordersToDraw &= ~BControlLook::B_TOP_BORDER;
+                       rect.top = fTabHeight;
+                       break;
+               case kBottomSide:
+                       bordersToDraw &= ~BControlLook::B_BOTTOM_BORDER;
+                       rect.bottom -= fTabHeight;
+                       break;
+               case kLeftSide:
+                       bordersToDraw &= ~BControlLook::B_LEFT_BORDER;
+                       rect.left = fTabHeight;
+                       break;
+               case kRightSide:
+                       bordersToDraw &= ~BControlLook::B_RIGHT_BORDER;
+                       rect.right -= fTabHeight;
+                       break;
+       }
 
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
-       if (fBorderStyle == B_FANCY_BORDER) {
-               be_control_look->DrawGroupFrame(this, rect, rect, base,
-                       BControlLook::B_ALL_BORDERS & 
~BControlLook::B_TOP_BORDER);
-       } else if (fBorderStyle == B_PLAIN_BORDER) {
+       if (fBorderStyle == B_FANCY_BORDER)
+               be_control_look->DrawGroupFrame(this, rect, rect, base, 
bordersToDraw);
+       else if (fBorderStyle == B_PLAIN_BORDER) {
                be_control_look->DrawBorder(this, rect, rect, base, 
B_PLAIN_BORDER,
-                       0, BControlLook::B_ALL_BORDERS & 
~BControlLook::B_TOP_BORDER);
+                       0, bordersToDraw);
        } else
                ; // B_NO_BORDER draws no box
 }
@@ -876,6 +1020,7 @@ BTabView::TabFrame(int32 index) const
        float width = 100.0f;
        float height = fTabHeight;
        float offset = BControlLook::ComposeSpacing(B_USE_WINDOW_SPACING);
+       BRect bounds(Bounds());
 
        switch (fTabWidthSetting) {
                case B_WIDTH_FROM_LABEL:
@@ -885,9 +1030,25 @@ BTabView::TabFrame(int32 index) const
                                x += StringWidth(TabAt(i)->Label()) + 20.0f;
                        }
 
-                       return BRect(offset + x, 0.0f,
-                               offset + x + StringWidth(TabAt(index)->Label()) 
+ 20.0f,
-                               height);
+                       switch (fTabSide) {
+                               case kTopSide:
+                                       return BRect(offset + x, 0.0f,
+                                               offset + x + 
StringWidth(TabAt(index)->Label()) + 20.0f,
+                                               height);
+                               case kBottomSide:
+                                       return BRect(offset + x, bounds.bottom 
- height,
+                                               offset + x + 
StringWidth(TabAt(index)->Label()) + 20.0f,
+                                               bounds.bottom);
+                               case kLeftSide:
+                                       return BRect(0.0f, offset + x, height, 
offset + x
+                                               + 
StringWidth(TabAt(index)->Label()) + 20.0f);
+                               case kRightSide:
+                                       return BRect(bounds.right - height, 
offset + x,
+                                               bounds.right, offset + x
+                                                       + 
StringWidth(TabAt(index)->Label()) + 20.0f);
+                               default:
+                                       return BRect();
+                       }
                }
 
                case B_WIDTH_FROM_WIDEST:
@@ -901,8 +1062,22 @@ BTabView::TabFrame(int32 index) const
 
                case B_WIDTH_AS_USUAL:
                default:
-                       return BRect(offset + index * width, 0.0f,
-                               offset + index * width + width, height);
+                       switch (fTabSide) {
+                               case kTopSide:
+                                       return BRect(offset + index * width, 
0.0f,
+                                               offset + index * width + width, 
height);
+                               case kBottomSide:
+                                       return BRect(offset + index * width, 
bounds.bottom - height,
+                                               offset + index * width + width, 
bounds.bottom);
+                               case kLeftSide:
+                                       return BRect(0.0f, offset + index * 
width, height,
+                                               offset + index * width + width);
+                               case kRightSide:
+                                       return BRect(bounds.right - height, 
offset + index * width,
+                                               bounds.right, offset + index * 
width + width);
+                               default:
+                                       return BRect();
+                       }
        }
 }
 
@@ -1153,6 +1328,24 @@ BTabView::Border() const
 }
 
 
+void
+BTabView::SetTabSide(tab_side tabSide)
+{
+       if (fTabSide == tabSide)
+               return;
+
+       fTabSide = tabSide;
+       _LayoutContainerView(Flags() & B_SUPPORTS_LAYOUT);
+}
+
+
+BTabView::tab_side
+BTabView::TabSide() const
+{
+       return fTabSide;
+}
+
+
 BView*
 BTabView::ContainerView() const
 {
@@ -1188,6 +1381,7 @@ BTabView::_InitObject(bool layouted, button_width width)
        fFocus = -1;
        fTabOffset = 0.0f;
        fBorderStyle = B_FANCY_BORDER;
+       fTabSide = kTopSide;
 
        SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
        SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
@@ -1292,13 +1486,42 @@ BTabView::_LayoutContainerView(bool layouted)
                }
                BGroupLayout* layout = dynamic_cast<BGroupLayout*>(GetLayout());
                if (layout != NULL) {
-                       layout->SetInsets(borderWidth, borderWidth + TabHeight()
-                               - topBorderOffset, borderWidth, borderWidth);
+                       float inset = borderWidth + TabHeight() - 
topBorderOffset;
+                       switch (fTabSide) {
+                               case kTopSide:
+                                       layout->SetInsets(borderWidth, inset, 
borderWidth,
+                                               borderWidth);
+                                       break;
+                               case kBottomSide:
+                                       layout->SetInsets(borderWidth, 
borderWidth, borderWidth,
+                                               inset);
+                                       break;
+                               case kLeftSide:
+                                       layout->SetInsets(inset, borderWidth, 
borderWidth,
+                                               borderWidth);
+                                       break;
+                               case kRightSide:
+                                       layout->SetInsets(borderWidth, 
borderWidth, inset,
+                                               borderWidth);
+                                       break;
+                       }
                }
        } else {
                BRect bounds = Bounds();
-
-               bounds.top += TabHeight();
+               switch (fTabSide) {
+                       case kTopSide:
+                               bounds.top += TabHeight();
+                               break;
+                       case kBottomSide:
+                               bounds.bottom -= TabHeight();
+                               break;
+                       case kLeftSide:
+                               bounds.left += TabHeight();
+                               break;
+                       case kRightSide:
+                               bounds.right -= TabHeight();
+                               break;
+               }
                bounds.InsetBy(borderWidth, borderWidth);
 
                fContainerView->MoveTo(bounds.left, bounds.top);
@@ -1310,7 +1533,6 @@ BTabView::_LayoutContainerView(bool layouted)
 // #pragma mark - FBC and forbidden
 
 
-void BTabView::_ReservedTabView2() {}
 void BTabView::_ReservedTabView3() {}
 void BTabView::_ReservedTabView4() {}
 void BTabView::_ReservedTabView5() {}

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

Commit:      1e80caa3094cf9fd3a2436516da90b5268627065
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1e80caa3094c
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Aug 20 07:10:05 2017 UTC

Add a white background version of the sticker

- Uses the Haiku URL instead of "inspired by the BeOS"
- Tweaked dimensions to match lastickerie.com templates (45x80mm + cutting 
margin)

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

diff --git a/data/artwork/sticker/haiku-sticker-80x45mm 
b/data/artwork/sticker/haiku-sticker-80x45mm
new file mode 100644
index 0000000..d66ba8c
Binary files /dev/null and b/data/artwork/sticker/haiku-sticker-80x45mm differ

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

Revision:    hrev51368
Commit:      d47dec93566d7224797b3d33d6338ea7981247dd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d47dec93566d
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Aug 20 07:48:29 2017 UTC

Make gcc2 happy.

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

diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index ddc4823..271bc5f 100644
--- a/src/kits/interface/TabView.cpp
+++ b/src/kits/interface/TabView.cpp
@@ -275,7 +275,7 @@ BTab::DrawFocusMark(BView* owner, BRect frame)
 void
 BTab::DrawLabel(BView* owner, BRect frame)
 {
-       float rotation;
+       float rotation = 0.0f;
        BPoint center(frame.left + frame.Width() / 2,
                frame.top + frame.Height() / 2);
        switch (fTabView->TabSide()) {
@@ -318,7 +318,7 @@ void
 BTab::DrawTab(BView* owner, BRect frame, tab_position position, bool full)
 {
        rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
-       uint32 borders;
+       uint32 borders = 0;
        if (fTabView->TabSide() == BTabView::kTopSide
                || fTabView->TabSide() == BTabView::kBottomSide) {
                borders = BControlLook::B_TOP_BORDER | 
BControlLook::B_BOTTOM_BORDER;
@@ -883,7 +883,7 @@ BTabView::DrawTabs()
 {
        BRect bounds(Bounds());
        BRect tabsBounds;
-       uint32 borders;
+       uint32 borders = 0;
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
        if (fTabSide == kTopSide || fTabSide == kBottomSide) {
                if (fTabSide == kTopSide)


Other related posts:

  • » [haiku-commits] haiku: hrev51368 - data/artwork/sticker src/kits/interface - pulkomandy