2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <sigc++/bind.h>
30 #include <pbd/error.h>
31 #include <pbd/stl_delete.h>
32 #include <pbd/whitespace.h>
33 #include <pbd/memento_command.h>
35 #include <gtkmm/menu.h>
36 #include <gtkmm/menuitem.h>
37 #include <gtkmm2ext/gtk_ui.h>
38 #include <gtkmm2ext/selector.h>
39 #include <gtkmm2ext/stop_signal.h>
40 #include <gtkmm2ext/bindable_button.h>
41 #include <gtkmm2ext/utils.h>
43 #include <ardour/playlist.h>
44 #include <ardour/audioplaylist.h>
45 #include <ardour/diskstream.h>
46 #include <ardour/processor.h>
47 #include <ardour/ladspa_plugin.h>
48 #include <ardour/location.h>
49 #include <ardour/panner.h>
50 #include <ardour/playlist.h>
51 #include <ardour/session.h>
52 #include <ardour/session_playlist.h>
53 #include <ardour/utils.h>
54 #include <ardour/param_id.h>
56 #include "ardour_ui.h"
57 #include "route_time_axis.h"
58 #include "automation_time_axis.h"
59 #include "processor_automation_time_axis.h"
60 #include "processor_automation_line.h"
61 #include "canvas_impl.h"
62 #include "crossfade_view.h"
64 #include "gui_thread.h"
66 #include "playlist_selector.h"
67 #include "point_selection.h"
69 #include "public_editor.h"
70 #include "region_view.h"
71 #include "rgb_macros.h"
72 #include "selection.h"
73 #include "simplerect.h"
74 #include "streamview.h"
77 #include <ardour/track.h>
81 using namespace ARDOUR;
84 using namespace Editing;
88 RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
90 RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
91 TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
92 parent_canvas (canvas),
94 edit_group_button (_("g")), // group
95 playlist_button (_("p")),
96 size_button (_("h")), // height
97 automation_button (_("a")),
98 visual_button (_("v"))
103 playlist_action_menu = 0;
104 automation_action_menu = 0;
106 timestretch_rect = 0;
109 ignore_toggle = false;
111 edit_group_button.set_name ("TrackGroupButton");
112 playlist_button.set_name ("TrackPlaylistButton");
113 automation_button.set_name ("TrackAutomationButton");
114 size_button.set_name ("TrackSizeButton");
115 visual_button.set_name ("TrackVisualButton");
116 hide_button.set_name ("TrackRemoveButton");
118 hide_button.add (*(manage (new Image (::get_icon("hide")))));
119 hide_button.show_all ();
121 edit_group_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::edit_click), false);
122 playlist_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::playlist_click));
123 automation_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::automation_click));
124 size_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::size_click), false);
125 visual_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::visual_click));
126 hide_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::hide_click));
128 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
129 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release));
130 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
131 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
137 rec_enable_button->remove ();
138 switch (track()->mode()) {
140 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
142 case ARDOUR::Destructive:
143 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
146 rec_enable_button->show_all ();
148 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
149 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
150 controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
151 ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
154 controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
155 controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::FILL|Gtk::EXPAND, 0, 0);
157 controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
159 ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
160 ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
161 ARDOUR_UI::instance()->tooltips().set_tip(edit_group_button,_("Edit Group"));
162 ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height"));
163 ARDOUR_UI::instance()->tooltips().set_tip(playlist_button,_("Playlist"));
164 ARDOUR_UI::instance()->tooltips().set_tip(automation_button, _("Automation"));
165 ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options"));
166 ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track"));
170 controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
171 controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
172 controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
173 controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
175 if (is_track() && track()->mode() == ARDOUR::Normal) {
176 controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
179 /* remove focus from the buttons */
183 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
184 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
185 _route->processors_changed.connect (mem_fun(*this, &RouteTimeAxisView::processors_changed));
186 _route->NameChanged.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed));
187 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
192 track()->TrackModeChanged.connect (mem_fun(*this, &RouteTimeAxisView::track_mode_changed));
193 track()->FreezeChange.connect (mem_fun(*this, &RouteTimeAxisView::map_frozen));
194 track()->DiskstreamChanged.connect (mem_fun(*this, &RouteTimeAxisView::diskstream_changed));
195 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &RouteTimeAxisView::speed_changed));
197 /* pick up the correct freeze state */
202 editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
203 ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
206 RouteTimeAxisView::~RouteTimeAxisView ()
208 GoingAway (); /* EMIT_SIGNAL */
210 vector_delete (&processor_automation_curves);
212 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
217 delete playlist_menu;
221 if (playlist_action_menu) {
222 delete playlist_action_menu;
223 playlist_action_menu = 0;
233 RouteTimeAxisView::post_construct ()
235 /* map current state of the route */
237 update_diskstream_display ();
238 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
239 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
240 reset_processor_automation_curves ();
244 RouteTimeAxisView::set_playlist (boost::shared_ptr<Playlist> newplaylist)
246 boost::shared_ptr<Playlist> pl = playlist();
249 modified_connection.disconnect ();
250 modified_connection = pl->Modified.connect (mem_fun(*this, &RouteTimeAxisView::playlist_modified));
254 RouteTimeAxisView::playlist_modified ()
259 RouteTimeAxisView::set_state (const XMLNode& node)
261 const XMLProperty *prop;
263 TimeAxisView::set_state (node);
265 if ((prop = node.property ("shown_editor")) != 0) {
266 if (prop->value() == "no") {
267 _marked_for_display = false;
269 _marked_for_display = true;
272 _marked_for_display = true;
275 XMLNodeList nlist = node.children();
276 XMLNodeConstIterator niter;
279 _show_automation.clear();
281 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
284 ParamID param(child_node->name());
288 XMLProperty* prop = child_node->property ("shown");
290 if (_automation_tracks.find(param) == _automation_tracks.end())
291 create_automation_child(param);
293 if (prop != 0 && prop->value() == "yes")
294 _show_automation.insert(ParamID(GainAutomation));
297 warning << "GUI info exists, but no parameter " << child_node->name() << " found." << endmsg;
303 RouteTimeAxisView::get_child_xml_node (const string & childname)
305 return RouteUI::get_child_xml_node (childname);
309 RouteTimeAxisView::edit_click (GdkEventButton *ev)
311 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
312 _route->set_edit_group (0, this);
316 using namespace Menu_Helpers;
318 MenuList& items = edit_group_menu.items ();
319 RadioMenuItem::Group group;
322 items.push_back (RadioMenuElem (group, _("No group"),
323 bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
325 if (_route->edit_group() == 0) {
326 static_cast<RadioMenuItem*>(&items.back())->set_active ();
329 _session.foreach_edit_group (bind (mem_fun (*this, &RouteTimeAxisView::add_edit_group_menu_item), &group));
330 edit_group_menu.popup (ev->button, ev->time);
336 RouteTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
338 using namespace Menu_Helpers;
340 MenuList &items = edit_group_menu.items();
342 items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), eg)));
343 if (_route->edit_group() == eg) {
344 static_cast<RadioMenuItem*>(&items.back())->set_active ();
349 RouteTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
351 _route->set_edit_group (eg, this);
355 RouteTimeAxisView::playlist_changed ()
361 set_playlist (get_diskstream()->playlist());
366 RouteTimeAxisView::label_view ()
368 string x = _route->name();
370 if (x != name_entry.get_text()) {
371 name_entry.set_text (x);
374 ARDOUR_UI::instance()->tooltips().set_tip (name_entry, x);
378 RouteTimeAxisView::route_name_changed ()
380 editor.route_name_changed (this);
385 RouteTimeAxisView::take_name_changed (void *src)
394 RouteTimeAxisView::playlist_click ()
396 // always build a new action menu
398 if (playlist_action_menu != 0) {
399 delete playlist_action_menu;
402 playlist_action_menu = new Menu;
403 playlist_action_menu->set_name ("ArdourContextMenu");
405 build_playlist_menu (playlist_action_menu);
406 editor.set_selected_track (*this, Selection::Add);
407 playlist_action_menu->popup (1, gtk_get_current_event_time());
411 RouteTimeAxisView::automation_click ()
413 if (automation_action_menu == 0) {
414 /* this seems odd, but the automation action
415 menu is built as part of the display menu.
417 build_display_menu ();
419 editor.set_selected_track (*this, Selection::Add);
420 automation_action_menu->popup (1, gtk_get_current_event_time());
424 RouteTimeAxisView::build_automation_action_menu ()
426 using namespace Menu_Helpers;
428 automation_action_menu = manage (new Menu);
429 MenuList& automation_items = automation_action_menu->items();
430 automation_action_menu->set_name ("ArdourContextMenu");
432 automation_items.push_back (MenuElem (_("Show all automation"),
433 mem_fun(*this, &RouteTimeAxisView::show_all_automation)));
435 automation_items.push_back (MenuElem (_("Show existing automation"),
436 mem_fun(*this, &RouteTimeAxisView::show_existing_automation)));
438 automation_items.push_back (MenuElem (_("Hide all automation"),
439 mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
441 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
443 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
444 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
446 automation_items.push_back (SeparatorElem());
448 if ( ! i->second->menu_item) {
449 automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param),
450 bind (mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), i->second->param)));
452 i->second->menu_item = static_cast<Gtk::CheckMenuItem*>(&automation_items.back());
455 automation_items.push_back (*i->second->menu_item);
458 i->second->menu_item->set_active(show_automation(i->second->param));
463 RouteTimeAxisView::build_display_menu ()
465 using namespace Menu_Helpers;
467 /* get the size menu ready */
473 TimeAxisView::build_display_menu ();
475 /* now fill it with our stuff */
477 MenuList& items = display_menu->items();
478 display_menu->set_name ("ArdourContextMenu");
480 items.push_back (MenuElem (_("Height"), *size_menu));
481 items.push_back (MenuElem (_("Color"), mem_fun(*this, &RouteTimeAxisView::select_track_color)));
483 items.push_back (SeparatorElem());
485 build_remote_control_menu ();
486 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
488 build_automation_action_menu ();
489 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
491 // Hook for derived classes to add type specific stuff
492 items.push_back (SeparatorElem());
493 append_extra_display_menu_items ();
494 items.push_back (SeparatorElem());
498 Menu* alignment_menu = manage (new Menu);
499 MenuList& alignment_items = alignment_menu->items();
500 alignment_menu->set_name ("ArdourContextMenu");
502 RadioMenuItem::Group align_group;
504 alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
505 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
506 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
507 if (get_diskstream()->alignment_style() == ExistingMaterial)
508 align_existing_item->set_active();
510 alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
511 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
512 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
513 if (get_diskstream()->alignment_style() == CaptureTime)
514 align_capture_item->set_active();
516 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
518 get_diskstream()->AlignmentStyleChanged.connect (
519 mem_fun(*this, &RouteTimeAxisView::align_style_changed));
521 RadioMenuItem::Group mode_group;
522 items.push_back (RadioMenuElem (mode_group, _("Normal mode"),
523 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Normal)));
524 normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
525 items.push_back (RadioMenuElem (mode_group, _("Tape mode"),
526 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Destructive)));
527 destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
530 switch (track()->mode()) {
531 case ARDOUR::Destructive:
532 destructive_track_mode_item->set_active ();
535 normal_track_mode_item->set_active ();
540 items.push_back (SeparatorElem());
541 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
542 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
543 route_active_menu_item->set_active (_route->active());
545 items.push_back (SeparatorElem());
546 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
549 static bool __reset_item (RadioMenuItem* item)
556 RouteTimeAxisView::set_track_mode (TrackMode mode)
559 RadioMenuItem* other_item;
563 item = normal_track_mode_item;
564 other_item = destructive_track_mode_item;
566 case ARDOUR::Destructive:
567 item = destructive_track_mode_item;
568 other_item = normal_track_mode_item;
571 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", mode) << endmsg;
576 if (item->get_active () && track()->mode() != mode) {
577 _set_track_mode (track().get(), mode, other_item);
582 RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem* reset_item)
586 if (!track->can_use_mode (mode, needs_bounce)) {
590 Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), reset_item));
593 cerr << "would bounce this one\n";
598 track->set_mode (mode);
600 rec_enable_button->remove ();
603 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
605 case ARDOUR::Destructive:
606 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
609 rec_enable_button->show_all ();
614 RouteTimeAxisView::track_mode_changed ()
618 switch (track()->mode()) {
620 item = normal_track_mode_item;
622 case ARDOUR::Destructive:
623 item = destructive_track_mode_item;
626 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", track()->mode()) << endmsg;
635 RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end)
641 TimeAxisView::show_timestretch (start, end);
651 /* check that the time selection was made in our route, or our edit group.
652 remember that edit_group() == 0 implies the route is *not* in a edit group.
655 if (!(ts.track == this || (ts.group != 0 && ts.group == _route->edit_group()))) {
656 /* this doesn't apply to us */
660 /* ignore it if our edit group is not active */
662 if ((ts.track != this) && _route->edit_group() && !_route->edit_group()->is_active()) {
667 if (timestretch_rect == 0) {
668 timestretch_rect = new SimpleRect (*canvas_display);
669 timestretch_rect->property_x1() = 0.0;
670 timestretch_rect->property_y1() = 0.0;
671 timestretch_rect->property_x2() = 0.0;
672 timestretch_rect->property_y2() = 0.0;
673 timestretch_rect->property_fill_color_rgba() = Config->canvasvar_TimeStretchFill.get();
674 timestretch_rect->property_outline_color_rgba() = Config->canvasvar_TimeStretchOutline.get();
677 timestretch_rect->show ();
678 timestretch_rect->raise_to_top ();
680 x1 = start / editor.get_current_zoom();
681 x2 = (end - 1) / editor.get_current_zoom();
684 timestretch_rect->property_x1() = x1;
685 timestretch_rect->property_y1() = 1.0;
686 timestretch_rect->property_x2() = x2;
687 timestretch_rect->property_y2() = y2;
691 RouteTimeAxisView::hide_timestretch ()
693 TimeAxisView::hide_timestretch ();
695 if (timestretch_rect) {
696 timestretch_rect->hide ();
701 RouteTimeAxisView::show_selection (TimeSelection& ts)
705 /* ignore it if our edit group is not active or if the selection was started
706 in some other track or edit group (remember that edit_group() == 0 means
707 that the track is not in an edit group).
710 if (((ts.track != this && !is_child (ts.track)) && _route->edit_group() && !_route->edit_group()->is_active()) ||
711 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route->edit_group())))) {
717 TimeAxisView::show_selection (ts);
721 RouteTimeAxisView::set_height (TrackHeight h)
723 bool height_changed = (height == 0) || (h != height_style);
725 TimeAxisView::set_height (h);
730 _view->set_height ((double) height);
733 switch (height_style) {
735 xml_node->add_property ("track_height", "largest");
739 xml_node->add_property ("track_height", "large");
743 xml_node->add_property ("track_height", "larger");
747 xml_node->add_property ("track_height", "normal");
751 xml_node->add_property ("track_height", "smaller");
755 xml_node->add_property ("track_height", "small");
759 switch (height_style) {
769 if (rec_enable_button)
770 rec_enable_button->show();
772 edit_group_button.show();
774 visual_button.show();
776 automation_button.show();
778 if (is_track() && track()->mode() == ARDOUR::Normal) {
779 playlist_button.show();
789 if (rec_enable_button)
790 rec_enable_button->show();
792 edit_group_button.hide ();
794 visual_button.hide ();
796 automation_button.hide ();
798 if (is_track() && track()->mode() == ARDOUR::Normal) {
799 playlist_button.hide ();
809 if (rec_enable_button)
810 rec_enable_button->hide();
812 edit_group_button.hide ();
814 visual_button.hide ();
816 automation_button.hide ();
817 playlist_button.hide ();
818 name_label.set_text (_route->name());
822 if (height_changed) {
823 /* only emit the signal if the height really changed */
824 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
829 RouteTimeAxisView::select_track_color ()
831 if (RouteUI::choose_color ()) {
834 _view->apply_color (_color, StreamView::RegionColor);
840 RouteTimeAxisView::reset_samples_per_unit ()
842 set_samples_per_unit (editor.get_current_zoom());
846 RouteTimeAxisView::set_samples_per_unit (double spu)
850 if (get_diskstream() != 0) {
851 speed = get_diskstream()->speed();
855 _view->set_samples_per_unit (spu * speed);
858 TimeAxisView::set_samples_per_unit (spu * speed);
862 RouteTimeAxisView::align_style_changed ()
864 switch (get_diskstream()->alignment_style()) {
865 case ExistingMaterial:
866 if (!align_existing_item->get_active()) {
867 align_existing_item->set_active();
871 if (!align_capture_item->get_active()) {
872 align_capture_item->set_active();
879 RouteTimeAxisView::set_align_style (AlignStyle style)
884 case ExistingMaterial:
885 item = align_existing_item;
888 item = align_capture_item;
891 fatal << string_compose (_("programming error: %1 %2"), "illegal align style in RouteTimeAxisView::set_align_style", style) << endmsg;
896 if (item->get_active()) {
897 get_diskstream()->set_align_style (style);
902 RouteTimeAxisView::rename_current_playlist ()
904 ArdourPrompter prompter (true);
907 boost::shared_ptr<Diskstream> ds = get_diskstream();
908 if (!ds || ds->destructive())
911 boost::shared_ptr<Playlist> pl = ds->playlist();
915 prompter.set_prompt (_("Name for playlist"));
916 prompter.set_initial_text (pl->name());
917 prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
918 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
920 switch (prompter.run ()) {
921 case Gtk::RESPONSE_ACCEPT:
922 prompter.get_result (name);
934 RouteTimeAxisView::use_copy_playlist (bool prompt)
938 boost::shared_ptr<Diskstream> ds = get_diskstream();
939 if (!ds || ds->destructive())
942 boost::shared_ptr<const Playlist> pl = ds->playlist();
949 name = Playlist::bump_name (name, _session);
950 } while (_session.playlist_by_name(name));
952 // TODO: The prompter "new" button should be de-activated if the user
953 // specifies a playlist name which already exists in the session.
957 ArdourPrompter prompter (true);
959 prompter.set_prompt (_("Name for Playlist"));
960 prompter.set_initial_text (name);
961 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
962 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
963 prompter.show_all ();
965 switch (prompter.run ()) {
966 case Gtk::RESPONSE_ACCEPT:
967 prompter.get_result (name);
976 ds->use_copy_playlist ();
977 ds->playlist()->set_name (name);
982 RouteTimeAxisView::use_new_playlist (bool prompt)
986 boost::shared_ptr<Diskstream> ds = get_diskstream();
987 if (!ds || ds->destructive())
990 boost::shared_ptr<const Playlist> pl = ds->playlist();
997 name = Playlist::bump_name (name, _session);
998 } while (_session.playlist_by_name(name));
1003 ArdourPrompter prompter (true);
1005 prompter.set_prompt (_("Name for Playlist"));
1006 prompter.set_initial_text (name);
1007 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
1008 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
1010 switch (prompter.run ()) {
1011 case Gtk::RESPONSE_ACCEPT:
1012 prompter.get_result (name);
1020 if (name.length()) {
1021 ds->use_new_playlist ();
1022 ds->playlist()->set_name (name);
1027 RouteTimeAxisView::clear_playlist ()
1029 boost::shared_ptr<Diskstream> ds = get_diskstream();
1030 if (!ds || ds->destructive())
1033 boost::shared_ptr<Playlist> pl = ds->playlist();
1037 editor.clear_playlist (pl);
1041 RouteTimeAxisView::speed_changed ()
1043 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
1047 RouteTimeAxisView::diskstream_changed ()
1049 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::update_diskstream_display));
1053 RouteTimeAxisView::update_diskstream_display ()
1055 if (!get_diskstream()) // bus
1058 set_playlist (get_diskstream()->playlist());
1063 RouteTimeAxisView::selection_click (GdkEventButton* ev)
1065 if (Keyboard::modifier_state_equals (ev->state, (Keyboard::Shift|Keyboard::Control))) {
1067 /* special case: select/deselect all tracks */
1068 if (editor.get_selection().selected (this)) {
1069 editor.get_selection().clear_tracks ();
1071 editor.select_all_tracks ();
1077 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route->edit_group());
1079 switch (Keyboard::selection_type (ev->state)) {
1080 case Selection::Toggle:
1081 editor.get_selection().toggle (*tracks);
1084 case Selection::Set:
1085 editor.get_selection().set (*tracks);
1088 case Selection::Extend:
1089 if (tracks->size() > 1) {
1090 /* add each one, do not "extend" */
1091 editor.get_selection().add (*tracks);
1093 /* extend to the single track */
1094 editor.extend_selection_to_track (*tracks->front());
1098 case Selection::Add:
1099 editor.get_selection().add (*tracks);
1107 RouteTimeAxisView::set_selected_points (PointSelection& points)
1109 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1110 (*i)->set_selected_points (points);
1115 RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
1118 _view->set_selected_regionviews (regions);
1122 /** Add the selectable things that we have to a list.
1123 * @param results List to add things to.
1126 RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
1130 if (get_diskstream() != 0) {
1131 speed = get_diskstream()->speed();
1134 nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1135 nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1137 if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
1138 _view->get_selectables (start_adjusted, end_adjusted, results);
1141 /* pick up visible automation tracks */
1143 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1144 if (!(*i)->hidden()) {
1145 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1151 RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1154 _view->get_inverted_selectables (sel, results);
1157 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1158 if (!(*i)->hidden()) {
1159 (*i)->get_inverted_selectables (sel, results);
1167 RouteTimeAxisView::show_automation(ParamID param)
1169 return (_show_automation.find(param) != _show_automation.end());
1172 /** Retuns NULL if track for \a param doesn't exist.
1174 RouteTimeAxisView::RouteAutomationNode*
1175 RouteTimeAxisView::automation_track(ParamID param)
1177 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
1179 if (i != _automation_tracks.end())
1185 /** Shorthand for GainAutomation, etc.
1187 RouteTimeAxisView::RouteAutomationNode*
1188 RouteTimeAxisView::automation_track(AutomationType type)
1190 return automation_track(ParamID(type));
1194 RouteTimeAxisView::edit_group() const
1196 return _route->edit_group();
1200 RouteTimeAxisView::name() const
1202 return _route->name();
1205 boost::shared_ptr<Playlist>
1206 RouteTimeAxisView::playlist () const
1208 boost::shared_ptr<Diskstream> ds;
1210 if ((ds = get_diskstream()) != 0) {
1211 return ds->playlist();
1213 return boost::shared_ptr<Playlist> ();
1218 RouteTimeAxisView::name_entry_changed ()
1222 x = name_entry.get_text ();
1224 if (x == _route->name()) {
1228 strip_whitespace_edges(x);
1230 if (x.length() == 0) {
1231 name_entry.set_text (_route->name());
1235 if (_session.route_name_unique (x)) {
1236 _route->set_name (x);
1238 ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
1239 name_entry.set_text (_route->name());
1244 RouteTimeAxisView::visual_click ()
1246 popup_display_menu (0);
1250 RouteTimeAxisView::hide_click ()
1252 // LAME fix for hide_button refresh fix
1253 hide_button.set_sensitive(false);
1255 editor.hide_track_in_display (*this);
1257 hide_button.set_sensitive(true);
1260 boost::shared_ptr<Region>
1261 RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir)
1263 boost::shared_ptr<Diskstream> stream;
1264 boost::shared_ptr<Playlist> playlist;
1266 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1267 return playlist->find_next_region (pos, point, dir);
1270 return boost::shared_ptr<Region> ();
1274 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1276 boost::shared_ptr<Playlist> what_we_got;
1277 boost::shared_ptr<Diskstream> ds = get_diskstream();
1278 boost::shared_ptr<Playlist> playlist;
1282 /* route is a bus, not a track */
1286 playlist = ds->playlist();
1288 TimeSelection time (selection.time);
1289 float speed = ds->speed();
1290 if (speed != 1.0f) {
1291 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1292 (*i).start = session_frame_to_track_frame((*i).start, speed);
1293 (*i).end = session_frame_to_track_frame((*i).end, speed);
1297 XMLNode &before = playlist->get_state();
1300 if ((what_we_got = playlist->cut (time)) != 0) {
1301 editor.get_cut_buffer().add (what_we_got);
1302 _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
1307 if ((what_we_got = playlist->copy (time)) != 0) {
1308 editor.get_cut_buffer().add (what_we_got);
1313 if ((what_we_got = playlist->cut (time)) != 0) {
1314 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1315 what_we_got->release ();
1325 RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size_t nth)
1331 boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist();
1332 PlaylistSelection::iterator p;
1334 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1336 if (p == selection.playlists.end()) {
1340 if (get_diskstream()->speed() != 1.0f)
1341 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1343 XMLNode &before = playlist->get_state();
1344 playlist->paste (*p, pos, times);
1345 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1352 RouteTimeAxisView::get_child_list()
1354 list<TimeAxisView*> redirect_children;
1356 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1357 if (!(*i)->hidden()) {
1358 redirect_children.push_back(*i);
1361 return redirect_children;
1366 RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1368 using namespace Menu_Helpers;
1370 if (!menu || !is_track()) {
1374 MenuList& playlist_items = menu->items();
1375 menu->set_name ("ArdourContextMenu");
1376 playlist_items.clear();
1378 if (playlist_menu) {
1379 delete playlist_menu;
1382 playlist_menu = new Menu;
1383 playlist_menu->set_name ("ArdourContextMenu");
1385 vector<boost::shared_ptr<Playlist> > playlists;
1386 boost::shared_ptr<Diskstream> ds = get_diskstream();
1387 RadioMenuItem::Group playlist_group;
1389 _session.get_playlists (playlists);
1391 for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
1393 if ((*i)->get_orig_diskstream_id() == ds->id()) {
1394 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1395 boost::weak_ptr<Playlist> (*i))));
1397 if (ds->playlist()->id() == (*i)->id()) {
1398 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1400 } else if (ds->playlist()->id() == (*i)->id()) {
1401 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1402 boost::weak_ptr<Playlist>(*i))));
1403 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1408 playlist_items.push_back (SeparatorElem());
1409 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
1410 playlist_items.push_back (SeparatorElem());
1412 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1413 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1414 playlist_items.push_back (SeparatorElem());
1415 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1416 playlist_items.push_back (SeparatorElem());
1418 playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector)));
1422 RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl)
1424 assert (is_track());
1426 boost::shared_ptr<Playlist> pl (wpl.lock());
1432 boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
1435 get_diskstream()->use_playlist (apl);
1440 RouteTimeAxisView::show_playlist_selector ()
1442 editor.playlist_selector().show_for (this);
1446 RouteTimeAxisView::map_frozen ()
1452 ENSURE_GUI_THREAD (mem_fun(*this, &RouteTimeAxisView::map_frozen));
1454 switch (track()->freeze_state()) {
1456 playlist_button.set_sensitive (false);
1457 rec_enable_button->set_sensitive (false);
1460 playlist_button.set_sensitive (true);
1461 rec_enable_button->set_sensitive (true);
1467 RouteTimeAxisView::color_handler ()
1469 //case cTimeStretchOutline:
1470 if (timestretch_rect) {
1471 timestretch_rect->property_outline_color_rgba() = Config->canvasvar_TimeStretchOutline.get();
1473 //case cTimeStretchFill:
1474 if (timestretch_rect) {
1475 timestretch_rect->property_fill_color_rgba() = Config->canvasvar_TimeStretchFill.get();
1481 RouteTimeAxisView::toggle_automation_track (ParamID param)
1483 RouteAutomationNode* node = automation_track(param);
1488 bool showit = node->menu_item->get_active();
1490 if (showit != node->track->marked_for_display()) {
1492 node->track->set_marked_for_display (true);
1493 node->track->canvas_display->show();
1494 node->track->get_state_node()->add_property ("shown", X_("yes"));
1496 node->track->set_marked_for_display (false);
1497 node->track->hide ();
1498 node->track->get_state_node()->add_property ("shown", X_("no"));
1501 /* now trigger a redisplay */
1504 _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1510 RouteTimeAxisView::automation_track_hidden (ParamID param)
1512 RouteAutomationNode* ran = automation_track(param);
1516 _show_automation.erase(param);
1517 ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
1519 if (ran->menu_item && !_hidden) {
1520 ran->menu_item->set_active (false);
1523 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1528 RouteTimeAxisView::show_all_automation ()
1532 /* Show our automation */
1534 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
1535 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1536 i->second->track->set_marked_for_display (true);
1537 i->second->track->canvas_display->show();
1538 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1539 i->second->menu_item->set_active(true);
1543 /* Show processor automation */
1545 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1546 for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1547 if ((*ii)->view == 0) {
1548 add_processor_automation_curve ((*i)->processor, (*ii)->what);
1551 (*ii)->menu_item->set_active (true);
1560 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1564 RouteTimeAxisView::show_existing_automation ()
1568 /* Show our automation */
1570 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
1571 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1572 // FIXME: only shown if /first/ line has points
1573 if (!i->second->track->lines.empty() && i->second->track->lines[0].first->npoints() > 0) {
1574 i->second->track->set_marked_for_display (true);
1575 i->second->track->canvas_display->show();
1576 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1577 i->second->menu_item->set_active(true);
1582 /* Show processor automation */
1584 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1585 for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1586 if ((*ii)->view != 0) {
1587 (*ii)->menu_item->set_active (true);
1594 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1598 RouteTimeAxisView::hide_all_automation ()
1602 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1603 for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1604 (*ii)->menu_item->set_active (false);
1609 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1614 RouteTimeAxisView::region_view_added (RegionView* rv)
1616 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1617 AutomationTimeAxisView* atv;
1619 if ((atv = dynamic_cast<AutomationTimeAxisView*> (*i)) != 0) {
1620 rv->add_ghost (*atv);
1626 RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, AutomationTimeAxisView* atv)
1628 rv->add_ghost (*atv);
1631 RouteTimeAxisView::InsertAutomationInfo::~InsertAutomationInfo ()
1633 for (vector<InsertAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1639 RouteTimeAxisView::InsertAutomationNode::~InsertAutomationNode ()
1641 parent.remove_ran (this);
1649 RouteTimeAxisView::remove_ran (InsertAutomationNode* ran)
1652 remove_child (ran->view);
1656 RouteTimeAxisView::InsertAutomationNode*
1657 RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, ParamID what)
1659 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1661 if ((*i)->processor == processor) {
1663 for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1664 if ((*ii)->what == what) {
1675 legalize_for_xml_node (string str)
1677 string::size_type pos;
1678 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1684 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1685 legal.replace (pos, 1, "_");
1694 RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what)
1696 ProcessorAutomationLine* ral;
1698 InsertAutomationNode* ran;
1700 if ((ran = find_processor_automation_node (processor, what)) == 0) {
1701 fatal << _("programming error: ")
1702 << string_compose (X_("processor automation curve for %1:%2 not registered with track!"),
1703 processor->name(), what)
1713 name = processor->describe_parameter (what);
1715 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1719 char state_name[256];
1720 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
1722 ran->view = new ProcessorAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *processor, state_name);
1724 ral = new ProcessorAutomationLine (name,
1725 *processor, *ran->view, *ran->view->canvas_display,
1726 processor->control (what, true)->list());
1728 ral->set_line_color (Config->canvasvar_ProcessorAutomationLine.get());
1729 ral->queue_reset ();
1731 ran->view->add_line (*ral);
1733 ran->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), ran, processor));
1735 if (!ran->view->marked_for_display()) {
1738 ran->menu_item->set_active (true);
1741 add_child (ran->view);
1744 _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), ran->view));
1747 processor->mark_automation_visible (what, true);
1751 RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::InsertAutomationNode* ran, boost::shared_ptr<Processor> i)
1754 ran->menu_item->set_active (false);
1757 i->mark_automation_visible (ran->what, false);
1759 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1763 RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor)
1766 ProcessorAutomationLine *ral;
1768 processor->what_has_visible_automation (s);
1770 for (set<ParamID>::iterator i = s.begin(); i != s.end(); ++i) {
1772 if ((ral = find_processor_automation_curve (processor, *i)) != 0) {
1773 ral->queue_reset ();
1775 add_processor_automation_curve (processor, (*i));
1781 RouteTimeAxisView::add_automation_child(ParamID param, AutomationTimeAxisView* track)
1783 using namespace Menu_Helpers;
1789 track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
1791 bool hideit = false;
1795 if ((node = track->get_state_node()) != 0) {
1796 if ((prop = node->property ("shown")) != 0) {
1797 if (prop->value() == "yes") {
1803 _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track)));
1808 _show_automation.insert(param);
1809 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1812 build_automation_action_menu();
1817 RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor> processor)
1819 using namespace Menu_Helpers;
1820 InsertAutomationInfo *rai;
1821 list<InsertAutomationInfo*>::iterator x;
1823 const std::set<ParamID>& automatable = processor->what_can_be_automated ();
1824 std::set<ParamID> has_visible_automation;
1826 processor->what_has_visible_automation(has_visible_automation);
1828 if (automatable.empty()) {
1832 for (x = processor_automation.begin(); x != processor_automation.end(); ++x) {
1833 if ((*x)->processor == processor) {
1838 if (x == processor_automation.end()) {
1840 rai = new InsertAutomationInfo (processor);
1841 processor_automation.push_back (rai);
1849 /* any older menu was deleted at the top of processors_changed()
1850 when we cleared the subplugin menu.
1853 rai->menu = manage (new Menu);
1854 MenuList& items = rai->menu->items();
1855 rai->menu->set_name ("ArdourContextMenu");
1859 for (std::set<ParamID>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1861 InsertAutomationNode* ran;
1862 CheckMenuItem* mitem;
1864 string name = processor->describe_parameter (*i);
1866 items.push_back (CheckMenuElem (name));
1867 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1869 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1870 mitem->set_active(true);
1873 if ((ran = find_processor_automation_node (processor, *i)) == 0) {
1877 ran = new InsertAutomationNode (*i, mitem, *this);
1879 rai->lines.push_back (ran);
1883 ran->menu_item = mitem;
1887 mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, ran));
1890 /* add the menu for this processor, because the subplugin
1891 menu is always cleared at the top of processors_changed().
1892 this is the result of some poor design in gtkmm and/or
1896 subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu));
1901 RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo* rai,
1902 RouteTimeAxisView::InsertAutomationNode* ran)
1904 bool showit = ran->menu_item->get_active();
1905 bool redraw = false;
1907 if (ran->view == 0 && showit) {
1908 add_processor_automation_curve (rai->processor, ran->what);
1912 if (showit != ran->view->marked_for_display()) {
1915 ran->view->set_marked_for_display (true);
1916 ran->view->canvas_display->show();
1918 rai->processor->mark_automation_visible (ran->what, true);
1919 ran->view->set_marked_for_display (false);
1927 if (redraw && !no_redraw) {
1929 /* now trigger a redisplay */
1931 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1937 RouteTimeAxisView::processors_changed ()
1939 using namespace Menu_Helpers;
1941 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1942 (*i)->valid = false;
1945 subplugin_menu.items().clear ();
1947 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
1948 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
1950 for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ) {
1952 list<InsertAutomationInfo*>::iterator tmp;
1960 processor_automation.erase (i);
1967 /* change in visibility was possible */
1969 _route->gui_changed ("track_height", this);
1972 ProcessorAutomationLine *
1973 RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what)
1975 InsertAutomationNode* ran;
1977 if ((ran = find_processor_automation_node (processor, what)) != 0) {
1979 return dynamic_cast<ProcessorAutomationLine*> (ran->view->lines.front().first);
1987 RouteTimeAxisView::reset_processor_automation_curves ()
1989 for (vector<ProcessorAutomationLine*>::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) {
1995 RouteTimeAxisView::update_rec_display ()
1997 RouteUI::update_rec_display ();
1998 name_entry.set_sensitive (!_route->record_enabled());