]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloatlist.C
use more specific smart_ptr headers
[lyx.git] / src / insets / insetfloatlist.C
index 8d2c565f094cfedad4a40994294d6208c7612f2e..7c146848c2179004318197eec0d3ffb9fae5dcf0 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "insetfloatlist.h"
 #include "FloatList.h"
+#include "LaTeXFeatures.h"
 #include "frontends/Dialogs.h"
 #include "LyXView.h"
 #include "BufferView.h"
@@ -23,7 +24,7 @@ InsetFloatList::InsetFloatList()
 {
 }
 
+
 InsetFloatList::InsetFloatList(string const & type)
        : InsetCommand(InsetCommandParams())
 {
@@ -31,14 +32,13 @@ InsetFloatList::InsetFloatList(string const & type)
 }
 
 
-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!");
 }
 
 
@@ -54,13 +54,15 @@ void InsetFloatList::write(Buffer const *, ostream & os) const
 }
 
 
-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()) {
@@ -105,7 +107,7 @@ int InsetFloatList::latex(Buffer const *, ostream & os, bool, bool) const
                        }
                } else {
                        os << "\\listof{" << getCmdName() << "}{"
-                          << _("List of ") << cit->second.name() << "}\n";
+                          << cit->second.listName() << "}\n";
                }
        } else {
                os << "%%\\listof{" << getCmdName() << "}{"
@@ -133,3 +135,9 @@ int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
        os << "\n";
        return 0;
 }
+
+
+void InsetFloatList::validate(LaTeXFeatures & features) const
+{
+       features.useFloat(getCmdName());
+}