Ticket #9356: 0001-Added-Hide-status-Hide-navigation-and-Hide-menu-to-t.patch

File 0001-Added-Hide-status-Hide-navigation-and-Hide-menu-to-t.patch, 5.1 KB (added by dsjonny, 12 years ago)
  • src/apps/webpositive/BrowserWindow.cpp

    From 03eafd2259ba4ba639e7c0407dd6e9adf04c65bf Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Dancs=C3=B3=20R=C3=B3bert?= <dancso.robert@d-rendszer.hu>
    Date: Sat, 5 Jan 2013 08:27:48 +0100
    Subject: [PATCH] Added "Hide status", "Hide navigation" and "Hide menu" to
     the "View" menu.
    
    ---
     src/apps/webpositive/BrowserWindow.cpp |   39 ++++++++++++++++++++++++++++----
     src/apps/webpositive/BrowserWindow.h   |   12 ++++++++++
     2 files changed, 46 insertions(+), 5 deletions(-)
    
    diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp
    index 9f5e3e7..ade70b8 100644
    a b enum {  
    115115    FIND_TEXT_CHANGED                           = 'ftxt',
    116116
    117117    SELECT_TAB                                  = 'sltb',
     118
     119    HIDE_STATUSBAR                              = 'hstb',
     120    HIDE_NAVIGATIONBAR                          = 'bbtb',
     121    HIDE_MENUBAR                                = 'mntb',
    118122};
    119123
    120124
    BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,  
    283287
    284288    // Menu
    285289#if INTEGRATE_MENU_INTO_TAB_BAR
    286     BMenu* mainMenu = fTabManager->Menu();
     290    mainMenu = fTabManager->Menu();
    287291#else
    288     BMenu* mainMenu = new BMenuBar("Main menu");
     292    mainMenu = new BMenuBar("Main menu");
    289293#endif
    290294    BMenu* menu = new BMenu(B_TRANSLATE("Window"));
    291295    BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
    BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,  
    361365    menu->AddItem(fFullscreenItem);
    362366    menu->AddItem(new BMenuItem(B_TRANSLATE("Page source"),
    363367        new BMessage(SHOW_PAGE_SOURCE), 'U'));
     368
     369    menu->AddSeparatorItem();
     370    menu->AddItem(fHideStatusMenuItem = new BMenuItem(B_TRANSLATE("Hide status"),
     371        new BMessage(HIDE_STATUSBAR), 'S', B_SHIFT_KEY));
     372    menu->AddItem(fHideNavigationMenuItem = new BMenuItem(B_TRANSLATE("Hide navigation"),
     373        new BMessage(HIDE_NAVIGATIONBAR), 'N', B_SHIFT_KEY));
     374    menu->AddItem(fHideMenuMenuItem = new BMenuItem(B_TRANSLATE("Hide menu"),
     375        new BMessage(HIDE_MENUBAR), 'M', B_SHIFT_KEY));
     376
    364377    mainMenu->AddItem(menu);
    365378
    366379    fHistoryMenu = new BMenu(B_TRANSLATE("History"));
    BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,  
    449462    ;
    450463
    451464    // Navigation group
    452     BGroupLayout* navigationGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
     465    navigationGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
    453466        .Add(BLayoutBuilder::Group<>(B_HORIZONTAL, kElementSpacing)
    454467            .Add(fBackButton)
    455468            .Add(fForwardButton)
    BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,  
    463476    ;
    464477
    465478    // Status bar group
    466     BGroupLayout* statusGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
     479    statusGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
    467480        .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
    468481        .Add(BLayoutBuilder::Group<>(B_HORIZONTAL, kElementSpacing)
    469482            .Add(fStatusText)
    BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,  
    478491        new BMessage(TOGGLE_FULLSCREEN));
    479492    toggleFullscreenButton->SetBackgroundMode(BitmapButton::MENUBAR_BACKGROUND);
    480493
    481     BGroupLayout* menuBarGroup = BLayoutBuilder::Group<>(B_HORIZONTAL, 0.0)
     494    menuBarGroup = BLayoutBuilder::Group<>(B_HORIZONTAL, 0.0)
    482495        .Add(mainMenu)
    483496        .Add(toggleFullscreenButton, 0.0f)
    484497    ;
    BrowserWindow::MessageReceived(BMessage* message)  
    803816        case B_PAGE_SOURCE_RESULT:
    804817            _HandlePageSourceResult(message);
    805818            break;
     819           
     820        case HIDE_STATUSBAR:
     821            statusGroup->SetVisible(!statusGroup->IsVisible());
     822            if (statusGroup->IsVisible()) fHideStatusMenuItem->SetLabel(B_TRANSLATE("Hide status"));
     823            else fHideStatusMenuItem->SetLabel(B_TRANSLATE("Show status"));
     824            break;
     825        case HIDE_NAVIGATIONBAR:
     826            navigationGroup->SetVisible(!navigationGroup->IsVisible());
     827            if (navigationGroup->IsVisible()) fHideNavigationMenuItem->SetLabel(B_TRANSLATE("Hide navigation"));
     828            else fHideNavigationMenuItem->SetLabel(B_TRANSLATE("Show navigation"));
     829            break;
     830        case HIDE_MENUBAR:
     831            menuBarGroup->SetVisible(!menuBarGroup->IsVisible());
     832            if (menuBarGroup->IsVisible()) fHideMenuMenuItem->SetLabel(B_TRANSLATE("Hide menu"));
     833            else fHideMenuMenuItem->SetLabel(B_TRANSLATE("Show menu"));
     834            break;
    806835
    807836        case EDIT_FIND_NEXT:
    808837            CurrentWebView()->FindString(fFindTextControl->Text(), true,
  • src/apps/webpositive/BrowserWindow.h

    diff --git a/src/apps/webpositive/BrowserWindow.h b/src/apps/webpositive/BrowserWindow.h
    index bf80d75..1f34246 100644
    a b  
    3131
    3232
    3333#include "WebWindow.h"
     34#include <GridLayoutBuilder.h>
     35#include <GroupLayout.h>
     36#include <GroupLayoutBuilder.h>
     37#include <LayoutBuilder.h>
    3438#include <Messenger.h>
    3539#include <String.h>
    3640
    private:  
    201205                                    const BMessage* message);
    202206
    203207private:
     208            BMenu*              mainMenu;
    204209            BMenu*              fHistoryMenu;
    205210            int32               fHistoryMenuFixedItemCount;
    206211
    private:  
    213218            BMenuItem*          fFullscreenItem;
    214219            BMenuItem*          fBackMenuItem;
    215220            BMenuItem*          fForwardMenuItem;
     221            BMenuItem*          fHideStatusMenuItem;
     222            BMenuItem*          fHideNavigationMenuItem;
     223            BMenuItem*          fHideMenuMenuItem;
     224
     225            BGroupLayout*       statusGroup;
     226            BGroupLayout*       navigationGroup;
     227            BGroupLayout*       menuBarGroup;
    216228
    217229            IconButton*         fBackButton;
    218230            IconButton*         fForwardButton;