diff options
-rw-r--r-- | dw/outofflowmgr.cc | 10 | ||||
-rw-r--r-- | dw/textblock.cc | 57 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 23 |
3 files changed, 58 insertions, 32 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index d5b1f364..ff3b0898 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -140,17 +140,17 @@ bool OutOfFlowMgr::Float::covers (Textblock *textblock, int y, int h) b = false; } else { Allocation *tba = getOutOfFlowMgr()->getAllocation(textblock), - *gba = getOutOfFlowMgr()->getAllocation(generatingBlock), + //*gba = getOutOfFlowMgr()->getAllocation(generatingBlock), *fla = getWidget()->getAllocation (); int reqyCanv = tba->y + y; - int flyCanv = gba->y + yReal; + int flyCanv = fla->y; int flh = fla->ascent + fla->descent; b = flyCanv + flh > reqyCanv && flyCanv < reqyCanv + h; DBG_OBJ_MSGF_O ("border", 1, getOutOfFlowMgr (), "not generator (allocated): reqyCanv = %d + %d = %d, " - "flyCanv = %d + %d = %d, flh = %d + %d = %d => %s", - tba->y, y, reqyCanv, gba->y, yReal, flyCanv, + "flyCanv = %d, flh = %d + %d = %d => %s", + tba->y, y, reqyCanv, flyCanv, fla->ascent, fla->descent, flh, b ? "true" : "false"); } } @@ -1630,7 +1630,7 @@ int OutOfFlowMgr::getBorder (Textblock *textblock, Side side, int y, int h, for (int i = 0; i < list->size(); i++) { Float *f = list->get(i); DBG_OBJ_MSGF ("border", 1, - "%d: (%p, i = %d/%d, y = %d/%d, s = (%d * (%d + %d), " + "%d: (%p, i = %d/%d, y = %d/%d, s = (%d * (%d + %d)), " "%s, %s); widget at (%d, %d)", i, f->getWidget (), f->index, f->sideSpanningIndex, f->yReq, f->yReal, f->size.width, f->size.ascent, diff --git a/dw/textblock.cc b/dw/textblock.cc index 3e184719..7718d6b3 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2876,19 +2876,40 @@ Textblock *Textblock::getTextblockForLine (int firstWord, int lastWord) */ int Textblock::yOffsetOfPossiblyMissingLine (int lineNo) { - if (lineNo == 0) - return verticalOffset + getStyle()->boxOffsetY(); - else { + DBG_OBJ_MSGF ("line.yoffset", 0, "<b>yOffsetOfPossiblyMissingLine</b> (%d)", + lineNo); + DBG_OBJ_MSG_START (); + + int result; + + if (lineNo == 0) { + result = verticalOffset + getStyle()->boxOffsetY(); + DBG_OBJ_MSGF ("line.yoffset", 1, "first line: %d + %d = %d", + verticalOffset, getStyle()->boxOffsetY(), result); + } else { Line *prevLine = lines->getRef (lineNo - 1); - return verticalOffset + + result = verticalOffset + getStyle()->boxOffsetY() + prevLine->top + prevLine->boxAscent + prevLine->boxDescent + - prevLine->breakSpace + getStyle()->boxOffsetY(); + prevLine->breakSpace; + DBG_OBJ_MSGF ("line.yoffset", 1, + "other line: %d + %d + %d + (%d + %d) + %d = %d", + verticalOffset, getStyle()->boxOffsetY(), + prevLine->top, prevLine->boxAscent, prevLine->boxDescent, + prevLine->breakSpace, result); } + + DBG_OBJ_MSG_END (); + + return result; } int Textblock::heightOfPossiblyMissingLine (int lineNo) { - PRINTF ("[%p] HEIGHT_OF_POSSIBLY_MISSING_LINE (%d)\n", this, lineNo); + DBG_OBJ_MSGF ("line.height", 0, "<b>heightOfPossiblyMissingLine</b> (%d)", + lineNo); + DBG_OBJ_MSG_START (); + + int result; if (lineNo < lines->size()) { // An existing line. @@ -2901,13 +2922,14 @@ int Textblock::heightOfPossiblyMissingLine (int lineNo) // accumulate the heights then. if (line->finished) { - PRINTF (" Exists and is finished; height = %d + %d = %d\n", - line->boxAscent, line->boxDescent, - line->boxAscent + line->boxDescent); - return line->boxAscent + line->boxDescent; + DBG_OBJ_MSGF ("line.height", 1, + "exists and is finished; height = %d + %d = %d", + line->boxAscent, line->boxDescent, + line->boxAscent + line->boxDescent); + result = line->boxAscent + line->boxDescent; } else { - PRINTF (" Exist but is not finished.\n"); - return misc::max (1, newLineAscent + newLineDescent); + DBG_OBJ_MSG ("line.height", 1, "exist but is not finished"); + result = misc::max (1, newLineAscent + newLineDescent); } } else if (lineNo == lines->size()) { // The line to be constructed: some words exist, but not the @@ -2916,10 +2938,15 @@ int Textblock::heightOfPossiblyMissingLine (int lineNo) // Old comment: Furthermore, this is in some cases incomplete: // see doc/dw-out-of-flow.doc. -- Still the case? - PRINTF (" Does not exist.\n"); - return misc::max (1, newLineAscent + newLineDescent); + DBG_OBJ_MSG ("line.height", 1, "does not exist"); + result = misc::max (1, newLineAscent + newLineDescent); } else - return 1; + result = 1; + + DBG_OBJ_MSGF ("line.height", 0, "result = %d", result); + DBG_OBJ_MSG_END (); + + return result; } } // namespace dw diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 6fb5d156..5564f819 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -410,18 +410,17 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, + (lineIndex == 0 ? line1OffsetEff : 0)) + line->leftOffset; - PRINTF (" line[%d].top = %d\n", lines->size () - 1, line->top); - PRINTF (" line[%d].boxAscent = %d\n", lines->size () - 1, line->boxAscent); - PRINTF (" line[%d].boxDescent = %d\n", - lines->size () - 1, line->boxDescent); - PRINTF (" line[%d].contentAscent = %d\n", lines->size () - 1, - line->contentAscent); - PRINTF (" line[%d].contentDescent = %d\n", - lines->size () - 1, line->contentDescent); - PRINTF (" line[%d].maxLineWidth = %d (lineWidth = %d)\n", - lines->size () - 1, line->maxLineWidth, lineWidth); - PRINTF (" line[%d].offsetCompleteWidget = %d\n", - lines->size () - 1, line->offsetCompleteWidget); + DBG_OBJ_MSGF ("construct.line", 1, "top = %d\n", line->top); + //DBG_OBJ_MSGF ("construct.line", 1, "boxAscent = %d\n", line->boxAscent); + //DBG_OBJ_MSGF ("construct.line", 1, "boxDescent = %d\n", line->boxDescent); + //DBG_OBJ_MSGF ("construct.line", 1, "contentAscent = %d\n", + // line->contentAscent); + //DBG_OBJ_MSGF ("construct.line", 1, "contentDescent = %d\n", + // line->contentDescent); + //DBG_OBJ_MSGF ("construct.line", 1, "maxLineWidth = %d (lineWidth = %d)\n", + // line->maxLineWidth, lineWidth); + //DBG_OBJ_MSGF ("construct.line", 1, "offsetCompleteWidget = %d\n", + // line->offsetCompleteWidget); mustQueueResize = true; |