remove "remove seemingly unneeded {} hack"

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4501 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-06-28 09:40:40 +00:00
parent 79ca6fbe6d
commit c3a3e12319
6 changed files with 11 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2002-06-24 André Pönitz <poenitz@gmx.net>
* math_parser.C: remove "remove seemingly unneeded {} hack"
2002-06-26 Angus Leeming <leeming@lyx.org> 2002-06-26 Angus Leeming <leeming@lyx.org>
* formula.C: use lyxerr, not cerr. * formula.C: use lyxerr, not cerr.

View File

@ -40,8 +40,6 @@ public:
bool isRelOp() const; bool isRelOp() const;
/// ///
bool match(MathInset *) const; bool match(MathInset *) const;
/// identifies complicated things that need braces if used as arg
bool needsBraces() const { return false; }
private: private:
/// the character /// the character

View File

@ -224,8 +224,6 @@ public:
virtual char getChar() const { return 0; } virtual char getChar() const { return 0; }
/// identifies things that can get \limits or \nolimits /// identifies things that can get \limits or \nolimits
virtual bool takesLimits() const { return false; } virtual bool takesLimits() const { return false; }
/// identifies complicated things that need braces if used as arg
virtual bool needsBraces() const { return true; }
/// ///
virtual void edit(BufferView *, int, int, mouse_button::state) {} virtual void edit(BufferView *, int, int, mouse_button::state) {}

View File

@ -595,10 +595,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, bool mathmode)
parse_into1(grid, flags, mathmode, false); parse_into1(grid, flags, mathmode, false);
array = grid.cell(0); array = grid.cell(0);
// remove 'unnecessary' braces: // remove 'unnecessary' braces:
if (array.size() == 1 && array.back()->asBraceInset()) { //if (array.size() == 1 && array.back()->asBraceInset()) {
lyxerr << "extra braces removed\n"; // lyxerr << "extra braces removed\n";
array = array.back()->asBraceInset()->cell(0); // array = array.back()->asBraceInset()->cell(0);
} //}
} }
@ -693,20 +693,8 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
else if (t.cat() == catBegin) { else if (t.cat() == catBegin) {
MathArray ar; MathArray ar;
parse_into(ar, FLAG_BRACE_LAST, mathmode); parse_into(ar, FLAG_BRACE_LAST, mathmode);
#ifndef WITH_WARNINGS cell->push_back(MathAtom(new MathBraceInset));
#warning this might be wrong in general! cell->back()->cell(0).swap(ar);
#endif
// ignore braces around simple items
if ((ar.size() == 1 && !ar.front()->needsBraces()
|| (ar.size() == 2 && !ar.front()->needsBraces()
&& ar.back()->asScriptInset()))
|| (ar.size() == 0 && cell->size() == 0))
{
cell->push_back(ar);
} else {
cell->push_back(MathAtom(new MathBraceInset));
cell->back()->cell(0).swap(ar);
}
} }
else if (t.cat() == catEnd) { else if (t.cat() == catEnd) {

View File

@ -24,8 +24,6 @@ public:
void metrics(MathMetricsInfo & st) const; void metrics(MathMetricsInfo & st) const;
/// ///
void draw(MathPainterInfo &, int x, int y) const; void draw(MathPainterInfo &, int x, int y) const;
///
bool needsBraces() const { return false; }
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;

View File

@ -37,8 +37,6 @@ public:
bool match(MathInset *) const; bool match(MathInset *) const;
/// request "external features" /// request "external features"
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// identifies complicated things that need braces if used as arg
bool needsBraces() const { return false; }
/// ///
void normalize(NormalStream &) const; void normalize(NormalStream &) const;