Make it compile with g++-2.95.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7907 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-10-13 10:16:05 +00:00
parent efae689873
commit 360b55ea0f
2 changed files with 22 additions and 20 deletions

View File

@ -1,6 +1,8 @@
2003-10-13 Angus Leeming <leeming@lyx.org>
* formula.C: remove #include "PreviewImage.h".
(draw, metrics): some simplification of the editing_inset check.
Also make it compile with g++2.95.
2003-10-12 Angus Leeming <leeming@lyx.org>

View File

@ -177,13 +177,24 @@ void InsetFormula::read(Buffer const &, LyXLex & lex)
//}
namespace {
bool editing_inset(InsetFormula const & inset)
{
return (mathcursor &&
mathcursor->formula() == const_cast<InsetFormula *>(&inset));
}
} // namespace anon
void InsetFormula::draw(PainterInfo & pi, int x, int y) const
{
cache(pi.base.bv);
// The previews are drawn only when we're not editing the inset.
bool const editing_inset = mathcursor && mathcursor->formula() == this;
bool const use_preview = !editing_inset && preview_->previewReady();
bool const use_preview = (!editing_inset(*this) &&
preview_->previewReady());
int const w = dim_.wid;
int const d = dim_.des;
@ -202,7 +213,7 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
!= lcolor.getX11Name(LColor::background))
p.pain.fillRectangle(x, y - a, w, h, LColor::mathbg);
if (editing_inset) {
if (editing_inset(*this)) {
mathcursor->drawSelection(pi);
//p.pain.rectangle(x, y - a, w, h, LColor::mathframe);
}
@ -245,8 +256,8 @@ bool InsetFormula::insetAllowed(InsetOld::Code code) const
void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const
{
bool const editing_inset = mathcursor && mathcursor->formula() == this;
bool const use_preview = !editing_inset && preview_->previewReady();
bool const use_preview = (!editing_inset(*this) &&
preview_->previewReady());
if (use_preview) {
preview_->metrics(m, dim);
@ -293,13 +304,6 @@ void InsetFormula::statusChanged() const
namespace {
bool preview_wanted(InsetFormula const & inset, Buffer const &)
{
// Don't want a preview when we're editing the inset
return !(mathcursor && mathcursor->formula() == &inset);
}
string const latex_string(InsetFormula const & inset, Buffer const &)
{
ostringstream ls;
@ -313,17 +317,13 @@ string const latex_string(InsetFormula const & inset, Buffer const &)
void InsetFormula::addPreview(lyx::graphics::PreviewLoader & ploader) const
{
if (preview_wanted(*this, ploader.buffer())) {
string const snippet = latex_string(*this, ploader.buffer());
preview_->addPreview(snippet, ploader);
}
string const snippet = latex_string(*this, ploader.buffer());
preview_->addPreview(snippet, ploader);
}
void InsetFormula::generatePreview(Buffer const & buffer) const
{
if (preview_wanted(*this, buffer)) {
string const snippet = latex_string(*this, buffer);
preview_->generatePreview(snippet, buffer);
}
string const snippet = latex_string(*this, buffer);
preview_->generatePreview(snippet, buffer);
}