* the GNU General Public Licence version 2 or later.
*/
-#ifdef __GNUG__
-#pragma implementation
-#endif
#include <config.h>
void InsetFormula::write(Buffer const *, ostream & os) const
{
WriteStream wi(os, false, false);
- os << par_->fileInsetLabel() << " ";
+ os << par_->fileInsetLabel() << ' ';
par_->write(wi);
}
int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
- if (display()) {
+ if (0 && display()) {
TextMetricsInfo mi;
par()->metricsT(mi);
TextPainter tpain(par()->width(), par()->height());
void InsetFormula::draw(BufferView * bv, LyXFont const & font,
- int y, float & xx, bool) const
+ int y, float & xx) const
{
+ cache(bv);
// This initiates the loading of the preview, so should come
// before the metrics are computed.
- preview_->setView(bv);
bool const use_preview = preview_->previewReady();
int const x = int(xx);
MathPainterInfo pi(bv->painter());
if (use_preview) {
- pi.pain.image(x, y - a, w, h,
- *(preview_->pimage()->image(*this, *bv)));
+ pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front
+ *(preview_->pimage()->image()));
} else {
pi.base.style = LM_ST_TEXT;
pi.base.font = font;
//pi.pain.rectangle(x, y - a, w, h, LColor::mathframe);
}
- par_->draw(pi, x + 1, y);
+ par_->draw(pi, x, y);
}
xx += w;
bool InsetFormula::insetAllowed(Inset::Code code) const
{
return
- (code == Inset::LABEL_CODE)
+ code == Inset::LABEL_CODE
|| code == Inset::REF_CODE
|| code == Inset::ERT_CODE;
}
{
metrics(bv, font);
return preview_->previewReady() ?
- preview_->pimage()->width() : par_->width();
+ 1 + preview_->pimage()->width() : par_->width();
+ // insert a one pixel gap in front of the formula
}
ostringstream ls;
WriteStream wi(ls, false, false);
parent().par_->write(wi);
- return ls.str().c_str();
+ return STRCONV(ls.str());
}
+