Ticket #7052: Deskbar Resize Team Icons 5.diff

File Deskbar Resize Team Icons 5.diff, 20.3 KB (added by jscipione, 13 years ago)
  • src/apps/deskbar/BarApp.cpp

    diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
    index 532e1bc..f008ff8 100644
    a b BList TBarApp::sSubscribers;  
    7272const uint32 kShowBeMenu = 'BeMn';
    7373const uint32 kShowTeamMenu = 'TmMn';
    7474
    75 const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f);
    7675
    7776static const color_space kIconFormat = B_RGBA32;
    7877
    TBarApp::TBarApp()  
    9594    InitSettings();
    9695    InitIconPreloader();
    9796
     97    fBarWindow = new TBarWindow();
     98    fBarView = static_cast<TBarApp*>(be_app)->BarView();
     99
    98100    be_roster->StartWatching(this);
    99101
    100102    sBarTeamInfoList.MakeEmpty();
    TBarApp::TBarApp()  
    116118
    117119    fSwitcherMessenger = BMessenger(new TSwitchManager(fSettings.switcherLoc));
    118120
    119     fBarWindow = new TBarWindow();
    120121    fBarWindow->Show();
    121122
    122123    // this messenger now targets the barview instead of the
    TBarApp::SaveSettings()  
    190191        storedSettings.AddFloat("width", fSettings.width);
    191192        storedSettings.AddBool("showTime", fSettings.showTime);
    192193        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);
     194        storedSettings.AddInt32("recentAppsCount", fSettings.recentAppsCount);
     195        storedSettings.AddInt32("recentDocsCount", fSettings.recentDocsCount);
     196        storedSettings.AddBool("timeShowSeconds", fSettings.timeShowSeconds);
    199197        storedSettings.AddInt32("recentFoldersCount",
    200198            fSettings.recentFoldersCount);
    201199        storedSettings.AddBool("alwaysOnTop", fSettings.alwaysOnTop);
    202200        storedSettings.AddBool("timeFullDate", fSettings.timeFullDate);
    203201        storedSettings.AddBool("trackerAlwaysFirst",
    204202            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);
     203        storedSettings.AddBool("sortRunningApps", fSettings.sortRunningApps);
     204        storedSettings.AddBool("superExpando", fSettings.superExpando);
     205        storedSettings.AddBool("expandNewTeams", fSettings.expandNewTeams);
     206        storedSettings.AddInt32("iconSize", fSettings.iconSize);
     207        storedSettings.AddBool("autoRaise", fSettings.autoRaise);
    213208        storedSettings.AddBool("recentAppsEnabled",
    214209            fSettings.recentAppsEnabled);
    215210        storedSettings.AddBool("recentDocsEnabled",
    TBarApp::InitSettings()  
    244239    settings.sortRunningApps = false;
    245240    settings.superExpando = false;
    246241    settings.expandNewTeams = false;
     242    settings.iconSize = kMinimumIconSize;
    247243    settings.autoRaise = false;
    248244    settings.recentAppsEnabled = true;
    249245    settings.recentDocsEnabled = true;
    TBarApp::InitSettings()  
    291287                &settings.trackerAlwaysFirst);
    292288            storedSettings.FindBool("sortRunningApps",
    293289                &settings.sortRunningApps);
    294             storedSettings.FindBool("superExpando",
    295                 &settings.superExpando);
    296             storedSettings.FindBool("expandNewTeams",
    297                 &settings.expandNewTeams);
    298             storedSettings.FindBool("autoRaise",
    299                 &settings.autoRaise);
     290            storedSettings.FindBool("superExpando", &settings.superExpando);
     291            storedSettings.FindBool("expandNewTeams", &settings.expandNewTeams);
     292            storedSettings.FindInt32("iconSize", (int32*)&settings.iconSize);
     293            storedSettings.FindBool("autoRaise", &settings.autoRaise);
    300294            storedSettings.FindBool("recentAppsEnabled",
    301295                &settings.recentAppsEnabled);
    302296            storedSettings.FindBool("recentDocsEnabled",
    TBarApp::MessageReceived(BMessage* message)  
    369363            fPreferencesWindow = NULL;
    370364            break;
    371365
     366        case kStateChanged:
     367            fPreferencesWindow->PostMessage(kStateChanged);
     368            break;
     369
    372370        case B_SOME_APP_LAUNCHED:
    373371        {
    374372            team_id team = -1;
    TBarApp::MessageReceived(BMessage* message)  
    478476            break;
    479477        }
    480478
     479        case kResizeTeamIcons:
     480        {
     481            int32 iconSize;
     482
     483            if (message->FindInt32("be:value", &iconSize) == B_OK)
     484                fSettings.iconSize = iconSize * 8;
     485
     486            if (fSettings.iconSize < kMinimumIconSize)
     487                fSettings.iconSize = kMinimumIconSize;
     488            else if (fSettings.iconSize > kMaximumIconSize)
     489                fSettings.iconSize = kMaximumIconSize;
     490
     491            ResizeTeamIcons();
     492
     493            fBarWindow->Lock();
     494            fBarView->UpdatePlacement();
     495            fBarWindow->Unlock();
     496            break;
     497        }
     498
    481499        case 'TASK':
    482500            fSwitcherMessenger.SendMessage(message);
    483501            break;
    TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)  
    628646        return;
    629647    }
    630648
    631     BFile file(ref, B_READ_ONLY);
    632     BAppFileInfo appMime(&file);
    633 
    634649    BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
    635         new BBitmap(kIconSize, kIconFormat), strdup(ref->name));
     650        new BBitmap(IconRect(), kIconFormat), strdup(ref->name));
     651
     652    if ((barInfo->flags & B_BACKGROUND_APP) == 0
     653        && strcasecmp(barInfo->sig, kDeskbarSignature) != 0)
     654        FetchAppIcon(barInfo->sig, barInfo->icon);
    636655
    637656    barInfo->teams->AddItem((void*)team);
    638     if (appMime.GetIcon(barInfo->icon, B_MINI_ICON) != B_OK)
    639         appMime.GetTrackerIcon(barInfo->icon, B_MINI_ICON);
    640657
    641658    sBarTeamInfoList.AddItem(barInfo);
     659    BMessage message(kResizeTeamIcons);
     660    be_app->PostMessage(&message);
    642661
    643662    int32 subsCount = sSubscribers.CountItems();
    644663    if (subsCount > 0) {
    TBarApp::RemoveTeam(team_id team)  
    698717
    699718
    700719void
     720TBarApp::ResizeTeamIcons()
     721{
     722    for (int32 i = 0; i < sBarTeamInfoList.CountItems(); i++) {
     723        BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i);
     724        if ((barInfo->flags & B_BACKGROUND_APP) == 0
     725            && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
     726            barInfo->icon = new BBitmap(IconRect(), kIconFormat);
     727            FetchAppIcon(barInfo->sig, barInfo->icon);
     728        }
     729    }
     730}
     731
     732
     733void
    701734TBarApp::ShowPreferencesWindow()
    702735{
    703736    if (fPreferencesWindow)
    TBarApp::ShowPreferencesWindow()  
    709742}
    710743
    711744
     745void
     746TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
     747{
     748    app_info appInfo;
     749
     750    if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) {
     751        BFile file(&appInfo.ref, B_READ_ONLY);
     752        BAppFileInfo appMime(&file);
     753        icon_size size = icon->Bounds().IntegerHeight() >= 31
     754            ? B_LARGE_ICON : B_MINI_ICON;
     755
     756        if (appMime.GetIcon(icon, size) != B_OK)
     757            appMime.GetTrackerIcon(icon, size);
     758    }
     759}
     760
     761
     762const BRect
     763TBarApp::IconRect()
     764{
     765    return BRect(0, 0, fSettings.iconSize - 1, fSettings.iconSize - 1);
     766}
     767
     768
    712769//  #pragma mark -
    713770
    714771
  • src/apps/deskbar/BarApp.h

    diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
    index 6f15838..f474417 100644
    a b const uint32 kTrackerFirst = 'TkFt';  
    8080const uint32 kSortRunningApps = 'SAps';
    8181const uint32 kSuperExpando = 'SprE';
    8282const uint32 kExpandNewTeams = 'ExTm';
     83const uint32 kResizeTeamIcons = 'RTIs';
    8384const uint32 kAutoRaise = 'AtRs';
    8485const uint32 kRestartTracker = 'Trak';
    8586
    const uint32 kShutdownSystem = 301;  
    8889const uint32 kRebootSystem = 302;
    8990const uint32 kSuspendSystem = 304;
    9091
     92// icon size constants
     93const int32 kMinimumIconSize = 16;
     94const int32 kMaximumIconSize = 64;
     95const int32 kIconSizeInterval = 8;
     96
    9197/* --------------------------------------------- */
    9298
    9399struct desk_settings {
    struct desk_settings {  
    109115    bool sortRunningApps;
    110116    bool superExpando;
    111117    bool expandNewTeams;
     118    int32 iconSize;
    112119    bool autoRaise;
    113120    bool recentAppsEnabled;
    114121    bool recentDocsEnabled;
    class TBarApp : public BApplication {  
    139146
    140147        static void Subscribe(const BMessenger &subscriber, BList*);
    141148        static void Unsubscribe(const BMessenger &subscriber);
     149        void ResizeTeamIcons();
    142150
    143151    private:
    144152        void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *);
    class TBarApp : public BApplication {  
    148156        void SaveSettings();
    149157
    150158        void ShowPreferencesWindow();
     159        void FetchAppIcon(const char* signature, BBitmap* icon);
     160        const BRect IconRect();
    151161
    152162        TBarWindow* fBarWindow;
     163        TBarView* fBarView;
    153164        BMessenger fSwitcherMessenger;
    154165        BMessenger fStatusViewMessenger;
    155166        BFile* fSettingsFile;
  • src/apps/deskbar/BarView.cpp

    diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
    index f113e6a..f028fb2 100644
    a b void  
    130130TBarView::Draw(BRect)
    131131{
    132132    BRect bounds(Bounds());
    133    
     133
    134134    rgb_color hilite = tint_color(ViewColor(), B_DARKEN_1_TINT);
    135135    rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
    136    
     136
    137137    SetHighColor(hilite);
    138138    if (AcrossTop())
    139139        StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
    TBarView::PlaceBeMenu()  
    232232    } else if (fState == kExpandoState) {
    233233        // shows apps below tray
    234234        fBarMenuBar->RemoveTeamMenu();
    235         if (fVertical)
     235        if (fVertical) {
    236236            width += 1;
    237         else
     237            desk_settings* settings = ((TBarApp*)be_app)->Settings();
     238            width += settings->iconSize - kMinimumIconSize;
     239        } else
    238240            width = floorf(width) / 2;
    239241        loc = Bounds().LeftTop();
    240242    } else
    TBarView::PlaceApplicationBar(BRect screenFrame)  
    298300    if (fState == kMiniState)
    299301        return;
    300302
     303    desk_settings* settings = ((TBarApp*)be_app)->Settings();
    301304    BRect expandoFrame(0, 0, 0, 0);
    302305    if (fVertical) {
    303306        // top left/right
    TBarView::PlaceApplicationBar(BRect screenFrame)  
    309312        expandoFrame.bottom = expandoFrame.top + 1;
    310313        if (fState == kFullState)
    311314            expandoFrame.right = fBarMenuBar->Frame().Width();
    312         else
    313             expandoFrame.right = sMinimumWindowWidth;
     315        else {
     316            expandoFrame.right = sMinimumWindowWidth + settings->iconSize
     317                - kMinimumIconSize;
     318        }
    314319    } else {
    315320        // top or bottom
    316321        expandoFrame.top = 0;
    317         expandoFrame.bottom = kHModeHeight;
     322        expandoFrame.bottom = settings->iconSize + 4;
    318323        if (fTrayLocation != 0)
    319324            expandoFrame.right = fDragRegion->Frame().left - 1;
    320325        else
    TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height)  
    336341        windowHeight = screenFrame.bottom;
    337342        windowWidth = fBarMenuBar->Frame().Width();
    338343    } else if (fState == kExpandoState) {
     344        desk_settings* settings = ((TBarApp*)be_app)->Settings();
    339345        if (fVertical) {
    340346            // top left or right
    341347            windowHeight = fExpando->Frame().bottom;
     348            windowWidth += settings->iconSize - kMinimumIconSize;
    342349        } else {
    343350            // top or bottom, full
    344351            fExpando->CheckItemSizes(0);
    345             windowHeight = kHModeHeight;
     352            windowHeight = settings->iconSize + 4;
    346353            windowWidth = screenFrame.Width();
    347354        }
    348355    } else {
    TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)  
    433440{
    434441    bool vertSwap = (fVertical != vertical);
    435442    bool leftSwap = (fLeft != left);
     443    bool stateChanged = (fState != state);
    436444
    437445    fState = state;
    438446    fVertical = vertical;
    439447    fLeft = left;
    440448    fTop = top;
    441449
     450    // Send a message to the preferences window to let it know to enable
     451    // or disabled preference items
     452    if (stateChanged) {
     453        BMessage message(kStateChanged);
     454        be_app->PostMessage(&message);
     455    }
     456
    442457    BRect screenFrame = (BScreen(Window())).Frame();
    443458
    444459    PlaceBeMenu();
    BRect  
    934949TBarView::OffsetIconFrame(BRect rect) const
    935950{
    936951    BRect frame(Frame());
     952    desk_settings* settings = ((TBarApp*)be_app)->Settings();
     953
    937954    frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left
    938         + rect.left;
     955        + rect.left + settings->iconSize - kMinimumIconSize;
    939956    frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top
    940957        + rect.top;
    941958
  • src/apps/deskbar/ExpandoMenuBar.cpp

    diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp
    index 0fd4483..28ecb99 100644
    a b TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,  
    8989{
    9090    SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
    9191    SetFont(be_plain_font);
    92     SetMaxContentWidth(sMinimumWindowWidth);
     92    float maxContentWidth = sMinimumWindowWidth
     93        + ((TBarApp*)be_app)->Settings()->iconSize - kMinimumIconSize;
     94    SetMaxContentWidth(maxContentWidth);
    9395}
    9496
    9597
    TExpandoMenuBar::AttachedToWindow()  
    133135
    134136    desk_settings* settings = ((TBarApp*)be_app)->Settings();
    135137
     138    if (!fVertical || fBarView->Expando())
     139        width += settings->iconSize - kMinimumIconSize;
     140
    136141    if (settings->sortRunningApps)
    137142        teamList.SortItems(CompareByName);
    138143
    TExpandoMenuBar::CheckItemSizes(int32 delta)  
    628633    } else if (delta < 0 && fOverflow) {
    629634        reset = true;
    630635        if (fullWidth > width)
    631             newWidth = floorf(width/count);
     636            newWidth = floorf(width / count);
    632637        else
    633638            newWidth = sMinimumWindowWidth;
    634639    }
     640
    635641    if (newWidth > sMinimumWindowWidth)
    636642        newWidth = sMinimumWindowWidth;
    637643
  • src/apps/deskbar/PreferencesWindow.cpp

    diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
    index e8fdf07..6bd2405 100644
    a b  
    1717#include <OpenWithTracker.h>
    1818#include <RadioButton.h>
    1919#include <SeparatorView.h>
     20#include <Slider.h>
    2021
    2122#include <ctype.h>
    2223
    PreferencesWindow::PreferencesWindow(BRect frame)  
    5758        new BMessage(kSuperExpando));
    5859    fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"),
    5960        new BMessage(kExpandNewTeams));
     61    fAppsIconSizeSlider = new BSlider("icon_size", B_TRANSLATE("Icon size"),
     62        NULL, kMinimumIconSize / kIconSizeInterval,
     63        kMaximumIconSize / kIconSizeInterval, B_HORIZONTAL);
     64    fAppsIconSizeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
     65    fAppsIconSizeSlider->SetHashMarkCount(((kMaximumIconSize - kMinimumIconSize)
     66        / kIconSizeInterval) + 1);
     67    fAppsIconSizeSlider->SetLimitLabels(B_TRANSLATE("Small"),
     68        B_TRANSLATE("Large"));
     69    fAppsIconSizeSlider->SetModificationMessage(new BMessage(kResizeTeamIcons));
    6070
    6171    fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
    6272        new BMessage(kShowSeconds));
    PreferencesWindow::PreferencesWindow(BRect frame)  
    8393
    8494    // Values
    8595    TBarApp* barApp = static_cast<TBarApp*>(be_app);
    86     desk_settings* appSettings = barApp->Settings();;
     96    desk_settings* appSettings = barApp->Settings();
    8797
    8898    fAppsSort->SetValue(appSettings->sortRunningApps);
    8999    fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst);
    90100    fAppsShowExpanders->SetValue(appSettings->superExpando);
    91101    fAppsExpandNew->SetValue(appSettings->expandNewTeams);
     102    fAppsIconSizeSlider->SetValue(appSettings->iconSize / 8);
    92103
    93104    int32 docCount = appSettings->recentDocsCount;
    94105    int32 appCount = appSettings->recentAppsCount;
    PreferencesWindow::PreferencesWindow(BRect frame)  
    131142    fAppsSort->SetTarget(be_app);
    132143    fAppsSortTrackerFirst->SetTarget(be_app);
    133144    fAppsExpandNew->SetTarget(be_app);
     145    fAppsIconSizeSlider->SetTarget(be_app);
    134146
    135147    fClockSeconds->SetTarget(replicantTray);
    136148
    PreferencesWindow::PreferencesWindow(BRect frame)  
    179191                .SetInsets(20, 0, 0, 0)
    180192                .Add(fAppsExpandNew)
    181193                .End()
     194            .Add(fAppsIconSizeSlider)
    182195            .AddGlue()
    183196            .SetInsets(10, 10, 10, 10)
    184197            .End()
    PreferencesWindow::MessageReceived(BMessage* message)  
    242255            be_app->PostMessage(message);
    243256            break;
    244257
     258        case kStateChanged:
     259            _EnableDisableDependentItems();
     260            break;
     261
    245262        default:
    246263            BWindow::MessageReceived(message);
    247264            break;
    PreferencesWindow::_UpdateRecentCounts()  
    275292void
    276293PreferencesWindow::_EnableDisableDependentItems()
    277294{
    278     if (fAppsShowExpanders->Value())
    279         fAppsExpandNew->SetEnabled(true);
    280     else
     295    TBarApp* barApp = static_cast<TBarApp*>(be_app);
     296    if (barApp->BarView()->Vertical()) {
     297        if (barApp->BarView()->Expando()) {
     298            fAppsShowExpanders->SetEnabled(true);
     299            if (fAppsShowExpanders->Value())
     300                fAppsExpandNew->SetEnabled(true);
     301            else
     302                fAppsExpandNew->SetEnabled(false);
     303        } else {
     304            fAppsShowExpanders->SetEnabled(false);
     305            fAppsExpandNew->SetEnabled(false);
     306        }
     307    } else {
     308        fAppsShowExpanders->SetEnabled(false);
    281309        fAppsExpandNew->SetEnabled(false);
     310    }
    282311
    283312    if (fMenuRecentDocuments->Value())
    284313        fMenuRecentDocumentCount->SetEnabled(true);
  • src/apps/deskbar/PreferencesWindow.h

    diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
    index 77f641b..4aabde4 100644
    a b  
    1010#include <Button.h>
    1111#include <CheckBox.h>
    1212#include <RadioButton.h>
     13#include <Slider.h>
    1314#include <StringView.h>
    1415#include <TextControl.h>
    1516#include <Window.h>
    const uint32 kConfigShow = 'show';  
    1920const uint32 kConfigClose = 'canc';
    2021const uint32 kUpdateRecentCounts = 'upct';
    2122const uint32 kEditMenuInTracker = 'mtrk';
     23const uint32 kStateChanged = 'stch';
    2224
    2325
    2426class PreferencesWindow : public BWindow
    private:  
    5153            BCheckBox*      fAppsSortTrackerFirst;
    5254            BCheckBox*      fAppsShowExpanders;
    5355            BCheckBox*      fAppsExpandNew;
     56            BSlider*        fAppsIconSizeSlider;
    5457
    5558            BCheckBox*      fClockSeconds;
    5659
  • src/apps/deskbar/StatusView.cpp

    diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp
    index a504101..4f29518 100644
    a b TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)  
    136136    fAlignmentSupport(false)
    137137{
    138138    // init the minimum window width according to the logo.
     139    desk_settings* settings = ((TBarApp*)be_app)->Settings();
    139140    const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
    140141        R_BeLogoIcon);
     142
    141143    if (logoBitmap != NULL) {
    142144        sMinimumWindowWidth = max_c(sMinimumWindowWidth,
    143             2 * (logoBitmap->Bounds().Width() + 8));
     145            2 * (logoBitmap->Bounds().Width() + 8) + settings->iconSize
     146            - kMinimumIconSize);
    144147        fMinimumTrayWidth = sMinimumWindowWidth - kGutter - kDragRegionWidth;
    145148    }
    146149}
    void  
    250253TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
    251254{
    252255    float width = 0, height = kMinimumTrayHeight;
     256    desk_settings* settings = ((TBarApp*)be_app)->Settings();
    253257
    254258    if (fMultiRowMode) {
    255259        if (fShelf->CountReplicants() > 0)
    TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)  
    262266        height = kGutter + (rowCount * kMaxReplicantHeight)
    263267            + ((rowCount - 1) * kIconGap) + kGutter;
    264268        height = max(kMinimumTrayHeight, height);
    265         width = fMinimumTrayWidth;
     269
     270        if (fBarView->Expando())
     271            width = fMinimumTrayWidth + settings->iconSize - kMinimumIconSize;
     272        else
     273            width = fMinimumTrayWidth;
    266274    } else {
    267         // if last replicant overruns clock then
    268         // resize to accomodate
     275        // if last replicant overruns the clock then resize to accomodate
    269276        if (fShelf->CountReplicants() > 0) {
    270             if (fBarView->ShowingClock()
    271                 && fRightBottomReplicant.right + 6 >= fClock->Frame().left) {
     277            if (fBarView->ShowingClock() && fRightBottomReplicant.right + 6
     278                >= fClock->Frame().left) {
    272279                width = fRightBottomReplicant.right + 6
    273280                    + fClock->Frame().Width();
    274281            } else
    TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)  
    276283        }
    277284        // this view has a fixed minimum width
    278285        width = max(fMinimumTrayWidth, width);
     286        height = kGutter + settings->iconSize + kGutter;
    279287    }
    280288
    281289    *preferredWidth = width;
    TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message)  
    12371245BPoint
    12381246TReplicantTray::LocationForReplicant(int32 index, float width)
    12391247{
     1248    desk_settings* settings = ((TBarApp*)be_app)->Settings();
    12401249    BPoint loc(kIconGap + 1, kGutter + 1);
    12411250
    12421251    if (fMultiRowMode) {
    12431252        // try to find free space in every row
    12441253        for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) {
    12451254            // determine free space in this row
    1246             BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap - 2.0,
     1255            BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth
     1256                + settings->iconSize - kMinimumIconSize - kIconGap - 2.0,
    12471257                loc.y + kMaxReplicantHeight);
    12481258            if (row == 0 && fBarView->ShowingClock())
    12491259                rect.right -= fClock->Frame().Width() + kIconGap;
  • src/apps/deskbar/TeamMenuItem.cpp

    diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp
    index cbd669f..5e7f1cd 100644
    a b TTeamMenuItem::GetContentSize(float* width, float* height)  
    203203    if (fIcon)
    204204        iconBounds = fIcon->Bounds();
    205205    else
    206         iconBounds = BRect(0, 0, 15, 15);
     206        iconBounds = BRect(0, 0, kMinimumIconSize - 1, kMinimumIconSize - 1);
    207207
    208208    BMenuItem::GetContentSize(width, height);
    209209
    210210    if (fOverrideWidth != -1.0f)
    211211        *width = fOverrideWidth;
    212212    else
    213         *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad
    214             + 20;
     213        *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad            + 20;
    215214
    216215    if (fOverrideHeight != -1.0f)
    217216        *height = fOverrideHeight;