← Back to team overview

kicad-developers team mailing list archive

Re: Undo buffer refactor

 

On 9/5/2016 10:06 AM, Maciej Sumiński wrote:
> Recently I was refactoring the undo buffer code [1], as I have mentioned
> sometime ago. The main goal was to make the code simpler and more
> generic, remove some redundant parts.
> 
> Short changelog:
> 
> - BOARD_COMMIT class.
> Wrapper around undo buffer to simplify storing changes. Also performs
> all the necessary updates (ratsnest, view) once anything changes. A good
> entry point to introduce an observer interface.
> 
> - Removed BOARD_ITEM::Copy(), switched to C++ copy constructors and
> operator=.

Watch out for parenting issues when doing this.  The c++ copy ctors will
copy the parent pointer even if that's not what you want.  Getting the
parent wrong will cause issues.

> 
> - BOARD_ITEM_CONTAINER interface.
> A generic interface for adding & removing items, base class for MODULE
> and BOARD.
> 
> - Removed UR_MODEDIT.
> Module editor now uses the same UR_* flags as the layout editor. Now,
> together with BOARD_COMMIT is the way to unify undo handling code in
> tools (no more ugly 'if(m_editModules) {...} else {...}').
> 
> - Common code for handling undo buffer in the layout & module editor.
> board_undo_redo.cpp and modedit_undo_redo.cpp are merged to
> undo_redo.cpp. A lot of redundant code removed.
> 
> As you may have noticed, there are a lot of changes to the KiCad
> internals. It would be great if there were some brave folks to take the
> branch for a test ride. I have tested the code for some time, including
> a few sessions of valgrind and I had no problems.

I'll see if I can find the time to build and test it over the next few days.

> 
> If there are no objections I would like to commit the patches next week.

As long as it's reasonably stable, I'm fine with that.

> 
> Regards,
> Orson
> 
> 1.
> https://code.launchpad.net/~orsonmmz/kicad/+git/kicad/+ref/undobuffer_refactor
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References