From: Georg Baum Date: Tue, 3 Oct 2006 07:56:27 +0000 (+0000) Subject: Missing bits of the std::string -> hullType change of InsetMathHull::type_. X-Git-Tag: 1.6.10~12479 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8fb869e7c68aeeb87d58288b07fcee180c217222;p=lyx.git Missing bits of the std::string -> hullType change of InsetMathHull::type_. Now we write again \begin{align} instead of \begin{4} to .lyx and .tex. * src/mathed/InsetMathHull.C (InsetMathHull::header_write): write type name, not type_. Use switch instead of if for better readability. (InsetMathHull::footer_write): ditto (InsetMathHull::mutate): write type name, not type_ (InsetMathHull::normalize): ditto (InsetMathHull::infoize): ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15204 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/InsetMathHull.C b/src/mathed/InsetMathHull.C index cdcaa57a23..1a3a85fe51 100644 --- a/src/mathed/InsetMathHull.C +++ b/src/mathed/InsetMathHull.C @@ -508,37 +508,46 @@ void InsetMathHull::header_write(WriteStream & os) const { bool n = numberedType(); - if (type_ == hullNone) - ; + switch(type_) { + case hullNone: + break; - else if (type_ == hullSimple) { + case hullSimple: os << '$'; if (cell(0).empty()) os << ' '; - } + break; - else if (type_ == hullEquation) { + case hullEquation: if (n) os << "\\begin{equation" << star(n) << "}\n"; else os << "\\[\n"; - } + break; - else if (type_ == hullEqnArray || type_ == hullAlign || type_ == -hullFlAlign - || type_ == hullGather || type_ == hullMultline) - os << "\\begin{" << type_ << star(n) << "}\n"; + case hullEqnArray: + case hullAlign: + case hullFlAlign: + case hullGather: + case hullMultline: + os << "\\begin{" << hullName(type_) << star(n) << "}\n"; + break; - else if (type_ == hullAlignAt || type_ == hullXAlignAt) - os << "\\begin{" << type_ << star(n) << '}' + case hullAlignAt: + case hullXAlignAt: + os << "\\begin{" << hullName(type_) << star(n) << '}' << '{' << static_cast((ncols() + 1)/2) << "}\n"; + break; - else if (type_ == hullXXAlignAt) - os << "\\begin{" << type_ << '}' + case hullXXAlignAt: + os << "\\begin{" << hullName(type_) << '}' << '{' << static_cast((ncols() + 1)/2) << "}\n"; + break; - else + default: os << "\\begin{unknown" << star(n) << '}'; + break; + } } @@ -546,29 +555,40 @@ void InsetMathHull::footer_write(WriteStream & os) const { bool n = numberedType(); - if (type_ == hullNone) + switch(type_) { + case hullNone: os << "\n"; + break; - else if (type_ == hullSimple) + case hullSimple: os << '$'; + break; - else if (type_ == hullEquation) + case hullEquation: if (n) os << "\\end{equation" << star(n) << "}\n"; else os << "\\]\n"; + break; - else if (type_ == hullEqnArray || type_ == hullAlign || type_ == -hullFlAlign - || type_ == hullAlignAt || type_ == hullXAlignAt - || type_ == hullGather || type_ == hullMultline) - os << "\\end{" << type_ << star(n) << "}\n"; + case hullEqnArray: + case hullAlign: + case hullFlAlign: + case hullAlignAt: + case hullXAlignAt: + case hullGather: + case hullMultline: + os << "\\end{" << hullName(type_) << star(n) << "}\n"; + break; - else if (type_ == hullXXAlignAt) - os << "\\end{" << type_ << "}\n"; + case hullXXAlignAt: + os << "\\end{" << hullName(type_) << "}\n"; + break; - else + default: os << "\\end{unknown" << star(n) << '}'; + break; + } } @@ -873,8 +893,9 @@ void InsetMathHull::mutate(HullType newtype) } else { - lyxerr << "mutation from '" << type_ - << "' to '" << newtype << "' not implemented" << endl; + lyxerr << "mutation from '" << hullName(type_) + << "' to '" << hullName(newtype) + << "' not implemented" << endl; } } @@ -902,7 +923,7 @@ void InsetMathHull::write(WriteStream & os) const void InsetMathHull::normalize(NormalStream & os) const { - os << "[formula " << type_ << ' '; + os << "[formula " << hullName(type_) << ' '; InsetMathGrid::normalize(os); os << "] "; } @@ -916,7 +937,7 @@ void InsetMathHull::mathmlize(MathMLStream & os) const void InsetMathHull::infoize(ostream & os) const { - os << "Type: " << type_; + os << "Type: " << hullName(type_); }