From cae6397b69a5adf2c8b3f634428784d1820b1df4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Sat, 16 Feb 2013 01:44:02 +0100 Subject: [PATCH] GuiTabular.cpp: fix bug #8285 for branch fixes: - LyX uses for a decimal alignment a multicolumn and having for a cell a multicolumn _and_ a multirow is invalid LaTeX. Therefore do not allow to set table cells to this in the dialog. - It was impossible to unset a decimal alignment via the context menu or toolbar button. --- src/frontends/qt4/GuiTabular.cpp | 30 ++++++++++++++++++++++-------- status.20x | 7 +++++-- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 2a011e4fa5..f79c05c92f 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -204,6 +204,13 @@ void GuiTabular::checkEnabled() hAlignCO->setEnabled(!(multirowCB->isChecked() && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty()) && specialAlignmentED->text().isEmpty()); + // decimal alignment is only possible for non-multicol and non-multirow cells + if ((multicolumnCB->isChecked() || multirowCB->isChecked()) + && hAlignCO->findData(toqstr("decimal"))) + hAlignCO->removeItem(hAlignCO->findData(toqstr("decimal"))); + else if (!multicolumnCB->isChecked() && !multirowCB->isChecked() + && hAlignCO->findData(toqstr("decimal")) == -1) + hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal")); bool const dalign = hAlignCO->itemData(hAlignCO->currentIndex()).toString() == QString("decimal"); decimalPointED->setEnabled(dalign); @@ -215,9 +222,12 @@ void GuiTabular::checkEnabled() tabularWidthED->setEnabled(setwidth); tabularWidthUnitLC->setEnabled(setwidth); - vAlignCO->setEnabled(!multirowCB->isChecked() + bool const enable_valign = + !multirowCB->isChecked() && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty() - && specialAlignmentED->text().isEmpty()); + && specialAlignmentED->text().isEmpty(); + vAlignCO->setEnabled(enable_valign); + vAlignLA->setEnabled(enable_valign); topspaceED->setEnabled(topspaceCO->currentIndex() == 2); topspaceED->setEnabled(topspaceCO->currentIndex() == 2); @@ -283,10 +293,14 @@ void GuiTabular::checkEnabled() captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION) && longtabular); - multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN)); - multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW)); - multirowOffsetED->setEnabled(multirowCB->isChecked()); - multirowOffsetUnitLC->setEnabled(multirowCB->isChecked()); + multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN) + && !dalign && !multirowCB->isChecked()); + multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW) + && !dalign && !multicolumnCB->isChecked()); + bool const enable_mr = multirowCB->isChecked(); + multirowOffsetLA->setEnabled(enable_mr); + multirowOffsetED->setEnabled(enable_mr); + multirowOffsetUnitLC->setEnabled(enable_mr); changed(); } @@ -790,7 +804,7 @@ void GuiTabular::paramsToDialog(Inset const * inset) hAlignCO->addItem(qt_("Right"), toqstr("right")); if (!multicol && !pwidth.zero()) hAlignCO->addItem(qt_("Justified"), toqstr("justified")); - if (!multicol) + if (!multicol && !multirow) hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal")); string align; @@ -812,7 +826,7 @@ void GuiTabular::paramsToDialog(Inset const * inset) } case LYX_ALIGN_DECIMAL: { - if (!multicol) + if (!multicol && !multirow) align = "decimal"; break; } diff --git a/status.20x b/status.20x index 6bf65927b2..fa1549061d 100644 --- a/status.20x +++ b/status.20x @@ -123,6 +123,9 @@ What's new - Fix a few selection bugs in tabular (bugs 4981, 7988). +- Fix several issues when using multicolumns/multirows and decimal alignment in + table cells (bug 8285). + - Show the output of configure.py while the LaTeX packages are being checked rather than all at once at the end of the check (bug 8477). @@ -132,8 +135,8 @@ What's new - File format viewer & editor combo boxes are correctly initialized (bug 8237). -- Do not create an empty environment variable LC_ALL when launching - external processes (bug 8537). +- Do not create an empty environment variable LC_ALL when launching + external processes (bug 8537). * DOCUMENTATION AND LOCALIZATION -- 2.39.5