Abdelrazak Younes wrote:
> > +                           if (oldname != newname) {
> > +                                   // adapt the references
> > +                                   for (InsetIterator itt = 
> > inset_iterator_begin(in);
> > +                                        itt != i_end; ++itt) {
> > +                                           if (itt->lyxCode() == REF_CODE) 
> > {
> > +                                                   InsetCommand&  ref =
> > +                                                           
> > dynamic_cast<InsetCommand&>(*itt);
> 
> I don't think you need a dynamic cast. And if you need it, you should
> use a pointer instead and check it id null.

I just copied the code from the label mechanism below. Frankly, I no next to 
nothing about those *_casts. What do you suggest?

> > +                                                   if 
> > (ref.getParam("reference") == oldname)
> > +                                                           
> > ref.setParam("reference", newname);
> 
> Ouch, that's 7 level of indentation! I suggest that you use "continue"
> instead:
> 
>       if (oldname == newname)
>               continue;

OK.

> and
>       if (itt->lyxCode() != REF_CODE)
>               continue;

I'll need a second condition for the MATH_REF_CODE (bug 1562), so I left this.
(that's why I didn't change trunk yet; I'll commit the indentation changes 
with that patch)

> Hum, maybe:
> 
> std::vector<InsetLabel *> const & getLabels() const { return label_; }
> 
> The InsetLabel pointers themselves should remain modifiable.

Seems to work.

> Abdel.
> 

Thanks,
Jürgen

Reply via email to