summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2015-10-03 19:50:22 +0200
committerSebastian Geerken <devnull@localhost>2015-10-03 19:50:22 +0200
commit1392f2e22c584eaa1f26fb20babdf6eb4ddbc185 (patch)
tree6cae71ec81021de413eed21c174e773fe6a0064c
parent1191996538bd923b7f29016558a8154c51df3ffb (diff)
SRDOP: Remove references to allocations in OOFFloatsMgr.
-rw-r--r--dw/ooffloatsmgr.cc61
-rw-r--r--dw/ooffloatsmgr.hh40
2 files changed, 23 insertions, 78 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 32cda2e7..676d6a36 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -914,7 +914,6 @@ bool OOFFloatsMgr::collidesH (Float *vloat, Float *other)
if (!other->getWidget()->wasAllocated ())
collidesH = false;
else {
- assert (wasAllocated (vloat->generatingBlock));
int vloatX = calcFloatX (vloat);
// Generally: right border of the left float > left border of
@@ -1057,44 +1056,30 @@ void OOFFloatsMgr::getFloatsExtremes (Extremes *cbExtr, Side side,
vloat->getWidget (), vloat->generatingBlock,
container);
- if (vloat->generatingBlock == container ||
- wasAllocated (vloat->generatingBlock)) {
- Extremes extr;
- vloat->getWidget()->getExtremes (&extr);
-
- // The calculation of extremes must be kept consistent with
- // getFloatsSize(). Especially this means for the *minimal* width:
- //
- // - The right border (difference between float and
- // container) does not have to be considered (see
- // getFloatsSize()).
- //
- // - This is also the case for the left border, as seen in
- // calcFloatX() ("... but when the float exceeds the line
- // break width" ...).
-
- *minWidth = max (*minWidth, extr.minWidth);
-
- // For the maximal width, borders must be considered.
+ Extremes extr;
+ vloat->getWidget()->getExtremes (&extr);
- if (vloat->generatingBlock == container)
- *maxWidth =
- max (*maxWidth,
- extr.maxWidth
- + vloat->generatingBlock->getStyle()->boxDiffWidth());
- else {
- Allocation *gba = getAllocation (vloat->generatingBlock);
- *maxWidth =
- max (*maxWidth,
- extr.maxWidth
- + vloat->generatingBlock->getStyle()->boxDiffWidth()
- + max (containerAllocation.width - gba->width, 0));
- }
-
- DBG_OBJ_MSGF ("resize.oofm", 1, "%d / %d => %d / %d",
- extr.minWidth, extr.maxWidth, *minWidth, *maxWidth);
- } else
- DBG_OBJ_MSG ("resize.oofm", 1, "not allocated");
+ // The calculation of extremes must be kept consistent with
+ // getFloatsSize(). Especially this means for the *minimal* width:
+ //
+ // - The right border (difference between float and container) does not
+ // have to be considered (see getFloatsSize()).
+ //
+ // - This is also the case for the left border, as seen in calcFloatX()
+ // ("... but when the float exceeds the line break width" ...).
+
+ *minWidth = max (*minWidth, extr.minWidth);
+
+ // For the maximal width, borders must be considered.
+ *maxWidth = max (*maxWidth,
+ extr.maxWidth
+ + vloat->generatingBlock->getStyle()->boxDiffWidth(),
+ + max (container->getGeneratorWidth ()
+ - vloat->generatingBlock->getGeneratorWidth (),
+ 0));
+
+ DBG_OBJ_MSGF ("resize.oofm", 1, "%d / %d => %d / %d",
+ extr.minWidth, extr.maxWidth, *minWidth, *maxWidth);
}
DBG_OBJ_LEAVE ();
diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh
index 8e63eaab..b6571a86 100644
--- a/dw/ooffloatsmgr.hh
+++ b/dw/ooffloatsmgr.hh
@@ -81,15 +81,6 @@ private:
Float (OOFFloatsMgr *oofm, core::Widget *widget,
OOFAwareWidget *generatingBlock, int externalIndex);
- inline bool isNowAllocated () { return getWidget()->wasAllocated (); }
- inline int getNewXCB () { return getWidget()->getAllocation()->x -
- getOOFFloatsMgr()->containerAllocation.x; }
- inline int getNewYCB () { return getWidget()->getAllocation()->y -
- getOOFFloatsMgr()->containerAllocation.y; }
- inline int getNewWidth () { return getWidget()->getAllocation()->width; }
- inline int getNewHeight () { return getWidget()->getAllocation()->ascent +
- getWidget()->getAllocation()->descent; }
-
void intoStringBuffer(lout::misc::StringBuffer *sb);
bool covers (int y, int h);
@@ -162,21 +153,6 @@ private:
TBInfo *parent, int parentExtIndex);
~TBInfo ();
- inline bool isNowAllocated () {
- return getOOFFloatsMgr()->wasAllocated (getOOFAwareWidget()); }
- inline int getNewXCB () {
- return getOOFFloatsMgr()->getAllocation (getOOFAwareWidget())->x -
- getOOFFloatsMgr()->containerAllocation.x; }
- inline int getNewYCB () {
- return getOOFFloatsMgr()->getAllocation (getOOFAwareWidget())->y -
- getOOFFloatsMgr()->containerAllocation.y; }
- inline int getNewWidth () {
- return getOOFFloatsMgr()->getAllocation (getOOFAwareWidget())->width; }
- inline int getNewHeight () {
- core::Allocation *allocation =
- getOOFFloatsMgr()->getAllocation (getOOFAwareWidget ());
- return allocation->ascent + allocation->descent; }
-
inline OOFAwareWidget *getOOFAwareWidget ()
{ return (OOFAwareWidget*)getWidget (); }
};
@@ -192,22 +168,6 @@ private:
int lastLeftTBIndex, lastRightTBIndex, leftFloatsMark, rightFloatsMark;
- /**
- * Variant of Widget::wasAllocated(), which can also be used within
- * OOFM::sizeAllocateEnd().
- */
- inline bool wasAllocated (OOFAwareWidget *textblock) {
- return getOOFAwareWidget(textblock)->wasAllocated;
- }
-
- /**
- * Variant of Widget::getAllocation(), which can also be used
- * within OOFM::sizeAllocateEnd().
- */
- inline core::Allocation *getAllocation (OOFAwareWidget *textblock) {
- return &(getOOFAwareWidget(textblock)->allocation);
- }
-
void moveExternalIndices (lout::container::typed::Vector<Float> *list,
int oldStartIndex, int diff);
Float *findFloatByWidget (core::Widget *widget);