#include "support/lstrings.h"
+#include <sstream>
#include <ostream>
-namespace lyx {
+using namespace std;
+using namespace lyx::support;
-using support::bformat;
+namespace lyx {
InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name,
bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
- switch (cmd.action) {
- case LFUN_TABULAR_FEATURE: {
- docstring const & s = cmd.argument();
+ switch (cmd.action()) {
+ case LFUN_INSET_MODIFY: {
+ istringstream is(to_utf8(cmd.argument()));
+ string s;
+ is >> s;
+ if (s != "tabular")
+ break;
+ is >> s;
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();
}