aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac9
-rw-r--r--dw/Makefile.am4
-rw-r--r--dw/outofflowmgr.cc55
-rw-r--r--dw/textblock.cc30
-rw-r--r--dw/textblock_linebreaking.cc50
-rw-r--r--lout/debug.hh38
-rw-r--r--src/Makefile.am2
7 files changed, 150 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index 0c4dd953..5d0f919e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,14 @@ AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
+dnl -----------------------------------------------------------------
+dnl Check for absolute path of working directory.
+dnl This is needed for RTFL, to get full the full paths of the source
+dnl file names
+dnl -----------------------------------------------------------------
+dnl
+BASE_CUR_WORKING_DIR=`pwd`
+
dnl --------------------------------------
dnl Check whether to add /usr/local or not
dnl (this is somewhat a religious problem)
@@ -482,6 +490,7 @@ if eval "test x$GCC = xyes"; then
CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions"
fi
+AC_SUBST(BASE_CUR_WORKING_DIR)
AC_SUBST(LIBJPEG_LIBS)
AC_SUBST(LIBJPEG_LDFLAGS)
AC_SUBST(LIBJPEG_CPPFLAGS)
diff --git a/dw/Makefile.am b/dw/Makefile.am
index 47ec5275..5306c5a5 100644
--- a/dw/Makefile.am
+++ b/dw/Makefile.am
@@ -1,7 +1,7 @@
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -DDILLO_LIBDIR='"$(pkglibdir)/"'
-
+ -DDILLO_LIBDIR='"$(pkglibdir)/"' \
+ -DCUR_WORKING_DIR='"@BASE_CUR_WORKING_DIR@/dw"'
noinst_LIBRARIES = \
libDw-core.a \
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index bb7f63da..634422c9 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -355,14 +355,14 @@ OutOfFlowMgr::~OutOfFlowMgr ()
void OutOfFlowMgr::sizeAllocateStart (Allocation *containingBlockAllocation)
{
- DBG_OBJ_MSG ("resize", 0, "<b>sizeAllocateStart</b>");
+ DBG_OBJ_MSG ("resize.floats", 0, "<b>sizeAllocateStart</b>");
this->containingBlockAllocation = *containingBlockAllocation;
containingBlockWasAllocated = true;
}
void OutOfFlowMgr::sizeAllocateEnd ()
{
- DBG_OBJ_MSG ("resize", 0, "<b>sizeAllocateStart</b>");
+ DBG_OBJ_MSG ("resize.floats", 0, "<b>sizeAllocateEnd</b>");
DBG_OBJ_MSG_START ();
// 1. Move floats from GB lists to the one CB list.
@@ -411,6 +411,9 @@ void OutOfFlowMgr::sizeAllocateEnd ()
int c2 = isTextblockCoveredByFloats (tb, tbAllocation->x,
tbAllocation->y, width,
height, &newPos, &newFloat);
+ DBG_OBJ_MSGF ("resize.floats", 0, "%p covered? then: %s, now: %s.",
+ tb, c1 ? "yes" : "no", c2 ? "yes" : "no");
+
if (c1 || c2) {
if (!c1)
tb->borderChanged (newPos, newFloat);
@@ -526,14 +529,20 @@ bool OutOfFlowMgr::isTextblockCoveredByFloat (Float *vloat, Textblock *tb,
void OutOfFlowMgr::checkChangedFloatSizes ()
{
+ DBG_OBJ_MSG ("resize.floats", 0, "<b>checkChangedFloatSizes</b>");
+ DBG_OBJ_MSG_START ();
+
checkChangedFloatSizes (leftFloatsCB);
checkChangedFloatSizes (rightFloatsCB);
+
+ DBG_OBJ_MSG_END ();
}
void OutOfFlowMgr::checkChangedFloatSizes (SortedFloatsVector *list)
{
- DBG_OBJ_MSG ("resize", 0, "<b>checkChangedFloatSizes</b>");
- DBG_OBJ_MSG_START ();
+ DBG_OBJ_MSG ("resize.floats", 0,
+ "<b>checkChangedFloatSizes</b> (<i>list</i>)");
+ DBG_OBJ_MSG_START ();
// TODO (i) Comment (ii) linear search?
for (int i = 0; i < list->size(); i++) {
@@ -542,7 +551,9 @@ void OutOfFlowMgr::checkChangedFloatSizes (SortedFloatsVector *list)
if (vloat->sizeChangedSinceLastAllocation &&
wasAllocated (vloat->generatingBlock)) {
- //printf ("=== start checking textblocks ===\n");
+ DBG_OBJ_MSGF ("resize.floats", 1, "float %p: checking textblocks",
+ vloat->widget);
+ DBG_OBJ_MSG_START ();
for (lout::container::typed::Iterator<TypedPointer <Textblock> > it =
tbInfosByTextblock->iterator ();
@@ -551,25 +562,22 @@ void OutOfFlowMgr::checkChangedFloatSizes (SortedFloatsVector *list)
if (wasAllocated (tb)) {
Allocation *tba = getAllocation (tb);
int floatPos;
-
+
if (isTextblockCoveredByFloat
(vloat, tb, tba->x - containingBlockAllocation.x,
tba->y - containingBlockAllocation.y,
tba->width, tba->ascent + tba->descent, &floatPos)) {
- //printf (" ---> yes: %p (parent: %p)\n", tb,
- // tb->getParent());
+ DBG_OBJ_MSGF ("resize.floats", 2, "%p: covereds", tb);
tb->borderChanged (floatPos, vloat->widget);
- } //else
- // printf (" ---> not covered: %p (parent: %p)\n", tb,
- // tb->getParent());
- } //else
- // printf (" ---> not allocated: %p (parent: %p)\n", tb,
- // tb->getParent());
+ } else
+ DBG_OBJ_MSGF ("resize.floats", 2, "%p: not covered", tb);
+ } else
+ DBG_OBJ_MSGF ("resize.floats", 2, "%p: not allocated", tb);
}
-
- //printf ("=== end checking textblocks ===\n");
vloat->sizeChangedSinceLastAllocation = false;
+
+ DBG_OBJ_MSG_END ();
}
}
@@ -942,7 +950,7 @@ void OutOfFlowMgr::tellPosition (Widget *widget, int yReq)
void OutOfFlowMgr::tellFloatPosition (Widget *widget, int yReq)
{
- DBG_OBJ_MSGF ("resize", 0, "<b>tellFloatPosition</b> (%p, %d)",
+ DBG_OBJ_MSGF ("resize.floats", 0, "<b>tellFloatPosition</b> (%p, %d)",
widget, yReq);
DBG_OBJ_MSG_START ();
@@ -1027,7 +1035,8 @@ void OutOfFlowMgr::tellFloatPosition (Widget *widget, int yReq)
}
}
- DBG_OBJ_MSGF ("resize", 1, "oldY = %d, vloat->yReq = %d, vloat->yReal = %d",
+ DBG_OBJ_MSGF ("resize.floats", 1,
+ "oldY = %d, vloat->yReq = %d, vloat->yReal = %d",
oldY, vloat->yReq, vloat->yReal);
// No call neccessary when yReal has not changed. (Notice that
@@ -1068,10 +1077,10 @@ bool OutOfFlowMgr::collides (Float *vloat, Float *other, int *yReal)
void OutOfFlowMgr::checkCoveragePosChanged (Float *vloat, int oldY)
{
- DBG_OBJ_MSGF ("resize", 0,
+ DBG_OBJ_MSGF ("resize.floats", 0,
"<b>checkCoveragePosChanged</b> (<widget: %p>, %d)",
vloat->widget, oldY);
- DBG_OBJ_MSG_START ();
+ DBG_OBJ_MSG_START ();
// Only this float has been changed (see tellFloatPosition), so
// only this float has to be tested against all textblocks.
@@ -1096,6 +1105,12 @@ void OutOfFlowMgr::checkCoveragePosChanged (Float *vloat, int oldY)
bool covered =
(y2old > tby1 && y1old < tby2) || (y2new > tby1 && y1new < tby2);
+ DBG_OBJ_MSGF ("resize.floats", 0,
+ "%p covered: (%d > %d && %d < %d) || "
+ "(%d > %d && %d < %d? %s.\n",
+ textblock, y2old, tby1, y1old, tby2, y2new, tby1,
+ y1new,tby2, covered ? "Yes" : "No");
+
if (covered) {
int yTextblock = gba->y + min (oldY, vloat->yReal) - tba->y;
textblock->borderChanged (yTextblock, vloat->widget);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index fcbfe32b..468a7a44 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -256,6 +256,8 @@ Textblock::Textblock (bool limitTextWidth)
wrapRefLines = wrapRefParagraphs = -1;
+ DBG_OBJ_SET_NUM ("lines.size", lines->size ());
+ DBG_OBJ_SET_NUM ("words.size", words->size ());
DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines);
DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs);
@@ -1636,6 +1638,7 @@ Textblock::Word *Textblock::addWord (int width, int ascent, int descent,
short flags, core::style::Style *style)
{
words->increase ();
+ DBG_OBJ_SET_NUM ("words.size", words->size ());
int wordNo = words->size () - 1;
initWord (wordNo);
fillWord (wordNo, width, ascent, descent, flags, style);
@@ -2113,6 +2116,10 @@ void Textblock::addText0 (const char *text, size_t len, short flags,
word->content.type = core::Content::TEXT;
word->content.text = layout->textZone->strndup(text, len);
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "TEXT");
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1,
+ "text/widget/breakSpace", word->content.text);
+
// The following debug message may be useful to identify the
// different textblocks.
@@ -2154,6 +2161,11 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style)
word->content.type = core::Content::WIDGET_OOF_REF;
word->content.widget = widget;
word->style = style;
+
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type",
+ "WIDGET_OOF_REF");
+ DBG_OBJ_ARRATTRSET_PTR ("words", words->size () - 1,
+ "text/widget/breakSpace", word->content.widget);
} else {
PRINTF (" -> within flow.\n");
@@ -2166,10 +2178,14 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style)
core::Requisition size;
calcWidgetSize (widget, &size);
- Word *word =
- addWord (size.width, size.ascent, size.descent, 0, style);
+ Word *word = addWord (size.width, size.ascent, size.descent, 0, style);
word->content.type = core::Content::WIDGET_IN_FLOW;
word->content.widget = widget;
+
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type",
+ "WIDGET_IN_FLOW");
+ DBG_OBJ_ARRATTRSET_PTR ("words", words->size () - 1,
+ "text/widget/breakSpace", word->content.widget);
}
processWord (words->size () - 1);
@@ -2413,6 +2429,11 @@ void Textblock::addParbreak (int space, core::style::Style *style)
word->content.type = core::Content::BREAK;
word->badnessAndPenalty.setPenalty (PENALTY_FORCE_BREAK);
word->content.breakSpace = space;
+
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "BREAK");
+ DBG_OBJ_ARRATTRSET_NUM ("words", words->size () - 1,
+ "text/widget/breakSpace", word->content.breakSpace);
+
processWord (words->size () - 1);
}
@@ -2436,6 +2457,11 @@ void Textblock::addLinebreak (core::style::Style *style)
word->content.type = core::Content::BREAK;
word->badnessAndPenalty.setPenalty (PENALTY_FORCE_BREAK);
word->content.breakSpace = 0;
+
+ DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "BREAK");
+ DBG_OBJ_ARRATTRSET_NUM ("words", words->size () - 1,
+ "text/widget/breakSpace", word->content.breakSpace);
+
processWord (words->size () - 1);
}
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 1fdd5159..e18b637a 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -325,9 +325,10 @@ void Textblock::justifyLine (Line *line, int diff)
Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
bool temporary)
{
- PRINTF ("[%p] ADD_LINE (%d, %d) => %d\n",
- this, firstWord, lastWord, lines->size ());
-
+ 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));
@@ -448,6 +449,7 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
initNewLine ();
+ DBG_OBJ_MSG_END ();
return line;
}
@@ -524,8 +526,9 @@ void Textblock::processWord (int wordIndex)
*/
bool Textblock::wordWrap (int wordIndex, bool wrapAll)
{
- PRINTF ("[%p] WORD_WRAP (%d, %s)\n",
- this, wordIndex, wrapAll ? "true" : "false");
+ DBG_OBJ_MSGF ("construct.word", 0, "<b>wordWrap</b> (%d, %s)",
+ wordIndex, wrapAll ? "true" : "false");
+ DBG_OBJ_MSG_START ();
if (!wrapAll)
removeTemporaryLines ();
@@ -541,19 +544,28 @@ bool Textblock::wordWrap (int wordIndex, bool wrapAll)
//printWord (word);
//printf ("\n");
+ bool b;
switch (word->content.type) {
case core::Content::WIDGET_OOF_REF:
- return wrapWordOofRef (wordIndex, wrapAll);
+ b = wrapWordOofRef (wordIndex, wrapAll);
break;
default:
- return wrapWordInFlow (wordIndex, wrapAll);
+ b = wrapWordInFlow (wordIndex, wrapAll);
break;
}
+
+ DBG_OBJ_MSG_END ();
+
+ return b;
}
bool Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
{
+ DBG_OBJ_MSGF ("construct.word", 0, "<b>wrapWordInFlow</b> (%d, %s)",
+ wordIndex, wrapAll ? "true" : "false");
+ DBG_OBJ_MSG_START ();
+
Word *word = words->getRef (wordIndex);
bool wordListChanged = false;
@@ -732,6 +744,8 @@ bool Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
}
}
+ DBG_OBJ_MSG_END ();
+
return wordListChanged;
}
@@ -759,6 +773,10 @@ void Textblock::checkPossibleLineHeightChange (int wordIndex)
bool Textblock::wrapWordOofRef (int wordIndex, bool wrapAll)
{
+ DBG_OBJ_MSGF ("construct.word", 0, "<b>wrapWordOofRef</b> (%d, %s)",
+ wordIndex, wrapAll ? "true" : "false");
+ DBG_OBJ_MSG_START ();
+
assert (containingBlock->outOfFlowMgr);
int y = yOffsetOfPossiblyMissingLine (lines->size ());
@@ -774,6 +792,9 @@ bool Textblock::wrapWordOofRef (int wordIndex, bool wrapAll)
if (left || right)
updateBorders (wordIndex, left, right);
+
+ DBG_OBJ_MSG_END ();
+
return false; // Actually, the words list is never changed here.
}
@@ -1037,6 +1058,15 @@ int Textblock::hyphenateWord (int wordIndex)
PRINTF ("[%p] %d words ...\n", this, words->size ());
words->insert (wordIndex, numBreaks);
+
+#ifdef DBG_RTFL
+ // TODO Must be corrected.
+ for (int i = wordIndex + numBreaks; i < words->size (); i++) {
+ DBG_OBJ_ARRATTRSET_STR ("words", i, "type", "???");
+ DBG_OBJ_ARRATTRSET_STR ("words", i, "text/widget/breakSpace", "???");
+ }
+#endif
+
for (int i = 0; i < numBreaks; i++)
initWord (wordIndex + i);
PRINTF ("[%p] ... => %d words\n", this, words->size ());
@@ -1068,6 +1098,10 @@ int Textblock::hyphenateWord (int wordIndex)
end - start);
PRINTF (" [%d] -> '%s'\n", wordIndex + i, w->content.text);
+ DBG_OBJ_ARRATTRSET_STR ("words", wordIndex + i, "type", "TEXT");
+ DBG_OBJ_ARRATTRSET_STR ("words", wordIndex + i,
+ "text/widget/breakSpace", w->content.text);
+
// Note: there are numBreaks + 1 word parts.
if (i == 0)
w->flags |= Word::WORD_START;
@@ -1377,6 +1411,7 @@ void Textblock::rewrap ()
/* All lines up from wrapRef will be rebuild from the word list,
* the line list up from this position is rebuild. */
lines->setSize (wrapRefLines);
+ DBG_OBJ_SET_NUM ("lines.size", lines->size ());
nonTemporaryLines = misc::min (nonTemporaryLines, wrapRefLines);
initNewLine ();
@@ -1518,6 +1553,7 @@ void Textblock::showMissingLines ()
void Textblock::removeTemporaryLines ()
{
lines->setSize (nonTemporaryLines);
+ DBG_OBJ_SET_NUM ("lines.size", lines->size ());
}
int Textblock::getSpaceShrinkability(struct Word *word)
diff --git a/lout/debug.hh b/lout/debug.hh
index adc9c0a5..f78012f5 100644
--- a/lout/debug.hh
+++ b/lout/debug.hh
@@ -41,7 +41,7 @@
// "\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 RTFL_PREFIX_ARGS CUR_WORKING_DIR "/" __FILE__, __LINE__, getpid()
#define DBG_OBJ_MSG(aspect, prio, msg) \
D_STMT_START { \
@@ -129,22 +129,43 @@
#define DBG_OBJ_ARRSET_NUM(var, ind, val) \
D_STMT_START { \
- printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%d\n", \
- RTFL_PREFIX_ARGS, this, ind, val); \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:%d\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, val); \
fflush (stdout); \
} D_STMT_END
#define DBG_OBJ_ARRSET_STR(var, ind, val) \
D_STMT_START { \
- printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%s\n", \
- RTFL_PREFIX_ARGS, this, ind, val); \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:%s\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, val); \
fflush (stdout); \
} D_STMT_END
#define DBG_OBJ_ARRSET_PTR(var, ind, val) \
D_STMT_START { \
- printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%p\n", \
- RTFL_PREFIX_ARGS, this, ind, val); \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:%p\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
+#define DBG_OBJ_ARRATTRSET_NUM(var, ind, attr, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:%d\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, attr, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
+#define DBG_OBJ_ARRATTRSET_STR(var, ind, attr, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:%s\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, attr, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
+#define DBG_OBJ_ARRATTRSET_PTR(var, ind, attr, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:%p\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, attr, val); \
fflush (stdout); \
} D_STMT_END
@@ -172,6 +193,9 @@
#define DBG_OBJ_ARRSET_NUM(var, ind, val)
#define DBG_OBJ_ARRSET_STR(var, ind, val)
#define DBG_OBJ_ARRSET_PTR(var, ind, val)
+#define DBG_OBJ_ARRATTRSET_NUM(var, ind, attr, val)
+#define DBG_OBJ_ARRATTRSET_STR(var, ind, attr, val)
+#define DBG_OBJ_ARRATTRSET_PTR(var, ind, attr, val)
#define DBG_OBJ_COLOR(klass, color)
#endif /* DBG_RTFL */
diff --git a/src/Makefile.am b/src/Makefile.am
index 65a42cad..16398f21 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,9 @@ AM_CPPFLAGS= \
-I$(top_srcdir) \
-DDILLO_SYSCONF='"$(sysconfdir)/"' \
-DDILLO_DOCDIR='"$(docdir)/"' \
+ -DCUR_WORKING_DIR='"@BASE_CUR_WORKING_DIR@/src"'
@LIBJPEG_CPPFLAGS@
+
AM_CFLAGS = @LIBPNG_CFLAGS@
AM_CXXFLAGS = @LIBPNG_CFLAGS@ @LIBFLTK_CXXFLAGS@