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:
Richard Heck 2010-11-17 17:25:22 +00:00
parent 4133f627b2
commit 897404e34d
7 changed files with 18 additions and 22 deletions

View File

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

View File

@ -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))

View File

@ -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);

View File

@ -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_);
}

View File

@ -288,7 +288,7 @@ docstring InsetIndex::toolTip(BufferView const &, int, int) const
tip += ")";
}
tip += ": ";
return InsetText::toolTipText(tip);
return toolTipText(tip);
}

View File

@ -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(": "));
}

View File

@ -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);
}