]> git.lyx.org Git - lyx.git/commitdiff
Add LeftDelim and RightDelim to the Style and InsetLayout repertoire
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 25 Nov 2012 18:10:16 +0000 (19:10 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 25 Nov 2012 18:10:16 +0000 (19:10 +0100)
lib/doc/Customization.lyx
src/Layout.cpp
src/Layout.h
src/Paragraph.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h
src/insets/InsetText.cpp

index b4f0e428fcda263e7d01ade279aaacbd56aa45f6..e733e8fec5dcc0147b9647345910288311f3236a 100644 (file)
@@ -12442,6 +12442,35 @@ depending upon the LaTeX type.
 \end_layout
 
 \end_deeper
+\begin_layout Description
+
+\change_inserted -712698321 1353866861
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866852
+LeftDelim
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866852
+string
+\end_layout
+
+\end_inset
+
+] A string that is put at the beginning of the style content.
+\end_layout
+
 \begin_layout Description
 \begin_inset Flex Code
 status collapsed
@@ -13442,6 +13471,35 @@ CopyStyle
 
 \end_layout
 
+\begin_layout Description
+
+\change_inserted -712698321 1353866881
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866876
+RightDelim
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866873
+string
+\end_layout
+
+\end_inset
+
+] A string that is put at the end of the layout content.
+\end_layout
+
 \begin_layout Description
 \begin_inset Flex Code
 status collapsed
@@ -15178,7 +15236,15 @@ Note:Greyedout
 status collapsed
 
 \begin_layout Plain Layout
-OptArg
+
+\change_deleted -712698321 1353866704
+Opt
+\change_unchanged
+Arg
+\change_inserted -712698321 1353866707
+ument
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -16421,6 +16487,39 @@ depending upon the LaTeX type.
 \end_layout
 
 \end_deeper
+\begin_layout Description
+
+\change_inserted -712698321 1353866797
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866742
+LeftDelim
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866752
+string
+\end_layout
+
+\end_inset
+
+] A string that is put at the beginning of the layout content.
+\change_unchanged
+
+\end_layout
+
 \begin_layout Description
 \begin_inset Flex Code
 status collapsed
@@ -16884,6 +16983,39 @@ status collapsed
 ] Whether this inset should use the font of its surrounding environment
  or uses its own.
  Default is true: uses its own.
+\change_inserted -712698321 1353866806
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1353866814
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866810
+RightDelim
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1353866806
+string
+\end_layout
+
+\end_inset
+
+] A string that is put at the end of the layout content.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
index a2c98ac4610fb3d6dd94322b85837816a9462f0f..a5d3550ffb493b8ce5dadf2510f307610a890877 100644 (file)
@@ -69,6 +69,7 @@ enum LayoutTags {
        LT_LATEXNAME,
        LT_LATEXPARAM,
        LT_LATEXTYPE,
+       LT_LEFTDELIM,
        LT_LEFTMARGIN,
        LT_NEED_PROTECT,
        LT_NEWLINE,
@@ -102,6 +103,7 @@ enum LayoutTags {
        LT_SPELLCHECK,
        LT_REFPREFIX,
        LT_RESETARGS,
+       LT_RIGHTDELIM,
        LT_INTITLE // keep this last!
 };
 
@@ -194,6 +196,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                { "latexname",      LT_LATEXNAME },
                { "latexparam",     LT_LATEXPARAM },
                { "latextype",      LT_LATEXTYPE },
+               { "leftdelim",      LT_LEFTDELIM },
                { "leftmargin",     LT_LEFTMARGIN },
                { "margin",         LT_MARGIN },
                { "needprotect",    LT_NEED_PROTECT },
@@ -209,6 +212,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                { "refprefix",      LT_REFPREFIX },
                { "requires",       LT_REQUIRES },
                { "resetargs",      LT_RESETARGS },
+               { "rightdelim",     LT_RIGHTDELIM },
                { "rightmargin",    LT_RIGHTMARGIN },
                { "spacing",        LT_SPACING },
                { "spellcheck",     LT_SPELLCHECK },
@@ -364,6 +368,14 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                        latexparam_ = subst(latexparam_, "&quot;", "\"");
                        break;
 
+               case LT_LEFTDELIM:
+                       lex >> leftdelim_;
+                       break;
+
+               case LT_RIGHTDELIM:
+                       lex >> rightdelim_;
+                       break;
+
                case LT_INNERTAG:
                        lex >> innertag_;
                        break;
index 469cbf0f5517c3a3ff3776516a92e018aad7eae7..45bdf460bf7a0eb3245325a80bc17bda96d15df0 100644 (file)
@@ -124,6 +124,10 @@ public:
        ///
        std::string const & latexparam() const { return latexparam_; }
        ///
+       docstring leftdelim() const { return leftdelim_; }
+       ///
+       docstring rightdelim() const { return rightdelim_; }
+       ///
        std::string const & innertag() const { return innertag_; }
        ///
        std::string const & labeltag() const { return labeltag_; }
@@ -314,6 +318,10 @@ private:
        docstring labelstring_appendix_;
        /// LaTeX parameter for environment
        std::string latexparam_;
+       /// Left delimiter of the content
+       docstring leftdelim_;
+       /// Right delimiter of the content
+       docstring rightdelim_;
        /// Internal tag to use (e.g., <title></title> for sect header)
        std::string innertag_;
        /// Internal tag to use (e.g. to surround varentrylist label)
index ee80b94454351d0cc4aedee3d20b4c3b398fba79..c7a39b6ab39da44a88ca87b237ad2c4756274af2 100644 (file)
@@ -2428,6 +2428,10 @@ void Paragraph::latex(BufferParams const & bparams,
                        os << '{';
                        ++column;
                }
+               if (!style.leftdelim().empty()) {
+                       os << style.leftdelim();
+                       column += style.leftdelim().size();
+               }
                if (allowcust)
                        column += d->startTeXParParams(bparams, os, runparams);
        }
@@ -2458,6 +2462,11 @@ void Paragraph::latex(BufferParams const & bparams,
                                ++column;
                        }
 
+                       if (!style.leftdelim().empty()) {
+                               os << style.leftdelim();
+                               column += style.leftdelim().size();
+                       }
+
                        if (allowcust)
                                column += d->startTeXParParams(bparams, os,
                                                            runparams);
@@ -2648,6 +2657,11 @@ void Paragraph::latex(BufferParams const & bparams,
                os << "}]~";
        }
 
+       if (!style.rightdelim().empty()) {
+               os << style.rightdelim();
+               column += style.rightdelim().size();
+       }
+
        if (allowcust && d->endTeXParParams(bparams, os, runparams)
            && runparams.encoding != prev_encoding) {
                runparams.encoding = prev_encoding;
index 53f56aea6099307376e0c257a31c27be03903cec..808176602178638c071ab501fea5799b7fc8349f 100644 (file)
@@ -106,6 +106,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_LATEXNAME,
                IL_LATEXPARAM,
                IL_LATEXTYPE,
+               IL_LEFTDELIM,
                IL_LYXTYPE,
                IL_KEEPEMPTY,
                IL_MULTIPAR,
@@ -114,6 +115,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_PARBREAKISNEWLINE,
                IL_PREAMBLE,
                IL_REQUIRES,
+               IL_RIGHTDELIM,
                IL_SPELLCHECK,
                IL_REFPREFIX,
                IL_RESETSFONT,
@@ -153,6 +155,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "latexname", IL_LATEXNAME },
                { "latexparam", IL_LATEXPARAM },
                { "latextype", IL_LATEXTYPE },
+               { "leftdelim", IL_LEFTDELIM },
                { "lyxtype", IL_LYXTYPE },
                { "multipar", IL_MULTIPAR },
                { "needprotect", IL_NEEDPROTECT },
@@ -162,6 +165,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "refprefix", IL_REFPREFIX },
                { "requires", IL_REQUIRES },
                { "resetsfont", IL_RESETSFONT },
+               { "rightdelim", IL_RIGHTDELIM },
                { "spellcheck", IL_SPELLCHECK }
        };
 
@@ -229,6 +233,12 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                        lex >> tmp;
                        latexparam_ = support::subst(tmp, "&quot;", "\"");
                        break;
+               case IL_LEFTDELIM:
+                       lex >> leftdelim_;
+                       break;
+               case IL_RIGHTDELIM:
+                       lex >> rightdelim_;
+                       break;
                case IL_LABELFONT:
                        labelfont_ = lyxRead(lex, inherit_font);
                        break;
index 3ddee169ce9eb1d2dad30c7dcf72fb2a8465c66d..4f5a6b89e3f6e27cb21e526fc204868ba631df61 100644 (file)
@@ -76,6 +76,10 @@ public:
        ///
        std::string latexparam() const { return latexparam_; }
        ///
+       docstring leftdelim() const { return leftdelim_; }
+       ///
+       docstring rightdelim() const { return rightdelim_; }
+       ///
        FontInfo font() const { return font_; }
        ///
        FontInfo labelfont() const { return labelfont_; }
@@ -188,6 +192,10 @@ private:
        ///
        std::string latexparam_;
        ///
+       docstring leftdelim_;
+       ///
+       docstring rightdelim_;
+       ///
        FontInfo font_;
        ///
        FontInfo labelfont_;
index 04bee82873fe000e1f466bc0fafcd82ee3a62cf2..4760df5024ac13dd2cfb6be44484d70ad769cf1d 100644 (file)
@@ -459,6 +459,10 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
                if (!il.latexparam().empty())
                        os << from_utf8(il.latexparam());
        }
+
+       if (!il.leftdelim().empty())
+               os << il.leftdelim();
+
        OutputParams rp = runparams;
        if (il.isPassThru())
                rp.pass_thru = true;
@@ -471,6 +475,9 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
        latexParagraphs(buffer(), text_, os, rp);
        runparams.encoding = rp.encoding;
 
+       if (!il.rightdelim().empty())
+               os << il.rightdelim();
+
        if (!il.latexname().empty()) {
                if (il.latextype() == InsetLayout::COMMAND) {
                        os << "}";