Fix bug 4323/2, and more logical naming of addRow

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@21430 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-11-05 10:03:45 +00:00
parent 035078cc87
commit 2929845c7f
5 changed files with 12 additions and 12 deletions

View File

@ -64,7 +64,7 @@ InsetMathArray::InsetMathArray(docstring const & name, docstring const & str)
} }
for (row_type row = 1; row < dat.size(); ++row) for (row_type row = 1; row < dat.size(); ++row)
addRow(0); appendRow(0);
for (col_type col = 1; col < dat[0].size(); ++col) for (col_type col = 1; col < dat[0].size(); ++col)
addCol(0); addCol(0);
for (row_type row = 0; row < dat.size(); ++row) for (row_type row = 0; row < dat.size(); ++row)

View File

@ -679,7 +679,7 @@ docstring InsetMathGrid::eocString(col_type col, col_type lastcol) const
} }
void InsetMathGrid::addRow(row_type row) void InsetMathGrid::appendRow(row_type row)
{ {
rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo()); rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
cells_.insert cells_.insert
@ -717,7 +717,7 @@ void InsetMathGrid::delRow(row_type row)
void InsetMathGrid::copyRow(row_type row) void InsetMathGrid::copyRow(row_type row)
{ {
addRow(row); appendRow(row);
for (col_type col = 0; col < ncols(); ++col) for (col_type col = 0; col < ncols(); ++col)
cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col]; cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col];
} }
@ -1122,7 +1122,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_BREAK_LINE: { case LFUN_BREAK_LINE: {
recordUndoInset(cur); recordUndoInset(cur);
row_type const r = cur.row(); row_type const r = cur.row();
addRow(r); appendRow(r);
// split line // split line
for (col_type c = col(cur.idx()) + 1; c < ncols(); ++c) for (col_type c = col(cur.idx()) + 1; c < ncols(); ++c)
@ -1160,7 +1160,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
halign('c', cur.col()); halign('c', cur.col());
else if (s == "append-row") else if (s == "append-row")
for (int i = 0, n = extractInt(is); i < n; ++i) for (int i = 0, n = extractInt(is); i < n; ++i)
addRow(cur.row()); appendRow(cur.row());
else if (s == "delete-row") { else if (s == "delete-row") {
for (int i = 0, n = extractInt(is); i < n; ++i) { for (int i = 0, n = extractInt(is); i < n; ++i) {
delRow(cur.row()); delRow(cur.row());
@ -1196,7 +1196,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
row_type const r = cur.row(); row_type const r = cur.row();
col_type const c = cur.col(); col_type const c = cur.col();
for (int i = 0, n = extractInt(is); i < n; ++i) for (int i = 0, n = extractInt(is); i < n; ++i)
addCol(cur.col()); addCol(cur.col() + 1);
cur.idx() = index(r, c); cur.idx() = index(r, c);
} }
else if (s == "delete-column") { else if (s == "delete-column") {

View File

@ -169,15 +169,15 @@ public:
/// pulls cell after pressing erase /// pulls cell after pressing erase
void idxGlue(idx_type idx); void idxGlue(idx_type idx);
/// add a row /// add a row, one row down
virtual void addRow(row_type r); virtual void appendRow(row_type r);
/// delete a row /// delete a row
virtual void delRow(row_type r); virtual void delRow(row_type r);
/// copy a row /// copy a row
virtual void copyRow(row_type r); virtual void copyRow(row_type r);
/// swap two rows /// swap two rows
virtual void swapRow(row_type r); virtual void swapRow(row_type r);
/// add a column /// add a column, here
virtual void addCol(col_type c); virtual void addCol(col_type c);
/// delete a column /// delete a column
virtual void delCol(col_type c); virtual void delCol(col_type c);

View File

@ -630,7 +630,7 @@ void InsetMathHull::addRow(row_type row)
return; return;
nonum_.insert(nonum_.begin() + row + 1, !numberedType()); nonum_.insert(nonum_.begin() + row + 1, !numberedType());
label_.insert(label_.begin() + row + 1, docstring()); label_.insert(label_.begin() + row + 1, docstring());
InsetMathGrid::addRow(row); InsetMathGrid::appendRow(row);
} }
@ -1031,7 +1031,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
#ifdef WITH_WARNINGS #ifdef WITH_WARNINGS
#warning temporarily disabled #warning temporarily disabled
#endif #endif
addRow(cur.row()); appendRow(cur.row());
++cur.idx(); ++cur.idx();
++cur.idx(); ++cur.idx();
cur.cell() = eq; cur.cell() = eq;

View File

@ -116,7 +116,7 @@ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
++cellrow; ++cellrow;
if (cellrow == grid.nrows()) { if (cellrow == grid.nrows()) {
//lyxerr << "adding row " << cellrow << endl; //lyxerr << "adding row " << cellrow << endl;
grid.addRow(cellrow - 1); grid.appendRow(cellrow - 1);
if (cellrow == grid.nrows()) { if (cellrow == grid.nrows()) {
// We can't add a row to this grid, so let's // We can't add a row to this grid, so let's
// append the content of this cell to the previous // append the content of this cell to the previous