summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_region_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-14 12:27:37 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-14 12:27:37 +0000
commit66062a85b6388b28ed04f90bab3d302eec0f2a77 (patch)
tree89c1ea74a896e60e14143bc6e3dde867eac42c48 /gtk2_ardour/automation_region_view.cc
parent5ce47b52da7bb60b5b7dde94ca0bacc6ae44197a (diff)
Fix binding of automation list undo records to MIDI sources. Should fix the remainder of #3203.
git-svn-id: svn://localhost/ardour2/branches/3.0@7411 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_region_view.cc')
-rw-r--r--gtk2_ardour/automation_region_view.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 9f3d169dde..feb40c3ddf 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -22,10 +22,13 @@
#include "ardour/event_type_map.h"
#include "ardour/session.h"
#include "ardour/source.h"
+#include "ardour/midi_automation_list_binder.h"
+#include "ardour/midi_region.h"
#include "automation_region_view.h"
#include "gui_thread.h"
#include "public_editor.h"
+#include "midi_automation_line.h"
#include "i18n.h"
@@ -71,9 +74,12 @@ AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
void
AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> list)
{
- _line = boost::shared_ptr<AutomationLine>(new AutomationLine(
+ _line = boost::shared_ptr<AutomationLine> (new MidiAutomationLine(
ARDOUR::EventTypeMap::instance().to_symbol(list->parameter()),
- trackview, *get_canvas_group(), list, &_time_converter));
+ trackview, *get_canvas_group(), list,
+ boost::dynamic_pointer_cast<ARDOUR::MidiRegion> (_region),
+ _parameter,
+ &_time_converter));
_line->set_colors();
_line->set_height ((uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE));
_line->show();
@@ -130,8 +136,15 @@ AutomationRegionView::add_automation_event (GdkEvent *, nframes_t when, double y
_line->the_list()->add (when_d, y);
XMLNode& after = _line->the_list()->get_state();
- view->session()->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
- *_line->the_list(), &before, &after));
+
+ /* XXX: hack! */
+ boost::shared_ptr<ARDOUR::MidiRegion> mr = boost::dynamic_pointer_cast<ARDOUR::MidiRegion> (_region);
+ assert (mr);
+
+ view->session()->commit_reversible_command (
+ new MementoCommand<ARDOUR::AutomationList> (new ARDOUR::MidiAutomationListBinder (mr->midi_source(), _parameter), &before, &after)
+ );
+
view->session()->set_dirty ();
}