[haiku-commits] haiku: hrev49691 - src/kits/tracker

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 15 Oct 2015 07:32:50 +0200 (CEST)

hrev49691 adds 1 changeset to branch 'master'
old head: e345b60486f011e19d17379a155161722a8faed2
new head: e01bbf955faa8fecafd747b08240781320d496dd
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=e01bbf955faa+%5Ee345b60486f0

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

e01bbf955faa: Tracker: Fix issue with vertical scroll bar border

This issue only manifested itself when the navigation toolbar was shown.

The scrollbar appeared to have no border while the rest did. This issue
manifested when the scrollbar insets were adjusted in hrev49654. The
scroll bar insets were really hiding the bug underlying bug though.

I'll try to explain what was happening and how I fixed it. The PoseView
container, called BorderedView, was showing its top border when the
navigation bar was hidden, and hiding its top border when the navigation
bar was shown. This (almost) worked because the menu bar provided a
bottom border while the navigation toolbar didn't. However hiding
BorderedView's top border also hid the scroll bar border.

My solution was to draw a bottom border on the navigation toolbar and
then remove the top border from BorderedView unconditionally. So either
the menu bar or the navigation toolbar provides a bottom border and the
BorderedView has no top border.

Fixes #12392

[ John Scipione <jscipione@xxxxxxxxx> ]

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

Revision: hrev49691
Commit: e01bbf955faa8fecafd747b08240781320d496dd
URL: http://cgit.haiku-os.org/haiku/commit/?id=e01bbf955faa
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Oct 15 04:32:55 2015 UTC

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

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

3 files changed, 24 insertions(+), 9 deletions(-)
src/kits/tracker/ContainerWindow.cpp | 9 +--------
src/kits/tracker/Navigator.cpp | 23 ++++++++++++++++++++++-
src/kits/tracker/Navigator.h | 1 +

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

diff --git a/src/kits/tracker/ContainerWindow.cpp
b/src/kits/tracker/ContainerWindow.cpp
index e96baf7..dfac6e3 100644
--- a/src/kits/tracker/ContainerWindow.cpp
+++ b/src/kits/tracker/ContainerWindow.cpp
@@ -731,9 +731,7 @@ BContainerWindow::CreatePoseView(Model* model)
&& !fPoseView->IsFilePanel()) {
fNavigator = new BNavigator(model);
fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2);
- if (settings.ShowNavigator())
- fBorderedView->GroupLayout()->SetInsets(1);
- else
+ if (!settings.ShowNavigator())
fNavigator->Hide();
}

@@ -1618,8 +1616,6 @@ BContainerWindow::MessageReceived(BMessage* message)

fPoseContainer->GridLayout()->AddView(fNavigator,
0, 0, 2);
fNavigator->Hide();
-
fBorderedView->GroupLayout()->SetInsets(1, 0,
- 1, 1);

SetPathWatchingEnabled(settings.ShowNavigator()
||
settings.ShowFullPathInTitleBar());
}
@@ -4072,8 +4068,6 @@ BContainerWindow::ShowNavigator(bool show)

if (PoseView()->VScrollBar())
PoseView()->UpdateScrollRange();
-
- fBorderedView->GroupLayout()->SetInsets(1);
} else {
if (!Navigator() || Navigator()->IsHidden())
return;
@@ -4082,7 +4076,6 @@ BContainerWindow::ShowNavigator(bool show)
PoseView()->UpdateScrollRange();

fNavigator->Hide();
- fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1);
}
}

diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp
index 679f58a..0f5eee9 100644
--- a/src/kits/tracker/Navigator.cpp
+++ b/src/kits/tracker/Navigator.cpp
@@ -35,6 +35,7 @@ All rights reserved.

#include "Navigator.h"

+#include <ControlLook.h>
#include <TextControl.h>
#include <Window.h>

@@ -67,7 +68,12 @@ BNavigator::BNavigator(const Model* model)
new BMessage(kNavigatorCommandLocation));
fLocation->SetDivider(0);

- GroupLayout()->SetInsets(0, 0, B_USE_HALF_ITEM_INSETS, 0);
+ GroupLayout()->SetInsets(0.0f, 0.0f, B_USE_HALF_ITEM_INSETS, 1.0f);
+ // 1px bottom inset used for border
+
+ // Needed to draw the bottom border
+ SetFlags(Flags() | B_WILL_DRAW);
+ SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}


@@ -115,6 +121,21 @@ BNavigator::AllAttached()


void
+BNavigator::Draw(BRect updateRect)
+{
+ // Draw a 1px bottom border, like BMenuBar
+ BRect rect(Bounds());
+ rgb_color base = LowColor();
+ uint32 flags = 0;
+
+ be_control_look->DrawBorder(this, rect, updateRect, base,
+ B_PLAIN_BORDER, flags, BControlLook::B_BOTTOM_BORDER);
+
+ _inherited::Draw(rect & updateRect);
+}
+
+
+void
BNavigator::MessageReceived(BMessage* message)
{
switch (message->what) {
diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h
index 82e879c..cf24129 100644
--- a/src/kits/tracker/Navigator.h
+++ b/src/kits/tracker/Navigator.h
@@ -76,6 +76,7 @@ protected:
virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow();
virtual void AllAttached();
+ virtual void Draw(BRect updateRect);

void GoForward(bool option);
// is option key held down?


Other related posts:

  • » [haiku-commits] haiku: hrev49691 - src/kits/tracker - jscipione