backport r33615: fix bug that LyX allowed to specify the vertical alignment of table columns without a fixed width

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@33685 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-03-09 00:34:58 +00:00
parent 76d3278183
commit 5322561dcd
2 changed files with 12 additions and 1 deletions

View File

@ -1000,6 +1000,11 @@ void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
col_type const j = cellColumn(cell); col_type const j = cellColumn(cell);
column_info[j].p_width = width; 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) { for (row_type i = 0; i < row_info.size(); ++i) {
idx_type const cell = cellIndex(i, j); idx_type const cell = cellIndex(i, j);
// because of multicolumns // because of multicolumns
@ -1931,7 +1936,7 @@ int Tabular::TeXCellPreamble(odocstream & os, idx_type cell, bool & ismulticol)
if (is_long_tabular && row_info[r].caption) if (is_long_tabular && row_info[r].caption)
return ret; return ret;
Tabular::VAlignment valign = getVAlignment(cell, !isMultiColumn(cell)); Tabular::VAlignment valign = getVAlignment(cell, !isMultiColumn(cell));
LyXAlignment align = getAlignment(cell, !isMultiColumn(cell)); LyXAlignment align = getAlignment(cell, !isMultiColumn(cell));
// figure out how to set the lines // figure out how to set the lines
// we always set double lines to the right of the cell // we always set double lines to the right of the cell
@ -3854,6 +3859,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_TOP: case Tabular::M_VALIGN_TOP:
flag = false; flag = false;
case Tabular::VALIGN_TOP: case Tabular::VALIGN_TOP:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff( status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_TOP); tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_TOP);
break; break;
@ -3861,6 +3867,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_BOTTOM: case Tabular::M_VALIGN_BOTTOM:
flag = false; flag = false;
case Tabular::VALIGN_BOTTOM: case Tabular::VALIGN_BOTTOM:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff( status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_BOTTOM); tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_BOTTOM);
break; break;
@ -3868,6 +3875,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::M_VALIGN_MIDDLE: case Tabular::M_VALIGN_MIDDLE:
flag = false; flag = false;
case Tabular::VALIGN_MIDDLE: case Tabular::VALIGN_MIDDLE:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
status.setOnOff( status.setOnOff(
tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_MIDDLE); tabular.getVAlignment(cur.idx(), flag) == Tabular::LYX_VALIGN_MIDDLE);
break; break;

View File

@ -176,6 +176,9 @@ What's new
- Detect user-specified package dependencies for modules (bug 6361). - Detect user-specified package dependencies for modules (bug 6361).
- Fix bug that LyX allowed to specify the vertical alignment of table
columns without a fixed width.
- Prevent the error dialog from jumping to the first item when - Prevent the error dialog from jumping to the first item when
clicking outside the dialog (bug 2179). clicking outside the dialog (bug 2179).