diff options
author | Sebastian Geerken <devnull@localhost> | 2013-12-31 00:04:58 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-12-31 00:04:58 +0100 |
commit | f0f9af6dd9a71bc4b93c154d881b310fce80a1df (patch) | |
tree | 5d346501ab4d70d1a578fb289aca42715b2f604e | |
parent | 01f697091153846bdffc73b3150ba37c763301cc (diff) |
RTFL messages.
-rw-r--r-- | dw/layout.cc | 9 | ||||
-rw-r--r-- | dw/outofflowmgr.cc | 32 | ||||
-rw-r--r-- | dw/textblock.cc | 73 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 3 | ||||
-rw-r--r-- | dw/widget.cc | 23 | ||||
-rw-r--r-- | lout/debug.hh | 4 |
6 files changed, 106 insertions, 38 deletions
diff --git a/dw/layout.cc b/dw/layout.cc index ff121250..c984b764 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -787,6 +787,9 @@ void Layout::setBgImage (style::StyleImage *bgImage, void Layout::resizeIdle () { + DBG_OBJ_MSG ("resize", 0, "<b>resizeIdle</b>"); + DBG_OBJ_MSG_START (); + enterQueueResize (); //static int calls = 0; @@ -828,6 +831,8 @@ void Layout::resizeIdle () Allocation allocation; topLevel->sizeRequest (&requisition); + DBG_OBJ_MSGF ("resize", 1, "toplevel size: %d * (%d + %d)", + requisition.width, requisition.ascent, requisition.descent); // This method is triggered by Widget::queueResize, which will, // in any case, set NEEDS_ALLOCATE (indirectly, as @@ -869,12 +874,12 @@ void Layout::resizeIdle () } // views are redrawn via Widget::resizeDrawImpl () - } updateAnchor (); - //printf ("Layout::resizeIdle end\n"); + DBG_OBJ_MSGF ("resize", 1, "resizeIdleId = %d", resizeIdleId); + DBG_OBJ_MSG_END (); leaveQueueResize (); } diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 49babdab..bb7f63da 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -20,6 +20,7 @@ #include "outofflowmgr.hh" #include "textblock.hh" +#include "../lout/debug.hh" using namespace lout::object; using namespace lout::container::typed; @@ -301,7 +302,7 @@ OutOfFlowMgr::AbsolutelyPositioned::AbsolutelyPositioned (OutOfFlowMgr *oofm, OutOfFlowMgr::OutOfFlowMgr (Textblock *containingBlock) { - //printf ("OutOfFlowMgr::OutOfFlowMgr\n"); + DBG_OBJ_CREATE ("dw::OutOfFlowMgr"); this->containingBlock = containingBlock; @@ -354,15 +355,15 @@ OutOfFlowMgr::~OutOfFlowMgr () void OutOfFlowMgr::sizeAllocateStart (Allocation *containingBlockAllocation) { + DBG_OBJ_MSG ("resize", 0, "<b>sizeAllocateStart</b>"); this->containingBlockAllocation = *containingBlockAllocation; containingBlockWasAllocated = true; } void OutOfFlowMgr::sizeAllocateEnd () { - //printf ("[%p] SIZE_ALLOCATE_END: leftFloatsMark = %d, " - // "rightFloatsMark = %d\n", - // containingBlock, leftFloatsMark, rightFloatsMark); + DBG_OBJ_MSG ("resize", 0, "<b>sizeAllocateStart</b>"); + DBG_OBJ_MSG_START (); // 1. Move floats from GB lists to the one CB list. moveFromGBToCB (LEFT); @@ -434,6 +435,8 @@ void OutOfFlowMgr::sizeAllocateEnd () tbInfo->width = width; tbInfo->height = height; } + + DBG_OBJ_MSG_END (); } bool OutOfFlowMgr::isTextblockCoveredByFloats (Textblock *tb, int tbx, int tby, @@ -529,6 +532,9 @@ void OutOfFlowMgr::checkChangedFloatSizes () void OutOfFlowMgr::checkChangedFloatSizes (SortedFloatsVector *list) { + DBG_OBJ_MSG ("resize", 0, "<b>checkChangedFloatSizes</b>"); + DBG_OBJ_MSG_START (); + // TODO (i) Comment (ii) linear search? for (int i = 0; i < list->size(); i++) { // TODO binary search @@ -566,6 +572,8 @@ void OutOfFlowMgr::checkChangedFloatSizes (SortedFloatsVector *list) vloat->sizeChangedSinceLastAllocation = false; } } + + DBG_OBJ_MSG_END (); } void OutOfFlowMgr::moveFromGBToCB (Side side) @@ -934,6 +942,10 @@ void OutOfFlowMgr::tellPosition (Widget *widget, int yReq) void OutOfFlowMgr::tellFloatPosition (Widget *widget, int yReq) { + DBG_OBJ_MSGF ("resize", 0, "<b>tellFloatPosition</b> (%p, %d)", + widget, yReq); + DBG_OBJ_MSG_START (); + assert (yReq >= 0); Float *vloat = findFloatByWidget(widget); @@ -1015,11 +1027,16 @@ void OutOfFlowMgr::tellFloatPosition (Widget *widget, int yReq) } } + DBG_OBJ_MSGF ("resize", 1, "oldY = %d, vloat->yReq = %d, vloat->yReal = %d", + oldY, vloat->yReq, vloat->yReal); + // No call neccessary when yReal has not changed. (Notice that // checking for yReq is wrong: yReq may remain the same, when yReal // changes, e. g. when previous float has changes its size. if (vloat->yReal != oldY) checkCoveragePosChanged (vloat, oldY); + + DBG_OBJ_MSG_END (); } bool OutOfFlowMgr::collides (Float *vloat, Float *other, int *yReal) @@ -1051,6 +1068,11 @@ bool OutOfFlowMgr::collides (Float *vloat, Float *other, int *yReal) void OutOfFlowMgr::checkCoveragePosChanged (Float *vloat, int oldY) { + DBG_OBJ_MSGF ("resize", 0, + "<b>checkCoveragePosChanged</b> (<widget: %p>, %d)", + vloat->widget, oldY); + DBG_OBJ_MSG_START (); + // Only this float has been changed (see tellFloatPosition), so // only this float has to be tested against all textblocks. if (wasAllocated (vloat->generatingBlock)) { @@ -1081,6 +1103,8 @@ void OutOfFlowMgr::checkCoveragePosChanged (Float *vloat, int oldY) } } } + + DBG_OBJ_MSG_END (); } void OutOfFlowMgr::getFloatsLists (Float *vloat, SortedFloatsVector **listSame, diff --git a/dw/textblock.cc b/dw/textblock.cc index c0a902f4..fcbfe32b 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -254,14 +254,10 @@ Textblock::Textblock (bool limitTextWidth) anchors = new misc::SimpleVector <Anchor> (1); outOfFlowMgr = NULL; - //DBG_OBJ_SET_NUM(this, "num_lines", num_lines); - wrapRefLines = wrapRefParagraphs = -1; - //DBG_OBJ_SET_NUM(this, "last_line_width", last_line_width); - //DBG_OBJ_SET_NUM(this, "last_line_par_min", last_line_par_min); - //DBG_OBJ_SET_NUM(this, "last_line_par_max", last_line_par_max); - //DBG_OBJ_SET_NUM(this, "wrap_ref", wrap_ref); + DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); + DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs); hoverLink = -1; @@ -610,6 +606,9 @@ void Textblock::resizeDrawImpl () void Textblock::markSizeChange (int ref) { + DBG_OBJ_MSGF ("resize", 1, "<b>markSizeChange</b> (%d)", ref); + DBG_OBJ_MSG_START (); + if (OutOfFlowMgr::isRefOutOfFlow (ref)) { assert (outOfFlowMgr != NULL); outOfFlowMgr->markSizeChange (ref); @@ -630,7 +629,7 @@ void Textblock::markSizeChange (int ref) OutOfFlowMgr::getLineNoFromRef (ref)); } - PRINTF (" ... => %d\n", wrapRefLine); + DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); // It seems that sometimes (even without floats) the lines // structure is changed, so that wrapRefLines may refers to a @@ -639,11 +638,14 @@ void Textblock::markSizeChange (int ref) // a workaround. markExtremesChange (ref); } + + DBG_OBJ_MSG_END (); } void Textblock::markExtremesChange (int ref) { - PRINTF ("[%p] MARK_SIZE_CHANGE (%d): %d => ...\n", this, ref, wrapRefLines); + DBG_OBJ_MSGF ("resize", 1, "<b>markExtremesChange</b> (%d)", ref); + DBG_OBJ_MSG_START (); if (OutOfFlowMgr::isRefOutOfFlow (ref)) { assert (outOfFlowMgr != NULL); @@ -666,8 +668,10 @@ void Textblock::markExtremesChange (int ref) OutOfFlowMgr::getLineNoFromRef (ref)); } - PRINTF (" ... => %d\n", wrapRefParagraphs); + DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs); } + + DBG_OBJ_MSG_END (); } void Textblock::notifySetAsTopLevel() @@ -725,43 +729,43 @@ void Textblock::setWidth (int width) /* If limitTextWidth is set to YES, a queueResize() may also be * necessary. */ if (availWidth != width || limitTextWidth) { - //DEBUG_MSG(DEBUG_REWRAP_LEVEL, - // "setWidth: Calling queueResize, " - // "in page with %d word(s)\n", - // words->size()); + DBG_OBJ_MSGF ("resize", 0, "<b>setWidth</b> (%d)", width); + DBG_OBJ_MSG_START (); availWidth = width; queueResize (OutOfFlowMgr::createRefNormalFlow (0), false); mustQueueResize = false; redrawY = 0; + + DBG_OBJ_MSG_END (); } } void Textblock::setAscent (int ascent) { if (availAscent != ascent) { - //DEBUG_MSG(DEBUG_REWRAP_LEVEL, - // "setAscent: Calling queueResize, " - // "in page with %d word(s)\n", - // words->size()); + DBG_OBJ_MSGF ("resize", 0, "<b>setAscent</b> (%d)", ascent); + DBG_OBJ_MSG_START (); availAscent = ascent; queueResize (OutOfFlowMgr::createRefNormalFlow (0), false); mustQueueResize = false; + + DBG_OBJ_MSG_END (); } } void Textblock::setDescent (int descent) { if (availDescent != descent) { - //DEBUG_MSG(DEBUG_REWRAP_LEVEL, - // "setDescent: Calling queueResize, " - // "in page with %d word(s)\n", - // words->size()); + DBG_OBJ_MSGF ("resize", 0, "<b>setDescent</b> (%d)", descent); + DBG_OBJ_MSG_START (); availDescent = descent; queueResize (OutOfFlowMgr::createRefNormalFlow (0), false); mustQueueResize = false; + + DBG_OBJ_MSG_END (); } } @@ -2134,8 +2138,10 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) PRINTF ("adding the %s %p to %p (word %d) ...\n", widget->getClassName(), widget, this, words->size()); - if (containingBlock->outOfFlowMgr == NULL) + if (containingBlock->outOfFlowMgr == NULL) { containingBlock->outOfFlowMgr = new OutOfFlowMgr (containingBlock); + DBG_OBJ_ASSOC (containingBlock, containingBlock->outOfFlowMgr); + } if (OutOfFlowMgr::isWidgetHandledByOOFM (widget)) { PRINTF (" -> out of flow.\n"); @@ -2514,12 +2520,14 @@ void Textblock::handOverBreak (core::style::Style *style) */ void Textblock::flush () { - PRINTF ("[%p] FLUSH => %s (parentRef = %d)\n", - this, mustQueueResize ? "true" : "false", parentRef); - if (mustQueueResize) { + DBG_OBJ_MSG ("resize", 0, "<b>flush</b> (mustQueueResize set)"); + DBG_OBJ_MSG_START (); + queueResize (-1, true); mustQueueResize = false; + + DBG_OBJ_MSG_END (); } } @@ -2626,11 +2634,12 @@ void Textblock::setVerticalOffset (int verticalOffset) */ void Textblock::borderChanged (int y, Widget *vloat) { - PRINTF ("[%p] BORDER_CHANGED: %d (float %s %p, with generator %p)\n", - this, y, vloat->getClassName(), vloat, vloat->getGenerator()); + DBG_OBJ_MSGF ("resize", 0, "<b>borderChanged</b> (%d, %p)", y, vloat); + DBG_OBJ_MSG_START (); int lineIndex = findLineIndex (y); - PRINTF (" Line index: %d (of %d).\n", lineIndex, lines->size ()); + DBG_OBJ_MSGF ("resize", 1, "Line index: %d (of %d).", + lineIndex, lines->size ()); // Nothing to do at all, when lineIndex >= lines->size (), // i. e. the change is below the bottom of this widget. @@ -2642,8 +2651,8 @@ void Textblock::borderChanged (int y, Widget *vloat) else wrapLineIndex = lineIndex; - PRINTF (" Rewrapping from line %d (of %d).\n", - wrapLineIndex, lines->size ()); + DBG_OBJ_MSGF ("resize", 1, "Rewrapping from line %d (of %d).", + wrapLineIndex, lines->size ()); if (vloat->getGenerator() == this) { bool found = false; @@ -2727,11 +2736,13 @@ void Textblock::borderChanged (int y, Widget *vloat) printBorderChangedErrorAndAbort (y, vloat, wrapLineIndex); } - PRINTF (" Corrected to line %d.\n", wrapLineIndex); + DBG_OBJ_MSGF ("resize", 1, "Corrected to line %d.", wrapLineIndex); queueResize (OutOfFlowMgr::createRefNormalFlow (wrapLineIndex), true); lastWordDrawn = lines->getRef(wrapLineIndex)->firstWord; } + + DBG_OBJ_MSG_END (); } void Textblock::printBorderChangedErrorAndAbort (int y, Widget *vloat, diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 1c1a3c1f..1fdd5159 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -23,6 +23,7 @@ #include "textblock.hh" #include "hyphenator.hh" #include "../lout/msg.h" +#include "../lout/debug.hh" #include "../lout/misc.hh" #include <stdio.h> @@ -1409,6 +1410,7 @@ void Textblock::rewrap () /* Next time, the page will not have to be rewrapped. */ wrapRefLines = -1; + DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); } /** @@ -1456,6 +1458,7 @@ void Textblock::fillParagraphs () handleWordExtremes (i); wrapRefParagraphs = -1; + DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs); } void Textblock::initNewLine () diff --git a/dw/widget.cc b/dw/widget.cc index 83b9956a..bf921d31 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -169,6 +169,10 @@ void Widget::queueResize (int ref, bool extremesChanged) { assert (!queueResizeEntered ()); + DBG_OBJ_MSGF ("resize", 0, "<b>queueResize</b> (%d, %s)", + ref, extremesChanged ? "true" : "false"); + DBG_OBJ_MSG_START (); + enterQueueResize (); Widget *widget2, *child; @@ -225,6 +229,8 @@ void Widget::queueResize (int ref, bool extremesChanged) layout->queueResize (); leaveQueueResize (); + + DBG_OBJ_MSG_END (); } @@ -236,6 +242,9 @@ void Widget::sizeRequest (Requisition *requisition) { assert (!queueResizeEntered ()); + DBG_OBJ_MSG ("resize", 0, "<b>sizeRequest</b>"); + DBG_OBJ_MSG_START (); + enterSizeRequest (); //printf ("The %stop-level %s %p with parentRef = %d: needsResize: %s, " @@ -269,6 +278,8 @@ void Widget::sizeRequest (Requisition *requisition) // requisition->width, requisition->ascent, requisition->descent); leaveSizeRequest (); + + DBG_OBJ_MSG_END (); } /** @@ -278,6 +289,9 @@ void Widget::getExtremes (Extremes *extremes) { assert (!queueResizeEntered ()); + DBG_OBJ_MSG ("resize", 0, "<b>getExtremes</b>"); + DBG_OBJ_MSG_START (); + enterGetExtremes (); if (extremesQueued ()) { @@ -300,6 +314,8 @@ void Widget::getExtremes (Extremes *extremes) *extremes = this->extremes; leaveGetExtremes (); + + DBG_OBJ_MSG_END (); } /** @@ -313,6 +329,11 @@ void Widget::sizeAllocate (Allocation *allocation) assert (!getExtremesEntered ()); assert (resizeIdleEntered ()); + DBG_OBJ_MSGF ("resize", 0, "<b>sizeAllocate</b> ((%d, %d; %d * (%d + %d))", + allocation->x, allocation->y, allocation->width, + allocation->ascent, allocation->descent); + DBG_OBJ_MSG_START (); + enterSizeAllocate (); /*printf ("The %stop-level %s %p is allocated:\n", @@ -367,6 +388,8 @@ void Widget::sizeAllocate (Allocation *allocation) /*unsetFlags (NEEDS_RESIZE);*/ leaveSizeAllocate (); + + DBG_OBJ_MSG_END (); } bool Widget::buttonPress (EventButton *event) diff --git a/lout/debug.hh b/lout/debug.hh index bbbe401b..adc9c0a5 100644 --- a/lout/debug.hh +++ b/lout/debug.hh @@ -38,7 +38,9 @@ #include <unistd.h> #include <stdio.h> -#define RTFL_PREFIX_FMT "[rtfl]%s:%d:%d:" +// "\n" at the beginning just in case that the previous line is not finished +// yet. +#define RTFL_PREFIX_FMT "\n[rtfl]%s:%d:%d:" #define RTFL_PREFIX_ARGS __FILE__, __LINE__, getpid() #define DBG_OBJ_MSG(aspect, prio, msg) \ |