Deskbar: Remove settings member vars
... from expando menu bar. Get them from the BarApp settings instead. This is so that we don't have to keep the settings and the member vars in sync.
This commit is contained in:
parent
4f4cab958e
commit
ae30ad6e23
@ -92,9 +92,6 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView* barView, bool vertical)
|
||||
fBarView(barView),
|
||||
fVertical(vertical),
|
||||
fOverflow(false),
|
||||
fDrawLabel(!static_cast<TBarApp*>(be_app)->Settings()->hideLabels),
|
||||
fShowTeamExpander(static_cast<TBarApp*>(be_app)->Settings()->superExpando),
|
||||
fExpandNewTeams(static_cast<TBarApp*>(be_app)->Settings()->expandNewTeams),
|
||||
fDeskbarMenuWidth(kMinMenuItemWidth),
|
||||
fPreviousDragTargetItem(NULL),
|
||||
fLastMousedOverItem(NULL),
|
||||
@ -303,7 +300,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
|
||||
}
|
||||
|
||||
// check if within expander bounds to expand window items
|
||||
if (fVertical && fShowTeamExpander
|
||||
if (fVertical && static_cast<TBarApp*>(be_app)->Settings()->superExpando
|
||||
&& item->ExpanderBounds().Contains(where)) {
|
||||
// start the animation here, finish on mouse up
|
||||
fLastClickedItem = item;
|
||||
@ -466,13 +463,17 @@ TExpandoMenuBar::BuildItems()
|
||||
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
desk_settings* settings = static_cast<TBarApp*>(be_app)->Settings();
|
||||
fDrawLabel = !settings->hideLabels;
|
||||
fShowTeamExpander = settings->superExpando;
|
||||
fExpandNewTeams = settings->expandNewTeams;
|
||||
|
||||
float itemWidth = fVertical ? Frame().Width()
|
||||
: iconSize + (fDrawLabel ? sMinimumWindowWidth - kMinimumIconSize
|
||||
: kIconPadding * 2);
|
||||
float itemWidth = -1.0f;
|
||||
if (fVertical)
|
||||
itemWidth = Frame().Width();
|
||||
else {
|
||||
itemWidth = iconSize;
|
||||
if (!settings->hideLabels)
|
||||
itemWidth += sMinimumWindowWidth - kMinimumIconSize;
|
||||
else
|
||||
itemWidth += kIconPadding * 2;
|
||||
}
|
||||
float itemHeight = -1.0f;
|
||||
|
||||
TeamMenuItemMap items;
|
||||
@ -534,7 +535,7 @@ TExpandoMenuBar::BuildItems()
|
||||
}
|
||||
|
||||
// unexpand if turn off show team expander
|
||||
if (fVertical && !fShowTeamExpander && item->IsExpanded())
|
||||
if (fVertical && !settings->superExpando && item->IsExpanded())
|
||||
item->ToggleExpandState(false);
|
||||
|
||||
if (hasWindowItems) {
|
||||
@ -610,12 +611,19 @@ void
|
||||
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
|
||||
char* signature)
|
||||
{
|
||||
desk_settings* settings = static_cast<TBarApp*>(be_app)->Settings();
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
desk_settings* settings = static_cast<TBarApp*>(be_app)->Settings();
|
||||
|
||||
float itemWidth = fVertical ? Frame().Width()
|
||||
: iconSize + (fDrawLabel ? sMinimumWindowWidth - kMinimumIconSize
|
||||
: kIconPadding * 2);
|
||||
float itemWidth = -1.0f;
|
||||
if (fVertical)
|
||||
itemWidth = Frame().Width();
|
||||
else {
|
||||
itemWidth = iconSize;
|
||||
if (!settings->hideLabels)
|
||||
itemWidth += sMinimumWindowWidth - kMinimumIconSize;
|
||||
else
|
||||
itemWidth += kIconPadding * 2;
|
||||
}
|
||||
float itemHeight = -1.0f;
|
||||
|
||||
TTeamMenuItem* item = new TTeamMenuItem(team, icon, name, signature,
|
||||
@ -651,7 +659,7 @@ TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
|
||||
} else
|
||||
AddItem(item);
|
||||
|
||||
if (fShowTeamExpander && fExpandNewTeams)
|
||||
if (settings->superExpando && settings->expandNewTeams)
|
||||
item->ToggleExpandState(false);
|
||||
|
||||
SizeWindow(1);
|
||||
@ -726,14 +734,16 @@ TExpandoMenuBar::CheckItemSizes(int32 delta)
|
||||
if (fBarView->Vertical())
|
||||
return;
|
||||
|
||||
bool drawLabels = !static_cast<TBarApp*>(be_app)->Settings()->hideLabels;
|
||||
|
||||
float maxWidth = fBarView->DragRegion()->Frame().left
|
||||
- fDeskbarMenuWidth - kSepItemWidth;
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
float iconOnlyWidth = kIconPadding + iconSize + kIconPadding;
|
||||
float minItemWidth = fDrawLabel
|
||||
float minItemWidth = drawLabels
|
||||
? iconOnlyWidth + kMinMenuItemWidth
|
||||
: iconOnlyWidth - kIconPadding;
|
||||
float maxItemWidth = fDrawLabel
|
||||
float maxItemWidth = drawLabels
|
||||
? sMinimumWindowWidth + iconSize - kMinimumIconSize
|
||||
: iconOnlyWidth;
|
||||
float menuWidth = maxItemWidth * CountItems() + fDeskbarMenuWidth
|
||||
@ -863,7 +873,7 @@ TExpandoMenuBar::CheckForSizeOverrun()
|
||||
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
float iconOnlyWidth = kIconPadding + iconSize + kIconPadding;
|
||||
float minItemWidth = fDrawLabel
|
||||
float minItemWidth = !static_cast<TBarApp*>(be_app)->Settings()->hideLabels
|
||||
? iconOnlyWidth + kMinMenuItemWidth
|
||||
: iconOnlyWidth - kIconPadding;
|
||||
float menuWidth = minItemWidth * CountItems() + fDeskbarMenuWidth
|
||||
|
@ -114,9 +114,6 @@ private:
|
||||
TBarView* fBarView;
|
||||
bool fVertical : 1;
|
||||
bool fOverflow : 1;
|
||||
bool fDrawLabel : 1;
|
||||
bool fShowTeamExpander : 1;
|
||||
bool fExpandNewTeams : 1;
|
||||
|
||||
float fDeskbarMenuWidth;
|
||||
TTeamMenuItem* fPreviousDragTargetItem;
|
||||
|
Loading…
Reference in New Issue
Block a user