mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
* move extended tooltips support to InsetCollapsable (fixes bug 3778).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24524 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ba4d271346
commit
fa568e12f0
@ -112,13 +112,26 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
|
||||
if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des)
|
||||
return docstring();
|
||||
|
||||
docstring default_tip;
|
||||
switch (status_) {
|
||||
case Open:
|
||||
return _("Left-click to collapse the inset");
|
||||
default_tip = _("Left-click to collapse the inset");
|
||||
break;
|
||||
case Collapsed:
|
||||
return _("Left-click to open the inset");
|
||||
default_tip = _("Left-click to open the inset");
|
||||
break;
|
||||
}
|
||||
return docstring();
|
||||
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
odocstringstream ods;
|
||||
InsetText::plaintext(ods, rp);
|
||||
docstring content_tip = ods.str();
|
||||
// shorten it if necessary
|
||||
if (content_tip.size() > 200)
|
||||
content_tip = content_tip.substr(0, 200) + "...";
|
||||
if (!isOpen() && !content_tip.empty())
|
||||
return content_tip + '\n' + default_tip;
|
||||
return default_tip;
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,8 +129,15 @@ InsetFloat::~InsetFloat()
|
||||
|
||||
docstring InsetFloat::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
if (InsetCollapsable::toolTip(bv, x, y).empty())
|
||||
return docstring();
|
||||
|
||||
docstring default_tip;
|
||||
if (isOpen())
|
||||
default_tip = _("Left-click to collapse the inset");
|
||||
else
|
||||
default_tip = _("Left-click to open the inset");
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
docstring default_tip = InsetCollapsable::toolTip(bv, x, y);
|
||||
docstring caption_tip = getCaptionText(rp);
|
||||
if (!isOpen() && !caption_tip.empty())
|
||||
return caption_tip + '\n' + default_tip;
|
||||
|
@ -82,15 +82,8 @@ void InsetFoot::addToToc(ParConstIterator const & cpit) const
|
||||
docstring InsetFoot::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
docstring default_tip = InsetCollapsable::toolTip(bv, x, y);
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
odocstringstream ods;
|
||||
InsetText::plaintext(ods, rp);
|
||||
docstring foot_tip = custom_label_ + ": " + ods.str();
|
||||
// shorten it if necessary
|
||||
if (foot_tip.size() > 200)
|
||||
foot_tip = foot_tip.substr(0, 200) + "...";
|
||||
if (!isOpen() && !foot_tip.empty())
|
||||
return foot_tip + '\n' + default_tip;
|
||||
if (!isOpen())
|
||||
return custom_label_ + ": " + default_tip;
|
||||
return default_tip;
|
||||
}
|
||||
|
||||
|
@ -38,22 +38,6 @@ docstring InsetMarginal::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetMarginal::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
docstring default_tip = InsetCollapsable::toolTip(bv, x, y);
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
odocstringstream ods;
|
||||
InsetText::plaintext(ods, rp);
|
||||
docstring margin_tip = ods.str();
|
||||
// shorten it if necessary
|
||||
if (margin_tip.size() > 200)
|
||||
margin_tip = margin_tip.substr(0, 200) + "...";
|
||||
if (!isOpen() && !margin_tip.empty())
|
||||
return margin_tip + '\n' + default_tip;
|
||||
return default_tip;
|
||||
}
|
||||
|
||||
|
||||
int InsetMarginal::latex(odocstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
os << "%\n\\marginpar{";
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
docstring editMessage() const;
|
||||
///
|
||||
void addToToc(ParConstIterator const &) const;
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
private:
|
||||
///
|
||||
Inset * clone() const { return new InsetMarginal(*this); }
|
||||
|
Loading…
Reference in New Issue
Block a user