aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/iterator.cc9
-rw-r--r--dw/iterator.hh2
-rw-r--r--dw/textblock_linebreaking.cc24
-rw-r--r--dw/types.cc45
-rw-r--r--dw/types.hh2
5 files changed, 59 insertions, 23 deletions
diff --git a/dw/iterator.cc b/dw/iterator.cc
index b6fde502..019d8e07 100644
--- a/dw/iterator.cc
+++ b/dw/iterator.cc
@@ -186,6 +186,15 @@ void Iterator::scrollTo (Iterator *it1, Iterator *it2, int start, int end,
}
}
+
+void Iterator::print ()
+{
+ printf ("in the %s %p, mask ", widget->getClassName(), widget);
+ Content::printMask (mask);
+ printf (", pointing at ");
+ Content::print (&content);
+}
+
// -------------------
// EmptyIterator
// -------------------
diff --git a/dw/iterator.hh b/dw/iterator.hh
index 222a05c0..12c3d4ac 100644
--- a/dw/iterator.hh
+++ b/dw/iterator.hh
@@ -85,6 +85,8 @@ public:
static void scrollTo (Iterator *it1, Iterator *it2, int start, int end,
HPosition hpos, VPosition vpos);
+
+ void print ();
};
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 99552b3d..b8a10207 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -210,29 +210,7 @@ void Textblock::BadnessAndPenalty::print ()
void Textblock::printWordShort (Word *word)
{
- switch(word->content.type) {
- case core::Content::TEXT:
- printf ("\"%s\"", word->content.text);
- break;
- case core::Content::WIDGET_IN_FLOW:
- printf ("<widget in flow: %p (%s)>",
- word->content.widget, word->content.widget->getClassName());
- break;
- case core::Content::WIDGET_OOF_REF:
- printf ("<widget oof ref: %p (%s)>",
- word->content.widget, word->content.widget->getClassName());
- break;
- case core::Content::WIDGET_OOF_CONT:
- printf ("<widge oof cont: %p (%s)>",
- word->content.widget, word->content.widget->getClassName());
- break;
- case core::Content::BREAK:
- printf ("<break>");
- break;
- default:
- printf ("<?>");
- break;
- }
+ core::Content::print (&(word->content));
}
void Textblock::printWordFlags (short flags)
diff --git a/dw/types.cc b/dw/types.cc
index dc243ad7..4835f95b 100644
--- a/dw/types.cc
+++ b/dw/types.cc
@@ -276,5 +276,50 @@ Content::Type Content::maskForSelection (bool followReferences)
return (Content::Type)(Content::SELECTION_CONTENT | widgetMask);
}
+void Content::print (Content *content)
+{
+ switch(content->type) {
+ case START:
+ printf ("<start>");
+ break;
+ case END:
+ printf ("<end>");
+ break;
+ case TEXT:
+ printf ("\"%s\"", content->text);
+ break;
+ case WIDGET_IN_FLOW:
+ printf ("<widget in flow: %p (%s)>",
+ content->widget, content->widget->getClassName());
+ break;
+ case WIDGET_OOF_REF:
+ printf ("<widget oof ref: %p (%s)>",
+ content->widget, content->widget->getClassName());
+ break;
+ case WIDGET_OOF_CONT:
+ printf ("<widge oof cont: %p (%s)>",
+ content->widget, content->widget->getClassName());
+ break;
+ case BREAK:
+ printf ("<break>");
+ break;
+ default:
+ printf ("<?>");
+ break;
+ }
+}
+
+void Content::printMask (Type mask)
+{
+ printf ("%s:%s:%s:%s:%s:%s:%s",
+ (mask & START) ? "st" : "--",
+ (mask & END) ? "en" : "--",
+ (mask & TEXT) ? "tx" : "--",
+ (mask & WIDGET_IN_FLOW) ? "wf" : "--",
+ (mask & WIDGET_OOF_REF) ? "Wr" : "--",
+ (mask & WIDGET_OOF_CONT) ? "Wc" : "--",
+ (mask & BREAK) ? "br" : "--");
+}
+
} // namespace dw
} // namespace core
diff --git a/dw/types.hh b/dw/types.hh
index 514733a5..e933a98c 100644
--- a/dw/types.hh
+++ b/dw/types.hh
@@ -223,6 +223,8 @@ struct Content
};
static Content::Type maskForSelection (bool followReferences);
+ static void print (Content *content);
+ static void printMask (Type mask);
};
} // namespace dw