On Tue, 2005-02-08 at 19:25 +0100, Georg Baum wrote: > Martin Vermeer wrote: > > > +void MathGridInset::horLine(row_type row) > > +{ > > + if (nrows() == 1) > > + return; > > + if (row + 1 == nrows()) > > + --row; > > + rowinfo_[row].lines_++; > > +} > > I don't understand this. I understand that this method adds a line above the > row. I would think that it should look like > > void MathGridInset::addHLineAbove(row_type row) > { > if (row == 0) > // Only if we don't want a line above the first row; > return; > if (row >= nrows()) > return; > rowinfo_[row].lines_++; > } > > IMO it should simply return if the line cannot be added.
You're even righter than you think: these conditions are not needed when you think about it, so I just removed all of them. > Another question: What about lines above the first row and below the last? I > believe that this is possible in LaTeX, but how to support it here? I can't > think of a better way than having an addHLineBelow() etc. No, neither can I. But as there is no support for this in the current mathed infrastructure, implementing this would go much further than just fixing a broken UI. For 1.5? > And getStatus needs to be updated to disable addHLineAbove if the cursor is > in the first row. How? If I look at getStatus for math_gridinset, I see a lot of stuff commented out. Is this supposed to work at all, and how? > Of course the same things should be done for the other h- and vline methods. > > > @@ -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()); > > I would prefer add-hline-above, delete-hline-above etc. Yes, good proposal. > Georg New patch attached.
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 20:03:36 -0000 @@ -1,3 +1,9 @@ +2005-02-08 Martin Vermeer <[EMAIL PROTECTED]> + + * ui/stdmenus.ui: add methods addHLineAbove, deleteHLineAbove, + addVLineLeft, deleteVLineLeft 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 20:03:37 -0000 @@ -1,3 +1,9 @@ +2005-02-08 Martin Vermeer <[EMAIL PROTECTED]> + + * math_gridinset.[hC]: add methods addHLineAbove, deleteHLineAbove, + addVLineLeft, deleteVLineLeft 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 20:03:37 -0000 @@ -679,6 +679,30 @@ } +void MathGridInset::addHLineAbove(row_type row) +{ + rowinfo_[row].lines_++; +} + + +void MathGridInset::deleteHLineAbove(row_type row) +{ + rowinfo_[row].lines_ = 0; +} + + +void MathGridInset::addVLineLeft(col_type col) +{ + colinfo_[col].lines_++; +} + + +void MathGridInset::deleteVLineLeft(col_type col) +{ + colinfo_[col].lines_ = 0; +} + + void MathGridInset::addCol(col_type newcol) { const col_type nc = ncols(); @@ -1100,6 +1124,10 @@ copyRow(cur.row()); else if (s == "swap-row") swapRow(cur.row()); + else if (s == "add-hline-above") + addHLineAbove(cur.row()); + else if (s == "delete-hline-above") + deleteHLineAbove(cur.row()); else if (s == "append-column") for (int i = 0, n = extractInt(is); i < n; ++i) { row_type r = cur.row(); @@ -1120,6 +1148,10 @@ copyCol(col(cur.idx())); else if (s == "swap-column") swapCol(col(cur.idx())); + else if (s == "add-vline-left") + addVLineLeft(col(cur.idx())); + else if (s == "delete-vline-left") + deleteVLineLeft(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 20:03:37 -0000 @@ -168,6 +168,14 @@ /// virtual void swapRow(row_type r); /// + virtual void addHLineAbove(row_type r); + /// + virtual void deleteHLineAbove(row_type r); + /// + virtual void addVLineLeft(col_type c); + /// + virtual void deleteVLineLeft(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 20:03:37 -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 add-hline-above" + Item "Delete Line Above" "tabular-feature delete-hline-above" 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 add-vline-left" + Item "Delete Line to Left" "tabular-feature delete-vline-left" End Menu "edit_math_limits"
signature.asc
Description: This is a digitally signed message part