]> git.lyx.org Git - lyx.git/blobdiff - src/lyxlayout.C
Lars says _(_(b)) is a bug ... fix
[lyx.git] / src / lyxlayout.C
index 2f6b0fc84d796c6a6d320947a77bd801da6967d6..0a95c43811397b8ab0be3de73fefdd4746959213 100644 (file)
@@ -32,6 +32,7 @@ enum LayoutTags {
        LT_MARGIN,
        LT_BOTTOMSEP,
        LT_COPYSTYLE,
+       LT_DEPENDSON,
        LT_OBSOLETEDBY,
        //LT_EMPTY,
        LT_END,
@@ -58,6 +59,7 @@ enum LayoutTags {
        LT_ENDLABELTYPE,
        LT_LATEXNAME,
        LT_LATEXPARAM,
+       LT_OPTARGS,
        LT_LATEXTYPE,
        LT_LEFTMARGIN,
        LT_NEED_PROTECT,
@@ -82,6 +84,7 @@ LyXLayout::LyXLayout ()
        margintype = MARGIN_STATIC;
        latextype = LATEX_PARAGRAPH;
        intitle = false;
+       optionalargs = 0;
        needprotect = false;
        keepempty = false;
        font = LyXFont(LyXFont::ALL_INHERIT);
@@ -114,45 +117,47 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
 {
        // This table is sorted alphabetically [asierra 30March96]
        keyword_item layoutTags[] = {
-               { "align",                      LT_ALIGN },
-               { "alignpossible",              LT_ALIGNPOSSIBLE },
-               { "bottomsep",                  LT_BOTTOMSEP },
-               { "copystyle",                  LT_COPYSTYLE },
-               { "end",                        LT_END },
+               { "align",              LT_ALIGN },
+               { "alignpossible",      LT_ALIGNPOSSIBLE },
+               { "bottomsep",          LT_BOTTOMSEP },
+               { "copystyle",          LT_COPYSTYLE },
+               { "dependson",          LT_DEPENDSON },
+               { "end",                LT_END },
                { "endlabelstring",     LT_ENDLABELSTRING },
                { "endlabeltype",       LT_ENDLABELTYPE },
-               { "fill_bottom",                LT_FILL_BOTTOM },
-               { "fill_top",                   LT_FILL_TOP },
-               { "font",       LT_FONT },
-               { "freespacing",                LT_FREE_SPACING },
-               { "intitle",                    LT_INTITLE },
-               { "itemsep",    LT_ITEMSEP },
-               { "keepempty",                  LT_KEEPEMPTY },
-               { "labelbottomsep",             LT_LABEL_BOTTOMSEP },
-               { "labelfont",  LT_LABELFONT },
+               { "fill_bottom",        LT_FILL_BOTTOM },
+               { "fill_top",           LT_FILL_TOP },
+               { "font",               LT_FONT },
+               { "freespacing",        LT_FREE_SPACING },
+               { "intitle",            LT_INTITLE },
+               { "itemsep",            LT_ITEMSEP },
+               { "keepempty",          LT_KEEPEMPTY },
+               { "labelbottomsep",     LT_LABEL_BOTTOMSEP },
+               { "labelfont",          LT_LABELFONT },
                { "labelindent",        LT_LABELINDENT },
-               { "labelsep",   LT_LABELSEP },
+               { "labelsep",           LT_LABELSEP },
                { "labelstring",        LT_LABELSTRING },
-               { "labelstringappendix",        LT_LABELSTRING_APPENDIX },
-               { "labeltype",  LT_LABELTYPE },
-               { "latexname",  LT_LATEXNAME },
-               { "latexparam",                 LT_LATEXPARAM },
-               { "latextype",  LT_LATEXTYPE },
-               { "leftmargin", LT_LEFTMARGIN },
-               { "margin",     LT_MARGIN },
-               { "needprotect",                LT_NEED_PROTECT },
-               { "newline",                    LT_NEWLINE },
-               { "nextnoindent",               LT_NEXTNOINDENT },
-               { "obsoletedby",                LT_OBSOLETEDBY },
-               { "parindent",                  LT_PARINDENT },
-               { "parsep",                     LT_PARSEP },
-               { "parskip",                    LT_PARSKIP },
-               { "passthru",                   LT_PASS_THRU },
-               { "preamble",                   LT_PREAMBLE },
-               { "rightmargin",                LT_RIGHTMARGIN },
-               { "spacing",                    LT_SPACING },
-               { "textfont",                   LT_TEXTFONT },
-               { "topsep",                     LT_TOPSEP }
+               { "labelstringappendix", LT_LABELSTRING_APPENDIX },
+               { "labeltype",          LT_LABELTYPE },
+               { "latexname",          LT_LATEXNAME },
+               { "latexparam",         LT_LATEXPARAM },
+               { "latextype",          LT_LATEXTYPE },
+               { "leftmargin",         LT_LEFTMARGIN },
+               { "margin",             LT_MARGIN },
+               { "needprotect",        LT_NEED_PROTECT },
+               { "newline",            LT_NEWLINE },
+               { "nextnoindent",       LT_NEXTNOINDENT },
+               { "obsoletedby",        LT_OBSOLETEDBY },
+               { "optionalargs",       LT_OPTARGS },
+               { "parindent",          LT_PARINDENT },
+               { "parsep",             LT_PARSEP },
+               { "parskip",            LT_PARSKIP },
+               { "passthru",           LT_PASS_THRU },
+               { "preamble",           LT_PREAMBLE },
+               { "rightmargin",        LT_RIGHTMARGIN },
+               { "spacing",            LT_SPACING },
+               { "textfont",           LT_TEXTFONT },
+               { "topsep",             LT_TOPSEP }
        };
 
        bool error = false;
@@ -216,7 +221,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
                                        if (obsoleted_by().empty())
                                                obsoleted_by_ = style;
                                } else {
-                                       lyxerr << "Cannot replace with unknown style `" << style << "'" << endl;
+                                       lyxerr << "Cannot replace with unknown style `" << style << '\'' << endl;
 
                                        //lexrc.printError("Cannot replace with"
                                        //               " unknown style "
@@ -225,6 +230,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
                        }
                        break;
 
+               case LT_DEPENDSON:
+                       if (lexrc.next()) {
+                               depends_on_ = lexrc.getString();
+                       }
+                       break;
+
                case LT_MARGIN:         // Margin style definition.
                        readMargin(lexrc);
                        break;
@@ -237,6 +248,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
                        intitle = lexrc.next() && lexrc.getInteger();
                        break;
 
+               case LT_OPTARGS:
+                       if (lexrc.next()) {
+                               optionalargs = lexrc.getInteger();
+                       }
+                       break;
+
                case LT_NEED_PROTECT:
                        needprotect = lexrc.next() && lexrc.getInteger();
                        break;
@@ -754,3 +771,9 @@ string const & LyXLayout::obsoleted_by() const
 {
        return obsoleted_by_;
 }
+
+
+string const & LyXLayout::depends_on() const
+{
+       return depends_on_;
+}