]> git.lyx.org Git - features.git/commitdiff
fix button label of insets like InsetMarginal
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Jul 2009 16:01:07 +0000 (16:01 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Jul 2009 16:01:07 +0000 (16:01 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30570 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h

index 9c75d81fee60e50cdf4dbdbf9de0fea8d7999dd1..bd5fbf2d729d079a9f3637e5a0097b6ba198e86f 100644 (file)
@@ -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;
                }
        }
index 85ded86eafc081d0441fc39455e2f22be192f4fd..f082462e7e410aa489432e217617350f296c180d 100644 (file)
@@ -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; }