commit 092911880a79cf33684dcc33d4ddbca9c783e250
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Aug 14 16:28:15 2024 +0200
    Disable valign widget in tabularx tables
    
    See https://marc.info/?l=lyx-users&m=172363857509065&w=2
    
    (cherry picked from commit c993485782a1f47c6eafc9335c8905b3def7e083)
---
 src/frontends/qt/GuiTabular.cpp | 3 ++-
 src/insets/InsetTabular.cpp     | 7 +++++--
 status.24x                      | 4 ++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt/GuiTabular.cpp b/src/frontends/qt/GuiTabular.cpp
index 5c32edc7d4..26f3f6debb 100644
--- a/src/frontends/qt/GuiTabular.cpp
+++ b/src/frontends/qt/GuiTabular.cpp
@@ -267,7 +267,8 @@ void GuiTabular::enableWidgets() const
        bool const enable_valign =
                !multirowCB->isChecked()
                && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty()
-               && specialAlignmentED->text().isEmpty();
+               && specialAlignmentED->text().isEmpty()
+               && funcEnabled(Tabular::VALIGN_BOTTOM);
        vAlignCO->setEnabled(enable_valign);
        vAlignLA->setEnabled(enable_valign);
 
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 2365d2e1be..758400f7c2 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -5675,6 +5675,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string 
const & s,
                col_type sel_col_end = 0;
                Tabular::ltType dummyltt;
                bool flag = true;
+               bool const tabularx = tabular.hasVarwidthColumn();
 
                getSelection(cur, sel_row_start, sel_row_end, sel_col_start, 
sel_col_end);
 
@@ -5950,7 +5951,8 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string 
const & s,
                        flag = false;
                        // fall through
                case Tabular::VALIGN_BOTTOM:
-                       status.setEnabled((!tabular.getPWidth(cur.idx()).zero()
+                       status.setEnabled(!tabularx
+                                         && 
(!tabular.getPWidth(cur.idx()).zero()
                                           || tabular.getUsebox(cur.idx()) == 
Tabular::BOX_VARWIDTH));
                        status.setOnOff(
                                tabular.getVAlignment(cur.idx(), flag) == 
Tabular::LYX_VALIGN_BOTTOM);
@@ -5960,7 +5962,8 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string 
const & s,
                        flag = false;
                        // fall through
                case Tabular::VALIGN_MIDDLE:
-                       status.setEnabled((!tabular.getPWidth(cur.idx()).zero()
+                       status.setEnabled(!tabularx
+                                         && 
(!tabular.getPWidth(cur.idx()).zero()
                                           || tabular.getUsebox(cur.idx()) == 
Tabular::BOX_VARWIDTH));
                        status.setOnOff(
                                tabular.getVAlignment(cur.idx(), flag) == 
Tabular::LYX_VALIGN_MIDDLE);
diff --git a/status.24x b/status.24x
index b0a7e1d40b..1df3c6b7a7 100644
--- a/status.24x
+++ b/status.24x
@@ -94,6 +94,10 @@ What's new
 
 - Display values of cross-references in tooltips for forward references.
 
+- Disable vertical alignment in tables with variable width columns (tabularx
+  and xltable), as this is not supported by the packages. Also fix the
+  disabling mechanism in the table dialog.
+
 
 * INTERNALS
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to