mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Simplify more of the tooltips. There will be some speed improvements
here, but not very noticeable, I think, as these ones aren't called by the addToToc stuff. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36347 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4133f627b2
commit
897404e34d
@ -62,17 +62,15 @@ void InsetBranch::read(Lexer & lex)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetBranch::toolTip(BufferView const & bv, int x, int y) const
|
||||
docstring InsetBranch::toolTip(BufferView const & bv, int, int) const
|
||||
{
|
||||
docstring const status = isBranchSelected() ?
|
||||
_("active") : _("non-active");
|
||||
docstring const heading =
|
||||
support::bformat(_("Branch (%1$s): %2$s"), status, params_.branch);
|
||||
docstring const contents = InsetCollapsable::toolTip(bv, x, y);
|
||||
if (isOpen(bv) || contents.empty())
|
||||
if (isOpen(bv))
|
||||
return heading;
|
||||
else
|
||||
return heading + from_ascii("\n") + contents;
|
||||
return toolTipText(heading + from_ascii("\n"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
|
||||
|
||||
docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
Dimension dim = dimensionCollapsed(bv);
|
||||
Dimension const dim = dimensionCollapsed(bv);
|
||||
if (geometry(bv) == NoButton)
|
||||
return translateIfPossible(getLayout().labelstring());
|
||||
if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des || isOpen(bv))
|
||||
|
@ -127,8 +127,8 @@ docstring InsetFloat::name() const
|
||||
|
||||
docstring InsetFloat::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
if (InsetCollapsable::toolTip(bv, x, y).empty() || isOpen(bv))
|
||||
return docstring();
|
||||
if (isOpen(bv))
|
||||
return InsetCollapsable::toolTip(bv, x, y);
|
||||
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
return getCaptionText(rp);
|
||||
|
@ -75,10 +75,10 @@ void InsetFoot::addToToc(DocIterator const & cpit)
|
||||
|
||||
docstring InsetFoot::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
docstring default_tip = InsetCollapsable::toolTip(bv, x, y);
|
||||
if (!isOpen(bv))
|
||||
return custom_label_ + "\n" + default_tip;
|
||||
return default_tip;
|
||||
if (isOpen(bv))
|
||||
// this will give us something useful if there is no button
|
||||
return InsetCollapsable::toolTip(bv, x, y);
|
||||
return toolTipText(custom_label_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -288,7 +288,7 @@ docstring InsetIndex::toolTip(BufferView const &, int, int) const
|
||||
tip += ")";
|
||||
}
|
||||
tip += ": ";
|
||||
return InsetText::toolTipText(tip);
|
||||
return toolTipText(tip);
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,11 +299,8 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
docstring InsetPhantom::toolTip(BufferView const &, int, int) const
|
||||
{
|
||||
docstring const tip = InsetText::toolTipText();
|
||||
docstring res = phantomtranslator_loc().find(params_.type);
|
||||
if (!tip.empty())
|
||||
res += from_ascii(": ") + "\n" + tip;
|
||||
return res;
|
||||
docstring const res = phantomtranslator_loc().find(params_.type);
|
||||
return toolTipText(res + from_ascii(": "));
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,12 +66,13 @@ docstring InsetWrap::name() const
|
||||
|
||||
docstring InsetWrap::toolTip(BufferView const & bv, int x, int y) const
|
||||
{
|
||||
if (isOpen(bv))
|
||||
return InsetCollapsable::toolTip(bv, x, y);
|
||||
OutputParams rp(&buffer().params().encoding());
|
||||
docstring default_tip = InsetCollapsable::toolTip(bv, x, y);
|
||||
docstring caption_tip = getCaptionText(rp);
|
||||
if (!isOpen(bv) && !caption_tip.empty())
|
||||
return caption_tip + '\n' + default_tip;
|
||||
return default_tip;
|
||||
if (!caption_tip.empty())
|
||||
caption_tip += from_ascii("\n");
|
||||
return toolTipText(caption_tip);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user