From: Jean-Marc Lasgouttes Date: Tue, 14 Jul 2009 16:01:07 +0000 (+0000) Subject: fix button label of insets like InsetMarginal X-Git-Tag: 2.0.0~6023 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c1b89e4d68ae44103d381a147817f6a41ab6213b;p=features.git fix button label of insets like InsetMarginal git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30570 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 9c75d81fee..bd5fbf2d72 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -582,6 +582,12 @@ void InsetCollapsable::setLabel(docstring const & l) } +docstring const InsetCollapsable::buttonLabel(BufferView const &) const +{ + return labelstring_.empty() ? getLayout().labelstring() : labelstring_; +} + + void InsetCollapsable::setStatus(Cursor & cur, CollapseStatus status) { status_ = status; @@ -617,32 +623,33 @@ int InsetCollapsable::latex(odocstream & os, // a collapsable inset, either a command or an environment. Standard // collapsable insets should not redefine this, non-standard ones may // call this. - if (!getLayout().latexname().empty()) { - if (getLayout().latextype() == InsetLayout::COMMAND) { + InsetLayout const & il = getLayout(); + if (!il.latexname().empty()) { + if (il.latextype() == InsetLayout::COMMAND) { // FIXME UNICODE if (runparams.moving_arg) os << "\\protect"; - os << '\\' << from_utf8(getLayout().latexname()); - if (!getLayout().latexparam().empty()) - os << from_utf8(getLayout().latexparam()); + os << '\\' << from_utf8(il.latexname()); + if (!il.latexparam().empty()) + os << from_utf8(il.latexparam()); os << '{'; - } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) { - os << "%\n\\begin{" << from_utf8(getLayout().latexname()) << "}\n"; - if (!getLayout().latexparam().empty()) - os << from_utf8(getLayout().latexparam()); + } else if (il.latextype() == InsetLayout::ENVIRONMENT) { + os << "%\n\\begin{" << from_utf8(il.latexname()) << "}\n"; + if (!il.latexparam().empty()) + os << from_utf8(il.latexparam()); } } OutputParams rp = runparams; - if (getLayout().isPassThru()) + if (il.isPassThru()) rp.verbatim = true; - if (getLayout().isNeedProtect()) + if (il.isNeedProtect()) rp.moving_arg = true; int i = InsetText::latex(os, rp); - if (!getLayout().latexname().empty()) { - if (getLayout().latextype() == InsetLayout::COMMAND) { + if (!il.latexname().empty()) { + if (il.latextype() == InsetLayout::COMMAND) { os << "}"; - } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) { - os << "\n\\end{" << from_utf8(getLayout().latexname()) << "}\n"; + } else if (il.latextype() == InsetLayout::ENVIRONMENT) { + os << "\n\\end{" << from_utf8(il.latexname()) << "}\n"; i += 4; } } diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 85ded86eaf..f082462e7e 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -73,8 +73,7 @@ public: /// virtual void setButtonLabel() {} /// - virtual docstring const buttonLabel(BufferView const &) const - { return labelstring_; } + virtual docstring const buttonLabel(BufferView const &) const; /// bool isOpen(BufferView const & bv) const { return geometry(bv) != ButtonOnly; }