diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 7b6378411a..e8303eadef 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -285,28 +285,14 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const text_.rebuild(mi.base.textwidth); dim.asc = text_.rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET; dim.des = text_.height - dim.asc + TEXT_TO_INSET_OFFSET; - dim.wid = max(textWidth(bv), int(text_.width)) + 2 * TEXT_TO_INSET_OFFSET; + dim.wid = max(textwidth_, int(text_.width)) + 2 * TEXT_TO_INSET_OFFSET; dim.wid = max(dim.wid, 10); dim_ = dim; } -int InsetText::textWidth(BufferView * bv, bool fordraw) const +int InsetText::textWidth() const { -/* - int w = autoBreakRows ? getMaxWidth(bv, this) : -1; - - if (fordraw) - return max(w - 2 * TEXT_TO_INSET_OFFSET, - (int)getLyXText(bv)->width); - - if (w < 0) - return -1; - - return w - 2 * TEXT_TO_INSET_OFFSET; - lyxerr << "InsetText::textWidth: " << getInsetName() - << " " << textwidth_ << endl; -*/ return textwidth_; } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 62e4bfad06..70325f6530 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -88,7 +88,7 @@ public: /// void metrics(MetricsInfo &, Dimension &) const; /// - int textWidth(BufferView *, bool fordraw = false) const; + int textWidth() const; /// void draw(PainterInfo & pi, int x, int y) const; /// diff --git a/src/rowpainter.C b/src/rowpainter.C index dfdac82d68..84d970678b 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -1007,8 +1007,7 @@ void RowPainter::paintText() void RowPainter::paint() { - width_ = text_.isInInset() - ? text_.inset_owner->textWidth(perv(bv_), true) : bv_.workWidth(); + width_ = text_.workWidth(); // FIXME: must be a cleaner way here. Aren't these calculations // belonging to row metrics ? diff --git a/src/text.C b/src/text.C index c8f8cbebe9..524cb0089f 100644 --- a/src/text.C +++ b/src/text.C @@ -144,11 +144,7 @@ void LyXText::anchor_row(RowList::iterator rit) int LyXText::workWidth() const { - if (inset_owner) { - // FIXME: pass (const ?) ref - return inset_owner->textWidth(bv()); - } - return bv()->workWidth(); + return inset_owner ? inset_owner->textWidth() : bv()->workWidth(); }