Comment by btown
9 years ago
Musescore (open-source music notation software) uses this pattern, for those interested... but not in a particularly DRY or stable way (so much duplicated logic!). I'm sure other open-source examples exist, but this should give you an idea:
https://github.com/musescore/MuseScore/blob/master/libmscore...
https://github.com/musescore/MuseScore/blob/master/libmscore...
https://github.com/musescore/MuseScore/blob/c4af0c22bc90a6ba...
Here's how I do it (interestingly, on a Qt-based art software too :p )
https://github.com/OSSIA/score/blob/master/base/lib/core/com...
https://github.com/OSSIA/score/blob/master/base/plugins/scor...
https://github.com/OSSIA/score/blob/master/base/plugins/scor...
https://github.com/OSSIA/score/blob/master/base/plugins/scor...
Also once your commands are serialized you can send them over the network for distributed edition
http://gameprogrammingpatterns.com/command.html