[haiku-commits] r40815 - haiku/trunk/src/apps/deskbar

  • From: fredrik.holmqvist@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 5 Mar 2011 16:52:49 +0100 (CET)

Author: tqh
Date: 2011-03-05 16:52:49 +0100 (Sat, 05 Mar 2011)
New Revision: 40815
Changeset: http://dev.haiku-os.org/changeset/40815

Modified:
   haiku/trunk/src/apps/deskbar/BarMenuBar.cpp
   haiku/trunk/src/apps/deskbar/BarMenuBar.h
   haiku/trunk/src/apps/deskbar/BarMenuTitle.cpp
   haiku/trunk/src/apps/deskbar/BarMenuTitle.h
   haiku/trunk/src/apps/deskbar/BarView.cpp
   haiku/trunk/src/apps/deskbar/BarView.h
Log:
Patches from John Scipione as part of bug 7052.


Modified: haiku/trunk/src/apps/deskbar/BarMenuBar.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/BarMenuBar.cpp 2011-03-05 15:40:24 UTC (rev 
40814)
+++ haiku/trunk/src/apps/deskbar/BarMenuBar.cpp 2011-03-05 15:52:49 UTC (rev 
40815)
@@ -26,9 +26,10 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
@@ -78,7 +79,7 @@
                BRect frame = Frame();
                width = frame.Width();
                height = frame.Height();
-       } else 
+       } else
                ResizeTo(width, height);
 
        width -= 1;
@@ -96,7 +97,7 @@
 void
 TBarMenuBar::AddTeamMenu()
 {
-       if (CountItems() > 1) 
+       if (CountItems() > 1)
                return;
 
        BRect frame(Frame());
@@ -112,7 +113,7 @@
 void
 TBarMenuBar::RemoveTeamMenu()
 {
-       if (CountItems() < 2) 
+       if (CountItems() < 2)
                return;
 
        if (fAppListMenuItem) {
@@ -121,7 +122,7 @@
                fAppListMenuItem = NULL;
        }
 
-       BRect frame = Frame();  
+       BRect frame = Frame();
        SmartResize(frame.Width(), frame.Height());
 }
 
@@ -179,9 +180,10 @@
                return;
 
        BMenu* windowMenu = item->Submenu();
-       if (windowMenu) 
-               //      have a menu, set the tracking hook
-               windowMenu->SetTrackingHook(hookFunction, state);               
                        
+       if (windowMenu) {
+               // have a menu, set the tracking hook
+               windowMenu->SetTrackingHook(hookFunction, state);
+       }
 }
 
 
@@ -192,13 +194,13 @@
        BPoint loc;
        uint32 buttons;
        GetMouse(&loc, &buttons);
-       //      set the hook functions for the two menus
-       //      will always have the be menu
-       //      may have the app menu as well (mini mode)
-       if (fBeMenuItem->Frame().Contains(loc) || both) 
+       // set the hook functions for the two menus
+       // will always have the be menu
+       // may have the app menu as well (mini mode)
+       if (fBeMenuItem->Frame().Contains(loc) || both)
                init_tracking_hook(fBeMenuItem, hookFunction, state);
 
-       if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || 
both)) 
+       if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || 
both))
                init_tracking_hook(fAppListMenuItem, hookFunction, state);
 }
 

Modified: haiku/trunk/src/apps/deskbar/BarMenuBar.h
===================================================================
--- haiku/trunk/src/apps/deskbar/BarMenuBar.h   2011-03-05 15:40:24 UTC (rev 
40814)
+++ haiku/trunk/src/apps/deskbar/BarMenuBar.h   2011-03-05 15:52:49 UTC (rev 
40815)
@@ -26,15 +26,16 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
-//     Be Menu, used in vertical mode, expanded and mini
-//             in mini mode will have team menu next to Be menu
-//             Be menu in horizontal mode is embedded in ExpandoMenuBar
+// Be Menu, used in vertical mode, expanded and mini
+//   - in mini mode will have team menu next to Be menu
+//   - Be menu in horizontal mode is embedded in ExpandoMenuBar
 
 #ifndef BARMENUBAR_H
 #define BARMENUBAR_H
@@ -63,7 +64,7 @@
 
                void InitTrackingHook(bool (* hookfunction)(BMenu*, void*), 
void* state,
                        bool both = false);
-       
+
        private:
                TBarView* fBarView;
                TBarMenuTitle* fBeMenuItem;

Modified: haiku/trunk/src/apps/deskbar/BarMenuTitle.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/BarMenuTitle.cpp       2011-03-05 15:40:24 UTC 
(rev 40814)
+++ haiku/trunk/src/apps/deskbar/BarMenuTitle.cpp       2011-03-05 15:52:49 UTC 
(rev 40815)
@@ -26,9 +26,10 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
@@ -116,14 +117,14 @@
 
        if (be_control_look != NULL) {
                menu->SetDrawingMode(B_OP_ALPHA);
-       
+
                if (fIcon != NULL) {
                        BRect dstRect(fIcon->Bounds());
                        dstRect.OffsetTo(frame.LeftTop());
                        dstRect.OffsetBy(rintf(((frame.Width() - 
dstRect.Width()) / 2)
                                - 1.0f), rintf(((frame.Height() - 
dstRect.Height()) / 2)
                                - 0.0f));
-       
+
                        menu->DrawBitmapAsync(fIcon, dstRect);
                }
                return;
@@ -200,11 +201,11 @@
                BLooper* looper = barview->Looper();
                if (looper->Lock()) {
                        // tell barview to add the refs to the be menu
-                       barview->HandleBeMenu(NULL);                    
+                       barview->HandleBeMenu(NULL);
                        looper->Unlock();
                }
        }
-               
+
        return BMenuItem::Invoke(message);
 }
 

Modified: haiku/trunk/src/apps/deskbar/BarMenuTitle.h
===================================================================
--- haiku/trunk/src/apps/deskbar/BarMenuTitle.h 2011-03-05 15:40:24 UTC (rev 
40814)
+++ haiku/trunk/src/apps/deskbar/BarMenuTitle.h 2011-03-05 15:52:49 UTC (rev 
40815)
@@ -26,9 +26,10 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
@@ -46,15 +47,15 @@
 
 class TBarMenuTitle : public BMenuItem {
 public:
-       TBarMenuTitle(float width,float height, const BBitmap* icon,
-               BMenu* menu, bool inexpando = false);
+       TBarMenuTitle(float width, float height, const BBitmap* icon,
+               BMenu* menu, bool inexpando = false);
        virtual ~TBarMenuTitle();
 
        void SetWidthHeight(float width, float height);
        void Draw();
 
        status_t Invoke(BMessage* message);
-               
+
 protected:
        void DrawContent();
        void GetContentSize(float* width, float* height);
@@ -63,7 +64,7 @@
        float fWidth;
        float fHeight;
        bool fInExpando;
-       const BBitmap* fIcon;   
+       const BBitmap* fIcon;
 };
 
 #endif /* BARMENUTITLE_H */

Modified: haiku/trunk/src/apps/deskbar/BarView.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/BarView.cpp    2011-03-05 15:40:24 UTC (rev 
40814)
+++ haiku/trunk/src/apps/deskbar/BarView.cpp    2011-03-05 15:52:49 UTC (rev 
40815)
@@ -26,9 +26,10 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
@@ -135,9 +136,9 @@
        rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
 
        SetHighColor(hilite);
-       if (AcrossTop()) 
+       if (AcrossTop())
                StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
-       else if (AcrossBottom()) 
+       else if (AcrossBottom())
                StrokeLine(bounds.LeftTop(), bounds.RightTop());
 
        if (Vertical() && Expando()) {
@@ -166,7 +167,7 @@
                        // so that I can follow the common pathway
                        // for adding icons to the tray
                        int32 id;
-                       AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id); 
+                       AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id);
                        break;
                }
 
@@ -206,9 +207,9 @@
                fBarMenuBar = NULL;
        }
 
-       //      top or bottom expando mode has Be menu built in for tracking
-       //      only for vertical mini or expanded
-       //      mini mode will have team menu added as part of BarMenuBar
+       // top or bottom expando mode has Be menu built in for tracking
+       // only for vertical mini or expanded
+       // mini mode will have team menu added as part of BarMenuBar
        if (fVertical && !fBarMenuBar) {
                //      create the Be menu
                BRect mbarFrame(Bounds());
@@ -217,11 +218,11 @@
                AddChild(fBarMenuBar);
        }
 
-       //      if there isn't a bemenu at this point,
-       //      DB should be in top/bottom mode, else error
+       // if there isn't a bemenu at this point,
+       // DB should be in top/bottom mode, else error
        if (!fBarMenuBar)
                return;
-               
+
        float width = sMinimumWindowWidth;
        BPoint loc(B_ORIGIN);
        BRect menuFrame(fBarMenuBar->Frame());
@@ -237,9 +238,10 @@
                else
                        width = floorf(width) / 2;
                loc = Bounds().LeftTop();
-       } else 
+       } else {
                // mini mode, BeMenu next to team menu
                fBarMenuBar->AddTeamMenu();
+       }
 
        fBarMenuBar->SmartResize(width, menuFrame.Height());
        fBarMenuBar->MoveTo(loc);
@@ -257,13 +259,13 @@
                fDragRegion->MoveTo(statusLoc);
 
                if (!fReplicantTray->IsHidden())
-                       fReplicantTray->Hide(); 
+                       fReplicantTray->Hide();
 
                return;
        }
 
        if (fReplicantTray->IsHidden())
-               fReplicantTray->Show(); 
+               fReplicantTray->Show();
 
        if (fTrayLocation != 0) {
                fReplicantTray->SetMultiRow(fVertical);
@@ -347,7 +349,7 @@
                }
        } else {
                // four corners
-               if (fTrayLocation != 0)         
+               if (fTrayLocation != 0)
                        windowHeight = fDragRegion->Frame().bottom;
                else
                        windowHeight = fBarMenuBar->Frame().bottom;
@@ -404,10 +406,10 @@
        settings->state = (uint32)State();
        settings->width = 0;
        settings->showTime = ShowingClock();
-       
+
        fReplicantTray->RememberClockSettings();
-       settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL)
-               != 0;
+       settings->alwaysOnTop
+               = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL) != 0;
 }
 
 
@@ -424,7 +426,7 @@
 void
 TBarView::UpdatePlacement()
 {
-       ChangeState(fState, fVertical, fLeft, fTop);    
+       ChangeState(fState, fVertical, fLeft, fTop);
 }
 
 
@@ -455,7 +457,7 @@
        BString* signature = NULL;
        if (fVertical && Expando()
                && static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
-               // Get a list of the signatures of expanded apps. Can't use 
+               // Get a list of the signatures of expanded apps. Can't use
                // team_id because there can be more than one team per 
application
                if (fVertical && Expando() && vertical && fExpando) {
                        for (int index = 0; index < fExpando->CountItems(); 
index++) {
@@ -469,10 +471,10 @@
                }
        }
 
-       PlaceApplicationBar(screenFrame);
-       SizeWindow(screenFrame);
-       PositionWindow(screenFrame);
-       Window()->UpdateIfNeeded();
+       PlaceApplicationBar(screenFrame);
+       SizeWindow(screenFrame);
+       PositionWindow(screenFrame);
+       Window()->UpdateIfNeeded();
 
        // Re-expand those apps.
        if (expandedItems.CountItems() > 0) {
@@ -505,7 +507,7 @@
 }
 
 
-//     window placement functions
+// window placement functions
 
 bool
 TBarView::Vertical() const
@@ -558,7 +560,7 @@
 
 // optional functionality functions
 
-bool 
+bool
 TBarView::MilTime() const
 {
        return fShowInterval;
@@ -586,7 +588,7 @@
 TBarView::CacheDragData(const BMessage* incoming)
 {
        if (!incoming)
-               return; 
+               return;
 
        if (Dragging() && SpringLoadedFolderCompareMessages(incoming, 
fDragMessage))
                return;
@@ -614,7 +616,7 @@
 
 status_t
 TBarView::DragStart()
-{      
+{
        if (!Dragging())
                return B_OK;
 
@@ -624,7 +626,7 @@
 
        if (fExpando && fExpando->Frame().Contains(loc)) {
                ConvertToScreen(&loc);
-               BPoint expandoLocation = fExpando->ConvertFromScreen(loc);      
        
+               BPoint expandoLocation = fExpando->ConvertFromScreen(loc);
                TTeamMenuItem* item = 
fExpando->TeamItemAtPoint(expandoLocation);
 
                if (fLastDragItem)
@@ -634,8 +636,8 @@
                        if (item == fLastDragItem)
                                return B_OK;
 
-                       fLastDragItem = item;           
-               }                                       
+                       fLastDragItem = item;
+               }
        }
 
        return B_OK;
@@ -676,7 +678,7 @@
 
                        if (bemenu && bemenu->LockLooper()) {
                                bemenu->ConvertFromScreen(&location);
-                               if (bemenu->Frame().Contains(location)) 
+                               if (bemenu->Frame().Contains(location))
                                        endMenu = false;
 
                                bemenu->UnlockLooper();
@@ -685,7 +687,7 @@
                        if (endMenu && expando) {
                                expando->ConvertFromScreen(&location);
                                BMenuItem* item = 
expando->TeamItemAtPoint(location);
-                               if (item) 
+                               if (item)
                                        endMenu = false;
                        }
                        barview->UnlockLooper();
@@ -757,7 +759,7 @@
        if (appmime.GetAppHint(&hintref) != B_OK)
                return false;
 
-       // an app was found, now see if it supports any of 
+       // an app was found, now see if it supports any of
        // the refs in the message
        BFile file(&hintref, O_RDONLY);
        BAppFileInfo fileinfo(&file);
@@ -768,7 +770,7 @@
 
        int32 count = fCachedTypesList->CountItems();
        for (int32 i = 0 ; i < count ; i++) {
-               if 
(fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String())) 
+               if 
(fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String()))
                        return true;
        }
 
@@ -910,9 +912,9 @@
 
 int32
 TBarView::CountItems(DeskbarShelf)
-{      
-       return fReplicantTray->IconCount();     
-}      
+{
+       return fReplicantTray->IconCount();
+}
 
 
 status_t

Modified: haiku/trunk/src/apps/deskbar/BarView.h
===================================================================
--- haiku/trunk/src/apps/deskbar/BarView.h      2011-03-05 15:40:24 UTC (rev 
40814)
+++ haiku/trunk/src/apps/deskbar/BarView.h      2011-03-05 15:52:49 UTC (rev 
40815)
@@ -26,9 +26,10 @@
 used in advertising or otherwise to promote the sale, use or other dealings in
 this Software without prior written authorization from Be Incorporated.
 
-Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
-of Be Incorporated in the United States and other countries. Other brand 
product
-names are registered trademarks or trademarks of their respective holders.
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
+trademarks of Be Incorporated in the United States and other countries. Other
+brand product names are registered trademarks or trademarks of their respective
+holders.
 All rights reserved.
 */
 
@@ -98,7 +99,7 @@
                void CacheDragData(const BMessage* incoming);
                status_t DragStart();
                static bool MenuTrackingHook(BMenu* menu, void* castToThis);
-               void DragStop(bool full=false);
+               void DragStop(bool full = false);
                TrackingHookData* GetTrackingHookData();
                bool Dragging() const;
                const BMessage* DragMessage() const;


Other related posts: