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