Deskbar: Don't keep state in TBarView
... get/set from/to the app settings instead. This synchronises bar view state and app settings state. Set state in the app settings when TBarView::ChangeState() is called. This updates the in-memory settings, they get saved on quit (reboot). Change order of ChangeState() to be same as settings: vertical, left, top, state. Pass kExpandoState or kMiniState instead of a true or false. kFullState is deprecated and unused. Change-Id: I907e381396d99bd6d81cac8986dd6769735b6cd6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10834 Reviewed-by: John Scipione <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
@@ -142,10 +142,6 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
|||||||
fTrayLocation(1),
|
fTrayLocation(1),
|
||||||
fIsRaised(false),
|
fIsRaised(false),
|
||||||
fMouseDownOutside(false),
|
fMouseDownOutside(false),
|
||||||
fVertical(vertical),
|
|
||||||
fTop(top),
|
|
||||||
fLeft(left),
|
|
||||||
fState(state),
|
|
||||||
fRefsRcvdOnly(true),
|
fRefsRcvdOnly(true),
|
||||||
fDragMessage(NULL),
|
fDragMessage(NULL),
|
||||||
fCachedTypesList(NULL),
|
fCachedTypesList(NULL),
|
||||||
@@ -171,7 +167,7 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
|||||||
// determine the initial Be menu size
|
// determine the initial Be menu size
|
||||||
// (will be updated later)
|
// (will be updated later)
|
||||||
BRect menuFrame(frame);
|
BRect menuFrame(frame);
|
||||||
if (fVertical)
|
if (Vertical())
|
||||||
menuFrame.bottom = menuFrame.top + fTabHeight - 1;
|
menuFrame.bottom = menuFrame.top + fTabHeight - 1;
|
||||||
else
|
else
|
||||||
menuFrame.bottom = menuFrame.top + TeamMenuItemHeight();
|
menuFrame.bottom = menuFrame.top + TeamMenuItemHeight();
|
||||||
@@ -198,9 +194,9 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
|||||||
|
|
||||||
// create and add the expando menu bar
|
// create and add the expando menu bar
|
||||||
fExpandoMenuBar = new TExpandoMenuBar(
|
fExpandoMenuBar = new TExpandoMenuBar(
|
||||||
fVertical ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW, this);
|
Vertical() ? B_ITEMS_IN_COLUMN : B_ITEMS_IN_ROW, this);
|
||||||
fInlineScrollView = new TInlineScrollView(fExpandoMenuBar,
|
fInlineScrollView = new TInlineScrollView(fExpandoMenuBar,
|
||||||
fVertical ? B_VERTICAL : B_HORIZONTAL);
|
Vertical() ? B_VERTICAL : B_HORIZONTAL);
|
||||||
AddChild(fInlineScrollView);
|
AddChild(fInlineScrollView);
|
||||||
|
|
||||||
// hide the expando menu bar in mini-mode
|
// hide the expando menu bar in mini-mode
|
||||||
@@ -238,7 +234,7 @@ TBarView::AttachedToWindow()
|
|||||||
fTrackingHookData.fTarget = BMessenger(this);
|
fTrackingHookData.fTarget = BMessenger(this);
|
||||||
fTrackingHookData.fDragMessage = new BMessage(B_REFS_RECEIVED);
|
fTrackingHookData.fDragMessage = new BMessage(B_REFS_RECEIVED);
|
||||||
|
|
||||||
if (!fVertical)
|
if (!Vertical())
|
||||||
UpdatePlacement(); // update MenuBarHeight
|
UpdatePlacement(); // update MenuBarHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +263,7 @@ TBarView::Draw(BRect)
|
|||||||
else if (AcrossBottom())
|
else if (AcrossBottom())
|
||||||
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
||||||
|
|
||||||
if (fVertical && fState == kExpandoState) {
|
if (Vertical() && State() == kExpandoState) {
|
||||||
SetHighColor(hilite);
|
SetHighColor(hilite);
|
||||||
BRect frame(fExpandoMenuBar->Frame());
|
BRect frame(fExpandoMenuBar->Frame());
|
||||||
StrokeLine(BPoint(frame.left, frame.top - 1),
|
StrokeLine(BPoint(frame.left, frame.top - 1),
|
||||||
@@ -464,12 +460,12 @@ TBarView::PlaceDeskbarMenu()
|
|||||||
|
|
||||||
// Calculate the size of the deskbar menu
|
// Calculate the size of the deskbar menu
|
||||||
BRect menuFrame(Bounds());
|
BRect menuFrame(Bounds());
|
||||||
if (fVertical) {
|
if (Vertical()) {
|
||||||
width = static_cast<TBarApp*>(be_app)->Settings()->width;
|
width = fBarApp->Settings()->width;
|
||||||
height = fTabHeight;
|
height = fTabHeight;
|
||||||
} else {
|
} else {
|
||||||
// horizontal
|
// horizontal
|
||||||
if (fState == kMiniState) {
|
if (State() == kMiniState) {
|
||||||
width = gMinimumWindowWidth;
|
width = gMinimumWindowWidth;
|
||||||
height = std::max(fTabHeight,
|
height = std::max(fTabHeight,
|
||||||
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter);
|
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter);
|
||||||
@@ -489,11 +485,11 @@ TBarView::PlaceDeskbarMenu()
|
|||||||
} else
|
} else
|
||||||
fBarMenuBar->SmartResize(-1, -1);
|
fBarMenuBar->SmartResize(-1, -1);
|
||||||
|
|
||||||
if (fState == kMiniState) {
|
if (State() == kMiniState) {
|
||||||
// vertical or horizontal mini
|
// vertical or horizontal mini
|
||||||
fBarMenuBar->RemoveSeperatorItem();
|
fBarMenuBar->RemoveSeperatorItem();
|
||||||
fBarMenuBar->AddTeamMenu();
|
fBarMenuBar->AddTeamMenu();
|
||||||
} else if (fVertical) {
|
} else if (Vertical()) {
|
||||||
fBarMenuBar->RemoveSeperatorItem();
|
fBarMenuBar->RemoveSeperatorItem();
|
||||||
fBarMenuBar->RemoveTeamMenu();
|
fBarMenuBar->RemoveTeamMenu();
|
||||||
} else {
|
} else {
|
||||||
@@ -522,11 +518,11 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
|
|||||||
fDragRegion->ResizeToPreferred();
|
fDragRegion->ResizeToPreferred();
|
||||||
// also resizes replicant tray
|
// also resizes replicant tray
|
||||||
|
|
||||||
if (fVertical) {
|
if (Vertical()) {
|
||||||
if (fResizeControl->IsHidden())
|
if (fResizeControl->IsHidden())
|
||||||
fResizeControl->Show();
|
fResizeControl->Show();
|
||||||
|
|
||||||
if (fLeft) {
|
if (Left()) {
|
||||||
// move replicant tray past dragger width on left
|
// move replicant tray past dragger width on left
|
||||||
// also down 1px so it won't cover the border
|
// also down 1px so it won't cover the border
|
||||||
fReplicantTray->MoveTo(gDragWidth + kGutter, kGutter);
|
fReplicantTray->MoveTo(gDragWidth + kGutter, kGutter);
|
||||||
@@ -542,14 +538,14 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
|
|||||||
statusLoc.y = fBarMenuBar->Frame().bottom + 1;
|
statusLoc.y = fBarMenuBar->Frame().bottom + 1;
|
||||||
} else {
|
} else {
|
||||||
// horizontal
|
// horizontal
|
||||||
if (fState == kMiniState) {
|
if (State() == kMiniState) {
|
||||||
// horizontal mini
|
// horizontal mini
|
||||||
statusLoc.x = fLeft ? fBarMenuBar->Frame().right + 1 : 0;
|
statusLoc.x = Left() ? fBarMenuBar->Frame().right + 1 : 0;
|
||||||
statusLoc.y = 0;
|
statusLoc.y = 0;
|
||||||
|
|
||||||
// move past dragger and top border
|
// move past dragger and top border
|
||||||
// and make room for the top and bottom borders
|
// and make room for the top and bottom borders
|
||||||
fReplicantTray->MoveTo(fLeft ? gDragWidth : 0, kGutter);
|
fReplicantTray->MoveTo(Left() ? gDragWidth : 0, kGutter);
|
||||||
fReplicantTray->ResizeBy(0, -4);
|
fReplicantTray->ResizeBy(0, -4);
|
||||||
} else {
|
} else {
|
||||||
// move tray right and down to not cover border, resize by same
|
// move tray right and down to not cover border, resize by same
|
||||||
@@ -566,10 +562,10 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
|
|||||||
// make room for top and bottom border
|
// make room for top and bottom border
|
||||||
fResizeControl->ResizeTo(gDragWidth, fDragRegion->Bounds().Height() - 2);
|
fResizeControl->ResizeTo(gDragWidth, fDragRegion->Bounds().Height() - 2);
|
||||||
|
|
||||||
if (fVertical) {
|
if (Vertical()) {
|
||||||
// move resize control into place based on width setting
|
// move resize control into place based on width setting
|
||||||
fResizeControl->MoveTo(
|
fResizeControl->MoveTo(
|
||||||
fLeft ? fBarApp->Settings()->width - gDragWidth : 0, 1);
|
Left() ? fBarApp->Settings()->width - gDragWidth : 0, 1);
|
||||||
if (fResizeControl->IsHidden())
|
if (fResizeControl->IsHidden())
|
||||||
fResizeControl->Show();
|
fResizeControl->Show();
|
||||||
} else {
|
} else {
|
||||||
@@ -586,17 +582,17 @@ void
|
|||||||
TBarView::PlaceApplicationBar()
|
TBarView::PlaceApplicationBar()
|
||||||
{
|
{
|
||||||
BRect screenFrame = (BScreen(Window())).Frame();
|
BRect screenFrame = (BScreen(Window())).Frame();
|
||||||
if (fState == kMiniState) {
|
if (State() == kMiniState) {
|
||||||
if (!fInlineScrollView->IsHidden())
|
if (!fInlineScrollView->IsHidden())
|
||||||
fInlineScrollView->Hide();
|
fInlineScrollView->Hide();
|
||||||
|
|
||||||
SizeWindow(screenFrame);
|
SizeWindow(screenFrame);
|
||||||
PositionWindow(screenFrame);
|
PositionWindow(screenFrame);
|
||||||
Window()->UpdateIfNeeded();
|
Window()->UpdateIfNeeded();
|
||||||
if (!fVertical) {
|
if (!Vertical()) {
|
||||||
// move the menu bar into place after the window has been resized
|
// move the menu bar into place after the window has been resized
|
||||||
// based on replicant tray
|
// based on replicant tray
|
||||||
fBarMenuBar->MoveTo(fLeft ? 0 : fDragRegion->Bounds().right + 1,
|
fBarMenuBar->MoveTo(Left() ? 0 : fDragRegion->Bounds().right + 1,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@@ -607,13 +603,13 @@ TBarView::PlaceApplicationBar()
|
|||||||
fInlineScrollView->Show();
|
fInlineScrollView->Show();
|
||||||
|
|
||||||
BRect expandoFrame(0, 0, 0, 0);
|
BRect expandoFrame(0, 0, 0, 0);
|
||||||
if (fVertical) {
|
if (Vertical()) {
|
||||||
// left or right
|
// left or right
|
||||||
expandoFrame.left = fDragRegion->Frame().left;
|
expandoFrame.left = fDragRegion->Frame().left;
|
||||||
expandoFrame.top = fTrayLocation != 0 ? fDragRegion->Frame().bottom + 1
|
expandoFrame.top = fTrayLocation != 0 ? fDragRegion->Frame().bottom + 1
|
||||||
: fBarMenuBar->Frame().bottom + 1;
|
: fBarMenuBar->Frame().bottom + 1;
|
||||||
expandoFrame.right = fBarApp->Settings()->width;
|
expandoFrame.right = fBarApp->Settings()->width;
|
||||||
expandoFrame.bottom = fState == kFullState ? screenFrame.bottom
|
expandoFrame.bottom = State() == kFullState ? screenFrame.bottom
|
||||||
: Frame().bottom;
|
: Frame().bottom;
|
||||||
} else {
|
} else {
|
||||||
// top or bottom
|
// top or bottom
|
||||||
@@ -625,7 +621,7 @@ TBarView::PlaceApplicationBar()
|
|||||||
|
|
||||||
fInlineScrollView->DetachScrollers();
|
fInlineScrollView->DetachScrollers();
|
||||||
fInlineScrollView->MoveTo(expandoFrame.LeftTop());
|
fInlineScrollView->MoveTo(expandoFrame.LeftTop());
|
||||||
fInlineScrollView->ResizeTo(expandoFrame.Width(), fVertical
|
fInlineScrollView->ResizeTo(expandoFrame.Width(), Vertical()
|
||||||
? screenFrame.bottom - expandoFrame.top : expandoFrame.bottom);
|
? screenFrame.bottom - expandoFrame.top : expandoFrame.bottom);
|
||||||
fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height());
|
fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height());
|
||||||
fExpandoMenuBar->MoveTo(0, 0);
|
fExpandoMenuBar->MoveTo(0, 0);
|
||||||
@@ -646,13 +642,13 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width,
|
|||||||
if (setToHiddenSize) {
|
if (setToHiddenSize) {
|
||||||
windowHeight = kHiddenDimension;
|
windowHeight = kHiddenDimension;
|
||||||
|
|
||||||
if (fState == kExpandoState && !fVertical) {
|
if (State() == kExpandoState && !Vertical()) {
|
||||||
// top or bottom, full
|
// top or bottom, full
|
||||||
windowWidth = screenFrame.Width();
|
windowWidth = screenFrame.Width();
|
||||||
} else
|
} else
|
||||||
windowWidth = kHiddenDimension;
|
windowWidth = kHiddenDimension;
|
||||||
} else if (fVertical) {
|
} else if (Vertical()) {
|
||||||
if (fState == kFullState) {
|
if (State() == kFullState) {
|
||||||
// full state has minimum screen window height
|
// full state has minimum screen window height
|
||||||
windowHeight = std::max(screenFrame.bottom, windowHeight);
|
windowHeight = std::max(screenFrame.bottom, windowHeight);
|
||||||
} else {
|
} else {
|
||||||
@@ -662,7 +658,7 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width,
|
|||||||
else
|
else
|
||||||
windowHeight = fBarMenuBar->Frame().bottom;
|
windowHeight = fBarMenuBar->Frame().bottom;
|
||||||
|
|
||||||
if (fState == kExpandoState && fExpandoMenuBar != NULL) {
|
if (State() == kExpandoState && fExpandoMenuBar != NULL) {
|
||||||
// top left or right
|
// top left or right
|
||||||
windowHeight += fExpandoMenuBar->Bounds().Height();
|
windowHeight += fExpandoMenuBar->Bounds().Height();
|
||||||
// use Height() here, not bottom so view can be scrolled
|
// use Height() here, not bottom so view can be scrolled
|
||||||
@@ -672,7 +668,7 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width,
|
|||||||
windowWidth = fBarApp->Settings()->width;
|
windowWidth = fBarApp->Settings()->width;
|
||||||
} else {
|
} else {
|
||||||
// horizontal
|
// horizontal
|
||||||
if (fState == kMiniState) {
|
if (State() == kMiniState) {
|
||||||
// four corners horizontal
|
// four corners horizontal
|
||||||
windowHeight = fBarMenuBar->Frame().Height();
|
windowHeight = fBarMenuBar->Frame().Height();
|
||||||
windowWidth = fDragRegion->Frame().Width()
|
windowWidth = fDragRegion->Frame().Width()
|
||||||
@@ -710,11 +706,11 @@ TBarView::PositionWindow(BRect screenFrame)
|
|||||||
|
|
||||||
BPoint moveLoc(0, 0);
|
BPoint moveLoc(0, 0);
|
||||||
// right, expanded, mini, or full
|
// right, expanded, mini, or full
|
||||||
if (!fLeft && (fVertical || fState == kMiniState))
|
if (!Left() && (Vertical() || State() == kMiniState))
|
||||||
moveLoc.x = screenFrame.right - windowWidth;
|
moveLoc.x = screenFrame.right - windowWidth;
|
||||||
|
|
||||||
// bottom, full
|
// bottom, full
|
||||||
if (!fTop)
|
if (!Top())
|
||||||
moveLoc.y = screenFrame.bottom - windowHeight;
|
moveLoc.y = screenFrame.bottom - windowHeight;
|
||||||
|
|
||||||
Window()->MoveTo(moveLoc);
|
Window()->MoveTo(moveLoc);
|
||||||
@@ -737,13 +733,6 @@ TBarView::CheckForScrolling()
|
|||||||
void
|
void
|
||||||
TBarView::SaveSettings()
|
TBarView::SaveSettings()
|
||||||
{
|
{
|
||||||
desk_settings* settings = fBarApp->Settings();
|
|
||||||
|
|
||||||
settings->vertical = fVertical;
|
|
||||||
settings->left = fLeft;
|
|
||||||
settings->top = fTop;
|
|
||||||
settings->state = fState;
|
|
||||||
|
|
||||||
fReplicantTray->SaveTimeSettings();
|
fReplicantTray->SaveTimeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,19 +740,18 @@ TBarView::SaveSettings()
|
|||||||
void
|
void
|
||||||
TBarView::UpdatePlacement()
|
TBarView::UpdatePlacement()
|
||||||
{
|
{
|
||||||
ChangeState(fState, fVertical, fLeft, fTop);
|
ChangeState(Vertical(), Left(), Top(), State());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top,
|
TBarView::ChangeState(bool vertical, bool left, bool top, int32 state, bool async)
|
||||||
bool async)
|
|
||||||
{
|
{
|
||||||
BMessage message(kUpdateOrientation);
|
BMessage message(kUpdateOrientation);
|
||||||
message.AddInt32("state", state);
|
|
||||||
message.AddBool("vertical", vertical);
|
message.AddBool("vertical", vertical);
|
||||||
message.AddBool("left", left);
|
message.AddBool("left", left);
|
||||||
message.AddBool("top", top);
|
message.AddBool("top", top);
|
||||||
|
message.AddInt32("state", state);
|
||||||
|
|
||||||
if (async)
|
if (async)
|
||||||
BMessenger(this).SendMessage(&message);
|
BMessenger(this).SendMessage(&message);
|
||||||
@@ -775,19 +763,19 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top,
|
|||||||
void
|
void
|
||||||
TBarView::_ChangeState(BMessage* message)
|
TBarView::_ChangeState(BMessage* message)
|
||||||
{
|
{
|
||||||
int32 state = message->FindInt32("state");
|
|
||||||
bool vertical = message->FindBool("vertical");
|
bool vertical = message->FindBool("vertical");
|
||||||
bool left = message->FindBool("left");
|
bool left = message->FindBool("left");
|
||||||
bool top = message->FindBool("top");
|
bool top = message->FindBool("top");
|
||||||
|
int32 state = message->FindInt32("state");
|
||||||
|
|
||||||
bool vertSwap = (fVertical != vertical);
|
bool vertSwap = (Vertical() != vertical);
|
||||||
bool leftSwap = (fLeft != left);
|
bool leftSwap = (Left() != left);
|
||||||
bool stateChanged = (fState != state);
|
bool stateChanged = (State() != state);
|
||||||
|
|
||||||
fState = state;
|
fBarApp->Settings()->vertical = vertical;
|
||||||
fVertical = vertical;
|
fBarApp->Settings()->left = left;
|
||||||
fLeft = left;
|
fBarApp->Settings()->top = top;
|
||||||
fTop = top;
|
fBarApp->Settings()->state = state;
|
||||||
|
|
||||||
if (stateChanged || vertSwap) {
|
if (stateChanged || vertSwap) {
|
||||||
be_app->PostMessage(kStateChanged);
|
be_app->PostMessage(kStateChanged);
|
||||||
@@ -799,7 +787,7 @@ TBarView::_ChangeState(BMessage* message)
|
|||||||
barWindow->SetSizeLimits();
|
barWindow->SetSizeLimits();
|
||||||
|
|
||||||
if (vertSwap && fExpandoMenuBar != NULL) {
|
if (vertSwap && fExpandoMenuBar != NULL) {
|
||||||
if (fVertical) {
|
if (Vertical()) {
|
||||||
fInlineScrollView->SetOrientation(B_VERTICAL);
|
fInlineScrollView->SetOrientation(B_VERTICAL);
|
||||||
fExpandoMenuBar->SetMenuLayout(B_ITEMS_IN_COLUMN);
|
fExpandoMenuBar->SetMenuLayout(B_ITEMS_IN_COLUMN);
|
||||||
fExpandoMenuBar->StartMonitoringWindows();
|
fExpandoMenuBar->StartMonitoringWindows();
|
||||||
@@ -854,6 +842,48 @@ TBarView::HideDeskbar(bool hide)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TBarView::Vertical() const
|
||||||
|
{
|
||||||
|
return fBarApp->Settings()->vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TBarView::Left() const
|
||||||
|
{
|
||||||
|
return fBarApp->Settings()->left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TBarView::Top() const {
|
||||||
|
return fBarApp->Settings()->top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
TBarView::State() const
|
||||||
|
{
|
||||||
|
return fBarApp->Settings()->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TBarView::AcrossTop() const
|
||||||
|
{
|
||||||
|
return Top() && !Vertical() && State() != kMiniState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TBarView::AcrossBottom() const
|
||||||
|
{
|
||||||
|
return !Top() && !Vertical() && State() != kMiniState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Drag and Drop
|
// #pragma mark - Drag and Drop
|
||||||
|
|
||||||
|
|
||||||
@@ -1117,7 +1147,7 @@ TBarView::HandleDeskbarMenu(BMessage* messagewithdestination)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// in mini-mode
|
// in mini-mode
|
||||||
if (fVertical && fState != kExpandoState) {
|
if (Vertical() && State() != kExpandoState) {
|
||||||
// if drop is in the team menu, bail
|
// if drop is in the team menu, bail
|
||||||
if (fBarMenuBar->CountItems() >= 2) {
|
if (fBarMenuBar->CountItems() >= 2) {
|
||||||
uint32 buttons;
|
uint32 buttons;
|
||||||
@@ -1282,11 +1312,11 @@ TBarView::TeamMenuItemHeight() const
|
|||||||
if (fBarApp->Settings()->hideLabels && iconSize > B_MINI_ICON) {
|
if (fBarApp->Settings()->hideLabels && iconSize > B_MINI_ICON) {
|
||||||
// height is determined based solely on icon size
|
// height is determined based solely on icon size
|
||||||
return iconOnlyHeight;
|
return iconOnlyHeight;
|
||||||
} else if (!fVertical || (fVertical && iconSize <= large)) {
|
} else if (!Vertical() || (Vertical() && iconSize <= large)) {
|
||||||
// horizontal or vertical with label on same row as icon:
|
// horizontal or vertical with label on same row as icon:
|
||||||
// height based on icon size or font size, whichever is bigger
|
// height based on icon size or font size, whichever is bigger
|
||||||
return std::max(iconOnlyHeight, labelHeight);
|
return std::max(iconOnlyHeight, labelHeight);
|
||||||
} else if (fVertical && iconSize > large) {
|
} else if (Vertical() && iconSize > large) {
|
||||||
// vertical with label below icon: height based on icon and label
|
// vertical with label below icon: height based on icon and label
|
||||||
return ceilf(iconOnlyHeight + labelHeight);
|
return ceilf(iconOnlyHeight + labelHeight);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+11
-19
@@ -96,27 +96,24 @@ public:
|
|||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
void UpdatePlacement();
|
void UpdatePlacement();
|
||||||
void ChangeState(int32 state, bool vertical, bool left,
|
void ChangeState(bool vertical, bool left, bool top, int32 state,
|
||||||
bool top, bool aSync = false);
|
bool aSync = false);
|
||||||
|
|
||||||
void RaiseDeskbar(bool raise);
|
void RaiseDeskbar(bool raise);
|
||||||
void HideDeskbar(bool hide);
|
void HideDeskbar(bool hide);
|
||||||
|
|
||||||
// window placement methods
|
// window placement methods
|
||||||
bool Vertical() const { return fVertical; };
|
bool Vertical() const;
|
||||||
bool Left() const { return fLeft; };
|
bool Left() const;
|
||||||
bool Top() const { return fTop; };
|
bool Top() const;
|
||||||
bool AcrossTop() const { return fTop && !fVertical
|
bool AcrossTop() const;
|
||||||
&& fState != kMiniState; };
|
bool AcrossBottom() const;
|
||||||
bool AcrossBottom() const { return !fTop && !fVertical
|
|
||||||
&& fState != kMiniState; };
|
|
||||||
|
|
||||||
// window state methods
|
// window state methods
|
||||||
bool ExpandoState() const
|
bool ExpandoState() const { return State() == kExpandoState; };
|
||||||
{ return fState == kExpandoState; };
|
bool FullState() const { return State() == kFullState; };
|
||||||
bool FullState() const { return fState == kFullState; };
|
bool MiniState() const { return State() == kMiniState; };
|
||||||
bool MiniState() const { return fState == kMiniState; };
|
int32 State() const;
|
||||||
int32 State() const { return fState; };
|
|
||||||
|
|
||||||
// drag and drop methods
|
// drag and drop methods
|
||||||
void CacheDragData(const BMessage* incoming);
|
void CacheDragData(const BMessage* incoming);
|
||||||
@@ -201,11 +198,6 @@ private:
|
|||||||
bool fIsRaised : 1;
|
bool fIsRaised : 1;
|
||||||
bool fMouseDownOutside : 1;
|
bool fMouseDownOutside : 1;
|
||||||
|
|
||||||
bool fVertical : 1;
|
|
||||||
bool fTop : 1;
|
|
||||||
bool fLeft : 1;
|
|
||||||
int32 fState;
|
|
||||||
|
|
||||||
bigtime_t fPulseRate;
|
bigtime_t fPulseRate;
|
||||||
bool fRefsRcvdOnly;
|
bool fRefsRcvdOnly;
|
||||||
BMessage* fDragMessage;
|
BMessage* fDragMessage;
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ TBarWindow::SetDeskbarLocation(deskbar_location location, bool newExpandState)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fBarView->ChangeState(expand, vertical, left, top);
|
fBarView->ChangeState(vertical, left, top, expand ? kExpandoState : kMiniState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ TBarWindow::Expand(BMessage* message)
|
|||||||
bool vertical = fBarView->Vertical();
|
bool vertical = fBarView->Vertical();
|
||||||
bool left = fBarView->Left();
|
bool left = fBarView->Left();
|
||||||
bool top = fBarView->Top();
|
bool top = fBarView->Top();
|
||||||
fBarView->ChangeState(expand, vertical, left, top);
|
fBarView->ChangeState(vertical, left, top, expand ? kExpandoState : kMiniState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1560,7 +1560,7 @@ TDragRegion::SwitchModeForRegion(BPoint where, BRegion region,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fBarView->ChangeState(newState, newVertical, newLeft, newTop, true);
|
fBarView->ChangeState(newVertical, newLeft, newTop, newState, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user