Uwe Stöhr wrote:
> Index: BufferParams.cpp
> ===================================================================
> --- BufferParams.cpp    (revision 30639)
> +++ BufferParams.cpp    (working copy)
> @@ -289,6 +289,7 @@
>         /** This is the amount of space used for paragraph_separation
> "skip", * and for detached paragraphs in "indented" documents.
>          */
> +       Length indentation;

Why not HSpace indentation?

>         VSpace defskip;
>         PDFOptions pdfoptions;
>         LayoutFileIndex baseClass_;
> @@ -468,6 +469,18 @@
>  }
>
>
> +Length const & BufferParams::getIndentation() const

Dito.

> +                       pimpl_->indentation = Length(Length::DEFAULT);
> +               else
> +                       pimpl_->indentation = Length(indentation);

Dito.

> +       } else {
> +               // when separation by indentation
> +               // only output something when a width is given
> +               // "0" is the case for a new document
> +               if (getIndentation().asString() != "default"
> +                       && getIndentation().asString() != "0") {

Why the test for "0"?

> +                       os << "\\setlength{\\parindent}{"
> +                          << from_utf8(getIndentation().asLatexString())
> +                          << "}\n";
> +                       texrow.newline();
> +               }
>         }
>
>         // Now insert the LyX specific LaTeX commands...
> Index: BufferParams.h
> ===================================================================
> --- BufferParams.h      (revision 30639)
> +++ BufferParams.h      (working copy)
> @@ -41,6 +41,7 @@
>  class LatexFeatures;
>  class LayoutFile;
>  class LayoutFileIndex;
> +class Length;
>  class Lexer;
>  class PDFOptions;
>  class Spacing;
> @@ -90,6 +91,10 @@
>         bool hasClassDefaults() const;
>
>         ///
> +       Length const & getIndentation() const;

See above

> +       textLayoutModule->indentCO->addItem(qt_("Default"));
> +       textLayoutModule->indentCO->addItem(qt_("Length"));

Both are Lengths, so I'd rather use

+       textLayoutModule->indentCO->addItem(qt_("Default"));
+       textLayoutModule->indentCO->addItem(qt_("Custom"));

> +               case 0:
> +                       bp_.setIndentation(Length(Length::DEFAULT));

bp_.setIndentation(HSpace(HSpace::DEFAULT));
etc.

> +               // "0" is the case for a new document

Then something is wrong. You have to initialize HSpace to default.

> Index: Length.cpp
> ===================================================================
> --- Length.cpp  (revision 30639)
> +++ Length.cpp  (working copy)
> @@ -35,17 +35,22 @@
>  /////////////////////////////////////////////////////////////////////
>
>  Length::Length()
> -       : val_(0), unit_(Length::UNIT_NONE)
> +       : kind_(LENGTH), val_(0), unit_(Length::UNIT_NONE)
>  {}
>
>
> +Length::Length(HSpaceKind h)
> +       : kind_(h), val_(0), unit_(Length::UNIT_NONE)
> +{}
> +
> +

OK, I see now. I think this is not the way to go. Rather, I would set up an 
own HSpace class (i.e., HSpace.cpp and HSpace.h), very much as the VSpace 
class we already have.

Length should be direction-abtract.

Jürgen

Reply via email to