diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 2ed206fce8..b63a5d4ac1 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -367,10 +367,10 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) && fBarView->ExpandoState() && item->IsExpanded()) { // expando mode window menu item fLastMousedOverItem = menuItem; - if (strcasecmp(windowMenuItem->Label(), - windowMenuItem->Name()) > 0) { + if (strcasecmp(windowMenuItem->TruncatedLabel(), + windowMenuItem->Label()) > 0) { // label is truncated, set tooltip - SetToolTip(windowMenuItem->Name()); + SetToolTip(windowMenuItem->Label()); } else SetToolTip((const char*)NULL); @@ -380,17 +380,17 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) if (!dynamic_cast(be_app)->Settings()->hideLabels) { // item has a visible label, set tool tip if truncated fLastMousedOverItem = menuItem; - if (strcasecmp(item->Label(), item->Name()) > 0) { + if (strcasecmp(item->TruncatedLabel(), item->Label()) > 0) { // label is truncated, set tooltip - SetToolTip(item->Name()); + SetToolTip(item->Label()); } else SetToolTip((const char*)NULL); break; } - SetToolTip(item->Name()); - // new item, set the tooltip to the item name + SetToolTip(item->Label()); + // new item, set the tooltip to the item label fLastMousedOverItem = menuItem; // save the current menuitem for the next MouseMoved() call break; @@ -639,7 +639,7 @@ TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name, int32 itemCount = CountItems(); while (i < itemCount) { teamItem = dynamic_cast(ItemAt(i)); - if (teamItem != NULL && strcasecmp(teamItem->Name(), name) > 0) { + if (teamItem != NULL && strcasecmp(teamItem->Label(), name) > 0) { AddItem(item, i); break; } diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp index 97dd80313b..3f072e2f05 100644 --- a/src/apps/deskbar/TeamMenuItem.cpp +++ b/src/apps/deskbar/TeamMenuItem.cpp @@ -89,7 +89,6 @@ TTeamMenuItem::~TTeamMenuItem() { delete fTeam; delete fIcon; - free(fName); free(fSignature); } @@ -418,27 +417,28 @@ TTeamMenuItem::_Init(BList* team, BBitmap* icon, char* name, char* signature, { fTeam = team; fIcon = icon; - fName = name; fSignature = signature; - if (fName == NULL) { + + if (name == NULL) { char temp[32]; snprintf(temp, sizeof(temp), "team %ld", (addr_t)team->ItemAt(0)); - fName = strdup(temp); + name = strdup(temp); } - BFont font(be_plain_font); - fLabelWidth = ceilf(font.StringWidth(fName)); - font_height fontHeight; - font.GetHeight(&fontHeight); - fLabelAscent = ceilf(fontHeight.ascent); - fLabelDescent = ceilf(fontHeight.descent + fontHeight.leading); - SetLabel(fName); + SetLabel(name); fOverrideWidth = width; fOverrideHeight = height; fBarView = static_cast(be_app)->BarView(); + BFont font(be_plain_font); + fLabelWidth = ceilf(font.StringWidth(name)); + font_height fontHeight; + font.GetHeight(&fontHeight); + fLabelAscent = ceilf(fontHeight.ascent); + fLabelDescent = ceilf(fontHeight.descent + fontHeight.leading); + fOverriddenSelected = false; fExpanded = false; diff --git a/src/apps/deskbar/TeamMenuItem.h b/src/apps/deskbar/TeamMenuItem.h index 08911bc288..e8f770eabd 100644 --- a/src/apps/deskbar/TeamMenuItem.h +++ b/src/apps/deskbar/TeamMenuItem.h @@ -82,7 +82,6 @@ public: float LabelWidth() const { return fLabelWidth; }; BList* Teams() const { return fTeam; }; const char* Signature() const { return fSignature; }; - const char* Name() const { return fName; }; protected: void GetContentSize(float* width, float* height); @@ -100,7 +99,6 @@ private: private: BList* fTeam; BBitmap* fIcon; - char* fName; char* fSignature; float fOverrideWidth; diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp index 6a19baa1c4..ce5e948784 100644 --- a/src/apps/deskbar/WindowMenu.cpp +++ b/src/apps/deskbar/WindowMenu.cpp @@ -144,7 +144,7 @@ TWindowMenu::AttachedToWindow() TWindowMenuItem* item = static_cast(ItemAt(addIndex)); if (item != NULL - && strcasecmp(item->Name(), wInfo->name) > 0) { + && strcasecmp(item->Label(), wInfo->name) > 0) { break; } } diff --git a/src/apps/deskbar/WindowMenuItem.cpp b/src/apps/deskbar/WindowMenuItem.cpp index de740ccb1e..45bedb81ba 100644 --- a/src/apps/deskbar/WindowMenuItem.cpp +++ b/src/apps/deskbar/WindowMenuItem.cpp @@ -61,10 +61,10 @@ const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f); // #pragma mark - TWindowMenuItem -TWindowMenuItem::TWindowMenuItem(const char* label, int32 id, bool mini, +TWindowMenuItem::TWindowMenuItem(const char* name, int32 id, bool mini, bool currentWorkspace, bool dragging) : - TTruncatableMenuItem(label, NULL), + TTruncatableMenuItem(name, NULL), fID(id), fMini(mini), fCurrentWorkSpace(currentWorkspace), @@ -73,7 +73,7 @@ TWindowMenuItem::TWindowMenuItem(const char* label, int32 id, bool mini, fRequireUpdate(false), fModified(false) { - _Init(label); + _Init(name); } @@ -222,7 +222,7 @@ TWindowMenuItem::Invoke(BMessage* /*message*/) void -TWindowMenuItem::SetTo(const char* label, int32 id, bool mini, +TWindowMenuItem::SetTo(const char* name, int32 id, bool mini, bool currentWorkspace, bool dragging) { fModified = fCurrentWorkSpace != currentWorkspace || fMini != mini; @@ -233,7 +233,7 @@ TWindowMenuItem::SetTo(const char* label, int32 id, bool mini, fDragging = dragging; fRequireUpdate = false; - _Init(label); + _Init(name); } @@ -256,7 +256,7 @@ TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex, void -TWindowMenuItem::_Init(const char* label) +TWindowMenuItem::_Init(const char* name) { if (fMini) { fBitmap = fCurrentWorkSpace @@ -268,13 +268,12 @@ TWindowMenuItem::_Init(const char* label) : AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowShownSwitchIcon); } - fName = label; BFont font(be_plain_font); - fLabelWidth = ceilf(font.StringWidth(label)); + fLabelWidth = ceilf(font.StringWidth(name)); font_height fontHeight; font.GetHeight(&fontHeight); fLabelAscent = ceilf(fontHeight.ascent); fLabelDescent = ceilf(fontHeight.descent + fontHeight.leading); - SetLabel(label); + SetLabel(name); } diff --git a/src/apps/deskbar/WindowMenuItem.h b/src/apps/deskbar/WindowMenuItem.h index 5e919ddd50..30f0b22ab9 100644 --- a/src/apps/deskbar/WindowMenuItem.h +++ b/src/apps/deskbar/WindowMenuItem.h @@ -47,11 +47,11 @@ class BBitmap; // sub of TeamMenuItem all DB positions class TWindowMenuItem : public TTruncatableMenuItem { public: - TWindowMenuItem(const char* label, int32 id, + TWindowMenuItem(const char* name, int32 id, bool mini, bool currentWorkSpace, bool dragging = false); - void SetTo(const char* label, int32 id, bool mini, + void SetTo(const char* name, int32 id, bool mini, bool currentWorkSpace, bool dragging = false); @@ -60,7 +60,6 @@ public: int32 ID() const { return fID; }; bool Modified() const { return fModified; }; - const char* Name() const { return fName; }; bool RequiresUpdate() { return fRequireUpdate; }; void SetRequireUpdate(bool update) @@ -76,7 +75,7 @@ protected: virtual void Draw(); private: - void _Init(const char* label); + void _Init(const char* name); int32 fID; bool fMini; @@ -89,7 +88,6 @@ private: bool fExpanded; bool fRequireUpdate; bool fModified; - const char* fName; };