diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/iterator.cc | 10 | ||||
-rw-r--r-- | dw/iterator.hh | 14 | ||||
-rw-r--r-- | dw/table.cc | 2 | ||||
-rw-r--r-- | dw/table.hh | 2 | ||||
-rw-r--r-- | dw/textblock.cc | 14 | ||||
-rw-r--r-- | dw/textblock.hh | 5 | ||||
-rw-r--r-- | dw/textblock_iterator.cc | 2 |
7 files changed, 25 insertions, 24 deletions
diff --git a/dw/iterator.cc b/dw/iterator.cc index ccfc068b..c31c2706 100644 --- a/dw/iterator.cc +++ b/dw/iterator.cc @@ -37,7 +37,7 @@ Iterator::Iterator(Widget *widget, Content::Type mask, bool atEnd) this->mask = mask; } -Iterator::Iterator(Iterator &it): object::Object (), misc::Comparable () +Iterator::Iterator(Iterator &it): object::Comparable () { widget = it.widget; content = it.content; @@ -214,7 +214,7 @@ object::Object *EmptyIterator::clone () return new EmptyIterator (*this); } -int EmptyIterator::compareTo (misc::Comparable *other) +int EmptyIterator::compareTo (object::Comparable *other) { EmptyIterator *otherIt = (EmptyIterator*)other; @@ -266,7 +266,7 @@ TextIterator::TextIterator (TextIterator &it): Iterator (it) text = it.text; } -int TextIterator::compareTo (misc::Comparable *other) +int TextIterator::compareTo (object::Comparable *other) { TextIterator *otherIt = (TextIterator*)other; @@ -579,7 +579,7 @@ object::Object *DeepIterator::clone () return it; } -int DeepIterator::compareTo (misc::Comparable *other) +int DeepIterator::compareTo (object::Comparable *other) { DeepIterator *otherDeepIterator = (DeepIterator*)other; @@ -717,7 +717,7 @@ object::Object *CharIterator::clone() return cloned; } -int CharIterator::compareTo(misc::Comparable *other) +int CharIterator::compareTo(object::Comparable *other) { CharIterator *otherIt = (CharIterator*)other; int c = it->compareTo(otherIt->it); diff --git a/dw/iterator.hh b/dw/iterator.hh index a48356ef..d8a59eec 100644 --- a/dw/iterator.hh +++ b/dw/iterator.hh @@ -16,7 +16,7 @@ namespace core { * * \sa dw::core::Widget::iterator */ -class Iterator: public lout::object::Object, public lout::misc::Comparable +class Iterator: public lout::object::Comparable { protected: Iterator(Widget *widget, Content::Type mask, bool atEnd); @@ -103,7 +103,7 @@ public: EmptyIterator (Widget *widget, Content::Type mask, bool atEnd); lout::object::Object *clone(); - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); bool next (); bool prev (); void highlight (int start, int end, HighlightLayer layer); @@ -128,7 +128,7 @@ public: TextIterator (Widget *widget, Content::Type mask, bool atEnd, const char *text); - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); bool next (); bool prev (); @@ -144,7 +144,7 @@ public: * iterators do not have the limitation, that iteration is only done within * a widget, instead, child widgets are iterated through recursively. */ -class DeepIterator: public lout::object::Object, public lout::misc::Comparable +class DeepIterator: public lout::object::Comparable { private: class Stack: public lout::container::typed::Vector<Iterator> @@ -189,7 +189,7 @@ public: bool next (); bool prev (); inline DeepIterator *cloneDeepIterator() { return (DeepIterator*)clone(); } - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); /** * \brief Highlight a part of the current content. @@ -222,7 +222,7 @@ public: start, end, hpos, vpos); } }; -class CharIterator: public lout::object::Object, public lout::misc::Comparable +class CharIterator: public lout::object::Comparable { public: // START and END must not clash with any char value @@ -240,7 +240,7 @@ public: ~CharIterator (); lout::object::Object *clone(); - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); bool next (); bool prev (); diff --git a/dw/table.cc b/dw/table.cc index ee9762fe..5587f469 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -1114,7 +1114,7 @@ object::Object *Table::TableIterator::clone() return new TableIterator ((Table*)getWidget(), getMask(), index); } -int Table::TableIterator::compareTo(misc::Comparable *other) +int Table::TableIterator::compareTo(object::Comparable *other) { return index - ((TableIterator*)other)->index; } diff --git a/dw/table.hh b/dw/table.hh index 7bcc6c1b..b8feb835 100644 --- a/dw/table.hh +++ b/dw/table.hh @@ -344,7 +344,7 @@ private: TableIterator (Table *table, core::Content::Type mask, int index); lout::object::Object *clone(); - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); bool next (); bool prev (); diff --git a/dw/textblock.cc b/dw/textblock.cc index 9d61e06e..03f15f63 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -1786,9 +1786,8 @@ void Textblock::addText (const char *text, size_t len, if(i < numParts - 1) { Word *word = words->getLastRef(); - word->badnessAndPenalty - .setPenalties (penalties[partPenaltyIndex[i]][0], - penalties[partPenaltyIndex[i]][1]); + setBreakOption (word, style, penalties[partPenaltyIndex[i]][0], + penalties[partPenaltyIndex[i]][1]); if (charRemoved[i]) // Currently, only unconditional hyphens (UTF-8: @@ -1982,7 +1981,7 @@ void Textblock::addBreakOption (core::style::Style *style) { int wordIndex = words->size () - 1; if (wordIndex >= 0) { - setBreakOption (words->getRef(wordIndex), style); + setBreakOption (words->getRef(wordIndex), style, 0, 0); // Call of accumulateWordData() is not needed here. correctLastWordExtremes (); } @@ -2008,7 +2007,7 @@ void Textblock::fillSpace (Word *word, core::style::Style *style) // Do not override a previously set break penalty. if (!word->content.space) { - setBreakOption (word, style); + setBreakOption (word, style, 0, 0); word->content.space = true; word->effSpace = word->origSpace = style->font->spaceWidth + @@ -2032,7 +2031,8 @@ void Textblock::fillSpace (Word *word, core::style::Style *style) * (and so addSpace), but may be called, via addBreakOption(), as an * alternative, e. g. for ideographic characters. */ -void Textblock::setBreakOption (Word *word, core::style::Style *style) +void Textblock::setBreakOption (Word *word, core::style::Style *style, + int breakPenalty1, int breakPenalty2) { // TODO: lineMustBeBroken should be independent of the penalty // index? Otherwise, examine the last line. @@ -2041,7 +2041,7 @@ void Textblock::setBreakOption (Word *word, core::style::Style *style) case core::style::WHITE_SPACE_NORMAL: case core::style::WHITE_SPACE_PRE_LINE: case core::style::WHITE_SPACE_PRE_WRAP: - word->badnessAndPenalty.setPenalty (0); + word->badnessAndPenalty.setPenalties (breakPenalty1, breakPenalty2); break; case core::style::WHITE_SPACE_PRE: diff --git a/dw/textblock.hh b/dw/textblock.hh index f0f8347f..04a7fa68 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -384,7 +384,7 @@ protected: bool oofm, int index); lout::object::Object *clone(); - int compareTo(lout::misc::Comparable *other); + int compareTo(lout::object::Comparable *other); bool next (); bool prev (); @@ -494,7 +494,8 @@ protected: void fillWord (Word *word, int width, int ascent, int descent, short flags, core::style::Style *style); void fillSpace (Word *word, core::style::Style *style); - void setBreakOption (Word *word, core::style::Style *style); + void setBreakOption (Word *word, core::style::Style *style, + int breakPenalty1, int breakPenalty2); int textWidth (const char *text, int start, int len, core::style::Style *style, bool isStart, bool isEnd); void calcTextSize (const char *text, size_t len, core::style::Style *style, diff --git a/dw/textblock_iterator.cc b/dw/textblock_iterator.cc index 0956ef29..daf82c50 100644 --- a/dw/textblock_iterator.cc +++ b/dw/textblock_iterator.cc @@ -72,7 +72,7 @@ object::Object *Textblock::TextblockIterator::clone() new TextblockIterator ((Textblock*)getWidget(), getMask(), oofm, index); } -int Textblock::TextblockIterator::compareTo(misc::Comparable *other) +int Textblock::TextblockIterator::compareTo(object::Comparable *other) { TextblockIterator *otherTI = (TextblockIterator*)other; |