mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
r183@gandalf: fugalh | 2006-07-17 19:01:39 -0600
Use XMLNode instead of templating memento types. git-svn-id: svn://localhost/ardour2/branches/undo@683 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0bd3b0b670
commit
72168803ee
1 changed files with 9 additions and 4 deletions
|
|
@ -24,13 +24,17 @@
|
||||||
#include <pbd/command.h>
|
#include <pbd/command.h>
|
||||||
#include <sigc++/slot.h>
|
#include <sigc++/slot.h>
|
||||||
|
|
||||||
template <class obj_T, class mem_T>
|
/** This command class is initialized with before and after mementos
|
||||||
|
* (from Stateful::get_state()), so undo becomes restoring the before
|
||||||
|
* memento, and redo is restoring the after memento.
|
||||||
|
*/
|
||||||
|
template <class obj_T>
|
||||||
class MementoCommand : public Command
|
class MementoCommand : public Command
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MementoCommand(obj_T &obj,
|
MementoCommand(obj_T &obj,
|
||||||
mem_T before,
|
XMLNode &before,
|
||||||
mem_T after
|
XMLNode &after
|
||||||
)
|
)
|
||||||
: obj(obj), before(before), after(after) {}
|
: obj(obj), before(before), after(after) {}
|
||||||
void operator() () { obj.set_memento(after); }
|
void operator() () { obj.set_memento(after); }
|
||||||
|
|
@ -41,9 +45,10 @@ class MementoCommand : public Command
|
||||||
// key is "MementoCommand" or something
|
// key is "MementoCommand" or something
|
||||||
// before and after mementos
|
// before and after mementos
|
||||||
}
|
}
|
||||||
|
// TODO does this need a copy constructor?
|
||||||
protected:
|
protected:
|
||||||
obj_T &obj;
|
obj_T &obj;
|
||||||
mem_T before, after;
|
XMLNode &before, &after;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __lib_pbd_memento_h__
|
#endif // __lib_pbd_memento_h__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue