Generate undo record for crossfade edits, and provide signalling to update the view when such things are undone. Partially fixes #3257.

git-svn-id: svn://localhost/ardour2/branches/3.0@7309 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-06-28 02:40:09 +00:00
parent c8e07653da
commit ed19559ece
6 changed files with 21 additions and 1 deletions

View 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

View 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 ();
}

View 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 ();

View 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()) {

View 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;

View 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;
}