Alexander Larsson wrote:
> 
> On 6 Jun 1999, Lars R.Clausen wrote:
> > Alexander, what thoughts have you made about the undo functionality?  I
> > could see how the properties settings would be one of the more difficult
> > parts of that.
> 
> Yes, this is the hardest part of undo.

some notes from a lurker:

I'd implement properties as nested styles (name value pairs). You could
pass changed values along through the tree of objects so that every selected
object can query the value and see *itself* whether it applies to it or not.
So you would write a function for each object type (class) which tests out
of a given set of changes (such as constructed with a property dialog) whether
the intersection with its own styles is non zero.

> I've pushed the undo stuff into the future for too long, maybe it's time
> to do now, before too much objects are written. Many objects will probably
> need to be changed for this.
> 
> Let's discuss the implementation (with multi-object-properties setting
> on our mind too). It was a long time since i thought about this last time,
> but i'll try to remeber what i thought then.

Hmm, there is the Memento pattern which looks pretty good for this kind of
functionality. For example you could for every state-change let the changed
objects insert a 'Memento' into a list. It would contain state change info
you would need to reproduce the last state from the current. To undo n steps
you'd simply have to reverse apply the last n Mementos from the list to it's
originators to recover the global state. You could set the list size ('history')
to an appropriate value from a config file and then let it do the job.

In this approach you delegate the responsability for defining 'state changes'
to the individual objects rather then handling it centrally. Every function
acting on an object (method in C++) would have to evaluate whether it mutates
the object's state and if so cause the object to create a Memento...

Regards,        Stefan

_______________________________________________________              
              
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: [EMAIL PROTECTED]

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...

Reply via email to