]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtextclass.C
Alfredo's second patch
[lyx.git] / src / lyxtextclass.C
index 3e2365c60ad0486842a49aeeefaaf774517882ee..61b2b1f44c8654a39a13acde1061245433e69a3a 100644 (file)
@@ -39,7 +39,6 @@ struct compare_name {
 
        bool operator()(boost::shared_ptr<LyXLayout> const & c)
        {
-               //lyxerr << "comparing '" << name_ << "' to '" << c->name() << "'\n";
                return c->name() == name_;
        }
 
@@ -93,6 +92,7 @@ enum TextClassTags {
        TC_INPUT,
        TC_STYLE,
        TC_DEFAULTSTYLE,
+       TC_ENVIRONMENT,
        TC_NOSTYLE,
        TC_COLUMNS,
        TC_SIDES,
@@ -113,8 +113,7 @@ enum TextClassTags {
        TC_COUNTER,
        TC_NOFLOAT,
        TC_TITLELATEXNAME,
-       TC_TITLELATEXTYPE,
-       TC_ENVIRONMENT
+       TC_TITLELATEXTYPE
 };
 
 // Reads a textclass structure from file.
@@ -126,6 +125,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                { "counter",         TC_COUNTER },
                { "defaultfont",     TC_DEFAULTFONT },
                { "defaultstyle",    TC_DEFAULTSTYLE },
+               { "environment",     TC_ENVIRONMENT },
                { "float",           TC_FLOAT },
                { "input",           TC_INPUT },
                { "leftmargin",      TC_LEFTMARGIN },
@@ -157,7 +157,8 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                                     << MakeDisplayPath(filename)
                                     << endl;
 
-       LyXLex lexrc(textClassTags, TC_TITLELATEXTYPE);
+       LyXLex lexrc(textClassTags,
+               sizeof(textClassTags) / sizeof(textClassTags[0]));
        bool error = false;
 
        lexrc.setFile(filename);
@@ -166,6 +167,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
        // parsing
        while (lexrc.isOK() && !error) {
                int le = lexrc.lex();
+
                switch (le) {
                case LyXLex::LEX_FEOF:
                        continue;
@@ -174,9 +176,13 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                        lexrc.printError("Unknown TextClass tag `$$Token'");
                        error = true;
                        continue;
-               default: break;
+
+               default:
+                       break;
                }
+
                switch (static_cast<TextClassTags>(le)) {
+
                case TC_OUTPUTTYPE:   // output type definition
                        readOutputType(lexrc);
                        break;
@@ -214,7 +220,8 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                                        LyXLayout lay;
                                        lay.setName(name);
                                        if (!(error = do_readStyle(lexrc, lay)))
-                                               layoutlist_.push_back(boost::shared_ptr<LyXLayout>(new LyXLayout(lay)));
+                                               layoutlist_.push_back
+                                                       (boost::shared_ptr<LyXLayout>(new LyXLayout(lay)));
                                        if (defaultlayout_.empty()) {
                                                // We do not have a default
                                                // layout yet, so we choose
@@ -479,13 +486,16 @@ void LyXTextClass::readMaxCounter(LyXLex & lexrc)
        };
 
        pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV);
+
        int le = lexrc.lex();
        switch (le) {
        case LyXLex::LEX_UNDEF:
                lexrc.printError("Unknown MaxCounter tag `$$Token'");
                return;
-       default: break;
+       default:
+               break;
        }
+
        switch (static_cast<MaxCounterTags>(le)) {
        case MC_COUNTER_CHAPTER:
                maxcounter_ = LABEL_COUNTER_CHAPTER;