[haiku-webkit-commits] r248 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sun, 28 Feb 2010 20:48:31 +0000

Author: stippi
Date: Sun Feb 28 20:48:31 2010
New Revision: 248
URL: http://mmlr.dyndns.org/changeset/248

Log:
Experimental integration of the main menu into the tab bar. Please tell me what
you think, I am not 100% it's nicer than before. Can be easily reverted in any
case.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp
   webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h
   webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp
   webkit/trunk/WebKit/haiku/WebPositive/WebTabView.h

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Sun Feb 28 
15:21:43 2010        (r247)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Sun Feb 28 
20:48:31 2010        (r248)
@@ -106,7 +106,8 @@
 
        if (toolbarPolicy == HaveToolbar) {
                // Menu
-               fMenuBar = new BMenuBar("Main menu");
+//             BMenu* mainMenu = new BMenuBar("Main menu");
+               BMenu* mainMenu = fTabManager->Menu();
                BMenu* menu = new BMenu("Window");
                BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
                newWindowMessage->AddString("url", "");
@@ -126,7 +127,7 @@
                BMenuItem* quitItem = new BMenuItem("Quit", new 
BMessage(B_QUIT_REQUESTED), 'Q');
                menu->AddItem(quitItem);
                quitItem->SetTarget(be_app);
-               fMenuBar->AddItem(menu);
+               mainMenu->AddItem(menu);
 
                menu = new BMenu("Text");
                menu->AddItem(new BMenuItem("Find", new 
BMessage(TEXT_SHOW_FIND_GROUP), 'F'));
@@ -134,10 +135,10 @@
                menu->AddItem(new BMenuItem("Increase size", new 
BMessage(TEXT_SIZE_INCREASE), '+'));
                menu->AddItem(new BMenuItem("Decrease size", new 
BMessage(TEXT_SIZE_DECREASE), '-'));
                menu->AddItem(new BMenuItem("Reset size", new 
BMessage(TEXT_SIZE_RESET), '0'));
-               fMenuBar->AddItem(menu);
+               mainMenu->AddItem(menu);
 
                fGoMenu = new BMenu("Go");
-               fMenuBar->AddItem(fGoMenu);
+               mainMenu->AddItem(fGoMenu);
 
                // Back, Forward & Stop
                fBackButton = new IconButton("Back", 0, NULL, new 
BMessage(GO_BACK));
@@ -175,8 +176,8 @@
                fLoadingProgressBar->Hide();
                fLoadingProgressBar->SetBarHeight(12);
 
-               const float kInsetSpacing = 5;
-               const float kElementSpacing = 7;
+               const float kInsetSpacing = 3;
+               const float kElementSpacing = 5;
 
                fFindTextControl = new BTextControl("find", "Find:", "",
                        new BMessage(TEXT_FIND_NEXT));
@@ -196,7 +197,7 @@
                ;
                // Layout
                AddChild(BGroupLayoutBuilder(B_VERTICAL)
-                       .Add(fMenuBar)
+//                     .Add(mainMenu)
                        .Add(fTabManager->TabGroup())
                        .Add(BGridLayoutBuilder(kElementSpacing, 
kElementSpacing)
                                .Add(fBackButton, 0, 0)
@@ -228,7 +229,6 @@
                fStopButton = 0;
                fGoButton = 0;
                fURLTextControl = 0;
-               fMenuBar = 0;
                fStatusText = 0;
                fLoadingProgressBar = 0;
 

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h       Sun Feb 28 
15:21:43 2010        (r247)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h       Sun Feb 28 
20:48:31 2010        (r248)
@@ -115,7 +115,6 @@
 
 private:
                        BMessenger                      fDownloadListener;
-                       BMenuBar*                       fMenuBar;
                        BMenu*                          fGoMenu;
                        IconButton*                     fBackButton;
                        IconButton*                     fForwardButton;

Modified: webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Sun Feb 28 
15:21:43 2010        (r247)
+++ webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Sun Feb 28 
20:48:31 2010        (r248)
@@ -35,6 +35,7 @@
 #include <CardLayout.h>
 #include <ControlLook.h>
 #include <GroupView.h>
+#include <MenuBar.h>
 #include <SpaceLayoutItem.h>
 #include <Window.h>
 #include <stdio.h>
@@ -863,10 +864,10 @@
 
        rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
        float tint = B_DARKEN_1_TINT;
-       if (!IsFront())
+       if (!IsFront()) {
+               base = tint_color(base, tint);
                tint *= 1.02;
-
-       base = tint_color(base, tint);
+       }
 
        if (fOverCloseRect)
                tint *= 1.2;
@@ -916,6 +917,30 @@
 }
 
 
+// #pragma mark - TabButtonContainer
+
+
+class TabButtonContainer : public BGroupView {
+public:
+       TabButtonContainer()
+               : BGroupView(B_HORIZONTAL)
+       {
+               SetFlags(Flags() | B_WILL_DRAW);
+               SetViewColor(B_TRANSPARENT_COLOR);
+               SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+               GroupLayout()->SetInsets(0, 6, 0, 0);
+       }
+
+       virtual void Draw(BRect updateRect)
+       {
+               BRect bounds(Bounds());
+               rgb_color base = LowColor();
+               be_control_look->DrawInactiveTab(this, bounds, updateRect,
+                       base, 0, BControlLook::B_TOP_BORDER);
+       }
+};
+
+
 // #pragma mark - TabButton
 
 
@@ -1058,7 +1083,6 @@
 // #pragma mark - TabManager
 
 
-
 TabManager::TabManager(const BMessenger& target, BMessage* newTabMessage)
     :
     fController(new TabManagerController(this)),
@@ -1068,9 +1092,17 @@
        fCardLayout = new BCardLayout();
        fContainerView->SetLayout(fCardLayout);
 
+       fMenu = new BMenu("Menu");
        fTabContainerView = new TabContainerView(fController);
        fTabContainerGroup = new BGroupView(B_HORIZONTAL);
-       fTabContainerGroup->GroupLayout()->SetInsets(0, 5, 0, 0);
+       fTabContainerGroup->GroupLayout()->SetInsets(0, 3, 0, 0);
+
+       BMenuBar* menuBar = new BMenuBar("Menu bar");
+       menuBar->AddItem(fMenu);
+       TabButtonContainer* menuBarContainer = new TabButtonContainer();
+       menuBarContainer->GroupLayout()->AddView(menuBar);
+       fTabContainerGroup->GroupLayout()->AddView(menuBarContainer, 0.0f);
+
        fTabContainerGroup->GroupLayout()->AddView(fTabContainerView);
 //     fTabContainerGroup->GroupLayout()->AddView(new 
ScrollLeftTabButton(NULL), 0.0f);
 //     fTabContainerGroup->GroupLayout()->AddView(new 
ScrollRightTabButton(NULL), 0.0f);
@@ -1101,6 +1133,13 @@
 }
 
 
+BMenu*
+TabManager::Menu() const
+{
+       return fMenu;
+}
+
+
 BView*
 TabManager::TabGroup() const
 {

Modified: webkit/trunk/WebKit/haiku/WebPositive/WebTabView.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/WebTabView.h  Sun Feb 28 15:21:43 
2010        (r247)
+++ webkit/trunk/WebKit/haiku/WebPositive/WebTabView.h  Sun Feb 28 20:48:31 
2010        (r248)
@@ -38,6 +38,7 @@
 
 class BCardLayout;
 class BGroupView;
+class BMenu;
 class TabContainerView;
 class TabManagerController;
 
@@ -50,6 +51,8 @@
                        void                            SetTarget(const 
BMessenger& target);
                        const BMessenger&       Target() const;
 
+                       BMenu*                          Menu() const;
+
                        BView*                          TabGroup() const;
                        BView*                          ContainerView() const;
 
@@ -69,6 +72,7 @@
                        void                            
SetCloseButtonsAvailable(bool available);
 
 private:
+                       BMenu*                          fMenu;
                        BGroupView*                     fTabContainerGroup;
                        TabContainerView*       fTabContainerView;
                        BView*                          fContainerView;

Other related posts:

  • » [haiku-webkit-commits] r248 - webkit/trunk/WebKit/haiku/WebPositive - webkit