Change forToc() to forOutliner(), to avoid confusion. The old name

is left over from when the outliner really did just display a TOC.
This commit is contained in:
Richard Heck 2014-03-29 13:34:36 -04:00
parent f13e9a183d
commit 8b00b355ca
31 changed files with 38 additions and 38 deletions

View File

@ -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()) if (!d->params_.labelString().empty())
os += d->params_.labelString() + ' '; os += d->params_.labelString() + ' ';
@ -3387,7 +3387,7 @@ void Paragraph::forToc(docstring & os, size_t maxlen) const
else if (c == '\t' || c == '\n') else if (c == '\t' || c == '\n')
os += ' '; os += ' ';
else if (c == META_INSET) else if (c == META_INSET)
getInset(i)->forToc(os, maxlen); getInset(i)->forOutliner(os, maxlen);
} }
} }

View File

@ -177,7 +177,7 @@ public:
docstring asString(pos_type beg, pos_type end, docstring asString(pos_type beg, pos_type end,
int options = AS_STR_NONE) const; 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), /// Extract only the explicitly visible text (without any formatting),
/// descending into insets /// descending into insets

View File

@ -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) if (maxlen == 0)
maxlen = std::numeric_limits<std::size_t>::max(); maxlen = std::numeric_limits<std::size_t>::max();
else else
LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH); LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH);
for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i) 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) if (shorten && os.length() >= maxlen)
os = os.substr(0, maxlen - 3) + from_ascii("..."); os = os.substr(0, maxlen - 3) + from_ascii("...");
} }

View File

@ -130,7 +130,7 @@ public:
/// if \param os is longer than maxlen chars. /// if \param os is longer than maxlen chars.
/// if \param maxlen is passed as 0, then it is ignored. (In fact, /// if \param maxlen is passed as 0, then it is ignored. (In fact,
/// it is reset to the maximum value for size_t.) /// 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 /// insert a character at cursor position
/// FIXME: replace Cursor with DocIterator. /// FIXME: replace Cursor with DocIterator.

View File

@ -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
{ {
} }

View File

@ -333,7 +333,7 @@ public:
virtual void toString(odocstream &) const {} virtual void toString(odocstream &) const {}
/// Appends a potentially abbreviated version of the inset to /// Appends a potentially abbreviated version of the inset to
/// \param str. Intended for use by the TOC. /// \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; size_t maxlen = TOC_ENTRY_LENGTH) const;
/// can the contents of the inset be edited on screen ? /// can the contents of the inset be edited on screen ?

View File

@ -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()) 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"); Toc & toc = buffer().tocBackend().toc("branch");
docstring str = params_.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))); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.
bool const doing_output = output_active && isBranchSelected(); bool const doing_output = output_active && isBranchSelected();

View File

@ -76,7 +76,7 @@ private:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/// ///

View File

@ -104,7 +104,7 @@ void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
Toc & toc = buffer().tocBackend().toc(floattype_); Toc & toc = buffer().tocBackend().toc(floattype_);
docstring str = full_label_; docstring str = full_label_;
int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH; 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)); toc.push_back(TocItem(pit, 0, str, output_active));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.

View File

@ -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(); os += screenLabel();
} }

View File

@ -59,7 +59,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
void validate(LaTeXFeatures &) const {} void validate(LaTeXFeatures &) const {}
/// ///

View File

@ -68,7 +68,7 @@ void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const
Toc & toc = buffer().tocBackend().toc("footnote"); Toc & toc = buffer().tocBackend().toc("footnote");
docstring str = custom_label_ + ": "; 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))); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.
InsetFootlike::addToToc(cpit, output_active); InsetFootlike::addToToc(cpit, output_active);

View File

@ -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"); docstring const & n = getParam("name");
if (!n.empty()) { if (!n.empty()) {

View File

@ -38,7 +38,7 @@ public:
/// ///
void toString(odocstream &) const; 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; docstring toolTip(BufferView const & bv, int x, int y) const;
/// ///

View File

@ -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; odocstringstream ods;
plaintext(ods, OutputParams(0)); plaintext(ods, OutputParams(0));

View File

@ -156,7 +156,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
InsetCode lyxCode() const { return IPACHAR_CODE; } InsetCode lyxCode() const { return IPACHAR_CODE; }
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset

View File

@ -353,7 +353,7 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const
DocIterator pit = cpit; DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this))); pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
docstring str; docstring str;
text().forToc(str, 0); text().forOutliner(str, 0);
buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str, output_active)); buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str, output_active));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.
InsetCollapsable::addToToc(cpit, output_active); InsetCollapsable::addToToc(cpit, output_active);

View File

@ -58,7 +58,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const
Toc & toc = buffer().tocBackend().toc("marginalnote"); Toc & toc = buffer().tocBackend().toc("marginalnote");
docstring str; 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))); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.
InsetFootlike::addToToc(cpit, output_active); InsetFootlike::addToToc(cpit, output_active);

View File

@ -203,7 +203,7 @@ void InsetNote::addToToc(DocIterator const & cpit, bool output_active) const
Toc & toc = buffer().tocBackend().toc("note"); Toc & toc = buffer().tocBackend().toc("note");
InsetLayout const & il = getLayout(); InsetLayout const & il = getLayout();
docstring str = translateIfPossible(il.labelstring()) + from_ascii(": "); 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))); toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.

View File

@ -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(); os += displayString();
} }

View File

@ -90,7 +90,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t maxlen) const; void forOutliner(docstring &, size_t maxlen) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;

View File

@ -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 // There's no need for details in the TOC, and a long label
// will just get in the way. // will just get in the way.

View File

@ -62,7 +62,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///

View File

@ -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. // There's no need to be cute here.
os += " "; os += " ";

View File

@ -135,7 +135,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
bool hasSettings() const { return true; } bool hasSettings() const { return true; }
/// ///

View File

@ -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; odocstringstream ods;
plaintext(ods, OutputParams(0)); plaintext(ods, OutputParams(0));

View File

@ -70,7 +70,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// ///
InsetCode lyxCode() const { return SPECIALCHAR_CODE; } InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset

View File

@ -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()) if (!getLayout().isInToc())
return; 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(); tocstring = par.labelString();
if (!tocstring.empty()) if (!tocstring.empty())
tocstring += ' '; tocstring += ' ';
arginset->text().forToc(tocstring, length); arginset->text().forOutliner(tocstring, length);
} else } else
par.forToc(tocstring, length); par.forOutliner(tocstring, length);
dit.pos() = 0; dit.pos() = 0;
toc.push_back(TocItem(dit, toclevel - min_toclevel, toc.push_back(TocItem(dit, toclevel - min_toclevel,
tocstring, doing_output, tocstring)); tocstring, doing_output, tocstring));

View File

@ -170,7 +170,7 @@ public:
/// ///
void toString(odocstream &) const; 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; void addToToc(DocIterator const & di, bool output_active) const;
/// ///

View File

@ -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; odocstringstream ods;
OutputParams op(0); OutputParams op(0);

View File

@ -140,7 +140,7 @@ public:
/// ///
void toString(odocstream &) const; void toString(odocstream &) const;
/// ///
void forToc(docstring &, size_t) const; void forOutliner(docstring &, size_t) const;
/// get notification when the cursor leaves this inset /// get notification when the cursor leaves this inset
bool notifyCursorLeaves(Cursor const & old, Cursor & cur); bool notifyCursorLeaves(Cursor const & old, Cursor & cur);