]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
use more specific smart_ptr headers
[lyx.git] / src / insets / insettabular.C
index 74859a96abf7222e1f87a4bb7855e2ee19348d55..d7c59e82bf5ee72093e0234ab0f982a1443d606a 100644 (file)
@@ -450,8 +450,8 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int baseline,
                          on_off ? Painter::line_onoffdash : Painter::line_solid);
        }
        on_off = !tabular->BottomLine(cell);
-       pain.line(x,baseline +  tabular->GetDescentOfRow(row),
-                 x2, baseline +  tabular->GetDescentOfRow(row),
+       pain.line(x, baseline + tabular->GetDescentOfRow(row),
+                 x2, baseline + tabular->GetDescentOfRow(row),
                  on_off ? LColor::tabularonoffline : LColor::tabularline,
                  on_off ? Painter::line_onoffdash : Painter::line_solid);
        if (!tabular->LeftAlreadyDrawed(cell)) {
@@ -491,8 +491,8 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
 
        if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) {
                int w = tabular->GetWidthOfColumn(cell);
-               int h = tabular->GetAscentOfRow(row) + tabular->GetDescentOfRow(row);
-               pain.fillRectangle(x, baseline - tabular->GetAscentOfRow(row),
+               int h = tabular->GetAscentOfRow(row) + tabular->GetDescentOfRow(row)-1;
+               pain.fillRectangle(x, baseline - tabular->GetAscentOfRow(row) + 1,
                                   w, h, LColor::selection);
        }
 }
@@ -530,8 +530,10 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
        case INIT:
        case FULL:
        case CELL:
-               if (calculate_dimensions_of_cells(bv, font, false))
+               if (calculate_dimensions_of_cells(bv, font, false)) {
                        need_update = INIT;
+                       resetPos(bv);
+               }
                break;
        case SELECTION:
                need_update = FULL;
@@ -597,8 +599,8 @@ void InsetTabular::insetUnlock(BufferView * bv)
 {
        if (the_locking_inset) {
                the_locking_inset->insetUnlock(bv);
-               the_locking_inset = 0;
                updateLocal(bv, CELL, false);
+               the_locking_inset = 0;
        }
        hideInsetCursor(bv);
        oldcell = -1;
@@ -792,6 +794,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
        if (button == 3) {
                if ((ocell != actcell) && the_locking_inset) {
                        the_locking_inset->insetUnlock(bv);
+                       updateLocal(bv, CELL, false);
                        the_locking_inset = 0;
                }
                showInsetCursor(bv);
@@ -809,8 +812,8 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
                return;
        } else if (the_locking_inset) {
                the_locking_inset->insetUnlock(bv);
-               the_locking_inset = 0;
                updateLocal(bv, CELL, false);
+               the_locking_inset = 0;
        }
        if (button == 2) {
                localDispatch(bv, LFUN_PASTESELECTION, "paragraph");
@@ -1476,6 +1479,7 @@ void InsetTabular::fitInsetCursor(BufferView * bv) const
 
        int const asc = lyxfont::maxAscent(font);
        int const desc = lyxfont::maxDescent(font);
+       resetPos(bv);
        if (bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc))
                need_update = FULL;
 }
@@ -1770,6 +1774,8 @@ void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
                }
                if (!frozen)
                        unFreezeUndo();
+               if (selectall)
+                       clearSelection();
                updateLocal(bv, INIT, true);
        }
        if (the_locking_inset)
@@ -2823,7 +2829,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
 {
        if (buf.length() <= 0)
                return true;
-       
+
        int cols = 1;
        int rows = 1;
        int maxCols = 1;