width_ += 2 * font_metrics::width(' ', font_);
lyxerr << "MathCharInset::metrics: " << dim << endl;
#endif
- dim_ = dim;
+ width_ = dim.wid;
}
#ifndef MATH_CHARINSET_H
#define MATH_CHARINSET_H
-#include "math_diminset.h"
+#include "math_inset.h"
-#warning this should not derive from the fat MathDimInset
/// The base character inset.
-class MathCharInset : public MathDimInset {
+class MathCharInset : public MathInset {
public:
///
explicit MathCharInset(char c);
void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
///
void drawT(TextPainter &, int x, int y) const;
+ ///
+ int width() const { return width_; }
///
void write(WriteStream & os) const;
private:
/// the character
char char_;
+ /// cached width
+ mutable int width_;
};
#endif
///
mutable int yo_;
};
+
#endif
else
for (row_type row = 0; row < nrows(); ++row)
numbered(row, !old);
- //cur.bv()->owner()->message(old ? _("No number") : _("Number"));
+ cur.message(old ? _("No number") : _("Number"));
}
return DispatchResult(true, true);
row_type r = (type_ == "multline") ? nrows() - 1 : cur.row();
////recordUndo(cur, Undo::INSERT);
bool old = numbered(r);
- //cur.bv()->owner()->message(old ? _("No number") : _("Number"));
+ cur.message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
return DispatchResult(true, true);
return;
ostringstream os;
cur.info(os);
- cur.bv().owner()->message(os.str());
+ cur.message(os.str());
/*
// write something to the minibuffer
// translate to latex
res = res.substr(pos - 30);
if (res.size() > 60)
res = res.substr(0, 60);
- bv.owner()->message(res);
+ cur.message(res);
*/
}
cur.bv().getLyXText()->cutSelection(true, false);
openNewInset(cur, f);
}
- cmd.message(N_("Math editor mode"));
+ cur.message(N_("Math editor mode"));
}
} // namespace anon
if (mi.base.style == LM_ST_DISPLAY)
if (sym_->inset == "cmex" || sym_->extra == "funclim")
scriptable_ = true;
+
+ width_ = dim.wid;
}
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
+ ///
+ int width() const { return width_; }
+
///
bool isRelOp() const;
/// do we take scripts?
latexkeys const * sym_;
///
mutable int h_;
+ /// cached width
+ mutable int width_;
///
mutable bool scriptable_;
};
#include "math_mathmlstream.h"
#include "math_streamstr.h"
-
using std::string;
using std::auto_ptr;
void MathUnknownInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_string_dim(mi.base.font, name_, dim);
+ dim_ = dim;
}
drawStrBlack(pi, x, y, name_);
else
drawStrRed(pi, x, y, name_);
+ xo_ = x;
+ yo_ = y;
}