Revert "Revert "Fix the display of column spacing in AMS environments""

This reverts commit f1a388584f.

# Conflicts:
#	src/mathed/InsetMathGrid.cpp
#	src/mathed/InsetMathSplit.cpp
This commit is contained in:
Uwe Stöhr 2016-01-19 23:20:53 +01:00
parent 641a1cc1a2
commit 764a2163bb
5 changed files with 18 additions and 98 deletions

View File

@ -1838,29 +1838,4 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
}
// static
char InsetMathGrid::colAlign(HullType type, col_type col)
{
switch (type) {
case hullEqnArray:
return "rcl"[col % 3];
case hullMultline:
case hullGather:
return 'c';
case hullAlign:
case hullAlignAt:
case hullXAlignAt:
case hullXXAlignAt:
case hullFlAlign:
return "rl"[col & 1];
default:
return 'c';
}
}
} // namespace lyx

View File

@ -258,11 +258,10 @@ protected:
virtual docstring eocString(col_type col, col_type lastcol) const;
/// splits cells and shifts right part to the next cell
void splitCell(Cursor & cur);
/// Column alignment for display of cell \p idx.
/// Column aligmment for display of cell \p idx.
/// Must not be written to file!
virtual char displayColAlign(idx_type idx) const;
/// The value of a fixed col align for a certain hull type
static char colAlign(HullType type, col_type col);
/// row info.
/// rowinfo_[nrows()] is a dummy row used only for hlines.

View File

@ -349,34 +349,28 @@ bool InsetMathHull::idxLast(Cursor & cur) const
}
//FIXME: This has probably no effect and can be removed.
char InsetMathHull::defaultColAlign(col_type col)
{
return colAlign(type_, col);
if (type_ == hullEqnArray)
return "rcl"[col];
if (type_ == hullMultline)
return 'c';
if (type_ == hullGather)
return 'c';
if (type_ >= hullAlign)
return "rl"[col & 1];
return 'c';
}
char InsetMathHull::displayColAlign(idx_type idx) const
{
switch (type_) {
case hullMultline: {
if (type_ == hullMultline) {
row_type const r = row(idx);
if (r == 0)
return 'l';
if (r == nrows() - 1)
return 'r';
return 'c';
}
case hullEqnArray:
case hullGather:
case hullAlign:
case hullAlignAt:
case hullXAlignAt:
case hullXXAlignAt:
case hullFlAlign:
return colAlign(type_, col(idx));
default:
break;
}
return InsetMathGrid::displayColAlign(idx);
}
@ -1247,27 +1241,6 @@ void InsetMathHull::setType(HullType type)
}
bool InsetMathHull::isMutable(HullType type)
{
switch (type) {
case hullNone:
case hullSimple:
case hullEquation:
case hullEqnArray:
case hullAlign:
case hullFlAlign:
case hullAlignAt:
case hullXAlignAt:
case hullXXAlignAt:
case hullMultline:
case hullGather:
return true;
default:
return false;
}
}
void InsetMathHull::mutate(HullType newtype)
{
//lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;

View File

@ -48,38 +48,17 @@ Inset * InsetMathSplit::clone() const
}
//FIXME: This has probably no effect and can be removed.
char InsetMathSplit::defaultColAlign(col_type col)
{
if (name_ == "split")
return 'l';
if (name_ == "gathered")
return 'c';
if (name_ == "lgathered")
if (name_ == "aligned" || name_ == "align")
return (col & 1) ? 'l' : 'r';
if (name_ == "alignedat")
return (col & 1) ? 'l' : 'r';
return 'l';
if (name_ == "rgathered")
return 'r';
if (name_ == "split"
|| name_ == "aligned"
|| name_ == "align"
|| name_ == "alignedat")
return colAlign(hullAlign, col);
return 'l';
}
char InsetMathSplit::displayColAlign(idx_type idx) const
{
if (name_ == "gathered")
return 'c';
if (name_ == "lgathered")
return 'l';
if (name_ == "rgathered")
return 'r';
if (name_ == "split"
|| name_ == "aligned"
|| name_ == "align"
|| name_ == "alignedat")
return colAlign(hullAlign, col(idx));
return InsetMathGrid::displayColAlign(idx);
}
@ -107,10 +86,6 @@ bool InsetMathSplit::getStatus(Cursor & cur, FuncRequest const & cmd,
flag.setEnabled(false);
return true;
}
if (s == "align-left" || s == "align-center" || s == "align-right") {
flag.setEnabled(false);
return true;
}
break;
}
default:

View File

@ -43,8 +43,6 @@ public:
///
char defaultColAlign(col_type);
///
char displayColAlign(idx_type idx) const;
///
InsetCode lyxCode() const { return MATH_SPLIT_CODE; }
private: