]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
Fixes to insettabular/text.
[lyx.git] / src / BufferView_pimpl.C
index 17039740e0c6104dfd4f7840ff7f84b0876b957a..36dbfa07c3744369fb5bc1e43b0bedd0c5c6fcf6 100644 (file)
@@ -208,12 +208,13 @@ void BufferView::Pimpl::redraw()
 }
 
 
-bool BufferView::Pimpl::fitCursor()
+bool BufferView::Pimpl::fitCursor(LyXText * text)
 {
        Assert(screen_); // it is a programming error to call fitCursor
        // without a valid screen.
-       bool ret = screen_->FitCursor(bv_->text);
-       if (ret) updateScrollbar();
+       bool ret = screen_->FitCursor(text);
+       if (ret)
+           updateScrollbar();
        return ret;
 }
 
@@ -541,7 +542,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
       
                bv_->text->SetSelection();
                screen_->ToggleToggle(bv_->text);
-               fitCursor();
+               fitCursor(bv_->text);
                screen_->ShowCursor(bv_->text);
        }
        return;
@@ -591,46 +592,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                selection_possible = true;
        screen_->HideCursor();
 
-#ifndef NEW_TABULAR
-       // Right button mouse click on a table
-       if (button == 3 &&
-           (bv_->text->cursor.par()->table ||
-            bv_->text->MouseHitInTable(bv_, xpos, ypos + bv_->text->first))) {
-               // Set the cursor to the press-position
-               bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + bv_->text->first);
-               bool doit = true;
-               
-               // Only show the table popup if the hit is in
-               // the table, too
-               if (!bv_->text->HitInTable(bv_,
-                                          bv_->text->cursor.row(), xpos))
-                       doit = false;
-               
-               // Hit above or below the table?
-               if (doit) {
-                       if (!bv_->text->selection) {
-                               screen_->ToggleSelection(bv_->text);
-                               bv_->text->ClearSelection();
-                               bv_->text->FullRebreak(bv_);
-                               screen_->Update(bv_->text);
-                               updateScrollbar();
-                       }
-                       // Popup table popup when on a table.
-                       // This is obviously temporary, since we
-                       // should be able to popup various
-                       // context-sensitive-menus with the
-                       // the right mouse. So this should be done more
-                       // general in the future. Matthias.
-                       selection_possible = false;
-                       owner_->getLyXFunc()
-                               ->Dispatch(LFUN_LAYOUT_TABLE,
-                                          "true");
-                       return;
-               }
-       }
-#endif
-       
-       int screen_first = bv_->text->first;
+       int const screen_first = bv_->text->first;
        
        // Middle button press pastes if we have a selection
        bool paste_internally = false;
@@ -673,7 +635,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        bv_->text->cursor.x_fix(bv_->text->cursor.x());
        
        owner_->updateLayoutChoice();
-       if (fitCursor()) {
+       if (fitCursor(bv_->text)) {
                selection_possible = false;
        }
        
@@ -705,7 +667,7 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
                         * if necessary */
                        update(BufferView::SELECT|BufferView::FITCUR);
                }
-       }            
+       }   
 }
 
 
@@ -767,19 +729,6 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        }
        
        selection_possible = false;
-#ifndef NEW_TABULAR
-       if (bv_->text->cursor.par()->table) {
-                int cell = bv_->text->
-                        NumberOfCell(bv_->text->cursor.par(),
-                                     bv_->text->cursor.pos());
-                if (bv_->text->cursor.par()->table->IsContRow(cell) &&
-                    bv_->text->cursor.par()->table->
-                    CellHasContRow(bv_->text->cursor.par()->table->
-                                   GetCellAbove(cell))<0) {
-                        bv_->text->CursorUp(bv_);
-                }
-        }
-#endif
        
        if (button >= 2) return;
 
@@ -1028,7 +977,7 @@ void BufferView::Pimpl::workAreaExpose()
                        // fitCursor() ensures we don't jump back
                        // to the start of the document on vertical
                        // resize
-                       fitCursor();
+                       fitCursor(bv_->text);
 
                        // The main window size has changed, repaint most stuff
                        redraw();
@@ -1104,7 +1053,7 @@ void BufferView::Pimpl::update(BufferView::UpdateCodes f)
        update();
 
        if ((f & FITCUR)) {
-               fitCursor();
+               fitCursor(bv_->text);
        }
 
        if ((f & CHANGE)) {
@@ -1187,7 +1136,7 @@ void BufferView::Pimpl::cursorPrevious()
 {
        if (!bv_->text->cursor.row()->previous()) return;
        
-       long y = bv_->text->first;
+       int y = bv_->text->first;
        Row * cursorrow = bv_->text->cursor.row();
        bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
        bv_->text->FinishUndo();
@@ -1209,7 +1158,7 @@ void BufferView::Pimpl::cursorNext()
 {
        if (!bv_->text->cursor.row()->next()) return;
        
-       long y = bv_->text->first;
+       int y = bv_->text->first;
        bv_->text->GetRowNearY(y);
        Row * cursorrow = bv_->text->cursor.row();
        bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y