Remove BALM::Area::fConstraints field, which is not needed.
It's easier to just delete all the constraints in the dtor, the ones that wouldn't have been in fConstraints are NULL at this point anyway.
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
#define AREA_H
|
#define AREA_H
|
||||||
|
|
||||||
|
|
||||||
#include <ObjectList.h>
|
|
||||||
#include <Referenceable.h>
|
#include <Referenceable.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <Size.h>
|
#include <Size.h>
|
||||||
@@ -137,7 +136,6 @@ private:
|
|||||||
double fContentAspectRatio;
|
double fContentAspectRatio;
|
||||||
RowColumnManager* fRowColumnManager;
|
RowColumnManager* fRowColumnManager;
|
||||||
|
|
||||||
BObjectList<LinearProgramming::Constraint> fConstraints;
|
|
||||||
LinearProgramming::Constraint* fMinContentWidth;
|
LinearProgramming::Constraint* fMinContentWidth;
|
||||||
LinearProgramming::Constraint* fMaxContentWidth;
|
LinearProgramming::Constraint* fMaxContentWidth;
|
||||||
LinearProgramming::Constraint* fMinContentHeight;
|
LinearProgramming::Constraint* fMinContentHeight;
|
||||||
|
|||||||
+9
-21
@@ -227,7 +227,6 @@ Area::SetContentAspectRatio(double ratio)
|
|||||||
} else if (fContentAspectRatioC == NULL) {
|
} else if (fContentAspectRatioC == NULL) {
|
||||||
fContentAspectRatioC = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight,
|
fContentAspectRatioC = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight,
|
||||||
ratio, fTop, -ratio, fBottom, kEQ, 0.0);
|
ratio, fTop, -ratio, fBottom, kEQ, 0.0);
|
||||||
fConstraints.AddItem(fContentAspectRatioC);
|
|
||||||
} else {
|
} else {
|
||||||
fContentAspectRatioC->SetLeftSide(-1.0, fLeft, 1.0, fRight, ratio,
|
fContentAspectRatioC->SetLeftSide(-1.0, fLeft, 1.0, fRight, ratio,
|
||||||
fTop, -ratio, fBottom);
|
fTop, -ratio, fBottom);
|
||||||
@@ -469,8 +468,11 @@ Area::Frame() const
|
|||||||
*/
|
*/
|
||||||
Area::~Area()
|
Area::~Area()
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < fConstraints.CountItems(); i++)
|
delete fMinContentWidth;
|
||||||
delete fConstraints.ItemAt(i);
|
delete fMaxContentWidth;
|
||||||
|
delete fMinContentHeight;
|
||||||
|
delete fMaxContentHeight;
|
||||||
|
delete fContentAspectRatioC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -490,27 +492,21 @@ new_area_id()
|
|||||||
Area::Area(BLayoutItem* item)
|
Area::Area(BLayoutItem* item)
|
||||||
:
|
:
|
||||||
fLayoutItem(item),
|
fLayoutItem(item),
|
||||||
|
|
||||||
fLS(NULL),
|
fLS(NULL),
|
||||||
fLeft(NULL),
|
fLeft(NULL),
|
||||||
fRight(NULL),
|
fRight(NULL),
|
||||||
fTop(NULL),
|
fTop(NULL),
|
||||||
fBottom(NULL),
|
fBottom(NULL),
|
||||||
|
|
||||||
fRow(NULL),
|
fRow(NULL),
|
||||||
fColumn(NULL),
|
fColumn(NULL),
|
||||||
|
|
||||||
fShrinkPenalties(5, 5),
|
fShrinkPenalties(5, 5),
|
||||||
fGrowPenalties(5, 5),
|
fGrowPenalties(5, 5),
|
||||||
|
|
||||||
fContentAspectRatio(-1),
|
fContentAspectRatio(-1),
|
||||||
fRowColumnManager(NULL),
|
fRowColumnManager(NULL),
|
||||||
|
|
||||||
fMinContentWidth(NULL),
|
fMinContentWidth(NULL),
|
||||||
fMaxContentWidth(NULL),
|
fMaxContentWidth(NULL),
|
||||||
fMinContentHeight(NULL),
|
fMinContentHeight(NULL),
|
||||||
fMaxContentHeight(NULL),
|
fMaxContentHeight(NULL),
|
||||||
|
|
||||||
fContentAspectRatioC(NULL)
|
fContentAspectRatioC(NULL)
|
||||||
{
|
{
|
||||||
fID = new_area_id();
|
fID = new_area_id();
|
||||||
@@ -551,16 +547,14 @@ Area::_Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom,
|
|||||||
// really above the bottom y-tab
|
// really above the bottom y-tab
|
||||||
fMinContentWidth = ls->AddConstraint(-1.0, fLeft, 1.0, fRight, kGE, 0);
|
fMinContentWidth = ls->AddConstraint(-1.0, fLeft, 1.0, fRight, kGE, 0);
|
||||||
fMinContentHeight = ls->AddConstraint(-1.0, fTop, 1.0, fBottom, kGE, 0);
|
fMinContentHeight = ls->AddConstraint(-1.0, fTop, 1.0, fBottom, kGE, 0);
|
||||||
|
|
||||||
fConstraints.AddItem(fMinContentWidth);
|
|
||||||
fConstraints.AddItem(fMinContentHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Area::_Init(LinearSpec* ls, Row* row, Column* column, RowColumnManager* manager)
|
Area::_Init(LinearSpec* ls, Row* row, Column* column, RowColumnManager* manager)
|
||||||
{
|
{
|
||||||
_Init(ls, column->Left(), row->Top(), column->Right(), row->Bottom(), manager);
|
_Init(ls, column->Left(), row->Top(), column->Right(),
|
||||||
|
row->Bottom(), manager);
|
||||||
|
|
||||||
fRow = row;
|
fRow = row;
|
||||||
fColumn = column;
|
fColumn = column;
|
||||||
@@ -615,12 +609,9 @@ Area::_UpdateMaxSizeConstraint(BSize max)
|
|||||||
if (fMaxContentHeight == NULL) {
|
if (fMaxContentHeight == NULL) {
|
||||||
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
||||||
kLE, max.Height());
|
kLE, max.Height());
|
||||||
fConstraints.AddItem(fMaxContentHeight);
|
|
||||||
} else
|
} else
|
||||||
fMaxContentHeight->SetRightSide(max.Height());
|
fMaxContentHeight->SetRightSide(max.Height());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fConstraints.RemoveItem(fMaxContentHeight);
|
|
||||||
delete fMaxContentHeight;
|
delete fMaxContentHeight;
|
||||||
fMaxContentHeight = NULL;
|
fMaxContentHeight = NULL;
|
||||||
}
|
}
|
||||||
@@ -629,12 +620,9 @@ Area::_UpdateMaxSizeConstraint(BSize max)
|
|||||||
if (fMaxContentWidth == NULL) {
|
if (fMaxContentWidth == NULL) {
|
||||||
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight, kLE,
|
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight, kLE,
|
||||||
max.Width());
|
max.Width());
|
||||||
fConstraints.AddItem(fMaxContentWidth);
|
|
||||||
} else
|
} else
|
||||||
fMaxContentWidth->SetRightSide(max.Width());
|
fMaxContentWidth->SetRightSide(max.Width());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fConstraints.RemoveItem(fMaxContentWidth);
|
|
||||||
delete fMaxContentWidth;
|
delete fMaxContentWidth;
|
||||||
fMaxContentWidth = NULL;
|
fMaxContentWidth = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user