improve support for align and alignat

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2677 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-09-04 08:48:23 +00:00
parent 92705b7a74
commit b07b7528ff
3 changed files with 17 additions and 6 deletions

View File

@ -77,6 +77,12 @@ int firstRelOp(MathArray const & array)
}
MathMatrixInset::MathMatrixInset()
: MathGridInset(1, 1), objtype_(LM_OT_SIMPLE), nonum_(1), label_(1)
{}
MathMatrixInset::MathMatrixInset(MathInsetTypes t)
: MathGridInset(getCols(t), 1), objtype_(t), nonum_(1), label_(1)
{
@ -84,9 +90,12 @@ MathMatrixInset::MathMatrixInset(MathInsetTypes t)
}
MathMatrixInset::MathMatrixInset()
: MathGridInset(1, 1), objtype_(LM_OT_SIMPLE), nonum_(1), label_(1)
{}
MathMatrixInset::MathMatrixInset(MathInsetTypes t, int cols)
: MathGridInset(cols, 1), objtype_(t), nonum_(1), label_(1)
{
halign(getAlign(t, ncols()));
}
MathInset * MathMatrixInset::clone() const
{
@ -170,6 +179,7 @@ string MathMatrixInset::label(int row) const
return label_[row];
}
void MathMatrixInset::label(int row, string const & label)
{
label_[row] = label;

View File

@ -23,6 +23,8 @@ public:
///
explicit MathMatrixInset(MathInsetTypes t);
///
MathMatrixInset(MathInsetTypes t, int cols);
///
MathInset * clone() const;
///
void write(std::ostream &, bool fragile) const;

View File

@ -591,14 +591,13 @@ MathMatrixInset * Parser::parse_normal()
if (name == "align" || name == "align*") {
MathMatrixInset * p = new MathMatrixInset(LM_OT_ALIGN);
p->halign(getArg('{', '}'));
parse_lines(p, !stared(name), true);
return p;
}
if (name == "alignat" || name == "alignat*") {
MathMatrixInset * p = new MathMatrixInset(LM_OT_ALIGNAT);
p->halign(getArg('{', '}'));
MathMatrixInset * p =
new MathMatrixInset(LM_OT_ALIGNAT, 2 * atoi(getArg('{', '}').c_str()));
parse_lines(p, !stared(name), true);
return p;
}