]> git.lyx.org Git - features.git/commitdiff
Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 May 2016 15:31:47 +0000 (17:31 +0200)
committerRichard Heck <rgheck@lyx.org>
Sun, 29 May 2016 21:55:46 +0000 (17:55 -0400)
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.

src/Text3.cpp
src/insets/InsetScript.cpp
src/insets/InsetScript.h
src/insets/InsetTabular.cpp

index 352d3cb429800660a24e1bdbbfb7a28f9f7f1c8e..0467aa8b69f4fa26dac881bbd683894140d23f2c 100644 (file)
@@ -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?
index 830307508daa541fbdcd1f230276cf0e39ea0b84..bee4c541cf95cca6e1522ba496dc1a2df4efda79 100644 (file)
@@ -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:
index 84ed50e1b12a09c94749556d8a98004b44fecc49..11864d305c4a39e01d37939ad7ed6ef8fff83751 100644 (file)
@@ -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,
index 71036cc0fb10a8e229d36fe484b646b048d1e407..6477ef3fe673a2febfa66eabe5f5e0baafdb7ffd 100644 (file)
@@ -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;