#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "support/gettext.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
+#include <sstream>
#include <ostream>
-namespace lyx {
+using namespace std;
+using namespace lyx::support;
-using support::bformat;
+namespace lyx {
-InsetMathAMSArray::InsetMathAMSArray(docstring const & name, int m, int n)
- : InsetMathGrid(m, n), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name,
+ int m, int n)
+ : InsetMathGrid(buf, m, n), name_(name)
{}
-InsetMathAMSArray::InsetMathAMSArray(docstring const & name)
- : InsetMathGrid(1, 1), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name)
+ : InsetMathGrid(buf, 1, 1), name_(name)
{}
void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const
{
- ArrayChanger dummy(mi.base);
+ Changer dummy =
+ mi.base.changeStyle(LM_ST_TEXT, mi.base.style == LM_ST_DISPLAY);
InsetMathGrid::metrics(mi, dim);
- dim.wid += 14;
}
{
Dimension const dim = dimension(*pi.base.bv);
int const yy = y - dim.ascent();
- // Drawing the deco after an ArrayChanger does not work
+ // Drawing the deco after changeStyle does not work
mathed_draw_deco(pi, x + 1, yy, 5, dim.height(), from_ascii(name_left()));
mathed_draw_deco(pi, x + dim.width() - 8, yy, 5, dim.height(), from_ascii(name_right()));
- ArrayChanger dummy(pi.base);
- InsetMathGrid::drawWithMargin(pi, x, y, 6, 8);
+ Changer dummy =
+ pi.base.changeStyle(LM_ST_TEXT, pi.base.style == LM_ST_DISPLAY);
+ InsetMathGrid::draw(pi, x, y);
}
bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_TABULAR_FEATURE: {
- docstring const & s = cmd.argument();
+ string s = cmd.getArg(0);
if (s == "add-vline-left" || s == "add-vline-right") {
flag.message(bformat(
- from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
+ from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
+ name_));
flag.setEnabled(false);
return true;
}
- return InsetMathGrid::getStatus(cur, cmd, flag);
+ break;
}
default:
- return InsetMathGrid::getStatus(cur, cmd, flag);
+ break;
}
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
{
MathEnsurer ensurer(os);
os << "\\begin{" << name_ << '}';
+ bool open = os.startOuterRow();
InsetMathGrid::write(os);
os << "\\end{" << name_ << '}';
+ if (open)
+ os.startOuterRow();
}