]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNomencl.cpp
Fix GRAPHICS_EDIT of InsetGraphics
[lyx.git] / src / insets / InsetNomencl.cpp
index 838cf552bcb717082eeb1cd5c8abd6cff41b744c..10aef0f51d62d63f2bbbd857fc8cff8bbef4a2f7 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"
+
+using namespace std;
 
 namespace lyx {
 
-using std::string;
 
+/////////////////////////////////////////////////////////////////////
+//
+// InsetPrintNomencl
+//
+/////////////////////////////////////////////////////////////////////
 
 InsetNomencl::InsetNomencl(InsetCommandParams const & p)
        : InsetCommand(p, "nomenclature"),
-         glossary_entry_id(sgml::uniqueID(from_ascii("gloss")))
+         nomenclature_entry_id(sgml::uniqueID(from_ascii("nomen")))
 {}
 
 
-docstring const InsetNomencl::getScreenLabel(Buffer const &) const
+ParamInfo const & InsetNomencl::findInfo(string const & /* cmdName */)
 {
-       return _("Glo");
+       static ParamInfo param_info_;
+       if (param_info_.empty()) {
+               param_info_.add("prefix", ParamInfo::LATEX_OPTIONAL);
+               param_info_.add("symbol", ParamInfo::LATEX_REQUIRED);
+               param_info_.add("description", ParamInfo::LATEX_REQUIRED);
+       }
+       return param_info_;
 }
 
 
-int InsetNomencl::docbook(Buffer const &, odocstream & os,
-               OutputParams const &) const
+docstring InsetNomencl::screenLabel() const
 {
-       os << "<glossterm linkend=\"" << glossary_entry_id << "\">"
+       return _("Nom");
+}
+
+
+int InsetNomencl::docbook(odocstream & os, OutputParams const &) const
+{
+       os << "<glossterm linkend=\"" << nomenclature_entry_id << "\">"
           << sgml::escapeString(getParam("symbol"))
           << "</glossterm>";
        return 0;
@@ -52,7 +70,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,34 +88,43 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
 }
 
 
-InsetBase::Code InsetNomencl::lyxCode() const
-{
-       return InsetBase::NOMENCL_CODE;
-}
-
+/////////////////////////////////////////////////////////////////////
+//
+// InsetPrintNomencl
+//
+/////////////////////////////////////////////////////////////////////
 
 InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
        : InsetCommand(p, string())
 {}
 
 
-docstring const InsetPrintNomencl::getScreenLabel(Buffer const &) const
+ParamInfo const & InsetPrintNomencl::findInfo(string const & /* cmdName */)
+{
+       static ParamInfo param_info_;
+       if (param_info_.empty()) {
+               param_info_.add("labelwidth", ParamInfo::LATEX_REQUIRED);
+       }
+       return param_info_;
+}
+
+
+docstring InsetPrintNomencl::screenLabel() const
 {
-       return _("Glossary");
+       return _("Nomenclature");
 }
 
 
-int InsetPrintNomencl::docbook(Buffer const & buf, odocstream & os,
-               OutputParams const &) const
+int InsetPrintNomencl::docbook(odocstream & os, OutputParams const &) const
 {
        os << "<glossary>\n";
        int newlines = 2;
-       for (InsetIterator it = inset_iterator_begin(buf.inset()); it;) {
-               if (it->lyxCode() == InsetBase::NOMENCL_CODE) {
+       for (InsetIterator it = inset_iterator_begin(buffer().inset()); it;) {
+               if (it->lyxCode() == NOMENCL_CODE) {
                        newlines += static_cast<InsetNomencl const &>(*it).docbookGlossary(os);
                        ++it;
-               } else if(it->lyxCode() == InsetBase::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 +145,9 @@ void InsetPrintNomencl::validate(LaTeXFeatures & features) const
 }
 
 
-InsetBase::Code InsetPrintNomencl::lyxCode() const
+InsetCode InsetPrintNomencl::lyxCode() const
 {
-       return InsetBase::NOMENCL_PRINT_CODE;
+       return NOMENCL_PRINT_CODE;
 }