commit ccc8ad4744545bf08eb22454c0f6cb91a590f059 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Thu May 12 17:31:47 2016 +0200
Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus The way it works is: * the inset defines allowParagraphCustomization() correctly * Text::getStatus acts on it. Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset. diff --git a/src/Text3.cpp b/src/Text3.cpp index 352d3cb..0467aa8 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -3145,7 +3145,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_PARAGRAPH_PARAMS: case LFUN_PARAGRAPH_PARAMS_APPLY: case LFUN_PARAGRAPH_UPDATE: - enable = cur.inset().allowParagraphCustomization(); + enable = owner_->allowParagraphCustomization(); break; // FIXME: why are accent lfuns forbidden with pass_thru layouts? diff --git a/src/insets/InsetScript.cpp b/src/insets/InsetScript.cpp index 8303075..bee4c54 100644 --- a/src/insets/InsetScript.cpp +++ b/src/insets/InsetScript.cpp @@ -263,7 +263,6 @@ bool InsetScript::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { switch (cmd.action()) { - case LFUN_LAYOUT_PARAGRAPH: case LFUN_MATH_DISPLAY: case LFUN_BOX_INSERT: case LFUN_BRANCH_INSERT: diff --git a/src/insets/InsetScript.h b/src/insets/InsetScript.h index 84ed50e..11864d3 100644 --- a/src/insets/InsetScript.h +++ b/src/insets/InsetScript.h @@ -82,6 +82,8 @@ public: /// bool forcePlainLayout(idx_type = 0) const { return true; } /// + bool allowParagraphCustomization(idx_type = 0) const { return false; } + /// bool neverIndent() const { return true; } /// int plaintext(odocstringstream & ods, OutputParams const & op, diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 71036cc..6477ef3 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3413,10 +3413,6 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd, { bool enabled = true; switch (cmd.action()) { - case LFUN_LAYOUT_PARAGRAPH: - enabled = allowParagraphCustomization(); - break; - case LFUN_MATH_DISPLAY: if (!hasFixedWidth()) { enabled = false;