diff options
author | Sebastian Geerken <devnull@localhost> | 2012-09-24 18:23:26 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2012-09-24 18:23:26 +0200 |
commit | b38df648b637a221bd6d9107de433cbe8107c276 (patch) | |
tree | 084702913cd69886d2987209966fae8cec71bf66 | |
parent | fd3bd017cca30ec144ba19bb46159ffd952d5467 (diff) |
Restructured; new class OutOfFlowManager. Much code removed, will be added again to OutOfFlowManager.
-rw-r--r-- | dw/Makefile.am | 2 | ||||
-rw-r--r-- | dw/outofflowmgr.cc | 38 | ||||
-rw-r--r-- | dw/outofflowmgr.hh | 47 | ||||
-rw-r--r-- | dw/textblock.cc | 316 | ||||
-rw-r--r-- | dw/textblock.hh | 155 | ||||
-rw-r--r-- | src/html.cc | 5 | ||||
-rw-r--r-- | test/dw_float_test.cc | 2 |
7 files changed, 197 insertions, 368 deletions
diff --git a/dw/Makefile.am b/dw/Makefile.am index 07948b5f..61c92b98 100644 --- a/dw/Makefile.am +++ b/dw/Makefile.am @@ -65,6 +65,8 @@ libDw_widgets_a_SOURCES = \ image.hh \ listitem.cc \ listitem.hh \ + outofflowmgr.cc \ + outofflowmgr.hh \ ruler.cc \ ruler.hh \ table.cc \ diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc new file mode 100644 index 00000000..19aa21b0 --- /dev/null +++ b/dw/outofflowmgr.cc @@ -0,0 +1,38 @@ +#include "outofflowmgr.hh" + +#include <math.h> // only for testing + +namespace dw { + +void OutOfFlowMgr::sizeAllocate(core::Allocation *containingBoxAllocation) +{ +} + +void OutOfFlowMgr::draw (core::View *view, core::Rectangle *area) +{ +} + +void OutOfFlowMgr::queueResize(int ref) +{ +} + +void OutOfFlowMgr::addWidget (core::Widget *widget, core::style::Style *style) +{ + // widget->parentRef = ... +} + +void OutOfFlowMgr::markChange (int ref) +{ +} + +int OutOfFlowMgr::getLeftBorder (int y) +{ + return 40 * sin ((double)y / 30); +} + +int OutOfFlowMgr::getRightBorder (int y) +{ + return 40 * cos ((double)y / 30); +} + +} // namespace dw diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh new file mode 100644 index 00000000..bcd1148d --- /dev/null +++ b/dw/outofflowmgr.hh @@ -0,0 +1,47 @@ +#ifndef __DW_OUTOFFLOWMGR_HH__ +#define __DW_OUTOFFLOWMGR_HH__ + +#include "core.hh" + +namespace dw { + +class Textblock; + +/** + * \brief Represents additional data for containing boxes. + */ +class OutOfFlowMgr +{ +private: + void markChange (int ref); + +public: + void sizeAllocate(core::Allocation *containingBoxAllocation); + void draw (core::View *view, core::Rectangle *area); + void queueResize(int ref); + + inline void markSizeChange (int ref) { markChange (ref); } + inline void markExtremesChange (int ref) { markChange (ref); } + + void addWidget (core::Widget *widget, core::style::Style *style); + + /** + * Get the left border for the vertical position of y, based on + * floats. The border includes marging/border/padding of the + * containging box, but is 0 if there is no float, so a caller + * should also consider other borders. + */ + int getLeftBorder (int y); + + int getRightBorder (int y); + + inline static bool isRefOutOfFlow (int ref) + { return ref != -1 && (ref & 1) != 0; } + inline static int createRefNormalFlow (int lineNo) { return lineNo << 1; } + inline static int getLineNoFromRef (int ref) + { return ref == -1 ? ref : (ref >> 1); } +}; + +} // namespace dw + +#endif // __DW_OUTOFFLOWMGR_HH__ diff --git a/dw/textblock.cc b/dw/textblock.cc index 27c14561..3e06b4ab 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -70,7 +70,7 @@ Textblock::Textblock (bool limitTextWidth) nonTemporaryLines = 0; words = new misc::NotSoSimpleVector <Word> (1); anchors = new misc::SimpleVector <Anchor> (1); - leftFloatSide = rightFloatSide = NULL; + outOfFlowMgr = NULL; //DBG_OBJ_SET_NUM(this, "num_lines", num_lines); @@ -124,10 +124,8 @@ Textblock::~Textblock () delete words; delete anchors; - if(leftFloatSide) - delete leftFloatSide; - if(rightFloatSide) - delete rightFloatSide; + if(outOfFlowMgr) + delete outOfFlowMgr; /* Make sure we don't own widgets anymore. Necessary before call of parent class destructor. (???) */ @@ -439,10 +437,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) } } - if(leftFloatSide) - leftFloatSide->sizeAllocate(allocation); - if(rightFloatSide) - rightFloatSide->sizeAllocate(allocation); + if(outOfFlowMgr) + outOfFlowMgr->sizeAllocate(allocation); for (int i = 0; i < anchors->size(); i++) { Anchor *anchor = anchors->getRef(i); @@ -474,16 +470,29 @@ void Textblock::resizeDrawImpl () void Textblock::markSizeChange (int ref) { - markChange (ref); + printf ("markSizeChange (%d)\n", ref); + + if (OutOfFlowMgr::isRefOutOfFlow (ref)) { + assert (outOfFlowMgr != NULL); + outOfFlowMgr->markSizeChange (ref); + } else + markChange (ref); } void Textblock::markExtremesChange (int ref) { - markChange (ref); + printf ("markExtremesChange (%d)\n", ref); + + if (OutOfFlowMgr::isRefOutOfFlow (ref)) { + assert (outOfFlowMgr != NULL); + outOfFlowMgr->markExtremesChange (ref); + } else + markChange (ref); } /* - * Implementation for both mark_size_change and mark_extremes_change. + * Implementation for both markSizeChange and markExtremesChange. + * Only used for normal flow. */ void Textblock::markChange (int ref) { @@ -495,43 +504,24 @@ void Textblock::markChange (int ref) added to a line. In the latter case, nothing has to be done now, but addLine(...) will do everything necessary. */ - int refEquiv = (ref == 0) ? 1 | (dw::core::style::FLOAT_NONE << 1) : ref; - - if (refEquiv != -1 && (refEquiv & 1)) { - switch((refEquiv >> 1) & 3) - { - case dw::core::style::FLOAT_NONE: - if (wrapRef == -1) - wrapRef = refEquiv >> 3; - else - wrapRef = misc::min (wrapRef, refEquiv >> 3); - //DBG_OBJ_SET_NUM (page, "wrap_ref", page->wrap_ref); - printf("wrapRef = %d\n", wrapRef); - break; - - case dw::core::style::FLOAT_LEFT: - leftFloatSide->queueResize(refEquiv); - break; - - case dw::core::style::FLOAT_RIGHT: - rightFloatSide->queueResize(refEquiv); - break; - } - } + if (wrapRef == -1) + wrapRef = OutOfFlowMgr::getLineNoFromRef (ref); + else + wrapRef = misc::min (wrapRef, OutOfFlowMgr::getLineNoFromRef (ref)); PRINTF (" ... => %d\n", wrapRef); } void Textblock::notifySetAsTopLevel() { - containingBox = this; + containingBlock = this; } void Textblock::notifySetParent() { // Search for containing Box. It can be assumed that this widget has a // parent, otherwise, notifySetAsToplevel would have been called. - containingBox = NULL; + containingBlock = NULL; Textblock *topmostTextblock = this; for(Widget *widget = getParent(); widget != NULL; @@ -541,19 +531,19 @@ void Textblock::notifySetParent() topmostTextblock = (Textblock*)widget; } - for(Widget *widget = getParent(); containingBox == NULL; + for(Widget *widget = getParent(); containingBlock == NULL; widget = widget->getParent()) { if(widget->getParent() == NULL) // No other widget left. - containingBox = topmostTextblock; + containingBlock = topmostTextblock; else if(widget->instanceOf(Textblock::CLASS_ID)) { if(// this widget is a table cell widget->getParent()->instanceOf(Table::CLASS_ID) || // this widget is a float widget->getStyle()->vloat != dw::core::style::FLOAT_NONE) - containingBox = (Textblock*)widget; + containingBlock = (Textblock*)widget; } } } @@ -1352,10 +1342,8 @@ void Textblock::draw (core::View *view, core::Rectangle *area) drawLine (line, view, area); } - if(leftFloatSide) - leftFloatSide->draw(view, area); - if(rightFloatSide) - rightFloatSide->draw(view, area); + if(outOfFlowMgr) + outOfFlowMgr->draw(view, area); } /** @@ -1662,6 +1650,21 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) // "Assigning parent_ref = %d to added word %d, " // "in page with %d word(s)\n", // lines->size () - 1, words->size() - 1, words->size()); + + // TODO Floats: + /* + Word *word; + + widget->setStyle (style); + containingBlock->addFloatIntoContainer(widget, this); + + word = addWord (0, 0, 0, false, style); + word->content.type = core::Content::FLOAT_REF; + word->content.breakSpace = 0; + word->content.widget = widget; + word->style = style; + wordWrap (words->size () - 1, false); + */ } /** @@ -1892,23 +1895,6 @@ void Textblock::addLinebreak (core::style::Style *style) wordWrap (words->size () - 1, false); } -/** \todo This MUST be commented! */ -void Textblock::addFloatIntoGenerator (core::Widget *widget, core::style::Style *style) -{ - Word *word; - - widget->setStyle (style); - containingBox->addFloatIntoContainer(widget, this); - - word = addWord (0, 0, 0, false, style); - word->content.type = core::Content::FLOAT_REF; - word->content.breakSpace = 0; - word->content.widget = widget; - word->style = style; - wordWrap (words->size () - 1, false); -} - - /** * \brief Search recursively through widget. * @@ -2055,214 +2041,6 @@ void Textblock::changeWordStyle (int from, int to, core::style::Style *style, // ---------------------------------------------------------------------- -/** \todo This MUST be commented! */ -void Textblock::addFloatIntoContainer(Widget *widget, - Textblock *floatGenerator) -{ - FloatSide *floatSide = NULL; - - switch(widget->getStyle()->vloat) - { - case dw::core::style::FLOAT_LEFT: - if(leftFloatSide == NULL) - leftFloatSide = new LeftFloatSide(this); - floatSide = leftFloatSide; - break; - - case dw::core::style::FLOAT_RIGHT: - if(rightFloatSide == NULL) - rightFloatSide = new RightFloatSide(this); - floatSide = rightFloatSide; - break; - - default: - //TODO lout::misc::fail("invalid value %d for float to be added", widget->getStyle()->vloat); - break; - } - - // ABC - widget->parentRef = 1 | (widget->getStyle()->vloat << 1) | (floatSide->size() << 3); - widget->parentRef = 0; - printf("parentRef = %d\n", widget->parentRef); - widget->setParent(this); - - floatSide->addFloat(widget, floatGenerator); -} - -void Textblock::handleFloatInContainer(Widget *widget, int lineNo, - int y, int lineWidth, int lineHeight) -{ - FloatSide *floatSide = NULL; - - switch(widget->getStyle()->vloat) - { - case dw::core::style::FLOAT_LEFT: - floatSide = leftFloatSide; - break; - - case dw::core::style::FLOAT_RIGHT: - floatSide = rightFloatSide; - break; - - default: - //TODO lout::misc::fail("invalid value %d for float to be handled", widget->getStyle()->vloat); - break; - } - - floatSide->handleFloat(widget, lineNo, y, lineWidth, lineHeight); -} - -Textblock::FloatSide::FloatSide(Textblock *floatContainer) -{ - this->floatContainer = floatContainer; - floats = new container::typed::Vector<Float>(1, false); - floatsByWidget = - new container::typed::HashTable<object::TypedPointer<dw::core::Widget>, Float>(true, true); -} - -Textblock::FloatSide::~FloatSide() -{ - delete floats; - delete floatsByWidget; -} - -void Textblock::FloatSide::addFloat(Widget *widget, Textblock *floatGenerator) -{ - Float *vloat = new Float(); - vloat->floatGenerator = floatGenerator; - vloat->widget = widget; - floats->put(vloat); - object::TypedPointer<Widget> *pointer = new object::TypedPointer<Widget>(widget); - floatsByWidget->put(pointer, vloat); -} - -void Textblock::FloatSide::handleFloat(Widget *widget, int lineNo, - int y, int lineWidth, int lineHeight) -{ - /** \todo lineHeight may change afterwards */ - object::TypedPointer<Widget> pointer(widget); - Float *vloat = floatsByWidget->get(&pointer); - - printf("searching %s in %s\n", pointer.toString(), floatsByWidget->toString()); - - dw::core::Requisition requisition; - widget->sizeRequest(&requisition); - - int effY; - /** \todo Check for another float. Futhermore: what, if the float does not fit - * into a line at all? */ - if(requisition.width > vloat->floatGenerator->availWidth - lineWidth) - effY = y + lineHeight; - else - effY = y; - - vloat->lineNo = lineNo; - vloat->y = effY; - vloat->width = requisition.width; - vloat->ascent = requisition.ascent; - vloat->descent = requisition.descent; -} - -int Textblock::FloatSide::calcBorder(int y, Textblock *viewdFrom) -{ - Float *vloat = findFloat(y); - if(vloat) { - int fromContainer = calcBorderFromContainer(vloat); - int fromThisViewedFrom = fromContainer - calcBorderDiff(viewdFrom); - //printf("fromThisViewedFrom = %d\n", fromThisViewedFrom); - return misc::max(fromThisViewedFrom, 0); - } else - return 0; -} - -Textblock::FloatSide::Float *Textblock::FloatSide::findFloat(int y) -{ - for(int i = 0; i < floats->size(); i++) - { - Float *vloat = floats->get(i); - if(y >= vloat->y && y < vloat->y + vloat->ascent + vloat->descent) - return vloat; - } - - return NULL; -} - -void Textblock::FloatSide::draw (core::View *view, core::Rectangle *area) -{ - for(int i = 0; i < floats->size(); i++) - { - Float *vloat = floats->get(i); - core::Rectangle childArea; - if (vloat->widget->intersects (area, &childArea)) - vloat->widget->draw (view, &childArea); - } -} - -void Textblock::FloatSide::queueResize(int ref) -{ - // TODO Float *vloat = floats->get(ref >> 3); - // TODO vloat->floatGenerator->queueResize(false, 1 | (dw::core::style::FLOAT_NONE << 1) | (vloat->lineNo << 3), true); -} - -int Textblock::LeftFloatSide::calcBorderFromContainer(Textblock::FloatSide::Float *vloat) -{ - return vloat->width + floatContainer->getStyle()->boxOffsetX() + - vloat->floatGenerator->getStyle()->boxOffsetX(); -} - -int Textblock::LeftFloatSide::calcBorderDiff(Textblock *child) -{ - return child->getStyle()->boxOffsetX(); -} - -void Textblock::LeftFloatSide::sizeAllocate(core::Allocation *containingBoxAllocation) -{ - for(int i = 0; i < floats->size(); i++) - { - Float *vloat = floats->get(i); - core::Allocation childAllocation; - childAllocation.x = - containingBoxAllocation->x + floatContainer->getStyle()->boxOffsetX() + - vloat->floatGenerator->getStyle()->boxOffsetX(); - childAllocation.y = containingBoxAllocation->y + vloat->y; - childAllocation.width = vloat->width; - childAllocation.ascent = vloat->ascent; - childAllocation.descent = vloat->descent; - vloat->widget->sizeAllocate(&childAllocation); - } -} - -int Textblock::RightFloatSide::calcBorderFromContainer(Textblock::FloatSide::Float *vloat) -{ - return vloat->width + floatContainer->getStyle()->boxRestWidth() + - vloat->floatGenerator->getStyle()->boxRestWidth(); -} - -int Textblock::RightFloatSide::calcBorderDiff(Textblock *child) -{ - return child->getStyle()->boxRestWidth(); -} - -void Textblock::RightFloatSide::sizeAllocate(core::Allocation *containingBoxAllocation) -{ - for(int i = 0; i < floats->size(); i++) - { - Float *vloat = floats->get(i); - core::Allocation childAllocation; - childAllocation.x = - containingBoxAllocation->x + containingBoxAllocation->width - - floatContainer->getStyle()->boxRestWidth() - vloat->width - - vloat->floatGenerator->getStyle()->boxRestWidth(); - childAllocation.y = containingBoxAllocation->y + vloat->y; - childAllocation.width = vloat->width; - childAllocation.ascent = vloat->ascent; - childAllocation.descent = vloat->descent; - vloat->widget->sizeAllocate(&childAllocation); - } -} - -// ---------------------------------------------------------------------- - Textblock::TextblockIterator::TextblockIterator (Textblock *textblock, core::Content::Type mask, bool atEnd): diff --git a/dw/textblock.hh b/dw/textblock.hh index 10a56d50..14ef1afb 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -4,6 +4,7 @@ #include <limits.h> #include "core.hh" +#include "outofflowmgr.hh" #include "../lout/misc.hh" // These were used when improved line breaking and hyphenation were @@ -22,7 +23,7 @@ namespace dw { * #ffffe0"><b>Info:</b> The recent changes (line breaking and * hyphenation on one hand, floats on the other hand) have not yet * been incorporated into this documentation. See \ref - * dw-line-breaking and \ref dw-special-textflow.</div> + * dw-line-breaking and \ref dw-out-of-flow.</div> * * <h3>Signals</h3> * @@ -145,11 +146,6 @@ namespace dw { class Textblock: public core::Widget { private: - // Hint: the following is somewhat chaotic, as a result of the merge - // of dillo_hyphen and dillo_floats - - // Part 1 -- Line-Breaking and Hyphenation - /** * This class encapsulates the badness/penalty calculation, and so * (i) makes changes (hopefully) simpler, and (ii) hides the @@ -213,68 +209,8 @@ private: void print (); }; - // Part 2 -- Floats - - Textblock *containingBox; - - class FloatSide - { - protected: - class Float: public lout::object::Object - { - public: - Textblock *floatGenerator; - core::Widget *widget; - int lineNo, y, width, ascent, descent; - }; - - Textblock *floatContainer; - lout::container::typed::Vector<Float> *floats; - lout::container::typed::HashTable<lout::object::TypedPointer<dw::core::Widget>, Float> *floatsByWidget; - - Float *findFloat(int y); - - virtual int calcBorderFromContainer(Float *vloat) = 0; - virtual int calcBorderDiff(Textblock *child) = 0; - - public: - FloatSide(Textblock *floatContainer); - virtual ~FloatSide(); - - inline int size() { return floats->size(); } - void addFloat(Widget *widget, Textblock *floatGenerator); - void handleFloat(Widget *widget, int lineNo, int y, int lineWidth, int lineHeight); - int calcBorder(int y, Textblock *viewdFrom); - virtual void sizeAllocate(core::Allocation *containingBoxAllocation) = 0; - void draw (core::View *view, core::Rectangle *area); - void queueResize(int ref); - }; - - class LeftFloatSide: public FloatSide - { - protected: - int calcBorderFromContainer(Float *vloat); - int calcBorderDiff(Textblock *child); - - public: - LeftFloatSide(Textblock *floatContainer) : FloatSide(floatContainer) { } - void sizeAllocate(core::Allocation *containingBoxAllocation); - }; - - class RightFloatSide: public FloatSide - { - protected: - int calcBorderFromContainer(Float *vloat); - int calcBorderDiff(Textblock *child); - - public: - RightFloatSide(Textblock *floatContainer) : FloatSide(floatContainer) { } - void sizeAllocate(core::Allocation *containingBoxAllocation); - }; - - FloatSide *leftFloatSide, *rightFloatSide; - - // End of merge chaos. + Textblock *containingBlock; + OutOfFlowMgr *outOfFlowMgr; protected: enum { @@ -295,7 +231,6 @@ protected: * page->lines[0].top is always 0. */ int top, boxAscent, boxDescent, contentAscent, contentDescent, breakSpace, leftOffset; - int boxLeft, boxRight; /* This is similar to descent, but includes the bottom margins of the * widgets within this line. */ @@ -489,35 +424,69 @@ protected: void calcTextSize (const char *text, size_t len, core::style::Style *style, core::Requisition *size); - void addFloatIntoContainer(core::Widget *widget, Textblock *floatGenerator); - void handleFloatInContainer(Widget *widget, int lineNo, - int y, int lineWidth, int lineHeight); - - inline int calcLeftFloatBorder(int y, Textblock *viewedFrom) - { return containingBox->leftFloatSide ? containingBox->leftFloatSide->calcBorder(y, viewedFrom) : 0; } - inline int calcRightFloatBorder(int y, Textblock *viewedFrom) - { return containingBox->rightFloatSide ? containingBox->rightFloatSide->calcBorder(y, viewedFrom) : 0; } - /** - * \brief Returns the x offset (the indentation plus any offset needed for - * centering or right justification) for the line. - * - * The offset returned is relative to the page *content* (i.e. without - * border etc.). + * \brief Returns the x offset (the indentation plus any offset + * needed for centering or right justification) for the line, + * relative to the allocation (i.e. including border etc.). */ - inline int lineXOffsetContents (Line *line) + inline int lineXOffsetWidget (Line *line) { - return innerPadding + line->leftOffset + line->boxLeft + - (line == lines->getFirstRef() ? line1OffsetEff : 0); + return innerPadding + line->leftOffset + + (line == lines->getFirstRef() ? line1OffsetEff : 0) + + lout::misc::max (getStyle()->boxOffsetX(), + containingBlock->getAllocation()->x + + containingBlock->outOfFlowMgr->getLeftBorder + (allocation.y + line->top + getStyle()->boxOffsetY() + - containingBlock->getAllocation()->y) - + allocation.x); } - /** - * \brief Like lineXOffset, but relative to the allocation (i.e. - * including border etc.). - */ - inline int lineXOffsetWidget (Line *line) + inline int lineLeftBorder (int lineNo) { - return lineXOffsetContents (line) + getStyle()->boxOffsetX (); + // Note that the line must not exist yet (but unless it is not + // the first line, the previous line, lineNo - 1, must). But + // lineHeight should be known to the caller. + int top; + if (lineNo == 0) + top = 0; + else { + Line *prevLine = lines->getRef (lineNo - 1); + top = prevLine->top + prevLine->boxAscent + prevLine->boxDescent + + prevLine->breakSpace; + } + + // TODO: line->leftOffset is not regarded, which is correct, depending + // on where this method is called. Document; perhaps rename this method. + // (Update: was renamed.) + return innerPadding + + (lineNo == 0 ? line1OffsetEff : 0) + + lout::misc::max (getStyle()->boxOffsetX(), + containingBlock->getAllocation()->x + + containingBlock->outOfFlowMgr->getLeftBorder + (allocation.y + top + getStyle()->boxOffsetY() + - containingBlock->getAllocation()->y) - + allocation.x); + } + + inline int lineRightBorder (int lineNo) + { + // Similar to lineLeftBorder(). + int top; + if (lineNo == 0) + top = 0; + else { + Line *prevLine = lines->getRef (lineNo - 1); + top = prevLine->top + prevLine->boxAscent + prevLine->boxDescent + + prevLine->breakSpace; + } + + return lout::misc::max (getStyle()->boxRestWidth(), + (containingBlock->getAllocation()->x + + containingBlock->getAllocation()->width) - + containingBlock->outOfFlowMgr->getRightBorder + (allocation.y + top + getStyle()->boxOffsetY() + - containingBlock->getAllocation()->y) - + (allocation.x + allocation.width)); } inline int lineYOffsetWidgetAllocation (Line *line, @@ -639,8 +608,6 @@ public: void addParbreak (int space, core::style::Style *style); void addLinebreak (core::style::Style *style); - void addFloatIntoGenerator (core::Widget *widget, core::style::Style *style); - core::Widget *getWidgetAtPoint (int x, int y, int level); void handOverBreak (core::style::Style *style); void changeLinkColor (int link, int newColor); diff --git a/src/html.cc b/src/html.cc index ca9b7751..c4a3d060 100644 --- a/src/html.cc +++ b/src/html.cc @@ -361,10 +361,7 @@ static void Html_add_textblock(DilloHtml *html, int space) Style *style = html->styleEngine->style (); HT2TB(html)->addParbreak (space, html->styleEngine->wordStyle ()); - if (style->vloat == FLOAT_NONE) - HT2TB(html)->addWidget (textblock, style); - else - HT2TB(html)->addFloatIntoGenerator(textblock, style); + HT2TB(html)->addWidget (textblock, style); // Works also for floats etc. HT2TB(html)->addParbreak (space, html->styleEngine->wordStyle ()); S_TOP(html)->textblock = html->dw = textblock; diff --git a/test/dw_float_test.cc b/test/dw_float_test.cc index acafeafa..2f4a0d93 100644 --- a/test/dw_float_test.cc +++ b/test/dw_float_test.cc @@ -104,7 +104,7 @@ int main(int argc, char **argv) textblock->addSpace(wordStyle); Textblock *vloat = new Textblock (false); - textblock->addFloatIntoGenerator(vloat, i == 3 ? leftFloatStyle : rightFloatStyle); + textblock->addWidget(vloat, i == 3 ? leftFloatStyle : rightFloatStyle); const char *fWords[] = { "This", "is", "a", "float,", "which", "is", "set", "aside", "from", "the", "main", |