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:
@@ -109,11 +109,6 @@ private:
|
|||||||
void _UpdateMaxSizeConstraint(BSize max);
|
void _UpdateMaxSizeConstraint(BSize max);
|
||||||
void _UpdatePreferredConstraint(BSize preferred);
|
void _UpdatePreferredConstraint(BSize preferred);
|
||||||
|
|
||||||
public:
|
|
||||||
static BSize kMaxSize;
|
|
||||||
static BSize kMinSize;
|
|
||||||
static BSize kUndefinedSize;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BList* fConstraints;
|
BList* fConstraints;
|
||||||
|
|
||||||
@@ -129,13 +124,10 @@ private:
|
|||||||
YTab* fBottom;
|
YTab* fBottom;
|
||||||
Row* fRow;
|
Row* fRow;
|
||||||
Column* fColumn;
|
Column* fColumn;
|
||||||
BSize fMinContentSize;
|
|
||||||
BSize fMaxContentSize;
|
|
||||||
Constraint* fMinContentWidth;
|
Constraint* fMinContentWidth;
|
||||||
Constraint* fMaxContentWidth;
|
Constraint* fMaxContentWidth;
|
||||||
Constraint* fMinContentHeight;
|
Constraint* fMinContentHeight;
|
||||||
Constraint* fMaxContentHeight;
|
Constraint* fMaxContentHeight;
|
||||||
BSize fPreferredContentSize;
|
|
||||||
BSize fShrinkPenalties;
|
BSize fShrinkPenalties;
|
||||||
BSize fGrowPenalties;
|
BSize fGrowPenalties;
|
||||||
double fContentAspectRatio;
|
double fContentAspectRatio;
|
||||||
@@ -155,7 +147,7 @@ private:
|
|||||||
Constraint* fBottomConstraint;
|
Constraint* fBottomConstraint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
friend class BALMLayout;
|
//friend class BALMLayout;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+16
-11
@@ -18,6 +18,11 @@
|
|||||||
#include "YTab.h"
|
#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.
|
* Constructor.
|
||||||
* Creates new layout engine.
|
* Creates new layout engine.
|
||||||
@@ -40,9 +45,9 @@ BALMLayout::BALMLayout()
|
|||||||
|
|
||||||
// cached layout values
|
// cached layout values
|
||||||
// need to be invalidated whenever the layout specification is changed
|
// need to be invalidated whenever the layout specification is changed
|
||||||
fMinSize = Area::kUndefinedSize;
|
fMinSize = kUnsetSize;
|
||||||
fMaxSize = Area::kUndefinedSize;
|
fMaxSize = kUnsetSize;
|
||||||
fPreferredSize = Area::kUndefinedSize;
|
fPreferredSize = kUnsetSize;
|
||||||
|
|
||||||
fPerformancePath = NULL;
|
fPerformancePath = NULL;
|
||||||
}
|
}
|
||||||
@@ -366,7 +371,7 @@ BALMLayout::SetLayoutStyle(LayoutStyleType style)
|
|||||||
*/
|
*/
|
||||||
BSize
|
BSize
|
||||||
BALMLayout::BaseMinSize() {
|
BALMLayout::BaseMinSize() {
|
||||||
if (fMinSize == Area::kUndefinedSize)
|
if (fMinSize == kUnsetSize)
|
||||||
fMinSize = CalculateMinSize();
|
fMinSize = CalculateMinSize();
|
||||||
return fMinSize;
|
return fMinSize;
|
||||||
}
|
}
|
||||||
@@ -378,7 +383,7 @@ BALMLayout::BaseMinSize() {
|
|||||||
BSize
|
BSize
|
||||||
BALMLayout::BaseMaxSize()
|
BALMLayout::BaseMaxSize()
|
||||||
{
|
{
|
||||||
if (fMaxSize == Area::kUndefinedSize)
|
if (fMaxSize == kUnsetSize)
|
||||||
fMaxSize = CalculateMaxSize();
|
fMaxSize = CalculateMaxSize();
|
||||||
return fMaxSize;
|
return fMaxSize;
|
||||||
}
|
}
|
||||||
@@ -390,7 +395,7 @@ BALMLayout::BaseMaxSize()
|
|||||||
BSize
|
BSize
|
||||||
BALMLayout::BasePreferredSize()
|
BALMLayout::BasePreferredSize()
|
||||||
{
|
{
|
||||||
if (fPreferredSize == Area::kUndefinedSize)
|
if (fPreferredSize == kUnsetSize)
|
||||||
fPreferredSize = CalculatePreferredSize();
|
fPreferredSize = CalculatePreferredSize();
|
||||||
return fPreferredSize;
|
return fPreferredSize;
|
||||||
}
|
}
|
||||||
@@ -417,9 +422,9 @@ void
|
|||||||
BALMLayout::InvalidateLayout(bool children)
|
BALMLayout::InvalidateLayout(bool children)
|
||||||
{
|
{
|
||||||
BLayout::InvalidateLayout(children);
|
BLayout::InvalidateLayout(children);
|
||||||
fMinSize = Area::kUndefinedSize;
|
fMinSize = kUnsetSize;
|
||||||
fMaxSize = Area::kUndefinedSize;
|
fMaxSize = kUnsetSize;
|
||||||
fPreferredSize = Area::kUndefinedSize;
|
fPreferredSize = kUnsetSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -554,7 +559,7 @@ BALMLayout::CalculateMinSize()
|
|||||||
delete newObjFunction;
|
delete newObjFunction;
|
||||||
|
|
||||||
if (fSolver.Result() == UNBOUNDED)
|
if (fSolver.Result() == UNBOUNDED)
|
||||||
return Area::kMinSize;
|
return kMinSize;
|
||||||
if (fSolver.Result() != OPTIMAL) {
|
if (fSolver.Result() != OPTIMAL) {
|
||||||
fSolver.Save("failed-layout.txt");
|
fSolver.Save("failed-layout.txt");
|
||||||
printf("Could not solve the layout specification (%d). "
|
printf("Could not solve the layout specification (%d). "
|
||||||
@@ -587,7 +592,7 @@ BALMLayout::CalculateMaxSize()
|
|||||||
delete newObjFunction;
|
delete newObjFunction;
|
||||||
|
|
||||||
if (fSolver.Result() == UNBOUNDED)
|
if (fSolver.Result() == UNBOUNDED)
|
||||||
return Area::kMaxSize;
|
return kMaxSize;
|
||||||
if (fSolver.Result() != OPTIMAL) {
|
if (fSolver.Result() != OPTIMAL) {
|
||||||
fSolver.Save("failed-layout.txt");
|
fSolver.Save("failed-layout.txt");
|
||||||
printf("Could not solve the layout specification (%d). "
|
printf("Could not solve the layout specification (%d). "
|
||||||
|
|||||||
+8
-21
@@ -25,10 +25,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
BSize Area::kMaxSize(INT_MAX, INT_MAX);
|
|
||||||
BSize Area::kMinSize(0, 0);
|
|
||||||
BSize Area::kUndefinedSize(-1, -1);
|
|
||||||
|
|
||||||
|
|
||||||
BView*
|
BView*
|
||||||
Area::View()
|
Area::View()
|
||||||
@@ -631,12 +627,10 @@ Area::Init(LinearSpec* ls, XTab* left, YTab* top,
|
|||||||
XTab* right, YTab* bottom, BView* content, BSize minContentSize)
|
XTab* right, YTab* bottom, BView* content, BSize minContentSize)
|
||||||
{
|
{
|
||||||
fConstraints = new BList(2);
|
fConstraints = new BList(2);
|
||||||
fMaxContentSize = kMaxSize;
|
|
||||||
|
|
||||||
fMaxContentWidth = NULL;
|
fMaxContentWidth = NULL;
|
||||||
fMaxContentHeight = NULL;
|
fMaxContentHeight = NULL;
|
||||||
|
|
||||||
fPreferredContentSize = kUndefinedSize;
|
|
||||||
fShrinkPenalties = BSize(2, 2);
|
fShrinkPenalties = BSize(2, 2);
|
||||||
fGrowPenalties = BSize(1, 1);
|
fGrowPenalties = BSize(1, 1);
|
||||||
fContentAspectRatio = 0;
|
fContentAspectRatio = 0;
|
||||||
@@ -665,7 +659,6 @@ Area::Init(LinearSpec* ls, XTab* left, YTab* top,
|
|||||||
fRight = right;
|
fRight = right;
|
||||||
fTop = top;
|
fTop = top;
|
||||||
fBottom = bottom;
|
fBottom = bottom;
|
||||||
fMinContentSize = minContentSize;
|
|
||||||
|
|
||||||
// adds the two essential constraints of the area that make sure that the left x-tab is
|
// 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
|
// 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
|
// change them so that they refer to the tabs of the childArea
|
||||||
// and copy the minimum content size settings to the childArea
|
// and copy the minimum content size settings to the childArea
|
||||||
if (fMaxContentWidth != NULL) {
|
if (fMaxContentWidth != NULL) {
|
||||||
fChildArea->fMaxContentSize = fMaxContentSize;
|
|
||||||
|
|
||||||
fChildArea->fMaxContentWidth = fMaxContentWidth;
|
fChildArea->fMaxContentWidth = fMaxContentWidth;
|
||||||
fMaxContentWidth->SetLeftSide(
|
fMaxContentWidth->SetLeftSide(
|
||||||
-1.0, fChildArea->Left(), 1.0, fChildArea->Right());
|
-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
|
// change them so that they refer to the tabs of the childArea
|
||||||
// and copy the preferred content size settings to the childArea
|
// and copy the preferred content size settings to the childArea
|
||||||
if (fPreferredContentHeight != NULL) {
|
if (fPreferredContentHeight != NULL) {
|
||||||
fChildArea->fPreferredContentSize = fPreferredContentSize;
|
|
||||||
fChildArea->fShrinkPenalties = fShrinkPenalties;
|
fChildArea->fShrinkPenalties = fShrinkPenalties;
|
||||||
fChildArea->fGrowPenalties = fGrowPenalties;
|
fChildArea->fGrowPenalties = fGrowPenalties;
|
||||||
|
|
||||||
@@ -891,9 +881,8 @@ void
|
|||||||
Area::_UpdateMinSizeConstraint(BSize min)
|
Area::_UpdateMinSizeConstraint(BSize min)
|
||||||
{
|
{
|
||||||
if (fChildArea == NULL) {
|
if (fChildArea == NULL) {
|
||||||
fMinContentSize = min;
|
fMinContentWidth->SetRightSide(min.Width());
|
||||||
fMinContentWidth->SetRightSide(fMinContentSize.Width());
|
fMinContentHeight->SetRightSide(min.Height());
|
||||||
fMinContentHeight->SetRightSide(fMinContentSize.Height());
|
|
||||||
} else
|
} else
|
||||||
fChildArea->_UpdateMinSizeConstraint(min);
|
fChildArea->_UpdateMinSizeConstraint(min);
|
||||||
}
|
}
|
||||||
@@ -903,18 +892,17 @@ void
|
|||||||
Area::_UpdateMaxSizeConstraint(BSize max)
|
Area::_UpdateMaxSizeConstraint(BSize max)
|
||||||
{
|
{
|
||||||
if (fChildArea == NULL) {
|
if (fChildArea == NULL) {
|
||||||
fMaxContentSize = max;
|
|
||||||
if (fMaxContentWidth == NULL) {
|
if (fMaxContentWidth == NULL) {
|
||||||
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight,
|
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight,
|
||||||
OperatorType(LE), fMaxContentSize.Width());
|
OperatorType(LE), max.Width());
|
||||||
fConstraints->AddItem(fMaxContentWidth);
|
fConstraints->AddItem(fMaxContentWidth);
|
||||||
|
|
||||||
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
||||||
OperatorType(LE), fMaxContentSize.Height());
|
OperatorType(LE), max.Height());
|
||||||
fConstraints->AddItem(fMaxContentHeight);
|
fConstraints->AddItem(fMaxContentHeight);
|
||||||
} else {
|
} else {
|
||||||
fMaxContentWidth->SetRightSide(fMaxContentSize.Width());
|
fMaxContentWidth->SetRightSide(max.Width());
|
||||||
fMaxContentHeight->SetRightSide(fMaxContentSize.Height());
|
fMaxContentHeight->SetRightSide(max.Height());
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fChildArea->_UpdateMaxSizeConstraint(max);
|
fChildArea->_UpdateMaxSizeConstraint(max);
|
||||||
@@ -931,17 +919,16 @@ void
|
|||||||
Area::_UpdatePreferredConstraint(BSize preferred)
|
Area::_UpdatePreferredConstraint(BSize preferred)
|
||||||
{
|
{
|
||||||
if (fChildArea == NULL) {
|
if (fChildArea == NULL) {
|
||||||
fPreferredContentSize = preferred;
|
|
||||||
if (fPreferredContentWidth == NULL) {
|
if (fPreferredContentWidth == NULL) {
|
||||||
fPreferredContentWidth = fLS->AddConstraint(
|
fPreferredContentWidth = fLS->AddConstraint(
|
||||||
-1.0, fLeft, 1.0, fRight, OperatorType(EQ),
|
-1.0, fLeft, 1.0, fRight, OperatorType(EQ),
|
||||||
fPreferredContentSize.Width(), fShrinkPenalties.Width(),
|
preferred.Width(), fShrinkPenalties.Width(),
|
||||||
fGrowPenalties.Width());
|
fGrowPenalties.Width());
|
||||||
fConstraints->AddItem(fPreferredContentWidth);
|
fConstraints->AddItem(fPreferredContentWidth);
|
||||||
|
|
||||||
fPreferredContentHeight = fLS->AddConstraint(
|
fPreferredContentHeight = fLS->AddConstraint(
|
||||||
-1.0, fTop, 1.0, fBottom, OperatorType(EQ),
|
-1.0, fTop, 1.0, fBottom, OperatorType(EQ),
|
||||||
fPreferredContentSize.Height(), fShrinkPenalties.Height(),
|
preferred.Height(), fShrinkPenalties.Height(),
|
||||||
fGrowPenalties.Height());
|
fGrowPenalties.Height());
|
||||||
fConstraints->AddItem(fPreferredContentHeight);
|
fConstraints->AddItem(fPreferredContentHeight);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user