diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/oofawarewidget.cc | 4 | ||||
-rw-r--r-- | dw/oofawarewidget.hh | 2 | ||||
-rw-r--r-- | dw/ooffloatsmgr.cc | 26 | ||||
-rw-r--r-- | dw/textblock.cc | 24 | ||||
-rw-r--r-- | dw/textblock.hh | 2 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 38 |
6 files changed, 20 insertions, 76 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc index 8f704f40..025111ae 100644 --- a/dw/oofawarewidget.cc +++ b/dw/oofawarewidget.cc @@ -573,9 +573,9 @@ void OOFAwareWidget::oofSizeChanged (bool extremesChanged) DBG_OBJ_LEAVE (); } -int OOFAwareWidget::getC0RelX (int oofmIndex) +int OOFAwareWidget::getGeneratorX (int oofmIndex) { - notImplemented ("OOFAwareWidget::getC0RelX"); + notImplemented ("OOFAwareWidget::getGeneratorX"); return 0; } diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh index d72b894a..e49cce14 100644 --- a/dw/oofawarewidget.hh +++ b/dw/oofawarewidget.hh @@ -276,7 +276,7 @@ public: * Return position relative to container, not regarding * margin/border/padding, Called by OOFFloatsMgr to position floats. */ - virtual int getC0RelX (int oofmIndex); + virtual int getGeneratorX (int oofmIndex); /** * Return position relative to container, not regarding diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index cadf980e..84b2f6ff 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -20,7 +20,6 @@ #include "ooffloatsmgr.hh" #include "oofawarewidget.hh" #include "../lout/debug.hh" -#include "../lout/msg.h" #include <limits.h> @@ -434,13 +433,12 @@ int OOFFloatsMgr::calcFloatX (Float *vloat) OOFAwareWidget *generator = vloat->generator; ensureFloatSize (vloat); - MSG("calcFloatX: "); switch (vloat->getWidget()->getStyle()->vloat) { case FLOAT_LEFT: // Left floats are always aligned on the left side of the generator // (content, not allocation) ... - x = generator->getC0RelX (oofmIndex) + x = generator->getGeneratorX (oofmIndex) + generator->getStyle()->boxOffsetX(); // ... but when the float exceeds the line break width of the container, @@ -475,27 +473,13 @@ int OOFFloatsMgr::calcFloatX (Float *vloat) // (ii) If there is more than one line, the line break will already be // exceeded, and so be smaller that GB width + float width. effGeneratorWidth = - //min (vloat->generator->getGeneratorWidth (0, 0), min (vloat->generator->getGeneratorWidth (0, 0) + vloat->size.width, vloat->generator->getMaxGeneratorWidth ()); - MSG("UsesMaxGenW=%d gen->MaxGenW()=%d genW00=%d effGenW=%d ", - vloat->generator->usesMaxGeneratorWidth(), - vloat->generator->getMaxGeneratorWidth (), - vloat->generator->getGeneratorWidth (0, 0), - effGeneratorWidth); - x = max (generator->getC0RelX (oofmIndex) + effGeneratorWidth + x = max (generator->getGeneratorX (oofmIndex) + effGeneratorWidth - vloat->size.width - generator->getStyle()->boxRestWidth(), - //- generator->getStyle()->boxRestWidth(), // Do not exceed container allocation: 0); - - //if (x == 356) x -= 34; - - MSG("vloatW=%d gen->getC0RelX()=%d g->boxRestWidth()=%d x=%d", - vloat->size.width, - generator->getC0RelX (oofmIndex), - generator->getStyle()->boxRestWidth(), x); break; default: @@ -503,8 +487,8 @@ int OOFFloatsMgr::calcFloatX (Float *vloat) x = 0; break; } + DBG_OBJ_LEAVE_VAL ("%d", x); - MSG("\n"); return x; } @@ -1122,7 +1106,7 @@ int OOFFloatsMgr::getBorder (Side side, int y, int h, OOFAwareWidget *lastGB, int d; switch (side) { case LEFT: - d = vloat->generator->getC0RelX (oofmIndex) + d = vloat->generator->getGeneratorX (oofmIndex) + vloat->generator->getStyle()->boxOffsetX (); break; @@ -1132,7 +1116,7 @@ int OOFFloatsMgr::getBorder (Side side, int y, int h, OOFAwareWidget *lastGB, // left border, see above). We have to calculate the difference // between the maximal widths. d = container->getMaxGeneratorWidth () - - (vloat->generator->getC0RelX (oofmIndex) + - (vloat->generator->getGeneratorX (oofmIndex) + vloat->generator->getMaxGeneratorWidth ()) + vloat->generator->getStyle()->boxRestWidth (); break; diff --git a/dw/textblock.cc b/dw/textblock.cc index ce93fd36..4fe19fdd 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -3067,9 +3067,9 @@ void Textblock::oofSizeChanged (bool extremesChanged) DBG_OBJ_LEAVE (); } -int Textblock::getC0RelX (int oofmIndex) +int Textblock::getGeneratorX (int oofmIndex) { - DBG_OBJ_ENTER ("resize", 0, "Textblock::getC0RelX", "%d", oofmIndex); + DBG_OBJ_ENTER ("resize", 0, "Textblock::getGeneratorX", "%d", oofmIndex); int x, xRef; if (findSizeRequestReference (oofmIndex, &xRef, NULL)) @@ -3119,7 +3119,7 @@ int Textblock::getGeneratorRest (int oofmIndex) int width = getGeneratorWidth (0, 0); rest = container->getGeneratorWidth (xRef, width) - (xRef + width); } else { - // Only called for floats, so this should not happen: + // Only callend for floats, so this should not happen: assertNotReached (); rest = 0; } @@ -3132,31 +3132,15 @@ int Textblock::getGeneratorWidth (int callerX, int callerWidth) { DBG_OBJ_ENTER ("resize", 0, "Textblock::getGeneratorWidth", "%d, %d", callerX, callerWidth); - - if (0 && lines->size () > 0) { - Word *lastWordOfLine, *lwol0; - lwol0 = words->getRef(lines->getRef(0)->lastWord); - lastWordOfLine = words->getRef(lines->getLastRef()->lastWord); - MSG("lww=%d lwol0=%d ", lastWordOfLine->totalWidth, lwol0->totalWidth); - MSG("lbw0=%d lbwl=%d\n", - calcLineBreakWidth(0), - calcLineBreakWidth(lines->size() - 1)); - } + // Cf. sizeRequestImpl. if (usesMaxGeneratorWidth ()) { DBG_OBJ_LEAVE_VAL ("%d", lineBreakWidth); return lineBreakWidth; } else { -#if 0 - int w0 = max (lines->size () > 0 ? lines->getLastRef()->maxLineWidth : 0, - callerX + callerWidth); - ... - w = min (w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth); -#else int w0 = max (lines->size () > 0 ? lines->getLastRef()->maxLineWidth : 0, callerX + callerWidth), w = min (w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth); -#endif DBG_OBJ_LEAVE_VAL ("min (%d + %d + %d, %d) = %d", w0, leftInnerPadding, boxDiffWidth (), lineBreakWidth, w); diff --git a/dw/textblock.hh b/dw/textblock.hh index 98a0f9bb..fd92b636 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -902,7 +902,7 @@ public: void widgetRefSizeChanged (int externalIndex); void clearPositionChanged (); void oofSizeChanged (bool extremesChanged); - int getC0RelX (int oofmIndex); + int getGeneratorX (int oofmIndex); int getGeneratorY (int oofmIndex); int getGeneratorWidth (int callerX, int callerWidth); int getMaxGeneratorWidth (); diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index e48c9a6e..fddfb44f 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -575,7 +575,7 @@ int Textblock::wordWrap (int wordIndex, bool wrapAll) n = wrapWordOofRef (wordIndex, wrapAll); else n = wrapWordInFlow (wordIndex, wrapAll); - _MSG("wordWrap word[%d] wtW=%d\n", wordIndex, word->totalWidth); + DBG_OBJ_MSGF ("construct.word", 1, "=> %d", n); DBG_OBJ_LEAVE (); @@ -758,6 +758,7 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) // (currently?). lastFloatPos = newFloatPos; + Widget *widget = words->getRef(lastFloatPos)->content.widgetReference->widget; int oofmIndex = getWidgetOOFIndex (widget); @@ -812,6 +813,7 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) } addLine (firstIndex, breakPos, lastFloatPos, tempNewLine, minHeight); + DBG_OBJ_MSGF ("construct.word", 1, "accumulating again from %d to %d", breakPos + 1, wordIndexEnd); @@ -821,12 +823,7 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) // update word pointer as hyphenateWord() can trigger a // reorganization of the words structure word = words->getRef (wordIndex); - MSG("wrapWordInFlow brkPos=%d, wIdxEnd=%d, word[%d].totalWidth=%d\n", - breakPos, wordIndexEnd, - wordIndex, words->getRef(wordIndex)->totalWidth); - if (words->getRef(wordIndex)->totalWidth == 36) { - MSG("*"); - } + penaltyIndex = calcPenaltyIndexForNewLine (); } } while (newLine); @@ -1657,6 +1654,7 @@ void Textblock::accumulateWordData (int wordIndex) word->maxDescent = word->size.descent; word->totalSpaceStretchability = 0; word->totalSpaceShrinkability = 0; + DBG_OBJ_MSGF ("construct.word.accum", 1, "first word of line: words[%d].totalWidth = %d + %d = %d; " "maxAscent = %d, maxDescent = %d", @@ -1668,7 +1666,6 @@ void Textblock::accumulateWordData (int wordIndex) word->totalWidth = prevWord->totalWidth + prevWord->origSpace - prevWord->hyphenWidth + word->size.width + word->hyphenWidth; - _MSG("wtW=%d ", word->totalWidth); word->maxAscent = max (prevWord->maxAscent, word->size.ascent); word->maxDescent = max (prevWord->maxDescent, word->size.descent); word->totalSpaceStretchability = @@ -1968,21 +1965,6 @@ void Textblock::rewrap () // So this is necessary: word = words->getRef (i); } - MSG("rewrap tb=%p: totalWidth { ", this); - for (int i = firstWord; i < words->size (); i++) { - Word *word = words->getRef (i); - MSG("w%d=%d ", i, word->totalWidth); - } - MSG("}"); - - MSG(", Lines MaxW{ "); - for (int i = 0; i < lines->size (); ++i) { - Line *line = lines->getRef(i); - MSG("l%d=%d ", i, line->maxLineWidth); - //Line *lastLine = lines->getLastRef(); - } - MSG("}\n"); - // Next time, the page will not have to be rewrapped. wrapRefLines = -1; DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); @@ -2071,7 +2053,7 @@ void Textblock::calcBorders (int lastOofRef, int height) { DBG_OBJ_ENTER ("construct.line", 0, "calcBorders", "%d, %d", lastOofRef, height); - MSG("calcBorders tb=%p ", this); + newLineHasFloatLeft = newLineHasFloatRight = false; newLineLeftBorder = newLineRightBorder = 0; newLineLeftFloatHeight = newLineRightFloatHeight = 0; @@ -2130,7 +2112,6 @@ void Textblock::calcBorders (int lastOofRef, int height) newLineHasFloatLeft = newLineHasFloatLeft || thisHasLeft; thisHasRight = oofm->hasFloatRight (y, height, this, effOofRef); newLineHasFloatRight = newLineHasFloatRight || thisHasRight; - MSG("nlhFR=%d thR=%d ", newLineHasFloatRight, thisHasRight); // TODO "max" is not really correct for the heights. (Does // not matter, since only one, the float manager, returns @@ -2139,7 +2120,7 @@ void Textblock::calcBorders (int lastOofRef, int height) newLineLeftBorder = max (newLineLeftBorder, oofm->getLeftBorder (y, height, this, effOofRef) - - getC0RelX (i)); + - getGeneratorX (i)); newLineLeftFloatHeight = max (newLineLeftFloatHeight, oofm->getLeftFloatHeight (y, height, this, effOofRef)); @@ -2148,12 +2129,8 @@ void Textblock::calcBorders (int lastOofRef, int height) if (thisHasRight) { newLineRightBorder = max (newLineRightBorder, -#if 0 - oofm->getRightBorder (y, height, this, effOofRef)); -#else oofm->getRightBorder (y, height, this, effOofRef) - getGeneratorRest (i)); -#endif newLineRightFloatHeight = max (newLineRightFloatHeight, oofm->getRightFloatHeight (y, height, this, effOofRef)); @@ -2170,7 +2147,6 @@ void Textblock::calcBorders (int lastOofRef, int height) } } } - MSG("\n"); DBG_OBJ_SET_BOOL ("newLineHasFloatLeft", newLineHasFloatLeft); DBG_OBJ_SET_BOOL ("newLineHasFloatRight", newLineHasFloatRight); |