support nofloat and try to reduce dependency a bit

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5261 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-09-11 07:39:55 +00:00
parent 71a678205c
commit 12b01bf0a2
5 changed files with 49 additions and 36 deletions

View 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> 2002-09-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* MenuBackend.C (expandToc): fix crash when there is no document * MenuBackend.C (expandToc): fix crash when there is no document
open open
2002-09-10 Dekel Tsur <dekelts@tau.ac.il> 2002-09-10 Dekel Tsur <dekelts@tau.ac.il>
@ -10,17 +27,17 @@
2002-09-09 John Levon <levon@movementarian.org> 2002-09-09 John Levon <levon@movementarian.org>
* text2.C: remove confusing and awkward depth wraparound * text2.C: remove confusing and awkward depth wraparound
2002-09-09 John Levon <levon@movementarian.org> 2002-09-09 John Levon <levon@movementarian.org>
* BufferView_pimpl.C: Don't use empty arg for LFUN_CHILD_INSERT * BufferView_pimpl.C: Don't use empty arg for LFUN_CHILD_INSERT
* buffer.h: * buffer.h:
* buffer.C: remove getIncludeonlyList() * buffer.C: remove getIncludeonlyList()
* paragraph.C: * paragraph.C:
* lyxfunc.C: remove headers * lyxfunc.C: remove headers
2002-09-09 Juergen Vigna <jug@sad.it> 2002-09-09 Juergen Vigna <jug@sad.it>
* text.C (getColumnNearX): fix form Michael this is most * text.C (getColumnNearX): fix form Michael this is most

View File

@ -26,29 +26,6 @@
FloatList::FloatList() 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 FloatList::const_iterator FloatList::operator[](string const & t) const
{ {
return list.find(t); return list.find(t);

View File

@ -43,6 +43,8 @@ public:
/// ///
Floating const & getType(string const & t) const; Floating const & getType(string const & t) const;
/// ///
void erase(string const & t);
///
const_iterator operator[](string const & t) const; const_iterator operator[](string const & t) const;
private: private:
/// ///

View File

@ -19,6 +19,7 @@
#include "debug.h" #include "debug.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "counters.h" #include "counters.h"
#include "FloatList.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/LAssert.h" #include "support/LAssert.h"
@ -49,7 +50,8 @@ struct compare_name {
LyXTextClass::LyXTextClass(string const & fn, string const & cln, LyXTextClass::LyXTextClass(string const & fn, string const & cln,
string const & desc) 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; outputType_ = LATEX;
columns_ = 1; columns_ = 1;
@ -104,7 +106,8 @@ enum TextClassTags {
TC_LEFTMARGIN, TC_LEFTMARGIN,
TC_RIGHTMARGIN, TC_RIGHTMARGIN,
TC_FLOAT, TC_FLOAT,
TC_COUNTER TC_COUNTER,
TC_NOFLOAT
}; };
@ -121,6 +124,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
{ "input", TC_INPUT }, { "input", TC_INPUT },
{ "leftmargin", TC_LEFTMARGIN }, { "leftmargin", TC_LEFTMARGIN },
{ "maxcounter", TC_MAXCOUNTER }, { "maxcounter", TC_MAXCOUNTER },
{ "nofloat", TC_NOFLOAT },
{ "nostyle", TC_NOSTYLE }, { "nostyle", TC_NOSTYLE },
{ "outputtype", TC_OUTPUTTYPE }, { "outputtype", TC_OUTPUTTYPE },
{ "pagestyle", TC_PAGESTYLE }, { "pagestyle", TC_PAGESTYLE },
@ -145,7 +149,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
<< MakeDisplayPath(filename) << MakeDisplayPath(filename)
<< endl; << endl;
LyXLex lexrc(textClassTags, TC_COUNTER); LyXLex lexrc(textClassTags, TC_NOFLOAT);
bool error = false; bool error = false;
lexrc.setFile(filename); lexrc.setFile(filename);
@ -322,6 +326,13 @@ bool LyXTextClass::Read(string const & filename, bool merge)
case TC_COUNTER: case TC_COUNTER:
readCounter(lexrc); readCounter(lexrc);
break; 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) { if (getout) {
Floating newfloat(type, placement, ext, within, Floating newfloat(type, placement, ext, within,
style, name, listname, builtin); style, name, listname, builtin);
floatlist_.newFloat(newfloat); floatlist_->newFloat(newfloat);
} }
lexrc.popTable(); lexrc.popTable();
@ -757,13 +768,13 @@ bool LyXTextClass::load() const
FloatList & LyXTextClass::floats() FloatList & LyXTextClass::floats()
{ {
return floatlist_; return *floatlist_.get();
} }
FloatList const & LyXTextClass::floats() const FloatList const & LyXTextClass::floats() const
{ {
return floatlist_; return *floatlist_.get();
} }

View File

@ -19,7 +19,6 @@
#include "lyxlayout.h" #include "lyxlayout.h"
#include "LString.h" #include "LString.h"
#include "lyxlayout_ptr_fwd.h" #include "lyxlayout_ptr_fwd.h"
#include "FloatList.h"
#include "support/types.h" #include "support/types.h"
@ -29,6 +28,7 @@
class LyXLex; class LyXLex;
class Counters; class Counters;
class FloatList;
/// ///
class LyXTextClass { class LyXTextClass {
@ -196,7 +196,7 @@ private:
LayoutList layoutlist_; LayoutList layoutlist_;
/// ///
FloatList floatlist_; boost::shared_ptr<FloatList> floatlist_;
/// ///
boost::shared_ptr<Counters> ctrs_; boost::shared_ptr<Counters> ctrs_;