]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_gridinset.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / mathed / math_gridinset.C
index e6a15edd05fad23e1720e6a644a0546d0c920299..26d56cf4e7251d4457051006fa281f8258e1a377 100644 (file)
 #include "cursor.h"
 #include "debug.h"
 #include "funcrequest.h"
+#include "undo.h"
 
 #include "frontends/Painter.h"
 
-#include "support/std_sstream.h"
-
 #include "insets/mailinset.h"
 
+#include <sstream>
+
 using std::endl;
 using std::max;
 using std::min;
@@ -185,7 +186,7 @@ MathGridInset::~MathGridInset()
 }
 
 
-auto_ptr<InsetBase> MathGridInset::clone() const
+auto_ptr<InsetBase> MathGridInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathGridInset(*this));
 }
@@ -1007,7 +1008,7 @@ void MathGridInset::splitCell(LCursor & cur)
 }
 
 
-void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
 {
        //lyxerr << "*** MathGridInset: request: " << cmd << endl;
        switch (cmd.action) {
@@ -1017,7 +1018,7 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                //      GridInsetMailer(*this).showDialog();
                //      return DispatchResult(true, true);
                //}
-               MathNestInset::priv_dispatch(cur, cmd);
+               MathNestInset::doDispatch(cur, cmd);
                break;
 
        case LFUN_INSET_DIALOG_UPDATE:
@@ -1026,6 +1027,7 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
        // insert file functions
        case LFUN_DELETE_LINE_FORWARD:
+               recordUndo(cur);
                //autocorrect_ = false;
                //macroModeClose();
                //if (selection_) {
@@ -1041,12 +1043,12 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_CELL_SPLIT:
-               ////recordUndo(cur, Undo::ATOMIC);
+               recordUndo(cur);
                splitCell(cur);
                break;
 
        case LFUN_BREAKLINE: {
-               ////recordUndo(cur, Undo::INSERT);
+               recordUndo(cur);
                row_type const r = cur.row();
                addRow(r);
 
@@ -1059,14 +1061,15 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
                if (cur.idx() > 0)
                        --cur.idx();
-               cur.idx() = cur.lastpos();
+               cur.pos() = cur.lastpos();
 
                //mathcursor->normalize();
-               cmd = FuncRequest(LFUN_FINISHED_LEFT);
+               //cmd = FuncRequest(LFUN_FINISHED_LEFT);
                break;
        }
 
        case LFUN_TABULAR_FEATURE: {
+               recordUndo(cur);
                //lyxerr << "handling tabular-feature " << cmd.argument << endl;
                istringstream is(cmd.argument);
                string s;
@@ -1126,6 +1129,7 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_PASTE: {
+               recordUndo(cur);
                lyxerr << "MathGridInset: PASTE: " << cmd << std::endl;
                istringstream is(cmd.argument);
                int n = 0;
@@ -1201,7 +1205,7 @@ void MathGridInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                break;
 
        default:
-               MathNestInset::priv_dispatch(cur, cmd);
+               MathNestInset::doDispatch(cur, cmd);
        }
 }