Removed unused min, max, pref variables.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38774 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-21 23:51:41 +00:00
parent f5dc380d11
commit 3a3c1d8222
3 changed files with 25 additions and 41 deletions
+1 -9
View File
@@ -109,11 +109,6 @@ private:
void _UpdateMaxSizeConstraint(BSize max);
void _UpdatePreferredConstraint(BSize preferred);
public:
static BSize kMaxSize;
static BSize kMinSize;
static BSize kUndefinedSize;
protected:
BList* fConstraints;
@@ -129,13 +124,10 @@ private:
YTab* fBottom;
Row* fRow;
Column* fColumn;
BSize fMinContentSize;
BSize fMaxContentSize;
Constraint* fMinContentWidth;
Constraint* fMaxContentWidth;
Constraint* fMinContentHeight;
Constraint* fMaxContentHeight;
BSize fPreferredContentSize;
BSize fShrinkPenalties;
BSize fGrowPenalties;
double fContentAspectRatio;
@@ -155,7 +147,7 @@ private:
Constraint* fBottomConstraint;
public:
friend class BALMLayout;
//friend class BALMLayout;
};
+16 -11
View File
@@ -18,6 +18,11 @@
#include "YTab.h"
const BSize kUnsetSize(B_SIZE_UNSET, B_SIZE_UNSET);
const BSize kMinSize(0, 0);
const BSize kMaxSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED);
/**
* Constructor.
* Creates new layout engine.
@@ -40,9 +45,9 @@ BALMLayout::BALMLayout()
// cached layout values
// need to be invalidated whenever the layout specification is changed
fMinSize = Area::kUndefinedSize;
fMaxSize = Area::kUndefinedSize;
fPreferredSize = Area::kUndefinedSize;
fMinSize = kUnsetSize;
fMaxSize = kUnsetSize;
fPreferredSize = kUnsetSize;
fPerformancePath = NULL;
}
@@ -366,7 +371,7 @@ BALMLayout::SetLayoutStyle(LayoutStyleType style)
*/
BSize
BALMLayout::BaseMinSize() {
if (fMinSize == Area::kUndefinedSize)
if (fMinSize == kUnsetSize)
fMinSize = CalculateMinSize();
return fMinSize;
}
@@ -378,7 +383,7 @@ BALMLayout::BaseMinSize() {
BSize
BALMLayout::BaseMaxSize()
{
if (fMaxSize == Area::kUndefinedSize)
if (fMaxSize == kUnsetSize)
fMaxSize = CalculateMaxSize();
return fMaxSize;
}
@@ -390,7 +395,7 @@ BALMLayout::BaseMaxSize()
BSize
BALMLayout::BasePreferredSize()
{
if (fPreferredSize == Area::kUndefinedSize)
if (fPreferredSize == kUnsetSize)
fPreferredSize = CalculatePreferredSize();
return fPreferredSize;
}
@@ -417,9 +422,9 @@ void
BALMLayout::InvalidateLayout(bool children)
{
BLayout::InvalidateLayout(children);
fMinSize = Area::kUndefinedSize;
fMaxSize = Area::kUndefinedSize;
fPreferredSize = Area::kUndefinedSize;
fMinSize = kUnsetSize;
fMaxSize = kUnsetSize;
fPreferredSize = kUnsetSize;
}
@@ -554,7 +559,7 @@ BALMLayout::CalculateMinSize()
delete newObjFunction;
if (fSolver.Result() == UNBOUNDED)
return Area::kMinSize;
return kMinSize;
if (fSolver.Result() != OPTIMAL) {
fSolver.Save("failed-layout.txt");
printf("Could not solve the layout specification (%d). "
@@ -587,7 +592,7 @@ BALMLayout::CalculateMaxSize()
delete newObjFunction;
if (fSolver.Result() == UNBOUNDED)
return Area::kMaxSize;
return kMaxSize;
if (fSolver.Result() != OPTIMAL) {
fSolver.Save("failed-layout.txt");
printf("Could not solve the layout specification (%d). "
+8 -21
View File
@@ -25,10 +25,6 @@
using namespace std;
BSize Area::kMaxSize(INT_MAX, INT_MAX);
BSize Area::kMinSize(0, 0);
BSize Area::kUndefinedSize(-1, -1);
BView*
Area::View()
@@ -631,12 +627,10 @@ Area::Init(LinearSpec* ls, XTab* left, YTab* top,
XTab* right, YTab* bottom, BView* content, BSize minContentSize)
{
fConstraints = new BList(2);
fMaxContentSize = kMaxSize;
fMaxContentWidth = NULL;
fMaxContentHeight = NULL;
fPreferredContentSize = kUndefinedSize;
fShrinkPenalties = BSize(2, 2);
fGrowPenalties = BSize(1, 1);
fContentAspectRatio = 0;
@@ -665,7 +659,6 @@ Area::Init(LinearSpec* ls, XTab* left, YTab* top,
fRight = right;
fTop = top;
fBottom = bottom;
fMinContentSize = minContentSize;
// adds the two essential constraints of the area that make sure that the left x-tab is
// really to the left of the right x-tab, and the top y-tab really above the bottom y-tab
@@ -747,8 +740,6 @@ Area::_InitChildArea()
// change them so that they refer to the tabs of the childArea
// and copy the minimum content size settings to the childArea
if (fMaxContentWidth != NULL) {
fChildArea->fMaxContentSize = fMaxContentSize;
fChildArea->fMaxContentWidth = fMaxContentWidth;
fMaxContentWidth->SetLeftSide(
-1.0, fChildArea->Left(), 1.0, fChildArea->Right());
@@ -762,7 +753,6 @@ Area::_InitChildArea()
// change them so that they refer to the tabs of the childArea
// and copy the preferred content size settings to the childArea
if (fPreferredContentHeight != NULL) {
fChildArea->fPreferredContentSize = fPreferredContentSize;
fChildArea->fShrinkPenalties = fShrinkPenalties;
fChildArea->fGrowPenalties = fGrowPenalties;
@@ -891,9 +881,8 @@ void
Area::_UpdateMinSizeConstraint(BSize min)
{
if (fChildArea == NULL) {
fMinContentSize = min;
fMinContentWidth->SetRightSide(fMinContentSize.Width());
fMinContentHeight->SetRightSide(fMinContentSize.Height());
fMinContentWidth->SetRightSide(min.Width());
fMinContentHeight->SetRightSide(min.Height());
} else
fChildArea->_UpdateMinSizeConstraint(min);
}
@@ -903,18 +892,17 @@ void
Area::_UpdateMaxSizeConstraint(BSize max)
{
if (fChildArea == NULL) {
fMaxContentSize = max;
if (fMaxContentWidth == NULL) {
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight,
OperatorType(LE), fMaxContentSize.Width());
OperatorType(LE), max.Width());
fConstraints->AddItem(fMaxContentWidth);
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
OperatorType(LE), fMaxContentSize.Height());
OperatorType(LE), max.Height());
fConstraints->AddItem(fMaxContentHeight);
} else {
fMaxContentWidth->SetRightSide(fMaxContentSize.Width());
fMaxContentHeight->SetRightSide(fMaxContentSize.Height());
fMaxContentWidth->SetRightSide(max.Width());
fMaxContentHeight->SetRightSide(max.Height());
}
} else
fChildArea->_UpdateMaxSizeConstraint(max);
@@ -931,17 +919,16 @@ void
Area::_UpdatePreferredConstraint(BSize preferred)
{
if (fChildArea == NULL) {
fPreferredContentSize = preferred;
if (fPreferredContentWidth == NULL) {
fPreferredContentWidth = fLS->AddConstraint(
-1.0, fLeft, 1.0, fRight, OperatorType(EQ),
fPreferredContentSize.Width(), fShrinkPenalties.Width(),
preferred.Width(), fShrinkPenalties.Width(),
fGrowPenalties.Width());
fConstraints->AddItem(fPreferredContentWidth);
fPreferredContentHeight = fLS->AddConstraint(
-1.0, fTop, 1.0, fBottom, OperatorType(EQ),
fPreferredContentSize.Height(), fShrinkPenalties.Height(),
preferred.Height(), fShrinkPenalties.Height(),
fGrowPenalties.Height());
fConstraints->AddItem(fPreferredContentHeight);
} else {