make textWidth access a bit simpler

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7315 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-18 12:05:50 +00:00
parent 01b31c56c9
commit 2eae49ac5a
4 changed files with 5 additions and 24 deletions

View File

@ -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_;
}

View File

@ -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;
///

View File

@ -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 ?

View File

@ -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();
}