← Back to team overview

kicad-developers team mailing list archive

Re: [RFC] Undo buffer refactoring

 

Thank you for the prompt reply.

On 05/13/2016 04:49 PM, Wayne Stambaugh wrote:
> On 5/13/2016 9:08 AM, Maciej Sumiński wrote:
[snip]
>> 2. Include OnModify() in SaveCopyInUndoList(), as it is called every
>> time anyway.
> 
> Include them where?  Please be careful to avoid coupling the UI with the
> undo/redo buffer.  I seem to remember this being a stumbling block as
> part of the Eeschema refactor so anything you can do to avoid coupling
> would be a good thing.

I mean, these two calls usually come in pairs:

frame->SaveCopyInUndoList(...);
frame->OnModify();

so I wanted to put OnModify() into SaveCopyInUndoList().
SaveCopyInUndoList() is still in a wxFrame method, and I would not dare
to call frame->OnModify() in an undo buffer method, but if you prefer
them separated I will keep it this way.

[snip]
>> 5. During certain operations (e.g. replacing a footprint), it is
>> necessary to notify observer twice: when the old BOARD_ITEM is removed
>> and when the new is added. Otherwise observers will keep stale pointers.
> 
> Be careful here to prevent any events from happening that could access a
> state pointer before the callbacks occur.

That is why I want to warn everyone that a pointer they held is going to
be removed in a moment, so they have a chance to say goodbye while the
object is still valid.

[snip]
>> 4. Get rid of UR_MOVED/UR_ROTATED, etc. and store an item copy instead.
> 
> Looks good.  If you happen to find any UI/undo buffer coupling please
> try to weed it out if possible.  This will make the long term
> maintenance of this code more palatable.

Will do my best.

> Thanks,
> 
> Wayne


Attachment: signature.asc
Description: OpenPGP digital signature


References