]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.cpp
pimpl not needed here
[lyx.git] / src / insets / InsetNote.cpp
index ac98846b06c2ae56ef670db38f3bf36684667885..f6e278347478a97814007c5cff07394871cc5a6e 100644 (file)
@@ -31,6 +31,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 
+#include "support/docstream.h"
 #include "support/Translator.h"
 
 #include <algorithm>
@@ -40,7 +41,6 @@
 namespace lyx {
 
 using std::string;
-using std::auto_ptr;
 using std::istringstream;
 using std::ostream;
 using std::ostringstream;
@@ -116,7 +116,6 @@ InsetNote::InsetNote(BufferParams const & bp, string const & label)
        : InsetCollapsable(bp)
 {
        params_.type = notetranslator().find(label);
-       setLayout(bp);
        setButtonLabel();
 }
 
@@ -134,9 +133,9 @@ InsetNote::~InsetNote()
 }
 
 
-auto_ptr<Inset> InsetNote::doClone() const
+Inset * InsetNote::clone() const
 {
-       return auto_ptr<Inset>(new InsetNote(*this));
+       return new InsetNote(*this);
 }
 
 
@@ -175,8 +174,6 @@ void InsetNote::read(Buffer const & buf, Lexer & lex)
 {
        params_.read(lex);
        InsetCollapsable::read(buf, lex);
-       setLayout(buf.params());
-       setButtonLabel();
 }
 
 
@@ -187,30 +184,6 @@ void InsetNote::setButtonLabel()
 }
 
 
-Color_color InsetNote::backgroundColor() const
-{
-       Color_color c;
-       switch (params_.type) {
-       case InsetNoteParams::Note:
-               c = Color::notebg;
-               break;
-       case InsetNoteParams::Comment:
-               c = Color::commentbg;
-               break;
-       case InsetNoteParams::Greyedout:
-               c = Color::greyedoutbg;
-               break;
-       case InsetNoteParams::Framed:
-               c = Color::greyedoutbg;
-               break;
-       case InsetNoteParams::Shaded:
-               c = Color::shadedbg;
-               break;
-       }
-       return c;
-}
-
-
 bool InsetNote::showInsetDialog(BufferView * bv) const
 {
        InsetNoteMailer(const_cast<InsetNote &>(*this)).showDialog(bv);
@@ -226,20 +199,11 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
                InsetNoteMailer::string2params(to_utf8(cmd.argument()), params_);
                // get a bp from cur:
                setLayout(cur.buffer().params());
-               setButtonLabel();
                break;
 
        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 +249,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: