revamping the undo infrastructure in Dia



Hi,

The current state of the Undo/Redo infrastructure in Dia seriously
lacks maintenance. A quick search for "undo" in bugs showed up some
long-standing bugs, fixing which would require a lot of work and some
fresh thinking. Here's a summary, sorted by what I think is more
important:

Bugs that highlight problems in the core:

http://bugzilla.gnome.org/show_bug.cgi?id=318182
Undo does not restore size of automatically resized shapes

http://bugzilla.gnome.org/show_bug.cgi?id=158570
change diagram background colour should be undoable

http://bugzilla.gnome.org/show_bug.cgi?id=488269
properties dialog creates empty undo actions when no properties are changed

Bugs that are just enhancements and/or will get fixed as a side-effect:

http://bugzilla.gnome.org/show_bug.cgi?id=482490
Undo & redo menu labels need detail I.e. "Undo move", "Undo delete"

http://bugzilla.gnome.org/show_bug.cgi?id=488270
properties dialog should have a button to undo all changes made while
interacting with the dialog

And here's my take on how Undo/Redo needs improvement:

1) The _Change struct in app/undo.h should have a facility to track
side-effects. For example, when changing a text-object results in a
resizing of the object, the resize should be recorded as a side-effect
of the main text-related Change.

2) Every function that modifies an object in any way needs to be
tracked down, and rewritten to suitably return a Change object. For
example, there is one place where obj->ops->move() is called simply
with the intention that is best described as
obj->ops->update_yourself_and_report_side_effects().

Also there is a hidden problem with the way the properties dialog
tracks undo history. It records the previous state of _all_ known
properties, whether or not they are changed. This can lead to
scalability problems if we dare to think of huge groups of objects
with a huge list of properties. Also, this cannot handle side-effects
to the object that do not involve properties. For example, changing
the font of a text object changes its size, but this is not tracked by
undo.

This can only be fixed if the Undo/Redo infrastructure guarantees that
side-effects are efficiently handled elsewhere. But the improvements
required for Undo are quite extensive, and would require lots of
planning as well as sufficient blessings from the gods of Dia.

Sameer.
-- 
Research Scholar, Department of CSE, IIT Bombay
http://www.it.iitb.ac.in/~sameerds/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]