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 Parameter param(child_node->name());
284 XMLProperty* prop = child_node->property ("shown");
286 if (_automation_tracks.find(param) == _automation_tracks.end())
287 create_automation_child(param);
289 if (prop != 0 && prop->value() == "yes")
290 _show_automation.insert(Parameter(GainAutomation));
293 warning << "GUI info exists, but no parameter " << child_node->name() << " found." << endmsg;
299 RouteTimeAxisView::get_child_xml_node (const string & childname)
301 return RouteUI::get_child_xml_node (childname);
305 RouteTimeAxisView::edit_click (GdkEventButton *ev)
307 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
308 _route->set_edit_group (0, this);
312 using namespace Menu_Helpers;
314 MenuList& items = edit_group_menu.items ();
315 RadioMenuItem::Group group;
318 items.push_back (RadioMenuElem (group, _("No group"),
319 bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
321 if (_route->edit_group() == 0) {
322 static_cast<RadioMenuItem*>(&items.back())->set_active ();
325 _session.foreach_edit_group (bind (mem_fun (*this, &RouteTimeAxisView::add_edit_group_menu_item), &group));
326 edit_group_menu.popup (ev->button, ev->time);
332 RouteTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
334 using namespace Menu_Helpers;
336 MenuList &items = edit_group_menu.items();
338 items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), eg)));
339 if (_route->edit_group() == eg) {
340 static_cast<RadioMenuItem*>(&items.back())->set_active ();
345 RouteTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
347 _route->set_edit_group (eg, this);
351 RouteTimeAxisView::playlist_changed ()
357 set_playlist (get_diskstream()->playlist());
362 RouteTimeAxisView::label_view ()
364 string x = _route->name();
366 if (x != name_entry.get_text()) {
367 name_entry.set_text (x);
370 ARDOUR_UI::instance()->tooltips().set_tip (name_entry, x);
374 RouteTimeAxisView::route_name_changed ()
376 editor.route_name_changed (this);
381 RouteTimeAxisView::take_name_changed (void *src)
390 RouteTimeAxisView::playlist_click ()
392 // always build a new action menu
394 if (playlist_action_menu != 0) {
395 delete playlist_action_menu;
398 playlist_action_menu = new Menu;
399 playlist_action_menu->set_name ("ArdourContextMenu");
401 build_playlist_menu (playlist_action_menu);
402 editor.set_selected_track (*this, Selection::Add);
403 playlist_action_menu->popup (1, gtk_get_current_event_time());
407 RouteTimeAxisView::automation_click ()
409 if (automation_action_menu == 0) {
410 /* this seems odd, but the automation action
411 menu is built as part of the display menu.
413 build_display_menu ();
415 editor.set_selected_track (*this, Selection::Add);
416 automation_action_menu->popup (1, gtk_get_current_event_time());
420 RouteTimeAxisView::build_automation_action_menu ()
422 using namespace Menu_Helpers;
424 automation_action_menu = manage (new Menu);
425 MenuList& automation_items = automation_action_menu->items();
426 automation_action_menu->set_name ("ArdourContextMenu");
428 automation_items.push_back (MenuElem (_("Show all automation"),
429 mem_fun(*this, &RouteTimeAxisView::show_all_automation)));
431 automation_items.push_back (MenuElem (_("Show existing automation"),
432 mem_fun(*this, &RouteTimeAxisView::show_existing_automation)));
434 automation_items.push_back (MenuElem (_("Hide all automation"),
435 mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
437 if (subplugin_menu.get_parent())
438 subplugin_menu.detach();
440 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
442 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
443 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
445 automation_items.push_back (SeparatorElem());
447 if (i->second->menu_item)
448 delete i->second->menu_item;
450 automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param),
451 bind (mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), i->second->param)));
453 i->second->menu_item = static_cast<Gtk::CheckMenuItem*>(&automation_items.back());
455 i->second->menu_item->set_active(show_automation(i->second->param));
456 //i->second->menu_item->set_active(false);
461 RouteTimeAxisView::build_display_menu ()
463 using namespace Menu_Helpers;
465 /* get the size menu ready */
471 TimeAxisView::build_display_menu ();
473 /* now fill it with our stuff */
475 MenuList& items = display_menu->items();
476 display_menu->set_name ("ArdourContextMenu");
478 items.push_back (MenuElem (_("Height"), *size_menu));
479 items.push_back (MenuElem (_("Color"), mem_fun(*this, &RouteTimeAxisView::select_track_color)));
481 items.push_back (SeparatorElem());
483 build_remote_control_menu ();
484 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
486 build_automation_action_menu ();
487 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
489 // Hook for derived classes to add type specific stuff
490 items.push_back (SeparatorElem());
491 append_extra_display_menu_items ();
492 items.push_back (SeparatorElem());
496 Menu* alignment_menu = manage (new Menu);
497 MenuList& alignment_items = alignment_menu->items();
498 alignment_menu->set_name ("ArdourContextMenu");
500 RadioMenuItem::Group align_group;
502 alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
503 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
504 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
505 if (get_diskstream()->alignment_style() == ExistingMaterial)
506 align_existing_item->set_active();
508 alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
509 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
510 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
511 if (get_diskstream()->alignment_style() == CaptureTime)
512 align_capture_item->set_active();
514 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
516 get_diskstream()->AlignmentStyleChanged.connect (
517 mem_fun(*this, &RouteTimeAxisView::align_style_changed));
519 RadioMenuItem::Group mode_group;
520 items.push_back (RadioMenuElem (mode_group, _("Normal mode"),
521 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Normal)));
522 normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
523 items.push_back (RadioMenuElem (mode_group, _("Tape mode"),
524 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Destructive)));
525 destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
528 switch (track()->mode()) {
529 case ARDOUR::Destructive:
530 destructive_track_mode_item->set_active ();
533 normal_track_mode_item->set_active ();
538 items.push_back (SeparatorElem());
539 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
540 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
541 route_active_menu_item->set_active (_route->active());
543 items.push_back (SeparatorElem());
544 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
547 static bool __reset_item (RadioMenuItem* item)
554 RouteTimeAxisView::set_track_mode (TrackMode mode)
557 RadioMenuItem* other_item;
561 item = normal_track_mode_item;
562 other_item = destructive_track_mode_item;
564 case ARDOUR::Destructive:
565 item = destructive_track_mode_item;
566 other_item = normal_track_mode_item;
569 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", mode) << endmsg;
574 if (item->get_active () && track()->mode() != mode) {
575 _set_track_mode (track().get(), mode, other_item);
580 RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem* reset_item)
584 if (!track->can_use_mode (mode, needs_bounce)) {
588 Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), reset_item));
591 cerr << "would bounce this one\n";
596 track->set_mode (mode);
598 rec_enable_button->remove ();
601 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
603 case ARDOUR::Destructive:
604 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
607 rec_enable_button->show_all ();
612 RouteTimeAxisView::track_mode_changed ()
616 switch (track()->mode()) {
618 item = normal_track_mode_item;
620 case ARDOUR::Destructive:
621 item = destructive_track_mode_item;
624 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", track()->mode()) << endmsg;
633 RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end)
639 TimeAxisView::show_timestretch (start, end);
649 /* check that the time selection was made in our route, or our edit group.
650 remember that edit_group() == 0 implies the route is *not* in a edit group.
653 if (!(ts.track == this || (ts.group != 0 && ts.group == _route->edit_group()))) {
654 /* this doesn't apply to us */
658 /* ignore it if our edit group is not active */
660 if ((ts.track != this) && _route->edit_group() && !_route->edit_group()->is_active()) {
665 if (timestretch_rect == 0) {
666 timestretch_rect = new SimpleRect (*canvas_display);
667 timestretch_rect->property_x1() = 0.0;
668 timestretch_rect->property_y1() = 0.0;
669 timestretch_rect->property_x2() = 0.0;
670 timestretch_rect->property_y2() = 0.0;
671 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
672 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
675 timestretch_rect->show ();
676 timestretch_rect->raise_to_top ();
678 x1 = start / editor.get_current_zoom();
679 x2 = (end - 1) / editor.get_current_zoom();
682 timestretch_rect->property_x1() = x1;
683 timestretch_rect->property_y1() = 1.0;
684 timestretch_rect->property_x2() = x2;
685 timestretch_rect->property_y2() = y2;
689 RouteTimeAxisView::hide_timestretch ()
691 TimeAxisView::hide_timestretch ();
693 if (timestretch_rect) {
694 timestretch_rect->hide ();
699 RouteTimeAxisView::show_selection (TimeSelection& ts)
703 /* ignore it if our edit group is not active or if the selection was started
704 in some other track or edit group (remember that edit_group() == 0 means
705 that the track is not in an edit group).
708 if (((ts.track != this && !is_child (ts.track)) && _route->edit_group() && !_route->edit_group()->is_active()) ||
709 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route->edit_group())))) {
715 TimeAxisView::show_selection (ts);
719 RouteTimeAxisView::set_height (TrackHeight h)
721 bool height_changed = (height == 0) || (h != height_style);
723 TimeAxisView::set_height (h);
728 _view->set_height ((double) height);
731 switch (height_style) {
733 xml_node->add_property ("track_height", "largest");
737 xml_node->add_property ("track_height", "large");
741 xml_node->add_property ("track_height", "larger");
745 xml_node->add_property ("track_height", "normal");
749 xml_node->add_property ("track_height", "smaller");
753 xml_node->add_property ("track_height", "small");
757 switch (height_style) {
767 if (rec_enable_button)
768 rec_enable_button->show();
770 edit_group_button.show();
772 visual_button.show();
774 automation_button.show();
776 if (is_track() && track()->mode() == ARDOUR::Normal) {
777 playlist_button.show();
787 if (rec_enable_button)
788 rec_enable_button->show();
790 edit_group_button.hide ();
792 visual_button.hide ();
794 automation_button.hide ();
796 if (is_track() && track()->mode() == ARDOUR::Normal) {
797 playlist_button.hide ();
807 if (rec_enable_button)
808 rec_enable_button->hide();
810 edit_group_button.hide ();
812 visual_button.hide ();
814 automation_button.hide ();
815 playlist_button.hide ();
816 name_label.set_text (_route->name());
820 if (height_changed) {
821 /* only emit the signal if the height really changed */
822 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
827 RouteTimeAxisView::select_track_color ()
829 if (RouteUI::choose_color ()) {
832 _view->apply_color (_color, StreamView::RegionColor);
838 RouteTimeAxisView::reset_samples_per_unit ()
840 set_samples_per_unit (editor.get_current_zoom());
844 RouteTimeAxisView::set_samples_per_unit (double spu)
848 if (get_diskstream() != 0) {
849 speed = get_diskstream()->speed();
853 _view->set_samples_per_unit (spu * speed);
856 TimeAxisView::set_samples_per_unit (spu * speed);
860 RouteTimeAxisView::align_style_changed ()
862 switch (get_diskstream()->alignment_style()) {
863 case ExistingMaterial:
864 if (!align_existing_item->get_active()) {
865 align_existing_item->set_active();
869 if (!align_capture_item->get_active()) {
870 align_capture_item->set_active();
877 RouteTimeAxisView::set_align_style (AlignStyle style)
882 case ExistingMaterial:
883 item = align_existing_item;
886 item = align_capture_item;
889 fatal << string_compose (_("programming error: %1 %2"), "illegal align style in RouteTimeAxisView::set_align_style", style) << endmsg;
894 if (item->get_active()) {
895 get_diskstream()->set_align_style (style);
900 RouteTimeAxisView::rename_current_playlist ()
902 ArdourPrompter prompter (true);
905 boost::shared_ptr<Diskstream> ds = get_diskstream();
906 if (!ds || ds->destructive())
909 boost::shared_ptr<Playlist> pl = ds->playlist();
913 prompter.set_prompt (_("Name for playlist"));
914 prompter.set_initial_text (pl->name());
915 prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
916 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
918 switch (prompter.run ()) {
919 case Gtk::RESPONSE_ACCEPT:
920 prompter.get_result (name);
932 RouteTimeAxisView::use_copy_playlist (bool prompt)
936 boost::shared_ptr<Diskstream> ds = get_diskstream();
937 if (!ds || ds->destructive())
940 boost::shared_ptr<const Playlist> pl = ds->playlist();
947 name = Playlist::bump_name (name, _session);
948 } while (_session.playlist_by_name(name));
950 // TODO: The prompter "new" button should be de-activated if the user
951 // specifies a playlist name which already exists in the session.
955 ArdourPrompter prompter (true);
957 prompter.set_prompt (_("Name for Playlist"));
958 prompter.set_initial_text (name);
959 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
960 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
961 prompter.show_all ();
963 switch (prompter.run ()) {
964 case Gtk::RESPONSE_ACCEPT:
965 prompter.get_result (name);
974 ds->use_copy_playlist ();
975 ds->playlist()->set_name (name);
980 RouteTimeAxisView::use_new_playlist (bool prompt)
984 boost::shared_ptr<Diskstream> ds = get_diskstream();
985 if (!ds || ds->destructive())
988 boost::shared_ptr<const Playlist> pl = ds->playlist();
995 name = Playlist::bump_name (name, _session);
996 } while (_session.playlist_by_name(name));
1001 ArdourPrompter prompter (true);
1003 prompter.set_prompt (_("Name for Playlist"));
1004 prompter.set_initial_text (name);
1005 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
1006 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
1008 switch (prompter.run ()) {
1009 case Gtk::RESPONSE_ACCEPT:
1010 prompter.get_result (name);
1018 if (name.length()) {
1019 ds->use_new_playlist ();
1020 ds->playlist()->set_name (name);
1025 RouteTimeAxisView::clear_playlist ()
1027 boost::shared_ptr<Diskstream> ds = get_diskstream();
1028 if (!ds || ds->destructive())
1031 boost::shared_ptr<Playlist> pl = ds->playlist();
1035 editor.clear_playlist (pl);
1039 RouteTimeAxisView::speed_changed ()
1041 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
1045 RouteTimeAxisView::diskstream_changed ()
1047 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::update_diskstream_display));
1051 RouteTimeAxisView::update_diskstream_display ()
1053 if (!get_diskstream()) // bus
1056 set_playlist (get_diskstream()->playlist());
1061 RouteTimeAxisView::selection_click (GdkEventButton* ev)
1063 if (Keyboard::modifier_state_equals (ev->state, (Keyboard::Shift|Keyboard::Control))) {
1065 /* special case: select/deselect all tracks */
1066 if (editor.get_selection().selected (this)) {
1067 editor.get_selection().clear_tracks ();
1069 editor.select_all_tracks ();
1075 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route->edit_group());
1077 switch (Keyboard::selection_type (ev->state)) {
1078 case Selection::Toggle:
1079 editor.get_selection().toggle (*tracks);
1082 case Selection::Set:
1083 editor.get_selection().set (*tracks);
1086 case Selection::Extend:
1087 if (tracks->size() > 1) {
1088 /* add each one, do not "extend" */
1089 editor.get_selection().add (*tracks);
1091 /* extend to the single track */
1092 editor.extend_selection_to_track (*tracks->front());
1096 case Selection::Add:
1097 editor.get_selection().add (*tracks);
1105 RouteTimeAxisView::set_selected_points (PointSelection& points)
1107 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1108 (*i)->set_selected_points (points);
1113 RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
1116 _view->set_selected_regionviews (regions);
1120 /** Add the selectable things that we have to a list.
1121 * @param results List to add things to.
1124 RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
1128 if (get_diskstream() != 0) {
1129 speed = get_diskstream()->speed();
1132 nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1133 nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1135 if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
1136 _view->get_selectables (start_adjusted, end_adjusted, results);
1139 /* pick up visible automation tracks */
1141 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1142 if (!(*i)->hidden()) {
1143 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1149 RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1152 _view->get_inverted_selectables (sel, results);
1155 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1156 if (!(*i)->hidden()) {
1157 (*i)->get_inverted_selectables (sel, results);
1165 RouteTimeAxisView::show_automation(Parameter param)
1167 return (_show_automation.find(param) != _show_automation.end());
1170 /** Retuns NULL if track for \a param doesn't exist.
1172 RouteTimeAxisView::RouteAutomationNode*
1173 RouteTimeAxisView::automation_track(Parameter param)
1175 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
1177 if (i != _automation_tracks.end())
1183 /** Shorthand for GainAutomation, etc.
1185 RouteTimeAxisView::RouteAutomationNode*
1186 RouteTimeAxisView::automation_track(AutomationType type)
1188 return automation_track(Parameter(type));
1192 RouteTimeAxisView::edit_group() const
1194 return _route->edit_group();
1198 RouteTimeAxisView::name() const
1200 return _route->name();
1203 boost::shared_ptr<Playlist>
1204 RouteTimeAxisView::playlist () const
1206 boost::shared_ptr<Diskstream> ds;
1208 if ((ds = get_diskstream()) != 0) {
1209 return ds->playlist();
1211 return boost::shared_ptr<Playlist> ();
1216 RouteTimeAxisView::name_entry_changed ()
1220 x = name_entry.get_text ();
1222 if (x == _route->name()) {
1226 strip_whitespace_edges(x);
1228 if (x.length() == 0) {
1229 name_entry.set_text (_route->name());
1233 if (_session.route_name_unique (x)) {
1234 _route->set_name (x);
1236 ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
1237 name_entry.set_text (_route->name());
1242 RouteTimeAxisView::visual_click ()
1244 popup_display_menu (0);
1248 RouteTimeAxisView::hide_click ()
1250 // LAME fix for hide_button refresh fix
1251 hide_button.set_sensitive(false);
1253 editor.hide_track_in_display (*this);
1255 hide_button.set_sensitive(true);
1258 boost::shared_ptr<Region>
1259 RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir)
1261 boost::shared_ptr<Diskstream> stream;
1262 boost::shared_ptr<Playlist> playlist;
1264 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1265 return playlist->find_next_region (pos, point, dir);
1268 return boost::shared_ptr<Region> ();
1272 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1274 boost::shared_ptr<Playlist> what_we_got;
1275 boost::shared_ptr<Diskstream> ds = get_diskstream();
1276 boost::shared_ptr<Playlist> playlist;
1280 /* route is a bus, not a track */
1284 playlist = ds->playlist();
1286 TimeSelection time (selection.time);
1287 float speed = ds->speed();
1288 if (speed != 1.0f) {
1289 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1290 (*i).start = session_frame_to_track_frame((*i).start, speed);
1291 (*i).end = session_frame_to_track_frame((*i).end, speed);
1295 XMLNode &before = playlist->get_state();
1298 if ((what_we_got = playlist->cut (time)) != 0) {
1299 editor.get_cut_buffer().add (what_we_got);
1300 _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
1305 if ((what_we_got = playlist->copy (time)) != 0) {
1306 editor.get_cut_buffer().add (what_we_got);
1311 if ((what_we_got = playlist->cut (time)) != 0) {
1312 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1313 what_we_got->release ();
1323 RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size_t nth)
1329 boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist();
1330 PlaylistSelection::iterator p;
1332 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1334 if (p == selection.playlists.end()) {
1338 if (get_diskstream()->speed() != 1.0f)
1339 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1341 XMLNode &before = playlist->get_state();
1342 playlist->paste (*p, pos, times);
1343 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1349 TimeAxisView::Children
1350 RouteTimeAxisView::get_child_list()
1352 TimeAxisView::Children redirect_children;
1354 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1355 if (!(*i)->hidden()) {
1356 redirect_children.push_back(*i);
1359 return redirect_children;
1364 RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1366 using namespace Menu_Helpers;
1368 if (!menu || !is_track()) {
1372 MenuList& playlist_items = menu->items();
1373 menu->set_name ("ArdourContextMenu");
1374 playlist_items.clear();
1376 if (playlist_menu) {
1377 delete playlist_menu;
1380 playlist_menu = new Menu;
1381 playlist_menu->set_name ("ArdourContextMenu");
1383 vector<boost::shared_ptr<Playlist> > playlists;
1384 boost::shared_ptr<Diskstream> ds = get_diskstream();
1385 RadioMenuItem::Group playlist_group;
1387 _session.get_playlists (playlists);
1389 for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
1391 if ((*i)->get_orig_diskstream_id() == ds->id()) {
1392 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1393 boost::weak_ptr<Playlist> (*i))));
1395 if (ds->playlist()->id() == (*i)->id()) {
1396 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1398 } else if (ds->playlist()->id() == (*i)->id()) {
1399 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1400 boost::weak_ptr<Playlist>(*i))));
1401 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1406 playlist_items.push_back (SeparatorElem());
1407 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
1408 playlist_items.push_back (SeparatorElem());
1410 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1411 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1412 playlist_items.push_back (SeparatorElem());
1413 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1414 playlist_items.push_back (SeparatorElem());
1416 playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector)));
1420 RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl)
1422 assert (is_track());
1424 boost::shared_ptr<Playlist> pl (wpl.lock());
1430 boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
1433 get_diskstream()->use_playlist (apl);
1438 RouteTimeAxisView::show_playlist_selector ()
1440 editor.playlist_selector().show_for (this);
1444 RouteTimeAxisView::map_frozen ()
1450 ENSURE_GUI_THREAD (mem_fun(*this, &RouteTimeAxisView::map_frozen));
1452 switch (track()->freeze_state()) {
1454 playlist_button.set_sensitive (false);
1455 rec_enable_button->set_sensitive (false);
1458 playlist_button.set_sensitive (true);
1459 rec_enable_button->set_sensitive (true);
1465 RouteTimeAxisView::color_handler ()
1467 //case cTimeStretchOutline:
1468 if (timestretch_rect) {
1469 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
1471 //case cTimeStretchFill:
1472 if (timestretch_rect) {
1473 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
1479 RouteTimeAxisView::toggle_automation_track (Parameter param)
1481 RouteAutomationNode* node = automation_track(param);
1486 bool showit = node->menu_item->get_active();
1488 if (showit != node->track->marked_for_display()) {
1490 node->track->set_marked_for_display (true);
1491 node->track->canvas_display->show();
1492 node->track->get_state_node()->add_property ("shown", X_("yes"));
1494 node->track->set_marked_for_display (false);
1495 node->track->hide ();
1496 node->track->get_state_node()->add_property ("shown", X_("no"));
1499 /* now trigger a redisplay */
1502 _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1508 RouteTimeAxisView::automation_track_hidden (Parameter param)
1510 RouteAutomationNode* ran = automation_track(param);
1514 _show_automation.erase(param);
1515 ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
1517 if (ran->menu_item && !_hidden) {
1518 ran->menu_item->set_active (false);
1521 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1526 RouteTimeAxisView::show_all_automation ()
1530 /* Show our automation */
1532 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
1533 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1534 i->second->track->set_marked_for_display (true);
1535 i->second->track->canvas_display->show();
1536 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1537 i->second->menu_item->set_active(true);
1541 /* Show processor automation */
1543 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1544 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1545 if ((*ii)->view == 0) {
1546 add_processor_automation_curve ((*i)->processor, (*ii)->what);
1549 (*ii)->menu_item->set_active (true);
1558 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1562 RouteTimeAxisView::show_existing_automation ()
1566 /* Show our automation */
1568 map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
1569 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1570 if (i->second->track->line() && i->second->track->line()->npoints() > 0) {
1571 i->second->track->set_marked_for_display (true);
1572 i->second->track->canvas_display->show();
1573 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1574 i->second->menu_item->set_active(true);
1579 /* Show processor automation */
1581 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1582 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1583 if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) {
1584 (*ii)->menu_item->set_active (true);
1591 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1595 RouteTimeAxisView::hide_all_automation ()
1599 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1600 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1601 (*ii)->menu_item->set_active (false);
1605 _show_automation.clear();
1608 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1613 RouteTimeAxisView::region_view_added (RegionView* rv)
1615 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1616 boost::shared_ptr<AutomationTimeAxisView> atv;
1618 if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) {
1619 rv->add_ghost (*atv.get());
1625 RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, boost::shared_ptr<AutomationTimeAxisView> atv)
1627 rv->add_ghost (*atv.get());
1630 RouteTimeAxisView::ProcessorAutomationInfo::~ProcessorAutomationInfo ()
1632 for (vector<ProcessorAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1638 RouteTimeAxisView::ProcessorAutomationNode::~ProcessorAutomationNode ()
1640 parent.remove_processor_automation_node (this);
1644 RouteTimeAxisView::remove_processor_automation_node (ProcessorAutomationNode* pan)
1647 remove_child (pan->view);
1651 RouteTimeAxisView::ProcessorAutomationNode*
1652 RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, Parameter what)
1654 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1656 if ((*i)->processor == processor) {
1658 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1659 if ((*ii)->what == what) {
1670 legalize_for_xml_node (string str)
1672 string::size_type pos;
1673 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1679 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1680 legal.replace (pos, 1, "_");
1689 RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
1692 ProcessorAutomationNode* pan;
1694 if ((pan = find_processor_automation_node (processor, what)) == 0) {
1695 fatal << _("programming error: ")
1696 << string_compose (X_("processor automation curve for %1:%2 not registered with track!"),
1697 processor->name(), what)
1707 name = processor->describe_parameter (what);
1709 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1713 char state_name[256];
1714 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
1716 boost::shared_ptr<AutomationControl> control = processor->control(what, true);
1718 pan->view = boost::shared_ptr<AutomationTimeAxisView>(
1719 new AutomationTimeAxisView (_session, _route, processor, control,
1720 editor, *this, parent_canvas, name, state_name));
1722 pan->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), pan, processor));
1724 if (!pan->view->marked_for_display()) {
1727 pan->menu_item->set_active (true);
1730 add_child (pan->view);
1733 _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), pan->view));
1736 processor->mark_automation_visible (what, true);
1740 RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::ProcessorAutomationNode* pan, boost::shared_ptr<Processor> i)
1743 pan->menu_item->set_active (false);
1746 i->mark_automation_visible (pan->what, false);
1748 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1752 RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor)
1755 boost::shared_ptr<AutomationLine> al;
1757 processor->what_has_visible_automation (s);
1759 for (set<Parameter>::iterator i = s.begin(); i != s.end(); ++i) {
1761 if ((al = find_processor_automation_curve (processor, *i)) != 0) {
1764 add_processor_automation_curve (processor, (*i));
1770 RouteTimeAxisView::add_automation_child(Parameter param, boost::shared_ptr<AutomationTimeAxisView> track)
1772 using namespace Menu_Helpers;
1778 track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
1780 bool hideit = false;
1784 if ((node = track->get_state_node()) != 0) {
1785 if ((prop = node->property ("shown")) != 0) {
1786 if (prop->value() == "yes") {
1792 _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track)));
1797 _show_automation.insert(param);
1798 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1801 build_display_menu();
1806 RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor> processor)
1808 using namespace Menu_Helpers;
1809 ProcessorAutomationInfo *rai;
1810 list<ProcessorAutomationInfo*>::iterator x;
1812 const std::set<Parameter>& automatable = processor->what_can_be_automated ();
1813 std::set<Parameter> has_visible_automation;
1815 processor->what_has_visible_automation(has_visible_automation);
1817 if (automatable.empty()) {
1821 for (x = processor_automation.begin(); x != processor_automation.end(); ++x) {
1822 if ((*x)->processor == processor) {
1827 if (x == processor_automation.end()) {
1829 rai = new ProcessorAutomationInfo (processor);
1830 processor_automation.push_back (rai);
1838 /* any older menu was deleted at the top of processors_changed()
1839 when we cleared the subplugin menu.
1842 rai->menu = manage (new Menu);
1843 MenuList& items = rai->menu->items();
1844 rai->menu->set_name ("ArdourContextMenu");
1848 for (std::set<Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1850 ProcessorAutomationNode* pan;
1851 CheckMenuItem* mitem;
1853 string name = processor->describe_parameter (*i);
1855 items.push_back (CheckMenuElem (name));
1856 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1858 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1859 mitem->set_active(true);
1862 if ((pan = find_processor_automation_node (processor, *i)) == 0) {
1866 pan = new ProcessorAutomationNode (*i, mitem, *this);
1868 rai->lines.push_back (pan);
1872 pan->menu_item = mitem;
1876 mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, pan));
1879 /* add the menu for this processor, because the subplugin
1880 menu is always cleared at the top of processors_changed().
1881 this is the result of some poor design in gtkmm and/or
1885 subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu));
1890 RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo* rai,
1891 RouteTimeAxisView::ProcessorAutomationNode* pan)
1893 bool showit = pan->menu_item->get_active();
1894 bool redraw = false;
1896 if (pan->view == 0 && showit) {
1897 add_processor_automation_curve (rai->processor, pan->what);
1901 if (showit != pan->view->marked_for_display()) {
1904 pan->view->set_marked_for_display (true);
1905 pan->view->canvas_display->show();
1907 rai->processor->mark_automation_visible (pan->what, true);
1908 pan->view->set_marked_for_display (false);
1916 if (redraw && !no_redraw) {
1918 /* now trigger a redisplay */
1920 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1926 RouteTimeAxisView::processors_changed ()
1928 using namespace Menu_Helpers;
1930 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1931 (*i)->valid = false;
1934 subplugin_menu.items().clear ();
1936 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
1937 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
1939 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ) {
1941 list<ProcessorAutomationInfo*>::iterator tmp;
1949 processor_automation.erase (i);
1956 /* change in visibility was possible */
1958 _route->gui_changed ("track_height", this);
1961 boost::shared_ptr<AutomationLine>
1962 RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
1964 ProcessorAutomationNode* pan;
1966 if ((pan = find_processor_automation_node (processor, what)) != 0) {
1972 return boost::shared_ptr<AutomationLine>();
1976 RouteTimeAxisView::reset_processor_automation_curves ()
1978 for (ProcessorAutomationCurves::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) {
1984 RouteTimeAxisView::update_rec_display ()
1986 RouteUI::update_rec_display ();
1987 name_entry.set_sensitive (!_route->record_enabled());