Edwin Leuven wrote:
give it a try: it is nice to be finally able to easily set the lines you want

any objections if i apply the attached?
Index: src/frontends/qt4/GuiTabular.cpp
===================================================================
--- src/frontends/qt4/GuiTabular.cpp	(revision 23727)
+++ src/frontends/qt4/GuiTabular.cpp	(working copy)
@@ -283,28 +283,28 @@
 
 void GuiTabular::leftBorder_changed()
 {
-	toggleLeftLine();
+	set(Tabular::TOGGLE_LINE_LEFT);
 	changed();
 }
 
 
 void GuiTabular::rightBorder_changed()
 {
-	toggleRightLine();
+	set(Tabular::TOGGLE_LINE_RIGHT);
 	changed();
 }
 
 
 void GuiTabular::topBorder_changed()
 {
-	toggleTopLine();
+	set(Tabular::TOGGLE_LINE_TOP);
 	changed();
 }
 
 
 void GuiTabular::bottomBorder_changed()
 {
-	toggleBottomLine();
+	set(Tabular::TOGGLE_LINE_BOTTOM);
 	changed();
 }
 
@@ -554,39 +554,10 @@
 void GuiTabular::update_borders()
 {
 	Tabular::idx_type const cell = getActiveCell();
-	bool const isMulticolumnCell = tabular_.isMultiColumn(cell);
-
-	if (!isMulticolumnCell) {
-		borders->setLeftEnabled(true);
-		borders->setRightEnabled(true);
-		borders->setTop(tabular_.topLine(cell, true));
-		borders->setBottom(tabular_.bottomLine(cell, true));
-		borders->setLeft(tabular_.leftLine(cell, true));
-		borders->setRight(tabular_.rightLine(cell, true));
-		// repaint the setborder widget
-		borders->update();
-		return;
-	}
-
 	borders->setTop(tabular_.topLine(cell));
 	borders->setBottom(tabular_.bottomLine(cell));
-	// pay attention to left/right lines: they are only allowed
-	// to set if we are in first/last cell of row or if the left/right
-	// cell is also a multicolumn.
-	if (tabular_.isFirstCellInRow(cell) || tabular_.isMultiColumn(cell - 1)) {
-		borders->setLeftEnabled(true);
-		borders->setLeft(tabular_.leftLine(cell));
-	} else {
-		borders->setLeft(false);
-		borders->setLeftEnabled(false);
-	}
-	if (tabular_.isLastCellInRow(cell) || tabular_.isMultiColumn(cell + 1)) {
-		borders->setRightEnabled(true);
-		borders->setRight(tabular_.rightLine(cell));
-	} else {
-		borders->setRight(false);
-		borders->setRightEnabled(false);
-	}
+	borders->setLeft(tabular_.leftLine(cell));
+	borders->setRight(tabular_.rightLine(cell));
 	// repaint the setborder widget
 	borders->update();
 }
@@ -988,42 +959,6 @@
 }
 
 
-void GuiTabular::toggleTopLine()
-{
-	if (tabular_.isMultiColumn(getActiveCell()))
-		set(Tabular::M_TOGGLE_LINE_TOP);
-	else
-		set(Tabular::TOGGLE_LINE_TOP);
-}
-
-
-void GuiTabular::toggleBottomLine()
-{
-	if (tabular_.isMultiColumn(getActiveCell()))
-		set(Tabular::M_TOGGLE_LINE_BOTTOM);
-	else
-		set(Tabular::TOGGLE_LINE_BOTTOM);
-}
-
-
-void GuiTabular::toggleLeftLine()
-{
-	if (tabular_.isMultiColumn(getActiveCell()))
-		set(Tabular::M_TOGGLE_LINE_LEFT);
-	else
-		set(Tabular::TOGGLE_LINE_LEFT);
-}
-
-
-void GuiTabular::toggleRightLine()
-{
-	if (tabular_.isMultiColumn(getActiveCell()))
-		set(Tabular::M_TOGGLE_LINE_RIGHT);
-	else
-		set(Tabular::TOGGLE_LINE_RIGHT);
-}
-
-
 void GuiTabular::setSpecial(string const & special)
 {
 	if (tabular_.isMultiColumn(getActiveCell()))
Index: src/frontends/qt4/GuiTabular.h
===================================================================
--- src/frontends/qt4/GuiTabular.h	(revision 23727)
+++ src/frontends/qt4/GuiTabular.h	(working copy)
@@ -95,12 +95,6 @@
 	/// set a parameter
 	void set(Tabular::Feature, std::string const & arg = std::string());
 
-	/// borders
-	void toggleTopLine();
-	void toggleBottomLine();
-	void toggleLeftLine();
-	void toggleRightLine();
-
 	void setSpecial(std::string const & special);
 
 	void setWidth(std::string const & width);
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp	(revision 23727)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -85,10 +85,10 @@
 
 namespace {
 
-int const ADD_TO_HEIGHT = 2;
-int const ADD_TO_TABULAR_WIDTH = 2;
-int const default_line_space = 10;
-int const WIDTH_OF_LINE = 5;
+int const ADD_TO_HEIGHT = 2; // in cell
+int const ADD_TO_TABULAR_WIDTH = 6; // horiz space before and after the table
+int const default_line_space = 10; // ?
+int const WIDTH_OF_LINE = 5; // space between double lines
 
 
 ///
@@ -120,10 +120,6 @@
 	{ Tabular::VALIGN_TOP, "valign-top" },
 	{ Tabular::VALIGN_BOTTOM, "valign-bottom" },
 	{ Tabular::VALIGN_MIDDLE, "valign-middle" },
-	{ Tabular::M_TOGGLE_LINE_TOP, "m-toggle-line-top" },
-	{ Tabular::M_TOGGLE_LINE_BOTTOM, "m-toggle-line-bottom" },
-	{ Tabular::M_TOGGLE_LINE_LEFT, "m-toggle-line-left" },
-	{ Tabular::M_TOGGLE_LINE_RIGHT, "m-toggle-line-right" },
 	{ Tabular::M_ALIGN_LEFT, "m-align-left" },
 	{ Tabular::M_ALIGN_RIGHT, "m-align-right" },
 	{ Tabular::M_ALIGN_CENTER, "m-align-center" },
@@ -478,9 +474,9 @@
 	  multicolumn(Tabular::CELL_NORMAL),
 	  alignment(LYX_ALIGN_CENTER),
 	  valignment(LYX_VALIGN_TOP),
-	  top_line(true),
+	  top_line(false),
 	  bottom_line(false),
-	  left_line(true),
+	  left_line(false),
 	  right_line(false),
 	  usebox(BOX_NONE),
 	  rotate(false),
@@ -538,7 +534,7 @@
 Tabular::RowData::RowData()
 	: ascent(0),
 	  descent(0),
-	  top_line(true),
+	  top_line(false),
 	  bottom_line(false),
 	  top_space_default(false),
 	  bottom_space_default(false),
@@ -554,7 +550,7 @@
 Tabular::ColumnData::ColumnData()
 	: alignment(LYX_ALIGN_CENTER),
 	  valignment(LYX_VALIGN_TOP),
-	  left_line(true),
+	  left_line(false),
 	  right_line(false),
 	  width(0)
 {
@@ -592,11 +588,7 @@
 	column_info.reserve(10);
 	cell_info.reserve(100);
 	fixCellNums();
-	for (row_type i = 0; i < rows_arg; ++i)
-		cell_info[i].back().right_line = true;
-	row_info.back().bottom_line = true;
-	row_info.front().bottom_line = true;
-	column_info.back().right_line = true;
+	// FIXME: set LyX's silly default lines?
 	is_long_tabular = false;
 	rotate = false;
 	use_booktabs = false;
@@ -606,15 +598,9 @@
 void Tabular::fixCellNums()
 {
 	idx_type cellno = 0;
-	for (row_type i = 0; i < rowCount(); ++i) {
-		for (col_type j = 0; j < columnCount(); ++j) {
-			// When debugging it can be nice to set
-			// this to true.
-			cell_info[i][j].inset->setDrawFrame(false);
+	for (row_type i = 0; i < rowCount(); ++i)
+		for (col_type j = 0; j < columnCount(); ++j)
 			cell_info[i][j].cellno = cellno++;
-		}
-		cell_info[i].back().right_line = true;
-	}
 
 	updateIndexes();
 }
@@ -809,43 +795,31 @@
 }
 
 
-bool Tabular::topLine(idx_type const cell, bool const wholerow) const
+bool Tabular::topLine(idx_type const cell) const
 {
-	if (!wholerow && isMultiColumn(cell) &&
-	    !(use_booktabs && cellRow(cell) == 0))
-		return cellinfo_of_cell(cell).top_line;
-	return row_info[cellRow(cell)].top_line;
+	return cellinfo_of_cell(cell).top_line;
 }
 
 
-bool Tabular::bottomLine(idx_type const cell, bool wholerow) const
+bool Tabular::bottomLine(idx_type const cell) const
 {
-	if (!wholerow && isMultiColumn(cell) &&
-	    !(use_booktabs && isLastRow(cell)))
-		return cellinfo_of_cell(cell).bottom_line;
-	return row_info[cellRow(cell)].bottom_line;
+	return cellinfo_of_cell(cell).bottom_line;
 }
 
 
-bool Tabular::leftLine(idx_type cell, bool wholecolumn) const
+bool Tabular::leftLine(idx_type cell) const
 {
 	if (use_booktabs)
 		return false;
-	if (!wholecolumn && isMultiColumn(cell) &&
-		(isFirstCellInRow(cell) || isMultiColumn(cell-1)))
-		return cellinfo_of_cell(cell).left_line;
-	return column_info[cellColumn(cell)].left_line;
+	return cellinfo_of_cell(cell).left_line;
 }
 
 
-bool Tabular::rightLine(idx_type cell, bool wholecolumn) const
+bool Tabular::rightLine(idx_type cell) const
 {
 	if (use_booktabs)
 		return false;
-	if (!wholecolumn && isMultiColumn(cell) &&
-		(isLastCellInRow(cell) || isMultiColumn(cell + 1)))
-		return cellinfo_of_cell(cell).right_line;
-	return column_info[cellRightColumn(cell)].right_line;
+	return cellinfo_of_cell(cell).right_line;
 }
 
 
@@ -919,6 +893,7 @@
 	int const interline_space = row_info[row - 1].interline_space_default ?
 		default_line_space :
 		row_info[row - 1].interline_space.inPixels(width());
+
 	if (top && bottom)
 		return interline_space + WIDTH_OF_LINE;
 	return interline_space;
@@ -929,11 +904,9 @@
 {
 	// internally already set in setCellWidth
 	// used to get it back in text.cpp
-	col_type const col = cellRightColumn(cell);
-	row_type const row = cellRow(cell);
-	if (col < columnCount() - 1 && rightLine(cell) &&
-		leftLine(cell_info[row][col+1].cellno)) // column_info[col+1].left_line)
-	{
+	col_type const col = cellColumn(cell);
+	if (col < columnCount() - 1 && column_info[col].right_line &&
+		column_info[col + 1].left_line) {
 		return WIDTH_OF_LINE;
 	}
 	return 0;
@@ -1024,15 +997,13 @@
 void Tabular::setCellWidth(idx_type cell, int new_width)
 {
 	row_type const row = cellRow(cell);
-	col_type const column1 = cellColumn(cell);
+	col_type const col = cellColumn(cell);
 	bool tmp = false;
 	int width = 0;
 	int add_width = 0;
 
-	if (rightLine(cell_info[row][column1].cellno, true) &&
-		column1 < columnCount() - 1 &&
-		leftLine(cell_info[row][column1+1].cellno, true))
-	{
+	if (col < columnCount() - 1 && column_info[col].right_line &&
+		column_info[col + 1].left_line) {
 		add_width = WIDTH_OF_LINE;
 	}
 
@@ -1043,10 +1014,10 @@
 		tmp = setWidthOfMulticolCell(cell, new_width);
 	} else {
 		width = new_width + 2 * WIDTH_OF_LINE + add_width;
-		cell_info[row][column1].width = width;
-		tmp = calculate_width_of_column_NMC(column1);
+		cell_info[row][col].width = width;
+		tmp = calculate_width_of_column_NMC(col);
 		if (tmp)
-			recalculateMulticolumnsOfColumn(column1);
+			recalculateMulticolumnsOfColumn(col);
 	}
 	if (tmp) {
 		for (col_type i = 0; i < columnCount(); ++i)
@@ -1162,40 +1133,67 @@
 }
 
 
-void Tabular::setTopLine(idx_type cell, bool line, bool wholerow)
+void Tabular::setTopLine(idx_type i, bool line)
 {
-	row_type const row = cellRow(cell);
-	if (wholerow || !isMultiColumn(cell))
-		row_info[row].top_line = line;
-	else
-		cellinfo_of_cell(cell).top_line = line;
+	cellinfo_of_cell(i).top_line = line;
+
+	row_type const r = cellRow(i);
+	idx_type i0 = getFirstCellInRow(r);
+	idx_type i1 = getLastCellInRow(r);
+
+	bool all_rows_set = true;
+	for (idx_type j = i0; all_rows_set && j <= i1; ++j)
+		all_rows_set = cellinfo_of_cell(j).top_line;
+
+	row_info[r].top_line = all_rows_set;
 }
 
 
-void Tabular::setBottomLine(idx_type cell, bool line, bool wholerow)
+void Tabular::setBottomLine(idx_type i, bool line)
 {
-	if (wholerow || !isMultiColumn(cell))
-		row_info[cellRow(cell)].bottom_line = line;
-	else
-		cellinfo_of_cell(cell).bottom_line = line;
+	cellinfo_of_cell(i).bottom_line = line;
+
+	row_type const r = cellRow(i);
+	idx_type i0 = getFirstCellInRow(r);
+	idx_type i1 = getLastCellInRow(r);
+
+	bool all_rows_set = true;
+	for (idx_type j = i0; all_rows_set && j <= i1; ++j)
+		all_rows_set = cellinfo_of_cell(j).bottom_line;
+
+	row_info[r].bottom_line = all_rows_set;
 }
 
 
-void Tabular::setLeftLine(idx_type cell, bool line, bool wholecolumn)
+void Tabular::setLeftLine(idx_type cell, bool line)
 {
-	if (wholecolumn || !isMultiColumn(cell))
-		column_info[cellColumn(cell)].left_line = line;
-	else
-		cellinfo_of_cell(cell).left_line = line;
+	cellinfo_of_cell(cell).left_line = line;
+
+	bool all_cols_set = true;
+	col_type c = cellColumn(cell);
+	row_type nrows = rowCount();
+	for (row_type r = 0; all_cols_set && r < nrows; ++r) {
+		idx_type i = cellIndex(r, c);
+		all_cols_set = cellinfo_of_cell(i).left_line;
+	}
+
+	column_info[c].left_line = all_cols_set;
 }
 
 
-void Tabular::setRightLine(idx_type cell, bool line, bool wholecolumn)
+void Tabular::setRightLine(idx_type cell, bool line)
 {
-	if (wholecolumn || !isMultiColumn(cell))
-		column_info[cellRightColumn(cell)].right_line = line;
-	else
-		cellinfo_of_cell(cell).right_line = line;
+	cellinfo_of_cell(cell).right_line = line;
+
+	bool all_cols_set = true;
+	col_type c = cellColumn(cell);
+	row_type nrows = rowCount();
+	for (row_type r = 0; all_cols_set && r < nrows; ++r) {
+		idx_type i = cellIndex(r, c);
+		all_cols_set = cellinfo_of_cell(i).right_line;
+	}
+
+	column_info[c].right_line = all_cols_set;
 }
 
 
@@ -1600,10 +1598,6 @@
 	CellData & cs = cellinfo_of_cell(cell);
 	cs.multicolumn = CELL_BEGIN_OF_MULTICOLUMN;
 	cs.alignment = column_info[cellColumn(cell)].alignment;
-	cs.top_line = row_info[cellRow(cell)].top_line;
-	cs.bottom_line = row_info[cellRow(cell)].bottom_line;
-	cs.left_line = column_info[cellColumn(cell)].left_line;
-	cs.right_line = column_info[cellColumn(cell+number-1)].right_line;
 	for (idx_type i = 1; i < number; ++i) {
 		CellData & cs1 = cellinfo_of_cell(cell + i);
 		cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
@@ -2033,18 +2027,20 @@
 		os << "\\begin{sideways}\n";
 		++ret;
 	}
-	if (isMultiColumn(cell)) {
+	Tabular::VAlignment valign =  getVAlignment(cell, !isMultiColumn(cell));
+	LyXAlignment align = getAlignment(cell, !isMultiColumn(cell));
+	col_type c = cellColumn(cell);
+	if (isMultiColumn(cell)
+		|| (leftLine(cell) && !column_info[c].left_line)
+		|| (rightLine(cell) && !column_info[c].right_line)) {
 		os << "\\multicolumn{" << cells_in_multicolumn(cell) << "}{";
-		if (leftLine(cell) &&
-			(isFirstCellInRow(cell) ||
-			 (!isMultiColumn(cell - 1) && !leftLine(cell, true) &&
-			  !rightLine(cell - 1, true))))
+		if (leftLine(cell))
 			os << '|';
 		if (!cellinfo_of_cell(cell).align_special.empty()) {
 			os << cellinfo_of_cell(cell).align_special;
 		} else {
 			if (!getPWidth(cell).zero()) {
-				switch (getVAlignment(cell)) {
+				switch (valign) {
 				case LYX_VALIGN_TOP:
 					os << 'p';
 					break;
@@ -2059,7 +2055,7 @@
 				   << from_ascii(getPWidth(cell).asLatexString())
 				   << '}';
 			} else {
-				switch (getAlignment(cell)) {
+				switch (align) {
 				case LYX_ALIGN_LEFT:
 					os << 'l';
 					break;
@@ -2074,14 +2070,11 @@
 		} // end if else !cellinfo_of_cell
 		if (rightLine(cell))
 			os << '|';
-		if (((cell + 1) < cellCount()) && !isFirstCellInRow(cell+1) &&
-			leftLine(cell+1))
-			os << '|';
 		os << "}{";
 		}
 	if (getUsebox(cell) == BOX_PARBOX) {
 		os << "\\parbox[";
-		switch (getVAlignment(cell)) {
+		switch (valign) {
 		case LYX_VALIGN_TOP:
 			os << 't';
 			break;
@@ -2096,7 +2089,7 @@
 		   << "}{";
 	} else if (getUsebox(cell) == BOX_MINIPAGE) {
 		os << "\\begin{minipage}[";
-		switch (getVAlignment(cell)) {
+		switch (valign) {
 		case LYX_VALIGN_TOP:
 			os << 't';
 			break;
@@ -2126,7 +2119,10 @@
 		os << "%\n\\end{minipage}";
 		ret += 2;
 	}
-	if (isMultiColumn(cell)) {
+	col_type c = cellColumn(cell);
+	if (isMultiColumn(cell)
+		|| (leftLine(cell) && !column_info[c].left_line)
+		|| (rightLine(cell) && !column_info[c].right_line)) {
 		os << '}';
 	}
 	if (getRotateCell(cell)) {
@@ -2924,6 +2920,34 @@
 }
 
 
+int InsetTabular::getRowFromY(Cursor & cur, int y) const
+{
+	// top y coordinate of tabular
+	int h = yo(cur.bv()) - tabular.rowAscent(0);
+	size_t nrows = tabular.rowCount();
+	row_type r = 0;
+	for (;r < nrows && y > h; ++r) {
+		h += tabular.rowAscent(r);
+		h += tabular.rowDescent(r);
+		h += tabular.getAdditionalHeight(r);
+	}
+	return r - 1;
+}
+
+
+int InsetTabular::getColumnFromX(Cursor & cur, int x) const
+{
+	// left x coordinate of tabular
+	int w = xo(cur.bv()) + ADD_TO_TABULAR_WIDTH;
+	size_t ncols = tabular.columnCount();
+	col_type c = 0;
+	for (;c < ncols && x > w; ++c) {
+		w += tabular.columnWidth(c);
+	}
+	return c - 1;
+}
+
+
 void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
 {
 	//lyxerr << "InsetTabular::metrics: " << mi.base.bv << " width: " <<
@@ -3195,9 +3219,36 @@
 
 	switch (cmd.action) {
 
-	case LFUN_MOUSE_PRESS:
+	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 = getRowFromY(cur, cmd.y);
+			cur.idx() = tabular.getFirstCellInRow(r);
+			cur.pos() = 0;
+			cur.resetAnchor();
+			cur.idx() = tabular.getLastCellInRow(r);
+			cur.pos() = cur.lastpos();
+			cur.selection() = true;
+			bvcur = cur; 
+			break;
+		}
+		// select column
+		int const y0 = yo(cur.bv()) - tabular.rowAscent(0);
+		if (cmd.y < y0 + ADD_TO_TABULAR_WIDTH 
+			|| cmd.y > y0 + tabular.height()) {
+			col_type c = getColumnFromX(cur, cmd.x);
+			cur.idx() = tabular.cellIndex(0, c);
+			cur.pos() = 0;
+			cur.resetAnchor();
+			cur.idx() = tabular.cellIndex(tabular.rowCount() - 1, c);
+			cur.pos() = cur.lastpos();
+			cur.selection() = true;
+			bvcur = cur; 
+			break;
+		}
 		// do not reset cursor/selection if we have selected
 		// some cells (bug 2715).
 		if (cmd.button() == mouse_button::button3
@@ -3208,20 +3259,41 @@
 			// Let InsetText do it
 			cell(cur.idx())->dispatch(cur, cmd);
 		break;
+	}
 	case LFUN_MOUSE_MOTION:
 		//lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl;
 		if (cmd.button() == mouse_button::button1) {
 			// only accept motions to places not deeper nested than the real anchor
-			if (bvcur.anchor_.hasPart(cur)) {
-				// only update if selection changes
-				if (bvcur.idx() == cur.idx() &&
-					!(bvcur.anchor_.idx() == cur.idx() && bvcur.pos() != cur.pos()))
-					cur.noUpdate();
-				setCursorFromCoordinates(cur, cmd.x, cmd.y);
+			if (!bvcur.anchor_.hasPart(cur)) {
+				cur.undispatched();
+				break;
+			}
+			// select (additional) row
+			if (cmd.x < xo(cur.bv()) + ADD_TO_TABULAR_WIDTH
+				|| cmd.x > xo(cur.bv()) + tabular.width()) {
+				row_type r = getRowFromY(cur, cmd.y);
+				cur.idx() = tabular.getLastCellInRow(r);
 				bvcur.setCursor(cur);
 				bvcur.selection() = true;
-			} else
-				cur.undispatched();
+				break;
+			}
+			// select (additional) column
+			int const y0 = yo(cur.bv()) - tabular.rowAscent(0);
+			if (cmd.y < y0 + ADD_TO_TABULAR_WIDTH 
+				|| cmd.y > y0 + tabular.height()) {
+				col_type c = getColumnFromX(cur, cmd.x);
+				cur.idx() = tabular.cellIndex(tabular.rowCount() - 1, c);
+				bvcur.setCursor(cur);
+				bvcur.selection() = true;
+				break;
+			}
+			// only update if selection changes
+			if (bvcur.idx() == cur.idx() &&
+				!(bvcur.anchor_.idx() == cur.idx() && bvcur.pos() != cur.pos()))
+				cur.noUpdate();
+			setCursorFromCoordinates(cur, cmd.x, cmd.y);
+			bvcur.setCursor(cur);
+			bvcur.selection() = true;
 		}
 		break;
 
@@ -3240,7 +3312,6 @@
 		moveNextCell(cur);
 		cur.selection() = false;
 		break;
-
 	case LFUN_CHAR_FORWARD_SELECT:
 	case LFUN_CHAR_FORWARD:
 		cell(cur.idx())->dispatch(cur, cmd);
@@ -3578,28 +3649,20 @@
 			status.setOnOff(tabular.isMultiColumn(cur.idx()));
 			break;
 
-		case Tabular::M_TOGGLE_LINE_TOP:
-			flag = false;
 		case Tabular::TOGGLE_LINE_TOP:
-			status.setOnOff(tabular.topLine(cur.idx(), flag));
+			status.setOnOff(tabular.topLine(cur.idx()));
 			break;
 
-		case Tabular::M_TOGGLE_LINE_BOTTOM:
-			flag = false;
 		case Tabular::TOGGLE_LINE_BOTTOM:
-			status.setOnOff(tabular.bottomLine(cur.idx(), flag));
+			status.setOnOff(tabular.bottomLine(cur.idx()));
 			break;
 
-		case Tabular::M_TOGGLE_LINE_LEFT:
-			flag = false;
 		case Tabular::TOGGLE_LINE_LEFT:
-			status.setOnOff(tabular.leftLine(cur.idx(), flag));
+			status.setOnOff(tabular.leftLine(cur.idx()));
 			break;
 
-		case Tabular::M_TOGGLE_LINE_RIGHT:
-			flag = false;
 		case Tabular::TOGGLE_LINE_RIGHT:
-			status.setOnOff(tabular.rightLine(cur.idx(), flag));
+			status.setOnOff(tabular.rightLine(cur.idx()));
 			break;
 
 		case Tabular::M_ALIGN_LEFT:
@@ -4220,51 +4283,35 @@
 		cur.idx() = tabular.cellIndex(row, column);
 		break;
 
-	case Tabular::M_TOGGLE_LINE_TOP:
-		flag = false;
 	case Tabular::TOGGLE_LINE_TOP: {
-		bool lineSet = !tabular.topLine(cur.idx(), flag);
+		bool lineSet = !tabular.topLine(cur.idx());
 		for (row_type i = sel_row_start; i <= sel_row_end; ++i)
 			for (col_type j = sel_col_start; j <= sel_col_end; ++j)
-				tabular.setTopLine(
-					tabular.cellIndex(i, j),
-					lineSet, flag);
+				tabular.setTopLine(tabular.cellIndex(i, j), lineSet);
 		break;
 	}
 
-	case Tabular::M_TOGGLE_LINE_BOTTOM:
-		flag = false;
 	case Tabular::TOGGLE_LINE_BOTTOM: {
-		bool lineSet = !tabular.bottomLine(cur.idx(), flag);
+		bool lineSet = !tabular.bottomLine(cur.idx());
 		for (row_type i = sel_row_start; i <= sel_row_end; ++i)
 			for (col_type j = sel_col_start; j <= sel_col_end; ++j)
-				tabular.setBottomLine(
-					tabular.cellIndex(i, j),
-					lineSet,
-					flag);
+				tabular.setBottomLine(tabular.cellIndex(i, j), lineSet);
 		break;
 	}
 
-	case Tabular::M_TOGGLE_LINE_LEFT:
-		flag = false;
 	case Tabular::TOGGLE_LINE_LEFT: {
-		bool lineSet = !tabular.leftLine(cur.idx(), flag);
+		bool lineSet = !tabular.leftLine(cur.idx());
 		for (row_type i = sel_row_start; i <= sel_row_end; ++i)
 			for (col_type j = sel_col_start; j <= sel_col_end; ++j)
-				tabular.setLeftLine(
-					tabular.cellIndex(i,j),
-					lineSet,
-					flag);
+				tabular.setLeftLine(tabular.cellIndex(i, j), lineSet);
 		break;
 	}
 
-	case Tabular::M_TOGGLE_LINE_RIGHT:
-		flag = false;
 	case Tabular::TOGGLE_LINE_RIGHT: {
-		bool lineSet = !tabular.rightLine(cur.idx(), flag);
+		bool lineSet = !tabular.rightLine(cur.idx());
 		for (row_type i = sel_row_start; i <= sel_row_end; ++i)
 			for (col_type j = sel_col_start; j <= sel_col_end; ++j)
-				tabular.setRightLine(tabular.cellIndex(i,j), lineSet, flag);
+				tabular.setRightLine(tabular.cellIndex(i, j), lineSet);
 		break;
 	}
 
@@ -4522,10 +4569,6 @@
 	while (paste_tabular->rowCount() > rows)
 		paste_tabular->deleteRow(rows);
 
-	paste_tabular->setTopLine(0, true, true);
-	paste_tabular->setBottomLine(paste_tabular->getFirstCellInRow(rows - 1),
-				     true, true);
-
 	for (col_type i = 0; i < cs; ++i)
 		paste_tabular->deleteColumn(0);
 
@@ -4533,10 +4576,6 @@
 	while (paste_tabular->columnCount() > columns)
 		paste_tabular->deleteColumn(columns);
 
-	paste_tabular->setLeftLine(0, true, true);
-	paste_tabular->setRightLine(paste_tabular->getLastCellInRow(0),
-				    true, true);
-
 	odocstringstream os;
 	OutputParams const runparams(0);
 	paste_tabular->plaintext(os, runparams, 0, true, '\t');
Index: src/insets/InsetTabular.h
===================================================================
--- src/insets/InsetTabular.h	(revision 23727)
+++ src/insets/InsetTabular.h	(working copy)
@@ -106,14 +106,6 @@
 		///
 		VALIGN_MIDDLE,
 		///
-		M_TOGGLE_LINE_TOP,
-		///
-		M_TOGGLE_LINE_BOTTOM,
-		///
-		M_TOGGLE_LINE_LEFT,
-		///
-		M_TOGGLE_LINE_RIGHT,
-		///
 		M_ALIGN_LEFT,
 		///
 		M_ALIGN_RIGHT,
@@ -244,13 +236,13 @@
 	Tabular(Buffer const &, col_type columns_arg, row_type rows_arg);
 
 	/// Returns true if there is a topline, returns false if not
-	bool topLine(idx_type cell, bool wholerow = false) const;
+	bool topLine(idx_type cell) const;
 	/// Returns true if there is a topline, returns false if not
-	bool bottomLine(idx_type cell, bool wholerow = false) const;
+	bool bottomLine(idx_type cell) const;
 	/// Returns true if there is a topline, returns false if not
-	bool leftLine(idx_type cell, bool wholecolumn = false) const;
+	bool leftLine(idx_type cell) const;
 	/// Returns true if there is a topline, returns false if not
-	bool rightLine(idx_type cell, bool wholecolumn = false) const;
+	bool rightLine(idx_type cell) const;
 
 	///
 	bool topAlreadyDrawn(idx_type cell) const;
@@ -285,13 +277,13 @@
 	///
 	void setAllLines(idx_type cell, bool line);
 	///
-	void setTopLine(idx_type cell, bool line, bool wholerow = false);
+	void setTopLine(idx_type cell, bool line);
 	///
-	void setBottomLine(idx_type cell, bool line, bool wholerow = false);
+	void setBottomLine(idx_type cell, bool line);
 	///
-	void setLeftLine(idx_type cell, bool line, bool wholecolumn = false);
+	void setLeftLine(idx_type cell, bool line);
 	///
-	void setRightLine(idx_type cell, bool line, bool wholecolumn = false);
+	void setRightLine(idx_type cell, bool line);
 	///
 	void setAlignment(idx_type cell, LyXAlignment align,
 			  bool onlycolumn = false);
@@ -743,6 +735,10 @@
 
 	/// lock cell with given index
 	void edit(Cursor & cur, bool front, EntryDirection entry_from);
+	/// get table rom from x coordinate
+	int getRowFromY(Cursor & cur, int y) const;
+	/// get table column from y coordinate
+	int getColumnFromX(Cursor & cur, int x) const;
 	///
 	Inset * editXY(Cursor & cur, int x, int y);
 	/// can we go further down on mouse click?

Reply via email to