[haiku-commits] haiku: hrev45298 - in src/apps/webpositive: . tabview

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 18 Feb 2013 02:27:04 +0100 (CET)

hrev45298 adds 4 changesets to branch 'master'
old head: da08cea0e323e01ebb7a5a838fae99338ec099d2
new head: cdb4abbd185bf5a02ef0d7bbcba449bf60fc17b2
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=cdb4abb+%5Eda08cea

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

8236628: Style changes only

688daae: Don't offset close tab x on click

8848aa1: Update close find bar button to appear similar to close tab button.

cdb4abb: Add tooltips for close tab and close find bar

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

6 files changed, 112 insertions(+), 30 deletions(-)
src/apps/webpositive/BrowserWindow.cpp           | 87 ++++++++++++++++++--
src/apps/webpositive/Jamfile                     |  2 +-
src/apps/webpositive/WebPositive.rdef            |  2 -
.../webpositive/tabview/TabContainerView.cpp     |  5 +-
src/apps/webpositive/tabview/TabManager.cpp      | 16 +++-
src/apps/webpositive/tabview/TabView.cpp         | 30 ++++---

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

Commit:      8236628b59ddeb8a9d850d8baa84b51cf1842951
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8236628
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sun Feb 17 22:51:58 2013 UTC

Style changes only

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

diff --git a/src/apps/webpositive/WebPositive.rdef 
b/src/apps/webpositive/WebPositive.rdef
index b382c95..1eb69fe 100644
--- a/src/apps/webpositive/WebPositive.rdef
+++ b/src/apps/webpositive/WebPositive.rdef
@@ -327,5 +327,3 @@ resource(205, "kActionGo") archive BBitmap {
                
$"0000000000000000000000000000000000000000000000000000000000000000"
        }
 };
-
-
diff --git a/src/apps/webpositive/tabview/TabContainerView.cpp 
b/src/apps/webpositive/tabview/TabContainerView.cpp
index cca2380..8f9c899 100644
--- a/src/apps/webpositive/tabview/TabContainerView.cpp
+++ b/src/apps/webpositive/tabview/TabContainerView.cpp
@@ -227,6 +227,7 @@ TabContainerView::AddTab(TabView* tab, int32 index)
        _ValidateTabVisibility();
 }
 
+
 TabView*
 TabContainerView::RemoveTab(int32 index)
 {
@@ -330,9 +331,8 @@ TabContainerView::SelectTab(TabView* tab)
                if (fSelectedTab != NULL)
                        index = GroupLayout()->IndexOfItem(tab->LayoutItem());
 
-               if (!tab->LayoutItem()->IsVisible()) {
+               if (!tab->LayoutItem()->IsVisible())
                        SetFirstVisibleTabIndex(index);
-               }
 
                fController->TabSelected(index);
        }
@@ -539,4 +539,3 @@ TabContainerView::_SendFakeMouseMoved()
        if (Bounds().Contains(where))
                _MouseMoved(where, B_INSIDE_VIEW, NULL);
 }
-
diff --git a/src/apps/webpositive/tabview/TabView.cpp 
b/src/apps/webpositive/tabview/TabView.cpp
index 3bb78ec..7caeaaf 100644
--- a/src/apps/webpositive/tabview/TabView.cpp
+++ b/src/apps/webpositive/tabview/TabView.cpp
@@ -93,25 +93,28 @@ TabView::Draw(BRect updateRect)
 {
        BRect frame(fLayoutItem->Frame());
        if (fIsFront) {
-           // Extend the front tab outward left/right in order to merge
-           // the frames of adjacent tabs.
-           if (!fIsFirst)
-               frame.left--;
-           if (!fIsLast)
-               frame.right++;
-
-               frame.bottom++;
+               // Extend the front tab outward left/right in order to merge
+               // the frames of adjacent tabs.
+               if (!fIsFirst)
+                       frame.left--;
+               if (!fIsLast)
+                       frame.right++;
+
+               frame.bottom++;
        }
+
        DrawBackground(fContainerView, frame, updateRect, fIsFirst, fIsLast,
                fIsFront);
+
        if (fIsFront) {
-           frame.top += 3.0f;
-           if (!fIsFirst)
-               frame.left++;
-           if (!fIsLast)
-               frame.right--;
+               frame.top += 3.0f;
+               if (!fIsFirst)
+                       frame.left++;
+               if (!fIsLast)
+                       frame.right--;
        } else
                frame.top += 6.0f;
+
        float spacing = be_control_look->DefaultLabelSpacing();
        frame.InsetBy(spacing, spacing / 2);
        DrawContents(fContainerView, frame, updateRect, fIsFirst, fIsLast,
@@ -126,6 +129,7 @@ TabView::DrawBackground(BView* owner, BRect frame, const 
BRect& updateRect,
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
        uint32 borders = BControlLook::B_TOP_BORDER
                | BControlLook::B_BOTTOM_BORDER;
+
        if (isFirst)
                borders |= BControlLook::B_LEFT_BORDER;
        if (isLast)

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

Commit:      688daae9cc75fe02cc0dc063b8e07c8df5cdf54c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=688daae
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Mon Feb 18 00:02:05 2013 UTC

Don't offset close tab x on click

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

diff --git a/src/apps/webpositive/tabview/TabManager.cpp 
b/src/apps/webpositive/tabview/TabManager.cpp
index dd93387..ab2b6b5 100644
--- a/src/apps/webpositive/tabview/TabManager.cpp
+++ b/src/apps/webpositive/tabview/TabManager.cpp
@@ -636,7 +636,6 @@ void WebTabView::_DrawCloseButton(BView* owner, BRect& 
frame,
                be_control_look->DrawButtonBackground(owner, buttonRect, 
updateRect,
                        base, BControlLook::B_ACTIVATED);
                tint *= 1.2;
-               closeRect.OffsetBy(1, 1);
        }
 
        base = tint_color(base, tint);

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

Commit:      8848aa106ac425294093855870f3de8ac14cd18d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8848aa1
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Mon Feb 18 00:02:48 2013 UTC

Update close find bar button to appear similar to close tab button.

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

diff --git a/src/apps/webpositive/BrowserWindow.cpp 
b/src/apps/webpositive/BrowserWindow.cpp
index ee9e6b8..a24afc8 100644
--- a/src/apps/webpositive/BrowserWindow.cpp
+++ b/src/apps/webpositive/BrowserWindow.cpp
@@ -86,6 +86,7 @@
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "WebPositive Window"
 
+
 enum {
        OPEN_LOCATION                                                           
= 'open',
        GO_BACK                                                                 
        = 'goba',
@@ -239,6 +240,78 @@ private:
 };
 
 
+class CloseButton : public BButton {
+public:
+       CloseButton(BMessage* message)
+               :
+               BButton("close button", NULL, message),
+               fOverCloseRect(false)
+       {
+               // Button is 16x16 regardless of font size
+               SetExplicitMinSize(BSize(15, 15));
+               SetExplicitMaxSize(BSize(15, 15));
+       }
+
+       virtual void Draw(BRect updateRect)
+       {
+               BRect frame = Bounds();
+               BRect closeRect(frame.InsetByCopy(4, 4));
+               rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+               float tint = B_DARKEN_1_TINT;
+
+               if (fOverCloseRect)
+                       tint *= 1.2;
+
+               if (Value() == B_CONTROL_ON && fOverCloseRect) {
+                       // Draw the button frame
+                       be_control_look->DrawButtonFrame(this, frame, 
updateRect,
+                               base, base, BControlLook::B_ACTIVATED
+                                       | BControlLook::B_BLEND_FRAME);
+                       be_control_look->DrawButtonBackground(this, frame,
+                               updateRect, base, BControlLook::B_ACTIVATED);
+                       tint *= 1.2;
+               } else {
+                       SetHighColor(base);
+                       FillRect(updateRect);
+               }
+
+               // Draw the ×
+               base = tint_color(base, tint);
+               SetHighColor(base);
+               SetPenSize(2);
+               StrokeLine(closeRect.LeftTop(), closeRect.RightBottom());
+               StrokeLine(closeRect.LeftBottom(), closeRect.RightTop());
+               SetPenSize(1);
+       }
+
+       virtual void MouseMoved(BPoint where, uint32 transit,
+               const BMessage* dragMessage)
+       {
+               switch (transit) {
+                       case B_ENTERED_VIEW:
+                               fOverCloseRect = true;
+                               Invalidate();
+                               break;
+                       case B_EXITED_VIEW:
+                               fOverCloseRect = false;
+                               Invalidate();
+                               break;
+                       case B_INSIDE_VIEW:
+                               fOverCloseRect = true;
+                               break;
+                       case B_OUTSIDE_VIEW:
+                               fOverCloseRect = false;
+                               break;
+               }
+
+               BButton::MouseMoved(where, transit, dragMessage);
+       }
+
+private:
+       bool fOverCloseRect;
+};
+
+
 // #pragma mark - BrowserWindow
 
 
@@ -426,12 +499,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* 
appSettings,
        const float kElementSpacing = 5;
 
        // Find group
-       fFindCloseButton = new BButton("\xc3\x97", // multiplication sign
-               new BMessage(EDIT_HIDE_FIND_GROUP));
-       fFindCloseButton->SetExplicitMinSize(
-               BSize(be_control_look->DefaultItemSpacing() * 3, B_SIZE_UNSET));
-       fFindCloseButton->SetExplicitMaxSize(
-               BSize(be_control_look->DefaultItemSpacing() * 3, B_SIZE_UNSET));
+       fFindCloseButton = new CloseButton(new BMessage(EDIT_HIDE_FIND_GROUP));
        fFindTextControl = new BTextControl("find", B_TRANSLATE("Find:"), "",
                new BMessage(EDIT_FIND_NEXT));
        fFindTextControl->SetModificationMessage(new 
BMessage(FIND_TEXT_CHANGED));
@@ -442,7 +510,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* 
appSettings,
        fFindCaseSensitiveCheckBox = new BCheckBox(B_TRANSLATE("Match case"));
        BGroupLayout* findGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
                .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
-               .Add(BGroupLayoutBuilder(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
+               .Add(BGroupLayoutBuilder(B_HORIZONTAL, B_USE_SMALL_SPACING)
                        .Add(fFindCloseButton)
                        .Add(fFindTextControl)
                        .Add(fFindPreviousButton)

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

Revision:    hrev45298
Commit:      cdb4abbd185bf5a02ef0d7bbcba449bf60fc17b2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cdb4abb
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Mon Feb 18 01:26:33 2013 UTC

Add tooltips for close tab and close find bar

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

diff --git a/src/apps/webpositive/BrowserWindow.cpp 
b/src/apps/webpositive/BrowserWindow.cpp
index a24afc8..6bc4c94 100644
--- a/src/apps/webpositive/BrowserWindow.cpp
+++ b/src/apps/webpositive/BrowserWindow.cpp
@@ -252,6 +252,11 @@ public:
                SetExplicitMaxSize(BSize(15, 15));
        }
 
+       virtual void AttachedToWindow()
+       {
+               SetToolTip(B_TRANSLATE("Close find bar"));
+       }
+
        virtual void Draw(BRect updateRect)
        {
                BRect frame = Bounds();
diff --git a/src/apps/webpositive/Jamfile b/src/apps/webpositive/Jamfile
index df45942..a287626 100644
--- a/src/apps/webpositive/Jamfile
+++ b/src/apps/webpositive/Jamfile
@@ -74,5 +74,5 @@ Application WebPositive :
 DoCatalogs WebPositive :
        x-vnd.Haiku-WebPositive
        :
-        $(sources)
+       $(sources)
 ;
diff --git a/src/apps/webpositive/tabview/TabManager.cpp 
b/src/apps/webpositive/tabview/TabManager.cpp
index ab2b6b5..787e9a4 100644
--- a/src/apps/webpositive/tabview/TabManager.cpp
+++ b/src/apps/webpositive/tabview/TabManager.cpp
@@ -36,6 +36,7 @@
 #include <Button.h>
 #include <CardLayout.h>
 #include <ControlLook.h>
+#include <Catalog.h>
 #include <GroupView.h>
 #include <MenuBar.h>
 #include <MenuItem.h>
@@ -48,6 +49,10 @@
 #include "TabView.h"
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Tab Manager"
+
+
 const static BString kEmptyString;
 
 
@@ -579,9 +584,13 @@ WebTabView::MouseMoved(BPoint where, uint32 transit,
                        fOverCloseRect = overCloseRect;
                        ContainerView()->Invalidate(closeRect);
                }
-       }
-
-       fController->SetToolTip(Label());
+               // Set the Tooltip
+               if (overCloseRect)
+                       fController->SetToolTip(B_TRANSLATE("Close tab"));
+               else
+                       fController->SetToolTip(Label());
+       } else
+               fController->SetToolTip(Label());
 
        TabView::MouseMoved(where, transit, dragMessage);
 }


Other related posts: