+Gtk::CheckMenuItem*
+RouteTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
+{
+ ParameterMenuMap::iterator i = _main_automation_menu_map.find (param);
+ if (i != _main_automation_menu_map.end()) {
+ return i->second;
+ }
+
+ i = _subplugin_menu_map.find (param);
+ if (i != _subplugin_menu_map.end()) {
+ return i->second;
+ }
+
+ return 0;
+}
+
+void
+RouteTimeAxisView::create_gain_automation_child (const Evoral::Parameter& param, bool show)
+{
+ boost::shared_ptr<AutomationControl> c = _route->gain_control();
+ if (!c) {
+ error << "Route has no gain automation, unable to add automation track view." << endmsg;
+ return;
+ }
+
+ gain_track.reset (new AutomationTimeAxisView (_session,
+ _route, _route->amp(), c, param,
+ _editor,
+ *this,
+ false,
+ parent_canvas,
+ _route->amp()->describe_parameter(param)));
+
+ if (_view) {
+ _view->foreach_regionview (sigc::mem_fun (*gain_track.get(), &TimeAxisView::add_ghost));
+ }
+
+ add_automation_child (Evoral::Parameter(GainAutomation), gain_track, show);
+}
+
+static
+void add_region_to_list (RegionView* rv, RegionList* l)
+{
+ l->push_back (rv->region());
+}
+
+RegionView*
+RouteTimeAxisView::combine_regions ()
+{
+ /* as of may 2011, we do not offer uncombine for MIDI tracks
+ */
+
+ if (!is_audio_track()) {
+ return 0;
+ }
+
+ if (!_view) {
+ return 0;
+ }
+
+ RegionList selected_regions;
+ boost::shared_ptr<Playlist> playlist = track()->playlist();
+
+ _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions));
+
+ if (selected_regions.size() < 2) {
+ return 0;
+ }
+
+ playlist->clear_changes ();
+ boost::shared_ptr<Region> compound_region = playlist->combine (selected_regions);
+
+ _session->add_command (new StatefulDiffCommand (playlist));
+ /* make the new region be selected */
+
+ return _view->find_view (compound_region);
+}
+
+void
+RouteTimeAxisView::uncombine_regions ()
+{
+ /* as of may 2011, we do not offer uncombine for MIDI tracks
+ */
+ if (!is_audio_track()) {
+ return;
+ }
+
+ if (!_view) {
+ return;
+ }
+
+ RegionList selected_regions;
+ boost::shared_ptr<Playlist> playlist = track()->playlist();
+
+ /* have to grab selected regions first because the uncombine is going
+ * to change that in the middle of the list traverse
+ */
+
+ _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions));
+
+ playlist->clear_changes ();
+
+ for (RegionList::iterator i = selected_regions.begin(); i != selected_regions.end(); ++i) {
+ playlist->uncombine (*i);
+ }
+
+ _session->add_command (new StatefulDiffCommand (playlist));
+}
+
+string
+RouteTimeAxisView::state_id() const
+{
+ return string_compose ("rtav %1", _route->id().to_s());
+}
+
+
+void
+RouteTimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> c)
+{
+ TimeAxisView::remove_child (c);
+
+ boost::shared_ptr<AutomationTimeAxisView> a = boost::dynamic_pointer_cast<AutomationTimeAxisView> (c);
+ if (a) {
+ for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
+ if (i->second == a) {
+ _automation_tracks.erase (i);
+ return;
+ }
+ }
+ }