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/parameter.h>
56 #include "ardour_ui.h"
57 #include "route_time_axis.h"
58 #include "automation_time_axis.h"
59 #include "canvas_impl.h"
60 #include "crossfade_view.h"
62 #include "gui_thread.h"
64 #include "playlist_selector.h"
65 #include "point_selection.h"
67 #include "public_editor.h"
68 #include "region_view.h"
69 #include "rgb_macros.h"
70 #include "selection.h"
71 #include "simplerect.h"
72 #include "streamview.h"
75 #include <ardour/track.h>
79 using namespace ARDOUR;
82 using namespace Editing;
86 RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
88 RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
89 TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
90 parent_canvas (canvas),
92 edit_group_button (_("g")), // group
93 playlist_button (_("p")),
94 size_button (_("h")), // height
95 automation_button (_("a")),
96 visual_button (_("v"))
101 playlist_action_menu = 0;
102 automation_action_menu = 0;
104 timestretch_rect = 0;
107 ignore_toggle = false;
109 edit_group_button.set_name ("TrackGroupButton");
110 playlist_button.set_name ("TrackPlaylistButton");
111 automation_button.set_name ("TrackAutomationButton");
112 size_button.set_name ("TrackSizeButton");
113 visual_button.set_name ("TrackVisualButton");
114 hide_button.set_name ("TrackRemoveButton");
116 hide_button.add (*(manage (new Image (::get_icon("hide")))));
117 hide_button.show_all ();
119 edit_group_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::edit_click), false);
120 playlist_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::playlist_click));
121 automation_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::automation_click));
122 size_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::size_click), false);
123 visual_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::visual_click));
124 hide_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::hide_click));
126 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
127 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release));
128 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
129 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
135 rec_enable_button->remove ();
136 switch (track()->mode()) {
138 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
140 case ARDOUR::Destructive:
141 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
144 rec_enable_button->show_all ();
146 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
147 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
148 controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
149 ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
152 controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
153 controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::FILL|Gtk::EXPAND, 0, 0);
155 controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
157 ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
158 ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
159 ARDOUR_UI::instance()->tooltips().set_tip(edit_group_button,_("Edit Group"));
160 ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height"));
161 ARDOUR_UI::instance()->tooltips().set_tip(playlist_button,_("Playlist"));
162 ARDOUR_UI::instance()->tooltips().set_tip(automation_button, _("Automation"));
163 ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options"));
164 ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track"));
168 controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
169 controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
170 controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
171 controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
173 if (is_track() && track()->mode() == ARDOUR::Normal) {
174 controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
177 /* remove focus from the buttons */
181 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
182 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
183 _route->processors_changed.connect (mem_fun(*this, &RouteTimeAxisView::processors_changed));
184 _route->NameChanged.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed));
185 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
190 track()->TrackModeChanged.connect (mem_fun(*this, &RouteTimeAxisView::track_mode_changed));
191 track()->FreezeChange.connect (mem_fun(*this, &RouteTimeAxisView::map_frozen));
192 track()->DiskstreamChanged.connect (mem_fun(*this, &RouteTimeAxisView::diskstream_changed));
193 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &RouteTimeAxisView::speed_changed));
195 /* pick up the correct freeze state */
200 editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
201 ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
204 RouteTimeAxisView::~RouteTimeAxisView ()
206 GoingAway (); /* EMIT_SIGNAL */
208 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
213 delete playlist_menu;
217 if (playlist_action_menu) {
218 delete playlist_action_menu;
219 playlist_action_menu = 0;
229 RouteTimeAxisView::post_construct ()
231 /* map current state of the route */
233 update_diskstream_display ();
234 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
235 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
236 reset_processor_automation_curves ();
240 RouteTimeAxisView::set_playlist (boost::shared_ptr<Playlist> newplaylist)
242 boost::shared_ptr<Playlist> pl = playlist();
245 modified_connection.disconnect ();
246 modified_connection = pl->Modified.connect (mem_fun(*this, &RouteTimeAxisView::playlist_modified));
250 RouteTimeAxisView::playlist_modified ()
255 RouteTimeAxisView::set_state (const XMLNode& node)
257 const XMLProperty *prop;
259 TimeAxisView::set_state (node);
261 if ((prop = node.property ("shown_editor")) != 0) {
262 if (prop->value() == "no") {
263 _marked_for_display = false;
265 _marked_for_display = true;
268 _marked_for_display = true;
271 XMLNodeList nlist = node.children();
272 XMLNodeConstIterator niter;
275 _show_automation.clear();
277 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
280 if (child_node->name() != AutomationTimeAxisView::state_node_name)
283 XMLProperty* prop = child_node->property ("automation-id");
287 Parameter param(prop->value());
293 prop = child_node->property ("shown");
295 if (prop && prop->value() == "yes") {
297 _show_automation.insert(param);
300 if (_automation_tracks.find(param) == _automation_tracks.end())
301 create_automation_child(param, show);
306 RouteTimeAxisView::get_automation_child_xml_node (Parameter param)
308 return RouteUI::get_automation_child_xml_node (param);
312 RouteTimeAxisView::edit_click (GdkEventButton *ev)
314 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
315 _route->set_edit_group (0, this);
319 using namespace Menu_Helpers;
321 MenuList& items = edit_group_menu.items ();
322 RadioMenuItem::Group group;
325 items.push_back (RadioMenuElem (group, _("No group"),
326 bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
328 if (_route->edit_group() == 0) {
329 static_cast<RadioMenuItem*>(&items.back())->set_active ();
332 _session.foreach_edit_group (bind (mem_fun (*this, &RouteTimeAxisView::add_edit_group_menu_item), &group));
333 edit_group_menu.popup (ev->button, ev->time);
339 RouteTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
341 using namespace Menu_Helpers;
343 MenuList &items = edit_group_menu.items();
345 items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), eg)));
346 if (_route->edit_group() == eg) {
347 static_cast<RadioMenuItem*>(&items.back())->set_active ();
352 RouteTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
354 _route->set_edit_group (eg, this);
358 RouteTimeAxisView::playlist_changed ()
364 set_playlist (get_diskstream()->playlist());
369 RouteTimeAxisView::label_view ()
371 string x = _route->name();
373 if (x != name_entry.get_text()) {
374 name_entry.set_text (x);
377 ARDOUR_UI::instance()->tooltips().set_tip (name_entry, x);
381 RouteTimeAxisView::route_name_changed ()
383 editor.route_name_changed (this);
388 RouteTimeAxisView::take_name_changed (void *src)
397 RouteTimeAxisView::playlist_click ()
399 // always build a new action menu
401 if (playlist_action_menu != 0) {
402 delete playlist_action_menu;
405 playlist_action_menu = new Menu;
406 playlist_action_menu->set_name ("ArdourContextMenu");
408 build_playlist_menu (playlist_action_menu);
409 editor.set_selected_track (*this, Selection::Add);
410 playlist_action_menu->popup (1, gtk_get_current_event_time());
414 RouteTimeAxisView::automation_click ()
416 if (automation_action_menu == 0) {
417 /* this seems odd, but the automation action
418 menu is built as part of the display menu.
420 build_display_menu ();
422 editor.set_selected_track (*this, Selection::Add);
423 automation_action_menu->popup (1, gtk_get_current_event_time());
427 RouteTimeAxisView::build_automation_action_menu ()
429 using namespace Menu_Helpers;
431 automation_action_menu = manage (new Menu);
432 MenuList& automation_items = automation_action_menu->items();
433 automation_action_menu->set_name ("ArdourContextMenu");
435 automation_items.push_back (MenuElem (_("Show all automation"),
436 mem_fun(*this, &RouteTimeAxisView::show_all_automation)));
438 automation_items.push_back (MenuElem (_("Show existing automation"),
439 mem_fun(*this, &RouteTimeAxisView::show_existing_automation)));
441 automation_items.push_back (MenuElem (_("Hide all automation"),
442 mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
444 if (subplugin_menu.get_parent())
445 subplugin_menu.detach();
447 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
449 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
450 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
452 automation_items.push_back (SeparatorElem());
454 if (i->second->menu_item)
455 delete i->second->menu_item;
457 automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param),
458 bind (mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), i->second->param)));
460 i->second->menu_item = static_cast<Gtk::CheckMenuItem*>(&automation_items.back());
462 i->second->menu_item->set_active(show_automation(i->second->param));
463 //i->second->menu_item->set_active(false);
468 RouteTimeAxisView::build_display_menu ()
470 using namespace Menu_Helpers;
472 /* get the size menu ready */
478 TimeAxisView::build_display_menu ();
480 /* now fill it with our stuff */
482 MenuList& items = display_menu->items();
483 display_menu->set_name ("ArdourContextMenu");
485 items.push_back (MenuElem (_("Height"), *size_menu));
486 items.push_back (MenuElem (_("Color"), mem_fun(*this, &RouteTimeAxisView::select_track_color)));
488 items.push_back (SeparatorElem());
490 build_remote_control_menu ();
491 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
493 build_automation_action_menu ();
494 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
496 // Hook for derived classes to add type specific stuff
497 items.push_back (SeparatorElem());
498 append_extra_display_menu_items ();
499 items.push_back (SeparatorElem());
503 Menu* alignment_menu = manage (new Menu);
504 MenuList& alignment_items = alignment_menu->items();
505 alignment_menu->set_name ("ArdourContextMenu");
507 RadioMenuItem::Group align_group;
509 alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
510 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
511 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
512 if (get_diskstream()->alignment_style() == ExistingMaterial)
513 align_existing_item->set_active();
515 alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
516 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
517 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
518 if (get_diskstream()->alignment_style() == CaptureTime)
519 align_capture_item->set_active();
521 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
523 get_diskstream()->AlignmentStyleChanged.connect (
524 mem_fun(*this, &RouteTimeAxisView::align_style_changed));
526 RadioMenuItem::Group mode_group;
527 items.push_back (RadioMenuElem (mode_group, _("Normal mode"),
528 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Normal)));
529 normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
530 items.push_back (RadioMenuElem (mode_group, _("Tape mode"),
531 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Destructive)));
532 destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
535 switch (track()->mode()) {
536 case ARDOUR::Destructive:
537 destructive_track_mode_item->set_active ();
540 normal_track_mode_item->set_active ();
545 items.push_back (SeparatorElem());
546 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
547 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
548 route_active_menu_item->set_active (_route->active());
550 items.push_back (SeparatorElem());
551 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
554 static bool __reset_item (RadioMenuItem* item)
561 RouteTimeAxisView::set_track_mode (TrackMode mode)
564 RadioMenuItem* other_item;
568 item = normal_track_mode_item;
569 other_item = destructive_track_mode_item;
571 case ARDOUR::Destructive:
572 item = destructive_track_mode_item;
573 other_item = normal_track_mode_item;
576 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", mode) << endmsg;
581 if (item->get_active () && track()->mode() != mode) {
582 _set_track_mode (track().get(), mode, other_item);
587 RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem* reset_item)
591 if (!track->can_use_mode (mode, needs_bounce)) {
595 Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), reset_item));
598 cerr << "would bounce this one\n";
603 track->set_mode (mode);
605 rec_enable_button->remove ();
608 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
610 case ARDOUR::Destructive:
611 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
614 rec_enable_button->show_all ();
619 RouteTimeAxisView::track_mode_changed ()
623 switch (track()->mode()) {
625 item = normal_track_mode_item;
627 case ARDOUR::Destructive:
628 item = destructive_track_mode_item;
631 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", track()->mode()) << endmsg;
640 RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end)
646 TimeAxisView::show_timestretch (start, end);
656 /* check that the time selection was made in our route, or our edit group.
657 remember that edit_group() == 0 implies the route is *not* in a edit group.
660 if (!(ts.track == this || (ts.group != 0 && ts.group == _route->edit_group()))) {
661 /* this doesn't apply to us */
665 /* ignore it if our edit group is not active */
667 if ((ts.track != this) && _route->edit_group() && !_route->edit_group()->is_active()) {
672 if (timestretch_rect == 0) {
673 timestretch_rect = new SimpleRect (*canvas_display);
674 timestretch_rect->property_x1() = 0.0;
675 timestretch_rect->property_y1() = 0.0;
676 timestretch_rect->property_x2() = 0.0;
677 timestretch_rect->property_y2() = 0.0;
678 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
679 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
682 timestretch_rect->show ();
683 timestretch_rect->raise_to_top ();
685 x1 = start / editor.get_current_zoom();
686 x2 = (end - 1) / editor.get_current_zoom();
689 timestretch_rect->property_x1() = x1;
690 timestretch_rect->property_y1() = 1.0;
691 timestretch_rect->property_x2() = x2;
692 timestretch_rect->property_y2() = y2;
696 RouteTimeAxisView::hide_timestretch ()
698 TimeAxisView::hide_timestretch ();
700 if (timestretch_rect) {
701 timestretch_rect->hide ();
706 RouteTimeAxisView::show_selection (TimeSelection& ts)
710 /* ignore it if our edit group is not active or if the selection was started
711 in some other track or edit group (remember that edit_group() == 0 means
712 that the track is not in an edit group).
715 if (((ts.track != this && !is_child (ts.track)) && _route->edit_group() && !_route->edit_group()->is_active()) ||
716 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route->edit_group())))) {
722 TimeAxisView::show_selection (ts);
726 RouteTimeAxisView::set_height (TrackHeight h)
728 bool height_changed = (height == 0) || (h != height_style);
730 TimeAxisView::set_height (h);
735 _view->set_height ((double) height);
738 switch (height_style) {
740 xml_node->add_property ("track_height", "largest");
744 xml_node->add_property ("track_height", "large");
748 xml_node->add_property ("track_height", "larger");
752 xml_node->add_property ("track_height", "normal");
756 xml_node->add_property ("track_height", "smaller");
760 xml_node->add_property ("track_height", "small");
764 switch (height_style) {
774 if (rec_enable_button)
775 rec_enable_button->show();
777 edit_group_button.show();
779 visual_button.show();
781 automation_button.show();
783 if (is_track() && track()->mode() == ARDOUR::Normal) {
784 playlist_button.show();
794 if (rec_enable_button)
795 rec_enable_button->show();
797 edit_group_button.hide ();
799 visual_button.hide ();
801 automation_button.hide ();
803 if (is_track() && track()->mode() == ARDOUR::Normal) {
804 playlist_button.hide ();
814 if (rec_enable_button)
815 rec_enable_button->hide();
817 edit_group_button.hide ();
819 visual_button.hide ();
821 automation_button.hide ();
822 playlist_button.hide ();
823 name_label.set_text (_route->name());
827 if (height_changed) {
828 /* only emit the signal if the height really changed */
829 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
834 RouteTimeAxisView::select_track_color ()
836 if (RouteUI::choose_color ()) {
839 _view->apply_color (_color, StreamView::RegionColor);
845 RouteTimeAxisView::reset_samples_per_unit ()
847 set_samples_per_unit (editor.get_current_zoom());
851 RouteTimeAxisView::set_samples_per_unit (double spu)
855 if (get_diskstream() != 0) {
856 speed = get_diskstream()->speed();
860 _view->set_samples_per_unit (spu * speed);
863 TimeAxisView::set_samples_per_unit (spu * speed);
867 RouteTimeAxisView::align_style_changed ()
869 switch (get_diskstream()->alignment_style()) {
870 case ExistingMaterial:
871 if (!align_existing_item->get_active()) {
872 align_existing_item->set_active();
876 if (!align_capture_item->get_active()) {
877 align_capture_item->set_active();
884 RouteTimeAxisView::set_align_style (AlignStyle style)
889 case ExistingMaterial:
890 item = align_existing_item;
893 item = align_capture_item;
896 fatal << string_compose (_("programming error: %1 %2"), "illegal align style in RouteTimeAxisView::set_align_style", style) << endmsg;
901 if (item->get_active()) {
902 get_diskstream()->set_align_style (style);
907 RouteTimeAxisView::rename_current_playlist ()
909 ArdourPrompter prompter (true);
912 boost::shared_ptr<Diskstream> ds = get_diskstream();
913 if (!ds || ds->destructive())
916 boost::shared_ptr<Playlist> pl = ds->playlist();
920 prompter.set_prompt (_("Name for playlist"));
921 prompter.set_initial_text (pl->name());
922 prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
923 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
925 switch (prompter.run ()) {
926 case Gtk::RESPONSE_ACCEPT:
927 prompter.get_result (name);
939 RouteTimeAxisView::use_copy_playlist (bool prompt)
943 boost::shared_ptr<Diskstream> ds = get_diskstream();
944 if (!ds || ds->destructive())
947 boost::shared_ptr<const Playlist> pl = ds->playlist();
954 name = Playlist::bump_name (name, _session);
955 } while (_session.playlist_by_name(name));
957 // TODO: The prompter "new" button should be de-activated if the user
958 // specifies a playlist name which already exists in the session.
962 ArdourPrompter prompter (true);
964 prompter.set_prompt (_("Name for Playlist"));
965 prompter.set_initial_text (name);
966 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
967 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
968 prompter.show_all ();
970 switch (prompter.run ()) {
971 case Gtk::RESPONSE_ACCEPT:
972 prompter.get_result (name);
981 ds->use_copy_playlist ();
982 ds->playlist()->set_name (name);
987 RouteTimeAxisView::use_new_playlist (bool prompt)
991 boost::shared_ptr<Diskstream> ds = get_diskstream();
992 if (!ds || ds->destructive())
995 boost::shared_ptr<const Playlist> pl = ds->playlist();
1002 name = Playlist::bump_name (name, _session);
1003 } while (_session.playlist_by_name(name));
1008 ArdourPrompter prompter (true);
1010 prompter.set_prompt (_("Name for Playlist"));
1011 prompter.set_initial_text (name);
1012 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
1013 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
1015 switch (prompter.run ()) {
1016 case Gtk::RESPONSE_ACCEPT:
1017 prompter.get_result (name);
1025 if (name.length()) {
1026 ds->use_new_playlist ();
1027 ds->playlist()->set_name (name);
1032 RouteTimeAxisView::clear_playlist ()
1034 boost::shared_ptr<Diskstream> ds = get_diskstream();
1035 if (!ds || ds->destructive())
1038 boost::shared_ptr<Playlist> pl = ds->playlist();
1042 editor.clear_playlist (pl);
1046 RouteTimeAxisView::speed_changed ()
1048 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
1052 RouteTimeAxisView::diskstream_changed ()
1054 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::update_diskstream_display));
1058 RouteTimeAxisView::update_diskstream_display ()
1060 if (!get_diskstream()) // bus
1063 set_playlist (get_diskstream()->playlist());
1068 RouteTimeAxisView::selection_click (GdkEventButton* ev)
1070 if (Keyboard::modifier_state_equals (ev->state, (Keyboard::Shift|Keyboard::Control))) {
1072 /* special case: select/deselect all tracks */
1073 if (editor.get_selection().selected (this)) {
1074 editor.get_selection().clear_tracks ();
1076 editor.select_all_tracks ();
1082 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route->edit_group());
1084 switch (Keyboard::selection_type (ev->state)) {
1085 case Selection::Toggle:
1086 editor.get_selection().toggle (*tracks);
1089 case Selection::Set:
1090 editor.get_selection().set (*tracks);
1093 case Selection::Extend:
1094 if (tracks->size() > 1) {
1095 /* add each one, do not "extend" */
1096 editor.get_selection().add (*tracks);
1098 /* extend to the single track */
1099 editor.extend_selection_to_track (*tracks->front());
1103 case Selection::Add:
1104 editor.get_selection().add (*tracks);
1112 RouteTimeAxisView::set_selected_points (PointSelection& points)
1114 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1115 (*i)->set_selected_points (points);
1120 RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
1123 _view->set_selected_regionviews (regions);
1127 /** Add the selectable things that we have to a list.
1128 * @param results List to add things to.
1131 RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
1135 if (get_diskstream() != 0) {
1136 speed = get_diskstream()->speed();
1139 nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1140 nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1142 if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
1143 _view->get_selectables (start_adjusted, end_adjusted, results);
1146 /* pick up visible automation tracks */
1148 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1149 if (!(*i)->hidden()) {
1150 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1156 RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1159 _view->get_inverted_selectables (sel, results);
1162 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1163 if (!(*i)->hidden()) {
1164 (*i)->get_inverted_selectables (sel, results);
1172 RouteTimeAxisView::show_automation(Parameter param)
1174 return (_show_automation.find(param) != _show_automation.end());
1177 /** Retuns NULL if track for \a param doesn't exist.
1179 RouteTimeAxisView::RouteAutomationNode*
1180 RouteTimeAxisView::automation_track(Parameter param)
1182 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
1184 if (i != _automation_tracks.end())
1190 /** Shorthand for GainAutomation, etc.
1192 RouteTimeAxisView::RouteAutomationNode*
1193 RouteTimeAxisView::automation_track(AutomationType type)
1195 return automation_track(Parameter(type));
1199 RouteTimeAxisView::edit_group() const
1201 return _route->edit_group();
1205 RouteTimeAxisView::name() const
1207 return _route->name();
1210 boost::shared_ptr<Playlist>
1211 RouteTimeAxisView::playlist () const
1213 boost::shared_ptr<Diskstream> ds;
1215 if ((ds = get_diskstream()) != 0) {
1216 return ds->playlist();
1218 return boost::shared_ptr<Playlist> ();
1223 RouteTimeAxisView::name_entry_changed ()
1227 x = name_entry.get_text ();
1229 if (x == _route->name()) {
1233 strip_whitespace_edges(x);
1235 if (x.length() == 0) {
1236 name_entry.set_text (_route->name());
1240 if (_session.route_name_unique (x)) {
1241 _route->set_name (x);
1243 ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
1244 name_entry.set_text (_route->name());
1249 RouteTimeAxisView::visual_click ()
1251 popup_display_menu (0);
1255 RouteTimeAxisView::hide_click ()
1257 // LAME fix for hide_button refresh fix
1258 hide_button.set_sensitive(false);
1260 editor.hide_track_in_display (*this);
1262 hide_button.set_sensitive(true);
1265 boost::shared_ptr<Region>
1266 RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir)
1268 boost::shared_ptr<Diskstream> stream;
1269 boost::shared_ptr<Playlist> playlist;
1271 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1272 return playlist->find_next_region (pos, point, dir);
1275 return boost::shared_ptr<Region> ();
1279 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1281 boost::shared_ptr<Playlist> what_we_got;
1282 boost::shared_ptr<Diskstream> ds = get_diskstream();
1283 boost::shared_ptr<Playlist> playlist;
1287 /* route is a bus, not a track */
1291 playlist = ds->playlist();
1293 TimeSelection time (selection.time);
1294 float speed = ds->speed();
1295 if (speed != 1.0f) {
1296 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1297 (*i).start = session_frame_to_track_frame((*i).start, speed);
1298 (*i).end = session_frame_to_track_frame((*i).end, speed);
1302 XMLNode &before = playlist->get_state();
1305 if ((what_we_got = playlist->cut (time)) != 0) {
1306 editor.get_cut_buffer().add (what_we_got);
1307 _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
1312 if ((what_we_got = playlist->copy (time)) != 0) {
1313 editor.get_cut_buffer().add (what_we_got);
1318 if ((what_we_got = playlist->cut (time)) != 0) {
1319 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1320 what_we_got->release ();
1330 RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size_t nth)
1336 boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist();
1337 PlaylistSelection::iterator p;
1339 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1341 if (p == selection.playlists.end()) {
1345 if (get_diskstream()->speed() != 1.0f)
1346 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1348 XMLNode &before = playlist->get_state();
1349 playlist->paste (*p, pos, times);
1350 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1356 TimeAxisView::Children
1357 RouteTimeAxisView::get_child_list()
1359 TimeAxisView::Children redirect_children;
1361 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1362 if (!(*i)->hidden()) {
1363 redirect_children.push_back(*i);
1366 return redirect_children;
1371 RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1373 using namespace Menu_Helpers;
1375 if (!menu || !is_track()) {
1379 MenuList& playlist_items = menu->items();
1380 menu->set_name ("ArdourContextMenu");
1381 playlist_items.clear();
1383 if (playlist_menu) {
1384 delete playlist_menu;
1387 playlist_menu = new Menu;
1388 playlist_menu->set_name ("ArdourContextMenu");
1390 vector<boost::shared_ptr<Playlist> > playlists;
1391 boost::shared_ptr<Diskstream> ds = get_diskstream();
1392 RadioMenuItem::Group playlist_group;
1394 _session.get_playlists (playlists);
1396 for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
1398 if ((*i)->get_orig_diskstream_id() == ds->id()) {
1399 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1400 boost::weak_ptr<Playlist> (*i))));
1402 if (ds->playlist()->id() == (*i)->id()) {
1403 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1405 } else if (ds->playlist()->id() == (*i)->id()) {
1406 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1407 boost::weak_ptr<Playlist>(*i))));
1408 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1413 playlist_items.push_back (SeparatorElem());
1414 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
1415 playlist_items.push_back (SeparatorElem());
1417 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1418 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1419 playlist_items.push_back (SeparatorElem());
1420 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1421 playlist_items.push_back (SeparatorElem());
1423 playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector)));
1427 RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl)
1429 assert (is_track());
1431 boost::shared_ptr<Playlist> pl (wpl.lock());
1437 boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
1440 get_diskstream()->use_playlist (apl);
1445 RouteTimeAxisView::show_playlist_selector ()
1447 editor.playlist_selector().show_for (this);
1451 RouteTimeAxisView::map_frozen ()
1457 ENSURE_GUI_THREAD (mem_fun(*this, &RouteTimeAxisView::map_frozen));
1459 switch (track()->freeze_state()) {
1461 playlist_button.set_sensitive (false);
1462 rec_enable_button->set_sensitive (false);
1465 playlist_button.set_sensitive (true);
1466 rec_enable_button->set_sensitive (true);
1472 RouteTimeAxisView::color_handler ()
1474 //case cTimeStretchOutline:
1475 if (timestretch_rect) {
1476 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
1478 //case cTimeStretchFill:
1479 if (timestretch_rect) {
1480 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
1486 RouteTimeAxisView::toggle_automation_track (Parameter param)
1488 RouteAutomationNode* node = automation_track(param);
1493 bool showit = node->menu_item->get_active();
1495 if (showit != node->track->marked_for_display()) {
1497 node->track->set_marked_for_display (true);
1498 node->track->canvas_display->show();
1499 node->track->get_state_node()->add_property ("shown", X_("yes"));
1501 node->track->set_marked_for_display (false);
1502 node->track->hide ();
1503 node->track->get_state_node()->add_property ("shown", X_("no"));
1506 /* now trigger a redisplay */
1509 _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1515 RouteTimeAxisView::automation_track_hidden (Parameter param)
1517 RouteAutomationNode* ran = automation_track(param);
1521 _show_automation.erase(param);
1522 ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
1524 if (ran->menu_item && !_hidden) {
1525 ran->menu_item->set_active (false);
1528 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1533 RouteTimeAxisView::show_all_automation ()
1537 /* Show our automation */
1539 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
1540 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1541 i->second->track->set_marked_for_display (true);
1542 i->second->track->canvas_display->show();
1543 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1544 i->second->menu_item->set_active(true);
1548 /* Show processor automation */
1550 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1551 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1552 if ((*ii)->view == 0) {
1553 add_processor_automation_curve ((*i)->processor, (*ii)->what);
1556 (*ii)->menu_item->set_active (true);
1565 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1569 RouteTimeAxisView::show_existing_automation ()
1573 /* Show our automation */
1575 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
1576 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1577 if (i->second->track->line() && i->second->track->line()->npoints() > 0) {
1578 i->second->track->set_marked_for_display (true);
1579 i->second->track->canvas_display->show();
1580 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1581 i->second->menu_item->set_active(true);
1586 /* Show processor automation */
1588 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1589 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1590 if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) {
1591 (*ii)->menu_item->set_active (true);
1598 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1602 RouteTimeAxisView::hide_all_automation ()
1606 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1607 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1608 (*ii)->menu_item->set_active (false);
1612 _show_automation.clear();
1615 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1620 RouteTimeAxisView::region_view_added (RegionView* rv)
1622 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1623 boost::shared_ptr<AutomationTimeAxisView> atv;
1625 if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) {
1626 rv->add_ghost (*atv.get());
1632 RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, boost::shared_ptr<AutomationTimeAxisView> atv)
1634 rv->add_ghost (*atv.get());
1637 RouteTimeAxisView::ProcessorAutomationInfo::~ProcessorAutomationInfo ()
1639 for (vector<ProcessorAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1645 RouteTimeAxisView::ProcessorAutomationNode::~ProcessorAutomationNode ()
1647 parent.remove_processor_automation_node (this);
1651 RouteTimeAxisView::remove_processor_automation_node (ProcessorAutomationNode* pan)
1654 remove_child (pan->view);
1658 RouteTimeAxisView::ProcessorAutomationNode*
1659 RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, Parameter what)
1661 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1663 if ((*i)->processor == processor) {
1665 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1666 if ((*ii)->what == what) {
1677 legalize_for_xml_node (string str)
1679 string::size_type pos;
1680 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1686 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1687 legal.replace (pos, 1, "_");
1696 RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
1699 ProcessorAutomationNode* pan;
1701 if ((pan = find_processor_automation_node (processor, what)) == 0) {
1702 fatal << _("programming error: ")
1703 << string_compose (X_("processor automation curve for %1:%2 not registered with track!"),
1704 processor->name(), what)
1714 name = processor->describe_parameter (what);
1716 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1720 char state_name[256];
1721 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
1723 boost::shared_ptr<AutomationControl> control = processor->control(what, true);
1725 pan->view = boost::shared_ptr<AutomationTimeAxisView>(
1726 new AutomationTimeAxisView (_session, _route, processor, control,
1727 editor, *this, parent_canvas, name, state_name));
1729 pan->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), pan, processor));
1731 if (!pan->view->marked_for_display()) {
1734 pan->menu_item->set_active (true);
1737 add_child (pan->view);
1740 _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), pan->view));
1743 processor->mark_automation_visible (what, true);
1747 RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::ProcessorAutomationNode* pan, boost::shared_ptr<Processor> i)
1750 pan->menu_item->set_active (false);
1753 i->mark_automation_visible (pan->what, false);
1755 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1759 RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor)
1762 boost::shared_ptr<AutomationLine> al;
1764 processor->what_has_visible_automation (s);
1766 for (set<Parameter>::iterator i = s.begin(); i != s.end(); ++i) {
1768 if ((al = find_processor_automation_curve (processor, *i)) != 0) {
1771 add_processor_automation_curve (processor, (*i));
1777 RouteTimeAxisView::add_automation_child(Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show)
1779 using namespace Menu_Helpers;
1785 track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
1787 bool hideit = (!show);
1791 if ((node = track->get_state_node()) != 0) {
1792 if ((prop = node->property ("shown")) != 0) {
1793 if (prop->value() == "yes") {
1799 _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track)));
1804 _show_automation.insert(param);
1805 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1808 build_display_menu();
1813 RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor> processor)
1815 using namespace Menu_Helpers;
1816 ProcessorAutomationInfo *rai;
1817 list<ProcessorAutomationInfo*>::iterator x;
1819 const std::set<Parameter>& automatable = processor->what_can_be_automated ();
1820 std::set<Parameter> has_visible_automation;
1822 processor->what_has_visible_automation(has_visible_automation);
1824 if (automatable.empty()) {
1828 for (x = processor_automation.begin(); x != processor_automation.end(); ++x) {
1829 if ((*x)->processor == processor) {
1834 if (x == processor_automation.end()) {
1836 rai = new ProcessorAutomationInfo (processor);
1837 processor_automation.push_back (rai);
1845 /* any older menu was deleted at the top of processors_changed()
1846 when we cleared the subplugin menu.
1849 rai->menu = manage (new Menu);
1850 MenuList& items = rai->menu->items();
1851 rai->menu->set_name ("ArdourContextMenu");
1855 for (std::set<Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1857 ProcessorAutomationNode* pan;
1858 CheckMenuItem* mitem;
1860 string name = processor->describe_parameter (*i);
1862 items.push_back (CheckMenuElem (name));
1863 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1865 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1866 mitem->set_active(true);
1869 if ((pan = find_processor_automation_node (processor, *i)) == 0) {
1873 pan = new ProcessorAutomationNode (*i, mitem, *this);
1875 rai->lines.push_back (pan);
1879 pan->menu_item = mitem;
1883 mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, pan));
1886 /* add the menu for this processor, because the subplugin
1887 menu is always cleared at the top of processors_changed().
1888 this is the result of some poor design in gtkmm and/or
1892 subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu));
1897 RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo* rai,
1898 RouteTimeAxisView::ProcessorAutomationNode* pan)
1900 bool showit = pan->menu_item->get_active();
1901 bool redraw = false;
1903 if (pan->view == 0 && showit) {
1904 add_processor_automation_curve (rai->processor, pan->what);
1908 if (pan->view && showit != pan->view->marked_for_display()) {
1911 pan->view->set_marked_for_display (true);
1912 pan->view->canvas_display->show();
1914 rai->processor->mark_automation_visible (pan->what, true);
1915 pan->view->set_marked_for_display (false);
1923 if (redraw && !no_redraw) {
1925 /* now trigger a redisplay */
1927 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1933 RouteTimeAxisView::processors_changed ()
1935 using namespace Menu_Helpers;
1937 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1938 (*i)->valid = false;
1941 subplugin_menu.items().clear ();
1943 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
1944 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
1946 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ) {
1948 list<ProcessorAutomationInfo*>::iterator tmp;
1956 processor_automation.erase (i);
1963 /* change in visibility was possible */
1965 _route->gui_changed ("track_height", this);
1968 boost::shared_ptr<AutomationLine>
1969 RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
1971 ProcessorAutomationNode* pan;
1973 if ((pan = find_processor_automation_node (processor, what)) != 0) {
1979 return boost::shared_ptr<AutomationLine>();
1983 RouteTimeAxisView::reset_processor_automation_curves ()
1985 for (ProcessorAutomationCurves::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) {
1991 RouteTimeAxisView::update_rec_display ()
1993 RouteUI::update_rec_display ();
1994 name_entry.set_sensitive (!_route->record_enabled());