Ticket #7052: Deskbar Style Changes and Refactoring 3.diff

File Deskbar Style Changes and Refactoring 3.diff, 71.1 KB (added by jscipione, 13 years ago)

Deskbar Style Super Mega Patch. Delete evil spaces at the beginning and end of lines. No your comments are not so special that they deserve and extra indent. No your comments are not so special that they get a tab after instead of a space. No you cannot use a tab instead of a space if the tab happens to indent by 1 space. Spaces around binary operators. Other stuff.

  • src/apps/deskbar/BarApp.cpp

    diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
    index 2647068..6cc209a 100644
    a b All rights reserved.  
    6060#include "PublicCommands.h"
    6161#include "ResourceSet.h"
    6262#include "Switcher.h"
    63 #include "TeamMenu.h"
    64 #include "WindowMenuItem.h"
    6563
    6664
    6765BLocker TBarApp::sSubscriberLock;
    BList TBarApp::sSubscribers;  
    7270const uint32 kShowBeMenu = 'BeMn';
    7371const uint32 kShowTeamMenu = 'TmMn';
    7472
    75 const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f);
    7673
     74const BRect kIconRect(0.0f, 0.0f, 15.0f, 15.0f);
    7775static const color_space kIconFormat = B_RGBA32;
    7876
    7977
    TBarApp::SaveSettings()  
    190188        storedSettings.AddFloat("width", fSettings.width);
    191189        storedSettings.AddBool("showTime", fSettings.showTime);
    192190        storedSettings.AddPoint("switcherLoc", fSettings.switcherLoc);
    193         storedSettings.AddInt32("recentAppsCount",
    194             fSettings.recentAppsCount);
    195         storedSettings.AddInt32("recentDocsCount",
    196             fSettings.recentDocsCount);
    197         storedSettings.AddBool("timeShowSeconds",
    198             fSettings.timeShowSeconds);
     191        storedSettings.AddInt32("recentAppsCount", fSettings.recentAppsCount);
     192        storedSettings.AddInt32("recentDocsCount", fSettings.recentDocsCount);
     193        storedSettings.AddBool("timeShowSeconds", fSettings.timeShowSeconds);
    199194        storedSettings.AddInt32("recentFoldersCount",
    200195            fSettings.recentFoldersCount);
    201196        storedSettings.AddBool("alwaysOnTop", fSettings.alwaysOnTop);
    202197        storedSettings.AddBool("timeFullDate", fSettings.timeFullDate);
    203198        storedSettings.AddBool("trackerAlwaysFirst",
    204199            fSettings.trackerAlwaysFirst);
    205         storedSettings.AddBool("sortRunningApps",
    206             fSettings.sortRunningApps);
    207         storedSettings.AddBool("superExpando",
    208             fSettings.superExpando);
    209         storedSettings.AddBool("expandNewTeams",
    210             fSettings.expandNewTeams);
    211         storedSettings.AddBool("autoRaise",
    212             fSettings.autoRaise);
     200        storedSettings.AddBool("sortRunningApps", fSettings.sortRunningApps);
     201        storedSettings.AddBool("superExpando", fSettings.superExpando);
     202        storedSettings.AddBool("expandNewTeams", fSettings.expandNewTeams);
     203        storedSettings.AddBool("autoRaise", fSettings.autoRaise);
    213204        storedSettings.AddBool("recentAppsEnabled",
    214205            fSettings.recentAppsEnabled);
    215206        storedSettings.AddBool("recentDocsEnabled",
    TBarApp::InitSettings()  
    291282                &settings.trackerAlwaysFirst);
    292283            storedSettings.FindBool("sortRunningApps",
    293284                &settings.sortRunningApps);
    294             storedSettings.FindBool("superExpando",
    295                 &settings.superExpando);
    296             storedSettings.FindBool("expandNewTeams",
    297                 &settings.expandNewTeams);
    298             storedSettings.FindBool("autoRaise",
    299                 &settings.autoRaise);
     285            storedSettings.FindBool("superExpando", &settings.superExpando);
     286            storedSettings.FindBool("expandNewTeams", &settings.expandNewTeams);
     287            storedSettings.FindBool("autoRaise", &settings.autoRaise);
    300288            storedSettings.FindBool("recentAppsEnabled",
    301289                &settings.recentAppsEnabled);
    302290            storedSettings.FindBool("recentDocsEnabled",
    TBarApp::InitSettings()  
    313301void
    314302TBarApp::MessageReceived(BMessage* message)
    315303{
    316     int32 count;
    317     bool enabled;
    318304    switch (message->what) {
    319305        case 'gloc':
    320306        case 'sloc':
    TBarApp::MessageReceived(BMessage* message)  
    353339            break;
    354340
    355341        case kUpdateRecentCounts:
     342            int32 count;
     343            bool enabled;
     344
    356345            if (message->FindInt32("applications", &count) == B_OK)
    357346                fSettings.recentAppsCount = count;
    358347            if (message->FindBool("applicationsEnabled", &enabled) == B_OK)
    TBarApp::MessageReceived(BMessage* message)  
    423412        {
    424413            fSettings.autoRaise = !fSettings.autoRaise;
    425414
    426             TBarView* barView = static_cast<TBarApp*>(be_app)->BarView();
    427415            fBarWindow->Lock();
    428             barView->UpdateAutoRaise();
     416            BarView()->UpdateAutoRaise();
    429417            fBarWindow->Unlock();
    430418            break;
    431419        }
    TBarApp::MessageReceived(BMessage* message)  
    434422        {
    435423            fSettings.trackerAlwaysFirst = !fSettings.trackerAlwaysFirst;
    436424
    437             TBarView* barView = static_cast<TBarApp*>(be_app)->BarView();
    438425            fBarWindow->Lock();
    439             barView->UpdatePlacement();
     426            BarView()->UpdatePlacement();
    440427            fBarWindow->Unlock();
    441428            break;
    442429        }
    TBarApp::MessageReceived(BMessage* message)  
    445432        {
    446433            fSettings.sortRunningApps = !fSettings.sortRunningApps;
    447434
    448             TBarView* barView = static_cast<TBarApp*>(be_app)->BarView();
    449435            fBarWindow->Lock();
    450             barView->UpdatePlacement();
     436            BarView()->UpdatePlacement();
    451437            fBarWindow->Unlock();
    452438            break;
    453439        }
    TBarApp::MessageReceived(BMessage* message)  
    464450        {
    465451            fSettings.superExpando = !fSettings.superExpando;
    466452
    467             TBarView* barView = static_cast<TBarApp*>(be_app)->BarView();
    468453            fBarWindow->Lock();
    469             barView->UpdatePlacement();
     454            BarView()->UpdatePlacement();
    470455            fBarWindow->Unlock();
    471456            break;
    472457        }
    TBarApp::MessageReceived(BMessage* message)  
    475460        {
    476461            fSettings.expandNewTeams = !fSettings.expandNewTeams;
    477462
    478             TBarView* barView = static_cast<TBarApp*>(be_app)->BarView();
    479463            fBarWindow->Lock();
    480             barView->UpdatePlacement();
     464            BarView()->UpdatePlacement();
    481465            fBarWindow->Unlock();
    482466            break;
    483467        }
    TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)  
    636620    BAppFileInfo appMime(&file);
    637621
    638622    BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
    639         new BBitmap(kIconSize, kIconFormat), strdup(ref->name));
     623        new BBitmap(kIconRect, kIconFormat), strdup(ref->name));
    640624
    641625    barInfo->teams->AddItem((void*)team);
    642626    if (appMime.GetIcon(barInfo->icon, B_MINI_ICON) != B_OK)
  • src/apps/deskbar/BarApp.h

    diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
    index 6f15838..c3fd47b 100644
    a b class TBarApp : public BApplication {  
    141141        static void Unsubscribe(const BMessenger &subscriber);
    142142
    143143    private:
    144         void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *);
     144        void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref*);
    145145        void RemoveTeam(team_id);
    146146
    147147        void InitSettings();
  • src/apps/deskbar/BarMenuBar.cpp

    diff --git a/src/apps/deskbar/BarMenuBar.cpp b/src/apps/deskbar/BarMenuBar.cpp
    index b246eb3..da27803 100644
    a b init_tracking_hook(BMenuItem* item, bool (*hookFunction)(BMenu*, void*),  
    180180
    181181    BMenu* windowMenu = item->Submenu();
    182182    if (windowMenu)
    183         //  have a menu, set the tracking hook
     183        // have a menu, set the tracking hook
    184184        windowMenu->SetTrackingHook(hookFunction, state);                   
    185185}
    186186
    TBarMenuBar::InitTrackingHook(bool (*hookFunction)(BMenu*, void*),  
    192192    BPoint loc;
    193193    uint32 buttons;
    194194    GetMouse(&loc, &buttons);
    195     //  set the hook functions for the two menus
    196     //  will always have the be menu
    197     //  may have the app menu as well (mini mode)
     195    // set the hook functions for the two menus
     196    // will always have the be menu
     197    // may have the app menu as well (mini mode)
    198198    if (fBeMenuItem->Frame().Contains(loc) || both)
    199199        init_tracking_hook(fBeMenuItem, hookFunction, state);
    200200
  • src/apps/deskbar/BarMenuBar.h

    diff --git a/src/apps/deskbar/BarMenuBar.h b/src/apps/deskbar/BarMenuBar.h
    index ef21df1..620eb77 100644
    a b class TBarMenuBar : public BMenuBar {  
    6363
    6464        void InitTrackingHook(bool (* hookfunction)(BMenu*, void*), void* state,
    6565            bool both = false);
    66    
     66
    6767    private:
    6868        TBarView* fBarView;
    6969        TBarMenuTitle* fBeMenuItem;
  • src/apps/deskbar/BarMenuTitle.cpp

    diff --git a/src/apps/deskbar/BarMenuTitle.cpp b/src/apps/deskbar/BarMenuTitle.cpp
    index df8b0d2..9c9195c 100644
    a b TBarMenuTitle::DrawContent()  
    123123            dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2)
    124124                - 1.0f), rintf(((frame.Height() - dstRect.Height()) / 2)
    125125                - 0.0f));
    126    
     126
    127127            menu->DrawBitmapAsync(fIcon, dstRect);
    128128        }
    129129        return;
    TBarMenuTitle::Invoke(BMessage* message)  
    204204            looper->Unlock();
    205205        }
    206206    }
    207        
     207
    208208    return BMenuItem::Invoke(message);
    209209}
    210210
  • src/apps/deskbar/BarMenuTitle.h

    diff --git a/src/apps/deskbar/BarMenuTitle.h b/src/apps/deskbar/BarMenuTitle.h
    index be7aa99..9324aa1 100644
    a b class BMenu;  
    4646
    4747class TBarMenuTitle : public BMenuItem {
    4848public:
    49     TBarMenuTitle(float width,float height, const BBitmap* icon,
    50         BMenu* menu, bool inexpando = false);
     49    TBarMenuTitle(float width, float height, const BBitmap* icon,
     50        BMenu* menu, bool inexpando = false);
    5151    virtual ~TBarMenuTitle();
    5252
    5353    void SetWidthHeight(float width, float height);
    5454    void Draw();
    5555
    5656    status_t Invoke(BMessage* message);
    57        
     57
    5858protected:
    5959    void DrawContent();
    6060    void GetContentSize(float* width, float* height);
  • src/apps/deskbar/BarView.cpp

    diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
    index 53dfeec..649bc3d 100644
    a b TBarView::PlaceBeMenu()  
    206206        fBarMenuBar = NULL;
    207207    }
    208208
    209     //  top or bottom expando mode has Be menu built in for tracking
    210     //  only for vertical mini or expanded
    211     //  mini mode will have team menu added as part of BarMenuBar
     209    // top or bottom expando mode has Be menu built in for tracking
     210    // only for vertical mini or expanded
     211    // mini mode will have team menu added as part of BarMenuBar
    212212    if (fVertical && !fBarMenuBar) {
    213213        //  create the Be menu
    214214        BRect mbarFrame(Bounds());
    TBarView::PlaceBeMenu()  
    217217        AddChild(fBarMenuBar);
    218218    }
    219219
    220     //  if there isn't a bemenu at this point,
    221     //  DB should be in top/bottom mode, else error
     220    // if there isn't a bemenu at this point,
     221    // DB should be in top/bottom mode, else error
    222222    if (!fBarMenuBar)
    223223        return;
    224224       
    TBarView::SaveSettings()  
    404404    settings->state = (uint32)State();
    405405    settings->width = 0;
    406406    settings->showTime = ShowingClock();
    407    
     407
    408408    fReplicantTray->RememberClockSettings();
    409     settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL)
    410         != 0;
     409    settings->alwaysOnTop
     410        = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL) != 0;
    411411}
    412412
    413413
    TBarView::UpdateAutoRaise()  
    424424void
    425425TBarView::UpdatePlacement()
    426426{
    427     ChangeState(fState, fVertical, fLeft, fTop);   
     427    ChangeState(fState, fVertical, fLeft, fTop);
    428428}
    429429
    430430
    TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)  
    455455    BString* signature = NULL;
    456456    if (fVertical && Expando()
    457457        && static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
    458         // Get a list of the signatures of expanded apps. Can't use 
     458        // Get a list of the signatures of expanded apps. Can't use
    459459        // team_id because there can be more than one team per application
    460460        if (fVertical && Expando() && vertical && fExpando) {
    461461            for (int index = 0; index < fExpando->CountItems(); index++) {
    TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)  
    469469        }
    470470    }
    471471
    472     PlaceApplicationBar(screenFrame);
    473     SizeWindow(screenFrame);
    474     PositionWindow(screenFrame);
    475     Window()->UpdateIfNeeded();
     472    PlaceApplicationBar(screenFrame);
     473    SizeWindow(screenFrame);
     474    PositionWindow(screenFrame);
     475    Window()->UpdateIfNeeded();
    476476
    477477    // Re-expand those apps.
    478478    if (expandedItems.CountItems() > 0) {
    TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)  
    505505}
    506506
    507507
    508 //  window placement functions
     508// window placement functions
    509509
    510510bool
    511511TBarView::Vertical() const
    void  
    586586TBarView::CacheDragData(const BMessage* incoming)
    587587{
    588588    if (!incoming)
    589         return; 
     589        return;
    590590
    591591    if (Dragging() && SpringLoadedFolderCompareMessages(incoming, fDragMessage))
    592592        return;
    init_tracking_hook(BMenuItem* item,  
    614614
    615615status_t
    616616TBarView::DragStart()
    617 {   
     617{
    618618    if (!Dragging())
    619619        return B_OK;
    620620
    TBarView::DragStart()  
    634634            if (item == fLastDragItem)
    635635                return B_OK;
    636636
    637             fLastDragItem = item;       
    638         }                   
     637            fLastDragItem = item;
     638        }
    639639    }
    640640
    641641    return B_OK;
  • src/apps/deskbar/BarWindow.cpp

    diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp
    index 26b02b7..44f6963 100644
    a b All rights reserved.  
    5858#include <MessagePrivate.h>
    5959
    6060
    61 // This is a very ugly hack to be able to call the private BMenuBar::StartMenuBar()
    62 // method from the TBarWindow::ShowBeMenu() method.
     61// This is a very ugly hack to be able to call the private
     62// BMenuBar::StartMenuBar() method from the TBarWindow::ShowBeMenu() method.
    6363// Don't do this at home -- but why the hell is this method private?
    6464#if __MWERKS__
    6565    #define BMenuBar_StartMenuBar_Hack StartMenuBar__8BMenuBarFlbbP5BRect
    TBarWindow::ShowBeMenu()  
    312312    if (menuBar == NULL)
    313313        return;
    314314
    315     BMenuBar_StartMenuBar_Hack(menuBar,0,true,true,NULL);
     315    BMenuBar_StartMenuBar_Hack(menuBar, 0, true, true, NULL);
    316316}
    317317
    318318
    TBarWindow::ShowTeamMenu()  
    326326    if (KeyMenuBar() == NULL)
    327327        return;
    328328
    329     BMenuBar_StartMenuBar_Hack(KeyMenuBar(),index,true,true,NULL);
     329    BMenuBar_StartMenuBar_Hack(KeyMenuBar(), index, true, true, NULL);
    330330}
    331331
    332332
    333 /** determines the actual location of the window */
     333// determines the actual location of the window
    334334
    335335deskbar_location
    336336TBarWindow::DeskbarLocation() const
    TBarWindow::_IsFocusMessage(BMessage* message)  
    632632
    633633    return true;
    634634}
     635
  • src/apps/deskbar/BeMenu.h

    diff --git a/src/apps/deskbar/BeMenu.h b/src/apps/deskbar/BeMenu.h
    index 276275d..3862dba 100644
    a b All rights reserved.  
    4242class TBarView;
    4343
    4444enum recent_type {
    45     kRecentDocuments    = 0,
     45    kRecentDocuments = 0,
    4646    kRecentApplications,
    4747    kRecentFolders,
    4848    kRecentAppDocuments
    class TBeMenu : public BNavMenu {  
    118118
    119119        bool            AddStandardBeMenuItems();
    120120
    121     private:       
    122         virtual bool    StartBuildingItemList();
     121    private:
     122        virtual bool    StartBuildingItemList();
    123123        virtual void    DoneBuildingItemList();
    124         virtual bool    AddNextItem();
    125         virtual void    ClearMenuBuildingState();
     124        virtual bool    AddNextItem();
     125        virtual void    ClearMenuBuildingState();
    126126
    127         //  to keep track of the menu building state
     127        // to keep track of the menu building state
    128128        State           fAddState; 
    129         TBarView        *fBarView;
     129        TBarView*       fBarView;
    130130};
    131131
    132132#endif  /* _BE_MENU_H_ */
  • src/apps/deskbar/CalendarMenuWindow.cpp

    diff --git a/src/apps/deskbar/CalendarMenuWindow.cpp b/src/apps/deskbar/CalendarMenuWindow.cpp
    index 7cdbb61..c7af6d1 100644
    a b using BPrivate::B_WEEK_START_SUNDAY;  
    2424using BPrivate::B_WEEK_START_MONDAY;
    2525
    2626
    27 // #pragma mark -- FlatButton
     27//  #pragma mark -- FlatButton
    2828
    2929
    3030class FlatButton : public BButton {
    FlatButton::Draw(BRect updateRect)  
    6666}
    6767
    6868
    69 // #pragma mark -- CalendarMenuWindow
     69//  #pragma mark -- CalendarMenuWindow
    7070
    7171
    7272enum {
  • src/apps/deskbar/CalendarMenuWindow.h

    diff --git a/src/apps/deskbar/CalendarMenuWindow.h b/src/apps/deskbar/CalendarMenuWindow.h
    index 57b627e..27d6e1a 100644
    a b public:  
    2525                    CalendarMenuWindow(BPoint where);
    2626    virtual         ~CalendarMenuWindow();
    2727
    28     virtual void    Show();
    29     virtual void    WindowActivated(bool active);
    30     virtual void    MessageReceived(BMessage* message);
     28    virtual void    Show();
     29    virtual void    WindowActivated(bool active);
     30    virtual void    MessageReceived(BMessage* message);
    3131
    3232private:
    3333    void            _UpdateUI(const BDate& date);
  • src/apps/deskbar/DeskBarUtils.cpp

    diff --git a/src/apps/deskbar/DeskBarUtils.cpp b/src/apps/deskbar/DeskBarUtils.cpp
    index 151fd60..74f18af 100644
    a b AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)  
    6060        int32 count = 0;
    6161        uint32 type = 0;
    6262        entry_ref ref;
    63        
     63
    6464        m->GetInfo("refs", &type, &count);
    6565        if (count <= 0)
    6666            return;
    67            
     67
    6868        BPath path;
    6969        BSymLink link;
    7070        BDirectory dir;
    AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)  
    7272            ref = *subdirectory;
    7373            BEntry entry(&ref);
    7474            if (entry.Exists()) {
    75                 //  if the ref is a file
    76                 //  get the parent and convert it to a ref
     75                // if the ref is a file get the parent and convert it to a ref
    7776                if (entry.IsFile()) {
    7877                    BEntry parent;
    7978                    entry.GetParent(&parent);
    AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)  
    8180                }
    8281            } else
    8382                return;
    84                
     83
    8584            dir.SetTo(&ref);
    8685        } else {
    8786            if (find_directory(B_USER_DESKBAR_DIRECTORY, &path) == B_OK)
    AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)  
    8988            else
    9089                return;
    9190        }
    92            
     91
    9392        for (long i = 0; i < count; i++) {
    9493            if (m->FindRef("refs", i, &ref) == B_NO_ERROR) {
    95 
    9694                BEntry entry(&ref);
    9795                entry.GetPath(&path);
    98                
     96
    9997                dir.CreateSymLink(ref.name, path.Path(), &link);
    10098            }
    10199        }
  • src/apps/deskbar/ExpandoMenuBar.cpp

    diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp
    index 0fd4483..b83560c 100644
    a b TExpandoMenuBar::AttachedToWindow()  
    118118            R_BeLogoIcon);
    119119        if (logoBitmap != NULL)
    120120            fBeMenuWidth = logoBitmap->Bounds().Width() + 16;
    121         fBeMenuItem = new TBarMenuTitle(fBeMenuWidth, Frame().Height(),
    122             logoBitmap, beMenu, true);
     121        fBeMenuItem = new TBarMenuTitle(fBeMenuWidth, Frame().Height(),
     122            logoBitmap, beMenu, true);
    123123        AddItem(fBeMenuItem);
    124124
    125125        fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical);
    TExpandoMenuBar::RemoveTeam(team_id team, bool partial)  
    584584                RemoveItem(i);
    585585
    586586                if (fVertical) {
    587                     //  instead of resizing the window here and there in the
    588                     //  code the resize method will be centered in one place
    589                     //  thus, the same behavior (good or bad) will be used
    590                     //  whereever window sizing is done
     587                    // instead of resizing the window here and there in the
     588                    // code the resize method will be centered in one place
     589                    // thus, the same behavior (good or bad) will be used
     590                    // whereever window sizing is done
    591591                    fBarView->SizeWindow(BScreen(Window()).Frame());
    592592                } else
    593593                    CheckItemSizes(-1);
    TExpandoMenuBar::CheckItemSizes(int32 delta)  
    613613
    614614    if (!fBarView->Vertical()) {
    615615        // in this case there are 2 extra items:
    616         //      The Be Menu
    617         //      The little separator item
     616        //   - The Be Menu
     617        //   - The little separator item
    618618        fullWidth = fullWidth - (sMinimumWindowWidth * 2)
    619619            + (fBeMenuWidth + kSepItemWidth);
    620620        width -= (fBeMenuWidth + kSepItemWidth);
    void  
    713713TExpandoMenuBar::CheckForSizeOverrun()
    714714{
    715715    BRect screenFrame = (BScreen(Window())).Frame();
    716     if (fVertical)
    717         fIsScrolling = Window()->Frame().bottom > screenFrame.bottom;
    718     else
    719         fIsScrolling = false;
     716
     717    fIsScrolling = fVertical ? Window()->Frame().bottom > screenFrame.bottom
     718                             : false;
    720719}
    721720
    722721
    TExpandoMenuBar::monitor_team_windows(void* arg)  
    744743            // Set all WindowMenuItems to require an update.
    745744            TWindowMenuItem* item = NULL;
    746745            for (int32 i = 0; i < totalItems; i++) {
    747                 if (!teamMenu->SubmenuAt(i)){
     746                if (!teamMenu->SubmenuAt(i)) {
    748747                    item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i));
    749748                    item->SetRequireUpdate();
    750749                }
    TExpandoMenuBar::monitor_team_windows(void* arg)  
    814813
    815814            // Remove any remaining items which require an update.
    816815            for (int32 i = 0; i < totalItems; i++) {
    817                 if (!teamMenu->SubmenuAt(i)){
     816                if (!teamMenu->SubmenuAt(i)) {
    818817                    item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i));
    819818                    if (item && item->RequiresUpdate()) {
    820819                        item = static_cast<TWindowMenuItem*>
  • src/apps/deskbar/ExpandoMenuBar.h

    diff --git a/src/apps/deskbar/ExpandoMenuBar.h b/src/apps/deskbar/ExpandoMenuBar.h
    index 928555c..0a2719b 100644
    a b All rights reserved.  
    3434#ifndef EXPANDO_MENU_BAR_H
    3535#define EXPANDO_MENU_BAR_H
    3636
    37 //  application list
    38 //  top level at window
    39 //  in expanded mode horizontal and vertical
     37// application list
     38// top level at window
     39// in expanded mode horizontal and vertical
    4040
    4141
    4242#include <MenuBar.h>
  • src/apps/deskbar/PreferencesWindow.cpp

    diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
    index aecbba7..bb378f1 100644
    a b PreferencesWindow::PreferencesWindow(BRect frame)  
    3535    // Controls
    3636    fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"),
    3737        new BMessage(kUpdateRecentCounts));
    38     fMenuRecentApplications = new BCheckBox(
    39         B_TRANSLATE("Recent applications:"),
     38    fMenuRecentApplications = new BCheckBox(B_TRANSLATE("Recent applications:"),
    4039        new BMessage(kUpdateRecentCounts));
    4140    fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"),
    4241        new BMessage(kUpdateRecentCounts));
    PreferencesWindow::PreferencesWindow(BRect frame)  
    5251        new BMessage(kSortRunningApps));
    5352    fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"),
    5453        new BMessage(kTrackerFirst));
    55     fAppsShowExpanders = new BCheckBox(
    56         B_TRANSLATE("Show application expander"),
     54    fAppsShowExpanders = new BCheckBox(B_TRANSLATE("Show application expander"),
    5755        new BMessage(kSuperExpando));
    5856    fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"),
    5957        new BMessage(kExpandNewTeams));
    PreferencesWindow::PreferencesWindow(BRect frame)  
    8381
    8482    // Values
    8583    TBarApp* barApp = static_cast<TBarApp*>(be_app);
    86     desk_settings* appSettings = barApp->Settings();;
     84    desk_settings* appSettings = barApp->Settings();
    8785
    8886    fAppsSort->SetValue(appSettings->sortRunningApps);
    8987    fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst);
  • src/apps/deskbar/PreferencesWindow.h

    diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
    index 9bacafd..a45005c 100644
    a b public:  
    2828                            PreferencesWindow(BRect frame);
    2929                            ~PreferencesWindow();
    3030
    31     virtual void            MessageReceived(BMessage* message);
    32     virtual void            WindowActivated(bool active);
     31    virtual void            MessageReceived(BMessage* message);
     32    virtual void            WindowActivated(bool active);
    3333
    3434private:
    3535            void            _UpdateRecentCounts();
  • src/apps/deskbar/ResourceSet.cpp

    diff --git a/src/apps/deskbar/ResourceSet.cpp b/src/apps/deskbar/ResourceSet.cpp
    index 6bbb33b..d1d0dbf 100644
    a b namespace TResourcePrivate {  
    7070            :   fDeleteOK(false)
    7171        {
    7272        }
    73        
     73
    7474        virtual ~TypeObject()
    7575        {
    7676            if (!fDeleteOK)
    7777                debugger("deleting object owned by BResourceSet");
    7878        }
    79        
     79
    8080        void Delete()
    8181        {
    8282            fDeleteOK = true;
    8383        }
    84        
     84
    8585    private:
    8686        TypeObject(const TypeObject &);
    8787        TypeObject &operator=(const TypeObject &);
    8888        bool operator==(const TypeObject &);
    8989        bool operator!=(const TypeObject &);
    90        
     90
    9191        bool fDeleteOK;
    9292    };
    93    
     93
    9494    class BitmapTypeItem : public BBitmap, public TypeObject {
    9595    public:
    9696        BitmapTypeItem(BRect bounds, uint32 flags, color_space depth,
    namespace TResourcePrivate {  
    9999            :   BBitmap(bounds, flags, depth, bytesPerRow, screenID)
    100100        {
    101101        }
    102        
     102
    103103        BitmapTypeItem(const BBitmap* source, bool accepts_views = false,
    104104            bool need_contiguous = false)
    105105            :   BBitmap(source, accepts_views, need_contiguous)
    106106        {
    107107        }
    108        
     108
    109109        BitmapTypeItem(BMessage* data)
    110110            :   BBitmap(data)
    111111        {
    112112        }
    113        
     113
    114114        virtual ~BitmapTypeItem()
    115115        {
    116116        }
    117117    };
    118    
     118
    119119    class StringBlockTypeItem : public TStringBlock, public TypeObject {
    120120    public:
    121121        StringBlockTypeItem(BDataIO* data)
    122122            :   TStringBlock(data)
    123123        {
    124124        }
    125        
     125
    126126        StringBlockTypeItem(const void* block, size_t size)
    127127            :   TStringBlock(block, size)
    128128        {
    129129        }
    130        
     130
    131131        virtual ~StringBlockTypeItem()
    132132        {
    133133        }
    134134    };
    135    
     135
    136136    class TypeItem {
    137137    public:
    138138        TypeItem(int32 id, const char* name, const void* data, size_t size)
    namespace TResourcePrivate {  
    141141              fOwnData(false), fSourceIsFile(false)
    142142        {
    143143        }
    144        
     144
    145145        TypeItem(int32 id, const char* name, BFile* file)
    146146            :   fID(id),
    147147                fName(name),
    namespace TResourcePrivate {  
    162162                }
    163163            }
    164164        }
    165        
     165
    166166        virtual ~TypeItem()
    167167        {
    168168            if (fOwnData) {
    namespace TResourcePrivate {  
    172172            }
    173173            SetObject(NULL);
    174174        }
    175        
     175
    176176        int32 ID() const
    177             { return fID; }
     177        {
     178            return fID;
     179        }
    178180
    179181        const char* Name() const
    180             { return fName.String(); }
     182        {
     183            return fName.String();
     184        }
    181185
    182186        const void* Data() const
    183             { return fData; }
     187        {
     188            return fData;
     189        }
    184190
    185191        size_t Size() const
    186             { return fSize; }
    187        
     192        {
     193            return fSize;
     194        }
     195
    188196        void SetObject(TypeObject* object)
    189197        {
    190198            if (object == fObject)
    namespace TResourcePrivate {  
    195203        }
    196204
    197205        TypeObject* Object() const
    198             { return fObject; }
    199        
     206        {
     207            return fObject;
     208        }
     209
    200210        void SetSourceIsFile(bool state)
    201             { fSourceIsFile = state; }
     211        {
     212            fSourceIsFile = state;
     213        }
    202214
    203215        bool SourceIsFile() const
    204             { return fSourceIsFile; }
    205        
     216        {
     217            return fSourceIsFile;
     218        }
     219
    206220    private:
    207221        int32 fID;
    208222        BString fName;
    namespace TResourcePrivate {  
    225239            :   fType(type)
    226240        {
    227241        }
    228        
     242
    229243        virtual ~TypeList()
    230244        {
    231245            fItems.DoForEach(FreeTypeItemFunc);
    232246            fItems.MakeEmpty();
    233247        }
    234        
     248
    235249        type_code Type() const
    236             { return fType; }
    237        
     250        {
     251            return fType;
     252        }
     253
    238254        TypeItem* FindItemByID(int32 id)
    239255        {
    240256            for (int32 i = 0; i < fItems.CountItems(); i++ ) {
    namespace TResourcePrivate {  
    254270            }
    255271            return NULL;
    256272        }
    257        
     273
    258274        void AddItem(TypeItem* item)
    259275        {
    260276            fItems.AddItem(item);
    261277        }
    262        
     278
    263279    private:
    264280        type_code fType;
    265281        BList fItems;
    266282    };
    267 
    268283}
    269284
    270285using namespace TResourcePrivate;
    TStringBlock::TStringBlock(BDataIO* data)  
    288303    }
    289304    if (amount > 0)
    290305        pos += amount;
    291    
     306
    292307    fNumEntries = PreIndex(fStrings, amount);
    293308    fIndex = (size_t*)malloc(sizeof(size_t) * fNumEntries);
    294309    MakeIndex(fStrings, amount, fNumEntries, fIndex);
    TStringBlock::TStringBlock(const void* block, size_t size)  
    304319{
    305320    fIndex = (size_t*)const_cast<void*>(block);
    306321    fStrings = (char*)const_cast<void*>(block);
    307    
     322
    308323    // Figure out how many entries there are.
    309324    size_t last_off = 0;
    310325    while (fIndex[fNumEntries] > last_off && fIndex[fNumEntries] < size ) {
    size_t  
    339354TStringBlock::PreIndex(char* strings, ssize_t len)
    340355{
    341356    size_t count = 0;
    342    
    343357    char* orig = strings;
    344358    char* end = strings + len;
    345359    bool in_cr = false;
    346360    bool first = true;
    347361    bool skipping = false;
     362
    348363    while (orig < end) {
    349364        if (*orig == '\n' || *orig == '\r' || *orig == 0) {
    350365            if (!in_cr && *orig == '\r')
    TStringBlock::PreIndex(char* strings, ssize_t len)  
    371386                case '\\':
    372387                    *strings = '\\';
    373388                    break;
    374                    
     389
    375390                case '\n':
    376391                    *strings = '\n';
    377392                    break;
    378                    
     393
    379394                case '\r':
    380395                    *strings = '\r';
    381396                    break;
    382                    
     397
    383398                case '\t':
    384399                    *strings = '\t';
    385400                    break;
    386                    
     401
    387402                default:
    388403                    *strings = *orig;
    389404                    break;
    TStringBlock::PreIndex(char* strings, ssize_t len)  
    394409        orig++;
    395410        strings++;
    396411    }
    397    
    398412    return count;
    399413}
    400414
    TStringBlock::MakeIndex(const char* strings, ssize_t len,  
    405419{
    406420    *resultingIndex++ = 0;
    407421    indexLength--;
    408    
     422
    409423    ssize_t pos = 0;
    410424    while (pos < len && indexLength > 0) {
    411425        if (strings[pos] == 0 ) {
    TResourceSet::AddResources(BResources* RESOURCES_ONLY(resources))  
    475489#if USE_RESOURCES
    476490    if (!resources)
    477491        return B_BAD_VALUE;
    478    
     492
    479493    BAutolock lock(&fLock);
    480494    status_t err = fResources.AddItem(resources) ? B_OK : B_ERROR;
    481495    if (err != B_OK)
    TResourceSet::AddDirectory(const char* fullPath)  
    499513        delete path;
    500514        return err;
    501515    }
    502    
     516
    503517    BAutolock lock(&fLock);
    504518    err = fDirectories.AddItem(path) ? B_OK : B_ERROR;
    505519    if (err != B_OK)
    TResourceSet::AddEnvDirectory(const char* in, const char* defaultValue)  
    514528{
    515529    BString buf;
    516530    status_t err = ExpandString(&buf, in);
    517    
     531
    518532    if (err != B_OK) {
    519533        if (defaultValue)
    520534            return AddDirectory(defaultValue);
    521535        return err;
    522536    }
    523    
     537
    524538    return AddDirectory(buf.String());
    525539}
    526540
    status_t  
    529543TResourceSet::ExpandString(BString* out, const char* in)
    530544{
    531545    const char* start = in;
     546
    532547    while (*in) {
    533548        if (*in == '$') {
    534549            if (start < in)
    535550                 out->Append(start, (int32)(in - start));
    536            
     551
    537552            in++;
    538553            char variableName[1024];
    539554            size_t i = 0;
    TResourceSet::ExpandString(BString* out, const char* in)  
    549564                while ((isalnum(*in) || *in == '_') && i
    550565                    < sizeof(variableName) - 1)
    551566                    variableName[i++] = *in++;
    552            
     567
    553568            start = in;
    554            
    555569            variableName[i] = '\0';
    556            
     570
    557571            const char* val = getenv(variableName);
    558572            if (!val) {
    559573                PRINT(("Error: env var %s not found.\n", &variableName[0]));
    560574                return B_NAME_NOT_FOUND;
    561575            }
    562            
     576
    563577            status_t err = ExpandString(out, val);
    564578            if (err != B_OK)
    565579                return err;
    566            
     580
    567581        } else if (*in == '\\') {
    568582            if (start < in)
    569583                out->Append(start, (int32)(in - start));
    TResourceSet::ExpandString(BString* out, const char* in)  
    576590
    577591    if (start < in)
    578592        out->Append(start, (int32)(in - start));
    579    
     593
    580594    return B_OK;
    581595}
    582596
    const void*  
    585599TResourceSet::FindResource(type_code type, int32 id, size_t* outSize)
    586600{
    587601    TypeItem* item = FindItemID(type, id);
    588    
     602
    589603    if (outSize)
    590604        *outSize = item ? item->Size() : 0;
    591605
    const void*  
    597611TResourceSet::FindResource(type_code type, const char* name, size_t* outSize)
    598612{
    599613    TypeItem* item = FindItemName(type, name);
    600    
     614
    601615    if (outSize)
    602616        *outSize = item ? item->Size() : 0;
    603617
    TResourceSet::FindStringBlock(type_code type, const char* name)  
    632646    return ReturnStringBlockItem(FindItemName(type, name));
    633647}
    634648
    635    
     649
    636650const char*
    637651TResourceSet::FindString(type_code type, int32 id, uint32 index)
    638652{
    639653    const TStringBlock* stringBlock = FindStringBlock(type, id);
     654
    640655    if (!stringBlock)
    641656        return NULL;
    642657
    const char*  
    648663TResourceSet::FindString(type_code type, const char* name, uint32 index)
    649664{
    650665    const TStringBlock* stringBlock = FindStringBlock(type, name);
     666
    651667    if (!stringBlock)
    652668        return NULL;
    653669
    654670    return stringBlock->String(index);
    655671}
    656672
    657    
     673
    658674TypeList*
    659675TResourceSet::FindTypeList(type_code type)
    660676{
    661677    BAutolock lock(&fLock);
    662    
     678
    663679    int32 count = fTypes.CountItems();
    664680    for (int32 i = 0; i < count; i++ ) {
    665681        TypeList* list = (TypeList*)fTypes.ItemAt(i);
    666682        if (list && list->Type() == type)
    667683            return list;
    668684    }
    669    
     685
    670686    return NULL;
    671687}
    672688
    TResourceSet::FindItemID(type_code type, int32 id)  
    676692{
    677693    TypeList* list = FindTypeList(type);
    678694    TypeItem* item = NULL;
    679    
    680     if (list) item = list->FindItemByID(id);
    681    
     695
     696    if (list)
     697        item = list->FindItemByID(id);
     698
    682699    if (!item)
    683700        item = LoadResource(type, id, 0, &list);
    684    
     701
    685702    return item;
    686703}
    687704
    TResourceSet::FindItemName(type_code type, const char* name)  
    691708{
    692709    TypeList* list = FindTypeList(type);
    693710    TypeItem* item = NULL;
    694    
     711
    695712    if (list)
    696713        item = list->FindItemByName(name);
    697    
     714
    698715    if (!item)
    699716        item = LoadResource(type, -1, name, &list);
    700    
     717
    701718    return item;
    702719}
    703720
    TResourceSet::LoadResource(type_code type, int32 id, const char* name,  
    707724    TypeList** inOutList)
    708725{
    709726    TypeItem* item = NULL;
    710    
     727
    711728    if (name) {
    712729        BEntry entry;
    713        
     730
    714731        // If a named resource, first look in directories.
    715732        fLock.Lock();
    716733        int32 count = fDirectories.CountItems();
    TResourceSet::LoadResource(type_code type, int32 id, const char* name,  
    731748        }
    732749        fLock.Unlock();
    733750    }
    734    
     751
    735752#if USE_RESOURCES
    736753    if (!item) {
    737754        // Look through resource objects for data.
    TResourceSet::LoadResource(type_code type, int32 id, const char* name,  
    746763                    data = resource->LoadResource(type, id, &size);
    747764                else if (name != NULL)
    748765                    data = resource->LoadResource(type, name, &size);
    749                    
     766
    750767                if (data && size) {
    751768                    item = new TypeItem(id, name, data, size);
    752769                    item->SetSourceIsFile(false);
    TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)  
    803820    // Try to read as an archived bitmap.
    804821    stream.Seek(0, SEEK_SET);
    805822    BMessage archive;
    806     if (archive.Unflatten(&stream) == B_OK ) {
     823    if (archive.Unflatten(&stream) == B_OK) {
    807824        bitmap = new BitmapTypeItem(&archive);
    808825        if (bitmap && bitmap->InitCheck() != B_OK) {
    809             bitmap->Delete();   // allows us to delete this bitmap...
     826            // allows us to delete this bitmap...
     827            bitmap->Delete();
    810828            delete bitmap;
    811829            bitmap = NULL;
    812830        }
    TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)  
    815833    if (bitmap) {
    816834        BAutolock lock(&fLock);
    817835        if (from->Object() != NULL) {
    818             // Whoops!  Someone snuck in under us.
     836            // Whoops! Someone snuck in under us.
    819837            bitmap->Delete();
    820838            delete bitmap;
    821839            bitmap = dynamic_cast<BitmapTypeItem*>(from->Object());
    822         } else 
     840        } else
    823841            from->SetObject(bitmap);
    824842    }
    825843
    TResourceSet::ReturnStringBlockItem(TypeItem* from)  
    832850{
    833851    if (!from)
    834852        return NULL;
    835    
     853
    836854    TypeObject* obj = from->Object();
    837855    StringBlockTypeItem* stringBlock = dynamic_cast<StringBlockTypeItem*>(obj);
    838856    if (stringBlock)
    839857        return stringBlock;
    840    
     858
    841859    // Can't change an existing object.
    842860    if (obj)
    843861        return NULL;
    844    
     862
    845863    // Don't have a string block in the item -- we'll create one.
    846864    if (from->SourceIsFile() ) {
    847865        BMemoryIO stream(from->Data(), from->Size());
    848866        stringBlock = new StringBlockTypeItem(&stream);
    849867    } else
    850868        stringBlock = new StringBlockTypeItem(from->Data(), from->Size());
    851    
     869
    852870    if (stringBlock) {
    853871        BAutolock lock(&fLock);
    854872        if (from->Object() != NULL) {
    855             // Whoops!  Someone snuck in under us.
     873            // Whoops! Someone snuck in under us.
    856874            delete stringBlock;
    857875            stringBlock = dynamic_cast<StringBlockTypeItem*>(from->Object());
    858876        } else
    859877            from->SetObject(stringBlock);
    860878    }
    861    
     879
    862880    return stringBlock;
    863881}
    864882
    TResourceSet::ReturnStringBlockItem(TypeItem* from)  
    867885
    868886
    869887namespace TResourcePrivate {
    870 
    871888    TResourceSet* gResources = NULL;
    872889    BLocker gResourceLocker;
    873    
    874890}
    875891
    876892
    AppResSet()  
    880896    // If already have it, return immediately.
    881897    if (gResources)
    882898        return gResources;
    883    
     899
    884900    // Don't have 'em, lock access to make 'em.
    885901    if (!gResourceLocker.Lock())
    886902        return NULL;
    AppResSet()  
    889905        gResourceLocker.Unlock();
    890906        return gResources;
    891907    }
    892    
     908
    893909    // Make 'em.
    894910    gResources = new TResourceSet;
    895911    gResources->AddResources(BApplication::AppResources());
  • src/apps/deskbar/ResourceSet.h

    diff --git a/src/apps/deskbar/ResourceSet.h b/src/apps/deskbar/ResourceSet.h
    index 5975304..919d3d6 100644
    a b public:  
    5757    TStringBlock(BDataIO* data);
    5858    TStringBlock(const void* block, size_t size);
    5959    virtual ~TStringBlock();
    60    
     60
    6161    const char* String(size_t index) const;
    6262
    6363private:
    6464    size_t PreIndex(char* strings, ssize_t len);
    65     void MakeIndex(const char* strings, ssize_t len,
    66         size_t indexLen, size_t* outIndex);
    67    
     65    void MakeIndex(const char* strings, ssize_t len, size_t indexLen,
     66        size_t* outIndex);
     67
    6868    size_t fNumEntries;
    6969    size_t* fIndex;
    7070    char* fStrings;
    public:  
    8181    status_t AddEnvDirectory(const char* envPath,
    8282        const char* defaultValue = NULL);
    8383   
    84     const void* FindResource(type_code type, int32 id,
    85         size_t* outSize);
    86     const void* FindResource(type_code type, const char* name,
    87         size_t* outSize);
    88    
     84    const void* FindResource(type_code type, int32 id, size_t* outSize);
     85    const void* FindResource(type_code type, const char* name, size_t* outSize);
     86
    8987    const BBitmap* FindBitmap(type_code type, int32 id);
    9088    const BBitmap* FindBitmap(type_code type, const char* name);
    91    
     89
    9290    const TStringBlock* FindStringBlock(type_code type, int32 id);
    9391    const TStringBlock* FindStringBlock(type_code type, const char* name);
    94    
     92
    9593    const char* FindString(type_code type, int32 id, uint32 index);
    9694    const char* FindString(type_code type, const char* name, uint32 index);
    97    
     95
    9896private:
    9997    status_t ExpandString(BString* out, const char* in);
    10098    TypeList* FindTypeList(type_code type);
    101    
     99
    102100    TypeItem* FindItemID(type_code type, int32 id);
    103101    TypeItem* FindItemName(type_code type, const char* name);
    104    
     102
    105103    TypeItem* LoadResource(type_code type, int32 id, const char* name,
    106104        TypeList** inoutList = NULL);
    107    
     105
    108106    BBitmap* ReturnBitmapItem(type_code type, TypeItem* from);
    109107    TStringBlock* ReturnStringBlockItem(TypeItem* from);
    110    
     108
    111109    BLocker fLock;              // access control.
    112110    BList fResources;           // containing BResources objects.
    113111    BList fDirectories;         // containing BPath objects.
  • src/apps/deskbar/StatusView.cpp

    diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp
    index a504101..e067a77 100644
    a b All rights reserved.  
    7474using std::max;
    7575
    7676#ifdef DB_ADDONS
    77 //  Add-on support
     77// Add-on support
    7878//
    79 //  Item - internal item list (node, eref, etc)
    80 //  Icon - physical replicant handed to the DeskbarClass class
    81 //  AddOn - attribute based add-on
     79// Item - internal item list (node, eref, etc)
     80// Icon - physical replicant handed to the DeskbarClass class
     81// AddOn - attribute based add-on
    8282
    8383const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item";
    8484const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry";
    TReplicantTray::DealWithClock(bool showClock)  
    240240}
    241241
    242242
    243 /*!
    244     Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth
     243/*! Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth
    245244    if not in multirowmode and greater than kMinimumReplicantCount
    246245    the width should be calculated based on the actual
    247246    replicant widths
    TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)  
    255254        if (fShelf->CountReplicants() > 0)
    256255            height = fRightBottomReplicant.bottom;
    257256
    258         // the height will be uniform for the number of rows
    259         // necessary to show all the reps + any gutters
    260         // necessary for spacing
     257        // the height will be uniform for the number of rows necessary to show
     258        // all the reps + any gutters necessary for spacing
    261259        int32 rowCount = (int32)(height / kMaxReplicantHeight);
    262260        height = kGutter + (rowCount * kMaxReplicantHeight)
    263261            + ((rowCount - 1) * kIconGap) + kGutter;
    264262        height = max(kMinimumTrayHeight, height);
    265263        width = fMinimumTrayWidth;
    266264    } else {
    267         // if last replicant overruns clock then
    268         // resize to accomodate
     265        // if last replicant overruns clock then resize to accomodate
    269266        if (fShelf->CountReplicants() > 0) {
    270267            if (fBarView->ShowingClock()
    271268                && fRightBottomReplicant.right + 6 >= fClock->Frame().left) {
    TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)  
    274271            } else
    275272                width = fRightBottomReplicant.right + 3;
    276273        }
     274
    277275        // this view has a fixed minimum width
    278276        width = max(fMinimumTrayWidth, width);
    279277    }
    280278
    281279    *preferredWidth = width;
    282     // add 2 for the border
     280    // add 1 for the border
    283281    *preferredHeight = height + 1;
    284282}
    285283
    TReplicantTray::ShowReplicantMenu(BPoint point)  
    350348    BPopUpMenu* menu = new BPopUpMenu("", false, false);
    351349    menu->SetFont(be_plain_font);
    352350
    353     // If the clock is visible, show the extended menu
    354     // otheriwse, show "Show Time".
     351    // If clock is visible show the extended menu, otherwise show "Show Time"
    355352
    356353    if (fBarView->ShowingClock())
    357354        fClock->ShowClockOptions(ConvertToScreen(point));
    TReplicantTray::MouseDown(BPoint where)  
    375372        DumpList(fItemList);
    376373#endif
    377374
    378     uint32  buttons;
     375    uint32 buttons;
    379376
    380377    Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons);
    381378    if (buttons == B_SECONDARY_MOUSE_BUTTON) {
    TReplicantTray::InitAddOnSupport()  
    412409{
    413410    // list to maintain refs to each rep added/deleted
    414411    fItemList = new BList();
    415 
    416412    bool haveKey = false;
    417     BPath path;
     413    BPath path;
     414
    418415    if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
    419416        path.Append(kDeskbarSecurityCodeFile);
    420417
    421418        BFile file(path.Path(),B_READ_ONLY);
    422419        if (file.InitCheck() == B_OK
    423             && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode))
     420            && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode))
    424421                == sizeof(fDeskbarSecurityCode))
    425422            haveKey = true;
    426423    }
    TReplicantTray::InitAddOnSupport()  
    443440        }
    444441    }
    445442
    446     // for each volume currently mounted
    447     //      index the volume with our indices
     443    // for each volume currently mounted index the volume with our indices
    448444    BVolumeRoster roster;
    449445    BVolume volume;
    450446    while (roster.GetNextVolume(&volume) == B_OK) {
    TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate)  
    488484        || fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0)
    489485        return;
    490486
    491     // run a new query on a specific volume
    492     // make it live
     487    // run a new query on a specific volume and make it live
    493488    BQuery query;
    494489    query.SetVolume(volume);
    495490    query.SetPredicate(predicate);
    TReplicantTray::NodeExists(node_ref& nodeRef)  
    557552}
    558553
    559554
    560 /*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received
     555/*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received
    561556    for the registered add-ons.
    562557*/
    563558void
    TReplicantTray::HandleEntryUpdate(BMessage* message)  
    697692}
    698693
    699694
    700 /*!
    701     The add-ons must support the exported C function API
     695/*! The add-ons must support the exported C function API
    702696    if they do, they will be loaded and added to deskbar
    703697    primary function is the Instantiate function
    704698*/
    TReplicantTray::IconCount() const  
    989983}
    990984
    991985
    992 /*! Message must contain an archivable view for later rehydration.
     986/*! Message must contain an archivable view for later rehydration.
    993987    This function takes over ownership of the provided message on success
    994988    only.
    995989    Returns the current replicant ID.
    TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)  
    1003997    // find entry_ref
    1004998
    1005999    entry_ref ref;
    1006     if (addOn) {
    1007         // Use it if we got it
    1008         ref = *addOn;
    1009     } else {
     1000    if (addOn)
     1001        ref = *addOn; // Use it if we got it
     1002    else {
    10101003        const char* signature;
     1004
    10111005        status_t status = archive->FindString("add_on", &signature);
    10121006        if (status == B_OK) {
    10131007            BRoster roster;
    TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)  
    10281022        return status;
    10291023
    10301024    BEntry entry(&ref, true);
    1031         // ToDo: this resolves an eventual link for the item
    1032         // being added - this is okay for now, but in multi-user
    1033         // environments, one might want to have links that
    1034         // carry the be:deskbar_item_status attribute
     1025    // TODO: this resolves an eventual link for the item being added - this is
     1026    // okay for now, but in multi-user environments, one might want to have
     1027    // links that carry the be:deskbar_item_status attribute
    10351028    status = entry.InitCheck();
    10361029    if (status != B_OK)
    10371030        return status;
    TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)  
    10411034        archive->what = 0;
    10421035
    10431036    BRect originalBounds = archive->FindRect("_frame");
    1044         // this is a work-around for buggy replicants that change their
    1045         // size in AttachedToWindow() (such as "SVM")
     1037    // this is a work-around for buggy replicants that change their size in
     1038    // AttachedToWindow() (such as "SVM")
    10461039
    1047     // !! check for name collisions?
     1040    // TODO: check for name collisions?
    10481041    status = fShelf->AddReplicant(archive, BPoint(1, 1));
    10491042    if (status != B_OK)
    10501043        return status;
    TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)  
    10701063    // add the item to the add-on list
    10711064
    10721065    AddItem(*id, nodeRef, entry, addOn != NULL);
    1073     return B_OK;
     1066    return B_OK;
    10741067}
    10751068
    10761069
    TReplicantTray::RealReplicantAdjustment(int32 startIndex)  
    11291122    float width, height;
    11301123    GetPreferredSize(&width, &height);
    11311124    if (oldWidth != width || oldHeight != height) {
    1132         // resize view to accomodate the replicants
    1133         // redraw as necessary
     1125        // resize view to accomodate the replicants, redraw as necessary
    11341126        AdjustPlacement();
    11351127    }
    11361128}
    TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)  
    11651157            }
    11661158        }
    11671159    }
    1168 
    11691160    return NULL;
    11701161}
    11711162
    TReplicantTray::ViewAt(int32* index, int32* id, const char* name)  
    11891180            return view;
    11901181        }
    11911182    }
    1192 
    11931183    return NULL;
    11941184}
    11951185
    TReplicantTray::SetMultiRow(bool state)  
    13531343//  #pragma mark -
    13541344
    13551345
    1356 /*! Draggable region that is asynchronous so that dragging does not block
     1346/*! Draggable region that is asynchronous so that dragging does not block
    13571347    other activities.
    13581348*/
    13591349TDragRegion::TDragRegion(TBarView* parent, BView* child)
    TDragRegion::MouseDown(BPoint thePoint)  
    15441534    BRect dragRegion(DragRegion());
    15451535
    15461536    dragRegion.InsetBy(-2.0f, -2.0f);
    1547         // DragRegion() is designed for drawing, not clicking
     1537    // DragRegion() is designed for drawing, not clicking
    15481538
    15491539    if (!dragRegion.Contains(thePoint))
    15501540        return;
    TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect,  
    15841574    bool newVertical, bool newLeft, bool newTop, int32 newState)
    15851575{
    15861576    if (!rect.Contains(mouse))
    1587         // not our rect
    1588         return false;
     1577        return false; // not our rect
    15891578
    1590     if (newVertical == fBarView->Vertical()
    1591         && newLeft == fBarView->Left()
    1592         && newTop == fBarView->Top()
    1593         && newState == fBarView->State())
    1594         // already in the correct mode
    1595         return true;
     1579    if (newVertical == fBarView->Vertical() && newLeft == fBarView->Left()
     1580        && newTop == fBarView->Top() && newState == fBarView->State())
     1581        return true; // already in the correct mode
    15961582
    15971583    fBarView->ChangeState(newState, newVertical, newLeft, newTop);
    15981584    return true;
  • src/apps/deskbar/StatusView.h

    diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h
    index aeef04b..057d06c 100644
    a b const int32 kIconGap = 2;  
    5151const int32 kGutter = 1;
    5252const int32 kDragRegionWidth = 6;
    5353
    54 //  1 pixel left gutter
    55 //  space for replicant tray (6 items)
    56 //  6 pixel drag region
    57 const float kMinimumTrayWidth = kIconGap
    58         + (kMinimumReplicantCount * kIconGap)
    59         + (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
     54// 1 pixel left gutter
     55// space for replicant tray (6 items)
     56// 6 pixel drag region
     57const float kMinimumTrayWidth = kIconGap + (kMinimumReplicantCount * kIconGap)
     58    + (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
    6059const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter;
    6160
    6261extern float sMinimumWindowWidth;
  • src/apps/deskbar/StatusViewShelf.cpp

    diff --git a/src/apps/deskbar/StatusViewShelf.cpp b/src/apps/deskbar/StatusViewShelf.cpp
    index c879036..0212015 100644
    a b TReplicantShelf::MessageReceived(BMessage* message)  
    7777            while (message->FindMessage("specifiers", index++, &repspec)
    7878                == B_OK) {
    7979                const char* str;
     80
    8081                if (repspec.FindString("property", &str) == B_OK) {
    8182                    if (strcmp(str, "Replicant") == 0) {
    8283                        int32 index;
  • src/apps/deskbar/StatusViewShelf.h

    diff --git a/src/apps/deskbar/StatusViewShelf.h b/src/apps/deskbar/StatusViewShelf.h
    index 4db46fb..d7e3c92 100644
    a b public:  
    5050       
    5151protected:
    5252        bool            CanAcceptReplicantView(BRect, BView*, BMessage*) const;
    53         BPoint          AdjustReplicantBy(BRect, BMessage*) const;
     53        BPoint          AdjustReplicantBy(BRect, BMessage*) const;
    5454        void            ReplicantDeleted(int32, const BMessage*, const BView*);
    5555
    5656private:
  • src/apps/deskbar/Switcher.cpp

    diff --git a/src/apps/deskbar/Switcher.cpp b/src/apps/deskbar/Switcher.cpp
    index 86df52d..3b43252 100644
    a b All rights reserved.  
    5656
    5757
    5858#define _ALLOW_STICKY_ 0
    59     // allows you to press 's' to keep the switcher window on screen
     59// allows you to press 's' to keep the switcher window on screen
    6060
    6161
    6262static const color_space kIconFormat = B_RGBA32;
    public:  
    9999                                TSwitchManager* manager);
    100100    virtual                 ~TSwitcherWindow();
    101101
    102     virtual bool            QuitRequested();
    103     virtual void            MessageReceived(BMessage* message);
    104     virtual void            Show();
    105     virtual void            Hide();
    106     virtual void            WindowActivated(bool state);
     102    virtual bool            QuitRequested();
     103    virtual void            MessageReceived(BMessage* message);
     104    virtual void            Show();
     105    virtual void            Hide();
     106    virtual void            WindowActivated(bool state);
    107107
    108108            void            DoKey(uint32 key, uint32 modifiers);
    109109            TIconView*      IconView();
    public:  
    133133            void            UpdateGroup(int32 groupIndex, int32 windowIndex);
    134134
    135135    virtual void            AttachedToWindow();
    136     virtual void            Draw(BRect update);
    137     virtual void            Pulse();
    138     virtual void            GetPreferredSize(float* w, float* h);
     136    virtual void            Draw(BRect update);
     137    virtual void            Pulse();
     138    virtual void            GetPreferredSize(float* w, float* h);
    139139            void            ScrollTo(float x, float y)
    140140                                { ScrollTo(BPoint(x,y)); }
    141     virtual void            ScrollTo(BPoint where);
     141    virtual void            ScrollTo(BPoint where);
    142142
    143143            void            ShowIndex(int32 windex);
    144144            BRect           FrameOf(int32 index) const;
    public:  
    161161            void            Hiding();
    162162
    163163    virtual void            KeyDown(const char* bytes, int32 numBytes);
    164     virtual void            Pulse();
    165     virtual void            MouseDown(BPoint point);
    166     virtual void            Draw(BRect updateRect);
     164    virtual void            Pulse();
     165    virtual void            MouseDown(BPoint point);
     166    virtual void            Draw(BRect updateRect);
    167167
    168168            void            ScrollTo(float x, float y)
    169169                                { ScrollTo(BPoint(x,y)); }
    170     virtual void    ScrollTo(BPoint where);
     170    virtual void    ScrollTo(BPoint where);
    171171            void            Update(int32 previous, int32 current,
    172172                                int32 previousSlot, int32 currentSlot,
    173173                                bool forward);
    public:  
    199199
    200200    virtual void            Draw(BRect update);
    201201    virtual void            AllAttached();
    202     virtual void            DrawIconScrollers(bool force);
    203     virtual void            DrawWindowScrollers(bool force);
    204     virtual void            MouseDown(BPoint where);
     202    virtual void            DrawIconScrollers(bool force);
     203    virtual void            DrawWindowScrollers(bool force);
     204    virtual void            MouseDown(BPoint where);
    205205
    206206private:
    207207            TSwitchManager* fManager;
    LowBitIndex(uint32 value)  
    252252inline bool
    253253IsVisibleInCurrentWorkspace(const window_info* windowInfo)
    254254{
    255     /*
    256      The window list is always ordered from the top
    257      front visible window (the first on the list), going down through all
    258      the other visible windows, then all the hidden or non workspace
    259      visible window at the end.
    260 
    261      layer > 2 : normal visible window.
    262      layer == 2 : reserved for the desktop window (visible also).
    263      layer < 2 : hidden (0) and non workspace visible window (1)
    264     */
     255    // The window list is always ordered from the top
     256    // front visible window (the first on the list), going down through all
     257    // the other visible windows, then all the hidden or non workspace
     258    // visible window at the end.
     259    //
     260    // layer > 2 : normal visible window.
     261    // layer == 2 : reserved for the desktop window (visible also).
     262    // layer < 2 : hidden (0) and non workspace visible window (1)
    265263    return windowInfo->layer > 2;
    266264}
    267265
    IsWindowOK(const window_info* windowInfo)  
    284282    // show_hide >= 1 means that the window is hidden.
    285283    //
    286284    // If the window is both minimized and hidden, then you get :
    287     //  TWindow->is_mini = false;
    288     //  TWindow->was_mini = true;
    289     //  TWindow->show_hide >= 1;
     285    //  TWindow->is_mini = false;
     286    //  TWindow->was_mini = true;
     287    //  TWindow->show_hide >= 1;
    290288
    291289    if (windowInfo->feel != _STD_W_TYPE_)
    292290        return false;
    SmartStrcmp(const char* s1, const char* s2)  
    333331            continue;
    334332        }
    335333        if (*s1 != *s2)
    336             return 1;       // they differ
     334            return 1; // they differ
    337335        s1++;
    338336        s2++;
    339337    }
    340338
    341339    // if one of the strings ended before the other
    342     // ??? could process trailing spaces & underscores!
     340    // TODO: could process trailing spaces and underscores
    343341    if (*s1)
    344342        return 1;
    345343    if (*s2)
    TSwitchManager::TSwitchManager(BPoint point)  
    448446    TBarApp::Subscribe(BMessenger(this), &tmpList);
    449447
    450448    for (int32 i = 0; ; i++) {
    451         BarTeamInfo *barTeamInfo = (BarTeamInfo *)tmpList.ItemAt(i);
     449        BarTeamInfo* barTeamInfo = (BarTeamInfo*)tmpList.ItemAt(i);
    452450        if (!barTeamInfo)
    453451            break;
    454452
    TSwitchManager::MessageReceived(BMessage* message)  
    485483            int i = 0;
    486484            TTeamGroup* tinfo;
    487485            message->FindInt32("team", &teamID);
     486
    488487            while ((tinfo = (TTeamGroup*)fGroupList.ItemAt(i)) != NULL) {
    489488                if (tinfo->TeamList()->HasItem((void*)teamID)) {
    490489                    fGroupList.RemoveItem(i);
    TSwitchManager::MessageReceived(BMessage* message)  
    519518                delete teams;
    520519                break;
    521520            }
     521
    522522            delete smallIcon;
     523
    523524            if (message->FindString("sig", &signature) != B_OK) {
    524525                delete teams;
    525526                break;
    526527            }
     528
    527529            if (message->FindInt32("flags", (int32*)&flags) != B_OK) {
    528530                delete teams;
    529531                break;
    530532            }
     533
    531534            if (message->FindString("name", &name) != B_OK) {
    532535                delete teams;
    533536                break;
    TSwitchManager::MessageReceived(BMessage* message)  
    548551            const char* signature = message->FindString("sig");
    549552            team_id team = message->FindInt32("team");
    550553
    551             int32 numItems = fGroupList.CountItems();
    552             for (int32 i = 0; i < numItems; i++) {
     554            for (int32 i = 0; i < fGroupList.CountItems(); i++) {
    553555                TTeamGroup* tinfo = (TTeamGroup*)fGroupList.ItemAt(i);
    554556                if (strcasecmp(tinfo->Signature(), signature) == 0) {
    555557                    if (!(tinfo->TeamList()->HasItem((void*)team)))
    TSwitchManager::MessageReceived(BMessage* message)  
    564566        {
    565567            team_id team = message->FindInt32("team");
    566568
    567             int32 numItems = fGroupList.CountItems();
    568             for (int32 i = 0; i < numItems; i++) {
     569            for (int32 i = 0; i < fGroupList.CountItems(); i++) {
    569570                TTeamGroup* tinfo = (TTeamGroup*)fGroupList.ItemAt(i);
    570571                if (tinfo->TeamList()->HasItem((void*)team)) {
    571572                    tinfo->TeamList()->RemoveItem((void*)team);
    TSwitchManager::MessageReceived(BMessage* message)  
    586587            // starts differentiating initial key_downs from KeyDowns generated
    587588            // by auto-repeat. Until then the fSkipUntil stuff helps, but it
    588589            // isn't perfect.
    589 
    590590            if (time < fSkipUntil)
    591591                break;
    592592
    TSwitchManager::_SortApps()  
    622622    team_id* teams;
    623623    int32 count;
    624624    if (BPrivate::get_application_order(current_workspace(), &teams, &count)
    625             != B_OK)
     625        != B_OK)
    626626        return;
    627627
    628628    BList groups;
    TSwitchManager::MainEntry(BMessage* message)  
    658658{
    659659    bigtime_t now = system_time();
    660660    bigtime_t timeout = now + 180000;
    661         // The delay above was arrived at by trial and error and
    662         // has a good "feel"
     661    // The delay above was arrived at by trial and error and has a good "feel"
    663662
    664663    app_info appInfo;
    665664    be_roster->GetActiveAppInfo(&appInfo);
    TSwitchManager::MainEntry(BMessage* message)  
    695694            QuickSwitch(message);
    696695            return;
    697696        }
    698         snooze(20000);
    699             // Must be a multiple of the delay used above
     697        snooze(20000); // Must be a multiple of the delay used above
    700698    }
    701699
    702700    Process((modifierKeys & B_SHIFT_KEY) == 0, key == 0x11);
    TSwitchManager::_FindNextValidApp(bool forward)  
    887885            if (fCurrentIndex < 0)
    888886                fCurrentIndex = max - 1;
    889887        }
     888
    890889        if (fCurrentIndex == startIndex) {
    891890            // we've gone completely through the list without finding
    892891            // a good app. Oh well.
    TSwitchManager::ActivateApp(bool forceShow, bool allowWorkspaceSwitch)  
    932931
    933932    int32 currentWorkspace = current_workspace();
    934933    TTeamGroup* teamGroup = (TTeamGroup*)fGroupList.ItemAt(fCurrentIndex);
     934
    935935    // Let's handle the easy case first: There's only 1 team in the group
    936936    if (teamGroup->TeamList()->CountItems() == 1) {
    937937        bool result;
    TSwitchManager::ActivateApp(bool forceShow, bool allowWorkspaceSwitch)  
    990990    if (tokens == NULL) {
    991991        ASSERT(windowInfo);
    992992        free(windowInfo);
    993         return true;    // weird error, so don't try to recover
     993        return true; // weird error, so don't try to recover
    994994    }
    995995
    996996    BList windowsToActivate;
    TSwitchManager::QuitApp()  
    10421042
    10431043    TTeamGroup* teamGroup;
    10441044    int32 count = 0;
     1045
    10451046    for (int32 i = fCurrentIndex + 1; i < fGroupList.CountItems(); i++) {
    10461047        teamGroup = (TTeamGroup*)fGroupList.ItemAt(i);
    10471048
    TBox::Draw(BRect update)  
    13821383    BeginLineArray(50);
    13831384
    13841385    // The main frame around the icon view
    1385     AddLine(box.LeftTop(), BPoint(center-kWedge, box.top), veryDarkGray);
    1386     AddLine(BPoint(center+kWedge, box.top), box.RightTop(), veryDarkGray);
     1386    AddLine(box.LeftTop(), BPoint(center - kWedge, box.top), veryDarkGray);
     1387    AddLine(BPoint(center + kWedge, box.top), box.RightTop(), veryDarkGray);
    13871388
    1388     AddLine(box.LeftBottom(), BPoint(center-kWedge, box.bottom), veryDarkGray);
    1389     AddLine(BPoint(center+kWedge, box.bottom), box.RightBottom(), veryDarkGray);
     1389    AddLine(box.LeftBottom(), BPoint(center - kWedge, box.bottom),
     1390        veryDarkGray);
     1391    AddLine(BPoint(center + kWedge, box.bottom), box.RightBottom(),
     1392        veryDarkGray);
    13901393    AddLine(box.LeftBottom() + BPoint(1, 1),
    1391         BPoint(center-kWedge, box.bottom + 1), white);
    1392     AddLine(BPoint(center+kWedge, box.bottom) + BPoint(0, 1),
     1394        BPoint(center - kWedge, box.bottom + 1), white);
     1395    AddLine(BPoint(center + kWedge, box.bottom) + BPoint(0, 1),
    13931396        box.RightBottom() + BPoint(1, 1), white);
    13941397
    13951398    AddLine(box.LeftTop(), box.LeftBottom(), veryDarkGray);
    13961399    AddLine(box.RightTop(), box.RightBottom(), veryDarkGray);
    1397     AddLine(box.RightTop() + BPoint(1, 1),
    1398         box.RightBottom() + BPoint(1, 1), white);
     1400    AddLine(box.RightTop() + BPoint(1, 1), box.RightBottom() + BPoint(1, 1),
     1401        white);
    13991402
    14001403    // downward pointing area at top of frame
    14011404    BPoint point(center - kWedge, box.top);
    14021405    AddLine(point, point + BPoint(kWedge, kWedge), veryDarkGray);
    1403     AddLine(point + BPoint(kWedge, kWedge),
    1404         BPoint(center+kWedge, point.y), veryDarkGray);
     1406    AddLine(point + BPoint(kWedge, kWedge), BPoint(center + kWedge, point.y),
     1407        veryDarkGray);
    14051408
    1406     AddLine(point + BPoint(1, 0),
    1407         point + BPoint(1, 0) + BPoint(kWedge - 1, kWedge - 1), white);
     1409    AddLine(point + BPoint(1, 0), point + BPoint(1, 0)
     1410        + BPoint(kWedge - 1, kWedge - 1), white);
    14081411
    14091412    AddLine(point + BPoint(2, -1) + BPoint(kWedge - 1, kWedge - 1),
    1410         BPoint(center+kWedge-1, point.y), darkGray);
     1413        BPoint(center + kWedge - 1, point.y), darkGray);
    14111414
    14121415    BPoint topPoint = point;
    14131416
    TBox::Draw(BRect update)  
    14161419    point.x = center - kWedge;
    14171420    AddLine(point, point + BPoint(kWedge, -kWedge), veryDarkGray);
    14181421    AddLine(point + BPoint(kWedge, -kWedge),
    1419         BPoint(center+kWedge, point.y), veryDarkGray);
     1422        BPoint(center + kWedge, point.y), veryDarkGray);
    14201423
    14211424    AddLine(point + BPoint(1, 0),
    14221425        point + BPoint(1, 0) + BPoint(kWedge - 1, -(kWedge - 1)), white);
    TBox::DrawIconScrollers(bool force)  
    14671470    }
    14681471
    14691472    int32 maxIndex = fManager->GroupList()->CountItems() - 1;
    1470             // last_frame is in fIconView coordinate space
     1473    // last_frame is in fIconView coordinate space
    14711474    BRect lastFrame = fIconView->FrameOf(maxIndex);
    14721475
    14731476    if (lastFrame.right > rect.right) {
    TIconView::CacheIcons(TTeamGroup* teamGroup)  
    18931896void
    18941897TIconView::AnimateIcon(BBitmap* startIcon, BBitmap* endIcon)
    18951898{
    1896     BRect centerRect(kCenterSlot*kSlotSize, 0,
     1899    BRect centerRect(kCenterSlot * kSlotSize, 0,
    18971900        (kCenterSlot + 1) * kSlotSize - 1, kSlotSize - 1);
    18981901    BRect startIconBounds = startIcon->Bounds();
    18991902    BRect bounds = Bounds();
    int32  
    20542057TIconView::SlotOf(int32 index) const
    20552058{
    20562059    BRect rect = FrameOf(index);
     2060
    20572061    return (int32)(rect.left / kSlotSize) - kCenterSlot;
    20582062}
    20592063
    TIconView::FrameOf(int32 index) const  
    20632067{
    20642068    BList* list = fManager->GroupList();
    20652069    int32 visible = kCenterSlot - 1;
    2066         // first few slots in view are empty
     2070    // first few slots in view are empty
    20672071
    20682072    TTeamGroup* teamGroup;
    20692073    for (int32 i = 0; i <= index; i++) {
    TWindowView::Draw(BRect update)  
    22742278    int32 groupIndex = fManager->CurrentIndex();
    22752279    TTeamGroup* teamGroup
    22762280        = (TTeamGroup*)fManager->GroupList()->ItemAt(groupIndex);
     2281
    22772282    if (teamGroup == NULL)
    22782283        return;
    22792284
  • src/apps/deskbar/Switcher.h

    diff --git a/src/apps/deskbar/Switcher.h b/src/apps/deskbar/Switcher.h
    index 9f319ea..51ca86f 100644
    a b public:  
    5353                            TSwitchManager(BPoint where);
    5454    virtual                 ~TSwitchManager();
    5555
    56     virtual void            MessageReceived(BMessage* message);
     56    virtual void            MessageReceived(BMessage* message);
    5757
    5858            void            Stop(bool doAction, uint32 modifiers);
    5959            void            Unblock();
  • src/apps/deskbar/TeamMenu.h

    diff --git a/src/apps/deskbar/TeamMenu.h b/src/apps/deskbar/TeamMenu.h
    index b3b0487..b8563f4 100644
    a b names are registered trademarks or trademarks of their respective holders.  
    3232All rights reserved.
    3333*/
    3434
    35 //  listing of running applications
    36 //  menu of BarMenuTitle
    37 //  in mini mode only
     35// listing of running applications
     36// menu of BarMenuTitle
     37// in mini mode only
    3838
    3939#ifndef TEAMMENU_H
    4040#define TEAMMENU_H
  • src/apps/deskbar/TeamMenuItem.cpp

    diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp
    index cbd669f..6885c4e 100644
    a b TTeamMenuItem::TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,  
    7171}
    7272
    7373
    74 TTeamMenuItem::TTeamMenuItem(float width,float height,bool vertical)
     74TTeamMenuItem::TTeamMenuItem(float width, float height, bool vertical)
    7575    :   BMenuItem("", NULL)
    7676{
    7777    InitData(NULL, NULL, strdup(""), strdup(""), width, height, false, vertical);
    TTeamMenuItem::Draw()  
    233233    BMenu* menu = Menu();
    234234    menu->PushState();
    235235    rgb_color menuColor = menu->LowColor();
    236 
    237236    TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
     237
    238238    bool canHandle = !barview->Dragging()
    239239        || barview->AppCanHandleTypes(Signature());
    240240
    TTeamMenuItem::Draw()  
    314314
    315315        // these continue the dark grey border on the left or top edge
    316316        menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT));
    317         if (fVertical)
     317        if (fVertical) {
    318318            // dark line at top
    319319            menu->StrokeLine(frame.LeftTop(), frame.RightTop());
    320         else
     320        } else {
    321321            // dark line on the left
    322322            menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
     323        }
    323324    } else
    324325        menu->SetLowColor(menuColor);
    325326
    TTeamMenuItem::DrawContent()  
    337338        if (fIcon->ColorSpace() == B_RGBA32) {
    338339            menu->SetDrawingMode(B_OP_ALPHA);
    339340            menu->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
    340         } else {
     341        } else
    341342            menu->SetDrawingMode(B_OP_OVER);
    342         }
    343         BRect frame(Frame());
    344343
     344        BRect frame(Frame());
    345345        BRect iconBounds(fIcon->Bounds());
    346346        BRect dstRect(iconBounds);
    347347        float extra = fVertical ? 0.0f : 1.0f;
    348348        BPoint contLoc = ContentLocation();
     349
    349350        dstRect.OffsetTo(BPoint(contLoc.x + kHPad, contLoc.y +
    350351            ((frame.Height() - iconBounds.Height()) / 2) + extra));
    351352        menu->DrawBitmapAsync(fIcon, dstRect);
    TTeamMenuItem::DrawContent()  
    357358        menu->MovePenTo(drawLoc);
    358359    }
    359360
    360     //  set the pen to black so that either method will draw in the same color
    361     //  low color is set in inherited::DrawContent, override makes sure its
    362     //  what we want
     361    // set the pen to black so that either method will draw in the same color
     362    // low color is set in inherited::DrawContent, override makes sure its
     363    // what we want
    363364    if (fDrawLabel) {
    364365        menu->SetDrawingMode(B_OP_OVER);
    365366        menu->SetHighColor(0, 0, 0);
    366367
    367         //  override the drawing of the content when the item is disabled
    368         //  the wrong lowcolor is used when the item is disabled since the
    369         //  text color does not change
     368        // override the drawing of the content when the item is disabled
     369        // the wrong lowcolor is used when the item is disabled since the
     370        // text color does not change
    370371        DrawContentLabel();
    371372    }
    372373
    TTeamMenuItem::DrawContent()  
    387388        } else {
    388389            rgb_color outlineColor = {80, 80, 80, 255};
    389390            rgb_color middleColor = {200, 200, 200, 255};
    390    
     391
    391392            menu->SetDrawingMode(B_OP_OVER);
    392    
     393
    393394            if (!fExpanded) {
    394395                menu->BeginLineArray(6);
    395    
     396
    396397                menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
    397398                    BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
    398399                menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
    399400                    BPoint(rect.left + 7, rect.top + 5), outlineColor);
    400401                menu->AddLine(BPoint(rect.left + 7, rect.top + 5),
    401402                    BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
    402    
     403
    403404                menu->AddLine(BPoint(rect.left + 4, rect.top + 3),
    404405                    BPoint(rect.left + 4, rect.bottom - 3), middleColor);
    405406                menu->AddLine(BPoint(rect.left + 5, rect.top + 4),
    TTeamMenuItem::DrawContent()  
    409410                menu->EndLineArray();
    410411            } else {
    411412                // expanded state
    412    
     413
    413414                menu->BeginLineArray(6);
    414415                menu->AddLine(BPoint(rect.left + 1, rect.top + 3),
    415416                    BPoint(rect.right - 3, rect.top + 3), outlineColor);
    TTeamMenuItem::DrawContent()  
    417418                    BPoint(rect.left + 5, rect.top + 7), outlineColor);
    418419                menu->AddLine(BPoint(rect.left + 5, rect.top + 7),
    419420                    BPoint(rect.right - 3, rect.top + 3), outlineColor);
    420    
     421
    421422                menu->AddLine(BPoint(rect.left + 3, rect.top + 4),
    422423                    BPoint(rect.right - 5, rect.top + 4), middleColor);
    423424                menu->AddLine(BPoint(rect.left + 4, rect.top + 5),
    TTeamMenuItem::DrawContentLabel()  
    444445    const char* label = Label();
    445446    char* truncLabel = NULL;
    446447    float max = 0;
     448
    447449    if (static_cast<TBarApp*>(be_app)->Settings()->superExpando && fVertical)
    448450        max = menu->MaxContentWidth() - kSwitchWidth;
    449451    else
    void  
    491493TTeamMenuItem::ToggleExpandState(bool resizeWindow)
    492494{
    493495    fExpanded = !fExpanded;
    494    
     496
    495497    if (fExpanded) {
    496498        // Populate Menu() with the stuff from SubMenu().
    497499        TWindowMenu* sub = (static_cast<TWindowMenu*>(Submenu()));
    TTeamMenuItem::ToggleExpandState(bool resizeWindow)  
    503505            if (locked)
    504506                sub->UnlockLooper();
    505507
    506             if (sub->CountItems() > 1){
     508            if (sub->CountItems() > 1) {
    507509                TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu());
    508510                int myindex = parent->IndexOf(this) + 1;
    509511
    TTeamMenuItem::ToggleExpandState(bool resizeWindow)  
    553555TWindowMenuItem*
    554556TTeamMenuItem::ExpandedWindowItem(int32 id)
    555557{
    556     if (!fExpanded) // Paranoia
     558    if (!fExpanded) {
     559        // Paranoia
    557560        return NULL;
     561    }
    558562
    559563    TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu());
    560564    int childIndex = parent->IndexOf(this) + 1;
  • src/apps/deskbar/TimeView.cpp

    diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp
    index 16c4982..2e338b6 100644
    a b TTimeView::GetPreferredSize(float* width, float* height)  
    154154
    155155    GetCurrentTime();
    156156
    157     // TODO: SetOrientation never gets called, fix that
    158     // When in vertical mode, we want to limit the width so that it can't
    159     // overlap the bevels in the parent view.
     157    // TODO: SetOrientation never gets called, fix that when in vertical mode,
     158    // we want to limit the width so that it can't overlap the bevels in the
     159    // parent view.
    160160    *width = fOrientation ?
    161161        min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
    162162        : kHMargin + StringWidth(fTimeStr);
    TTimeView::MessageReceived(BMessage* message)  
    217217
    218218        default:
    219219            BView::MessageReceived(message);
     220            break;
    220221    }
    221222}
    222223
    TTimeView::GetCurrentDate()  
    262263
    263264    fLocale.FormatDate(tmp, 64, fTime, B_FULL_DATE_FORMAT);
    264265
    265     //  remove leading 0 from date when month is less than 10 (MM/DD/YY)
    266     //  or remove leading 0 from date when day is less than 10 (DD/MM/YY)
     266    // remove leading 0 from date when month is less than 10 (MM/DD/YY)
     267    // or remove leading 0 from date when day is less than 10 (DD/MM/YY)
    267268    const char* str = tmp;
    268269    if (str[0] == '0')
    269270        str++;
    TTimeView::Pulse()  
    325326        // For dates, Update() could be called two times in a row,
    326327        // but that should only happen very rarely
    327328        if ((fLastTimeStr[1] != fTimeStr[1]
    328                 && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':'))
     329            && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':'))
    329330            || !fLastTimeStr[0])
    330331            Update();
    331332
    TTimeView::Update()  
    361362    GetCurrentTime();
    362363    GetCurrentDate();
    363364
    364 
    365365    SetToolTip(fDateStr);
    366366
    367367    ResizeToPreferred();
    TTimeView::Update()  
    370370    if (fParent) {
    371371        BMessage reformat('Trfm');
    372372        fParent->MessageReceived(&reformat);
    373             // time string format realign
     373        // time string format realign
    374374        fParent->Invalidate();
    375375    }
    376376}
  • src/apps/deskbar/TimeView.h

    diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h
    index 6034fb0..a8f1e48 100644
    a b class TTimeView : public BView {  
    7373        void        MouseDown(BPoint where);
    7474        void        Pulse();
    7575
    76         bool        ShowingSeconds()    { return fShowSeconds; }
     76        bool        ShowingSeconds() { return fShowSeconds; }
    7777        void        ShowSeconds(bool);
    7878        void        ShowCalendar(BPoint where);
    7979
    class TTimeView : public BView {  
    110110
    111111        float       fMaxWidth;
    112112        float       fHeight;
    113         bool        fOrientation;       // vertical = true
     113        bool        fOrientation; // vertical = true
    114114        BPoint      fTimeLocation;
    115115        BPoint      fDateLocation;
    116116
  • src/apps/deskbar/WindowMenu.cpp

    diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp
    index 895b890..7f9eb9c 100644
    a b void  
    8888TWindowMenu::AttachedToWindow()
    8989{
    9090    SetFont(be_plain_font);
    91 
    9291    RemoveItems(0, CountItems(), true);
    93 
    9492    int32 miniCount = 0;
    9593
    9694    bool dragging = false;
    9795    TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView();
    9896    if (barview && barview->LockLooper()) {
    99         //  'dragging' mode set in BarView::CacheDragData
    100         //      invoke in MouseEnter in ExpandoMenuBar
     97        // 'dragging' mode set in BarView::CacheDragData
     98        // invoke in MouseEnter in ExpandoMenuBar
    10199        dragging = barview->Dragging();
    102100        if (dragging) {
    103101            // We don't want to show the menu when dragging, but it's not
    TWindowMenu::AttachedToWindow()  
    105103            // Don't call BMenu::Hide(), it causes the menu to pop up every now
    106104            // and then.
    107105            Window()->Hide();
    108             //  if in expando (horizontal or vertical)
     106            // if in expando (horizontal or vertical)
    109107            if (barview->Expando()) {
    110108                SetTrackingHook(barview->MenuTrackingHook,
    111109                    barview->GetTrackingHookData());
    TWindowMenu::AttachedToWindow()  
    192190                fTeam, B_QUIT_REQUESTED));
    193191        }
    194192    } else {
    195         //  if we are in drag mode, then don't add the window controls
    196         //  to the menu
     193        // if we are in drag mode, then don't add the window controls
     194        // to the menu
    197195        if (!dragging) {
    198196            TShowHideMenuItem* hide =
    199197                new TShowHideMenuItem(B_TRANSLATE("Hide all"), fTeam,
    TWindowMenu::DetachedFromWindow()  
    230228    TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
    231229    if (barview && barview->Expando() && barview->Dragging()
    232230        && barview->LockLooper()) {
    233         // We changed the show level in AttachedToWindow().  Undo it.
     231        // We changed the show level in AttachedToWindow(). Undo it.
    234232        Window()->Show();
    235233        barview->DragStop();
    236234        barview->UnlockLooper();
  • src/apps/deskbar/WindowMenuItem.cpp

    diff --git a/src/apps/deskbar/WindowMenuItem.cpp b/src/apps/deskbar/WindowMenuItem.cpp
    index ddf94f4..5865466 100644
    a b All rights reserved.  
    4848#include "WindowMenu.h"
    4949
    5050
    51 const float kHPad = 10.0f;
    52 const float kVPad = 2.0f;
    53 const float kLabelOffset = 8.0f;
    54 const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f);
     51const float kHPad = 10.0f;
     52const float kVPad = 2.0f;
     53const float kLabelOffset = 8.0f;
     54const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f);
    5555
    5656
    5757TWindowMenuItem::TWindowMenuItem(const char* title, int32 id, bool mini,
    TWindowMenuItem::Draw()  
    204204
    205205    menu->PushState();
    206206
    207     //  if not selected or being tracked on, fill with gray
     207    // if not selected or being tracked on, fill with gray
    208208    TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
    209209    if ((!IsSelected() && !menu->IsRedrawAfterSticky())
    210210        || barview->Dragging() || !IsEnabled()) {
    TWindowMenuItem::DrawContent()  
    241241
    242242    BRect frame(Frame());
    243243    BPoint contLoc = ContentLocation() + BPoint(kHPad, kVPad);
    244 //  if (fExpanded)
    245 //      contLoc.x += kHPad;
     244    //if (fExpanded)
     245    //  contLoc.x += kHPad;
    246246
    247247    if (fID >= 0) {
    248248        menu->SetDrawingMode(B_OP_OVER);
  • src/apps/deskbar/WindowMenuItem.h

    diff --git a/src/apps/deskbar/WindowMenuItem.h b/src/apps/deskbar/WindowMenuItem.h
    index bfe14da..e889488 100644
    a b public:  
    6969
    7070protected:
    7171            void                Initialize(const char* title);
    72     virtual void                GetContentSize(float* width, float* height);
     72    virtual void                GetContentSize(float* width, float* height);
    7373    virtual void                DrawContent();
    7474    virtual status_t            Invoke(BMessage* message = NULL);
    7575    virtual void                Draw();
    private:  
    9191
    9292
    9393#endif  /* WINDOWMENUITEM_H */
     94