diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 6b726775a9..fc08e5a27a 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -44,9 +44,12 @@ #include "evoral/Note.h" #include "evoral/Sequence.h" +namespace PBD { + class HistoryOwner; +} + namespace ARDOUR { -class Session; class MidiSource; class MidiStateTracker; @@ -277,22 +280,22 @@ public: * This STARTS and COMMITS an undo command. * The command will constitute one item on the undo stack. */ - void apply_diff_command_as_commit (Session& session, PBD::Command* cmd); + void apply_diff_command_as_commit (PBD::HistoryOwner&, PBD::Command* cmd); - void apply_diff_command_as_commit (Session* session, PBD::Command* cmd) { if (session) { apply_diff_command_as_commit (*session, cmd); } } + void apply_diff_command_as_commit (PBD::HistoryOwner* history, PBD::Command* cmd) { if (history) { apply_diff_command_as_commit (*history, cmd); } } /** Add a command as part of a larger reversible transaction * * Ownership of cmd is taken, it must not be deleted by the caller. * The command will be incorporated into the current command. */ - void apply_diff_command_as_subcommand (Session& session, PBD::Command* cmd); + void apply_diff_command_as_subcommand (PBD::HistoryOwner&, PBD::Command* cmd); /** Apply the midi diff, but without any effect on undo * * Ownership of cmd is not changed. */ - void apply_diff_command_only (Session& session, PBD::Command* cmd); + void apply_diff_command_only (PBD::Command* cmd); bool sync_to_source (const Source::WriterLock& source_lock); diff --git a/libs/ardour/import_pt.cc b/libs/ardour/import_pt.cc index a0a1dd8f0a..85053149d1 100644 --- a/libs/ardour/import_pt.cc +++ b/libs/ardour/import_pt.cc @@ -466,7 +466,7 @@ no_audio_tracks: /* PT C-2 = 0, Ardour C-1 = 0, subtract twelve to convert ? */ midicmd->add (std::shared_ptr > (new Evoral::Note ((uint8_t)1, start, len, j->note, j->velocity))); } - mm->apply_diff_command_only (*this, midicmd); + mm->apply_diff_command_only (midicmd); delete midicmd; std::shared_ptr copy (RegionFactory::create (mr, true)); playlist->clear_changes (); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 5595f018d8..76a5fa2e05 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -1804,8 +1804,8 @@ LuaBindings::common (lua_State* L) .endClass () .deriveWSPtrClass > ("MidiModel") - .addFunction ("apply_command", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) /* deprecated: left here in case any extant scripts use apply_command */ - .addFunction ("apply_diff_command_as_commit", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) + .addFunction ("apply_command", (void (MidiModel::*)(PBD::HistoryOwner*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) /* deprecated: left here in case any extant scripts use apply_command */ + .addFunction ("apply_diff_command_as_commit", (void (MidiModel::*)(PBD::HistoryOwner*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) .addFunction ("new_note_diff_command", &MidiModel::new_note_diff_command) .addFunction ("new_sysex_diff_command", &MidiModel::new_sysex_diff_command) .addFunction ("new_patch_change_diff_command", &MidiModel::new_patch_change_diff_command) diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index de4f2f1270..3f69842cf2 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -32,6 +32,7 @@ #include "pbd/compose.h" #include "pbd/enumwriter.h" #include "pbd/error.h" +#include "pbd/history_owner.h" #include "evoral/Control.h" @@ -100,24 +101,24 @@ MidiModel::new_patch_change_diff_command (const string& name) void -MidiModel::apply_diff_command_as_commit(Session& session, Command* cmd) +MidiModel::apply_diff_command_as_commit(HistoryOwner& history, Command* cmd) { - session.begin_reversible_command (cmd->name()); + history.begin_reversible_command (cmd->name()); (*cmd)(); - session.commit_reversible_command (cmd); + history.commit_reversible_command (cmd); set_edited (true); } void -MidiModel::apply_diff_command_as_subcommand(Session& session, Command* cmd) +MidiModel::apply_diff_command_as_subcommand (HistoryOwner& history, Command* cmd) { (*cmd)(); - session.add_command (cmd); + history.add_command (cmd); set_edited (true); } void -MidiModel::apply_diff_command_only(Session& session, Command* cmd) +MidiModel::apply_diff_command_only (Command* cmd) { (*cmd)(); set_edited (true);