Generate undo record for crossfade edits, and provide signalling to update the view...
authorCarl Hetherington <carl@carlh.net>
Mon, 28 Jun 2010 02:40:09 +0000 (02:40 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 28 Jun 2010 02:40:09 +0000 (02:40 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7309 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/crossfade_edit.cc
gtk2_ardour/crossfade_view.cc
gtk2_ardour/crossfade_view.h
gtk2_ardour/editor.cc
libs/ardour/ardour/crossfade.h
libs/ardour/crossfade.cc

index 382f6afd09b114b5ad0392a39f64811d03ae3751..43a1c741df33694e1e787724efcc63dfe97ffc45 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <libgnomecanvasmm/line.h>
 
+#include "pbd/memento_command.h"
 #include "ardour/automation_list.h"
 #include "evoral/Curve.hpp"
 #include "ardour/crossfade.h"
@@ -783,7 +784,14 @@ CrossfadeEditor::apply_preset (Preset *preset)
 void
 CrossfadeEditor::apply ()
 {
+       _session->begin_reversible_command (_("Edit crossfade"));
+
+       XMLNode& before = xfade->get_state ();
+
        _apply_to (xfade);
+
+       _session->add_command (new MementoCommand<Crossfade> (*xfade.get(), &before, &xfade->get_state()));
+       _session->commit_reversible_command ();
 }
 
 void
index 4743c87ce4d237f649351d43387927ef330410ae..f77f8db44283cfb906b6f84cef307afb8da6798a 100644 (file)
@@ -84,6 +84,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
        crossfade_changed (all_crossfade_properties);
 
        crossfade->PropertyChanged.connect (*this, invalidator (*this), ui_bind (&CrossfadeView::crossfade_changed, this, _1), gui_context());
+       crossfade->FadesChanged.connect (*this, invalidator (*this), ui_bind (&CrossfadeView::crossfade_fades_changed, this), gui_context());
        ColorsChanged.connect (sigc::mem_fun (*this, &CrossfadeView::color_handler));
 }
 
@@ -261,3 +262,9 @@ CrossfadeView::fake_hide ()
 {
        group->hide();
 }
+
+void
+CrossfadeView::crossfade_fades_changed ()
+{
+       redraw_curves ();
+}
index 6bda06999d5ee3dfac0cc681b8ba4b204526754b..db1d33fdf81163e653698942b26cf7c23ac473c6 100644 (file)
@@ -72,6 +72,7 @@ struct CrossfadeView : public TimeAxisViewItem
     ArdourCanvas::Item *active_button;
 
     void crossfade_changed (const PBD::PropertyChange&);
+    void crossfade_fades_changed ();
     void active_changed ();
     void redraw_curves ();
     void color_handler ();
index 3181ea0728a222f8b04b9cbdfa973ca50fcf9130..8f1d259df447d30c90ae4602e809170ef7c6d7cd 100644 (file)
@@ -1646,7 +1646,7 @@ Editor::add_crossfade_context_items (AudioStreamView* /*view*/, boost::shared_pt
        }
 
        items.push_back (MenuElem (str, sigc::bind (sigc::mem_fun(*this, &Editor::toggle_xfade_active), boost::weak_ptr<Crossfade> (xfade))));
-       items.push_back (MenuElem (_("Edit"), sigc::bind (sigc::mem_fun(*this, &Editor::edit_xfade), boost::weak_ptr<Crossfade> (xfade))));
+       items.push_back (MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun(*this, &Editor::edit_xfade), boost::weak_ptr<Crossfade> (xfade))));
 
        if (xfade->can_follow_overlap()) {
 
index 7b5ac28379dbde18f1acd60e6bab16eca808710d..4c75a0226be3b4ee088d84e9339b409c9c74f259 100644 (file)
@@ -142,6 +142,9 @@ class Crossfade : public ARDOUR::AudioRegion
        static framecnt_t short_xfade_length() { return _short_xfade_length; }
        static void set_short_xfade_length (framecnt_t n);
 
+       /** emitted when the actual fade curves change, as opposed to one of the Stateful properties */
+       PBD::Signal0<void> FadesChanged;
+
   private:
        friend struct CrossfadeComparePtr;
        friend class AudioPlaylist;
index 276a42f77ba4b4cf16415060578f21b9c2f71f76..40857bd56afa5c45fab13f6022904c4213ed5eb8 100644 (file)
@@ -865,6 +865,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
        _fade_out.thaw ();
 
        PropertyChanged (what_changed); /* EMIT SIGNAL */
+       FadesChanged (); /* EMIT SIGNAL */
 
        return 0;
 }