aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/textblock.hh24
-rw-r--r--dw/textblock_linebreaking.cc11
2 files changed, 28 insertions, 7 deletions
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 46270b57..6b4c3d1e 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -802,6 +802,30 @@ public:
} \
} D_STMT_END
+#define DBG_MSG_WORD(aspect, prio, prefix, n, suffix) \
+ D_STMT_START { \
+ switch (words->getRef(n)->content.type) { \
+ case ::dw::core::Content::TEXT: \
+ DBG_OBJ_MSGF (aspect, prio, prefix "TEXT / \"%s\"" suffix, \
+ words->getRef(n)->content.text); \
+ break; \
+ case ::dw::core::Content::WIDGET_IN_FLOW: \
+ DBG_OBJ_MSGF (aspect, prio, prefix "WIDGET_IN_FLOW / %p" suffix, \
+ words->getRef(n)->content.widget); \
+ break; \
+ case ::dw::core::Content::WIDGET_OOF_REF: \
+ DBG_OBJ_MSGF (aspect, prio, prefix "WIDGET_OOF_REF / %p" suffix, \
+ words->getRef(n)->content.widget); \
+ break; \
+ case ::dw::core::Content::BREAK: \
+ DBG_OBJ_MSGF (aspect, prio, prefix "BREAK / %d" suffix, \
+ words->getRef(n)->content.breakSpace); \
+ break; \
+ default: \
+ DBG_OBJ_MSG (aspect, prio, prefix "??? / ???"); \
+ } \
+ } D_STMT_END
+
} // namespace dw
#endif // __DW_TEXTBLOCK_HH__
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 40e4d523..6fb5d156 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -328,15 +328,12 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
DBG_OBJ_MSGF ("construct.line", 0, "<b>addLine</b> (%d, %d) => %d",
firstWord, lastWord, lines->size ());
DBG_OBJ_MSG_START ();
-
- //for (int i = firstWord; i <= lastWord; i++) {
- // printf (" word %d: ", i);
- // printWord (words->getRef (i));
- // printf ("\n");
- //}
-
+
int lineWidth;
if (lastWord >= firstWord) {
+ DBG_MSG_WORD ("construct.line", 1, "<i>first word:</i> ", firstWord, "");
+ DBG_MSG_WORD ("construct.line", 1, "<i>last word:</i> ", lastWord, "");
+
Word *lastWordOfLine = words->getRef(lastWord);
PRINTF (" words[%d]->totalWidth = %d\n", lastWord,
lastWordOfLine->totalWidth);