mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Mini-optimization: We do not need really long tooltips for the TOC.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36989 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4aead1ffde
commit
1f44b8a5c0
@ -302,7 +302,7 @@ void InsetBranch::addToToc(DocIterator const & cpit)
|
|||||||
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().forToc(str, TOC_ENTRY_LENGTH);
|
||||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
|
||||||
// Proceed with the rest of the inset.
|
// Proceed with the rest of the inset.
|
||||||
InsetCollapsable::addToToc(cpit);
|
InsetCollapsable::addToToc(cpit);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ void InsetFoot::addToToc(DocIterator const & cpit)
|
|||||||
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().forToc(str, TOC_ENTRY_LENGTH);
|
||||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
|
||||||
// Proceed with the rest of the inset.
|
// Proceed with the rest of the inset.
|
||||||
InsetFootlike::addToToc(cpit);
|
InsetFootlike::addToToc(cpit);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit)
|
|||||||
Toc & toc = buffer().tocBackend().toc("marginalnote");
|
Toc & toc = buffer().tocBackend().toc("marginalnote");
|
||||||
docstring str;
|
docstring str;
|
||||||
text().forToc(str, TOC_ENTRY_LENGTH);
|
text().forToc(str, TOC_ENTRY_LENGTH);
|
||||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
|
||||||
// Proceed with the rest of the inset.
|
// Proceed with the rest of the inset.
|
||||||
InsetFootlike::addToToc(cpit);
|
InsetFootlike::addToToc(cpit);
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void InsetNote::addToToc(DocIterator const & cpit)
|
|||||||
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().forToc(str, TOC_ENTRY_LENGTH);
|
||||||
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
|
||||||
// Proceed with the rest of the inset.
|
// Proceed with the rest of the inset.
|
||||||
InsetCollapsable::addToToc(cpit);
|
InsetCollapsable::addToToc(cpit);
|
||||||
}
|
}
|
||||||
|
@ -824,9 +824,10 @@ docstring InsetText::contextMenuName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetText::toolTipText(docstring prefix) const
|
docstring InsetText::toolTipText(docstring prefix,
|
||||||
|
size_t numlines, size_t len) const
|
||||||
{
|
{
|
||||||
static unsigned int max_length = 400; // five 80 column lines
|
size_t const max_length = numlines * len;
|
||||||
OutputParams rp(&buffer().params().encoding());
|
OutputParams rp(&buffer().params().encoding());
|
||||||
odocstringstream oss;
|
odocstringstream oss;
|
||||||
oss << prefix;
|
oss << prefix;
|
||||||
@ -845,7 +846,7 @@ docstring InsetText::toolTipText(docstring prefix) const
|
|||||||
if (str.length() > max_length)
|
if (str.length() > max_length)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return support::wrapParas(str, 4, 80, 5);
|
return support::wrapParas(str, 4, len, numlines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,7 +195,10 @@ public:
|
|||||||
/// returns the text to be used as tooltip
|
/// returns the text to be used as tooltip
|
||||||
/// \param prefix: a string that will preced the tooltip,
|
/// \param prefix: a string that will preced the tooltip,
|
||||||
/// e.g., "Index: ".
|
/// e.g., "Index: ".
|
||||||
docstring toolTipText(docstring prefix = empty_docstring()) const;
|
/// \param numlines: the number of lines in the tooltip
|
||||||
|
/// \param len: length of those lines
|
||||||
|
docstring toolTipText(docstring prefix = empty_docstring(),
|
||||||
|
size_t numlines = 5, size_t len = 80) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
docstring contextMenu(BufferView const &, int, int) const;
|
docstring contextMenu(BufferView const &, int, int) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user