mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
use enums instead of strings to distinguish different types of math hull
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14882 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a6e0f26fe2
commit
3663e1161a
@ -74,21 +74,20 @@ using std::vector;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int getCols(string const & type)
|
int getCols(HullType type)
|
||||||
{
|
{
|
||||||
if (type == "eqnarray")
|
switch (type) {
|
||||||
return 3;
|
case hullEqnArray:
|
||||||
if (type == "align")
|
return 3;
|
||||||
return 2;
|
case hullAlign:
|
||||||
if (type == "flalign")
|
case hullFlAlign:
|
||||||
return 2;
|
case hullAlignAt:
|
||||||
if (type == "alignat")
|
case hullXAlignAt:
|
||||||
return 2;
|
case hullXXAlignAt:
|
||||||
if (type == "xalignat")
|
return 2;
|
||||||
return 2;
|
default:
|
||||||
if (type == "xxalignat")
|
return 1;
|
||||||
return 2;
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,35 +108,50 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int typecode(string const & s)
|
|
||||||
{
|
|
||||||
if (s == "none") return 0;
|
|
||||||
if (s == "simple") return 1;
|
|
||||||
if (s == "equation") return 2;
|
|
||||||
if (s == "eqnarray") return 3;
|
|
||||||
if (s == "align") return 4;
|
|
||||||
if (s == "alignat") return 5;
|
|
||||||
if (s == "xalignat") return 6;
|
|
||||||
if (s == "xxalignat") return 7;
|
|
||||||
if (s == "multline") return 8;
|
|
||||||
if (s == "gather") return 9;
|
|
||||||
if (s == "flalign") return 10;
|
|
||||||
lyxerr << "unknown hull type '" << s << "'" << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool smaller(string const & s, string const & t)
|
|
||||||
{
|
|
||||||
return typecode(s) < typecode(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end anon namespace
|
} // end anon namespace
|
||||||
|
|
||||||
|
|
||||||
|
HullType hullType(std::string const & s)
|
||||||
|
{
|
||||||
|
if (s == "none") return hullNone;
|
||||||
|
if (s == "simple") return hullSimple;
|
||||||
|
if (s == "equation") return hullEquation;
|
||||||
|
if (s == "eqnarray") return hullEqnArray;
|
||||||
|
if (s == "align") return hullAlign;
|
||||||
|
if (s == "alignat") return hullAlignAt;
|
||||||
|
if (s == "xalignat") return hullXAlignAt;
|
||||||
|
if (s == "xxalignat") return hullXXAlignAt;
|
||||||
|
if (s == "multline") return hullMultline;
|
||||||
|
if (s == "gather") return hullGather;
|
||||||
|
if (s == "flalign") return hullFlAlign;
|
||||||
|
lyxerr << "unknown hull type '" << s << "'" << endl;
|
||||||
|
return HullType(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string hullName(HullType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case hullNone: return "none";
|
||||||
|
case hullSimple: return "simple";
|
||||||
|
case hullEquation: return "equation";
|
||||||
|
case hullEqnArray: return "eqnarray";
|
||||||
|
case hullAlign: return "align";
|
||||||
|
case hullAlignAt: return "alignat";
|
||||||
|
case hullXAlignAt: return "xalignat";
|
||||||
|
case hullXXAlignAt: return "xxalignat";
|
||||||
|
case hullMultline: return "multline";
|
||||||
|
case hullGather: return "gather";
|
||||||
|
case hullFlAlign: return "flalign";
|
||||||
|
default:
|
||||||
|
lyxerr << "unknown hull type '" << type << "'" << endl;
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MathHullInset::MathHullInset()
|
MathHullInset::MathHullInset()
|
||||||
: MathGridInset(1, 1), type_("none"), nonum_(1), label_(1),
|
: MathGridInset(1, 1), type_(hullNone), nonum_(1), label_(1),
|
||||||
preview_(new RenderPreview(this))
|
preview_(new RenderPreview(this))
|
||||||
{
|
{
|
||||||
//lyxerr << "sizeof MathInset: " << sizeof(MathInset) << endl;
|
//lyxerr << "sizeof MathInset: " << sizeof(MathInset) << endl;
|
||||||
@ -149,7 +163,7 @@ MathHullInset::MathHullInset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathHullInset::MathHullInset(string const & type)
|
MathHullInset::MathHullInset(HullType type)
|
||||||
: MathGridInset(getCols(type), 1), type_(type), nonum_(1), label_(1),
|
: MathGridInset(getCols(type), 1), type_(type), nonum_(1), label_(1),
|
||||||
preview_(new RenderPreview(this))
|
preview_(new RenderPreview(this))
|
||||||
{
|
{
|
||||||
@ -201,7 +215,7 @@ InsetBase * MathHullInset::editXY(LCursor & cur, int x, int y)
|
|||||||
|
|
||||||
MathInset::mode_type MathHullInset::currentMode() const
|
MathInset::mode_type MathHullInset::currentMode() const
|
||||||
{
|
{
|
||||||
if (type_ == "none")
|
if (type_ == hullNone)
|
||||||
return UNDECIDED_MODE;
|
return UNDECIDED_MODE;
|
||||||
// definitely math mode ...
|
// definitely math mode ...
|
||||||
return MATH_MODE;
|
return MATH_MODE;
|
||||||
@ -226,9 +240,9 @@ bool MathHullInset::idxLast(LCursor & cur) const
|
|||||||
|
|
||||||
char MathHullInset::defaultColAlign(col_type col)
|
char MathHullInset::defaultColAlign(col_type col)
|
||||||
{
|
{
|
||||||
if (type_ == "eqnarray")
|
if (type_ == hullEqnArray)
|
||||||
return "rcl"[col];
|
return "rcl"[col];
|
||||||
if (typecode(type_) >= typecode("align"))
|
if (type_ >= hullAlign)
|
||||||
return "rl"[col & 1];
|
return "rl"[col & 1];
|
||||||
return 'c';
|
return 'c';
|
||||||
}
|
}
|
||||||
@ -236,11 +250,11 @@ char MathHullInset::defaultColAlign(col_type col)
|
|||||||
|
|
||||||
int MathHullInset::defaultColSpace(col_type col)
|
int MathHullInset::defaultColSpace(col_type col)
|
||||||
{
|
{
|
||||||
if (type_ == "align" || type_ == "alignat")
|
if (type_ == hullAlign || type_ == hullAlignAt)
|
||||||
return 0;
|
return 0;
|
||||||
if (type_ == "xalignat")
|
if (type_ == hullXAlignAt)
|
||||||
return (col & 1) ? 20 : 0;
|
return (col & 1) ? 20 : 0;
|
||||||
if (type_ == "xxalignat" || type_ == "flalign")
|
if (type_ == hullXXAlignAt || type_ == hullFlAlign)
|
||||||
return (col & 1) ? 40 : 0;
|
return (col & 1) ? 40 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -248,7 +262,7 @@ int MathHullInset::defaultColSpace(col_type col)
|
|||||||
|
|
||||||
char const * MathHullInset::standardFont() const
|
char const * MathHullInset::standardFont() const
|
||||||
{
|
{
|
||||||
return type_ == "none" ? "lyxnochange" : "mathnormal";
|
return type_ == hullNone ? "lyxnochange" : "mathnormal";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -427,19 +441,19 @@ bool MathHullInset::numbered(row_type row) const
|
|||||||
bool MathHullInset::ams() const
|
bool MathHullInset::ams() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
type_ == "align" ||
|
type_ == hullAlign ||
|
||||||
type_ == "flalign" ||
|
type_ == hullFlAlign ||
|
||||||
type_ == "multline" ||
|
type_ == hullMultline ||
|
||||||
type_ == "gather" ||
|
type_ == hullGather ||
|
||||||
type_ == "alignat" ||
|
type_ == hullAlignAt ||
|
||||||
type_ == "xalignat" ||
|
type_ == hullXAlignAt ||
|
||||||
type_ == "xxalignat";
|
type_ == hullXXAlignAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathHullInset::display() const
|
bool MathHullInset::display() const
|
||||||
{
|
{
|
||||||
return type_ != "simple" && type_ != "none";
|
return type_ != hullSimple && type_ != hullNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -453,11 +467,11 @@ void MathHullInset::getLabelList(Buffer const &, vector<string> & labels) const
|
|||||||
|
|
||||||
bool MathHullInset::numberedType() const
|
bool MathHullInset::numberedType() const
|
||||||
{
|
{
|
||||||
if (type_ == "none")
|
if (type_ == hullNone)
|
||||||
return false;
|
return false;
|
||||||
if (type_ == "simple")
|
if (type_ == hullSimple)
|
||||||
return false;
|
return false;
|
||||||
if (type_ == "xxalignat")
|
if (type_ == hullXXAlignAt)
|
||||||
return false;
|
return false;
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
if (!nonum_[row])
|
if (!nonum_[row])
|
||||||
@ -488,31 +502,32 @@ void MathHullInset::header_write(WriteStream & os) const
|
|||||||
{
|
{
|
||||||
bool n = numberedType();
|
bool n = numberedType();
|
||||||
|
|
||||||
if (type_ == "none")
|
if (type_ == hullNone)
|
||||||
;
|
;
|
||||||
|
|
||||||
else if (type_ == "simple") {
|
else if (type_ == hullSimple) {
|
||||||
os << '$';
|
os << '$';
|
||||||
if (cell(0).empty())
|
if (cell(0).empty())
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "equation") {
|
else if (type_ == hullEquation) {
|
||||||
if (n)
|
if (n)
|
||||||
os << "\\begin{equation" << star(n) << "}\n";
|
os << "\\begin{equation" << star(n) << "}\n";
|
||||||
else
|
else
|
||||||
os << "\\[\n";
|
os << "\\[\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
|
else if (type_ == hullEqnArray || type_ == hullAlign || type_ ==
|
||||||
|| type_ == "gather" || type_ == "multline")
|
hullFlAlign
|
||||||
|
|| type_ == hullGather || type_ == hullMultline)
|
||||||
os << "\\begin{" << type_ << star(n) << "}\n";
|
os << "\\begin{" << type_ << star(n) << "}\n";
|
||||||
|
|
||||||
else if (type_ == "alignat" || type_ == "xalignat")
|
else if (type_ == hullAlignAt || type_ == hullXAlignAt)
|
||||||
os << "\\begin{" << type_ << star(n) << '}'
|
os << "\\begin{" << type_ << star(n) << '}'
|
||||||
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
|
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
|
||||||
|
|
||||||
else if (type_ == "xxalignat")
|
else if (type_ == hullXXAlignAt)
|
||||||
os << "\\begin{" << type_ << '}'
|
os << "\\begin{" << type_ << '}'
|
||||||
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
|
<< '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
|
||||||
|
|
||||||
@ -525,24 +540,25 @@ void MathHullInset::footer_write(WriteStream & os) const
|
|||||||
{
|
{
|
||||||
bool n = numberedType();
|
bool n = numberedType();
|
||||||
|
|
||||||
if (type_ == "none")
|
if (type_ == hullNone)
|
||||||
os << "\n";
|
os << "\n";
|
||||||
|
|
||||||
else if (type_ == "simple")
|
else if (type_ == hullSimple)
|
||||||
os << '$';
|
os << '$';
|
||||||
|
|
||||||
else if (type_ == "equation")
|
else if (type_ == hullEquation)
|
||||||
if (n)
|
if (n)
|
||||||
os << "\\end{equation" << star(n) << "}\n";
|
os << "\\end{equation" << star(n) << "}\n";
|
||||||
else
|
else
|
||||||
os << "\\]\n";
|
os << "\\]\n";
|
||||||
|
|
||||||
else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
|
else if (type_ == hullEqnArray || type_ == hullAlign || type_ ==
|
||||||
|| type_ == "alignat" || type_ == "xalignat"
|
hullFlAlign
|
||||||
|| type_ == "gather" || type_ == "multline")
|
|| type_ == hullAlignAt || type_ == hullXAlignAt
|
||||||
|
|| type_ == hullGather || type_ == hullMultline)
|
||||||
os << "\\end{" << type_ << star(n) << "}\n";
|
os << "\\end{" << type_ << star(n) << "}\n";
|
||||||
|
|
||||||
else if (type_ == "xxalignat")
|
else if (type_ == hullXXAlignAt)
|
||||||
os << "\\end{" << type_ << "}\n";
|
os << "\\end{" << type_ << "}\n";
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -553,18 +569,18 @@ void MathHullInset::footer_write(WriteStream & os) const
|
|||||||
bool MathHullInset::rowChangeOK() const
|
bool MathHullInset::rowChangeOK() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
type_ == "eqnarray" || type_ == "align" ||
|
type_ == hullEqnArray || type_ == hullAlign ||
|
||||||
type_ == "flalign" || type_ == "alignat" ||
|
type_ == hullFlAlign || type_ == hullAlignAt ||
|
||||||
type_ == "xalignat" || type_ == "xxalignat" ||
|
type_ == hullXAlignAt || type_ == hullXXAlignAt ||
|
||||||
type_ == "gather" || type_ == "multline";
|
type_ == hullGather || type_ == hullMultline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathHullInset::colChangeOK() const
|
bool MathHullInset::colChangeOK() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
type_ == "align" || type_ == "flalign" ||type_ == "alignat" ||
|
type_ == hullAlign || type_ == hullFlAlign ||type_ == hullAlignAt ||
|
||||||
type_ == "xalignat" || type_ == "xxalignat";
|
type_ == hullXAlignAt || type_ == hullXXAlignAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -635,7 +651,7 @@ void MathHullInset::glueall()
|
|||||||
MathArray ar;
|
MathArray ar;
|
||||||
for (idx_type i = 0; i < nargs(); ++i)
|
for (idx_type i = 0; i < nargs(); ++i)
|
||||||
ar.append(cell(i));
|
ar.append(cell(i));
|
||||||
*this = MathHullInset("simple");
|
*this = MathHullInset(hullSimple);
|
||||||
cell(0) = ar;
|
cell(0) = ar;
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
@ -700,21 +716,20 @@ void MathHullInset::changeCols(col_type cols)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const & MathHullInset::getType() const
|
HullType MathHullInset::getType() const
|
||||||
{
|
{
|
||||||
return type_;
|
return type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathHullInset::setType(string const & type)
|
void MathHullInset::setType(HullType type)
|
||||||
{
|
{
|
||||||
type_ = type;
|
type_ = type;
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MathHullInset::mutate(HullType newtype)
|
||||||
void MathHullInset::mutate(string const & newtype)
|
|
||||||
{
|
{
|
||||||
//lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
|
//lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
|
||||||
|
|
||||||
@ -726,56 +741,53 @@ void MathHullInset::mutate(string const & newtype)
|
|||||||
// directly supported because it handles labels and numbering for
|
// directly supported because it handles labels and numbering for
|
||||||
// "down mutation".
|
// "down mutation".
|
||||||
|
|
||||||
if (newtype == "dump") {
|
if (newtype == type_) {
|
||||||
dump();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (newtype == type_) {
|
|
||||||
// done
|
// done
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (typecode(newtype) < 0) {
|
else if (newtype < hullNone) {
|
||||||
// unknown type
|
// unknown type
|
||||||
|
dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "none") {
|
else if (type_ == hullNone) {
|
||||||
setType("simple");
|
setType(hullSimple);
|
||||||
numbered(0, false);
|
numbered(0, false);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "simple") {
|
else if (type_ == hullSimple) {
|
||||||
if (newtype == "none") {
|
if (newtype == hullNone) {
|
||||||
setType("none");
|
setType(hullNone);
|
||||||
numbered(0, false);
|
numbered(0, false);
|
||||||
} else {
|
} else {
|
||||||
setType("equation");
|
setType(hullEquation);
|
||||||
numbered(0, false);
|
numbered(0, false);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "equation") {
|
else if (type_ == hullEquation) {
|
||||||
if (smaller(newtype, type_)) {
|
if (newtype < type_) {
|
||||||
setType("simple");
|
setType(hullSimple);
|
||||||
numbered(0, false);
|
numbered(0, false);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
} else if (newtype == "eqnarray") {
|
} else if (newtype == hullEqnArray) {
|
||||||
// split it "nicely" on the first relop
|
// split it "nicely" on the first relop
|
||||||
splitTo3Cols();
|
splitTo3Cols();
|
||||||
setType("eqnarray");
|
setType(hullEqnArray);
|
||||||
} else if (newtype == "multline" || newtype == "gather") {
|
} else if (newtype == hullMultline || newtype == hullGather) {
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
} else {
|
} else {
|
||||||
// split it "nicely"
|
// split it "nicely"
|
||||||
splitTo2Cols();
|
splitTo2Cols();
|
||||||
setType("align");
|
setType(hullAlign);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "eqnarray") {
|
else if (type_ == hullEqnArray) {
|
||||||
if (smaller(newtype, type_)) {
|
if (newtype < type_) {
|
||||||
// set correct (no)numbering
|
// set correct (no)numbering
|
||||||
bool allnonum = true;
|
bool allnonum = true;
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
@ -797,21 +809,21 @@ void MathHullInset::mutate(string const & newtype)
|
|||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
} else { // align & Co.
|
} else { // align & Co.
|
||||||
changeCols(2);
|
changeCols(2);
|
||||||
setType("align");
|
setType(hullAlign);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "align" || type_ == "alignat" ||
|
else if (type_ == hullAlign || type_ == hullAlignAt ||
|
||||||
type_ == "xalignat" || type_ == "flalign") {
|
type_ == hullXAlignAt || type_ == hullFlAlign) {
|
||||||
if (smaller(newtype, "align")) {
|
if (newtype < hullAlign) {
|
||||||
changeCols(3);
|
changeCols(3);
|
||||||
setType("eqnarray");
|
setType(hullEqnArray);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
} else if (newtype == "gather" || newtype == "multline") {
|
} else if (newtype == hullGather || newtype == hullMultline) {
|
||||||
changeCols(1);
|
changeCols(1);
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
} else if (newtype == "xxalignat") {
|
} else if (newtype == hullXXAlignAt) {
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
numbered(row, false);
|
numbered(row, false);
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
@ -820,14 +832,14 @@ void MathHullInset::mutate(string const & newtype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "xxalignat") {
|
else if (type_ == hullXXAlignAt) {
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
numbered(row, false);
|
numbered(row, false);
|
||||||
if (smaller(newtype, "align")) {
|
if (newtype < hullAlign) {
|
||||||
changeCols(3);
|
changeCols(3);
|
||||||
setType("eqnarray");
|
setType(hullEqnArray);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
} else if (newtype == "gather" || newtype == "multline") {
|
} else if (newtype == hullGather || newtype == hullMultline) {
|
||||||
changeCols(1);
|
changeCols(1);
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
} else {
|
} else {
|
||||||
@ -835,21 +847,21 @@ void MathHullInset::mutate(string const & newtype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type_ == "multline" || type_ == "gather") {
|
else if (type_ == hullMultline || type_ == hullGather) {
|
||||||
if (newtype == "gather" || newtype == "multline")
|
if (newtype == hullGather || newtype == hullMultline)
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
else if (newtype == "align" || newtype == "flalign" ||
|
else if (newtype == hullAlign || newtype == hullFlAlign ||
|
||||||
newtype == "alignat" || newtype == "xalignat") {
|
newtype == hullAlignAt || newtype == hullXAlignAt) {
|
||||||
splitTo2Cols();
|
splitTo2Cols();
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
} else if (newtype == "xxalignat") {
|
} else if (newtype == hullXXAlignAt) {
|
||||||
splitTo2Cols();
|
splitTo2Cols();
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
numbered(row, false);
|
numbered(row, false);
|
||||||
setType(newtype);
|
setType(newtype);
|
||||||
} else {
|
} else {
|
||||||
splitTo3Cols();
|
splitTo3Cols();
|
||||||
setType("eqnarray");
|
setType(hullEqnArray);
|
||||||
mutate(newtype);
|
mutate(newtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -867,7 +879,7 @@ string MathHullInset::eolString(row_type row, bool emptyline, bool fragile) cons
|
|||||||
if (numberedType()) {
|
if (numberedType()) {
|
||||||
if (!label_[row].empty() && !nonum_[row])
|
if (!label_[row].empty() && !nonum_[row])
|
||||||
res += "\\label{" + label_[row] + '}';
|
res += "\\label{" + label_[row] + '}';
|
||||||
if (nonum_[row] && (type_ != "multline"))
|
if (nonum_[row] && (type_ != hullMultline))
|
||||||
res += "\\nonumber ";
|
res += "\\nonumber ";
|
||||||
}
|
}
|
||||||
return res + MathGridInset::eolString(row, emptyline, fragile);
|
return res + MathGridInset::eolString(row, emptyline, fragile);
|
||||||
@ -936,7 +948,7 @@ void MathHullInset::doExtern(LCursor & cur, FuncRequest & func)
|
|||||||
cur.idx() -= cur.idx() % ncols();
|
cur.idx() -= cur.idx() % ncols();
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
|
|
||||||
if (getType() == "simple") {
|
if (getType() == hullSimple) {
|
||||||
size_type pos = cur.cell().find_last(eq);
|
size_type pos = cur.cell().find_last(eq);
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
if (cur.inMathed() && cur.selection()) {
|
if (cur.inMathed() && cur.selection()) {
|
||||||
@ -954,9 +966,9 @@ void MathHullInset::doExtern(LCursor & cur, FuncRequest & func)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getType() == "equation") {
|
if (getType() == hullEquation) {
|
||||||
lyxerr << "use equation inset" << endl;
|
lyxerr << "use equation inset" << endl;
|
||||||
mutate("eqnarray");
|
mutate(hullEqnArray);
|
||||||
MathArray & ar = cur.cell();
|
MathArray & ar = cur.cell();
|
||||||
lyxerr << "use cell: " << ar << endl;
|
lyxerr << "use cell: " << ar << endl;
|
||||||
++cur.idx();
|
++cur.idx();
|
||||||
@ -1009,11 +1021,11 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_BREAK_LINE:
|
case LFUN_BREAK_LINE:
|
||||||
// some magic for the common case
|
// some magic for the common case
|
||||||
if (type_ == "simple" || type_ == "equation") {
|
if (type_ == hullSimple || type_ == hullEquation) {
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
bool const align =
|
bool const align =
|
||||||
cur.bv().buffer()->params().use_amsmath == BufferParams::AMS_ON;
|
cur.bv().buffer()->params().use_amsmath == BufferParams::AMS_ON;
|
||||||
mutate(align ? "align" : "eqnarray");
|
mutate(align ? hullAlign : hullEqnArray);
|
||||||
cur.idx() = 0;
|
cur.idx() = 0;
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
}
|
}
|
||||||
@ -1025,7 +1037,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (display()) {
|
if (display()) {
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
bool old = numberedType();
|
bool old = numberedType();
|
||||||
if (type_ == "multline")
|
if (type_ == hullMultline)
|
||||||
numbered(nrows() - 1, !old);
|
numbered(nrows() - 1, !old);
|
||||||
else
|
else
|
||||||
for (row_type row = 0; row < nrows(); ++row)
|
for (row_type row = 0; row < nrows(); ++row)
|
||||||
@ -1037,7 +1049,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_MATH_NONUMBER:
|
case LFUN_MATH_NONUMBER:
|
||||||
if (display()) {
|
if (display()) {
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
row_type r = (type_ == "multline") ? nrows() - 1 : cur.row();
|
row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
||||||
bool old = numbered(r);
|
bool old = numbered(r);
|
||||||
cur.message(old ? _("No number") : _("Number"));
|
cur.message(old ? _("No number") : _("Number"));
|
||||||
numbered(r, !old);
|
numbered(r, !old);
|
||||||
@ -1046,7 +1058,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_LABEL_INSERT: {
|
case LFUN_LABEL_INSERT: {
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
row_type r = (type_ == "multline") ? nrows() - 1 : cur.row();
|
row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
||||||
string old_label = label(r);
|
string old_label = label(r);
|
||||||
string const default_label =
|
string const default_label =
|
||||||
(lyxrc.label_init_length >= 0) ? "eq:" : "";
|
(lyxrc.label_init_length >= 0) ? "eq:" : "";
|
||||||
@ -1075,7 +1087,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), p);
|
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), p);
|
||||||
string str = p.getContents();
|
string str = p.getContents();
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
row_type const r = (type_ == "multline") ? nrows() - 1 : cur.row();
|
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
||||||
str = lyx::support::trim(str);
|
str = lyx::support::trim(str);
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
numbered(r, true);
|
numbered(r, true);
|
||||||
@ -1104,7 +1116,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
row_type row = cur.row();
|
row_type row = cur.row();
|
||||||
col_type col = cur.col();
|
col_type col = cur.col();
|
||||||
mutate(lyx::to_utf8(cmd.argument()));
|
mutate(hullType(lyx::to_utf8(cmd.argument())));
|
||||||
cur.idx() = row * ncols() + col;
|
cur.idx() = row * ncols() + col;
|
||||||
if (cur.idx() > cur.lastidx()) {
|
if (cur.idx() > cur.lastidx()) {
|
||||||
cur.idx() = cur.lastidx();
|
cur.idx() = cur.lastidx();
|
||||||
@ -1118,7 +1130,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_MATH_DISPLAY: {
|
case LFUN_MATH_DISPLAY: {
|
||||||
recordUndoInset(cur);
|
recordUndoInset(cur);
|
||||||
mutate(type_ == "simple" ? "equation" : "simple");
|
mutate(type_ == hullSimple ? hullEquation : hullSimple);
|
||||||
cur.idx() = 0;
|
cur.idx() = 0;
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
//cur.dispatched(FINISHED);
|
//cur.dispatched(FINISHED);
|
||||||
@ -1152,7 +1164,7 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
status.enabled(true);
|
status.enabled(true);
|
||||||
return true;
|
return true;
|
||||||
case LFUN_LABEL_INSERT:
|
case LFUN_LABEL_INSERT:
|
||||||
status.enabled(type_ != "simple");
|
status.enabled(type_ != hullSimple);
|
||||||
return true;
|
return true;
|
||||||
case LFUN_INSET_INSERT: {
|
case LFUN_INSET_INSERT: {
|
||||||
// Don't test createMathInset_fromDialogStr(), since
|
// Don't test createMathInset_fromDialogStr(), since
|
||||||
@ -1160,7 +1172,7 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
// dialog would not be applyable.
|
// dialog would not be applyable.
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
status.enabled(name == "ref" ||
|
status.enabled(name == "ref" ||
|
||||||
(name == "label" && type_ != "simple"));
|
(name == "label" && type_ != hullSimple));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LFUN_TABULAR_FEATURE: {
|
case LFUN_TABULAR_FEATURE: {
|
||||||
@ -1173,7 +1185,7 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
|| s == "copy-row")) {
|
|| s == "copy-row")) {
|
||||||
status.message(bformat(
|
status.message(bformat(
|
||||||
N_("Can't change number of rows in '%1$s'"),
|
N_("Can't change number of rows in '%1$s'"),
|
||||||
type_));
|
hullName(type_)));
|
||||||
status.enabled(false);
|
status.enabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1183,24 +1195,24 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
|| s == "copy-column")) {
|
|| s == "copy-column")) {
|
||||||
status.message(bformat(
|
status.message(bformat(
|
||||||
N_("Can't change number of columns in '%1$s'"),
|
N_("Can't change number of columns in '%1$s'"),
|
||||||
type_));
|
hullName(type_)));
|
||||||
status.enabled(false);
|
status.enabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((type_ == "simple"
|
if ((type_ == hullSimple
|
||||||
|| type_ == "equation"
|
|| type_ == hullEquation
|
||||||
|| type_ == "none") &&
|
|| type_ == hullNone) &&
|
||||||
(s == "add-hline-above" || s == "add-hline-below")) {
|
(s == "add-hline-above" || s == "add-hline-below")) {
|
||||||
status.message(bformat(
|
status.message(bformat(
|
||||||
N_("Can't add horizontal grid lines in '%1$s'"),
|
N_("Can't add horizontal grid lines in '%1$s'"),
|
||||||
type_));
|
hullName(type_)));
|
||||||
status.enabled(false);
|
status.enabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||||
status.message(bformat(
|
status.message(bformat(
|
||||||
N_("Can't add vertical grid lines in '%1$s'"),
|
N_("Can't add vertical grid lines in '%1$s'"),
|
||||||
type_));
|
hullName(type_)));
|
||||||
status.enabled(false);
|
status.enabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1433,8 +1445,8 @@ int MathHullInset::docbook(Buffer const & buf, ostream & os,
|
|||||||
MathMLStream ms(os);
|
MathMLStream ms(os);
|
||||||
int res = 0;
|
int res = 0;
|
||||||
string name;
|
string name;
|
||||||
if (getType() == "simple")
|
if (getType() == hullSimple)
|
||||||
name= "inlineequation";
|
name = "inlineequation";
|
||||||
else
|
else
|
||||||
name = "informalequation";
|
name = "informalequation";
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathHullInset();
|
MathHullInset();
|
||||||
///
|
///
|
||||||
explicit MathHullInset(std::string const & type);
|
explicit MathHullInset(HullType type);
|
||||||
///
|
///
|
||||||
~MathHullInset();
|
~MathHullInset();
|
||||||
///
|
///
|
||||||
@ -73,9 +73,9 @@ public:
|
|||||||
void delCol(col_type col);
|
void delCol(col_type col);
|
||||||
|
|
||||||
/// get type
|
/// get type
|
||||||
std::string const & getType() const;
|
HullType getType() const;
|
||||||
/// change type
|
/// change type
|
||||||
void mutate(std::string const &);
|
void mutate(HullType newtype);
|
||||||
|
|
||||||
///
|
///
|
||||||
int defaultColSpace(col_type col);
|
int defaultColSpace(col_type col);
|
||||||
@ -131,7 +131,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual std::auto_ptr<InsetBase> doClone() const;
|
virtual std::auto_ptr<InsetBase> doClone() const;
|
||||||
///
|
///
|
||||||
void setType(std::string const & type);
|
void setType(HullType type);
|
||||||
///
|
///
|
||||||
void validate1(LaTeXFeatures & features);
|
void validate1(LaTeXFeatures & features);
|
||||||
///
|
///
|
||||||
@ -170,7 +170,7 @@ private:
|
|||||||
bool colChangeOK() const;
|
bool colChangeOK() const;
|
||||||
|
|
||||||
/// "none", "simple", "display", "eqnarray",...
|
/// "none", "simple", "display", "eqnarray",...
|
||||||
std::string type_;
|
HullType type_;
|
||||||
///
|
///
|
||||||
std::vector<int> nonum_;
|
std::vector<int> nonum_;
|
||||||
///
|
///
|
||||||
|
@ -119,10 +119,9 @@ void MathInset::mathmlize(MathMLStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const & MathInset::getType() const
|
HullType MathInset::getType() const
|
||||||
{
|
{
|
||||||
static string const t = "none";
|
return hullNone;
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,23 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
enum HullType {
|
||||||
|
hullNone,
|
||||||
|
hullSimple,
|
||||||
|
hullEquation,
|
||||||
|
hullEqnArray,
|
||||||
|
hullAlign,
|
||||||
|
hullAlignAt,
|
||||||
|
hullXAlignAt,
|
||||||
|
hullXXAlignAt,
|
||||||
|
hullFlAlign,
|
||||||
|
hullMultline,
|
||||||
|
hullGather
|
||||||
|
};
|
||||||
|
|
||||||
|
HullType hullType(std::string const & name);
|
||||||
|
std::string hullName(HullType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Abstract base class for all math objects. A math insets is for use of the
|
Abstract base class for all math objects. A math insets is for use of the
|
||||||
@ -171,9 +188,9 @@ public:
|
|||||||
/// LyXInset stuff
|
/// LyXInset stuff
|
||||||
virtual bool numberedType() const { return false; }
|
virtual bool numberedType() const { return false; }
|
||||||
/// hull type
|
/// hull type
|
||||||
virtual std::string const & getType() const;
|
virtual HullType getType() const;
|
||||||
/// change type
|
/// change type
|
||||||
virtual void mutate(std::string const &) {}
|
virtual void mutate(HullType /*newtype*/) {}
|
||||||
/// usually the latex name
|
/// usually the latex name
|
||||||
virtual std::string name() const;
|
virtual std::string name() const;
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ bool Parser::parse(MathAtom & at)
|
|||||||
skipSpaces();
|
skipSpaces();
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
parse(ar, false, MathInset::UNDECIDED_MODE);
|
parse(ar, false, MathInset::UNDECIDED_MODE);
|
||||||
if (ar.size() != 1 || ar.front()->getType() == "none") {
|
if (ar.size() != 1 || ar.front()->getType() == hullNone) {
|
||||||
lyxerr << "unusual contents found: " << ar << endl;
|
lyxerr << "unusual contents found: " << ar << endl;
|
||||||
at = MathAtom(new MathParInset(ar));
|
at = MathAtom(new MathParInset(ar));
|
||||||
//if (at->nargs() > 0)
|
//if (at->nargs() > 0)
|
||||||
@ -726,13 +726,13 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
|||||||
Token const & n = getToken();
|
Token const & n = getToken();
|
||||||
if (n.cat() == catMath) {
|
if (n.cat() == catMath) {
|
||||||
// TeX's $$...$$ syntax for displayed math
|
// TeX's $$...$$ syntax for displayed math
|
||||||
cell->push_back(MathAtom(new MathHullInset("equation")));
|
cell->push_back(MathAtom(new MathHullInset(hullEquation)));
|
||||||
parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
|
parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
|
||||||
getToken(); // skip the second '$' token
|
getToken(); // skip the second '$' token
|
||||||
} else {
|
} else {
|
||||||
// simple $...$ stuff
|
// simple $...$ stuff
|
||||||
putback();
|
putback();
|
||||||
cell->push_back(MathAtom(new MathHullInset("simple")));
|
cell->push_back(MathAtom(new MathHullInset(hullSimple)));
|
||||||
parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
|
parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -914,12 +914,12 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "(") {
|
else if (t.cs() == "(") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("simple")));
|
cell->push_back(MathAtom(new MathHullInset(hullSimple)));
|
||||||
parse2(cell->back(), FLAG_SIMPLE2, MathInset::MATH_MODE, false);
|
parse2(cell->back(), FLAG_SIMPLE2, MathInset::MATH_MODE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "[") {
|
else if (t.cs() == "[") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("equation")));
|
cell->push_back(MathAtom(new MathHullInset(hullEquation)));
|
||||||
parse2(cell->back(), FLAG_EQUATION, MathInset::MATH_MODE, false);
|
parse2(cell->back(), FLAG_EQUATION, MathInset::MATH_MODE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,59 +1114,59 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "math") {
|
else if (name == "math") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("simple")));
|
cell->push_back(MathAtom(new MathHullInset(hullSimple)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, true);
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "equation" || name == "equation*"
|
else if (name == "equation" || name == "equation*"
|
||||||
|| name == "displaymath") {
|
|| name == "displaymath") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("equation")));
|
cell->push_back(MathAtom(new MathHullInset(hullEquation)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, (name == "equation"));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, (name == "equation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "eqnarray" || name == "eqnarray*") {
|
else if (name == "eqnarray" || name == "eqnarray*") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("eqnarray")));
|
cell->push_back(MathAtom(new MathHullInset(hullEqnArray)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "align" || name == "align*") {
|
else if (name == "align" || name == "align*") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("align")));
|
cell->push_back(MathAtom(new MathHullInset(hullAlign)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "flalign" || name == "flalign*") {
|
else if (name == "flalign" || name == "flalign*") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("flalign")));
|
cell->push_back(MathAtom(new MathHullInset(hullFlAlign)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "alignat" || name == "alignat*") {
|
else if (name == "alignat" || name == "alignat*") {
|
||||||
// ignore this for a while
|
// ignore this for a while
|
||||||
getArg('{', '}');
|
getArg('{', '}');
|
||||||
cell->push_back(MathAtom(new MathHullInset("alignat")));
|
cell->push_back(MathAtom(new MathHullInset(hullAlignAt)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "xalignat" || name == "xalignat*") {
|
else if (name == "xalignat" || name == "xalignat*") {
|
||||||
// ignore this for a while
|
// ignore this for a while
|
||||||
getArg('{', '}');
|
getArg('{', '}');
|
||||||
cell->push_back(MathAtom(new MathHullInset("xalignat")));
|
cell->push_back(MathAtom(new MathHullInset(hullXAlignAt)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "xxalignat") {
|
else if (name == "xxalignat") {
|
||||||
// ignore this for a while
|
// ignore this for a while
|
||||||
getArg('{', '}');
|
getArg('{', '}');
|
||||||
cell->push_back(MathAtom(new MathHullInset("xxalignat")));
|
cell->push_back(MathAtom(new MathHullInset(hullXXAlignAt)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "multline" || name == "multline*") {
|
else if (name == "multline" || name == "multline*") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("multline")));
|
cell->push_back(MathAtom(new MathHullInset(hullMultline)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "gather" || name == "gather*") {
|
else if (name == "gather" || name == "gather*") {
|
||||||
cell->push_back(MathAtom(new MathHullInset("gather")));
|
cell->push_back(MathAtom(new MathHullInset(hullGather)));
|
||||||
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ namespace {
|
|||||||
|
|
||||||
if (sel.empty()) {
|
if (sel.empty()) {
|
||||||
const int old_pos = cur.pos();
|
const int old_pos = cur.pos();
|
||||||
cur.insert(new MathHullInset("simple"));
|
cur.insert(new MathHullInset(hullSimple));
|
||||||
BOOST_ASSERT(old_pos == cur.pos());
|
BOOST_ASSERT(old_pos == cur.pos());
|
||||||
cur.nextInset()->edit(cur, true);
|
cur.nextInset()->edit(cur, true);
|
||||||
// don't do that also for LFUN_MATH_MODE
|
// don't do that also for LFUN_MATH_MODE
|
||||||
@ -178,10 +178,10 @@ namespace {
|
|||||||
LyXLex lex(0, 0);
|
LyXLex lex(0, 0);
|
||||||
lex.setStream(is);
|
lex.setStream(is);
|
||||||
formula->read(cur.buffer(), lex);
|
formula->read(cur.buffer(), lex);
|
||||||
if (formula->getType() == "none")
|
if (formula->getType() == hullNone)
|
||||||
// Don't create pseudo formulas if
|
// Don't create pseudo formulas if
|
||||||
// delimiters are left out
|
// delimiters are left out
|
||||||
formula->mutate("simple");
|
formula->mutate(hullSimple);
|
||||||
cur.insert(formula);
|
cur.insert(formula);
|
||||||
} else
|
} else
|
||||||
cur.insert(new MathMacroTemplate(is));
|
cur.insert(new MathMacroTemplate(is));
|
||||||
@ -1251,7 +1251,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_MATH_MATRIX:
|
case LFUN_MATH_MATRIX:
|
||||||
case LFUN_MATH_DELIM:
|
case LFUN_MATH_DELIM:
|
||||||
case LFUN_MATH_BIGDELIM: {
|
case LFUN_MATH_BIGDELIM: {
|
||||||
cur.insert(new MathHullInset("simple"));
|
cur.insert(new MathHullInset(hullSimple));
|
||||||
cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
|
cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
|
||||||
cur.dispatch(cmd);
|
cur.dispatch(cmd);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user