Undo redo segmentation

During the process refactoring, we talked about undo/redo. To be sure to be consistent and to use the same patterns, I tried to implement it for segmentation, and here is the result.
I might have broken some stuff, so please have a good look at it.

There will probably be many things to refactor/add for the segmentation, but at least we can have undo/redo for the current version without too much effort...