From 555c7ac094d86a02b7bef85f9691cd507e19391e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 9 Dec 2010 21:36:31 +0000 Subject: Undo for sys-ex movements in time. git-svn-id: svn://localhost/ardour2/branches/3.0@8232 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_model.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'libs/ardour/ardour/midi_model.h') diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 69dc452b62..532d8c0e94 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -140,6 +140,38 @@ public: NotePtr unmarshal_note(XMLNode *xml_note); }; + /* Currently this class only supports changes of sys-ex time, but could be expanded */ + class SysexDiffCommand : public DiffCommand { + public: + SysexDiffCommand (boost::shared_ptr m, const XMLNode& node); + + enum Property { + Time, + }; + + int set_state (const XMLNode&, int version); + XMLNode & get_state (); + + void operator() (); + void undo (); + + void change (boost::shared_ptr >, TimeType); + + private: + struct Change { + boost::shared_ptr > sysex; + SysexDiffCommand::Property property; + TimeType old_time; + TimeType new_time; + }; + + typedef std::list ChangeList; + ChangeList _changes; + + XMLNode & marshal_change (const Change &); + Change unmarshal_change (XMLNode *); + }; + MidiModel::NoteDiffCommand* new_note_diff_command (const std::string name="midi edit"); void apply_command (Session& session, Command* cmd); void apply_command_as_subcommand (Session& session, Command* cmd); @@ -161,6 +193,7 @@ public: boost::shared_ptr > find_note (NotePtr); boost::shared_ptr > find_note (gint note_id); + boost::shared_ptr > find_sysex (gint); InsertMergePolicy insert_merge_policy () const; void set_insert_merge_policy (InsertMergePolicy); -- cgit v1.2.3