]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetERT.cpp
Check character encodability with pass-thru in command insets
[lyx.git] / src / insets / InsetERT.cpp
index eb9a808fbf733e028bf82e031e02150005227967..e3863ea09df1e244be261d2f92f1e1dd4dafa7b6 100644 (file)
 #include "OutputParams.h"
 #include "ParagraphParameters.h"
 #include "Paragraph.h"
-#include "TextClass.h"
 
+#include "support/docstream.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
+#include "support/TempFile.h"
 
 #include <sstream>
 
@@ -40,16 +41,21 @@ using namespace lyx::support;
 namespace lyx {
 
 InsetERT::InsetERT(Buffer * buf, CollapseStatus status)
-       : InsetCollapsable(buf)
+       : InsetCollapsible(buf)
 {
        status_ = status;
 }
 
 
+InsetERT::InsetERT(InsetERT const & old)
+       : InsetCollapsible(old)
+{}
+
+
 void InsetERT::write(ostream & os) const
 {
        os << "ERT" << "\n";
-       InsetCollapsable::write(os);
+       InsetCollapsible::write(os);
 }
 
 
@@ -111,13 +117,13 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
        switch (cmd.action()) {
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "ert") {
-                       cur.recordUndoInset(ATOMIC_UNDO, this);
+                       cur.recordUndoInset(this);
                        setStatus(cur, string2params(to_utf8(cmd.argument())));
                        break;
                }
                //fall-through
        default:
-               InsetCollapsable::doDispatch(cur, cmd);
+               InsetCollapsible::doDispatch(cur, cmd);
                break;
        }
 
@@ -128,6 +134,9 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
        FuncStatus & status) const
 {
        switch (cmd.action()) {
+       case LFUN_INSET_INSERT:
+               status.setEnabled(false);
+               return true;
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "ert") {
                        status.setEnabled(true);
@@ -136,11 +145,12 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
                //fall through
 
        default:
-               return InsetCollapsable::getStatus(cur, cmd, status);
+               return InsetCollapsible::getStatus(cur, cmd, status);
        }
 }
 
 
+
 docstring const InsetERT::buttonLabel(BufferView const & bv) const
 {
        if (decoration() == InsetLayout::CLASSIC)
@@ -150,7 +160,7 @@ docstring const InsetERT::buttonLabel(BufferView const & bv) const
 }
 
 
-InsetCollapsable::CollapseStatus InsetERT::string2params(string const & in)
+InsetCollapsible::CollapseStatus InsetERT::string2params(string const & in)
 {
        if (in.empty())
                return Collapsed;