commit 8b00b355ca7012ca703c78a8be89193ac6435fcb Author: Richard Heck <rgh...@lyx.org> Date: Sat Mar 29 13:34:36 2014 -0400
Change forToc() to forOutliner(), to avoid confusion. The old name is left over from when the outliner really did just display a TOC. diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 4d9b37c..098ea65 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -3374,7 +3374,7 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options) const } -void Paragraph::forToc(docstring & os, size_t maxlen) const +void Paragraph::forOutliner(docstring & os, size_t maxlen) const { if (!d->params_.labelString().empty()) os += d->params_.labelString() + ' '; @@ -3387,7 +3387,7 @@ void Paragraph::forToc(docstring & os, size_t maxlen) const else if (c == '\t' || c == '\n') os += ' '; else if (c == META_INSET) - getInset(i)->forToc(os, maxlen); + getInset(i)->forOutliner(os, maxlen); } } diff --git a/src/Paragraph.h b/src/Paragraph.h index 9558048..ba62f9b 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -177,7 +177,7 @@ public: docstring asString(pos_type beg, pos_type end, int options = AS_STR_NONE) const; /// - void forToc(docstring &, size_t maxlen) const; + void forOutliner(docstring &, size_t maxlen) const; /// Extract only the explicitly visible text (without any formatting), /// descending into insets diff --git a/src/Text.cpp b/src/Text.cpp index cdcc200..589fd25 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -2012,14 +2012,14 @@ docstring Text::asString(pit_type beg, pit_type end, int options) const } -void Text::forToc(docstring & os, size_t maxlen, bool shorten) const +void Text::forOutliner(docstring & os, size_t maxlen, bool shorten) const { if (maxlen == 0) maxlen = std::numeric_limits<std::size_t>::max(); else LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH); for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i) - pars_[i].forToc(os, maxlen); + pars_[i].forOutliner(os, maxlen); if (shorten && os.length() >= maxlen) os = os.substr(0, maxlen - 3) + from_ascii("..."); } diff --git a/src/Text.h b/src/Text.h index 7ee76d2..189a422 100644 --- a/src/Text.h +++ b/src/Text.h @@ -130,7 +130,7 @@ public: /// if \param os is longer than maxlen chars. /// if \param maxlen is passed as 0, then it is ignored. (In fact, /// it is reset to the maximum value for size_t.) - void forToc(docstring & os, size_t maxlen, bool shorten = true) const; + void forOutliner(docstring & os, size_t maxlen, bool shorten = true) const; /// insert a character at cursor position /// FIXME: replace Cursor with DocIterator. diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 66bdf0b..cce0f32 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -258,7 +258,7 @@ docstring Inset::toolTip(BufferView const &, int, int) const } -void Inset::forToc(docstring &, size_t) const +void Inset::forOutliner(docstring &, size_t) const { } diff --git a/src/insets/Inset.h b/src/insets/Inset.h index b18f8a5..0ed8ff4 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -333,7 +333,7 @@ public: virtual void toString(odocstream &) const {} /// Appends a potentially abbreviated version of the inset to /// \param str. Intended for use by the TOC. - virtual void forToc(docstring & str, + virtual void forOutliner(docstring & str, size_t maxlen = TOC_ENTRY_LENGTH) const; /// can the contents of the inset be edited on screen ? diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 2676d93..144123f 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -299,10 +299,10 @@ void InsetBranch::toString(odocstream & os) const } -void InsetBranch::forToc(docstring & os, size_t maxlen) const +void InsetBranch::forOutliner(docstring & os, size_t maxlen) const { if (isBranchSelected()) - InsetCollapsable::forToc(os, maxlen); + InsetCollapsable::forOutliner(os, maxlen); } @@ -355,7 +355,7 @@ void InsetBranch::addToToc(DocIterator const & cpit, bool output_active) const Toc & toc = buffer().tocBackend().toc("branch"); docstring str = params_.branch + ": "; - text().forToc(str, TOC_ENTRY_LENGTH); + text().forOutliner(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. bool const doing_output = output_active && isBranchSelected(); diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index 7521fbe..ecd2f7d 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -76,7 +76,7 @@ private: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// void validate(LaTeXFeatures &) const; /// diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index f6b2467..14baf86 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -104,7 +104,7 @@ void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const Toc & toc = buffer().tocBackend().toc(floattype_); docstring str = full_label_; int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH; - text().forToc(str, length); + text().forOutliner(str, length); toc.push_back(TocItem(pit, 0, str, output_active)); // Proceed with the rest of the inset. diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 96620c1..78a9cdc 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -403,7 +403,7 @@ void InsetCitation::toString(odocstream & os) const } -void InsetCitation::forToc(docstring & os, size_t) const +void InsetCitation::forOutliner(docstring & os, size_t) const { os += screenLabel(); } diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 2e78e01..8d7bb79 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -59,7 +59,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// void validate(LaTeXFeatures &) const {} /// diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 372bfab..bfb637e 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -68,7 +68,7 @@ void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const Toc & toc = buffer().tocBackend().toc("footnote"); docstring str = custom_label_ + ": "; - text().forToc(str, TOC_ENTRY_LENGTH); + text().forOutliner(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. InsetFootlike::addToToc(cpit, output_active); diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp index 81caa37..cbcf613 100644 --- a/src/insets/InsetHyperlink.cpp +++ b/src/insets/InsetHyperlink.cpp @@ -257,7 +257,7 @@ void InsetHyperlink::toString(odocstream & os) const } -void InsetHyperlink::forToc(docstring & os, size_t) const +void InsetHyperlink::forOutliner(docstring & os, size_t) const { docstring const & n = getParam("name"); if (!n.empty()) { diff --git a/src/insets/InsetHyperlink.h b/src/insets/InsetHyperlink.h index b33665e..6bc0c64 100644 --- a/src/insets/InsetHyperlink.h +++ b/src/insets/InsetHyperlink.h @@ -38,7 +38,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// docstring toolTip(BufferView const & bv, int x, int y) const; /// diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp index 21f2d11..46d7519 100644 --- a/src/insets/InsetIPAMacro.cpp +++ b/src/insets/InsetIPAMacro.cpp @@ -596,7 +596,7 @@ void InsetIPAChar::toString(odocstream & os) const } -void InsetIPAChar::forToc(docstring & os, size_t) const +void InsetIPAChar::forOutliner(docstring & os, size_t) const { odocstringstream ods; plaintext(ods, OutputParams(0)); diff --git a/src/insets/InsetIPAMacro.h b/src/insets/InsetIPAMacro.h index 077889c..ff07b40 100644 --- a/src/insets/InsetIPAMacro.h +++ b/src/insets/InsetIPAMacro.h @@ -156,7 +156,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// InsetCode lyxCode() const { return IPACHAR_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 57c0d07..9db1aca 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -353,7 +353,7 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this))); docstring str; - text().forToc(str, 0); + text().forOutliner(str, 0); buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str, output_active)); // Proceed with the rest of the inset. InsetCollapsable::addToToc(cpit, output_active); diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp index 9543e8f..996d6ec 100644 --- a/src/insets/InsetMarginal.cpp +++ b/src/insets/InsetMarginal.cpp @@ -58,7 +58,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const Toc & toc = buffer().tocBackend().toc("marginalnote"); docstring str; - text().forToc(str, TOC_ENTRY_LENGTH); + text().forOutliner(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. InsetFootlike::addToToc(cpit, output_active); diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index 7511708..6bb294d 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -203,7 +203,7 @@ void InsetNote::addToToc(DocIterator const & cpit, bool output_active) const Toc & toc = buffer().tocBackend().toc("note"); InsetLayout const & il = getLayout(); docstring str = translateIfPossible(il.labelstring()) + from_ascii(": "); - text().forToc(str, TOC_ENTRY_LENGTH); + text().forOutliner(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 70911fd..8a183fa 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -337,7 +337,7 @@ void InsetQuotes::toString(odocstream & os) const } -void InsetQuotes::forToc(docstring & os, size_t) const +void InsetQuotes::forOutliner(docstring & os, size_t) const { os += displayString(); } diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index 743208f..932cd91 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -90,7 +90,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t maxlen) const; + void forOutliner(docstring &, size_t maxlen) const; /// void validate(LaTeXFeatures &) const; diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index 464a3dd..a7f48f8 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -260,7 +260,7 @@ void InsetRef::toString(odocstream & os) const } -void InsetRef::forToc(docstring & os, size_t) const +void InsetRef::forOutliner(docstring & os, size_t) const { // There's no need for details in the TOC, and a long label // will just get in the way. diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h index 7cd0a11..255b60d 100644 --- a/src/insets/InsetRef.h +++ b/src/insets/InsetRef.h @@ -62,7 +62,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// void validate(LaTeXFeatures & features) const; /// diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index 16e1cb5..f7a1cd9 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -830,7 +830,7 @@ void InsetSpace::toString(odocstream & os) const } -void InsetSpace::forToc(docstring & os, size_t) const +void InsetSpace::forOutliner(docstring & os, size_t) const { // There's no need to be cute here. os += " "; diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index c4315a1..8055706 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -135,7 +135,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// bool hasSettings() const { return true; } /// diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index f342d0f..58df102 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -338,7 +338,7 @@ void InsetSpecialChar::toString(odocstream & os) const } -void InsetSpecialChar::forToc(docstring & os, size_t) const +void InsetSpecialChar::forOutliner(docstring & os, size_t) const { odocstringstream ods; plaintext(ods, OutputParams(0)); diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h index 423afda..5ce620c 100644 --- a/src/insets/InsetSpecialChar.h +++ b/src/insets/InsetSpecialChar.h @@ -70,7 +70,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// InsetCode lyxCode() const { return SPECIALCHAR_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 346e007..609de70 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -800,11 +800,11 @@ void InsetText::toString(odocstream & os) const } -void InsetText::forToc(docstring & os, size_t maxlen) const +void InsetText::forOutliner(docstring & os, size_t maxlen) const { if (!getLayout().isInToc()) return; - text().forToc(os, maxlen, false); + text().forOutliner(os, maxlen, false); } @@ -856,9 +856,9 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) cons tocstring = par.labelString(); if (!tocstring.empty()) tocstring += ' '; - arginset->text().forToc(tocstring, length); + arginset->text().forOutliner(tocstring, length); } else - par.forToc(tocstring, length); + par.forOutliner(tocstring, length); dit.pos() = 0; toc.push_back(TocItem(dit, toclevel - min_toclevel, tocstring, doing_output, tocstring)); diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 7343ee5..1a6d123 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -170,7 +170,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// void addToToc(DocIterator const & di, bool output_active) const; /// diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 4c20625..4a27d75 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -2283,7 +2283,7 @@ void InsetMathHull::toString(odocstream & os) const } -void InsetMathHull::forToc(docstring & os, size_t) const +void InsetMathHull::forOutliner(docstring & os, size_t) const { odocstringstream ods; OutputParams op(0); diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 0cffffd..6eb74e7 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -140,7 +140,7 @@ public: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t) const; /// get notification when the cursor leaves this inset bool notifyCursorLeaves(Cursor const & old, Cursor & cur);