diff options
author | Sebastian Geerken <devnull@localhost> | 2016-04-03 11:01:25 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2016-04-03 11:01:25 +0200 |
commit | 39534a46edef08b4a9e03dce5e65d8f4132e6b8d (patch) | |
tree | 6ca22c88302a51ad22a2a0e4b3a8f82957f49bd1 /dw | |
parent | ae8b2b7492d2166358fa8aadaa2ef17aedb28b6b (diff) |
WidgetReference: set parentRef.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/textblock_linebreaking.cc | 20 | ||||
-rw-r--r-- | dw/types.hh | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 1ef4b932..f4789619 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -881,6 +881,21 @@ int Textblock::wrapWordOofRef (int wordIndex, bool wrapAll) oofm->tellIncompletePosition1 (widget, this, xRel, yRel); } + if(word->content.type == core::Content::WIDGET_OOF_REF) { + // Set parentRef for the referred widget. Cf. wrapWordInFlow. + int firstWordWithoutLine; + if (lines->size() == 0) + firstWordWithoutLine = 0; + else + firstWordWithoutLine = lines->getLastRef()->lastWord + 1; + + if (wordIndex >= firstWordWithoutLine) { + word->content.widgetReference->parentRef = + makeParentRefInFlow (lines->size ()); + DBG_SET_WORD (wordIndex); + } + } + DBG_OBJ_LEAVE (); return 0; // Words list not changed. @@ -1582,6 +1597,11 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex) if (word->content.type == core::Content::BREAK) line->breakSpace = max (word->content.breakSpace, line->breakSpace); + else if (word->content.type == core::Content::WIDGET_OOF_REF) { + word->content.widgetReference->parentRef = + makeParentRefInFlow (lineIndex); + DBG_SET_WORD (wordIndex); + } } DBG_OBJ_MSGF ("construct.line", 2, diff --git a/dw/types.hh b/dw/types.hh index ab562a49..877593fe 100644 --- a/dw/types.hh +++ b/dw/types.hh @@ -191,7 +191,7 @@ public: Widget *widget; int parentRef; - WidgetReference (Widget *widget) { this->widget = widget; } + WidgetReference (Widget *widget) { parentRef = -1; this->widget = widget; } }; struct Content |