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

  • From: fredrik.holmqvist@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 6 Mar 2011 17:58:00 +0100 (CET)

Author: tqh
Date: 2011-03-06 17:57:59 +0100 (Sun, 06 Mar 2011)
New Revision: 40849
Changeset: http://dev.haiku-os.org/changeset/40849
Ticket: http://dev.haiku-os.org/ticket/7052

Modified:
   haiku/trunk/src/apps/deskbar/Switcher.cpp
   haiku/trunk/src/apps/deskbar/Switcher.h
   haiku/trunk/src/apps/deskbar/TeamMenu.cpp
   haiku/trunk/src/apps/deskbar/TeamMenu.h
   haiku/trunk/src/apps/deskbar/TeamMenuItem.cpp
   haiku/trunk/src/apps/deskbar/TeamMenuItem.h
   haiku/trunk/src/apps/deskbar/TimeView.cpp
   haiku/trunk/src/apps/deskbar/TimeView.h
   haiku/trunk/src/apps/deskbar/WindowMenu.cpp
   haiku/trunk/src/apps/deskbar/WindowMenu.h
   haiku/trunk/src/apps/deskbar/WindowMenuItem.cpp
   haiku/trunk/src/apps/deskbar/WindowMenuItem.h
Log:
Final set of style cleanup patches by John Scipione as part of #7052.


Modified: haiku/trunk/src/apps/deskbar/Switcher.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/Switcher.cpp   2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/Switcher.cpp   2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 
@@ -99,11 +100,11 @@
                                                                TSwitchManager* 
manager);
        virtual                                 ~TSwitcherWindow();
 
-       virtual bool                    QuitRequested();
-       virtual void                    MessageReceived(BMessage* message);
-       virtual void                    Show();
-       virtual void                    Hide();
-       virtual void                    WindowActivated(bool state);
+       virtual bool                    QuitRequested();
+       virtual void                    MessageReceived(BMessage* message);
+       virtual void                    Show();
+       virtual void                    Hide();
+       virtual void                    WindowActivated(bool state);
 
                        void                    DoKey(uint32 key, uint32 
modifiers);
                        TIconView*              IconView();
@@ -133,12 +134,14 @@
                        void                    UpdateGroup(int32 groupIndex, 
int32 windowIndex);
 
        virtual void                    AttachedToWindow();
-       virtual void                    Draw(BRect update);
-       virtual void                    Pulse();
-       virtual void                    GetPreferredSize(float* w, float* h);
+       virtual void                    Draw(BRect update);
+       virtual void                    Pulse();
+       virtual void                    GetPreferredSize(float* w, float* h);
                        void                    ScrollTo(float x, float y)
-                                                               { 
ScrollTo(BPoint(x,y)); }
-       virtual void                    ScrollTo(BPoint where);
+                                                       {
+                                                               
ScrollTo(BPoint(x, y));
+                                                       }
+       virtual void                    ScrollTo(BPoint where);
 
                        void                    ShowIndex(int32 windex);
                        BRect                   FrameOf(int32 index) const;
@@ -160,13 +163,15 @@
                        void                    Hiding();
 
        virtual void                    KeyDown(const char* bytes, int32 
numBytes);
-       virtual void                    Pulse();
-       virtual void                    MouseDown(BPoint point);
-       virtual void                    Draw(BRect updateRect);
+       virtual void                    Pulse();
+       virtual void                    MouseDown(BPoint point);
+       virtual void                    Draw(BRect updateRect);
 
                        void                    ScrollTo(float x, float y)
-                                                               { 
ScrollTo(BPoint(x,y)); }
-       virtual void    ScrollTo(BPoint where);
+                                                       {
+                                                               
ScrollTo(BPoint(x, y));
+                                                       }
+       virtual void    ScrollTo(BPoint where);
                        void                    Update(int32 previous, int32 
current,
                                                                int32 
previousSlot, int32 currentSlot,
                                                                bool forward);
@@ -197,9 +202,9 @@
 
        virtual void                    Draw(BRect update);
        virtual void                    AllAttached();
-       virtual void                    DrawIconScrollers(bool force);
-       virtual void                    DrawWindowScrollers(bool force);
-       virtual void                    MouseDown(BPoint where);
+       virtual void                    DrawIconScrollers(bool force);
+       virtual void                    DrawWindowScrollers(bool force);
+       virtual void                    MouseDown(BPoint where);
 
 private:
                        TSwitchManager* fManager;
@@ -250,16 +255,12 @@
 inline bool
 IsVisibleInCurrentWorkspace(const window_info* windowInfo)
 {
-       /*
-        The window list is always ordered from the top
-        front visible window (the first on the list), going down through all
-        the other visible windows, then all the hidden or non workspace
-        visible window at the end.
-
-        layer > 2 : normal visible window.
-        layer == 2 : reserved for the desktop window (visible also).
-        layer < 2 : hidden (0) and non workspace visible window (1)
-       */
+       // The window list is always ordered from the top front visible window
+       // (the first on the list), going down through all the other visible
+       // windows, then all hidden or non-workspace visible windows at the end.
+       //     layer > 2  : normal visible window
+       //     layer == 2 : reserved for the desktop window (visible also)
+       //     layer < 2  : hidden (0) and non workspace visible window (1)
        return windowInfo->layer > 2;
 }
 
@@ -278,13 +279,11 @@
 IsWindowOK(const window_info* windowInfo)
 {
        // is_mini (true means that the window is minimized).
-       // if not, then
-       // show_hide >= 1 means that the window is hidden.
-       //
+       // if not, then show_hide >= 1 means that the window is hidden.
        // If the window is both minimized and hidden, then you get :
-       //       TWindow->is_mini = false;
-       //       TWindow->was_mini = true;
-       //       TWindow->show_hide >= 1;
+       //     TWindow->is_mini = false;
+       //     TWindow->was_mini = true;
+       //     TWindow->show_hide >= 1;
 
        if (windowInfo->feel != _STD_W_TYPE_)
                return false;
@@ -330,14 +329,16 @@
                        s2++;
                        continue;
                }
-               if (*s1 != *s2)
-                       return 1;               // they differ
+               if (*s1 != *s2) {
+                       // they differ
+                       return 1;
+               }
                s1++;
                s2++;
        }
 
        // if one of the strings ended before the other
-       // ??? could process trailing spaces & underscores!
+       // TODO: could process trailing spaces and underscores
        if (*s1)
                return 1;
        if (*s2)
@@ -446,7 +447,7 @@
        TBarApp::Subscribe(BMessenger(this), &tmpList);
 
        for (int32 i = 0; ; i++) {
-               BarTeamInfo     *barTeamInfo = (BarTeamInfo     
*)tmpList.ItemAt(i);
+               BarTeamInfo* barTeamInfo = (BarTeamInfo*)tmpList.ItemAt(i);
                if (!barTeamInfo)
                        break;
 
@@ -483,6 +484,7 @@
                        int i = 0;
                        TTeamGroup* tinfo;
                        message->FindInt32("team", &teamID);
+
                        while ((tinfo = (TTeamGroup*)fGroupList.ItemAt(i)) != 
NULL) {
                                if (tinfo->TeamList()->HasItem((void*)teamID)) {
                                        fGroupList.RemoveItem(i);
@@ -517,15 +519,19 @@
                                delete teams;
                                break;
                        }
+
                        delete smallIcon;
+
                        if (message->FindString("sig", &signature) != B_OK) {
                                delete teams;
                                break;
                        }
+
                        if (message->FindInt32("flags", (int32*)&flags) != 
B_OK) {
                                delete teams;
                                break;
                        }
+
                        if (message->FindString("name", &name) != B_OK) {
                                delete teams;
                                break;
@@ -546,8 +552,7 @@
                        const char* signature = message->FindString("sig");
                        team_id team = message->FindInt32("team");
 
-                       int32 numItems = fGroupList.CountItems();
-                       for (int32 i = 0; i < numItems; i++) {
+                       for (int32 i = 0; i < fGroupList.CountItems(); i++) {
                                TTeamGroup* tinfo = 
(TTeamGroup*)fGroupList.ItemAt(i);
                                if (strcasecmp(tinfo->Signature(), signature) 
== 0) {
                                        if 
(!(tinfo->TeamList()->HasItem((void*)team)))
@@ -562,8 +567,7 @@
                {
                        team_id team = message->FindInt32("team");
 
-                       int32 numItems = fGroupList.CountItems();
-                       for (int32 i = 0; i < numItems; i++) {
+                       for (int32 i = 0; i < fGroupList.CountItems(); i++) {
                                TTeamGroup* tinfo = 
(TTeamGroup*)fGroupList.ItemAt(i);
                                if (tinfo->TeamList()->HasItem((void*)team)) {
                                        
tinfo->TeamList()->RemoveItem((void*)team);
@@ -584,7 +588,6 @@
                        // starts differentiating initial key_downs from 
KeyDowns generated
                        // by auto-repeat. Until then the fSkipUntil stuff 
helps, but it
                        // isn't perfect.
-
                        if (time < fSkipUntil)
                                break;
 
@@ -620,7 +623,7 @@
        team_id* teams;
        int32 count;
        if (BPrivate::get_application_order(current_workspace(), &teams, &count)
-                       != B_OK)
+               != B_OK)
                return;
 
        BList groups;
@@ -656,8 +659,7 @@
 {
        bigtime_t now = system_time();
        bigtime_t timeout = now + 180000;
-               // The delay above was arrived at by trial and error and
-               // has a good "feel"
+               // The above delay has a good "feel" found by trial and error
 
        app_info appInfo;
        be_roster->GetActiveAppInfo(&appInfo);
@@ -885,6 +887,7 @@
                        if (fCurrentIndex < 0)
                                fCurrentIndex = max - 1;
                }
+
                if (fCurrentIndex == startIndex) {
                        // we've gone completely through the list without 
finding
                        // a good app. Oh well.
@@ -898,6 +901,7 @@
        return false;
 }
 
+
 void
 TSwitchManager::SwitchToApp(int32 previousIndex, int32 newIndex, bool forward)
 {
@@ -930,6 +934,7 @@
 
        int32 currentWorkspace = current_workspace();
        TTeamGroup* teamGroup = (TTeamGroup*)fGroupList.ItemAt(fCurrentIndex);
+
        // Let's handle the easy case first: There's only 1 team in the group
        if (teamGroup->TeamList()->CountItems() == 1) {
                bool result;
@@ -988,7 +993,8 @@
        if (tokens == NULL) {
                ASSERT(windowInfo);
                free(windowInfo);
-               return true;    // weird error, so don't try to recover
+               return true;
+                       // weird error, so don't try to recover
        }
 
        BList windowsToActivate;
@@ -1040,6 +1046,7 @@
 
        TTeamGroup* teamGroup;
        int32 count = 0;
+
        for (int32 i = fCurrentIndex + 1; i < fGroupList.CountItems(); i++) {
                teamGroup = (TTeamGroup*)fGroupList.ItemAt(i);
 
@@ -1296,7 +1303,7 @@
        if (fLeftScroller) {
                BRect lhit(0, frame.top, frame.left, frame.bottom);
                if (lhit.Contains(where)) {
-                       // Want to scroll by NUMSLOTS-1 slots
+                       // Want to scroll by NUMSLOTS - 1 slots
                        int32 previousIndex = fManager->CurrentIndex();
                        int32 previousSlot = fManager->CurrentSlot();
                        int32 newSlot = previousSlot - (kNumSlots - 1);
@@ -1311,16 +1318,16 @@
        if (fRightScroller) {
                BRect rhit(frame.right, frame.top, bounds.right, frame.bottom);
                if (rhit.Contains(where)) {
-                       // Want to scroll by NUMSLOTS-1 slots
+                       // Want to scroll by NUMSLOTS - 1 slots
                        int32 previousIndex = fManager->CurrentIndex();
                        int32 previousSlot = fManager->CurrentSlot();
-                       int32 newSlot = previousSlot + (kNumSlots-1);
+                       int32 newSlot = previousSlot + (kNumSlots - 1);
                        int32 newIndex = fIconView->IndexAt(newSlot);
 
                        if (newIndex < 0) {
                                // don't have a page full to scroll
                                int32 valid = fManager->CountVisibleGroups();
-                               newIndex = fIconView->IndexAt(valid-1);
+                               newIndex = fIconView->IndexAt(valid - 1);
                        }
                        fManager->SwitchToApp(previousIndex, newIndex, true);
                }
@@ -1329,9 +1336,9 @@
        frame = fWindow->WindowView()->Frame();
        if (fUpScroller) {
                BRect hit1(frame.left - 10, frame.top, frame.left,
-                       (frame.top+frame.bottom)/2);
+                       (frame.top + frame.bottom) / 2);
                BRect hit2(frame.right, frame.top, frame.right + 10,
-                       (frame.top+frame.bottom)/2);
+                       (frame.top + frame.bottom) / 2);
                if (hit1.Contains(where) || hit2.Contains(where)) {
                        // Want to scroll up 1 window
                        fManager->CycleWindow(false, false);
@@ -1339,10 +1346,10 @@
        }
 
        if (fDownScroller) {
-               BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, 
frame.left,
-                       frame.bottom);
-               BRect hit2(frame.right, (frame.top+frame.bottom) / 2, 
frame.right + 10,
-                       frame.bottom);
+               BRect hit1(frame.left - 10, (frame.top + frame.bottom) / 2,
+                       frame.left, frame.bottom);
+               BRect hit2(frame.right, (frame.top + frame.bottom) / 2,
+                       frame.right + 10, frame.bottom);
                if (hit1.Contains(where) || hit2.Contains(where)) {
                        // Want to scroll down 1 window
                        fManager->CycleWindow(true, false);
@@ -1374,40 +1381,42 @@
 
        // Fill the area with dark gray
        SetHighColor(darkGray);
-       box.InsetBy(1,1);
+       box.InsetBy(1, 1);
        FillRect(box);
 
-       box.InsetBy(-1,-1);
+       box.InsetBy(-1, -1);
 
        BeginLineArray(50);
 
        // The main frame around the icon view
-       AddLine(box.LeftTop(), BPoint(center-kWedge, box.top), veryDarkGray);
-       AddLine(BPoint(center+kWedge, box.top), box.RightTop(), veryDarkGray);
+       AddLine(box.LeftTop(), BPoint(center - kWedge, box.top), veryDarkGray);
+       AddLine(BPoint(center + kWedge, box.top), box.RightTop(), veryDarkGray);
 
-       AddLine(box.LeftBottom(), BPoint(center-kWedge, box.bottom), 
veryDarkGray);
-       AddLine(BPoint(center+kWedge, box.bottom), box.RightBottom(), 
veryDarkGray);
+       AddLine(box.LeftBottom(), BPoint(center - kWedge, box.bottom),
+               veryDarkGray);
+       AddLine(BPoint(center + kWedge, box.bottom), box.RightBottom(),
+               veryDarkGray);
        AddLine(box.LeftBottom() + BPoint(1, 1),
-               BPoint(center-kWedge, box.bottom + 1), white);
-       AddLine(BPoint(center+kWedge, box.bottom) + BPoint(0, 1),
+               BPoint(center - kWedge, box.bottom + 1), white);
+       AddLine(BPoint(center + kWedge, box.bottom) + BPoint(0, 1),
                box.RightBottom() + BPoint(1, 1), white);
 
        AddLine(box.LeftTop(), box.LeftBottom(), veryDarkGray);
        AddLine(box.RightTop(), box.RightBottom(), veryDarkGray);
-       AddLine(box.RightTop() + BPoint(1, 1),
-               box.RightBottom() + BPoint(1, 1), white);
+       AddLine(box.RightTop() + BPoint(1, 1), box.RightBottom() + BPoint(1, 1),
+               white);
 
        // downward pointing area at top of frame
        BPoint point(center - kWedge, box.top);
        AddLine(point, point + BPoint(kWedge, kWedge), veryDarkGray);
-       AddLine(point + BPoint(kWedge, kWedge),
-               BPoint(center+kWedge, point.y), veryDarkGray);
+       AddLine(point + BPoint(kWedge, kWedge), BPoint(center + kWedge, 
point.y),
+               veryDarkGray);
 
-       AddLine(point + BPoint(1, 0),
-               point + BPoint(1, 0) + BPoint(kWedge - 1, kWedge - 1), white);
+       AddLine(point + BPoint(1, 0), point + BPoint(1, 0)
+               + BPoint(kWedge - 1, kWedge - 1), white);
 
        AddLine(point + BPoint(2, -1) + BPoint(kWedge - 1, kWedge - 1),
-               BPoint(center+kWedge-1, point.y), darkGray);
+               BPoint(center + kWedge - 1, point.y), darkGray);
 
        BPoint topPoint = point;
 
@@ -1416,7 +1425,7 @@
        point.x = center - kWedge;
        AddLine(point, point + BPoint(kWedge, -kWedge), veryDarkGray);
        AddLine(point + BPoint(kWedge, -kWedge),
-               BPoint(center+kWedge, point.y), veryDarkGray);
+               BPoint(center + kWedge, point.y), veryDarkGray);
 
        AddLine(point + BPoint(1, 0),
                point + BPoint(1, 0) + BPoint(kWedge - 1, -(kWedge - 1)), 
white);
@@ -1436,7 +1445,7 @@
 
        // fill the upward pointing arrow area
        SetHighColor(standardGray);
-       FillTriangle(bottomPoint + BPoint(2,0),
+       FillTriangle(bottomPoint + BPoint(2, 0),
                bottomPoint + BPoint(2, 0) + BPoint(kWedge - 2, -(kWedge - 2)),
                BPoint(center + kWedge - 2, bottomPoint.y));
 
@@ -1467,7 +1476,7 @@
        }
 
        int32 maxIndex = fManager->GroupList()->CountItems() - 1;
-                       // last_frame is in fIconView coordinate space
+       // last_frame is in fIconView coordinate space
        BRect lastFrame = fIconView->FrameOf(maxIndex);
 
        if (lastFrame.right > rect.right) {
@@ -1893,7 +1902,7 @@
 void
 TIconView::AnimateIcon(BBitmap* startIcon, BBitmap* endIcon)
 {
-       BRect centerRect(kCenterSlot*kSlotSize, 0,
+       BRect centerRect(kCenterSlot * kSlotSize, 0,
                (kCenterSlot + 1) * kSlotSize - 1, kSlotSize - 1);
        BRect startIconBounds = startIcon->Bounds();
        BRect bounds = Bounds();
@@ -1917,7 +1926,7 @@
        fOffBitmap->Lock();
 
        for (int i = 0; i < 2; i++) {
-               startIconBounds.InsetBy(amount,amount);
+               startIconBounds.InsetBy(amount, amount);
                snooze(20000);
                fOffView->SetDrawingMode(B_OP_COPY);
                fOffView->FillRect(fOffView->Bounds());
@@ -1927,7 +1936,7 @@
                DrawBitmap(fOffBitmap, destRect);
        }
        for (int i = 0; i < 2; i++) {
-               startIconBounds.InsetBy(amount,amount);
+               startIconBounds.InsetBy(amount, amount);
                snooze(20000);
                fOffView->SetDrawingMode(B_OP_COPY);
                fOffView->FillRect(fOffView->Bounds());
@@ -2054,6 +2063,7 @@
 TIconView::SlotOf(int32 index) const
 {
        BRect rect = FrameOf(index);
+
        return (int32)(rect.left / kSlotSize) - kCenterSlot;
 }
 
@@ -2107,7 +2117,7 @@
 
                        SetDrawingMode(B_OP_COPY);
                }
-               rect.OffsetBy(kSlotSize,0);
+               rect.OffsetBy(kSlotSize, 0);
        }
 }
 
@@ -2201,7 +2211,6 @@
 }
 
 
-
 BRect
 TWindowView::FrameOf(int32 index) const
 {
@@ -2275,6 +2284,7 @@
        int32 groupIndex = fManager->CurrentIndex();
        TTeamGroup* teamGroup
                = (TTeamGroup*)fManager->GroupList()->ItemAt(groupIndex);
+
        if (teamGroup == NULL)
                return;
 

Modified: haiku/trunk/src/apps/deskbar/Switcher.h
===================================================================
--- haiku/trunk/src/apps/deskbar/Switcher.h     2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/Switcher.h     2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 #ifndef SWITCHER_H
@@ -53,7 +54,7 @@
                                                        TSwitchManager(BPoint 
where);
        virtual                                 ~TSwitchManager();
 
-       virtual void                    MessageReceived(BMessage* message);
+       virtual void                    MessageReceived(BMessage* message);
 
                        void                    Stop(bool doAction, uint32 
modifiers);
                        void                    Unblock();
@@ -85,7 +86,7 @@
                                                                bool 
allowWorkspaceSwitch);
                        void                    ActivateWindow(int32 windowID = 
-1);
                        void                    _SortApps();
-                       
+
                        bool                    _FindNextValidApp(bool forward);
 
                        TSwitcherWindow* fWindow;

Modified: haiku/trunk/src/apps/deskbar/TeamMenu.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/TeamMenu.cpp   2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/TeamMenu.cpp   2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 
@@ -121,7 +122,7 @@
        if (dragging && barview->LockLooper()) {
                SetTrackingHook(barview->MenuTrackingHook,
                        barview->GetTrackingHookData());
-               barview->DragStart();                           
+               barview->DragStart();
                barview->UnlockLooper();
        }
 

Modified: haiku/trunk/src/apps/deskbar/TeamMenu.h
===================================================================
--- haiku/trunk/src/apps/deskbar/TeamMenu.h     2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/TeamMenu.h     2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 
-//     listing of running applications
-//     menu of BarMenuTitle
-//     in mini mode only
+// listing of running applications
+// menu of BarMenuTitle
+// in mini mode only
 
 #ifndef TEAMMENU_H
 #define TEAMMENU_H
@@ -44,7 +45,7 @@
 #include "TeamMenuItem.h"
 
 class TTeamMenu : public BMenu {
-       public:                                 
+       public:
                TTeamMenu();
 
                void    AttachedToWindow();

Modified: haiku/trunk/src/apps/deskbar/TeamMenuItem.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/TeamMenuItem.cpp       2011-03-06 16:42:58 UTC 
(rev 40848)
+++ haiku/trunk/src/apps/deskbar/TeamMenuItem.cpp       2011-03-06 16:57:59 UTC 
(rev 40849)
@@ -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.
 */
 
@@ -71,10 +72,11 @@
 }
 
 
-TTeamMenuItem::TTeamMenuItem(float width,float height,bool vertical)
+TTeamMenuItem::TTeamMenuItem(float width, float height, bool vertical)
        :       BMenuItem("", NULL)
 {
-       InitData(NULL, NULL, strdup(""), strdup(""), width, height, false, 
vertical);
+       InitData(NULL, NULL, strdup(""), strdup(""), width, height, false,
+               vertical);
 }
 
 
@@ -136,10 +138,11 @@
                barview->DragStop();
 
        // bring to front or minimize shortcuts
-       uint32 mods = modifiers();      
-       if (mods & B_CONTROL_KEY) 
+       uint32 mods = modifiers();
+       if (mods & B_CONTROL_KEY) {
                TShowHideMenuItem::TeamShowHideCommon((mods & B_SHIFT_KEY)
                                ? B_MINIMIZE_WINDOW : B_BRING_TO_FRONT, 
Teams());
+       }
 
        return BMenuItem::Invoke(message);
 }
@@ -213,7 +216,7 @@
                *width = kHPad + iconBounds.Width() + kLabelOffset + 
fLabelWidth + kHPad
                        + 20;
 
-       if (fOverrideHeight != -1.0f) 
+       if (fOverrideHeight != -1.0f)
                *height = fOverrideHeight;
        else {
                *height = iconBounds.Height();
@@ -233,8 +236,8 @@
        BMenu* menu = Menu();
        menu->PushState();
        rgb_color menuColor = menu->LowColor();
+       TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
 
-       TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
        bool canHandle = !barview->Dragging()
                || barview->AppCanHandleTypes(Signature());
 
@@ -314,13 +317,14 @@
 
                // these continue the dark grey border on the left or top edge
                menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT));
-               if (fVertical)
+               if (fVertical) {
                        // dark line at top
                        menu->StrokeLine(frame.LeftTop(), frame.RightTop());
-               else
+               } else {
                        // dark line on the left
                        menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
-       } else 
+               }
+       } else
                menu->SetLowColor(menuColor);
 
        menu->MovePenTo(ContentLocation());
@@ -337,15 +341,15 @@
                if (fIcon->ColorSpace() == B_RGBA32) {
                        menu->SetDrawingMode(B_OP_ALPHA);
                        menu->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
-               } else {
+               } else
                        menu->SetDrawingMode(B_OP_OVER);
-               }
+
                BRect frame(Frame());
-
                BRect iconBounds(fIcon->Bounds());
                BRect dstRect(iconBounds);
                float extra = fVertical ? 0.0f : 1.0f;
                BPoint contLoc = ContentLocation();
+
                dstRect.OffsetTo(BPoint(contLoc.x + kHPad, contLoc.y + 
                        ((frame.Height() - iconBounds.Height()) / 2) + extra));
                menu->DrawBitmapAsync(fIcon, dstRect);
@@ -357,17 +361,17 @@
                menu->MovePenTo(drawLoc);
        }
 
-       //      set the pen to black so that either method will draw in the 
same color
-       //      low color is set in inherited::DrawContent, override makes sure 
its
-       //  what we want
+       // set the pen to black so that either method will draw in the same 
color
+       // low color is set in inherited::DrawContent, override makes sure its
+       // what we want
        if (fDrawLabel) {
                menu->SetDrawingMode(B_OP_OVER);
                menu->SetHighColor(0, 0, 0);
 
-               //      override the drawing of the content when the item is 
disabled
-               //      the wrong lowcolor is used when the item is disabled 
since the
-               //      text color does not change
-               DrawContentLabel();     
+               // override the drawing of the content when the item is disabled
+               // the wrong lowcolor is used when the item is disabled since 
the
+               // text color does not change
+               DrawContentLabel();
        }
 
        // Draw the expandable icon.
@@ -387,42 +391,42 @@
                } else {
                        rgb_color outlineColor = {80, 80, 80, 255};
                        rgb_color middleColor = {200, 200, 200, 255};
-       
+
                        menu->SetDrawingMode(B_OP_OVER);
-       
+
                        if (!fExpanded) {
                                menu->BeginLineArray(6);
-       
-                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
1), 
+
+                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
1),
                                        BPoint(rect.left + 3, rect.bottom - 1), 
outlineColor);
-                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
1), 
+                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
1),
                                        BPoint(rect.left + 7, rect.top + 5), 
outlineColor);
-                               menu->AddLine(BPoint(rect.left + 7, rect.top + 
5), 
+                               menu->AddLine(BPoint(rect.left + 7, rect.top + 
5),
                                        BPoint(rect.left + 3, rect.bottom - 1), 
outlineColor);
-       
-                               menu->AddLine(BPoint(rect.left + 4, rect.top + 
3), 
+
+                               menu->AddLine(BPoint(rect.left + 4, rect.top + 
3),
                                        BPoint(rect.left + 4, rect.bottom - 3), 
middleColor);
-                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
4), 
+                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
4),
                                        BPoint(rect.left + 5, rect.bottom - 4), 
middleColor);
-                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
5), 
+                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
5),
                                        BPoint(rect.left + 6, rect.top + 5), 
middleColor);
                                menu->EndLineArray();
                        } else {
                                // expanded state
-       
+
                                menu->BeginLineArray(6);
-                               menu->AddLine(BPoint(rect.left + 1, rect.top + 
3), 
+                               menu->AddLine(BPoint(rect.left + 1, rect.top + 
3),
                                        BPoint(rect.right - 3, rect.top + 3), 
outlineColor);
-                               menu->AddLine(BPoint(rect.left + 1, rect.top + 
3), 
+                               menu->AddLine(BPoint(rect.left + 1, rect.top + 
3),
                                        BPoint(rect.left + 5, rect.top + 7), 
outlineColor);
-                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
7), 
+                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
7),
                                        BPoint(rect.right - 3, rect.top + 3), 
outlineColor);
-       
-                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
4), 
+
+                               menu->AddLine(BPoint(rect.left + 3, rect.top + 
4),
                                        BPoint(rect.right - 5, rect.top + 4), 
middleColor);
-                               menu->AddLine(BPoint(rect.left + 4, rect.top + 
5), 
+                               menu->AddLine(BPoint(rect.left + 4, rect.top + 
5),
                                        BPoint(rect.right - 6, rect.top + 5), 
middleColor);
-                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
5), 
+                               menu->AddLine(BPoint(rect.left + 5, rect.top + 
5),
                                        BPoint(rect.left + 5, rect.top + 6), 
middleColor);
                                menu->EndLineArray();
                        }
@@ -437,23 +441,24 @@
        BMenu* menu = Menu();
        menu->MovePenBy(0, fLabelAscent);
 
-       float cachedWidth = menu->StringWidth(Label()); 
+       float cachedWidth = menu->StringWidth(Label());
        if (Submenu() && fVertical)
                cachedWidth += 18;
 
        const char* label = Label();
        char* truncLabel = NULL;
        float max = 0;
+
        if (static_cast<TBarApp*>(be_app)->Settings()->superExpando && 
fVertical)
                max = menu->MaxContentWidth() - kSwitchWidth;
        else
                max = menu->MaxContentWidth();
 
        if (max > 0) {
-               BPoint penloc = menu->PenLocation();
+               BPoint penloc = menu->PenLocation();
                BRect frame = Frame();
                float offset = penloc.x - frame.left;
-               if (cachedWidth + offset > max) {
+               if (cachedWidth + offset > max) {
                        truncLabel = (char*)malloc(strlen(label) + 4);
                        if (!truncLabel)
                                return;
@@ -491,7 +496,7 @@
 TTeamMenuItem::ToggleExpandState(bool resizeWindow)
 {
        fExpanded = !fExpanded;
-       
+
        if (fExpanded) {
                // Populate Menu() with the stuff from SubMenu().
                TWindowMenu* sub = (static_cast<TWindowMenu*>(Submenu()));
@@ -503,7 +508,7 @@
                        if (locked)
                                sub->UnlockLooper();
 
-                       if (sub->CountItems() > 1){
+                       if (sub->CountItems() > 1) {
                                TExpandoMenuBar* parent = 
static_cast<TExpandoMenuBar*>(Menu());
                                int myindex = parent->IndexOf(this) + 1;
 
@@ -551,8 +556,10 @@
 TWindowMenuItem*
 TTeamMenuItem::ExpandedWindowItem(int32 id)
 {
-       if (!fExpanded) // Paranoia
+       if (!fExpanded) {
+               // Paranoia
                return NULL;
+       }
 
        TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu());
        int childIndex = parent->IndexOf(this) + 1;

Modified: haiku/trunk/src/apps/deskbar/TeamMenuItem.h
===================================================================
--- haiku/trunk/src/apps/deskbar/TeamMenuItem.h 2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/TeamMenuItem.h 2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 #ifndef TEAMMENUITEM_H
@@ -53,7 +54,7 @@
                        float width = -1.0f, float height = -1.0f,
                        bool drawLabel = true, bool vertical = true);
                TTeamMenuItem(float width = -1.0f, float height = -1.0f,
-                       bool vertical=true);
+                       bool vertical = true);
                virtual ~TTeamMenuItem();
 
                status_t Invoke(BMessage* msg = NULL);
@@ -82,7 +83,7 @@
                friend class TExpandoMenuBar;
                void InitData(BList* team, BBitmap* icon, char* name, char* sig,
                        float width = -1.0f, float height = -1.0f,
-                       bool drawLabel = true,bool vertical=true);
+                       bool drawLabel = true, bool vertical = true);
 
                bool _IsSelected() const;
 

Modified: haiku/trunk/src/apps/deskbar/TimeView.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/TimeView.cpp   2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/TimeView.cpp   2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 
@@ -154,9 +155,9 @@
 
        GetCurrentTime();
 
-       // TODO: SetOrientation never gets called, fix that
-       // When in vertical mode, we want to limit the width so that it can't
-       // overlap the bevels in the parent view.
+       // TODO: SetOrientation never gets called, fix that when in vertical 
mode,
+       // we want to limit the width so that it can't overlap the bevels in the
+       // parent view.
        *width = fOrientation ?
                min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
                : kHMargin + StringWidth(fTimeStr);
@@ -217,6 +218,7 @@
 
                default:
                        BView::MessageReceived(message);
+                       break;
        }
 }
 
@@ -262,8 +264,8 @@
 
        fLocale.FormatDate(tmp, 64, fTime, B_FULL_DATE_FORMAT);
 
-       //      remove leading 0 from date when month is less than 10 (MM/DD/YY)
-       //  or remove leading 0 from date when day is less than 10 (DD/MM/YY)
+       // remove leading 0 from date when month is less than 10 (MM/DD/YY)
+       // or remove leading 0 from date when day is less than 10 (DD/MM/YY)
        const char* str = tmp;
        if (str[0] == '0')
                str++;
@@ -325,7 +327,7 @@
                // For dates, Update() could be called two times in a row,
                // but that should only happen very rarely
                if ((fLastTimeStr[1] != fTimeStr[1]
-                               && (fLastTimeStr[1] == ':' || fTimeStr[1] == 
':'))
+                       && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':'))
                        || !fLastTimeStr[0])
                        Update();
 
@@ -360,7 +362,6 @@
        GetCurrentTime();
        GetCurrentDate();
 
-
        SetToolTip(fDateStr);
 
        ResizeToPreferred();

Modified: haiku/trunk/src/apps/deskbar/TimeView.h
===================================================================
--- haiku/trunk/src/apps/deskbar/TimeView.h     2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/TimeView.h     2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 #ifndef TIME_VIEW_H
@@ -73,7 +74,7 @@
                void            MouseDown(BPoint where);
                void            Pulse();
 
-               bool            ShowingSeconds()        { return fShowSeconds; }
+               bool            ShowingSeconds() { return fShowSeconds; }
                void            ShowSeconds(bool);
                void            ShowCalendar(BPoint where);
 
@@ -109,7 +110,7 @@
 
                float           fMaxWidth;
                float           fHeight;
-               bool            fOrientation;           // vertical = true
+               bool            fOrientation; // vertical = true
                BPoint          fTimeLocation;
                BPoint          fDateLocation;
 

Modified: haiku/trunk/src/apps/deskbar/WindowMenu.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/WindowMenu.cpp 2011-03-06 16:42:58 UTC (rev 
40848)
+++ haiku/trunk/src/apps/deskbar/WindowMenu.cpp 2011-03-06 16:57:59 UTC (rev 
40849)
@@ -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.
 */
 
@@ -88,16 +89,14 @@
 TWindowMenu::AttachedToWindow()
 {
        SetFont(be_plain_font);
-
        RemoveItems(0, CountItems(), true);
-
        int32 miniCount = 0;
 
        bool dragging = false;
        TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView();
        if (barview && barview->LockLooper()) {
-               //      'dragging' mode set in BarView::CacheDragData

[... truncated: 214 lines follow ...]

Other related posts: