X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathGrid.cpp;h=5b58f09a03eb1b746873057d84b00d19f985ac60;hb=981e958b9d63930c83b1adced65b75b3d857ac97;hp=d37870d4ada3b7cc24908a559b75394e0c789e44;hpb=da1e7e14ce8afdf7925b8a75790c63301d0402aa;p=lyx.git diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index d37870d4ad..5b58f09a03 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -67,9 +67,9 @@ static int extractInt(istream & is) static void resetGrid(InsetMathGrid & grid) { while (grid.ncols() > 1) - grid.delCol(grid.ncols()); + grid.delCol(grid.ncols() - 1); while (grid.nrows() > 1) - grid.delRow(grid.nrows()); + grid.delRow(grid.nrows() - 1); grid.cell(0).erase(0, grid.cell(0).size()); grid.setDefaults(); } @@ -381,8 +381,8 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const // compute vertical offsets rowinfo_[0].offset_ = 0; for (row_type row = 1; row <= nrows(); ++row) { - rowinfo_[row].offset_ = - rowinfo_[row - 1].offset_ + + rowinfo_[row].offset_ = + rowinfo_[row - 1].offset_ + rowinfo_[row - 1].descent_ + rowinfo_[row - 1].skipPixels(mi) + rowsep() + @@ -427,20 +427,20 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const } - dim.wid = colinfo_[ncols() - 1].offset_ - + colinfo_[ncols() - 1].width_ - + vlinesep() * colinfo_[ncols()].lines_ - + border(); + dim.wid = colinfo_[ncols() - 1].offset_ + + colinfo_[ncols() - 1].width_ + + vlinesep() * colinfo_[ncols()].lines_ + + border(); - dim.asc = - rowinfo_[0].offset_ - + rowinfo_[0].ascent_ - + hlinesep() * rowinfo_[0].lines_ - + border(); + dim.asc = - rowinfo_[0].offset_ + + rowinfo_[0].ascent_ + + hlinesep() * rowinfo_[0].lines_ + + border(); - dim.des = rowinfo_[nrows() - 1].offset_ - + rowinfo_[nrows() - 1].descent_ - + hlinesep() * rowinfo_[nrows()].lines_ - + border(); + dim.des = rowinfo_[nrows() - 1].offset_ + + rowinfo_[nrows() - 1].descent_ + + hlinesep() * rowinfo_[nrows()].lines_ + + border(); /* @@ -688,17 +688,6 @@ void InsetMathGrid::addRow(row_type row) } -void InsetMathGrid::appendRow() -{ - rowinfo_.push_back(RowInfo()); - //cells_.insert(cells_.end(), ncols(), MathData()); - for (col_type col = 0; col < ncols(); ++col) { - cells_.push_back(cells_type::value_type()); - cellinfo_.push_back(CellInfo()); - } -} - - void InsetMathGrid::delRow(row_type row) { if (nrows() == 1) @@ -799,7 +788,7 @@ int InsetMathGrid::cellXOffset(BufferView const & bv, idx_type idx) const { col_type c = col(idx); int x = colinfo_[c].offset_; - char align = colinfo_[c].align_; + char align = displayColAlign(c, row(idx)); Dimension const & celldim = cell(idx).dimension(bv); if (align == 'r' || align == 'R') x += colinfo_[c].width_ - celldim.wid; @@ -986,14 +975,14 @@ void InsetMathGrid::mathmlize(MathStream & os) const char const * const celltag = havetable ? "mtd" : "mrow"; for (row_type row = 0; row < nrows(); ++row) { if (havetable) - os << MTag("mtr");; + os << MTag("mtr"); for (col_type col = 0; col < ncols(); ++col) { os << MTag(celltag); os << cell(index(row, col)); os << ETag(celltag); } if (havetable) - os << ETag("mtr");; + os << ETag("mtr"); } if (havetable) os << ETag("mtable"); @@ -1011,13 +1000,13 @@ void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const } os << MTag("table", attrib); for (row_type row = 0; row < nrows(); ++row) { - os << MTag("tr");; + os << MTag("tr"); for (col_type col = 0; col < ncols(); ++col) { os << MTag("td"); os << cell(index(row, col)); os << ETag("td"); } - os << ETag("tr");; + os << ETag("tr"); } os << ETag("table"); } @@ -1191,7 +1180,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd) if (cur.idx() > 0) --cur.idx(); cur.pos() = cur.lastpos(); - + cur.forceBufferUpdate(); //mathcursor->normalize(); //cmd = FuncRequest(LFUN_FINISHED_BACKWARD); break; @@ -1534,7 +1523,7 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd, } case LFUN_CELL_SPLIT: - status.setEnabled(true); + status.setEnabled(cur.idx() != cur.lastidx()); return true; case LFUN_CELL_BACKWARD: