summaryrefslogtreecommitdiff
path: root/gtk2_ardour/audio_region_editor.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-02 18:05:26 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-02 18:05:26 +0000
commit17088ee3ea5af1e6174b098bb5bcfdaec6ebf9b0 (patch)
treecbf9fe8fb94212f9a50c6b760ebaac3b4a1bcec6 /gtk2_ardour/audio_region_editor.cc
parenta5ab2e99e19d5f5d4c1f91f38cd774fefdf257dc (diff)
(1) remove most uses of MementoCommand for Playlist and Region (2) move frozen state from Region into Stateful, renamed "suspend property changes" (3) successive changes to a Property (scalar) after clear_history() do not keep resetting the old value (fixes region trim)
git-svn-id: svn://localhost/ardour2/branches/3.0@6720 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_region_editor.cc')
-rw-r--r--gtk2_ardour/audio_region_editor.cc26
1 files changed, 11 insertions, 15 deletions
diff --git a/gtk2_ardour/audio_region_editor.cc b/gtk2_ardour/audio_region_editor.cc
index e246c04391..adbb1e04ea 100644
--- a/gtk2_ardour/audio_region_editor.cc
+++ b/gtk2_ardour/audio_region_editor.cc
@@ -18,6 +18,7 @@
*/
#include "pbd/memento_command.h"
+#include "pbd/stateful_diff_command.h"
#include "ardour/session.h"
#include "ardour/audioregion.h"
@@ -256,10 +257,9 @@ AudioRegionEditor::position_clock_changed ()
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
- XMLNode &before = pl->get_state();
+ _region->clear_history ();
_region->set_position (position_clock.current_time(), this);
- XMLNode &after = pl->get_state();
- _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new StatefulDiffCommand (_region));
}
_session->commit_reversible_command ();
@@ -273,10 +273,9 @@ AudioRegionEditor::end_clock_changed ()
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
- XMLNode &before = pl->get_state();
+ _region->clear_history ();
_region->trim_end (end_clock.current_time(), this);
- XMLNode &after = pl->get_state();
- _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new StatefulDiffCommand (_region));
}
_session->commit_reversible_command ();
@@ -294,10 +293,9 @@ AudioRegionEditor::length_clock_changed ()
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
- XMLNode &before = pl->get_state();
+ _region->clear_history ();
_region->trim_end (_region->position() + frames - 1, this);
- XMLNode &after = pl->get_state();
- _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+ _session->add_command(new StatefulDiffCommand (_region));
}
_session->commit_reversible_command ();
@@ -404,10 +402,9 @@ AudioRegionEditor::sync_offset_absolute_clock_changed ()
{
_session->begin_reversible_command (_("change region sync point"));
- XMLNode& before = _region->get_state ();
+ _region->clear_history ();
_region->set_sync_position (sync_offset_absolute_clock.current_time());
- XMLNode& after = _region->get_state ();
- _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+ _session->add_command (new StatefulDiffCommand (_region));
_session->commit_reversible_command ();
}
@@ -417,10 +414,9 @@ AudioRegionEditor::sync_offset_relative_clock_changed ()
{
_session->begin_reversible_command (_("change region sync point"));
- XMLNode& before = _region->get_state ();
+ _region->clear_history ();
_region->set_sync_position (sync_offset_relative_clock.current_time() + _region->position ());
- XMLNode& after = _region->get_state ();
- _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+ _session->add_command (new StatefulDiffCommand (_region));
_session->commit_reversible_command ();
}