Inset coords shall not be recorded in Inset::draw() because this can create problems with inheritance (which often modify the coords but not the Inset pointer itself). Right now there three kind of inset containers: paragraphs, tables and math arrays. The coords caching is fixed in the first two.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20376 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-20 10:58:38 +00:00
parent c3fefae326
commit 4c82dd1fc8
8 changed files with 2 additions and 14 deletions

View File

@ -71,7 +71,6 @@ bool InsetCommand::setMouseHover(bool mouse_hover)
void InsetCommand::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
button_.setRenderState(mouse_hover_);
button_.draw(pi, x, y);
}

View File

@ -517,7 +517,6 @@ bool InsetExternal::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetExternal::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
renderer_->draw(pi, x, y);
}

View File

@ -110,8 +110,6 @@ bool InsetFlex::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetFlex::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
Font tmpfont = pi.base.font;
getDrawFont(pi.base.font);
// I don't understand why the above .reduce and .realize aren't

View File

@ -268,7 +268,6 @@ bool InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
graphic_->draw(pi, x, y);
}

View File

@ -816,8 +816,6 @@ bool InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetInclude::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
BOOST_ASSERT(pi.base.bv);
bool use_preview = false;

View File

@ -263,7 +263,6 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
} else {
pi.pain.text(x, y, text, pi.base.font);
}
setPosCache(pi, x, y);
}

View File

@ -2994,8 +2994,6 @@ bool InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetTabular::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
//lyxerr << "InsetTabular::draw: " << x << " " << y << endl;
BufferView * bv = pi.base.bv;
@ -3022,6 +3020,8 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
first_visible_cell = idx;
int const cx = nx + tabular.getBeginningOfTextInCell(idx);
// Cache the Inset position.
bv->coordCache().insets().add(cell(idx).get(), cx, y);
if (nx + tabular.columnWidth(idx) < 0
|| nx > bv->workWidth()
|| y + d < 0
@ -3047,8 +3047,6 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
Cursor & cur = pi.base.bv->cursor();
x += scx_ + ADD_TO_TABULAR_WIDTH;

View File

@ -146,8 +146,6 @@ bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
x += ADD_TO_VSPACE_WIDTH;
int const start = y - dim_.asc;