Uwe Stöhr wrote:
> This is now done in the attached patch.

The patch looks good now, Uwe.
Just some final nitpicks (none of them prevent the patch from being committed, 
though, given that you add a file format change and lyx2lyx routine)

> +       } else if (token == "\\paragraph_indentation") {
> +               lex.next();
> +               string indentation = lex.getString();
> +               if (indentation == "default")
> +                       pimpl_->indentation = HSpace(HSpace::DEFAULT);
> +               else
> +                       pimpl_->indentation = HSpace(indentation);

HSpace("default") works, so you can simplify the above code to

+       } else if (token == "\\paragraph_indentation") {
+               lex.next();
+               string indentation = lex.getString();
+               pimpl_->indentation = HSpace(indentation);

> -       // remove the %-items from the unit choice
> -       textLayoutModule->skipLengthCO->noPercents();

I think you should do this in a separate step.

> +               case 1:
> +                       {
> +                       HSpace indent = HSpace(
> +                               widgetsToLength(textLayoutModule->indentLE,
> +                               textLayoutModule->indentLengthCO)
> +                               );
> +                       bp_.setIndentation(indent);
> +                       break;
> +                       }

More LyXish style would be

+               case 1: {
+                       HSpace indent = HSpace(
+                               widgetsToLength(textLayoutModule->indentLE,
+                               textLayoutModule->indentLengthCO));
+                       bp_.setIndentation(indent);
+                       break;
+                       }

> +               string indentation = bp_.getIndentation().asLyXCommand();
> +               int indent = 0;
> +               if (indentation == "default")
> +                       indent = 0;

the if clause strikes me redundant. indent is already 0. So

> +               else {

+                if (indentation != "default") {

> +                       lengthToWidgets(textLayoutModule->indentLE,
> +                       textLayoutModule->indentLengthCO,
> +                       indentation, defaultUnit);
> +                       indent = 1;
> +               }
> +               textLayoutModule->indentCO->setCurrentIndex(indent);
> +               setIndent(indent);
> +       } else {


> Index: src/TextMetrics.cpp
> ===================================================================
> --- src/TextMetrics.cpp (revision 30681)
> +++ src/TextMetrics.cpp (working copy)
> @@ -28,6 +28,7 @@
>  #include "Cursor.h"
>  #include "CutAndPaste.h"
>  #include "FuncRequest.h"
> +#include "HSpace.h"
>  #include "InsetList.h"
>  #include "Layout.h"
>  #include "Length.h"
> @@ -1930,30 +1931,36 @@
>                 align = par.params().align();
>
>         // set the correct parindent
> +       //BufferParams const & bufparams = buffer.params();
>         if (pos == 0
> -           && (layout.labeltype == LABEL_NO_LABEL
> -              || layout.labeltype == LABEL_TOP_ENVIRONMENT
> -              || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
> -              || (layout.labeltype == LABEL_STATIC
> -                  && layout.latextype == LATEX_ENVIRONMENT
> -                  && !isFirstInSequence(pit, pars)))
[...]
> +               && (layout.labeltype == LABEL_NO_LABEL
> +                       || layout.labeltype == LABEL_TOP_ENVIRONMENT
> +                       || layout.labeltype ==
> LABEL_CENTERED_TOP_ENVIRONMENT +                       || (layout.labeltype
> == LABEL_STATIC
> +                       && layout.latextype == LATEX_ENVIRONMENT
> +                               && !isFirstInSequence(pit, pars)))

Your indendation change doesn't conform the coding style. The use of spaces 
(rather than tabs) in the existing code is correct. 

Jürgen

Reply via email to