#include "insetfloatlist.h"
#include "FloatList.h"
+#include "LaTeXFeatures.h"
#include "frontends/Dialogs.h"
#include "LyXView.h"
#include "BufferView.h"
#include "gettext.h"
#include "debug.h"
+
+using std::ostream;
using std::endl;
+
InsetFloatList::InsetFloatList()
: InsetCommand(InsetCommandParams())
{
}
-
+
InsetFloatList::InsetFloatList(string const & type)
: InsetCommand(InsetCommandParams())
{
}
-string const InsetFloatList::getScreenLabel(Buffer const *) const
+string const InsetFloatList::getScreenLabel(Buffer const *) const
{
- string const guiName = floatList[getCmdName()]->second.name();
- if (!guiName.empty()) {
- string const res = guiName + _(" List");
- return res;
- }
- return _("ERROR: Nonexistent float type!");
+ FloatList::const_iterator it = floatList[getCmdName()];
+ if (it != floatList.end())
+ return _(it->second.listName());
+ else
+ return _("ERROR: Nonexistent float type!");
}
}
-void InsetFloatList::write(Buffer const *, std::ostream & os) const
+void InsetFloatList::write(Buffer const *, ostream & os) const
{
os << "FloatList " << getCmdName() << "\n";
}
-void InsetFloatList::read(Buffer const *, LyXLex & lex)
+void InsetFloatList::read(Buffer const *, LyXLex & lex)
{
string token;
if (lex.eatLine()) {
setCmdName(lex.getString());
- lyxerr << "FloatList::float_type: " << getCmdName() << endl;
+ lyxerr[Debug::INSETS] << "FloatList::float_type: " << getCmdName() << endl;
+ if (!floatList.typeExist(getCmdName()))
+ lex.printError("InsetFloatList: Unknown float type: `$$Token'");
} else
lex.printError("InsetFloatList: Parse error: `$$Token'");
while (lex.isOK()) {
}
-int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
+int InsetFloatList::latex(Buffer const *, ostream & os, bool, bool) const
{
FloatList::const_iterator cit = floatList[getCmdName()];
}
} else {
os << "\\listof{" << getCmdName() << "}{"
- << _("List of ") << cit->second.name() << "}\n";
+ << cit->second.listName() << "}\n";
}
} else {
os << "%%\\listof{" << getCmdName() << "}{"
}
-int InsetFloatList::ascii(Buffer const * buffer, std::ostream & os, int) const
+int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
{
os << getScreenLabel(buffer) << "\n\n";
os << "\n";
return 0;
}
+
+
+void InsetFloatList::validate(LaTeXFeatures & features) const
+{
+ features.useFloat(getCmdName());
+}