diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index 909d70eb96..abda494fca 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -144,10 +144,10 @@ TBarWindow::MenusEnded() { BWindow::MenusEnded(); - if (!sBeMenu->LockLooper()) { - // TODO: is this ok? - return; - } + if (!sBeMenu->LockLooper()) { + // TODO: is this ok? + return; + } BMenuItem *item = NULL; while ((item = sBeMenu->RemoveItem((int32)0)) != NULL) diff --git a/src/apps/deskbar/CalendarMenuItem.cpp b/src/apps/deskbar/CalendarMenuItem.cpp index 838209e017..885848b3ea 100644 --- a/src/apps/deskbar/CalendarMenuItem.cpp +++ b/src/apps/deskbar/CalendarMenuItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -13,7 +13,7 @@ #include -static const int32 kDaysPerMonth[] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31}; +static const int32 kDaysPerMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec static const int32 kTitleFontSize = 9; diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 94b4b2d2af..661b1e18e5 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -402,8 +402,8 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage *message) uint32 buttons; if (!(Window()->CurrentMessage()) - || Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) < B_OK) - buttons = 0; + || Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) < B_OK) + buttons = 0; switch (code) { case B_ENTERED_VIEW: @@ -438,13 +438,13 @@ TExpandoMenuBar::InBeMenu(BPoint loc) const TBarWindow *window = dynamic_cast(Window()); if (window) { if (TBeMenu *bemenu = window->BeMenu()) { - bool inBeMenu = false; - if (bemenu->LockLooper()) { - inBeMenu = bemenu->Frame().Contains(loc); - bemenu->UnlockLooper(); - } - return inBeMenu; - } + bool inBeMenu = false; + if (bemenu->LockLooper()) { + inBeMenu = bemenu->Frame().Contains(loc); + bemenu->UnlockLooper(); + } + return inBeMenu; + } } } diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 8849d37e17..ecc475bc11 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -300,8 +300,7 @@ TReplicantTray::AdjustPlacement() { // called when an add-on has been added or removed // need to resize the parent of this accordingly - // - // call to Parent will call ResizeToPreferred + BRect bounds = Bounds(); float width, height; GetPreferredSize(&width, &height); @@ -348,7 +347,7 @@ TReplicantTray::MessageReceived(BMessage *message) AdjustPlacement(); break; - case 'trfm': + case 'Trfm': // time string reformat -> realign DealWithClock(fBarView->ShowingClock()); RealignReplicants(); @@ -1065,22 +1064,33 @@ TReplicantTray::AddIcon(BMessage *icon, int32 *id, const entry_ref *addOn) if (icon->what == B_ARCHIVED_OBJECT) icon->what = 0; + BRect originalBounds = icon->FindRect("_frame"); + // this is a work-around for buggy replicants that change their + // size in AttachedToWindow() (such as "SVM") + // !! check for name collisions? status = fShelf->AddReplicant(icon, BPoint(1, 1)); if (status != B_OK) return status; + int32 count = fShelf->CountReplicants(); + BView *view; + fShelf->ReplicantAt(count - 1, &view, (uint32 *)id, NULL); + + if (originalBounds != view->Bounds()) { + // The replicant changed its size when added to the window, so we need + // to recompute all over again (it's already done once via BShelf::AddReplicant() + // and TReplicantShelf::CanAcceptReplicantView()) + RealignReplicants(); + } + float oldWidth = Bounds().Width(); float oldHeight = Bounds().Height(); float width, height; GetPreferredSize(&width, &height); - if (oldWidth != width || oldHeight != height) + if (oldWidth != width || oldHeight != height) AdjustPlacement(); - int32 count = fShelf->CountReplicants(); - BView *view; - fShelf->ReplicantAt(count-1, &view, (uint32 *)id, NULL); - // add the item to the add-on list AddItem(*id, nodeRef, entry, addOn != NULL); diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index e6ebdcb34f..f9f16a21cf 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -49,6 +49,11 @@ All rights reserved. #include +const char *kShortDateFormat = "%m/%d/%y"; +const char *kShortEuroDateFormat = "%d/%m/%y"; +const char *kLongDateFormat = "%a, %B %d, %Y"; +const char *kLongEuroDateFormat = "%a, %d %B, %Y"; + static const char * const kMinString = "99:99 AM"; @@ -263,12 +268,6 @@ TTimeView::GetCurrentTime() } -const char *kShortDateFormat = "%m/%d/%y"; -const char *kShortEuroDateFormat = "%d/%m/%y"; -const char *kLongDateFormat = "%a, %B %d, %Y"; -const char *kLongEuroDateFormat = "%a, %d %B, %Y"; - - void TTimeView::GetCurrentDate() { @@ -477,7 +476,8 @@ TTimeView::Update() CalculateTextPlacement(); if (fParent) { - fParent->MessageReceived(new BMessage('trfm')); + BMessage reformat('Trfm'); + fParent->MessageReceived(&reformat); // time string format realign fParent->Invalidate(); } diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp index 9dd9a89395..179a247037 100644 --- a/src/apps/deskbar/WindowMenu.cpp +++ b/src/apps/deskbar/WindowMenu.cpp @@ -174,7 +174,7 @@ TWindowMenu::AttachedToWindow() // if an application has no windows, this feature makes it easy to quit it. // (but we only add this option if the application is not Tracker.) - if (fApplicationSignature.Compare(kTrackerSignature) != 0) { + if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { AddSeparatorItem(); AddItem(new TShowHideMenuItem("Quit Application", fTeam, B_QUIT_REQUESTED)); }