]> git.lyx.org Git - features.git/commitdiff
Fix bug 2932 (non-UI part only)
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 19 Mar 2007 16:08:17 +0000 (16:08 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 19 Mar 2007 16:08:17 +0000 (16:08 +0000)
* src/mathed/InsetMathGrid.[Ch]
(InsetMathGrid::allow_pagebreak_): New member

* src/mathed/InsetMathGrid.C
(InsetMathGrid::eolString): Output \\* if allow_pagebreak_ is false

* src/mathed/MathParser.C
(addRow): Set allow_pagebreak_ in rowinfo if needed
(Parser::parse1): Parse '\\*' correctly

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17484 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathGrid.C
src/mathed/InsetMathGrid.h
src/mathed/MathParser.C

index aac42634d77c75934b84af8982620182d99a815b..98fc5fe44aa029926a0408a7f1130359b4384651 100644 (file)
@@ -113,7 +113,7 @@ InsetMathGrid::CellInfo::CellInfo()
 
 
 InsetMathGrid::RowInfo::RowInfo()
-       : lines_(0), skip_(0)
+       : lines_(0), skip_(0), allow_pagebreak_(true)
 {}
 
 
@@ -616,6 +616,8 @@ docstring InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) c
 
        if (!rowinfo_[row].crskip_.zero())
                eol += '[' + from_utf8(rowinfo_[row].crskip_.asLatexString()) + ']';
+       else if(!rowinfo_[row].allow_pagebreak_)
+               eol += '*';
 
        // make sure an upcoming '[' does not break anything
        if (row + 1 < nrows()) {
index f3485916a1f04d5969eeb8dfeec6c97d4e2ce256..da7eb28e5da61e2c99267b52351897f7484db8c2 100644 (file)
@@ -62,6 +62,8 @@ public:
                LyXLength crskip_;
                /// extra distance between lines
                int skip_;
+               /// Is a page break allowed after this row?
+               bool allow_pagebreak_;
        };
 
        // additional per-row information
index c18f9ad73dd39c5ca7111a64f3d748dfd3e50139..0e75ffaaa64ff02b4cce170b8f0ee77a8accea04 100644 (file)
@@ -111,7 +111,7 @@ bool stared(docstring const & s)
  * environments like "equation" that have a fixed number of rows.
  */
 bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
-           docstring const & vskip)
+           docstring const & vskip, bool allow_pagebreak = true)
 {
        ++cellrow;
        if (cellrow == grid.nrows()) {
@@ -128,11 +128,14 @@ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
                        lyxerr << "ignoring extra row";
                        if (!vskip.empty())
                                lyxerr << " with extra space " << to_utf8(vskip);
+                       if (!allow_pagebreak)
+                               lyxerr << " with no page break allowed";
                        lyxerr << '.' << endl;
                        return false;
                }
        }
        grid.vcrskip(LyXLength(to_utf8(vskip)), cellrow - 1);
+       grid.rowinfo(cellrow - 1).allow_pagebreak_ = allow_pagebreak;
        return true;
 }
 
@@ -1013,7 +1016,13 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                else if (t.cs() == "\\") {
                        if (flags & FLAG_ALIGN)
                                return;
-                       if (addRow(grid, cellrow, getArg('[', ']'))) {
+                       bool added;
+                       if (nextToken().asInput() == "*") {
+                               getToken();
+                               added = addRow(grid, cellrow, docstring(), false);
+                       } else
+                               added = addRow(grid, cellrow, getArg('[', ']'));
+                       if (added) {
                                cellcol = 0;
                                if (grid.asHullInset())
                                        grid.asHullInset()->numbered(