Abdelrazak Younes <[EMAIL PROTECTED]> writes: | Jean-Marc Lasgouttes a écrit : | >>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes: | >>>>>> | > | > Abdelrazak> bool needEnumCounterReset(ParagraphList & pars, size_t | > const pos) Abdelrazak> Maybe I am missing something but this is | > simpler. Please | > Abdelrazak> correct me if I am wrong. | > | > I agree that using dociterators all over makes a code a bit longer, | > but a big advantage is that we pass just one object to the function | > instead of a (ParagraphList,pos) [and of course your pos should be a | > pit, so your are preparing us for more confusion]. We have fixed | > *many* bugs in the core where people used a parlist index with the | > wrong parlist. | IMHO, this is because the code is not object oriented. In this context | docIterator is an advantage.
The code is not 'not object oriented' either. | When/if we move to a truly object oriented way of dealing with insets | I believe that most of the its use will disappear. Beside updating | _all_ the counters of the document (including inside insets!) because | of one new paragraph seems wrong to me. It sound like you are thinking of something we rejected quite some time ago. But I look forward to see your ideas. | > I am not going to fight about keeping this function as | > it is, I do not really care. What would be more useful though is to | > see a profile so that we see what the problem actually is. Rewriting | > everything just in case it helps will not give us the solution. | > | | This is something I don't understand, sorry. IMHO, rewriting is a sane | thing to do in any case if you want more people to understand the | code. Not if this ends up making the people that already understand the code loose that understanding. | There are really too much code of that sort in lyx. Please find | attached a patch that improve the situation dramatically. The | LABEL_ENUMERATE case optimization is not yet enabled but is almost | ready. Passing (Buffer const & buf) is not nice from an OO point of | view but this can be solved later. With a multi paradigm language like c++, pure OO is not the goal. But surely LyX can be improved in a lot of ways. -- Lgb