]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetERT.cpp
Fix text frame drawing.
[lyx.git] / src / insets / InsetERT.cpp
index 3a39b96a748a4036aa7dfdaecc30f8f02f6b1755..9a3e4eb320ac9537c62a2d62267b287376b0202c 100644 (file)
@@ -43,7 +43,6 @@ using support::token;
 using std::endl;
 using std::min;
 
-using std::auto_ptr;
 using std::istringstream;
 using std::ostream;
 using std::ostringstream;
@@ -54,8 +53,9 @@ void InsetERT::init()
 {
        setButtonLabel();
        setLabelFont(layout_.labelfont);
-       text_.current_font.setLanguage(latex_language);
-       text_.real_current_font.setLanguage(latex_language);
+       // FIXME: what to do with those?
+       //text_.current_font.setLanguage(latex_language);
+       //text_.real_current_font.setLanguage(latex_language);
 }
 
 
@@ -74,9 +74,9 @@ InsetERT::InsetERT(InsetERT const & in)
 }
 
 
-auto_ptr<Inset> InsetERT::doClone() const
+Inset * InsetERT::clone() const
 {
-       return auto_ptr<Inset>(new InsetERT(*this));
+       return new InsetERT(*this);
 }
 
 
@@ -199,6 +199,15 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
        //lyxerr << "\nInsetERT::doDispatch (begin): cmd: " << cmd << endl;
        switch (cmd.action) {
 
+       case LFUN_MOUSE_PRESS:
+               if (cmd.button() != mouse_button::button3)
+                       InsetCollapsable::doDispatch(cur, cmd);
+               else
+                       // This makes the cursor leave the
+                       // inset when it collapses on mouse-3
+                       cur.undispatched();
+               break;
+
        case LFUN_QUOTE_INSERT: {
                // We need to bypass the fancy quotes in Text
                FuncRequest f(LFUN_SELF_INSERT, "\"");
@@ -221,7 +230,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
                // FIXME: Change only the pasted paragraphs
 
                BufferParams const & bp = cur.buffer().params();
-               Layout_ptr const layout =
+               LayoutPtr const layout =
                        bp.getTextClass().defaultLayout();
                Font font = layout->font;
                // ERT contents has always latex_language
@@ -246,8 +255,9 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
                // start of an existing paragraph get the buffer language
                // and not latex_language, so we take this brute force
                // approach.
-               text_.current_font.setLanguage(latex_language);
-               text_.real_current_font.setLanguage(latex_language);
+               // FIXME: what to do with those?
+               //text_.current_font.setLanguage(latex_language);
+               //text_.real_current_font.setLanguage(latex_language);
 
                InsetCollapsable::doDispatch(cur, cmd);
                break;
@@ -382,7 +392,10 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
 void InsetERT::setButtonLabel()
 {
        // FIXME UNICODE
-       setLabel(isOpen() ?  _("ERT") : getNewLabel(_("ERT")));
+       if (decoration() == Classic)
+               setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
+       else
+               setLabel(getNewLabel(_("ERT")));
 }