undo & oldValue

Casper Boemann cbr at boemann.dk
Wed Jan 26 13:58:30 CET 2005


On Wednesday 26 January 2005 12:12, Boudewijn Rempt wrote:
> More todo's in the new code:
>
> I've been looking at oldValue -- which is necessary to make even simple
> filters like the example inversion filter work -- and to have that working,
> I need to have an understanding of the new undo/memento system. Now it
> happens that undo doesn't work correctly yet: you cannot undo simple brush
> strokes.
>
> I've already added an oldValue to the low-level iterators, because I think
> it should be solved there, using the memento. But because undo doesn't work
> yet, I cannot work on this :-(.

Sorry. Hhadn't seen that you have committed it, I'll take a look as soon as 
possible. I have been busy doing other things. After this weekend I'll have 
more time.

regarding undo/memento.

The idea is that each memeto provides a bookmark into the history of changes.
All changes are logged by the datamanager so no need for transactions.
You create a memento, which stores copy of original tiles as they are being 
modified.

1) so create memento (it's empty)
2) the user makes a change to a tile
    but first the tile is copied to the memento
3) the user makes another change to the same tile
   nothing is copied to the memento as this has already been done

making an undo is as simple as copying the mementos tiles into the 
datamanager.

This is a difference storing of changes, so get go back in time the mementos 
must be rolled back in reverse order.

hope this explains some

regarding oldValue, and how to fix it. I don't think we'll be able to fix that 
easily, but the questions is if we could change the semantics of oldValue so: 
It returns the value at the time of the previous memento creation. As most of 
the time a memento (through creation of a transaction) has been created 
before doing the iteration this should work as before.

The fix would then be to find the tile in getTile() but then check 
m_currentMemento if the tile exists there, and then return that tile instead.
getTile() should then take an argument like "bool oldvalues"

best regards
Casper Boemann


More information about the kimageshop mailing list