]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insettabular.C
index 891f4eea0a280c0e0840d3979ce185352c204889..4d7b3085fe6b5ad303d303f2b39538607a103222 100644 (file)
@@ -448,8 +448,8 @@ void InsetTabular::edit(LCursor & cur, bool left)
 
 void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
 {
-       lyxerr << "# InsetTabular::doDispatch: cmd: " << cmd << endl;
-       lyxerr << "  cur:\n" << cur << endl;
+       lyxerr[Debug::DEBUG] << "# InsetTabular::doDispatch: cmd: " << cmd 
+                            << "\n  cur:" << cur << endl;
        CursorSlice sl = cur.top();
        LCursor & bvcur = cur.bv().cursor();
 
@@ -511,24 +511,24 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_RIGHTSEL:
        case LFUN_RIGHT:
                cell(cur.idx())->dispatch(cur, cmd);
-               cur.dispatched(); // override the cell's decision
-               if (sl == cur.top())
+               if (!cur.result().dispatched()) {
                        isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
-               if (sl == cur.top()) {
-                       cmd = FuncRequest(LFUN_FINISHED_RIGHT);
-                       cur.undispatched();
+                       if (sl == cur.top()) 
+                               cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+                       else
+                               cur.dispatched();
                }
                break;
 
        case LFUN_LEFTSEL:
        case LFUN_LEFT:
                cell(cur.idx())->dispatch(cur, cmd);
-               cur.dispatched(); // override the cell's decision
-               if (sl == cur.top())
+               if (!cur.result().dispatched()) {
                        isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
-               if (sl == cur.top()) {
-                       cmd = FuncRequest(LFUN_FINISHED_LEFT);
-                       cur.undispatched();
+                       if (sl == cur.top()) 
+                               cmd = FuncRequest(LFUN_FINISHED_LEFT);
+                       else
+                               cur.dispatched();
                }
                break;
 
@@ -1422,10 +1422,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
 
        case LyXTabular::SET_PWIDTH: {
                LyXLength const len(value);
-               tabular.setColumnPWidth(cur.idx(), len);
-               // cur position can become invalid after newlines were removed
-               if (cur.pos() > cur.lastpos())
-                       cur.pos() = cur.lastpos();
+               tabular.setColumnPWidth(cur, cur.idx(), len);
                if (len.zero()
                    && tabular.getAlignment(cur.idx(), true) == LYX_ALIGN_BLOCK)
                        tabularFeatures(cur, LyXTabular::ALIGN_CENTER, string());
@@ -1433,10 +1430,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
        }
 
        case LyXTabular::SET_MPWIDTH:
-               tabular.setMColumnPWidth(cur.idx(), LyXLength(value));
-               // cur position can become invalid after newlines were removed
-               if (cur.pos() > cur.lastpos())
-                       cur.pos() = cur.lastpos();
+               tabular.setMColumnPWidth(cur, cur.idx(), LyXLength(value));
                break;
 
        case LyXTabular::SET_SPECIAL_COLUMN:
@@ -1851,27 +1845,9 @@ void InsetTabular::markErased(bool erased)
 }
 
 
-bool InsetTabular::forceDefaultParagraphs(InsetBase const *) const
+bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
 {
-#if 0
-       idx_type const cell = tabular.getCellFromInset(in);
-       // FIXME: getCellFromInset() returns now always a valid cell, so
-       // the stuff below can be deleted, and instead we have:
        return tabular.getPWidth(cell).zero();
-
-       if (cell != npos)
-               return tabular.getPWidth(cell).zero();
-
-       // this is a workaround for a crash (New, Insert->Tabular,
-       // Insert->FootNote)
-       if (!owner())
-               return false;
-
-       // well we didn't obviously find it so maybe our owner knows more
-       BOOST_ASSERT(owner());
-       return owner()->forceDefaultParagraphs(in);
-#endif
-       return false;
 }