The Paragraph controller currently contains the following code.

void ControlParagraph::setParams()
{
        if (!pp_.get())
                pp_.reset(new ParagraphParameters());

        /// get paragraph
        Paragraph const * par_ = bufferview()->getLyXText()->cursor.par();

        /// Set the paragraph parameters
        *pp_ = par_->params();

        /// this needs to be done separately
        pp_->labelWidthString(par_->getLabelWidthString());

        /// alignment
        LyXLayout_ptr const & layout = par_->layout();
        if (pp_->align() == LYX_ALIGN_LAYOUT)
                pp_->align(layout->align);

Where pp_ is of type boost::scoped_ptr<ParagraphParameters>. I'm confused by 
the code above.
        *pp_ = par_->params();
is using the implicit operator=() of the ParagraphParameters struct, but the 
next line suggests that this implicit operator doesn't cut the mustard. 
Looking at ParagraphParameters I see it contains data:

        boost::shared_ptr<ParameterStruct> param;

so the implicit operator=() should be fine. Nonetheless, the code above 
exists for a reason. Can someone advise why labelWidthString and align have 
to be set separately? Looking further I see stuff like

void ParagraphParameters::spaceTop(VSpace const & vs)
{
        ParameterStruct tmp(*param);
        tmp.added_space_top = vs;
        set_from_struct(tmp);
}

which looks really messy (ie, confuses me further).

Should I write an operator=()? What's the best way to proceed?

-- 
Angus

Reply via email to