InsetTabular.cpp: fix bug that LyX allowed to specify the vertical alignment of table columns without a fixed width

Should also go to branch, Jürgen?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33615 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-03-04 03:55:13 +00:00
parent 497d6d13f7
commit 20fbd7068a

View File

@ -1035,6 +1035,11 @@ void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
col_type const j = cellColumn(cell);
column_info[j].p_width = width;
// reset the vertical alignment to top if the fixed with
// is removed or zero because only fixed width columns can
// have a vertical alignment
if (column_info[j].p_width.zero())
column_info[j].valignment = LYX_VALIGN_TOP;
for (row_type i = 0; i < row_info.size(); ++i) {
idx_type const cell = cellIndex(i, j);
// because of multicolumns
@ -4139,6 +4144,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_TOP:
flag = false;
case Tabular::VALIGN_TOP:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_TOP);
break;
@ -4146,6 +4152,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_BOTTOM:
flag = false;
case Tabular::VALIGN_BOTTOM:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_BOTTOM);
break;
@ -4153,6 +4160,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_MIDDLE:
flag = false;
case Tabular::VALIGN_MIDDLE:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_MIDDLE);
break;