Deskbar: Restore old mini-mode

... with the replicant tray below the menu bar.

Deskbar now has four modes:
1. vertical mini-mode (old mini-mode)
2. horizontal mini-mode (new mini-mode, was vertical)
3. vertical expando-mode (default)
4. horizonal expando-mode

Horizontal mini-mode gets the corner, then it switches to vertical
mini-mode above or below that, then to vertical expando-mode after
that. Horizontal expando mode is in center-screen top and bottom.

Clock vertical centering simplification.

Change-Id: I216008c20feb28f793693046792bbcfdf1e703e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3146
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
John Scipione
2020-08-17 21:11:31 +00:00
parent 2e4840b45c
commit f9b3a3b1f3
7 changed files with 225 additions and 190 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ TBarMenuTitle::DrawContent()
// cut-off the leaf // cut-off the leaf
bool isLeafMenu = dynamic_cast<TDeskbarMenu*>(fMenu) != NULL; bool isLeafMenu = dynamic_cast<TDeskbarMenu*>(fMenu) != NULL;
if (fBarView->Vertical() && isLeafMenu) if (isLeafMenu)
iconRect.OffsetBy(widthOffset, frame.Height() - iconRect.Height() + 2); iconRect.OffsetBy(widthOffset, frame.Height() - iconRect.Height() + 2);
else else
iconRect.OffsetBy(widthOffset, heightOffset); iconRect.OffsetBy(widthOffset, heightOffset);
+85 -88
View File
@@ -465,16 +465,19 @@ 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 (fVertical) {
if (fState == kMiniState) width = static_cast<TBarApp*>(be_app)->Settings()->width;
width = gMinimumWindowWidth;
else
width = fBarApp->Settings()->width;
height = fTabHeight; height = fTabHeight;
} else { } else {
width = gMinimumWindowWidth / 2 + kIconPadding; // horizontal
height = std::max(TeamMenuItemHeight(), if (fState == kMiniState) {
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); width = gMinimumWindowWidth;
height = std::max(fTabHeight,
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter);
} else {
width = gMinimumWindowWidth / 2 + kIconPadding;
height = std::max(TeamMenuItemHeight(),
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter);
}
} }
menuFrame.bottom = menuFrame.top + height; menuFrame.bottom = menuFrame.top + height;
@@ -485,24 +488,14 @@ TBarView::PlaceDeskbarMenu()
} else } else
fBarMenuBar->SmartResize(-1, -1); fBarMenuBar->SmartResize(-1, -1);
if (fVertical) { if (fState == kMiniState) {
switch (fState) { // vertical or horizontal mini
case kFullState: fBarMenuBar->RemoveSeperatorItem();
case kExpandoState: fBarMenuBar->AddTeamMenu();
default: } else if (fVertical) {
// shows apps below tray fBarMenuBar->RemoveSeperatorItem();
fBarMenuBar->RemoveTeamMenu(); fBarMenuBar->RemoveTeamMenu();
fBarMenuBar->RemoveSeperatorItem();
break;
case kMiniState:
// leaf menu next to team menu
fBarMenuBar->RemoveSeperatorItem();
fBarMenuBar->AddTeamMenu();
break;
}
} else { } else {
// shows apps to the right of the leaf menu
fBarMenuBar->RemoveTeamMenu(); fBarMenuBar->RemoveTeamMenu();
fBarMenuBar->AddSeparatorItem(); fBarMenuBar->AddSeparatorItem();
} }
@@ -529,20 +522,27 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
// also resizes replicant tray // also resizes replicant tray
if (fVertical) { if (fVertical) {
if (fState == kExpandoState || fState == kFullState) { if (fResizeControl->IsHidden())
// move replicant tray down by 2px fResizeControl->Show();
if (fLeft) {
// move replicant tray past dragger and shrink by same amount
fReplicantTray->MoveTo(kDragWidth + 1, 2);
fReplicantTray->ResizeBy(-(kDragWidth + 1), -2);
} else {
fReplicantTray->MoveTo(0, 2);
fReplicantTray->ResizeBy(0, -2);
}
statusLoc.x = 0; if (fLeft) {
statusLoc.y = fBarMenuBar->Frame().bottom + 1; // move replicant tray past dragger width on left
} else if (fState == kMiniState) { // also down 1px so it won't cover the border
fReplicantTray->MoveTo(kDragWidth + kGutter, kGutter);
// shrink width by same amount
fReplicantTray->ResizeBy(-(kDragWidth + kGutter), 0);
} else {
// move replicant tray down 1px so it won't cover the border
fReplicantTray->MoveTo(0, kGutter);
}
statusLoc.x = 0;
statusLoc.y = fBarMenuBar->Frame().bottom + 1;
} else {
// horizontal
if (fState == kMiniState) {
// horizontal mini
statusLoc.x = fLeft ? fBarMenuBar->Frame().right + 1 : 0; statusLoc.x = fLeft ? fBarMenuBar->Frame().right + 1 : 0;
statusLoc.y = 0; statusLoc.y = 0;
@@ -550,25 +550,22 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
// and make room for the top and bottom borders // and make room for the top and bottom borders
fReplicantTray->MoveTo(fLeft ? kDragWidth : 0, kGutter); fReplicantTray->MoveTo(fLeft ? kDragWidth : 0, kGutter);
fReplicantTray->ResizeBy(0, -4); fReplicantTray->ResizeBy(0, -4);
} else {
// move tray right and down to not cover border, resize by same
fReplicantTray->MoveTo(2, 0);
fReplicantTray->ResizeBy(-2, 0);
BRect screenFrame = (BScreen(Window())).Frame();
statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width();
statusLoc.y = 0;
} }
} else {
// horizontal
// move tray right and down to not cover border, resize by same
fReplicantTray->MoveTo(2, 0);
fReplicantTray->ResizeBy(-2, 0);
BRect screenFrame = (BScreen(Window())).Frame();
statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width();
statusLoc.y = 0;
} }
fDragRegion->MoveTo(statusLoc); fDragRegion->MoveTo(statusLoc);
// make room for top and bottom border // make room for top and bottom border
fResizeControl->ResizeTo(kDragWidth, fDragRegion->Bounds().Height() - 2); fResizeControl->ResizeTo(kDragWidth, fDragRegion->Bounds().Height() - 2);
// resize control is only used in vertical expando and full state if (fVertical) {
if (fVertical && fState != kMiniState) {
// 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 - kDragWidth : 0, 1); fLeft ? fBarApp->Settings()->width - kDragWidth : 0, 1);
@@ -588,16 +585,19 @@ void
TBarView::PlaceApplicationBar() TBarView::PlaceApplicationBar()
{ {
BRect screenFrame = (BScreen(Window())).Frame(); BRect screenFrame = (BScreen(Window())).Frame();
if (fVertical && fState == kMiniState) { if (fState == kMiniState) {
if (!fInlineScrollView->IsHidden()) if (!fInlineScrollView->IsHidden())
fInlineScrollView->Hide(); fInlineScrollView->Hide();
SizeWindow(screenFrame); SizeWindow(screenFrame);
PositionWindow(screenFrame); PositionWindow(screenFrame);
Window()->UpdateIfNeeded(); Window()->UpdateIfNeeded();
// move the menu bar into place after the window has been resized if (!fVertical) {
// based on replicant tray // move the menu bar into place after the window has been resized
fBarMenuBar->MoveTo(fLeft ? 0 : fDragRegion->Bounds().right + 1, 0); // based on replicant tray
fBarMenuBar->MoveTo(fLeft ? 0 : fDragRegion->Bounds().right + 1,
0);
}
Invalidate(); Invalidate();
return; return;
} }
@@ -652,40 +652,37 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width,
windowWidth = screenFrame.Width(); windowWidth = screenFrame.Width();
} else } else
windowWidth = kHiddenDimension; windowWidth = kHiddenDimension;
} else if (!fVertical) { } else if (fVertical) {
// horizontal top or bottom if (fState == kFullState) {
windowHeight = std::max(TeamMenuItemHeight(), // full state has minimum screen window height
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); windowHeight = std::max(screenFrame.bottom, windowHeight);
windowWidth = screenFrame.Width(); } else {
} else { // mini or expando
// vertical if (fTrayLocation != 0)
switch (fState) { windowHeight = fDragRegion->Frame().bottom;
case kFullState: else
case kExpandoState:
default:
// top left or right
if (fTrayLocation != 0)
windowHeight = fDragRegion->Frame().bottom + 1;
else
windowHeight = fBarMenuBar->Frame().bottom + 1;
// use Height() here not bottom because view can be scrolled
if (fExpandoMenuBar != NULL)
windowHeight += fExpandoMenuBar->Bounds().Height();
// full state has minimum screen window height
if (fState == kFullState)
windowHeight = std::max(screenFrame.bottom, windowHeight);
windowWidth = fBarApp->Settings()->width;
break;
case kMiniState:
// four corners
windowHeight = fBarMenuBar->Frame().bottom; windowHeight = fBarMenuBar->Frame().bottom;
windowWidth = fDragRegion->Frame().Width()
+ fBarMenuBar->Frame().Width() + 1; if (fState == kExpandoState && fExpandoMenuBar != NULL) {
break; // top left or right
windowHeight += fExpandoMenuBar->Bounds().Height();
// use Height() here, not bottom so view can be scrolled
}
}
windowWidth = fBarApp->Settings()->width;
} else {
// horizontal
if (fState == kMiniState) {
// four corners horizontal
windowHeight = fBarMenuBar->Frame().Height();
windowWidth = fDragRegion->Frame().Width()
+ fBarMenuBar->Frame().Width() + 1;
} else {
// horizontal top or bottom
windowHeight = std::max(TeamMenuItemHeight(),
kGutter + fReplicantTray->MaxReplicantHeight() + kGutter);
windowWidth = screenFrame.Width();
} }
} }
@@ -714,7 +711,7 @@ 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) if (!fLeft && (fVertical || fState == kMiniState))
moveLoc.x = screenFrame.right - windowWidth; moveLoc.x = screenFrame.right - windowWidth;
// bottom, full // bottom, full
+4 -3
View File
@@ -106,9 +106,10 @@ public:
bool Vertical() const { return fVertical; }; bool Vertical() const { return fVertical; };
bool Left() const { return fLeft; }; bool Left() const { return fLeft; };
bool Top() const { return fTop; }; bool Top() const { return fTop; };
bool AcrossTop() const { return fTop && !fVertical; }; bool AcrossTop() const { return fTop && !fVertical
bool AcrossBottom() const && fState != kMiniState; };
{ return !fTop && !fVertical; }; bool AcrossBottom() const { return !fTop && !fVertical
&& fState != kMiniState; };
// window state methods // window state methods
bool ExpandoState() const bool ExpandoState() const
+28 -13
View File
@@ -244,7 +244,7 @@ TBarWindow::Minimize(bool minimize)
void void
TBarWindow::FrameResized(float width, float height) TBarWindow::FrameResized(float width, float height)
{ {
if (fBarView->MiniState() || !fBarView->Vertical()) if (!fBarView->Vertical())
return BWindow::FrameResized(width, height); return BWindow::FrameResized(width, height);
bool setToHiddenSize = fBarApp->Settings()->autoHide bool setToHiddenSize = fBarApp->Settings()->autoHide
@@ -686,19 +686,34 @@ TBarWindow::SetSizeLimits()
0, kHiddenDimension); 0, kHiddenDimension);
} }
} else { } else {
if (fBarView->Vertical()) { float minHeight;
float minHeight = 0; float maxHeight;
float maxHeight = B_SIZE_UNLIMITED; float minWidth;
float minWidth = gMinimumWindowWidth; float maxWidth;
float maxWidth = fBarView->MiniState() ? B_SIZE_UNLIMITED
: gMaximumWindowWidth;
BWindow::SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
} else {
BWindow::SetSizeLimits(screenFrame.Width(), screenFrame.Width(),
kMenuBarHeight - 1, kMaximumIconSize + 4);
}
}
if (fBarView->Vertical()) {
minHeight = fBarView->TabHeight();
maxHeight = B_SIZE_UNLIMITED;
minWidth = gMinimumWindowWidth;
maxWidth = gMaximumWindowWidth;
} else {
// horizontal
if (fBarView->MiniState()) {
minWidth = gMinimumWindowWidth;
maxWidth = B_SIZE_UNLIMITED;
minHeight = fBarView->TabHeight();
maxHeight = std::max(fBarView->TabHeight(), kGutter
+ fBarView->ReplicantTray()->MaxReplicantHeight()
+ kGutter);
} else {
minWidth = maxWidth = screenFrame.Width();
minHeight = kMenuBarHeight - 1;
maxHeight = kMaximumIconSize + 4;
}
}
BWindow::SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
}
} }
+96 -79
View File
@@ -77,6 +77,9 @@ All rights reserved.
#include "TimeView.h" #include "TimeView.h"
static const float kVerticalMiniMultiplier = 2.9f;
#ifdef DB_ADDONS #ifdef DB_ADDONS
// Add-on support // Add-on support
// //
@@ -229,8 +232,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
float width = 0; float width = 0;
float height = fMinTrayHeight; float height = fMinTrayHeight;
if (fBarView->Vertical() if (fBarView->Vertical()) {
&& (fBarView->ExpandoState() || fBarView->FullState())) {
width = static_cast<TBarApp*>(be_app)->Settings()->width width = static_cast<TBarApp*>(be_app)->Settings()->width
- kDragWidth - kGutter; - kDragWidth - kGutter;
if (fRightBottomReplicant.IsValid()) if (fRightBottomReplicant.IsValid())
@@ -261,7 +263,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
// if mini-mode set to tab height // if mini-mode set to tab height
// else if horizontal mode set to team menu item height // else if horizontal mode set to team menu item height
if (fBarView->Vertical() && fBarView->MiniState()) if (fBarView->MiniState())
height = std::max(fMinTrayHeight, fBarView->TabHeight()); height = std::max(fMinTrayHeight, fBarView->TabHeight());
else else
height = fBarView->TeamMenuItemHeight(); height = fBarView->TeamMenuItemHeight();
@@ -1143,7 +1145,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message)
alignment align = B_ALIGN_LEFT; alignment align = B_ALIGN_LEFT;
if (fAlignmentSupport && message->HasBool("deskbar:dynamic_align")) { if (fAlignmentSupport && message->HasBool("deskbar:dynamic_align")) {
if (!fBarView->Vertical()) if (!fBarView->Vertical() && !fBarView->MiniState())
align = B_ALIGN_RIGHT; align = B_ALIGN_RIGHT;
else else
align = fBarView->Left() ? B_ALIGN_LEFT : B_ALIGN_RIGHT; align = fBarView->Left() ? B_ALIGN_LEFT : B_ALIGN_RIGHT;
@@ -1172,19 +1174,17 @@ BPoint
TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) TReplicantTray::LocationForReplicant(int32 index, float replicantWidth)
{ {
BPoint loc(kTrayPadding, 0); BPoint loc(kTrayPadding, 0);
if (fBarView->Vertical()) { if (fBarView->Vertical() || fBarView->MiniState()) {
if (fBarView->MiniState()) if (fBarView->Vertical() && !fBarView->Left())
loc.y = floorf((fBarView->TabHeight() - fMaxReplicantHeight) / 2); loc.x += kDragWidth; // move past dragger on left
else if (!fBarView->Left()) {
// move past dragger on right loc.y = floorf((fBarView->TabHeight() - fMaxReplicantHeight) / 2) - 1;
loc.x += kDragWidth;
loc.y += 1;
}
} else { } else {
loc.x -= 2; // keeps everything lined up nicely loc.x -= 2; // keeps everything lined up nicely
const int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize(); const int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
float yOffset = iconSize > B_MINI_ICON ? 3 : 2; float yOffset = iconSize > B_MINI_ICON ? 3 : 2;
// squeeze icons in there at 16x16, reduce border by 1px // squeeze icons in there at 16x16, reduce border by 1px
if (fBarView->Top()) { if (fBarView->Top()) {
// align top // align top
loc.y = yOffset; loc.y = yOffset;
@@ -1195,8 +1195,11 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth)
} }
} }
if (fBarView->Vertical() // move clock vertically centered in first row next to replicants
&& (fBarView->ExpandoState() || fBarView->FullState())) { fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding,
loc.y + floorf((fMaxReplicantHeight - fTime->fHeight) / 2));
if (fBarView->Vertical()) {
// try to find free space in every row // try to find free space in every row
for (int32 row = 0; ; loc.y += fMaxReplicantHeight + kIconGap, row++) { for (int32 row = 0; ; loc.y += fMaxReplicantHeight + kIconGap, row++) {
// determine free space in this row // determine free space in this row
@@ -1231,12 +1234,8 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth)
// check next row // check next row
} }
// move clock into place vertically centered in first row
fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding,
floorf((fMaxReplicantHeight - fTime->fHeight) / 2) + 1);
} else { } else {
// horizontal or mini-mode // horizontal
if (index > 0) { if (index > 0) {
// get the last replicant added for placement reference // get the last replicant added for placement reference
BView* view = NULL; BView* view = NULL;
@@ -1246,10 +1245,6 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth)
loc.x = view->Frame().right + kIconGap + 1; loc.x = view->Frame().right + kIconGap + 1;
} }
} }
// move clock into place vertically centered next to replicants
fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding,
loc.y + floorf((fMaxReplicantHeight - fTime->fHeight) / 2));
} }
if (loc.y > fRightBottomReplicant.top if (loc.y > fRightBottomReplicant.top
@@ -1395,9 +1390,7 @@ TDragRegion::GetPreferredSize(float* width, float* height)
else else
*width += 6; *width += 6;
bool vertical = fBarView->Vertical(); if (fBarView->Vertical() && !fBarView->MiniState())
bool expandoOrFull = fBarView->ExpandoState() || fBarView->FullState();
if (vertical && expandoOrFull)
*height += 3; // add a pixel for an extra border on top *height += 3; // add a pixel for an extra border on top
else else
*height += 2; // all other modes have a 1px border on top and bottom *height += 2; // all other modes have a 1px border on top and bottom
@@ -1415,17 +1408,15 @@ TDragRegion::Draw(BRect updateRect)
BRect frame(Bounds()); BRect frame(Bounds());
BeginLineArray(4); BeginLineArray(4);
if (fBarView->Vertical() if (fBarView->Vertical()) {
&& (fBarView->ExpandoState() || fBarView->FullState())) { // vertical expando full or mini state, draw 2 lines at the top
// vertical expando or full state, draw 2 lines at the top
AddLine(frame.LeftTop(), frame.RightTop(), dark); AddLine(frame.LeftTop(), frame.RightTop(), dark);
AddLine(BPoint(frame.left, frame.top + 1), AddLine(BPoint(frame.left, frame.top + 1),
BPoint(frame.right, frame.top + 1), ldark); BPoint(frame.right, frame.top + 1), ldark);
// add hilight along bottom // add hilight along bottom
AddLine(BPoint(frame.left + 1, frame.bottom), AddLine(BPoint(frame.left + 1, frame.bottom),
BPoint(frame.right - 1, frame.bottom), hilite); BPoint(frame.right - 1, frame.bottom), hilite);
} else if ((fBarView->Vertical() && fBarView->MiniState()) } else {
|| fBarView->AcrossTop() || fBarView->AcrossBottom()) {
// mini-mode or horizontal, draw hilight along top left and bottom // mini-mode or horizontal, draw hilight along top left and bottom
AddLine(frame.LeftTop(), frame.RightTop(), hilite); AddLine(frame.LeftTop(), frame.RightTop(), hilite);
AddLine(BPoint(frame.left, frame.top + 1), frame.LeftBottom(), hilite); AddLine(BPoint(frame.left, frame.top + 1), frame.LeftBottom(), hilite);
@@ -1501,10 +1492,8 @@ TDragRegion::DragRegion() const
bool placeOnLeft = false; bool placeOnLeft = false;
if (fDragLocation == kAutoPlaceDragRegion) { if (fDragLocation == kAutoPlaceDragRegion) {
if (fBarView->Vertical() && fBarView->Left()) placeOnLeft = fBarView->Left()
placeOnLeft = true; && (fBarView->Vertical() || fBarView->MiniState());
else
placeOnLeft = false;
} else } else
placeOnLeft = fDragLocation == kDragRegionLeft; placeOnLeft = fDragLocation == kDragRegionLeft;
@@ -1591,38 +1580,57 @@ TDragRegion::CalculateRegions()
float halfScreen = floorf(screenFrame.Height() / 2); float halfScreen = floorf(screenFrame.Height() / 2);
// corners // corners
fTopLeft.Set(BRect(screenFrame.left, screenFrame.top, fTopLeftVertical.Set(BRect(screenFrame.left,
screenFrame.top + menuBarHeight, screenFrame.left + hDivider,
screenFrame.top + floorf(menuBarHeight * kVerticalMiniMultiplier)));
fTopRightVertical.Set(BRect(screenFrame.right - hDivider,
screenFrame.top + menuBarHeight, screenFrame.right,
screenFrame.top + floorf(menuBarHeight * kVerticalMiniMultiplier)));
fBottomLeftVertical.Set(BRect(screenFrame.left,
screenFrame.bottom - floorf(menuBarHeight * kVerticalMiniMultiplier),
screenFrame.left + hDivider, screenFrame.bottom - menuBarHeight));
fBottomRightVertical.Set(BRect(screenFrame.right - hDivider,
screenFrame.bottom - floorf(menuBarHeight * kVerticalMiniMultiplier),
screenFrame.right, screenFrame.bottom - menuBarHeight));
fTopLeftHorizontal.Set(BRect(screenFrame.left, screenFrame.top,
screenFrame.left + hDivider, screenFrame.top + menuBarHeight)); screenFrame.left + hDivider, screenFrame.top + menuBarHeight));
fTopRight.Set(BRect(screenFrame.right - hDivider, screenFrame.top, fTopRightHorizontal.Set(BRect(screenFrame.right - hDivider, screenFrame.top,
screenFrame.right, screenFrame.top + menuBarHeight)); screenFrame.right, screenFrame.top + menuBarHeight));
fBottomLeft.Set(BRect(screenFrame.left, screenFrame.bottom - menuBarHeight, fBottomLeftHorizontal.Set(BRect(screenFrame.left, screenFrame.bottom - menuBarHeight,
screenFrame.left + hDivider, screenFrame.bottom)); screenFrame.left + hDivider, screenFrame.bottom));
fBottomRight.Set(BRect(screenFrame.right - hDivider, fBottomRightHorizontal.Set(BRect(screenFrame.right - hDivider,
screenFrame.bottom - menuBarHeight, screenFrame.right, screenFrame.bottom - menuBarHeight, screenFrame.right,
screenFrame.bottom)); screenFrame.bottom));
// left/right expando // left/right expando
fMiddleLeft.Set(BRect(screenFrame.left, screenFrame.top, fMiddleLeft.Set(BRect(screenFrame.left, screenFrame.top,
screenFrame.left + hDivider, screenFrame.bottom)); screenFrame.left + hDivider, screenFrame.bottom));
fMiddleLeft.Exclude(&fTopLeft); fMiddleLeft.Exclude(&fTopLeftHorizontal);
fMiddleLeft.Exclude(&fBottomLeft); fMiddleLeft.Exclude(&fBottomLeftHorizontal);
fMiddleLeft.Exclude(&fTopLeftVertical);
fMiddleLeft.Exclude(&fBottomLeftVertical);
fMiddleRight.Set(BRect(screenFrame.right - hDivider, fMiddleRight.Set(BRect(screenFrame.right - hDivider,
screenFrame.top, screenFrame.right, screenFrame.bottom)); screenFrame.top, screenFrame.right, screenFrame.bottom));
fMiddleRight.Exclude(&fTopRight); fMiddleRight.Exclude(&fTopRightHorizontal);
fMiddleRight.Exclude(&fBottomRight); fMiddleRight.Exclude(&fBottomRightHorizontal);
fMiddleRight.Exclude(&fTopRightVertical);
fMiddleRight.Exclude(&fBottomRightVertical);
#ifdef FULL_MODE #ifdef FULL_MODE
// left/right full // left/right full
fLeftSide.Set(BRect(screenFrame.left, screenFrame.bottom - halfScreen, fLeftSide.Set(BRect(screenFrame.left, screenFrame.bottom - halfScreen,
screenFrame.left + hDivider, screenFrame.bottom)); screenFrame.left + hDivider, screenFrame.bottom));
fLeftSide.Exclude(&fBottomLeft); fLeftSide.Exclude(&fBottomLeftHorizontal);
fLeftSide.Exclude(&fBottomLeftVertical);
fMiddleLeft.Exclude(&fLeftSide); fMiddleLeft.Exclude(&fLeftSide);
fRightSide.Set(BRect(screenFrame.right - hDivider, fRightSide.Set(BRect(screenFrame.right - hDivider,
screenFrame.bottom - halfScreen, screenFrame.right, screenFrame.bottom - halfScreen, screenFrame.right,
screenFrame.bottom)); screenFrame.bottom));
fRightSide.Exclude(&fBottomRight); fRightSide.Exclude(&fBottomRightHorizontal);
fRightSide.Exclude(&fBottomRightVertical);
fMiddleRight.Exclude(&fRightSide); fMiddleRight.Exclude(&fRightSide);
#endif #endif
@@ -1663,15 +1671,24 @@ TDragRegion::MouseMoved(BPoint where, uint32 transit,
} }
// use short circuit evaluation for convenience // use short circuit evaluation for convenience
if (// mini if (// vertical mini
SwitchModeForRegion(whereScreen, fTopLeft, true, true, true, SwitchModeForRegion(whereScreen, fTopLeftVertical, true,
kMiniState) true, true, kMiniState)
|| SwitchModeForRegion(whereScreen, fTopRight, true, false, true, || SwitchModeForRegion(whereScreen, fTopRightVertical, true,
kMiniState) false, true, kMiniState)
|| SwitchModeForRegion(whereScreen, fBottomLeft, true, true, false, || SwitchModeForRegion(whereScreen, fBottomLeftVertical, true,
kMiniState) true, false, kMiniState)
|| SwitchModeForRegion(whereScreen, fBottomRight, true, false, false, || SwitchModeForRegion(whereScreen, fBottomRightVertical, true,
kMiniState) false, false, kMiniState)
// horizontal mini
|| SwitchModeForRegion(whereScreen, fTopLeftHorizontal, false,
true, true, kMiniState)
|| SwitchModeForRegion(whereScreen, fTopRightHorizontal, false,
false, true, kMiniState)
|| SwitchModeForRegion(whereScreen, fBottomLeftHorizontal, false,
true, false, kMiniState)
|| SwitchModeForRegion(whereScreen, fBottomRightHorizontal, false,
false, false, kMiniState)
// expando // expando
|| SwitchModeForRegion(whereScreen, fMiddleLeft, true, true, true, || SwitchModeForRegion(whereScreen, fMiddleLeft, true, true, true,
kExpandoState) kExpandoState)
@@ -1823,34 +1840,34 @@ void
TResizeControl::MouseMoved(BPoint where, uint32 code, TResizeControl::MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage) const BMessage* dragMessage)
{ {
if (IsResizing() && fBarView->Vertical() if (!fBarView->Vertical() || !IsResizing())
&& (fBarView->ExpandoState() || fBarView->FullState())) { return BControl::MouseMoved(where, code, dragMessage);
float windowWidth = Window()->Frame().Width();
float delta = 0;
BPoint whereScreen = ConvertToScreen(where);
if (fBarView->Left()) { float windowWidth = Window()->Frame().Width();
delta = whereScreen.x - Window()->Frame().right; float delta = 0;
if (delta > 0 && windowWidth >= gMaximumWindowWidth) BPoint whereScreen = ConvertToScreen(where);
; // do nothing
else if (delta < 0 && windowWidth <= gMinimumWindowWidth) if (fBarView->Left()) {
; // do nothing delta = whereScreen.x - Window()->Frame().right;
else if (delta > 0 && windowWidth >= gMaximumWindowWidth)
Window()->ResizeBy(delta, 0); ; // do nothing
} else { else if (delta < 0 && windowWidth <= gMinimumWindowWidth)
delta = Window()->Frame().left - whereScreen.x; ; // do nothing
if (delta > 0 && windowWidth >= gMaximumWindowWidth) else
; // do nothing Window()->ResizeBy(delta, 0);
else if (delta < 0 && windowWidth <= gMinimumWindowWidth) } else {
; // do nothing delta = Window()->Frame().left - whereScreen.x;
else { if (delta > 0 && windowWidth >= gMaximumWindowWidth)
Window()->MoveBy(delta, 0); ; // do nothing
Window()->ResizeBy(delta, 0); else if (delta < 0 && windowWidth <= gMinimumWindowWidth)
} ; // do nothing
else {
Window()->MoveBy(delta, 0);
Window()->ResizeBy(delta, 0);
} }
windowWidth = Window()->Frame().Width();
} }
windowWidth = Window()->Frame().Width();
BControl::MouseMoved(where, code, dragMessage); BControl::MouseMoved(where, code, dragMessage);
} }
+10 -4
View File
@@ -231,10 +231,16 @@ private:
BPoint fPreviousPosition; BPoint fPreviousPosition;
int32 fDragLocation; int32 fDragLocation;
BRegion fTopLeft; BRegion fTopLeftVertical;
BRegion fTopRight; BRegion fTopRightVertical;
BRegion fBottomLeft; BRegion fBottomLeftVertical;
BRegion fBottomRight; BRegion fBottomRightVertical;
BRegion fTopLeftHorizontal;
BRegion fTopRightHorizontal;
BRegion fBottomLeftHorizontal;
BRegion fBottomRightHorizontal;
BRegion fMiddleLeft; BRegion fMiddleLeft;
BRegion fMiddleRight; BRegion fMiddleRight;
#ifdef FULL_MODE #ifdef FULL_MODE
+1 -2
View File
@@ -532,6 +532,5 @@ TTimeView::Vertical()
if (fBarView == NULL) if (fBarView == NULL)
return true; return true;
return fBarView->Vertical() return fBarView->Vertical();
&& (fBarView->ExpandoState() || fBarView->FullState());
} }