]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNomencl.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetNomencl.cpp
index 11384b535c412e70ff2b44f1f5b627b2137d5ceb..ac61c7a0c5e9ae5cc1893e687013eadb22502921 100644 (file)
 #include "Buffer.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
 #include "InsetIterator.h"
 #include "LaTeXFeatures.h"
 #include "MetricsInfo.h"
 #include "sgml.h"
 
+#include "support/docstream.h"
 
-namespace lyx {
+using namespace std;
 
-using std::string;
+namespace lyx {
 
 
 InsetNomencl::InsetNomencl(InsetCommandParams const & p)
        : InsetCommand(p, "nomenclature"),
-         glossary_entry_id(sgml::uniqueID(from_ascii("gloss")))
+         nomenclature_entry_id(sgml::uniqueID(from_ascii("nomen")))
 {}
 
 
+CommandInfo const * InsetNomencl::findInfo(string const & /* cmdName */)
+{
+       static const char * const paramnames[] = {"prefix", "symbol", "description", ""};
+       static const bool isoptional[] = {true, false, false};
+       static const CommandInfo info = {3, paramnames, isoptional};
+       return &info;
+}
+
+
 docstring const InsetNomencl::getScreenLabel(Buffer const &) const
 {
-       return _("Glo");
+       return _("Nom");
 }
 
 
 int InsetNomencl::docbook(Buffer const &, odocstream & os,
                OutputParams const &) const
 {
-       os << "<glossterm linkend=\"" << glossary_entry_id << "\">"
+       os << "<glossterm linkend=\"" << nomenclature_entry_id << "\">"
           << sgml::escapeString(getParam("symbol"))
           << "</glossterm>";
        return 0;
@@ -52,7 +62,7 @@ int InsetNomencl::docbook(Buffer const &, odocstream & os,
 
 int InsetNomencl::docbookGlossary(odocstream & os) const
 {
-       os << "<glossentry id=\"" << glossary_entry_id << "\">\n"
+       os << "<glossentry id=\"" << nomenclature_entry_id << "\">\n"
           << "<glossterm>"
           << sgml::escapeString(getParam("symbol"))
           << "</glossterm>\n"
@@ -70,20 +80,23 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
 }
 
 
-Inset::Code InsetNomencl::lyxCode() const
-{
-       return Inset::NOMENCL_CODE;
-}
-
-
 InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
        : InsetCommand(p, string())
 {}
 
 
+CommandInfo const * InsetPrintNomencl::findInfo(string const & /* cmdName */)
+{
+               static const char * const paramnames[] = {"labelwidth", ""};
+               static const bool isoptional[] = {true};
+               static const CommandInfo info = {1, paramnames, isoptional};
+               return &info;
+}
+
+
 docstring const InsetPrintNomencl::getScreenLabel(Buffer const &) const
 {
-       return _("Glossary");
+       return _("Nomenclature");
 }
 
 
@@ -93,11 +106,11 @@ int InsetPrintNomencl::docbook(Buffer const & buf, odocstream & os,
        os << "<glossary>\n";
        int newlines = 2;
        for (InsetIterator it = inset_iterator_begin(buf.inset()); it;) {
-               if (it->lyxCode() == Inset::NOMENCL_CODE) {
+               if (it->lyxCode() == NOMENCL_CODE) {
                        newlines += static_cast<InsetNomencl const &>(*it).docbookGlossary(os);
                        ++it;
-               } else if(it->lyxCode() == Inset::NOTE_CODE &&
-                         static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
+               } else if(it->lyxCode() == NOTE_CODE &&
+                         static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
                        // Don't output anything nested in note insets
                        size_t const depth = it.depth();
                        ++it;
@@ -118,9 +131,9 @@ void InsetPrintNomencl::validate(LaTeXFeatures & features) const
 }
 
 
-Inset::Code InsetPrintNomencl::lyxCode() const
+InsetCode InsetPrintNomencl::lyxCode() const
 {
-       return Inset::NOMENCL_PRINT_CODE;
+       return NOMENCL_PRINT_CODE;
 }