← Back to team overview

kicad-developers team mailing list archive

Undo buffer refactor

 

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=.

- 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.

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

Regards,
Orson

1.
https://code.launchpad.net/~orsonmmz/kicad/+git/kicad/+ref/undobuffer_refactor

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups