aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/textblock.cc22
-rw-r--r--dw/widget.cc6
-rw-r--r--dw/widget.hh82
3 files changed, 107 insertions, 3 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 5b634cb1..540df6a9 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -236,7 +236,9 @@ Textblock::Textblock (bool limitTextWidth)
ignoreLine1OffsetSometimes = false;
mustQueueResize = false;
redrawY = 0;
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
lastWordDrawn = -1;
+ DBG_OBJ_SET_NUM ("lastWordDrawn", lastWordDrawn);
/*
* The initial sizes of lines and words should not be
@@ -504,6 +506,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
if (allocation->width != this->allocation.width) {
redrawY = 0;
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
for (lineIndex = 0; lineIndex < lines->size (); lineIndex++) {
@@ -516,6 +519,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
if (wordIndex == lastWordDrawn + 1) {
redrawY = misc::min (redrawY, lineYOffsetWidget (line));
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
if (word->content.type == core::Content::WIDGET_IN_FLOW) {
@@ -548,9 +552,11 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
* so we need to redraw from this line onwards.
*/
redrawY = misc::min (redrawY, lineYOffsetWidget (line));
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
if (word->content.widget->wasAllocated ()) {
redrawY = misc::min (redrawY,
oldChildAllocation->y - this->allocation.y);
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
} else if (childAllocation.ascent + childAllocation.descent !=
@@ -580,8 +586,10 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
oldChildAllocation->descent);
redrawY = misc::min (redrawY, childChangedY);
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
} else {
redrawY = misc::min (redrawY, lineYOffsetWidget (line));
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
}
word->content.widget->sizeAllocate (&childAllocation);
@@ -613,6 +621,9 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
void Textblock::resizeDrawImpl ()
{
+ DBG_OBJ_MSG ("draw", 0, "<b>resizeDrawImpl</b> ()");
+ DBG_OBJ_MSG_START ();
+
queueDrawArea (0, redrawY, allocation.width, getHeight () - redrawY);
if (lines->size () > 0) {
Line *lastLine = lines->getRef (lines->size () - 1);
@@ -620,9 +631,13 @@ void Textblock::resizeDrawImpl ()
* draw any new added words (see sizeAllocateImpl()).
*/
lastWordDrawn = lastLine->lastWord;
+ DBG_OBJ_SET_NUM ("lastWordDrawn", lastWordDrawn);
}
redrawY = getHeight ();
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
+
+ DBG_OBJ_MSG_END ();
}
void Textblock::markSizeChange (int ref)
@@ -758,6 +773,7 @@ void Textblock::setWidth (int width)
queueResize (OutOfFlowMgr::createRefNormalFlow (0), false);
mustQueueResize = false;
redrawY = 0;
+ DBG_OBJ_SET_NUM ("redrawY", redrawY);
DBG_OBJ_MSG_END ();
}
@@ -2879,6 +2895,12 @@ void Textblock::borderChanged (int y, Widget *vloat)
else
lastWordDrawn = misc::min (lastWordDrawn,
lines->getRef(wrapLineIndex - 1)->lastWord);
+ DBG_OBJ_SET_NUM ("lastWordDrawn", lastWordDrawn);
+
+ // TODO Is the following necessary? Or even useless?
+ //redrawY =
+ // misc::min (redrawY, lineYOffsetWidget (lines->getRef (wrapLineIndex)));
+ //DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
DBG_OBJ_MSG_END ();
diff --git a/dw/widget.cc b/dw/widget.cc
index d3223e67..0ef1fc78 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -370,6 +370,12 @@ void Widget::sizeAllocate (Allocation *allocation)
allocation->ascent, allocation->descent);
DBG_OBJ_MSG_START ();
+ DBG_OBJ_MSGF ("resize", 1,
+ "old allocation (%d, %d; %d * (%d + %d)); needsAllocate: %s",
+ this->allocation.x, this->allocation.y, this->allocation.width,
+ this->allocation.ascent, this->allocation.descent,
+ needsAllocate () ? "true" : "false");
+
enterSizeAllocate ();
/*printf ("The %stop-level %s %p is allocated:\n",
diff --git a/dw/widget.hh b/dw/widget.hh
index e7ac7f55..e3d9cbe1 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -34,7 +34,7 @@ protected:
/**
* \todo Comment this.
*/
- EXTREMES_QUEUED = 1 << 1,
+ EXTREMES_QUEUED = 1 << 1,
/**
* \brief Set, when dw::core::Widget::requisition is not up to date
@@ -191,8 +191,84 @@ protected:
Layout *layout;
- inline void setFlags (Flags f) { flags = (Flags)(flags | f); }
- inline void unsetFlags (Flags f) { flags = (Flags)(flags & ~f); }
+ /*inline void printFlags () {
+ DBG_IF_RTFL {
+ char buf[10 * 3 - 1 + 1];
+ snprintf (buf, sizeof (buf), "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s",
+ (flags & RESIZE_QUEUED) ? "Rq" : "--",
+ (flags & EXTREMES_QUEUED) ? "Eq" : "--",
+ (flags & NEEDS_RESIZE) ? "nR" : "--",
+ (flags & NEEDS_ALLOCATE) ? "nA" : "--",
+ (flags & ALLOCATE_QUEUED) ? "Aq" : "--",
+ (flags & EXTREMES_CHANGED) ? "Ec" : "--",
+ (flags & USES_HINTS) ? "uh" : "--",
+ (flags & HAS_CONTENTS) ? "hc" : "--",
+ (flags & WAS_ALLOCATED) ? "wA" : "--",
+ (flags & BLOCK_LEVEL) ? "bl" : "--");
+ DBG_OBJ_SET_SYM ("flags", buf);
+ }
+ }*/
+
+ inline void printFlag (Flags f) {
+ DBG_IF_RTFL {
+ switch (f) {
+ case RESIZE_QUEUED:
+ DBG_OBJ_SET_SYM ("flags.RESIZE_QUEUED",
+ (flags & RESIZE_QUEUED) ? "true" : "false");
+ break;
+
+ case EXTREMES_QUEUED:
+ DBG_OBJ_SET_SYM ("flags.EXTREMES_QUEUED",
+ (flags & EXTREMES_QUEUED) ? "true" : "false");
+ break;
+
+ case NEEDS_RESIZE:
+ DBG_OBJ_SET_SYM ("flags.NEEDS_RESIZE",
+ (flags & NEEDS_RESIZE) ? "true" : "false");
+ break;
+
+ case NEEDS_ALLOCATE:
+ DBG_OBJ_SET_SYM ("flags.NEEDS_ALLOCATE",
+ (flags & NEEDS_ALLOCATE) ? "true" : "false");
+ break;
+
+ case ALLOCATE_QUEUED:
+ DBG_OBJ_SET_SYM ("flags.ALLOCATE_QUEUED",
+ (flags & ALLOCATE_QUEUED) ? "true" : "false");
+ break;
+
+ case EXTREMES_CHANGED:
+ DBG_OBJ_SET_SYM ("flags.EXTREMES_CHANGED",
+ (flags & EXTREMES_CHANGED) ? "true" : "false");
+ break;
+
+ case USES_HINTS:
+ DBG_OBJ_SET_SYM ("flags.USES_HINTS",
+ (flags & USES_HINTS) ? "true" : "false");
+ break;
+
+ case HAS_CONTENTS:
+ DBG_OBJ_SET_SYM ("flags.HAS_CONTENTS",
+ (flags & HAS_CONTENTS) ? "true" : "false");
+ break;
+
+ case WAS_ALLOCATED:
+ DBG_OBJ_SET_SYM ("flags.WAS_ALLOCATED",
+ (flags & WAS_ALLOCATED) ? "true" : "false");
+ break;
+
+ case BLOCK_LEVEL:
+ DBG_OBJ_SET_SYM ("flags.BLOCK_LEVEL",
+ (flags & BLOCK_LEVEL) ? "true" : "false");
+ break;
+ }
+ }
+ }
+
+ inline void setFlags (Flags f)
+ { flags = (Flags)(flags | f); printFlag (f); }
+ inline void unsetFlags (Flags f)
+ { flags = (Flags)(flags & ~f); printFlag (f); }
inline void queueDraw ()