diff options
-rw-r--r-- | dw/outofflowmgr.cc | 43 | ||||
-rw-r--r-- | lout/debug.hh | 35 |
2 files changed, 57 insertions, 21 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 83431da3..1c41df78 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1631,29 +1631,37 @@ int OutOfFlowMgr::getRightBorder (Textblock *textblock, int y, int h, int OutOfFlowMgr::getBorder (Textblock *textblock, Side side, int y, int h, Textblock *lastGB, int lastExtIndex) { - //printf ("[%p] GET_BORDER (%p (allocated: %s), %s, %d, %d, %p, %d)\n", - // containingBlock, textblock, - // wasAllocated (textblock) ? "true" : "false", - // side == LEFT ? "LEFT" : "RIGHT", y, h, lastGB, lastExtIndex); + DBG_OBJ_MSGF_O ("border", 0, textblock, + "<b>getBorder</b> (%s, %d, %d, %p, %d)\n", + side == LEFT ? "LEFT" : "RIGHT", y, h, lastGB, lastExtIndex); + DBG_OBJ_MSG_START_O (textblock); SortedFloatsVector *list = getFloatsListForTextblock (textblock, side); - //printf (" searching in list:\n"); - //for (int i = 0; i < list->size(); i++) { - // printf (" %d: %s\n", i, list->get(i)->toString()); - // //printf (" (widget at (%d, %d))\n", - // // list->get(i)->widget->getAllocation()->x, - // // list->get(i)->widget->getAllocation()->y); - //} +#ifdef RTFL_ENABLED + DBG_OBJ_MSG_O ("border", 1, textblock, "searching in list:"); + DBG_OBJ_MSG_START_O (textblock); + + for (int i = 0; i < list->size(); i++) { + DBG_OBJ_MSGF_O ("border", 1, textblock, "%d: %s\n", + i, list->get(i)->toString()); + DBG_OBJ_MSGF_O ("border", 1, textblock, "(widget at (%d, %d))\n", + list->get(i)->widget->getAllocation()->x, + list->get(i)->widget->getAllocation()->y); + } + + DBG_OBJ_MSG_END_O (textblock); +#endif int first = list->findFirst (textblock, y, h, lastGB, lastExtIndex); - //printf (" first = %d\n", first); + DBG_OBJ_MSGF_O ("border", 1, textblock, "first = %d\n", first); - if (first == -1) + if (first == -1) { // No float. + DBG_OBJ_MSG_END_O (textblock); return 0; - else { + } else { // It is not sufficient to find the first float, since a line // (with height h) may cover the region of multiple float, of // which the widest has to be choosen. @@ -1663,8 +1671,8 @@ int OutOfFlowMgr::getBorder (Textblock *textblock, Side side, int y, int h, for (int i = first; covers && i < list->size(); i++) { Float *vloat = list->get(i); covers = vloat->covers (textblock, y, h); - //printf (" float %d: %s; covers? %s.\n", - // i, vloat->toString(), covers ? "yes" : "no"); + DBG_OBJ_MSGF_O ("border", 1, textblock, "float %d: %s; covers? %s.\n", + i, vloat->toString(), covers ? "yes" : "no"); if (covers) { int borderDiff = getBorderDiff (textblock, vloat, side); @@ -1672,10 +1680,11 @@ int OutOfFlowMgr::getBorder (Textblock *textblock, Side side, int y, int h, vloat->generatingBlock->getStyle()->boxOffsetX() : vloat->generatingBlock->getStyle()->boxRestWidth(); border = max (border, vloat->size.width + borderIn + borderDiff); - //printf (" => border = %d\n", border); + DBG_OBJ_MSGF_O ("border", 1, textblock, "=> border = %d\n", border); } } + DBG_OBJ_MSG_END_O (textblock); return border; } } diff --git a/lout/debug.hh b/lout/debug.hh index 98823b52..f2a4f92e 100644 --- a/lout/debug.hh +++ b/lout/debug.hh @@ -50,6 +50,15 @@ fflush (stdout); \ } D_STMT_END +// Variant which does not use "this", but an explicitly passed +// object. Should be applied to other macros. (Also, for use in C.) +#define DBG_OBJ_MSG_O(aspect, prio, obj, msg) \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:%s\n", \ + RTFL_PREFIX_ARGS, obj, aspect, prio, msg); \ + fflush (stdout); \ + } D_STMT_END + #define DBG_OBJ_MSGF(aspect, prio, fmt, ...) \ D_STMT_START { \ printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:" fmt "\n", \ @@ -57,8 +66,7 @@ fflush (stdout); \ } D_STMT_END -// Variant which does not use "this", but an explicitly passed -// object. Should be applied to other macros. (Also, for use in C.) +// See DBG_OBJ_MSG_O. #define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt, ...) \ D_STMT_START { \ printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:" fmt "\n", \ @@ -73,6 +81,14 @@ fflush (stdout); \ } D_STMT_END +// See DBG_OBJ_MSG_O. +#define DBG_OBJ_MSG_START_O(obj) \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg-start:%p\n", \ + RTFL_PREFIX_ARGS, obj); \ + fflush (stdout); \ + } D_STMT_END + #define DBG_OBJ_MSG_END() \ D_STMT_START { \ printf (RTFL_PREFIX_FMT "obj-msg-end:%p\n", \ @@ -80,6 +96,14 @@ fflush (stdout); \ } D_STMT_END +// See DBG_OBJ_MSG_O. +#define DBG_OBJ_MSG_END_O(obj) \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg-end:%p\n", \ + RTFL_PREFIX_ARGS, obj); \ + fflush (stdout); \ + } D_STMT_END + #define DBG_OBJ_CREATE(klass) \ D_STMT_START { \ printf (RTFL_PREFIX_FMT "obj-create:%p:%s\n", \ @@ -188,10 +212,13 @@ #else /* DBG_RTFL */ #define DBG_OBJ_MSG(aspect, prio, msg) +#define DBG_OBJ_MSG_O(aspect, prio, obj, msg) #define DBG_OBJ_MSGF(aspect, prio, fmt, ...) #define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt, ...) -#define DBG_OBJ_MSG_START(obj) -#define DBG_OBJ_MSG_END(obj) +#define DBG_OBJ_MSG_START() +#define DBG_OBJ_MSG_START_O(obj) +#define DBG_OBJ_MSG_END() +#define DBG_OBJ_MSG_END_O(obj) #define DBG_OBJ_CREATE(klass) #define DBG_OBJ_BASECLASS(klass) #define DBG_OBJ_ASSOC_PARENT(parent) |