mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 18:24:48 +00:00
move width computation to helper function
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7961 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd48fefe0e
commit
0011b84a16
36
src/text.C
36
src/text.C
@ -75,6 +75,21 @@ extern int const LEFT_MARGIN = PAPER_MARGIN + CHANGEBAR_MARGIN;
|
|||||||
int bibitemMaxWidth(BufferView *, LyXFont const &);
|
int bibitemMaxWidth(BufferView *, LyXFont const &);
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
unsigned int maxParagraphWidth(ParagraphList const & plist)
|
||||||
|
{
|
||||||
|
unsigned int width = 0;
|
||||||
|
ParagraphList::const_iterator pit = plist.begin();
|
||||||
|
ParagraphList::const_iterator end = plist.end();
|
||||||
|
for (; pit != end; ++pit)
|
||||||
|
width = std::max(width, pit->width);
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
BufferView * LyXText::bv()
|
BufferView * LyXText::bv()
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(bv_owner != 0);
|
BOOST_ASSERT(bv_owner != 0);
|
||||||
@ -1169,15 +1184,8 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
|
|||||||
|
|
||||||
row.width(maxwidth);
|
row.width(maxwidth);
|
||||||
|
|
||||||
if (inset_owner) {
|
if (inset_owner)
|
||||||
width = max(0, workWidth());
|
width = max(workWidth(), int(maxParagraphWidth(ownerParagraphs())));
|
||||||
ParagraphList::iterator pit = ownerParagraphs().begin();
|
|
||||||
ParagraphList::iterator end = ownerParagraphs().end();
|
|
||||||
for ( ; pit != end; ++pit) {
|
|
||||||
if (width < pit->width)
|
|
||||||
width = pit->width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2195,16 +2203,12 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
|||||||
lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
|
lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
|
||||||
<< " workWidth: " << workWidth() << "\nfont: " << mi.base.font << endl;
|
<< " workWidth: " << workWidth() << "\nfont: " << mi.base.font << endl;
|
||||||
//BOOST_ASSERT(mi.base.textwidth);
|
//BOOST_ASSERT(mi.base.textwidth);
|
||||||
|
|
||||||
// rebuild row cache
|
|
||||||
//anchor_y_ = 0;
|
//anchor_y_ = 0;
|
||||||
|
|
||||||
|
// rebuild row cache. This recomputes height as well.
|
||||||
redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
|
redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
|
||||||
|
|
||||||
width = 0;
|
width = maxParagraphWidth(ownerParagraphs());
|
||||||
ParagraphList::iterator pit = ownerParagraphs().begin();
|
|
||||||
ParagraphList::iterator end = ownerParagraphs().end();
|
|
||||||
for ( ; pit != end; ++pit)
|
|
||||||
width = std::max(pit->width, width);
|
|
||||||
|
|
||||||
// final dimension
|
// final dimension
|
||||||
dim.asc = firstRow()->ascent_of_text();
|
dim.asc = firstRow()->ascent_of_text();
|
||||||
|
Loading…
Reference in New Issue
Block a user