]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtextclass.C
cursor fix
[lyx.git] / src / lyxtextclass.C
index f1ee3e12c01df1b5743500898ec45f2f593917ec..376f20975a3a8c714c03ce6974be2adcafc6994f 100644 (file)
@@ -19,6 +19,7 @@
 #include "debug.h"
 #include "lyxlex.h"
 #include "counters.h"
+#include "FloatList.h"
 
 #include "support/lstrings.h"
 #include "support/LAssert.h"
@@ -49,7 +50,8 @@ struct compare_name {
 
 LyXTextClass::LyXTextClass(string const & fn, string const & cln,
                           string const & desc)
-       : name_(fn), latexname_(cln), description_(desc), ctrs_(new Counters)
+       : name_(fn), latexname_(cln), description_(desc),
+         floatlist_(new FloatList), ctrs_(new Counters)
 {
        outputType_ = LATEX;
        columns_ = 1;
@@ -72,15 +74,9 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
        if (!lay.Read(lexrc, *this)) {
                // Resolve fonts
                lay.resfont = lay.font;
-#ifndef INHERIT_LANGUAGE
                lay.resfont.realize(defaultfont());
                lay.reslabelfont = lay.labelfont;
                lay.reslabelfont.realize(defaultfont());
-#else
-               lay.resfont.realize(defaultfont(), default_language);
-               lay.reslabelfont = lay.labelfont;
-               lay.reslabelfont.realize(defaultfont(), default_language);
-#endif
                return false; // no errors
        }
        lyxerr << "Error parsing style `" << lay.name() << "'" << endl;
@@ -110,7 +106,8 @@ enum TextClassTags {
        TC_LEFTMARGIN,
        TC_RIGHTMARGIN,
        TC_FLOAT,
-       TC_COUNTER
+       TC_COUNTER,
+       TC_NOFLOAT
 };
 
 
@@ -127,6 +124,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                { "input",           TC_INPUT },
                { "leftmargin",      TC_LEFTMARGIN },
                { "maxcounter",      TC_MAXCOUNTER },
+               { "nofloat",         TC_NOFLOAT },
                { "nostyle",         TC_NOSTYLE },
                { "outputtype",      TC_OUTPUTTYPE },
                { "pagestyle",       TC_PAGESTYLE },
@@ -151,7 +149,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                                     << MakeDisplayPath(filename)
                                     << endl;
 
-       LyXLex lexrc(textClassTags, TC_COUNTER);
+       LyXLex lexrc(textClassTags, TC_NOFLOAT);
        bool error = false;
 
        lexrc.setFile(filename);
@@ -266,12 +264,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                        if (!defaultfont_.resolved()) {
                                lexrc.printError("Warning: defaultfont should "
                                                 "be fully instantiated!");
-#ifndef INHERIT_LANGUAGE
                                defaultfont_.realize(LyXFont(LyXFont::ALL_SANE));
-#else
-                               defaultfont_.realize(LyXFont(LyXFont::ALL_SANE),
-                                                    default_language);
-#endif
                        }
                        break;
 
@@ -333,6 +326,13 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                case TC_COUNTER:
                        readCounter(lexrc);
                        break;
+               case TC_NOFLOAT:
+                       if (lexrc.next()) {
+                               string const nofloat = lexrc.getString();
+                               floatlist_->erase(nofloat);
+                       }
+                       break;
+
                }
        }
 
@@ -599,7 +599,7 @@ void LyXTextClass::readFloat(LyXLex & lexrc)
        if (getout) {
                Floating newfloat(type, placement, ext, within,
                                  style, name, listname, builtin);
-               floatlist_.newFloat(newfloat);
+               floatlist_->newFloat(newfloat);
        }
 
        lexrc.popTable();
@@ -768,13 +768,13 @@ bool LyXTextClass::load() const
 
 FloatList & LyXTextClass::floats()
 {
-       return floatlist_;
+       return *floatlist_.get();
 }
 
 
 FloatList const & LyXTextClass::floats() const
 {
-       return floatlist_;
+       return *floatlist_.get();
 }