Move constraint solving to the rest of the constraint stuff. Only adjust windows if specifications are feasible.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38285 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -713,16 +713,8 @@ SATGroup::FindVerticalTab(float position)
|
||||
|
||||
|
||||
void
|
||||
SATGroup::SolveSATAndAdjustWindows(SATWindow* triggerWindow)
|
||||
SATGroup::AdjustWindows(SATWindow* triggerWindow)
|
||||
{
|
||||
// solve Stack & Tile specification
|
||||
ResultType result;
|
||||
for (int32 tries = 0; tries < 15; tries++) {
|
||||
result = fLinearSpec.Solve();
|
||||
if (result == OPTIMAL || result == INFEASIBLE)
|
||||
break;
|
||||
}
|
||||
|
||||
// set window locations and sizes
|
||||
for (int i = 0; i < fSATWindowList.CountItems(); i++) {
|
||||
SATWindow* windowSAT = fSATWindowList.ItemAt(i);
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
|
||||
LinearSpec* GetLinearSpec() { return &fLinearSpec; }
|
||||
|
||||
void SolveSATAndAdjustWindows(SATWindow* triggerWindow);
|
||||
void AdjustWindows(SATWindow* triggerWindow);
|
||||
|
||||
/*! Create a new WindowArea from the crossing and add the window. */
|
||||
bool AddWindow(SATWindow* window, Tab* left, Tab* top,
|
||||
|
||||
@@ -405,7 +405,6 @@ GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
|
||||
leftConstraint->SetRightSide(frame.left);
|
||||
topConstraint->SetRightSide(frame.top);
|
||||
|
||||
|
||||
widthConstraint->SetPenaltyNeg(110);
|
||||
widthConstraint->SetPenaltyPos(110);
|
||||
heightConstraint->SetPenaltyNeg(110);
|
||||
@@ -417,7 +416,16 @@ GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
|
||||
topConstraint->SetPenaltyPos(100);
|
||||
|
||||
// After we set the new parameter solve and apply the new layout.
|
||||
fSATGroup->SolveSATAndAdjustWindows(triggerWindow);
|
||||
ResultType result;
|
||||
for (int32 tries = 0; tries < 15; tries++) {
|
||||
result = fSATGroup->GetLinearSpec()->Solve();
|
||||
if (result == INFEASIBLE)
|
||||
break;
|
||||
if (result == OPTIMAL) {
|
||||
fSATGroup->AdjustWindows(triggerWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set penalties back to normal
|
||||
widthConstraint->SetPenaltyNeg(10);
|
||||
|
||||
Reference in New Issue
Block a user