]> git.lyx.org Git - lyx.git/commitdiff
Allow inset-forall to match separators (#10090)
authorGuillaume Munch <gm@lyx.org>
Mon, 16 May 2016 17:10:13 +0000 (18:10 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 16 May 2016 23:48:26 +0000 (00:48 +0100)
With this change, it becomes possible to run the following commands:
     inset-forall Separator:latexpar char-delete-forward
     inset-forall Separator:parbreak inset-modify separator plain

The first one deletes all latexpar separators. The second one turns parbreak
separators into plain separators. This is safe, flexible, and avoids adding a
new LFUN.

src/insets/InsetSeparator.h

index 66a0c5515aa3636db4908f07316f72b6fec0d0c5..5d080ccae6c32d5c3576186a1cc221e357f9d119 100644 (file)
@@ -48,6 +48,22 @@ public:
        static void string2params(std::string const &, InsetSeparatorParams &);
        ///
        static std::string params2string(InsetSeparatorParams const &);
+       /// To be used in combination with inset-forall
+       /// Here's a command that removes every latexpar separator:
+       ///   inset-forall Separator:latexpar char-delete-forward
+       docstring layoutName() const
+       {
+               switch (params_.kind) {
+               case InsetSeparatorParams::PLAIN:
+                       return from_ascii("Separator:plain");
+               case InsetSeparatorParams::PARBREAK:
+                       return from_ascii("Separator:parbreak");
+               case InsetSeparatorParams::LATEXPAR:
+                       return from_ascii("Separator:latexpar");
+               }
+               // remove warning
+               return docstring();
+       }
 private:
        ///
        InsetSeparatorParams params() const { return params_; }