Stefan Schimanski wrote:
Can you send me a complete patch of your changes?
attached. it defines a new lfun that selects a row (once you're in tabular) the part that doesn't work is this: // SELECT ROW if (cmd.x < xo(cur.bv()) + ADD_TO_TABULAR_WIDTH || cmd.x > xo(cur.bv()) + tabular.width()) { row_type r = 0; int h = yo(cur.bv()) - tabular.rowAscent(0); for (;r < tabular.rowCount() && cmd.y > h; ++r) { h += tabular.rowAscent(r); h += tabular.rowDescent(r); h += tabular.getAdditionalHeight(r); } cur.push(*this); bvcur.anchor_.idx() = tabular.getFirstCellInRow(r); cur.idx() = tabular.getLastCellInRow(r); cur.selection() = true; cur.pit() = 0; cur.pos() = 0; break; } thanks for having a look
Index: src/insets/InsetTabular.cpp =================================================================== --- src/insets/InsetTabular.cpp (revision 23696) +++ src/insets/InsetTabular.cpp (working copy) @@ -3198,6 +3198,25 @@ case LFUN_MOUSE_PRESS: //lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl; + // SELECT ROW + if (cmd.x < xo(cur.bv()) + ADD_TO_TABULAR_WIDTH + || cmd.x > xo(cur.bv()) + tabular.width()) { + row_type r = 0; + int h = yo(cur.bv()) - tabular.rowAscent(0); + for (;r < tabular.rowCount() && cmd.y > h; ++r) { + h += tabular.rowAscent(r); + h += tabular.rowDescent(r); + h += tabular.getAdditionalHeight(r); + } + cur.push(*this); + bvcur.anchor_.idx() = tabular.getFirstCellInRow(r); + cur.idx() = tabular.getLastCellInRow(r); + cur.selection() = true; + cur.pit() = 0; + cur.pos() = 0; + break; + } + // do not reset cursor/selection if we have selected // some cells (bug 2715). if (cmd.button() == mouse_button::button3 @@ -3231,6 +3250,16 @@ InsetTabularMailer(*this).showDialog(&cur.bv()); break; + case LFUN_ROW_SELECT: { + row_type const row = tabular.cellRow(cur.idx()); + bvcur.anchor_.idx() = tabular.getFirstCellInRow(row); + cur.idx() = tabular.getLastCellInRow(row); + cur.selection() = true; + cur.pit() = 0; + cur.pos() = 0; + break; + } + case LFUN_CELL_BACKWARD: movePrevCell(cur); cur.selection() = false; @@ -3731,6 +3760,7 @@ } // These are only enabled inside tabular + case LFUN_ROW_SELECT: case LFUN_CELL_BACKWARD: case LFUN_CELL_FORWARD: status.enabled(true); Index: src/lfuns.h =================================================================== --- src/lfuns.h (revision 23696) +++ src/lfuns.h (working copy) @@ -418,6 +418,7 @@ // 320 LFUN_COMPLETION_INLINE, LFUN_COMPLETION_COMPLETE, + LFUN_ROW_SELECT, LFUN_LASTACTION // end of the table }; Index: src/LyXAction.cpp =================================================================== --- src/LyXAction.cpp (revision 23696) +++ src/LyXAction.cpp (working copy) @@ -1602,6 +1602,7 @@ * \endvar */ { LFUN_COMPLETION_COMPLETE, "complete", SingleParUpdate, Edit }, + { LFUN_ROW_SELECT, "row-select", ReadOnly | SingleParUpdate, Edit }, { LFUN_NOACTION, "", Noop, Hidden } #ifndef DOXYGEN_SHOULD_SKIP_THIS