Stefan Schimanski wrote:
Look in BufferView::mouseEventDispatch:
Inset * inset = d->text_metrics_[&buffer_.text()].editXY(cur, cmd.x,
cmd.y);
So only the inset below the cursor will get the event.
it s getting the event alright, you're clicking on the white border
the attached patch increases its size a bit...
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp (revision 23696)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -85,8 +85,8 @@
namespace {
-int const ADD_TO_HEIGHT = 2;
-int const ADD_TO_TABULAR_WIDTH = 2;
+int const ADD_TO_HEIGHT = 10;
+int const ADD_TO_TABULAR_WIDTH = 10;
int const default_line_space = 10;
int const WIDTH_OF_LINE = 5;
@@ -3198,6 +3198,26 @@
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);
+ }
+ lyxerr << "Row " << r << endl;
+ 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 +3251,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 +3761,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