]> git.lyx.org Git - features.git/commitdiff
support nofloat and try to reduce dependency a bit
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 11 Sep 2002 07:39:55 +0000 (07:39 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 11 Sep 2002 07:39:55 +0000 (07:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5261 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/FloatList.C
src/FloatList.h
src/lyxtextclass.C
src/lyxtextclass.h

index 52d277e58aa0c5cf8a3097c0b275304019059edd..776dbd7141ce3bcf6f44f4b52f690e50e34df07d 100644 (file)
@@ -1,7 +1,24 @@
+2002-09-11  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyxtextclass.h: don't include FloatList.h, forward declare instead.
+       make floatlist_ a boost::shared_ptr<FloatList>
+
+       * lyxtextclass.C: include FloatList.h
+       (LyXTextClass): initialize floatlist_
+       (TextClassTags): add TC_NOFLOAT
+       (Read): match "nofloat" to TC_NOFLOAT and use it.
+       (readFloat): modify call to floatlist_
+       (floats): ditto
+       (floats): ditto
+
+       * FloatList.[Ch] (FloatList): remove commented out float
+       initialization.
+       (erase): new function
+
 2002-09-10  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * MenuBackend.C (expandToc): fix crash when there is no document
-       open 
+       open
 
 2002-09-10  Dekel Tsur  <dekelts@tau.ac.il>
 
 2002-09-09  John Levon  <levon@movementarian.org>
 
        * text2.C: remove confusing and awkward depth wraparound
+
 2002-09-09  John Levon  <levon@movementarian.org>
 
        * BufferView_pimpl.C: Don't use empty arg for LFUN_CHILD_INSERT
 
        * buffer.h:
        * buffer.C: remove getIncludeonlyList()
-       * paragraph.C: 
+
+       * paragraph.C:
        * lyxfunc.C: remove headers
+
 2002-09-09  Juergen Vigna  <jug@sad.it>
 
        * text.C (getColumnNearX): fix form Michael this is most
index 2e12fcf31f5c4f28e1edf1f23dc84ae24dc519d6..5647c71073182cf624c1074a6b0da253ef31a7cc 100644 (file)
 
 FloatList::FloatList()
 {
-#if 0
-       // Insert the latex builtin float-types
-       // (these will later be read from a layout file)
-
-       // table
-       Floating table("table", "tbp", "lot", "", "plain", N_("Table"),
-                      N_("List of Tables"), true);
-       newFloat(table);
-
-       // figure
-       Floating figure("figure", "tbp", "lof",
-                       "", "plain", N_("Figure"),
-                       N_("List of Figures"), true);
-       newFloat(figure);
-
-       // And we add algorithm too since LyX has
-       // supported that for a long time,
-       // but support for this should probably be moved to a layout file.
-       Floating algorithm("algorithm", "htbp", "loa",
-                          "", "ruled", N_("Algorithm"),
-                          N_("List of Algorithms"));
-       newFloat(algorithm);
-#endif
 }
 
 
@@ -101,6 +78,12 @@ Floating const & FloatList::getType(string const & t) const
 }
 
 
+void FloatList::erase(string const & t)
+{
+       list.erase(t);
+}
+
+
 FloatList::const_iterator FloatList::operator[](string const & t) const
 {
        return list.find(t);
index 150399dc377006953139588b63d3f61e464de123..5d05702ba79b9ce5435a5915045b758fc71206c2 100644 (file)
@@ -43,6 +43,8 @@ public:
        ///
        Floating const & getType(string const & t) const;
        ///
+       void erase(string const & t);
+       ///
        const_iterator operator[](string const & t) const;
 private:
        ///
index e1db73ad69c62a4cf2eac92696e148135118a369..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;
@@ -104,7 +106,8 @@ enum TextClassTags {
        TC_LEFTMARGIN,
        TC_RIGHTMARGIN,
        TC_FLOAT,
-       TC_COUNTER
+       TC_COUNTER,
+       TC_NOFLOAT
 };
 
 
@@ -121,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 },
@@ -145,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);
@@ -322,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;
+
                }
        }
 
@@ -588,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();
@@ -757,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();
 }
 
 
index 5063a13b0f2adb61840a9ae134df087740697bd0..007bc43a83c0c85d98c51a1c8c32991c0b82ac6b 100644 (file)
@@ -19,7 +19,6 @@
 #include "lyxlayout.h"
 #include "LString.h"
 #include "lyxlayout_ptr_fwd.h"
-#include "FloatList.h"
 
 #include "support/types.h"
 
@@ -29,6 +28,7 @@
 
 class LyXLex;
 class Counters;
+class FloatList;
 
 ///
 class LyXTextClass {
@@ -196,7 +196,7 @@ private:
        LayoutList layoutlist_;
 
        ///
-       FloatList floatlist_;
+       boost::shared_ptr<FloatList> floatlist_;
 
        ///
        boost::shared_ptr<Counters> ctrs_;