From: Georg Baum Date: Mon, 19 Mar 2007 16:08:17 +0000 (+0000) Subject: Fix bug 2932 (non-UI part only) X-Git-Tag: 1.6.10~10564 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b0cfb6c53b90b7396d586794045d901cd439ff63;p=features.git Fix bug 2932 (non-UI part only) * 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 --- diff --git a/src/mathed/InsetMathGrid.C b/src/mathed/InsetMathGrid.C index aac42634d7..98fc5fe44a 100644 --- a/src/mathed/InsetMathGrid.C +++ b/src/mathed/InsetMathGrid.C @@ -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()) { diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index f3485916a1..da7eb28e5d 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -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 diff --git a/src/mathed/MathParser.C b/src/mathed/MathParser.C index c18f9ad73d..0e75ffaaa6 100644 --- a/src/mathed/MathParser.C +++ b/src/mathed/MathParser.C @@ -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(