- InsetQuotes updates the inset cache

- Do not use the nullpainter for the rows outside the screen, because the nullpainter does not calculate the width of text, and thus the metric entries in the inset cache are completely wrong, causing assertions when using for instance page up or page down into an inset. This fixes the dreading assertion on navigation in the user guide, and elsewhere


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15455 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 2006-10-21 16:03:53 +00:00
parent 262a4c7385
commit 2a9abde507
2 changed files with 8 additions and 6 deletions

View File

@ -85,18 +85,22 @@ char const * const latex_quote_babel[2][5] =
InsetQuotes::InsetQuotes(string const & str) InsetQuotes::InsetQuotes(string const & str)
{ {
parseString(str); parseString(str);
setInsetName("InsetQuotes");
} }
InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t) InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t)
: language_(l), side_(s), times_(t) : language_(l), side_(s), times_(t)
{} {
setInsetName("InsetQuotes");
}
InsetQuotes::InsetQuotes(char_type c, BufferParams const & params) InsetQuotes::InsetQuotes(char_type c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times) : language_(params.quotes_language), times_(params.quotes_times)
{ {
getPosition(c); getPosition(c);
setInsetName("InsetQuotes");
} }
@ -104,6 +108,7 @@ InsetQuotes::InsetQuotes(char_type c, quote_language l, quote_times t)
: language_(l), times_(t) : language_(l), times_(t)
{ {
getPosition(c); getPosition(c);
setInsetName("InsetQuotes");
} }
@ -245,6 +250,7 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
docstring dtext(text.begin(), text.end()); docstring dtext(text.begin(), text.end());
pi.pain.text(x, y, dtext, pi.base.font); pi.pain.text(x, y, dtext, pi.base.font);
} }
setPosCache(pi, x, y);
} }

View File

@ -32,7 +32,6 @@
#include "vspace.h" #include "vspace.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/nullpainter.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "insets/insettext.h" #include "insets/insettext.h"
@ -45,7 +44,6 @@
namespace lyx { namespace lyx {
using frontend::Painter; using frontend::Painter;
using frontend::NullPainter;
using frontend::FontMetrics; using frontend::FontMetrics;
using std::endl; using std::endl;
@ -819,8 +817,6 @@ void paintPar
bool repaintAll) bool repaintAll)
{ {
// lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl; // lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
static NullPainter nop;
static PainterInfo nullpi(pi.base.bv, nop);
int const ww = pi.base.bv->workHeight(); int const ww = pi.base.bv->workHeight();
pi.base.bv->coordCache().parPos()[&text][pit] = Point(x, y); pi.base.bv->coordCache().parPos()[&text][pit] = Point(x, y);
@ -867,7 +863,7 @@ void paintPar
bool const inside = (y + rit->descent() >= 0 bool const inside = (y + rit->descent() >= 0
&& y - rit->ascent() < ww); && y - rit->ascent() < ww);
RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y); RowPainter rp(pi, text, pit, *rit, x, y);
// Clear background of this row // Clear background of this row
// (if paragraph background was not cleared) // (if paragraph background was not cleared)
if (!repaintAll && if (!repaintAll &&