]> git.lyx.org Git - features.git/commitdiff
Inset configurability, LaTeX work
authorMartin Vermeer <martin.vermeer@hut.fi>
Mon, 20 Aug 2007 19:02:38 +0000 (19:02 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Mon, 20 Aug 2007 19:02:38 +0000 (19:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19665 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCharStyle.cpp
src/insets/InsetCharStyle.h
src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h
src/insets/InsetNote.cpp

index 0fef555fc720129c2f4ea38ab65072c9e0ca0af9..3e38f8796e8109493c76a971060e5231ec039ab2 100644 (file)
@@ -204,23 +204,6 @@ bool InsetCharStyle::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
-                         OutputParams const & runparams) const
-{
-       if (!undefined()) {
-               // FIXME UNICODE
-               os << '\\' << from_utf8(layout_.latexname);
-               if (!layout_.latexparam.empty())
-                       os << from_utf8(layout_.latexparam);
-               os << '{';
-       }
-       int i = InsetText::latex(buf, os, runparams);
-       if (!undefined())
-               os << "}";
-       return i;
-}
-
-
 int InsetCharStyle::plaintext(Buffer const & buf, odocstream & os,
                              OutputParams const & runparams) const
 {
@@ -262,7 +245,7 @@ void InsetCharStyle::textString(Buffer const & buf, odocstream & os) const
 void InsetCharStyle::validate(LaTeXFeatures & features) const
 {
        // Force inclusion of preamble snippet in layout file
-       features.require(params_.name);
+       features.require(layout_.latexname);
        InsetText::validate(features);
 }
 
index cf1b450f9ad6ccd72c081edda24bc45128d84d7d..dc264ae4941f0976fa559924dbebc28977ff4994 100644 (file)
@@ -68,9 +68,6 @@ public:
        ///
        virtual Decoration decoration() const { return Conglomerate; }
 
-       ///
-       int latex(Buffer const &, odocstream &,
-                 OutputParams const &) const;
        ///
        int plaintext(Buffer const &, odocstream &,
                      OutputParams const &) const;
index fe1631a50ec8d55185554573b932b02beb596c65..314ec4badaa079dcdb2f89868c9d4625cc24f5bd 100644 (file)
@@ -618,4 +618,37 @@ docstring InsetCollapsable::floatName(string const & type, BufferParams const &
 }
 
 
+
+int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
+                         OutputParams const & runparams) const
+{
+       // This implements the standard way of handling the LaTeX output of
+       // a collapsable inset, either a command or an environment. Standard 
+       // collapsable insets should not redefine this, non-standard ones may
+       // call this.
+       if (!layout_.latexname.empty()) {
+               if (layout_.latextype == "command") {
+                       // FIXME UNICODE
+                       os << '\\' << from_utf8(layout_.latexname);
+                       if (!layout_.latexparam.empty())
+                               os << from_utf8(layout_.latexparam);
+                       os << '{';
+               } else if (layout_.latextype == "environment") {
+                       os << "%\n\\begin{" << from_utf8(layout_.latexname) << "}\n";
+                       if (!layout_.latexparam.empty())
+                               os << from_utf8(layout_.latexparam);
+               }
+       }
+       int i = InsetText::latex(buf, os, runparams);
+       if (!layout_.latexname.empty())
+               if (layout_.latextype == "command") {
+                       os << "}";
+               } else if (layout_.latextype == "environment") {
+                       os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n";
+                       i += 4;
+               }
+       return i;
+}
+
+
 } // namespace lyx
index e9540c741446e7a0eed276c2176557e9123dac59..901c480d87bfb9fe2cb7f726537f1ddce3ef6a9f 100644 (file)
@@ -130,6 +130,9 @@ public:
        void setStatus(Cursor & cur, CollapseStatus st);
        ///
        bool setMouseHover(bool mouse_hover);
+       ///
+       int latex(Buffer const &, odocstream &,
+                 OutputParams const &) const;
 
 protected:
        ///
index ac98846b06c2ae56ef670db38f3bf36684667885..9285ea95f60776da76a3ab0807dc62e39b6d4f62 100644 (file)
@@ -232,14 +232,6 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_DIALOG_UPDATE:
                InsetNoteMailer(*this).updateDialog(&cur.bv());
                break;
-
-       case LFUN_MOUSE_RELEASE:
-               if (cmd.button() == mouse_button::button3 && hitButton(cmd))
-                       InsetNoteMailer(*this).showDialog(&cur.bv());
-               else
-                       InsetCollapsable::doDispatch(cur, cmd);
-               break;
-
        default:
                InsetCollapsable::doDispatch(cur, cmd);
                break;
@@ -285,10 +277,7 @@ int InsetNote::latex(Buffer const & buf, odocstream & os,
        } 
 
        odocstringstream ss;
-       //ss << "%\n\\begin{" << from_ascii(type) << "}\n";
-       ss << "%\n\\begin{" << from_ascii(layout_.latexname) << "}\n";
-       InsetText::latex(buf, ss, runparams);
-       ss << "\n\\end{" << from_ascii(layout_.latexname) << "}\n";
+       InsetCollapsable::latex(buf, ss, runparams);
        // the space after the comment in 'a[comment] b' will be eaten by the
        // comment environment since the space before b is ignored with the
        // following latex output: