Op 16-2-2011 23:34, Richard Heck schreef:
On 02/16/2011 05:22 PM, Edwin Leuven wrote:
Patrick Atamaniuk<ataman...@frobs.net>  wrote:
I traced it down to InsetTabular.cpp:4327 , action 75
This is called at lfun_ok calculation from
InsetParamsDialog::checkWidgets and will set the status to not
enabled, where get_status stops and the applyPB will be disabled.

I'm absolutely clueless why action 75 (Tabular::SET_TABULAR_WIDTH) is
queried at this point
docstring GuiTabular::dialogToParams()

returns something like

tabular set-tabular-width 0pt set-pwidth 0pt align-center
set-decimal-point . valign-top  tabular-valign-middle  unset-booktabs
set-top-space none set-bottom-space none set-interline-space none
set-line-left true set-line-right false set-line-top true
set-line-bottom true set-special-column none unset-multicolumn
unset-multirow  unset-rotate-tabular  unset-rotate-cell
unset-longtabular  unset-ltcaption  unset-lthead none unset-lthead
dl_above unset-lthead dl_below unset-ltfirsthead dl_above
unset-ltfirsthead dl_below unset-ltfirsthead none unset-ltfirsthead
empty unset-ltfoot none unset-ltfoot dl_above unset-ltfoot dl_below
unset-ltlastfoot none unset-ltlastfoot dl_above unset-ltlastfoot
dl_below unset-ltlastfoot empty longtabular-align-center

...

so when you check longtable this gets passed to
InsetParamsDialog::checkWidgets which then checks whether
set-tabular-width is enabled (just because it happens to be first in
line), and it won't be and lfun_ok is false

a simple "fix" is to move

    // table width
string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
    if (tabwidth.empty())
        tabwidth = "0pt";
    setParam(param_str, Tabular::SET_TABULAR_WIDTH, tabwidth);

down so that for example set-pwidth will be queried first rather than
set-tabular-width

i don't know the logic of this machinery and i don't have the time to
try to twist my head around it either

so perhaps the inventor of this code can suggest a proper fix?

Another option is not to write the "set-tabular-width" thing if we're disabled. Surely we don't depend upon its being there. Simple patch below.

InsetTabular::getStatus() is weird anyway, since it only checks the very first argument.

rh

===

Index: src/frontends/qt4/GuiTabular.cpp
===================================================================
--- src/frontends/qt4/GuiTabular.cpp    (revision 37703)
+++ src/frontends/qt4/GuiTabular.cpp    (working copy)
@@ -411,10 +411,12 @@
        string param_str = "tabular";

        // table width
- string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
-       if (tabwidth.empty())
-               tabwidth = "0pt";
-       setParam(param_str, Tabular::SET_TABULAR_WIDTH, tabwidth);
+       if (tabularWidthED->isEnabled()) {
+ string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
+               if (tabwidth.empty())
+                       tabwidth = "0pt";
+ setParam(param_str, Tabular::SET_TABULAR_WIDTH, tabwidth);
+       }

        // apply the fixed width values
        // this must be done before applying the column alignment


edwin


This is not the right fix.

Imagine you have a longtable in your document. Now you uncheck the longtable checkbox, fill in a table width, press Apply. Nothing will happen because InsetTabular::getStatus checks for setting the table width, while the table is still a longtable.

Vincent

Reply via email to