This patch implements NoFloat to be used in layout files. As well as some other minor stuff.
Comments welcome.
Index: src/FloatList.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FloatList.C,v retrieving revision 1.14 diff -u -p -r1.14 FloatList.C --- src/FloatList.C 4 Sep 2002 06:52:26 -0000 1.14 +++ src/FloatList.C 10 Sep 2002 21:57:57 -0000 @@ -26,29 +26,6 @@ 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 } @@ -98,6 +75,12 @@ Floating const & FloatList::getType(stri static Floating empty_float; return empty_float; #endif +} + + +void FloatList::erase(string const & t) +{ + list.erase(t); } Index: src/FloatList.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FloatList.h,v retrieving revision 1.9 diff -u -p -r1.9 FloatList.h --- src/FloatList.h 27 Aug 2002 15:51:17 -0000 1.9 +++ src/FloatList.h 10 Sep 2002 21:57:57 -0000 @@ -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: src/lyxtextclass.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.C,v retrieving revision 1.20 diff -u -p -r1.20 lyxtextclass.C --- src/lyxtextclass.C 6 Sep 2002 15:18:07 -0000 1.20 +++ src/lyxtextclass.C 10 Sep 2002 21:57:57 -0000 @@ -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 & f { "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 & f << 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 & f 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 & le 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: src/lyxtextclass.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.h,v retrieving revision 1.9 diff -u -p -r1.9 lyxtextclass.h --- src/lyxtextclass.h 6 Sep 2002 14:47:59 -0000 1.9 +++ src/lyxtextclass.h 10 Sep 2002 21:57:57 -0000 @@ -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_;
-- Lgb