2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <sigc++/bind.h>
30 #include <pbd/error.h>
31 #include <pbd/stl_delete.h>
32 #include <pbd/whitespace.h>
33 #include <pbd/memento_command.h>
35 #include <gtkmm/menu.h>
36 #include <gtkmm/menuitem.h>
37 #include <gtkmm2ext/gtk_ui.h>
38 #include <gtkmm2ext/selector.h>
39 #include <gtkmm2ext/stop_signal.h>
40 #include <gtkmm2ext/bindable_button.h>
41 #include <gtkmm2ext/utils.h>
43 #include <ardour/playlist.h>
44 #include <ardour/audioplaylist.h>
45 #include <ardour/diskstream.h>
46 #include <ardour/processor.h>
47 #include <ardour/ladspa_plugin.h>
48 #include <ardour/location.h>
49 #include <ardour/panner.h>
50 #include <ardour/playlist.h>
51 #include <ardour/session.h>
52 #include <ardour/session_playlist.h>
53 #include <ardour/utils.h>
54 #include <ardour/param_id.h>
56 #include "ardour_ui.h"
57 #include "route_time_axis.h"
58 #include "automation_time_axis.h"
59 #include "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 ParamID 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(ParamID(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 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
439 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
440 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
442 automation_items.push_back (SeparatorElem());
444 if ( ! i->second->menu_item) {
445 automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param),
446 bind (mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), i->second->param)));
448 i->second->menu_item = static_cast<Gtk::CheckMenuItem*>(&automation_items.back());
451 automation_items.push_back (*i->second->menu_item);
454 //i->second->menu_item->set_active(show_automation(i->second->param));
455 i->second->menu_item->set_active(false);
460 RouteTimeAxisView::build_display_menu ()
462 using namespace Menu_Helpers;
464 /* get the size menu ready */
470 TimeAxisView::build_display_menu ();
472 /* now fill it with our stuff */
474 MenuList& items = display_menu->items();
475 display_menu->set_name ("ArdourContextMenu");
477 items.push_back (MenuElem (_("Height"), *size_menu));
478 items.push_back (MenuElem (_("Color"), mem_fun(*this, &RouteTimeAxisView::select_track_color)));
480 items.push_back (SeparatorElem());
482 build_remote_control_menu ();
483 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
485 build_automation_action_menu ();
486 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
488 // Hook for derived classes to add type specific stuff
489 items.push_back (SeparatorElem());
490 append_extra_display_menu_items ();
491 items.push_back (SeparatorElem());
495 Menu* alignment_menu = manage (new Menu);
496 MenuList& alignment_items = alignment_menu->items();
497 alignment_menu->set_name ("ArdourContextMenu");
499 RadioMenuItem::Group align_group;
501 alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
502 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
503 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
504 if (get_diskstream()->alignment_style() == ExistingMaterial)
505 align_existing_item->set_active();
507 alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
508 bind (mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
509 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
510 if (get_diskstream()->alignment_style() == CaptureTime)
511 align_capture_item->set_active();
513 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
515 get_diskstream()->AlignmentStyleChanged.connect (
516 mem_fun(*this, &RouteTimeAxisView::align_style_changed));
518 RadioMenuItem::Group mode_group;
519 items.push_back (RadioMenuElem (mode_group, _("Normal mode"),
520 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Normal)));
521 normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
522 items.push_back (RadioMenuElem (mode_group, _("Tape mode"),
523 bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::Destructive)));
524 destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
527 switch (track()->mode()) {
528 case ARDOUR::Destructive:
529 destructive_track_mode_item->set_active ();
532 normal_track_mode_item->set_active ();
537 items.push_back (SeparatorElem());
538 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
539 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
540 route_active_menu_item->set_active (_route->active());
542 items.push_back (SeparatorElem());
543 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
546 static bool __reset_item (RadioMenuItem* item)
553 RouteTimeAxisView::set_track_mode (TrackMode mode)
556 RadioMenuItem* other_item;
560 item = normal_track_mode_item;
561 other_item = destructive_track_mode_item;
563 case ARDOUR::Destructive:
564 item = destructive_track_mode_item;
565 other_item = normal_track_mode_item;
568 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", mode) << endmsg;
573 if (item->get_active () && track()->mode() != mode) {
574 _set_track_mode (track().get(), mode, other_item);
579 RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem* reset_item)
583 if (!track->can_use_mode (mode, needs_bounce)) {
587 Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), reset_item));
590 cerr << "would bounce this one\n";
595 track->set_mode (mode);
597 rec_enable_button->remove ();
600 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_normal_red"))))));
602 case ARDOUR::Destructive:
603 rec_enable_button->add (*(manage (new Image (::get_icon (X_("record_tape_red"))))));
606 rec_enable_button->show_all ();
611 RouteTimeAxisView::track_mode_changed ()
615 switch (track()->mode()) {
617 item = normal_track_mode_item;
619 case ARDOUR::Destructive:
620 item = destructive_track_mode_item;
623 fatal << string_compose (_("programming error: %1 %2"), "illegal track mode in RouteTimeAxisView::set_track_mode", track()->mode()) << endmsg;
632 RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end)
638 TimeAxisView::show_timestretch (start, end);
648 /* check that the time selection was made in our route, or our edit group.
649 remember that edit_group() == 0 implies the route is *not* in a edit group.
652 if (!(ts.track == this || (ts.group != 0 && ts.group == _route->edit_group()))) {
653 /* this doesn't apply to us */
657 /* ignore it if our edit group is not active */
659 if ((ts.track != this) && _route->edit_group() && !_route->edit_group()->is_active()) {
664 if (timestretch_rect == 0) {
665 timestretch_rect = new SimpleRect (*canvas_display);
666 timestretch_rect->property_x1() = 0.0;
667 timestretch_rect->property_y1() = 0.0;
668 timestretch_rect->property_x2() = 0.0;
669 timestretch_rect->property_y2() = 0.0;
670 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
671 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
674 timestretch_rect->show ();
675 timestretch_rect->raise_to_top ();
677 x1 = start / editor.get_current_zoom();
678 x2 = (end - 1) / editor.get_current_zoom();
681 timestretch_rect->property_x1() = x1;
682 timestretch_rect->property_y1() = 1.0;
683 timestretch_rect->property_x2() = x2;
684 timestretch_rect->property_y2() = y2;
688 RouteTimeAxisView::hide_timestretch ()
690 TimeAxisView::hide_timestretch ();
692 if (timestretch_rect) {
693 timestretch_rect->hide ();
698 RouteTimeAxisView::show_selection (TimeSelection& ts)
702 /* ignore it if our edit group is not active or if the selection was started
703 in some other track or edit group (remember that edit_group() == 0 means
704 that the track is not in an edit group).
707 if (((ts.track != this && !is_child (ts.track)) && _route->edit_group() && !_route->edit_group()->is_active()) ||
708 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route->edit_group())))) {
714 TimeAxisView::show_selection (ts);
718 RouteTimeAxisView::set_height (TrackHeight h)
720 bool height_changed = (height == 0) || (h != height_style);
722 TimeAxisView::set_height (h);
727 _view->set_height ((double) height);
730 switch (height_style) {
732 xml_node->add_property ("track_height", "largest");
736 xml_node->add_property ("track_height", "large");
740 xml_node->add_property ("track_height", "larger");
744 xml_node->add_property ("track_height", "normal");
748 xml_node->add_property ("track_height", "smaller");
752 xml_node->add_property ("track_height", "small");
756 switch (height_style) {
766 if (rec_enable_button)
767 rec_enable_button->show();
769 edit_group_button.show();
771 visual_button.show();
773 automation_button.show();
775 if (is_track() && track()->mode() == ARDOUR::Normal) {
776 playlist_button.show();
786 if (rec_enable_button)
787 rec_enable_button->show();
789 edit_group_button.hide ();
791 visual_button.hide ();
793 automation_button.hide ();
795 if (is_track() && track()->mode() == ARDOUR::Normal) {
796 playlist_button.hide ();
806 if (rec_enable_button)
807 rec_enable_button->hide();
809 edit_group_button.hide ();
811 visual_button.hide ();
813 automation_button.hide ();
814 playlist_button.hide ();
815 name_label.set_text (_route->name());
819 if (height_changed) {
820 /* only emit the signal if the height really changed */
821 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
826 RouteTimeAxisView::select_track_color ()
828 if (RouteUI::choose_color ()) {
831 _view->apply_color (_color, StreamView::RegionColor);
837 RouteTimeAxisView::reset_samples_per_unit ()
839 set_samples_per_unit (editor.get_current_zoom());
843 RouteTimeAxisView::set_samples_per_unit (double spu)
847 if (get_diskstream() != 0) {
848 speed = get_diskstream()->speed();
852 _view->set_samples_per_unit (spu * speed);
855 TimeAxisView::set_samples_per_unit (spu * speed);
859 RouteTimeAxisView::align_style_changed ()
861 switch (get_diskstream()->alignment_style()) {
862 case ExistingMaterial:
863 if (!align_existing_item->get_active()) {
864 align_existing_item->set_active();
868 if (!align_capture_item->get_active()) {
869 align_capture_item->set_active();
876 RouteTimeAxisView::set_align_style (AlignStyle style)
881 case ExistingMaterial:
882 item = align_existing_item;
885 item = align_capture_item;
888 fatal << string_compose (_("programming error: %1 %2"), "illegal align style in RouteTimeAxisView::set_align_style", style) << endmsg;
893 if (item->get_active()) {
894 get_diskstream()->set_align_style (style);
899 RouteTimeAxisView::rename_current_playlist ()
901 ArdourPrompter prompter (true);
904 boost::shared_ptr<Diskstream> ds = get_diskstream();
905 if (!ds || ds->destructive())
908 boost::shared_ptr<Playlist> pl = ds->playlist();
912 prompter.set_prompt (_("Name for playlist"));
913 prompter.set_initial_text (pl->name());
914 prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
915 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
917 switch (prompter.run ()) {
918 case Gtk::RESPONSE_ACCEPT:
919 prompter.get_result (name);
931 RouteTimeAxisView::use_copy_playlist (bool prompt)
935 boost::shared_ptr<Diskstream> ds = get_diskstream();
936 if (!ds || ds->destructive())
939 boost::shared_ptr<const Playlist> pl = ds->playlist();
946 name = Playlist::bump_name (name, _session);
947 } while (_session.playlist_by_name(name));
949 // TODO: The prompter "new" button should be de-activated if the user
950 // specifies a playlist name which already exists in the session.
954 ArdourPrompter prompter (true);
956 prompter.set_prompt (_("Name for Playlist"));
957 prompter.set_initial_text (name);
958 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
959 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
960 prompter.show_all ();
962 switch (prompter.run ()) {
963 case Gtk::RESPONSE_ACCEPT:
964 prompter.get_result (name);
973 ds->use_copy_playlist ();
974 ds->playlist()->set_name (name);
979 RouteTimeAxisView::use_new_playlist (bool prompt)
983 boost::shared_ptr<Diskstream> ds = get_diskstream();
984 if (!ds || ds->destructive())
987 boost::shared_ptr<const Playlist> pl = ds->playlist();
994 name = Playlist::bump_name (name, _session);
995 } while (_session.playlist_by_name(name));
1000 ArdourPrompter prompter (true);
1002 prompter.set_prompt (_("Name for Playlist"));
1003 prompter.set_initial_text (name);
1004 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
1005 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
1007 switch (prompter.run ()) {
1008 case Gtk::RESPONSE_ACCEPT:
1009 prompter.get_result (name);
1017 if (name.length()) {
1018 ds->use_new_playlist ();
1019 ds->playlist()->set_name (name);
1024 RouteTimeAxisView::clear_playlist ()
1026 boost::shared_ptr<Diskstream> ds = get_diskstream();
1027 if (!ds || ds->destructive())
1030 boost::shared_ptr<Playlist> pl = ds->playlist();
1034 editor.clear_playlist (pl);
1038 RouteTimeAxisView::speed_changed ()
1040 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
1044 RouteTimeAxisView::diskstream_changed ()
1046 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::update_diskstream_display));
1050 RouteTimeAxisView::update_diskstream_display ()
1052 if (!get_diskstream()) // bus
1055 set_playlist (get_diskstream()->playlist());
1060 RouteTimeAxisView::selection_click (GdkEventButton* ev)
1062 if (Keyboard::modifier_state_equals (ev->state, (Keyboard::Shift|Keyboard::Control))) {
1064 /* special case: select/deselect all tracks */
1065 if (editor.get_selection().selected (this)) {
1066 editor.get_selection().clear_tracks ();
1068 editor.select_all_tracks ();
1074 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route->edit_group());
1076 switch (Keyboard::selection_type (ev->state)) {
1077 case Selection::Toggle:
1078 editor.get_selection().toggle (*tracks);
1081 case Selection::Set:
1082 editor.get_selection().set (*tracks);
1085 case Selection::Extend:
1086 if (tracks->size() > 1) {
1087 /* add each one, do not "extend" */
1088 editor.get_selection().add (*tracks);
1090 /* extend to the single track */
1091 editor.extend_selection_to_track (*tracks->front());
1095 case Selection::Add:
1096 editor.get_selection().add (*tracks);
1104 RouteTimeAxisView::set_selected_points (PointSelection& points)
1106 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1107 (*i)->set_selected_points (points);
1112 RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
1115 _view->set_selected_regionviews (regions);
1119 /** Add the selectable things that we have to a list.
1120 * @param results List to add things to.
1123 RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
1127 if (get_diskstream() != 0) {
1128 speed = get_diskstream()->speed();
1131 nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1132 nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1134 if (_view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
1135 _view->get_selectables (start_adjusted, end_adjusted, results);
1138 /* pick up visible automation tracks */
1140 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1141 if (!(*i)->hidden()) {
1142 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1148 RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1151 _view->get_inverted_selectables (sel, results);
1154 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1155 if (!(*i)->hidden()) {
1156 (*i)->get_inverted_selectables (sel, results);
1164 RouteTimeAxisView::show_automation(ParamID param)
1166 return (_show_automation.find(param) != _show_automation.end());
1169 /** Retuns NULL if track for \a param doesn't exist.
1171 RouteTimeAxisView::RouteAutomationNode*
1172 RouteTimeAxisView::automation_track(ParamID param)
1174 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
1176 if (i != _automation_tracks.end())
1182 /** Shorthand for GainAutomation, etc.
1184 RouteTimeAxisView::RouteAutomationNode*
1185 RouteTimeAxisView::automation_track(AutomationType type)
1187 return automation_track(ParamID(type));
1191 RouteTimeAxisView::edit_group() const
1193 return _route->edit_group();
1197 RouteTimeAxisView::name() const
1199 return _route->name();
1202 boost::shared_ptr<Playlist>
1203 RouteTimeAxisView::playlist () const
1205 boost::shared_ptr<Diskstream> ds;
1207 if ((ds = get_diskstream()) != 0) {
1208 return ds->playlist();
1210 return boost::shared_ptr<Playlist> ();
1215 RouteTimeAxisView::name_entry_changed ()
1219 x = name_entry.get_text ();
1221 if (x == _route->name()) {
1225 strip_whitespace_edges(x);
1227 if (x.length() == 0) {
1228 name_entry.set_text (_route->name());
1232 if (_session.route_name_unique (x)) {
1233 _route->set_name (x);
1235 ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
1236 name_entry.set_text (_route->name());
1241 RouteTimeAxisView::visual_click ()
1243 popup_display_menu (0);
1247 RouteTimeAxisView::hide_click ()
1249 // LAME fix for hide_button refresh fix
1250 hide_button.set_sensitive(false);
1252 editor.hide_track_in_display (*this);
1254 hide_button.set_sensitive(true);
1257 boost::shared_ptr<Region>
1258 RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir)
1260 boost::shared_ptr<Diskstream> stream;
1261 boost::shared_ptr<Playlist> playlist;
1263 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1264 return playlist->find_next_region (pos, point, dir);
1267 return boost::shared_ptr<Region> ();
1271 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1273 boost::shared_ptr<Playlist> what_we_got;
1274 boost::shared_ptr<Diskstream> ds = get_diskstream();
1275 boost::shared_ptr<Playlist> playlist;
1279 /* route is a bus, not a track */
1283 playlist = ds->playlist();
1285 TimeSelection time (selection.time);
1286 float speed = ds->speed();
1287 if (speed != 1.0f) {
1288 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1289 (*i).start = session_frame_to_track_frame((*i).start, speed);
1290 (*i).end = session_frame_to_track_frame((*i).end, speed);
1294 XMLNode &before = playlist->get_state();
1297 if ((what_we_got = playlist->cut (time)) != 0) {
1298 editor.get_cut_buffer().add (what_we_got);
1299 _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
1304 if ((what_we_got = playlist->copy (time)) != 0) {
1305 editor.get_cut_buffer().add (what_we_got);
1310 if ((what_we_got = playlist->cut (time)) != 0) {
1311 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1312 what_we_got->release ();
1322 RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size_t nth)
1328 boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist();
1329 PlaylistSelection::iterator p;
1331 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1333 if (p == selection.playlists.end()) {
1337 if (get_diskstream()->speed() != 1.0f)
1338 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1340 XMLNode &before = playlist->get_state();
1341 playlist->paste (*p, pos, times);
1342 _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
1348 TimeAxisView::Children
1349 RouteTimeAxisView::get_child_list()
1351 TimeAxisView::Children redirect_children;
1353 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1354 if (!(*i)->hidden()) {
1355 redirect_children.push_back(*i);
1358 return redirect_children;
1363 RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1365 using namespace Menu_Helpers;
1367 if (!menu || !is_track()) {
1371 MenuList& playlist_items = menu->items();
1372 menu->set_name ("ArdourContextMenu");
1373 playlist_items.clear();
1375 if (playlist_menu) {
1376 delete playlist_menu;
1379 playlist_menu = new Menu;
1380 playlist_menu->set_name ("ArdourContextMenu");
1382 vector<boost::shared_ptr<Playlist> > playlists;
1383 boost::shared_ptr<Diskstream> ds = get_diskstream();
1384 RadioMenuItem::Group playlist_group;
1386 _session.get_playlists (playlists);
1388 for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
1390 if ((*i)->get_orig_diskstream_id() == ds->id()) {
1391 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1392 boost::weak_ptr<Playlist> (*i))));
1394 if (ds->playlist()->id() == (*i)->id()) {
1395 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1397 } else if (ds->playlist()->id() == (*i)->id()) {
1398 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist),
1399 boost::weak_ptr<Playlist>(*i))));
1400 static_cast<RadioMenuItem*>(&playlist_items.back())->set_active();
1405 playlist_items.push_back (SeparatorElem());
1406 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
1407 playlist_items.push_back (SeparatorElem());
1409 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1410 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1411 playlist_items.push_back (SeparatorElem());
1412 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1413 playlist_items.push_back (SeparatorElem());
1415 playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector)));
1419 RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl)
1421 assert (is_track());
1423 boost::shared_ptr<Playlist> pl (wpl.lock());
1429 boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
1432 get_diskstream()->use_playlist (apl);
1437 RouteTimeAxisView::show_playlist_selector ()
1439 editor.playlist_selector().show_for (this);
1443 RouteTimeAxisView::map_frozen ()
1449 ENSURE_GUI_THREAD (mem_fun(*this, &RouteTimeAxisView::map_frozen));
1451 switch (track()->freeze_state()) {
1453 playlist_button.set_sensitive (false);
1454 rec_enable_button->set_sensitive (false);
1457 playlist_button.set_sensitive (true);
1458 rec_enable_button->set_sensitive (true);
1464 RouteTimeAxisView::color_handler ()
1466 //case cTimeStretchOutline:
1467 if (timestretch_rect) {
1468 timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
1470 //case cTimeStretchFill:
1471 if (timestretch_rect) {
1472 timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
1478 RouteTimeAxisView::toggle_automation_track (ParamID param)
1480 RouteAutomationNode* node = automation_track(param);
1485 bool showit = node->menu_item->get_active();
1487 if (showit != node->track->marked_for_display()) {
1489 node->track->set_marked_for_display (true);
1490 node->track->canvas_display->show();
1491 node->track->get_state_node()->add_property ("shown", X_("yes"));
1493 node->track->set_marked_for_display (false);
1494 node->track->hide ();
1495 node->track->get_state_node()->add_property ("shown", X_("no"));
1498 /* now trigger a redisplay */
1501 _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1507 RouteTimeAxisView::automation_track_hidden (ParamID param)
1509 RouteAutomationNode* ran = automation_track(param);
1513 _show_automation.erase(param);
1514 ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
1516 if (ran->menu_item && !_hidden) {
1517 ran->menu_item->set_active (false);
1520 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1525 RouteTimeAxisView::show_all_automation ()
1529 /* Show our automation */
1531 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
1532 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1533 i->second->track->set_marked_for_display (true);
1534 i->second->track->canvas_display->show();
1535 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1536 i->second->menu_item->set_active(true);
1540 /* Show processor automation */
1542 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1543 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1544 if ((*ii)->view == 0) {
1545 add_processor_automation_curve ((*i)->processor, (*ii)->what);
1548 (*ii)->menu_item->set_active (true);
1557 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1561 RouteTimeAxisView::show_existing_automation ()
1565 /* Show our automation */
1567 map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i;
1568 for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
1569 if (i->second->track->line() && i->second->track->line()->npoints() > 0) {
1570 i->second->track->set_marked_for_display (true);
1571 i->second->track->canvas_display->show();
1572 i->second->track->get_state_node()->add_property ("shown", X_("yes"));
1573 i->second->menu_item->set_active(true);
1578 /* Show processor automation */
1580 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1581 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1582 if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) {
1583 (*ii)->menu_item->set_active (true);
1590 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1594 RouteTimeAxisView::hide_all_automation ()
1598 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1599 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1600 (*ii)->menu_item->set_active (false);
1604 _show_automation.clear();
1607 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1612 RouteTimeAxisView::region_view_added (RegionView* rv)
1614 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1615 boost::shared_ptr<AutomationTimeAxisView> atv;
1617 if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) {
1618 rv->add_ghost (*atv.get());
1624 RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, boost::shared_ptr<AutomationTimeAxisView> atv)
1626 rv->add_ghost (*atv.get());
1629 RouteTimeAxisView::ProcessorAutomationInfo::~ProcessorAutomationInfo ()
1631 for (vector<ProcessorAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1637 RouteTimeAxisView::ProcessorAutomationNode::~ProcessorAutomationNode ()
1639 parent.remove_processor_automation_node (this);
1643 RouteTimeAxisView::remove_processor_automation_node (ProcessorAutomationNode* pan)
1646 remove_child (pan->view);
1650 RouteTimeAxisView::ProcessorAutomationNode*
1651 RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, ParamID what)
1653 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1655 if ((*i)->processor == processor) {
1657 for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1658 if ((*ii)->what == what) {
1669 legalize_for_xml_node (string str)
1671 string::size_type pos;
1672 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1678 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1679 legal.replace (pos, 1, "_");
1688 RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what)
1691 ProcessorAutomationNode* pan;
1693 if ((pan = find_processor_automation_node (processor, what)) == 0) {
1694 fatal << _("programming error: ")
1695 << string_compose (X_("processor automation curve for %1:%2 not registered with track!"),
1696 processor->name(), what)
1706 name = processor->describe_parameter (what);
1708 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1712 char state_name[256];
1713 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
1715 boost::shared_ptr<AutomationControl> control = processor->control(what, true);
1717 pan->view = boost::shared_ptr<AutomationTimeAxisView>(
1718 new AutomationTimeAxisView (_session, _route, processor, control,
1719 editor, *this, parent_canvas, name, state_name));
1721 pan->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), pan, processor));
1723 if (!pan->view->marked_for_display()) {
1726 pan->menu_item->set_active (true);
1729 add_child (pan->view);
1732 _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), pan->view));
1735 processor->mark_automation_visible (what, true);
1739 RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::ProcessorAutomationNode* pan, boost::shared_ptr<Processor> i)
1742 pan->menu_item->set_active (false);
1745 i->mark_automation_visible (pan->what, false);
1747 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1751 RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor)
1754 boost::shared_ptr<AutomationLine> al;
1756 processor->what_has_visible_automation (s);
1758 for (set<ParamID>::iterator i = s.begin(); i != s.end(); ++i) {
1760 if ((al = find_processor_automation_curve (processor, *i)) != 0) {
1763 add_processor_automation_curve (processor, (*i));
1769 RouteTimeAxisView::add_automation_child(ParamID param, boost::shared_ptr<AutomationTimeAxisView> track)
1771 using namespace Menu_Helpers;
1777 track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
1779 bool hideit = false;
1783 if ((node = track->get_state_node()) != 0) {
1784 if ((prop = node->property ("shown")) != 0) {
1785 if (prop->value() == "yes") {
1791 _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track)));
1796 _show_automation.insert(param);
1797 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1803 RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor> processor)
1805 using namespace Menu_Helpers;
1806 ProcessorAutomationInfo *rai;
1807 list<ProcessorAutomationInfo*>::iterator x;
1809 const std::set<ParamID>& automatable = processor->what_can_be_automated ();
1810 std::set<ParamID> has_visible_automation;
1812 processor->what_has_visible_automation(has_visible_automation);
1814 if (automatable.empty()) {
1818 for (x = processor_automation.begin(); x != processor_automation.end(); ++x) {
1819 if ((*x)->processor == processor) {
1824 if (x == processor_automation.end()) {
1826 rai = new ProcessorAutomationInfo (processor);
1827 processor_automation.push_back (rai);
1835 /* any older menu was deleted at the top of processors_changed()
1836 when we cleared the subplugin menu.
1839 rai->menu = manage (new Menu);
1840 MenuList& items = rai->menu->items();
1841 rai->menu->set_name ("ArdourContextMenu");
1845 for (std::set<ParamID>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1847 ProcessorAutomationNode* pan;
1848 CheckMenuItem* mitem;
1850 string name = processor->describe_parameter (*i);
1852 items.push_back (CheckMenuElem (name));
1853 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1855 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1856 mitem->set_active(true);
1859 if ((pan = find_processor_automation_node (processor, *i)) == 0) {
1863 pan = new ProcessorAutomationNode (*i, mitem, *this);
1865 rai->lines.push_back (pan);
1869 pan->menu_item = mitem;
1873 mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, pan));
1876 /* add the menu for this processor, because the subplugin
1877 menu is always cleared at the top of processors_changed().
1878 this is the result of some poor design in gtkmm and/or
1882 subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu));
1887 RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo* rai,
1888 RouteTimeAxisView::ProcessorAutomationNode* pan)
1890 bool showit = pan->menu_item->get_active();
1891 bool redraw = false;
1893 if (pan->view == 0 && showit) {
1894 add_processor_automation_curve (rai->processor, pan->what);
1898 if (showit != pan->view->marked_for_display()) {
1901 pan->view->set_marked_for_display (true);
1902 pan->view->canvas_display->show();
1904 rai->processor->mark_automation_visible (pan->what, true);
1905 pan->view->set_marked_for_display (false);
1913 if (redraw && !no_redraw) {
1915 /* now trigger a redisplay */
1917 _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1923 RouteTimeAxisView::processors_changed ()
1925 using namespace Menu_Helpers;
1927 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
1928 (*i)->valid = false;
1931 subplugin_menu.items().clear ();
1933 _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu);
1934 _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves);
1936 for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ) {
1938 list<ProcessorAutomationInfo*>::iterator tmp;
1946 processor_automation.erase (i);
1953 /* change in visibility was possible */
1955 _route->gui_changed ("track_height", this);
1958 boost::shared_ptr<AutomationLine>
1959 RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what)
1961 ProcessorAutomationNode* pan;
1963 if ((pan = find_processor_automation_node (processor, what)) != 0) {
1969 return boost::shared_ptr<AutomationLine>();
1973 RouteTimeAxisView::reset_processor_automation_curves ()
1975 for (ProcessorAutomationCurves::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) {
1981 RouteTimeAxisView::update_rec_display ()
1983 RouteUI::update_rec_display ();
1984 name_entry.set_sensitive (!_route->record_enabled());