Here is the patch to add a user interface to this facility. It allows
both the drawing and the erasure of both horizontal and vertical
partition lines in math matrices, straight from the math edit menu.

As this cleanly fixes a fatal useability/discoverability bug of an
already fully implemented facility, I plan on checking this in later
today, if nobody shouts.

- Martin

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.671
diff -u -r1.671 ChangeLog
--- lib/ChangeLog	8 Feb 2005 10:41:58 -0000	1.671
+++ lib/ChangeLog	8 Feb 2005 12:33:42 -0000
@@ -1,3 +1,9 @@
+2005-02-08  Martin Vermeer  <[EMAIL PROTECTED]>
+
+	* ui/stdmenus.ui: add methods horLine, rmHorLine,
+	vertLine, rmVertLine for drawing/deleting partition lines
+	in matrix
+
 2005-02-08  Mike Ressler  <[EMAIL PROTECTED]>
 
 	* layouts/aastex.layout: Updated for AASTeX 5.2
Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.468
diff -u -r1.468 ChangeLog
--- src/mathed/ChangeLog	31 Jan 2005 16:29:47 -0000	1.468
+++ src/mathed/ChangeLog	8 Feb 2005 12:33:43 -0000
@@ -1,3 +1,9 @@
+2005-02-08  Martin Vermeer  <[EMAIL PROTECTED]>
+
+	* math_gridinset.[hC]: add methods horLine, rmHorLine, 
+	vertLine, rmVertLine for drawing/deleting partition lines 
+	in matrix
+
 2005-01-31  Asger Ottar Alstrup  <[EMAIL PROTECTED]>
 
 	* math_data.C:
Index: src/mathed/math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.154
diff -u -r1.154 math_gridinset.C
--- src/mathed/math_gridinset.C	24 Nov 2004 21:58:41 -0000	1.154
+++ src/mathed/math_gridinset.C	8 Feb 2005 12:33:43 -0000
@@ -679,6 +679,46 @@
 }
 
 
+void MathGridInset::horLine(row_type row)
+{
+	if (nrows() == 1)
+		return;
+	if (row + 1 == nrows())
+		--row;
+	rowinfo_[row].lines_++;
+}
+
+
+void MathGridInset::rmHorLine(row_type row)
+{
+	if (nrows() == 1)
+		return;
+	if (row + 1 == nrows())
+		--row;
+	rowinfo_[row].lines_ = 0;
+}
+
+
+void MathGridInset::vertLine(col_type col)
+{
+        if (ncols() == 1)
+                return;
+        if (col + 1 == ncols())
+                --col;
+	colinfo_[col].lines_++;
+}       
+
+
+void MathGridInset::rmVertLine(col_type col)
+{
+        if (ncols() == 1)
+                return;
+        if (col + 1 == ncols())
+                --col;
+	colinfo_[col].lines_ = 0;
+}
+
+
 void MathGridInset::addCol(col_type newcol)
 {
 	const col_type nc = ncols();
@@ -1100,6 +1140,10 @@
 				copyRow(cur.row());
 		else if (s == "swap-row")
 			swapRow(cur.row());
+		else if (s == "hor-line")
+			horLine(cur.row());
+		else if (s == "delete-hor-line")
+			rmHorLine(cur.row());
 		else if (s == "append-column")
 			for (int i = 0, n = extractInt(is); i < n; ++i) {
 				row_type r = cur.row();
@@ -1120,6 +1164,10 @@
 			copyCol(col(cur.idx()));
 		else if (s == "swap-column")
 			swapCol(col(cur.idx()));
+		else if (s == "vert-line")
+			vertLine(col(cur.idx()));
+		else if (s == "delete-vert-line")
+			rmVertLine(col(cur.idx()));
 		else {
 			cur.undispatched();
 			break;
Index: src/mathed/math_gridinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.h,v
retrieving revision 1.85
diff -u -r1.85 math_gridinset.h
--- src/mathed/math_gridinset.h	19 Jan 2005 15:03:31 -0000	1.85
+++ src/mathed/math_gridinset.h	8 Feb 2005 12:33:43 -0000
@@ -168,6 +168,14 @@
 	///
 	virtual void swapRow(row_type r);
 	///
+	virtual void horLine(row_type r);
+	///
+	virtual void rmHorLine(row_type r);
+	///
+	virtual void vertLine(col_type c);
+	///
+	virtual void rmVertLine(col_type c);
+	///
 	virtual void addCol(col_type c);
 	///
 	virtual void delCol(col_type c);
Index: lib/ui/stdmenus.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ui/stdmenus.ui,v
retrieving revision 1.39
diff -u -r1.39 stdmenus.ui
--- lib/ui/stdmenus.ui	24 Jan 2005 17:12:14 -0000	1.39
+++ lib/ui/stdmenus.ui	8 Feb 2005 12:33:43 -0000
@@ -158,11 +158,15 @@
 		Item "Delete Row|D" "tabular-feature delete-row"
 		Item "Copy Row" "tabular-feature copy-row"
 		Item "Swap Rows" "tabular-feature swap-row"
+		Item "Add Line Above" "tabular-feature hor-line"
+		Item "Delete Line Above" "tabular-feature delete-hor-line"
 		Separator
 		Item "Add Column|C" "tabular-feature append-column"
 		Item "Delete Column|e" "tabular-feature delete-column"
 		Item "Copy Column" "tabular-feature copy-column"
 		Item "Swap Columns" "tabular-feature swap-column"
+		Item "Add Line to Left" "tabular-feature vert-line"
+		Item "Delete Line to Left" "tabular-feature delete-vert-line"
 	End
 
 	Menu "edit_math_limits"

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to