mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
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:
parent
01b31c56c9
commit
2eae49ac5a
@ -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_;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
///
|
||||
|
@ -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 ?
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user