X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetNomencl.cpp;h=76bd7b3a0aa8d56da215ddc628cc16c88f23a59d;hb=d4550b7a4d64e9ff772cf3a7635cb4ca532fb340;hp=f7f740aa6f4673fbde19818cee36ff27f2141c11;hpb=4a6efbb102c98ce319bf3a00dd4883b67b7b4b57;p=lyx.git diff --git a/src/insets/InsetNomencl.cpp b/src/insets/InsetNomencl.cpp index f7f740aa6f..76bd7b3a0a 100644 --- a/src/insets/InsetNomencl.cpp +++ b/src/insets/InsetNomencl.cpp @@ -31,6 +31,7 @@ #include "OutputParams.h" #include "output_xhtml.h" #include "sgml.h" +#include "texstream.h" #include "TocBackend.h" #include "frontends/FontMetrics.h" @@ -75,12 +76,8 @@ ParamInfo const & InsetNomencl::findInfo(string const & /* cmdName */) docstring InsetNomencl::screenLabel() const { size_t const maxLabelChars = 25; - docstring label = _("Nom: ") + getParam("symbol"); - if (label.size() > maxLabelChars) { - label.erase(maxLabelChars - 3); - label += "..."; - } + support::truncateWithEllipsis(label, maxLabelChars); return label; } @@ -96,6 +93,14 @@ docstring InsetNomencl::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/) } +int InsetNomencl::plaintext(odocstringstream & os, + OutputParams const &, size_t) const +{ + docstring s = "[" + getParam("symbol") + ": " + getParam("description") + "]"; + os << s; + return s.size(); +} + int InsetNomencl::docbook(odocstream & os, OutputParams const &) const { @@ -132,10 +137,11 @@ void InsetNomencl::validate(LaTeXFeatures & features) const } -void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active) const +void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active, + UpdateType) const { docstring const str = getParam("symbol"); - buffer().tocBackend().toc("nomencl").push_back(TocItem(cpit, 0, str, output_active)); + buffer().tocBackend().toc("nomencl")->push_back(TocItem(cpit, 0, str, output_active)); } @@ -174,7 +180,7 @@ docstring InsetPrintNomencl::screenLabel() const struct NomenclEntry { - NomenclEntry() {} + NomenclEntry() : par(0) {} NomenclEntry(docstring s, docstring d, Paragraph const * p) : symbol(s), desc(d), par(p) {} @@ -190,11 +196,11 @@ typedef map EntryMap; docstring InsetPrintNomencl::xhtml(XHTMLStream &, OutputParams const & op) const { - Toc const & toc = buffer().tocBackend().toc("nomencl"); + shared_ptr toc = buffer().tocBackend().toc("nomencl"); EntryMap entries; - Toc::const_iterator it = toc.begin(); - Toc::const_iterator const en = toc.end(); + Toc::const_iterator it = toc->begin(); + Toc::const_iterator const en = toc->end(); for (; it != en; ++it) { DocIterator dit = it->dit(); Paragraph const & par = dit.innerParagraph();