mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 08:44:01 +00:00
speed up workWidth code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2900 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5507c1ad69
commit
a80bee35b9
@ -1,3 +1,9 @@
|
||||
2001-10-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* text.C (workWidth): do not search for the exact row when
|
||||
margintype is not MARGIN_RIGHT_ADDRESS_BOX. This is an
|
||||
optimization for big documents.
|
||||
|
||||
2001-10-18 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* text.C (workWidth): new function with added Inset * parameter.
|
||||
|
22
src/text.C
22
src/text.C
@ -68,7 +68,7 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
|
||||
{
|
||||
Buffer::inset_iterator it;
|
||||
Paragraph * par = 0;
|
||||
Paragraph::size_type pos;
|
||||
Paragraph::size_type pos = 0;
|
||||
|
||||
for(it=bview->buffer()->inset_iterator_begin();
|
||||
it != bview->buffer()->inset_iterator_end();
|
||||
@ -80,7 +80,25 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (par) {
|
||||
|
||||
if (!par) {
|
||||
lyxerr << "LyXText::workWidth: cannot find inset!" <<endl;
|
||||
return workWidth(bview);
|
||||
}
|
||||
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(bview->buffer()->params.textclass,
|
||||
par->getLayout());
|
||||
|
||||
if (layout.margintype != MARGIN_RIGHT_ADDRESS_BOX) {
|
||||
// Optimization here: in most cases, the real row is
|
||||
// not needed, but only the par/pos values. So we just
|
||||
// construct a dummy row for leftMargin. (JMarc)
|
||||
Row dummyrow;
|
||||
dummyrow.par(par);
|
||||
dummyrow.pos(pos);
|
||||
return workWidth(bview) - leftMargin(bview, &dummyrow);
|
||||
} else {
|
||||
Row * row = firstrow;
|
||||
for(; row; row = row->next()) {
|
||||
if ((row->par() == par && row->pos() >= pos)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user