> Author: uwestoehr
> Date: Sun May 23 18:36:06 2010
> New Revision: 34471
> URL: http://www.lyx.org/trac/changeset/34471
>
> Log:
> GuiBox.cpp: fix #6721
>

> +       // if an outer box from the fancybox LaTeX-package has no inner box,
> +       // the width cannot be specified
> +       if (!ibox && outer != 0 && outer != 1) {
> +               widthED->setEnabled(false);
> +               widthUnitsLC->setEnabled(false);
> +       } else {
> +               widthED->setEnabled(true);
> +               widthUnitsLC->setEnabled(true);
> +       }

I don't like explicitly checking for the number of the entry in the
box_type_list. If we ever add another type, all this logic breaks
down. Besides using the strings makes the code much clearer even
without comments. So, would the following be better ?

bool const width_enabled = !(ibox || ids_[outer] == "Frameless" ||
ids_[outer] == "Boxed");

The if statement is not really necessary here:

widthED->setEnabled(width_enabled);
widthUnitsLC->setEnabled(width_enabled);

> +       pagebreakCB->setEnabled(!ibox && outer == 1);

pagebreakCB->setEnabled(!ibox && ids_[outer] == "Boxed");

> +       // if an outer box from the fancybox LaTeX-package has no inner box,
> +       // the width cannot be specified
> +       if (itype == 0
> +           && (index == 2 || index == 3 || index == 4 || index == 6)) {

idem.

> +               widthED->setEnabled(index != 5);
> +               widthUnitsLC->setEnabled(index != 5);

idem.

Vincent

Reply via email to