diff options
-rw-r--r-- | dw/oofawarewidget.cc | 8 | ||||
-rw-r--r-- | dw/oofawarewidget.hh | 15 | ||||
-rw-r--r-- | dw/ooffloatsmgr.cc | 18 | ||||
-rw-r--r-- | dw/textblock.cc | 7 | ||||
-rw-r--r-- | dw/textblock.hh | 3 |
5 files changed, 35 insertions, 16 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc index cd0380a0..21c9fd63 100644 --- a/dw/oofawarewidget.cc +++ b/dw/oofawarewidget.cc @@ -566,7 +566,13 @@ void OOFAwareWidget::oofSizeChanged (bool extremesChanged) DBG_OBJ_LEAVE (); } -int OOFAwareWidget::getLineBreakWidth () +int OOFAwareWidget::getGeneratorX () +{ + assertNotReached (); + return 0; +} + +int OOFAwareWidget::getGeneratorWidth () { assertNotReached (); return 0; diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh index ab00e3ea..6a401e4e 100644 --- a/dw/oofawarewidget.hh +++ b/dw/oofawarewidget.hh @@ -278,15 +278,22 @@ public: virtual void clearPositionChanged (); /** - * Called by an implementation of dw::oof::OutOfFlowMgr when the size - * of the container has changed, typically in sizeAllocateEnd. + * Called by an implementation of dw::oof::OutOfFlowMgr when the size of the + * container has changed, typically in sizeAllocateEnd. */ virtual void oofSizeChanged (bool extremesChanged); /** - * Called by OOFFloatsMgr to position floats. (Should perhaps be renamed.) + * Return position relative to container, not regarding + * margin/border/padding, Called by OOFFloatsMgr to position floats. */ - virtual int getLineBreakWidth (); + virtual int getGeneratorX (); + + /** + * Return width including margin/border/padding Called by OOFFloatsMgr to + * position floats. + */ + virtual int getGeneratorWidth (); virtual bool isPossibleContainer (int oofmIndex); diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index ce32be77..8965d485 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -425,7 +425,7 @@ void OOFFloatsMgr::sizeAllocateEnd (OOFAwareWidget *caller) TBInfo *tbInfo = tbInfosByOOFAwareWidget->get (key); OOFAwareWidget *tb = key->getTypedValue(); - tbInfo->lineBreakWidth = tb->getLineBreakWidth (); + tbInfo->lineBreakWidth = tb->getGeneratorWidth (); } // There are cases where some allocated floats exceed the CB size. @@ -533,13 +533,13 @@ int OOFFloatsMgr::getGBWidthForAllocation (Float *vloat) { // See comments in getFloatsSize() for a detailed rationale ... if (container->mustBeWidenedToAvailWidth ()) - return vloat->generatingBlock->getLineBreakWidth (); + return vloat->generatingBlock->getGeneratorWidth (); else // ... but notice this difference: not GB width + float width is // used, but only GB width, since the float width has already // been included in getFloatsSize(). return min (getAllocation(vloat->generatingBlock)->width, - vloat->generatingBlock->getLineBreakWidth ()); + vloat->generatingBlock->getGeneratorWidth ()); } /** @@ -566,11 +566,11 @@ int OOFFloatsMgr::calcFloatX (Float *vloat, Side side, int gbX, int gbWidth) // This way, we save space and, especially within tables, avoid // some problems. if (wasAllocated (container) /* TODO: obsolete after SRDOP? */ && - x + vloat->size.width > container->getLineBreakWidth ()) { - x = max (0, container->getLineBreakWidth () - vloat->size.width); + x + vloat->size.width > container->getGeneratorWidth ()) { + x = max (0, container->getGeneratorWidth () - vloat->size.width); DBG_OBJ_MSGF ("resize.common", 1, "corrected to: max (0, %d - %d) = %d", - container->getLineBreakWidth (), vloat->size.width, x); + container->getGeneratorWidth (), vloat->size.width, x); } break; @@ -940,7 +940,7 @@ bool OOFFloatsMgr::collidesH (Float *vloat, Float *other) if (vloat->generatingBlock == other->generatingBlock) collidesH = vloat->size.width + other->size.width + vloat->generatingBlock->boxDiffWidth() - > vloat->generatingBlock->getLineBreakWidth(); + > vloat->generatingBlock->getGeneratorWidth (); else { // Again, if the other float is not allocated, there is no // collision. Compare to collidesV. (But vloat->size is used @@ -1048,7 +1048,7 @@ void OOFFloatsMgr::getFloatsSize (Requisition *cbReq, Side side, int *width, // For most textblocks, the line break width is used for calculating // the x position. (This changed for GROWS, where the width of a // textblock is often smaller that the line break.) - effWidth = vloat->generatingBlock->getLineBreakWidth (); + effWidth = vloat->generatingBlock->getGeneratorWidth (); else // For some textblocks, like inline blocks, the line break width would // be too large for right floats in some cases. @@ -1060,7 +1060,7 @@ void OOFFloatsMgr::getFloatsSize (Requisition *cbReq, Side side, int *width, // (ii) If there is more than one line, the line break will already be // exceeded, and so be smaller that GB width + float width. effWidth = min (cbReq->width + vloat->size.width, - vloat->generatingBlock->getLineBreakWidth ()); + vloat->generatingBlock->getGeneratorWidth ()); *width = max (*width, calcFloatX (vloat, side, 0, effWidth) diff --git a/dw/textblock.cc b/dw/textblock.cc index e66ab66a..a34ea025 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -3179,7 +3179,12 @@ void Textblock::oofSizeChanged (bool extremesChanged) DBG_OBJ_LEAVE (); } -int Textblock::getLineBreakWidth () +int Textblock::getGeneratorX () +{ + return 0; // TODO +} + +int Textblock::getGeneratorWidth () { return lineBreakWidth; } diff --git a/dw/textblock.hh b/dw/textblock.hh index 106f65ba..e3f565a2 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -908,7 +908,8 @@ public: void widgetRefSizeChanged (int externalIndex); void clearPositionChanged (); void oofSizeChanged (bool extremesChanged); - int getLineBreakWidth (); + int getGeneratorX (); + int getGeneratorWidth (); bool isPossibleContainer (int oofmIndex); bool isPossibleContainerParent (int oofmIndex); }; |