Clean up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38515 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -51,6 +51,9 @@ GroupCookie::~GroupCookie()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const uint32 kExtentPenalty = 10;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
|
GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
|
||||||
{
|
{
|
||||||
@@ -89,12 +92,13 @@ GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_UpdateWindowSize(frame);
|
||||||
|
|
||||||
// set penalties back to normal
|
// set penalties back to normal
|
||||||
fWidthConstraint->SetPenaltyNeg(10);
|
fWidthConstraint->SetPenaltyNeg(kExtentPenalty);
|
||||||
fWidthConstraint->SetPenaltyPos(10);
|
fWidthConstraint->SetPenaltyPos(kExtentPenalty);
|
||||||
fHeightConstraint->SetPenaltyNeg(10);
|
fHeightConstraint->SetPenaltyNeg(kExtentPenalty);
|
||||||
fHeightConstraint->SetPenaltyPos(10);
|
fHeightConstraint->SetPenaltyPos(kExtentPenalty);
|
||||||
|
|
||||||
fLeftConstraint->SetPenaltyNeg(1);
|
fLeftConstraint->SetPenaltyNeg(1);
|
||||||
fLeftConstraint->SetPenaltyPos(1);
|
fLeftConstraint->SetPenaltyPos(1);
|
||||||
@@ -118,17 +122,8 @@ GroupCookie::MoveWindow(int32 workspace)
|
|||||||
fTopBorder->Value() - frame.top);
|
fTopBorder->Value() - frame.top);
|
||||||
desktop->ResizeWindowBy(window, fRightBorder->Value() - frame.right,
|
desktop->ResizeWindowBy(window, fRightBorder->Value() - frame.right,
|
||||||
fBottomBorder->Value() - frame.bottom);
|
fBottomBorder->Value() - frame.bottom);
|
||||||
}
|
|
||||||
|
|
||||||
|
_UpdateWindowSize(frame);
|
||||||
void
|
|
||||||
GroupCookie::UpdateWindowSize()
|
|
||||||
{
|
|
||||||
BRect frame = fSATWindow->CompleteWindowFrame();
|
|
||||||
|
|
||||||
// adjust window size soft constraints
|
|
||||||
fWidthConstraint->SetRightSide(frame.Width());
|
|
||||||
fHeightConstraint->SetRightSide(frame.Height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -167,15 +162,17 @@ GroupCookie::Init(SATGroup* group, WindowArea* area)
|
|||||||
fRightBorder, OperatorType(LE), -minWidth);
|
fRightBorder, OperatorType(LE), -minWidth);
|
||||||
fMinHeightConstraint = linearSpec->AddConstraint(1.0, fTopBorder, -1.0,
|
fMinHeightConstraint = linearSpec->AddConstraint(1.0, fTopBorder, -1.0,
|
||||||
fBottomBorder, OperatorType(LE), -minHeight);
|
fBottomBorder, OperatorType(LE), -minHeight);
|
||||||
|
|
||||||
// The width and height constraints have higher penalties than the
|
// The width and height constraints have higher penalties than the
|
||||||
// position constraints (left, top), so a window will keep its size
|
// position constraints (left, top), so a window will keep its size
|
||||||
// unless explicitly resized.
|
// unless explicitly resized.
|
||||||
fWidthConstraint = linearSpec->AddConstraint(-1.0, fLeftBorder, 1.0,
|
fWidthConstraint = linearSpec->AddConstraint(-1.0, fLeftBorder, 1.0,
|
||||||
fRightBorder, OperatorType(EQ), frame.Width(), 10, 10);
|
fRightBorder, OperatorType(EQ), frame.Width(), kExtentPenalty,
|
||||||
|
kExtentPenalty);
|
||||||
fHeightConstraint = linearSpec->AddConstraint(-1.0, fTopBorder, 1.0,
|
fHeightConstraint = linearSpec->AddConstraint(-1.0, fTopBorder, 1.0,
|
||||||
fBottomBorder, OperatorType(EQ), frame.Height(), 10, 10);
|
fBottomBorder, OperatorType(EQ), frame.Height(), kExtentPenalty,
|
||||||
|
kExtentPenalty);
|
||||||
|
|
||||||
if (!fLeftConstraint || !fTopConstraint || !fMinWidthConstraint
|
if (!fLeftConstraint || !fTopConstraint || !fMinWidthConstraint
|
||||||
|| !fMinHeightConstraint || !fWidthConstraint || !fHeightConstraint) {
|
|| !fMinHeightConstraint || !fWidthConstraint || !fHeightConstraint) {
|
||||||
// clean up
|
// clean up
|
||||||
@@ -256,6 +253,15 @@ GroupCookie::PropagateToGroup(SATGroup* group, WindowArea* area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
GroupCookie::_UpdateWindowSize(const BRect& frame)
|
||||||
|
{
|
||||||
|
// adjust window size soft constraints
|
||||||
|
fWidthConstraint->SetRightSide(frame.Width());
|
||||||
|
fHeightConstraint->SetRightSide(frame.Height());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SATWindow::SATWindow(StackAndTile* sat, Window* window)
|
SATWindow::SATWindow(StackAndTile* sat, Window* window)
|
||||||
:
|
:
|
||||||
fWindow(window),
|
fWindow(window),
|
||||||
@@ -327,29 +333,6 @@ SATWindow::PropagateToGroup(SATGroup* group, WindowArea* area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
SATWindow::UpdateGroupWindowsSize()
|
|
||||||
{
|
|
||||||
SATGroup* group = GetGroup();
|
|
||||||
if (!group)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < group->CountItems(); i++) {
|
|
||||||
SATWindow* window = group->WindowAt(i);
|
|
||||||
if (window == this)
|
|
||||||
continue;
|
|
||||||
window->UpdateWindowSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
SATWindow::UpdateWindowSize()
|
|
||||||
{
|
|
||||||
fGroupCookie->UpdateWindowSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SATWindow::MoveWindowToSAT(int32 workspace)
|
SATWindow::MoveWindowToSAT(int32 workspace)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public:
|
|||||||
|
|
||||||
void DoGroupLayout(SATWindow* triggerWindow);
|
void DoGroupLayout(SATWindow* triggerWindow);
|
||||||
void MoveWindow(int32 workspace);
|
void MoveWindow(int32 workspace);
|
||||||
void UpdateWindowSize();
|
|
||||||
|
|
||||||
SATGroup* GetGroup() { return fSATGroup.Get(); }
|
SATGroup* GetGroup() { return fSATGroup.Get(); }
|
||||||
|
|
||||||
@@ -41,6 +40,8 @@ public:
|
|||||||
bool PropagateToGroup(SATGroup* group, WindowArea* area);
|
bool PropagateToGroup(SATGroup* group, WindowArea* area);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _UpdateWindowSize(const BRect& frame);
|
||||||
|
|
||||||
SATWindow* fSATWindow;
|
SATWindow* fSATWindow;
|
||||||
|
|
||||||
BReference<SATGroup> fSATGroup;
|
BReference<SATGroup> fSATGroup;
|
||||||
@@ -85,9 +86,6 @@ public:
|
|||||||
|
|
||||||
bool PropagateToGroup(SATGroup* group, WindowArea* area);
|
bool PropagateToGroup(SATGroup* group, WindowArea* area);
|
||||||
|
|
||||||
void UpdateGroupWindowsSize();
|
|
||||||
void UpdateWindowSize();
|
|
||||||
|
|
||||||
//! Move the window to the tab's position.
|
//! Move the window to the tab's position.
|
||||||
void MoveWindowToSAT(int32 workspace);
|
void MoveWindowToSAT(int32 workspace);
|
||||||
|
|
||||||
|
|||||||
@@ -182,9 +182,6 @@ StackAndTile::WindowResized(Window* window)
|
|||||||
satWindow->FindSnappingCandidates();
|
satWindow->FindSnappingCandidates();
|
||||||
else {
|
else {
|
||||||
satWindow->DoGroupLayout();
|
satWindow->DoGroupLayout();
|
||||||
// after solve the layout update the size constraints of all windows in
|
|
||||||
// the group
|
|
||||||
satWindow->UpdateGroupWindowsSize();
|
|
||||||
|
|
||||||
// Do a window layout for all windows. TODO: mybe do it a bit more
|
// Do a window layout for all windows. TODO: mybe do it a bit more
|
||||||
// efficient
|
// efficient
|
||||||
|
|||||||
Reference in New Issue
Block a user