Disable the arguments append-column and delete-column of tabular-features.
The code is taken from InsetMathCases, with some changes
* no need to record undo here
* in dispatch, return is prefered to break, since we do not want to invoke
InsetMathGrid::doDispatch.
Propagate these changes to InsetMathCases.
Cleanup of the InsetMathCases error messages to fit with other parts
of the code.
The handling of tabular-features in mathed needs to be unified somehow.
Based on a commit from lynx <lorenzobertini97@gmail.com>
Part of bug #12590.
void InsetMathCases::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
switch (cmd.action()) {
case LFUN_TABULAR_FEATURE: {
string s = cmd.getArg(0);
// vertical lines and adding/deleting columns is not allowed for \cases
- // FIXME: "I suspect that the break after cur.undispatched() should be a
- // return; the recordUndo seems bogus too." (lasgouttes)
if (s == "append-column" || s == "delete-column"
|| s == "add-vline-left" || s == "add-vline-right") {
cur.undispatched();
- break;
+ return;
}
- cur.recordUndo();
}
default:
break;
if (s == "add-vline-left" || s == "add-vline-right") {
flag.setEnabled(false);
flag.message(bformat(
- from_utf8(N_("No vertical grid lines in 'cases': feature %1$s")),
- from_utf8(s)));
+ from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
+ from_utf8("cases")));
return true;
}
if (s == "append-column" || s == "delete-column") {
flag.setEnabled(false);
flag.message(bformat(
from_utf8(N_("Changing number of columns not allowed in "
- "'cases': feature %1$s")), from_utf8(s)));
+ "'%1$s'")), from_utf8("cases")));
return true;
}
break;
#include "MathData.h"
#include "MathStream.h"
+#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LaTeXFeatures.h"
}
+void InsetMathSubstack::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+ switch (cmd.action()) {
+ case LFUN_TABULAR_FEATURE: {
+ string s = cmd.getArg(0);
+ if (s == "append-column" || s == "delete-column"
+ || s == "add-vline-left" || s == "add-vline-right") {
+ cur.undispatched();
+ return;
+ }
+ }
+ default:
+ break;
+ }
+ InsetMathGrid::doDispatch(cur, cmd);
+}
+
+
bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
flag.setEnabled(false);
return true;
}
+ // disallow changing number of columns
+ if (s == "append-column" || s == "delete-column") {
+ flag.setEnabled(false);
+ flag.message(bformat(
+ from_utf8(N_("Changing number of columns not allowed in "
+ "'%1$s'")), from_utf8("substack")));
+ return true;
+ }
break;
}
///
InsetMathSubstack const * asSubstackInset() const override { return this; }
+ ///
+ void doDispatch(Cursor & cur, FuncRequest & cmd) override;
///
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const override;