#include "math_matrixinset.h"
#include "mathed/support.h"
-using std::ostringstream;
using std::ostream;
using std::ifstream;
using std::istream;
InsetFormula::InsetFormula(string const & s)
- : InsetFormulaBase(0)
+ : InsetFormulaBase(mathed_parse(s))
{
- istringstream is(s.c_str());
- par(mathed_parse(is));
Metrics();
}
{
int x = int(xx) - 1;
y -= 2;
+
MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter();
int w = par()->width();
int h = par()->height();
int a = par()->ascent();
- pain.fillRectangle(int(x), y - a, w, h, LColor::mathbg);
-
- if (mathcursor) {
- if (mathcursor->formula() == this) {
- if (mathcursor->Selection()) {
- int xp[10];
- int yp[10];
- int n;
- mathcursor->SelGetArea(xp, yp, n);
- pain.fillPolygon(xp, yp, n, LColor::selection);
- }
- pain.rectangle(int(x), y - a, w, h, LColor::mathframe);
- }
+ pain.fillRectangle(x, y - a, w, h, LColor::mathbg);
+
+ if (mathcursor && mathcursor->formula() == this) {
+ mathcursor->drawSelection(pain);
+ pain.rectangle(x, y - a, w, h, LColor::mathframe);
}
- par()->draw(pain, int(x), y);
+ par()->draw(pain, x, y);
xx += par()->width();
setCursorVisible(false);
case LFUN_BREAKLINE:
bv->lockedInsetStoreUndo(Undo::INSERT);
+ int x;
+ int y;
+ mathcursor->GetPos(x, y);
mathcursor->breakLine();
- updateLocal(bv);
+ mathcursor->normalize();
+ updateLocal(bv, true);
break;
case LFUN_MATH_NUMBER:
for (int row = 0; row < par()->nrows(); ++row)
par()->numbered(row, !old);
bv->owner()->message(old ? _("No number") : _("Number"));
- updateLocal(bv);
+ updateLocal(bv, true);
}
break;
}
bool old = par()->numbered(row);
bv->owner()->message(old ? _("No number") : _("Number"));
par()->numbered(row, !old);
- updateLocal(bv);
+ updateLocal(bv, true);
}
break;
}
par()->label(row, new_label);
- updateLocal(bv);
+ updateLocal(bv, true);
break;
}
case LFUN_MATH_EXTERN:
bv->lockedInsetStoreUndo(Undo::EDIT);
handleExtern(arg, bv);
- updateLocal(bv);
+ updateLocal(bv, true);
break;
case LFUN_MATH_MUTATE:
par()->mutate(arg);
mathcursor->SetPos(x, y);
mathcursor->normalize();
- updateLocal(bv);
+ updateLocal(bv, true);
break;
}
par()->mutate(LM_OT_SIMPLE);
mathcursor->SetPos(x, y);
mathcursor->normalize();
- updateLocal(bv);
+ updateLocal(bv, true);
break;
}
par()->Validate(features);
}
+bool InsetFormula::insetAllowed(Inset::Code code) const
+{
+ return code == Inset::LABEL_CODE;
+}
+
int InsetFormula::ascent(BufferView *, LyXFont const &) const
{
- return par()->ascent();
+ return par()->ascent() + 1;
}
int InsetFormula::descent(BufferView *, LyXFont const &) const
{
- return par()->descent();
+ return par()->descent() + 1;
}
int InsetFormula::width(BufferView *, LyXFont const &) const
{
+ Metrics();
return par()->width();
}