more robust lable parsing, convenience contructor for braceinset

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4597 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-07-11 07:56:14 +00:00
parent 4792af4928
commit 4f7d532832
4 changed files with 18 additions and 8 deletions

View File

@ -18,6 +18,13 @@ MathBraceInset::MathBraceInset()
{}
MathBraceInset::MathBraceInset(MathArray const & ar)
: MathNestInset(1)
{
cell(0) = ar;
}
MathInset * MathBraceInset::clone() const
{
return new MathBraceInset(*this);

View File

@ -17,6 +17,8 @@ public:
///
MathBraceInset();
///
MathBraceInset(MathArray const & ar);
///
MathInset * clone() const;
/// we write extra braces in any case...
bool extraBraces() const { return true; }

View File

@ -713,12 +713,10 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
parse_into(ar, FLAG_BRACE_LAST, mathmode);
// do not create a BraceInset if they were written by LyX
// this helps to keep the annoyance of "a choose b" to a minimum
if (ar.size() == 1 && ar[0]->extraBraces()) {
if (ar.size() == 1 && ar[0]->extraBraces())
cell->push_back(ar);
} else {
cell->push_back(MathAtom(new MathBraceInset));
cell->back()->cell(0).swap(ar);
}
else
cell->push_back(MathAtom(new MathBraceInset(ar)));
}
else if (t.cat() == catEnd) {
@ -1001,10 +999,13 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
}
else if (t.cs() == "label") {
MathArray ar;
parse_into(ar, FLAG_ITEM, false);
if (grid.asHullInset()) {
MathArray ar;
parse_into(ar, FLAG_ITEM, false);
grid.asHullInset()->label(cellrow, asString(ar));
} else {
cell->push_back(createMathInset(t.cs()));
cell->push_back(MathAtom(new MathBraceInset(ar)));
}
}

View File

@ -101,7 +101,7 @@ void MathSpaceInset::octavize(OctaveStream & os) const
void MathSpaceInset::normalize(NormalStream & os) const
{
os << "[space " << space_ << "] ";
os << "[space " << int(space_) << ' ' << latex_mathspace[space_] << "] ";
}