X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathAMSArray.cpp;h=9a9a3495bc7434392afc1e41aa5e6d2c5519106c;hb=5fdc577badb1cb133d6a0dc7d831bb1f82576adb;hp=2d251f9f1e56bc795418b76be6f6c44ec9c2ce46;hpb=4c7a5d00245799695ea81aa0192151eed8f9c5fb;p=lyx.git diff --git a/src/mathed/InsetMathAMSArray.cpp b/src/mathed/InsetMathAMSArray.cpp index 2d251f9f1e..9a9a3495bc 100644 --- a/src/mathed/InsetMathAMSArray.cpp +++ b/src/mathed/InsetMathAMSArray.cpp @@ -20,8 +20,8 @@ #include "FuncRequest.h" #include "FuncStatus.h" -#include "support/gettext.h" +#include "support/gettext.h" #include "support/lstrings.h" #include @@ -85,35 +85,31 @@ char const * InsetMathAMSArray::name_right() const void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const { - ArrayChanger dummy(mi.base); + Changer dummy2 = mi.base.changeEnsureMath(); + Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); - dim.wid += 14; } void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const { + Changer dummy2 = pi.base.changeEnsureMath(); 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.changeArray(); + InsetMathGrid::draw(pi, x, y); } bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { - switch (cmd.action_) { - case LFUN_INSET_MODIFY: { - istringstream is(to_utf8(cmd.argument())); - string s; - is >> s; - if (s != "tabular") - break; - is >> s; + switch (cmd.action()) { + case LFUN_TABULAR_FEATURE: { + 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'")), @@ -134,8 +130,11 @@ void InsetMathAMSArray::write(WriteStream & os) const { MathEnsurer ensurer(os); os << "\\begin{" << name_ << '}'; + bool open = os.startOuterRow(); InsetMathGrid::write(os); os << "\\end{" << name_ << '}'; + if (open) + os.startOuterRow(); }