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;
}
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;
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;
}
}
-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{";
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); }