]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
some reindentation, revert workarea xpos++, constify, remove all traces of LyXParagra...
[lyx.git] / src / insets / insettabular.C
index 752e0d8565d2430c8d5a308930257dbab41df786..73aaf52f8bb123741b2ecd47552cf02f214c5447 100644 (file)
 #include "lyxtext.h"
 #include "lyx_gui_misc.h"
 #include "LyXView.h"
-#include "lyxfunc.h"
 #include "insets/insettext.h"
 #include "frontends/Dialogs.h"
 #include "debug.h"
-#include "lyxfunc.h"
 #include "WorkArea.h"
 #include "gettext.h"
 #include "language.h"
@@ -126,15 +124,11 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
                rows = 1;
        if (columns <= 0)
                columns = 1;
-       //tabular = new LyXTabular(this, rows,columns);
        tabular.reset(new LyXTabular(this, rows,columns));
        // for now make it always display as display() inset
        // just for test!!!
        the_locking_inset = 0;
        locked = no_selection = false;
-#if 0
-       cursor_visible = false;
-#endif
        oldcell = -1;
        actrow = actcell = 0;
        clearSelection();
@@ -145,13 +139,9 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
 InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf)
        : buffer(&buf)
 {
-       //tabular = new LyXTabular(this, *(tab.tabular));
        tabular.reset(new LyXTabular(this, *(tab.tabular)));
        the_locking_inset = 0;
        locked = no_selection = false;
-#if 0
-       cursor_visible = false;
-#endif
        oldcell = -1;
        actrow = actcell = 0;
        sel_cell_start = sel_cell_end = 0;
@@ -247,7 +237,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
        UpdatableInset::draw(bv, font, baseline, x, cleared);
 #else
        if (!owner())
-               x += (float)scroll();
+               x += static_cast<float>(scroll());
 #endif
        if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
                         (top_x != int(x)) || (top_baseline != baseline))) {
@@ -951,14 +941,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
                if (!copySelection(bv))
                        break;
                bv->text->SetUndo(bv->buffer(), Undo::DELETE,
-#ifndef NEW_INSETS
-                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
-#else
                                  bv->text->cursor.par()->previous(),
-                                 bv->text->cursor.par()->next()
-#endif
-                       );
+                                 bv->text->cursor.par()->next());
                cutSelection();
                UpdateLocal(bv, INIT, true);
                break;
@@ -970,7 +954,7 @@ InsetTabular::LocalDispatch(BufferView * bv,
                break;
        case LFUN_PASTESELECTION:
        {
-               string clip(bv->workarea()->getClipboard());
+               string clip(bv->getClipboard());
        
                if (clip.empty())
                        break;
@@ -1037,14 +1021,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
        case LFUN_PASTE:
                if (hasPasteBuffer()) {
                        bv->text->SetUndo(bv->buffer(), Undo::INSERT,
-#ifndef NEW_INSETS
-                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
-#else
                                          bv->text->cursor.par()->previous(),
-                                         bv->text->cursor.par()->next()
-#endif
-                               );
+                                         bv->text->cursor.par()->next());
                        pasteSelection(bv);
                        UpdateLocal(bv, INIT, true);
                        break;
@@ -1236,7 +1214,9 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
        int lx = tabular->GetWidthOfColumn(actcell) -
                tabular->GetAdditionalWidth(actcell);
 #if 0
+#ifdef WITH_WARNINGS
 #warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
+#endif
        for (; !tabular->IsLastCellInRow(actcell) && (lx < x);
             ++actcell,lx += tabular->GetWidthOfColumn(actcell) +
                     tabular->GetAdditionalWidth(actcell - 1));
@@ -1566,14 +1546,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
                sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
        }
        bv->text->SetUndo(bv->buffer(), Undo::FINISH,
-#ifndef NEW_INSETS
-                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
-#else
                          bv->text->cursor.par()->previous(),
-                         bv->text->cursor.par()->next()
-#endif
-               );
+                         bv->text->cursor.par()->next());
 
        int row = tabular->row_of_cell(actcell);
        int column = tabular->column_of_cell(actcell);