2 Copyright (C) 2000 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>
34 #include <gtkmm2ext/bindable_button.h>
35 #include <gtkmm2ext/gtk_ui.h>
36 #include <gtkmm2ext/selector.h>
37 #include <gtkmm2ext/stop_signal.h>
38 #include <gtkmm2ext/utils.h>
40 #include <ardour/audioplaylist.h>
41 #include <ardour/diskstream.h>
42 #include <ardour/insert.h>
43 #include <ardour/ladspa_plugin.h>
44 #include <ardour/location.h>
45 #include <ardour/panner.h>
46 #include <ardour/playlist.h>
47 #include <ardour/session.h>
48 #include <ardour/session_playlist.h>
49 #include <ardour/utils.h>
51 #include "ardour_ui.h"
52 #include "audio_time_axis.h"
53 #include "automation_gain_line.h"
54 #include "automation_pan_line.h"
55 #include "automation_time_axis.h"
56 #include "canvas_impl.h"
57 #include "crossfade_view.h"
59 #include "gain_automation_time_axis.h"
60 #include "gui_thread.h"
62 #include "pan_automation_time_axis.h"
63 #include "playlist_selector.h"
64 #include "plugin_selector.h"
65 #include "plugin_ui.h"
66 #include "point_selection.h"
68 #include "public_editor.h"
69 #include "redirect_automation_line.h"
70 #include "redirect_automation_time_axis.h"
71 #include "regionview.h"
72 #include "rgb_macros.h"
73 #include "selection.h"
74 #include "simplerect.h"
75 #include "streamview.h"
78 #include <ardour/audio_track.h>
82 using namespace ARDOUR;
83 using namespace LADSPA;
85 using namespace Editing;
88 AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas)
90 RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
91 TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
92 parent_canvas (canvas),
94 edit_group_button (_("g")), // group
95 playlist_button (_("p")),
96 size_button (_("h")), // height
97 automation_button (_("a")),
98 visual_button (_("v"))
102 subplugin_menu.set_name ("ArdourContextMenu");
104 playlist_action_menu = 0;
105 automation_action_menu = 0;
109 timestretch_rect = 0;
111 pan_automation_item = 0;
112 gain_automation_item = 0;
115 view = new StreamView (*this);
117 add_gain_automation_child ();
118 add_pan_automation_child ();
120 ignore_toggle = false;
122 rec_enable_button->set_active (false);
123 mute_button->set_active (false);
124 solo_button->set_active (false);
126 rec_enable_button->set_name ("TrackRecordEnableButton");
127 mute_button->set_name ("TrackMuteButton");
128 solo_button->set_name ("SoloButton");
129 edit_group_button.set_name ("TrackGroupButton");
130 playlist_button.set_name ("TrackPlaylistButton");
131 automation_button.set_name ("TrackAutomationButton");
132 size_button.set_name ("TrackSizeButton");
133 visual_button.set_name ("TrackVisualButton");
134 hide_button.set_name ("TrackRemoveButton");
136 hide_button.add (*(manage (new Image (get_xpm("small_x.xpm")))));
138 _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
139 _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
140 _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
142 _route.panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans));
144 solo_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
145 mute_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
146 rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
147 playlist_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
148 automation_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
149 size_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
150 visual_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
151 hide_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
153 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
154 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
155 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
156 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
157 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
158 edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click), false);
159 playlist_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::playlist_click));
160 automation_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::automation_click));
161 size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click), false);
162 visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
163 hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
165 if (is_audio_track()) {
166 controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
168 controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
169 controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::FILL|Gtk::EXPAND, 0, 0);
171 controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
173 ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
174 ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
175 ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
176 ARDOUR_UI::instance()->tooltips().set_tip(edit_group_button,_("Edit Group"));
177 ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height"));
178 ARDOUR_UI::instance()->tooltips().set_tip(playlist_button,_("Playlist"));
179 ARDOUR_UI::instance()->tooltips().set_tip(automation_button, _("Automation"));
180 ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options"));
181 ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track"));
185 controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
186 controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
187 controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
188 controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
190 if (is_audio_track() && audio_track()->mode() == ARDOUR::Normal) {
191 controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
194 /* remove focus from the buttons */
196 automation_button.unset_flags (Gtk::CAN_FOCUS);
197 solo_button->unset_flags (Gtk::CAN_FOCUS);
198 mute_button->unset_flags (Gtk::CAN_FOCUS);
199 edit_group_button.unset_flags (Gtk::CAN_FOCUS);
200 size_button.unset_flags (Gtk::CAN_FOCUS);
201 playlist_button.unset_flags (Gtk::CAN_FOCUS);
202 hide_button.unset_flags (Gtk::CAN_FOCUS);
203 visual_button.unset_flags (Gtk::CAN_FOCUS);
205 /* map current state of the route */
207 update_diskstream_display ();
210 redirects_changed (0);
211 reset_redirect_automation_curves ();
216 set_state (*xml_node);
218 _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
219 _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
220 _route.redirects_changed.connect (mem_fun(*this, &AudioTimeAxisView::redirects_changed));
222 _route.name_changed.connect (mem_fun(*this, &AudioTimeAxisView::route_name_changed));
224 if (is_audio_track()) {
228 audio_track()->FreezeChange.connect (mem_fun(*this, &AudioTimeAxisView::map_frozen));
230 audio_track()->diskstream_changed.connect (mem_fun(*this, &AudioTimeAxisView::diskstream_changed));
231 get_diskstream()->speed_changed.connect (mem_fun(*this, &AudioTimeAxisView::speed_changed));
233 controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
234 controls_base_selected_name = "AudioTrackControlsBaseSelected";
235 controls_base_unselected_name = "AudioTrackControlsBaseUnselected";
237 /* ask for notifications of any new RegionViews */
239 view->AudioRegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added));
243 /* pick up the correct freeze state */
251 controls_ebox.set_name ("BusControlsBaseUnselected");
252 controls_base_selected_name = "BusControlsBaseSelected";
253 controls_base_unselected_name = "BusControlsBaseUnselected";
256 editor.ZoomChanged.connect (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
257 ColorChanged.connect (mem_fun (*this, &AudioTimeAxisView::color_handler));
260 AudioTimeAxisView::~AudioTimeAxisView ()
262 GoingAway (); /* EMIT_SIGNAL */
265 delete playlist_menu;
269 if (playlist_action_menu) {
270 delete playlist_action_menu;
271 playlist_action_menu = 0;
274 vector_delete (&redirect_automation_curves);
276 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
287 AudioTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
290 xml_node->add_property ("shown_editor", "yes");
292 return TimeAxisView::show_at (y, nth, parent);
296 AudioTimeAxisView::hide ()
299 xml_node->add_property ("shown_editor", "no");
301 TimeAxisView::hide ();
305 AudioTimeAxisView::set_playlist (AudioPlaylist *newplaylist)
309 modified_connection.disconnect ();
310 state_changed_connection.disconnect ();
312 if ((pl = dynamic_cast<AudioPlaylist*> (playlist())) != 0) {
313 state_changed_connection = pl->StateChanged.connect (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed));
314 modified_connection = pl->Modified.connect (mem_fun(*this, &AudioTimeAxisView::playlist_modified));
319 AudioTimeAxisView::playlist_modified ()
324 AudioTimeAxisView::edit_click (GdkEventButton *ev)
326 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
327 _route.set_edit_group (0, this);
331 using namespace Menu_Helpers;
333 MenuList& items = edit_group_menu.items ();
334 RadioMenuItem::Group group;
337 items.push_back (RadioMenuElem (group, _("No group"),
338 bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
340 if (_route.edit_group() == 0) {
341 static_cast<RadioMenuItem*>(&items.back())->set_active ();
344 _session.foreach_edit_group (bind (mem_fun (*this, &AudioTimeAxisView::add_edit_group_menu_item), &group));
345 edit_group_menu.popup (ev->button, ev->time);
351 AudioTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
353 using namespace Menu_Helpers;
355 MenuList &items = edit_group_menu.items();
357 items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
358 if (_route.edit_group() == eg) {
359 static_cast<RadioMenuItem*>(&items.back())->set_active ();
364 AudioTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
367 _route.set_edit_group (eg, this);
371 AudioTimeAxisView::playlist_state_changed (Change ignored)
373 // ENSURE_GUI_THREAD (bind (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed), ignored));
378 AudioTimeAxisView::playlist_changed ()
383 if (is_audio_track()) {
384 set_playlist (get_diskstream()->playlist());
389 AudioTimeAxisView::label_view ()
391 string x = _route.name();
393 if (x != name_entry.get_text()) {
394 name_entry.set_text (x);
397 ARDOUR_UI::instance()->tooltips().set_tip (name_entry, x);
401 AudioTimeAxisView::route_name_changed (void *src)
403 editor.route_name_changed (this);
408 AudioTimeAxisView::take_name_changed (void *src)
417 AudioTimeAxisView::playlist_click ()
419 // always build a new action menu
421 if (playlist_action_menu == 0) {
422 playlist_action_menu = new Menu;
423 playlist_action_menu->set_name ("ArdourContextMenu");
426 build_playlist_menu(playlist_action_menu);
428 playlist_action_menu->popup (1, 0);
432 AudioTimeAxisView::automation_click ()
434 if (automation_action_menu == 0) {
435 /* this seems odd, but the automation action
436 menu is built as part of the display menu.
438 build_display_menu ();
440 automation_action_menu->popup (1, 0);
444 AudioTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end)
450 TimeAxisView::show_timestretch (start, end);
460 /* check that the time selection was made in our route, or our edit group.
461 remember that edit_group() == 0 implies the route is *not* in a edit group.
464 if (!(ts.track == this || (ts.group != 0 && ts.group == _route.edit_group()))) {
465 /* this doesn't apply to us */
469 /* ignore it if our edit group is not active */
471 if ((ts.track != this) && _route.edit_group() && !_route.edit_group()->is_active()) {
476 if (timestretch_rect == 0) {
477 timestretch_rect = new SimpleRect (*canvas_display);
478 timestretch_rect->property_x1() = 0.0;
479 timestretch_rect->property_y1() = 0.0;
480 timestretch_rect->property_x2() = 0.0;
481 timestretch_rect->property_y2() = 0.0;
482 timestretch_rect->property_fill_color_rgba() = color_map[cTimeStretchFill];
483 timestretch_rect->property_outline_color_rgba() = color_map[cTimeStretchOutline];
486 timestretch_rect->show ();
487 timestretch_rect->raise_to_top ();
489 x1 = start / editor.get_current_zoom();
490 x2 = (end - 1) / editor.get_current_zoom();
493 timestretch_rect->property_x1() = x1;
494 timestretch_rect->property_y1() = 1.0;
495 timestretch_rect->property_x2() = x2;
496 timestretch_rect->property_y2() = y2;
500 AudioTimeAxisView::hide_timestretch ()
502 TimeAxisView::hide_timestretch ();
504 if (timestretch_rect) {
505 timestretch_rect->hide ();
510 AudioTimeAxisView::show_selection (TimeSelection& ts)
514 /* ignore it if our edit group is not active or if the selection was started
515 in some other track or edit group (remember that edit_group() == 0 means
516 that the track is not in an edit group).
519 if (((ts.track != this && !is_child (ts.track)) && _route.edit_group() && !_route.edit_group()->is_active()) ||
520 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route.edit_group())))) {
526 TimeAxisView::show_selection (ts);
530 AudioTimeAxisView::set_state (const XMLNode& node)
532 const XMLProperty *prop;
534 TimeAxisView::set_state (node);
536 if ((prop = node.property ("shown_editor")) != 0) {
537 if (prop->value() == "no") {
538 _marked_for_display = false;
540 _marked_for_display = true;
543 _marked_for_display = true;
546 XMLNodeList nlist = node.children();
547 XMLNodeConstIterator niter;
551 show_gain_automation = false;
552 show_pan_automation = false;
554 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
557 if (child_node->name() == "gain") {
558 XMLProperty *prop=child_node->property ("shown");
561 if (prop->value() == "yes") {
562 show_gain_automation = true;
568 if (child_node->name() == "pan") {
569 XMLProperty *prop=child_node->property ("shown");
572 if (prop->value() == "yes") {
573 show_pan_automation = true;
582 AudioTimeAxisView::set_height (TrackHeight h)
584 bool height_changed = (h != height_style);
586 TimeAxisView::set_height (h);
590 view->set_height ((double) height);
592 switch (height_style) {
594 xml_node->add_property ("track_height", "largest");
597 controls_table.show_all();
600 xml_node->add_property ("track_height", "large");
603 controls_table.show_all();
606 xml_node->add_property ("track_height", "larger");
609 controls_table.show_all();
612 xml_node->add_property ("track_height", "normal");
615 controls_table.show_all();
618 xml_node->add_property ("track_height", "smaller");
619 controls_table.show_all ();
622 edit_group_button.hide ();
624 visual_button.hide ();
626 automation_button.hide ();
627 playlist_button.hide ();
630 xml_node->add_property ("track_height", "small");
631 controls_table.hide_all ();
632 controls_table.show ();
635 name_label.set_text (_route.name());
639 if (height_changed) {
640 /* only emit the signal if the height really changed */
641 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
646 AudioTimeAxisView::select_track_color ()
648 if (RouteUI::choose_color ()) {
651 view->apply_color (_color, StreamView::RegionColor);
657 AudioTimeAxisView::reset_redirect_automation_curves ()
659 for (vector<RedirectAutomationLine*>::iterator i = redirect_automation_curves.begin(); i != redirect_automation_curves.end(); ++i) {
665 AudioTimeAxisView::reset_samples_per_unit ()
667 set_samples_per_unit (editor.get_current_zoom());
671 AudioTimeAxisView::set_samples_per_unit (double spu)
675 if (get_diskstream() != 0) {
676 speed = get_diskstream()->speed();
680 view->set_samples_per_unit (spu * speed);
683 TimeAxisView::set_samples_per_unit (spu * speed);
687 AudioTimeAxisView::build_display_menu ()
689 using namespace Menu_Helpers;
691 /* get the size menu ready */
697 TimeAxisView::build_display_menu ();
699 /* now fill it with our stuff */
701 MenuList& items = display_menu->items();
702 display_menu->set_name ("ArdourContextMenu");
704 items.push_back (MenuElem (_("Height"), *size_menu));
705 items.push_back (MenuElem (_("Color"), mem_fun(*this, &AudioTimeAxisView::select_track_color)));
708 items.push_back (SeparatorElem());
709 items.push_back (MenuElem (_("Hide all crossfades"), mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
710 items.push_back (MenuElem (_("Show all crossfades"), mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
711 items.push_back (SeparatorElem());
713 build_remote_control_menu ();
714 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
716 automation_action_menu = manage (new Menu);
717 MenuList& automation_items = automation_action_menu->items();
718 automation_action_menu->set_name ("ArdourContextMenu");
720 automation_items.push_back (MenuElem (_("show all automation"),
721 mem_fun(*this, &AudioTimeAxisView::show_all_automation)));
723 automation_items.push_back (MenuElem (_("show existing automation"),
724 mem_fun(*this, &AudioTimeAxisView::show_existing_automation)));
726 automation_items.push_back (MenuElem (_("hide all automation"),
727 mem_fun(*this, &AudioTimeAxisView::hide_all_automation)));
729 automation_items.push_back (SeparatorElem());
731 automation_items.push_back (CheckMenuElem (_("gain"),
732 mem_fun(*this, &AudioTimeAxisView::toggle_gain_track)));
733 gain_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
734 gain_automation_item->set_active(show_gain_automation);
736 automation_items.push_back (CheckMenuElem (_("pan"),
737 mem_fun(*this, &AudioTimeAxisView::toggle_pan_track)));
738 pan_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
739 pan_automation_item->set_active(show_pan_automation);
741 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
743 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
745 Menu *waveform_menu = manage(new Menu);
746 MenuList& waveform_items = waveform_menu->items();
747 waveform_menu->set_name ("ArdourContextMenu");
749 waveform_items.push_back (CheckMenuElem (_("Show waveforms"), mem_fun(*this, &AudioTimeAxisView::toggle_waveforms)));
750 waveform_item = static_cast<CheckMenuItem *> (&waveform_items.back());
751 ignore_toggle = true;
752 waveform_item->set_active (editor.show_waveforms());
753 ignore_toggle = false;
755 RadioMenuItem::Group group;
757 waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
758 traditional_item = static_cast<RadioMenuItem *> (&waveform_items.back());
760 waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
761 rectified_item = static_cast<RadioMenuItem *> (&waveform_items.back());
763 items.push_back (MenuElem (_("Waveform"), *waveform_menu));
765 if (is_audio_track()) {
767 Menu* alignment_menu = manage (new Menu);
768 MenuList& alignment_items = alignment_menu->items();
769 alignment_menu->set_name ("ArdourContextMenu");
771 RadioMenuItem::Group align_group;
773 alignment_items.push_back (RadioMenuElem (align_group, _("align with existing material"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), ExistingMaterial)));
774 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
775 if (get_diskstream()->alignment_style() == ExistingMaterial) {
776 align_existing_item->set_active();
778 alignment_items.push_back (RadioMenuElem (align_group, _("align with capture time"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), CaptureTime)));
779 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
780 if (get_diskstream()->alignment_style() == CaptureTime) {
781 align_capture_item->set_active();
784 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
786 get_diskstream()->AlignmentStyleChanged.connect (mem_fun(*this, &AudioTimeAxisView::align_style_changed));
789 items.push_back (SeparatorElem());
790 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
791 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
792 route_active_menu_item->set_active (_route.active());
794 items.push_back (SeparatorElem());
795 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
800 AudioTimeAxisView::align_style_changed ()
802 switch (get_diskstream()->alignment_style()) {
803 case ExistingMaterial:
804 if (!align_existing_item->get_active()) {
805 align_existing_item->set_active();
809 if (!align_capture_item->get_active()) {
810 align_capture_item->set_active();
817 AudioTimeAxisView::set_align_style (AlignStyle style)
819 get_diskstream()->set_align_style (style);
823 AudioTimeAxisView::rename_current_playlist ()
825 ArdourPrompter prompter (true);
831 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
835 prompter.set_prompt (_("Name for playlist"));
836 prompter.set_initial_text (pl->name());
838 switch (prompter.run ()) {
839 case Gtk::RESPONSE_ACCEPT:
840 prompter.get_result (name);
852 AudioTimeAxisView::use_copy_playlist (bool prompt)
858 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
862 name = Playlist::bump_name (pl->name(), _session);
866 ArdourPrompter prompter (true);
868 prompter.set_prompt (_("Name for playlist"));
869 prompter.set_initial_text (name);
870 prompter.show_all ();
872 switch (prompter.run ()) {
873 case Gtk::RESPONSE_ACCEPT:
874 prompter.get_result (name);
883 ds->use_copy_playlist ();
890 AudioTimeAxisView::use_new_playlist (bool prompt)
896 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
900 name = Playlist::bump_name (pl->name(), _session);
904 ArdourPrompter prompter (true);
906 prompter.set_prompt (_("Name for playlist"));
907 prompter.set_initial_text (name);
909 switch (prompter.run ()) {
910 case Gtk::RESPONSE_ACCEPT:
911 prompter.get_result (name);
920 ds->use_new_playlist ();
927 AudioTimeAxisView::clear_playlist ()
932 if ((ds = get_diskstream()) != 0) {
933 if ((pl = ds->playlist()) != 0) {
934 editor.clear_playlist (*pl);
940 AudioTimeAxisView::toggle_waveforms ()
942 if (view && waveform_item && !ignore_toggle) {
943 view->set_show_waveforms (waveform_item->get_active());
948 AudioTimeAxisView::set_show_waveforms (bool yn)
951 waveform_item->set_active (yn);
953 view->set_show_waveforms (yn);
958 AudioTimeAxisView::set_show_waveforms_recording (bool yn)
961 view->set_show_waveforms_recording (yn);
966 AudioTimeAxisView::set_waveform_shape (WaveformShape shape)
969 view->set_waveform_shape (shape);
974 AudioTimeAxisView::speed_changed ()
976 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
980 AudioTimeAxisView::diskstream_changed (void *src)
982 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::update_diskstream_display));
986 AudioTimeAxisView::update_diskstream_display ()
990 if ((ds = get_diskstream()) != 0) {
991 set_playlist (ds->playlist ());
998 AudioTimeAxisView::selection_click (GdkEventButton* ev)
1000 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route.edit_group());
1002 switch (Keyboard::selection_type (ev->state)) {
1003 case Selection::Toggle:
1004 /* XXX this is not right */
1005 editor.get_selection().add (*tracks);
1008 case Selection::Set:
1009 editor.get_selection().set (*tracks);
1012 case Selection::Extend:
1013 /* not defined yet */
1021 AudioTimeAxisView::set_selected_regionviews (AudioRegionSelection& regions)
1024 view->set_selected_regionviews (regions);
1029 AudioTimeAxisView::set_selected_points (PointSelection& points)
1031 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1032 (*i)->set_selected_points (points);
1037 AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable*>& results)
1041 if (get_diskstream() != 0) {
1042 speed = get_diskstream()->speed();
1045 jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1046 jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1048 if (view && touched (top, bot)) {
1049 view->get_selectables (start_adjusted, end_adjusted, results);
1052 /* pick up visible automation tracks */
1054 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1055 if (!(*i)->hidden()) {
1056 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1062 AudioTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1065 view->get_inverted_selectables (sel, results);
1068 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1069 if (!(*i)->hidden()) {
1070 (*i)->get_inverted_selectables (sel, results);
1078 AudioTimeAxisView::edit_group() const
1080 return _route.edit_group();
1084 AudioTimeAxisView::name() const
1086 return _route.name();
1090 AudioTimeAxisView::playlist () const
1094 if ((ds = get_diskstream()) != 0) {
1095 return ds->playlist();
1102 AudioTimeAxisView::name_entry_changed ()
1106 x = name_entry.get_text ();
1108 if (x == _route.name()) {
1112 if (x.length() == 0) {
1113 name_entry.set_text (_route.name());
1117 strip_whitespace_edges(x);
1119 if (_session.route_name_unique (x)) {
1120 _route.set_name (x, this);
1122 ARDOUR_UI::instance()->popup_error (_("a track already exists with that name"));
1123 name_entry.set_text (_route.name());
1128 AudioTimeAxisView::visual_click ()
1130 popup_display_menu (0);
1134 AudioTimeAxisView::hide_click ()
1136 editor.hide_track_in_display (*this);
1140 AudioTimeAxisView::find_next_region (jack_nframes_t pos, RegionPoint point, int32_t dir)
1143 AudioPlaylist *playlist;
1145 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1146 return playlist->find_next_region (pos, point, dir);
1153 AudioTimeAxisView::add_gain_automation_child ()
1156 AutomationLine* line;
1158 gain_track = new GainAutomationTimeAxisView (_session,
1164 _route.gain_automation_curve());
1166 line = new AutomationGainLine ("automation gain",
1169 *gain_track->canvas_display,
1170 _route.gain_automation_curve());
1172 line->set_line_color (color_map[cAutomationLine]);
1175 gain_track->add_line (*line);
1177 add_child (gain_track);
1179 gain_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::gain_hidden));
1185 if ((node = gain_track->get_state_node()) != 0) {
1186 if ((prop = node->property ("shown")) != 0) {
1187 if (prop->value() == "yes") {
1194 gain_track->hide ();
1199 AudioTimeAxisView::add_pan_automation_child ()
1203 pan_track = new PanAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("pan"));
1207 add_child (pan_track);
1209 pan_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::pan_hidden));
1216 if ((node = pan_track->get_state_node()) != 0) {
1217 if ((prop = node->property ("shown")) != 0) {
1218 if (prop->value() == "yes") {
1230 AudioTimeAxisView::update_pans ()
1234 pan_track->clear_lines ();
1236 /* we don't draw lines for "greater than stereo" panning.
1239 if (_route.n_outputs() > 2) {
1243 for (p = _route.panner().begin(); p != _route.panner().end(); ++p) {
1245 AutomationLine* line;
1247 line = new AutomationPanLine ("automation pan", _session, *pan_track,
1248 *pan_track->canvas_display,
1249 (*p)->automation());
1251 if (p == _route.panner().begin()) {
1252 /* first line is a nice orange */
1253 line->set_line_color (color_map[cLeftPanAutomationLine]);
1255 /* second line is a nice blue */
1256 line->set_line_color (color_map[cRightPanAutomationLine]);
1259 pan_track->add_line (*line);
1264 AudioTimeAxisView::toggle_gain_track ()
1267 bool showit = gain_automation_item->get_active();
1269 if (showit != gain_track->marked_for_display()) {
1271 gain_track->set_marked_for_display (true);
1272 gain_track->canvas_display->show();
1273 gain_track->get_state_node()->add_property ("shown", X_("yes"));
1275 gain_track->set_marked_for_display (false);
1276 gain_track->hide ();
1277 gain_track->get_state_node()->add_property ("shown", X_("no"));
1280 /* now trigger a redisplay */
1283 _route.gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1289 AudioTimeAxisView::gain_hidden ()
1291 gain_track->get_state_node()->add_property (X_("shown"), X_("no"));
1293 if (gain_automation_item && !_hidden) {
1294 gain_automation_item->set_active (false);
1297 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1301 AudioTimeAxisView::toggle_pan_track ()
1303 bool showit = pan_automation_item->get_active();
1305 if (showit != pan_track->marked_for_display()) {
1307 pan_track->set_marked_for_display (true);
1308 pan_track->canvas_display->show();
1309 pan_track->get_state_node()->add_property ("shown", X_("yes"));
1311 pan_track->set_marked_for_display (false);
1313 pan_track->get_state_node()->add_property ("shown", X_("no"));
1316 /* now trigger a redisplay */
1319 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1325 AudioTimeAxisView::pan_hidden ()
1327 pan_track->get_state_node()->add_property ("shown", "no");
1329 if (pan_automation_item && !_hidden) {
1330 pan_automation_item->set_active (false);
1333 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1336 AudioTimeAxisView::RedirectAutomationInfo::~RedirectAutomationInfo ()
1338 for (vector<RedirectAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1344 AudioTimeAxisView::RedirectAutomationNode::~RedirectAutomationNode ()
1346 parent.remove_ran (this);
1354 AudioTimeAxisView::remove_ran (RedirectAutomationNode* ran)
1357 remove_child (ran->view);
1361 AudioTimeAxisView::RedirectAutomationNode*
1362 AudioTimeAxisView::find_redirect_automation_node (Redirect *redirect, uint32_t what)
1364 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1366 if ((*i)->redirect == redirect) {
1368 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1369 if ((*ii)->what == what) {
1380 legalize_for_xml_node (string str)
1382 string::size_type pos;
1383 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1389 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1390 legal.replace (pos, 1, "_");
1399 AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t what)
1401 RedirectAutomationLine* ral;
1403 RedirectAutomationNode* ran;
1405 if ((ran = find_redirect_automation_node (redirect, what)) == 0) {
1406 fatal << _("programming error: ")
1407 << string_compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
1408 redirect->name(), what)
1418 name = redirect->describe_parameter (what);
1420 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1422 char state_name[256];
1423 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (redirect->name()).c_str(), what);
1425 ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *redirect, state_name);
1427 ral = new RedirectAutomationLine (name,
1428 *redirect, what, _session, *ran->view,
1429 *ran->view->canvas_display, redirect->automation_list (what));
1431 ral->set_line_color (color_map[cRedirectAutomationLine]);
1432 ral->queue_reset ();
1434 ran->view->add_line (*ral);
1436 ran->view->Hiding.connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_automation_track_hidden), ran, redirect));
1438 if (!ran->view->marked_for_display()) {
1441 ran->menu_item->set_active (true);
1444 add_child (ran->view);
1446 view->foreach_regionview (bind (mem_fun(*this, &AudioTimeAxisView::add_ghost_to_redirect), ran->view));
1448 redirect->mark_automation_visible (what, true);
1452 AudioTimeAxisView::redirect_automation_track_hidden (AudioTimeAxisView::RedirectAutomationNode* ran, Redirect* r)
1455 ran->menu_item->set_active (false);
1458 r->mark_automation_visible (ran->what, false);
1460 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1464 AudioTimeAxisView::add_existing_redirect_automation_curves (Redirect *redirect)
1467 RedirectAutomationLine *ral;
1469 redirect->what_has_visible_automation (s);
1471 for (set<uint32_t>::iterator i = s.begin(); i != s.end(); ++i) {
1473 if ((ral = find_redirect_automation_curve (redirect, *i)) != 0) {
1474 ral->queue_reset ();
1476 add_redirect_automation_curve (redirect, (*i));
1482 AudioTimeAxisView::add_redirect_to_subplugin_menu (Redirect* r)
1484 using namespace Menu_Helpers;
1485 RedirectAutomationInfo *rai;
1486 list<RedirectAutomationInfo*>::iterator x;
1488 const std::set<uint32_t>& automatable = r->what_can_be_automated ();
1489 std::set<uint32_t> has_visible_automation;
1491 r->what_has_visible_automation(has_visible_automation);
1493 if (automatable.empty()) {
1497 for (x = redirect_automation.begin(); x != redirect_automation.end(); ++x) {
1498 if ((*x)->redirect == r) {
1503 if (x == redirect_automation.end()) {
1505 rai = new RedirectAutomationInfo (r);
1506 redirect_automation.push_back (rai);
1514 /* any older menu was deleted at the top of redirects_changed()
1515 when we cleared the subplugin menu.
1518 rai->menu = manage (new Menu);
1519 MenuList& items = rai->menu->items();
1520 rai->menu->set_name ("ArdourContextMenu");
1524 for (std::set<uint32_t>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1526 RedirectAutomationNode* ran;
1527 CheckMenuItem* mitem;
1529 string name = r->describe_parameter (*i);
1531 items.push_back (CheckMenuElem (name));
1532 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1534 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1535 mitem->set_active(true);
1538 if ((ran = find_redirect_automation_node (r, *i)) == 0) {
1542 ran = new RedirectAutomationNode (*i, mitem, *this);
1544 rai->lines.push_back (ran);
1548 ran->menu_item = mitem;
1552 mitem->signal_toggled().connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
1555 /* add the menu for this redirect, because the subplugin
1556 menu is always cleared at the top of redirects_changed().
1557 this is the result of some poor design in gtkmm and/or
1561 subplugin_menu.items().push_back (MenuElem (r->name(), *rai->menu));
1566 AudioTimeAxisView::redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo* rai,
1567 AudioTimeAxisView::RedirectAutomationNode* ran)
1569 bool showit = ran->menu_item->get_active();
1570 bool redraw = false;
1572 if (ran->view == 0 && showit) {
1573 add_redirect_automation_curve (rai->redirect, ran->what);
1577 if (showit != ran->view->marked_for_display()) {
1580 ran->view->set_marked_for_display (true);
1581 ran->view->canvas_display->show();
1583 rai->redirect->mark_automation_visible (ran->what, true);
1584 ran->view->set_marked_for_display (false);
1592 if (redraw && !no_redraw) {
1594 /* now trigger a redisplay */
1596 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1602 AudioTimeAxisView::redirects_changed (void *src)
1604 using namespace Menu_Helpers;
1606 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1607 (*i)->valid = false;
1610 subplugin_menu.items().clear ();
1612 _route.foreach_redirect (this, &AudioTimeAxisView::add_redirect_to_subplugin_menu);
1613 _route.foreach_redirect (this, &AudioTimeAxisView::add_existing_redirect_automation_curves);
1615 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ) {
1617 list<RedirectAutomationInfo*>::iterator tmp;
1625 redirect_automation.erase (i);
1632 /* change in visibility was possible */
1634 _route.gui_changed ("track_height", this);
1637 RedirectAutomationLine *
1638 AudioTimeAxisView::find_redirect_automation_curve (Redirect *redirect, uint32_t what)
1640 RedirectAutomationNode* ran;
1642 if ((ran = find_redirect_automation_node (redirect, what)) != 0) {
1644 return dynamic_cast<RedirectAutomationLine*> (ran->view->lines.front());
1652 AudioTimeAxisView::show_all_automation ()
1656 pan_automation_item->set_active (true);
1657 gain_automation_item->set_active (true);
1659 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1660 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1661 if ((*ii)->view == 0) {
1662 add_redirect_automation_curve ((*i)->redirect, (*ii)->what);
1665 (*ii)->menu_item->set_active (true);
1671 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1675 AudioTimeAxisView::show_existing_automation ()
1679 pan_automation_item->set_active (true);
1680 gain_automation_item->set_active (true);
1682 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1683 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1684 if ((*ii)->view != 0) {
1685 (*ii)->menu_item->set_active (true);
1692 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1696 AudioTimeAxisView::hide_all_automation ()
1700 pan_automation_item->set_active (false);
1701 gain_automation_item->set_active (false);
1703 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1704 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1705 (*ii)->menu_item->set_active (false);
1710 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1714 AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1716 Playlist* what_we_got;
1717 DiskStream* ds = get_diskstream();
1722 /* route is a bus, not a track */
1726 playlist = ds->playlist();
1729 TimeSelection time (selection.time);
1730 float speed = ds->speed();
1731 if (speed != 1.0f) {
1732 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1733 (*i).start = session_frame_to_track_frame((*i).start, speed);
1734 (*i).end = session_frame_to_track_frame((*i).end, speed);
1740 _session.add_undo (playlist->get_memento());
1741 if ((what_we_got = playlist->cut (time)) != 0) {
1742 editor.get_cut_buffer().add (what_we_got);
1743 _session.add_redo_no_execute (playlist->get_memento());
1748 if ((what_we_got = playlist->copy (time)) != 0) {
1749 editor.get_cut_buffer().add (what_we_got);
1754 _session.add_undo (playlist->get_memento());
1755 if ((what_we_got = playlist->cut (time)) != 0) {
1756 _session.add_redo_no_execute (playlist->get_memento());
1757 what_we_got->unref ();
1767 AudioTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection, size_t nth)
1769 if (!is_audio_track()) {
1773 Playlist* playlist = get_diskstream()->playlist();
1774 PlaylistSelection::iterator p;
1776 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1778 if (p == selection.playlists.end()) {
1782 if (get_diskstream()->speed() != 1.0f)
1783 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1785 _session.add_undo (playlist->get_memento());
1786 playlist->paste (**p, pos, times);
1787 _session.add_redo_no_execute (playlist->get_memento());
1793 AudioTimeAxisView::region_view_added (AudioRegionView* arv)
1795 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1796 AutomationTimeAxisView* atv;
1798 if ((atv = dynamic_cast<AutomationTimeAxisView*> (*i)) != 0) {
1799 arv->add_ghost (*atv);
1805 AudioTimeAxisView::add_ghost_to_redirect (AudioRegionView* arv, AutomationTimeAxisView* atv)
1807 arv->add_ghost (*atv);
1811 AudioTimeAxisView::get_child_list()
1814 list<TimeAxisView*>redirect_children;
1816 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1817 if (!(*i)->hidden()) {
1818 redirect_children.push_back(*i);
1821 return redirect_children;
1826 AudioTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1828 using namespace Menu_Helpers;
1830 if (!menu || !is_audio_track()) {
1834 MenuList& playlist_items = menu->items();
1835 menu->set_name ("ArdourContextMenu");
1836 playlist_items.clear();
1838 if (playlist_menu) {
1839 delete playlist_menu;
1841 playlist_menu = new Menu;
1842 playlist_menu->set_name ("ArdourContextMenu");
1844 playlist_items.push_back (MenuElem (string_compose (_("Current: %1"), get_diskstream()->playlist()->name())));
1845 playlist_items.push_back (SeparatorElem());
1847 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &AudioTimeAxisView::rename_current_playlist)));
1848 playlist_items.push_back (SeparatorElem());
1850 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1851 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1852 playlist_items.push_back (SeparatorElem());
1853 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1854 playlist_items.push_back (SeparatorElem());
1855 playlist_items.push_back (MenuElem(_("Select"), mem_fun(*this, &AudioTimeAxisView::show_playlist_selector)));
1860 AudioTimeAxisView::show_playlist_selector ()
1862 editor.playlist_selector().show_for (this);
1867 AudioTimeAxisView::map_frozen ()
1869 if (!is_audio_track()) {
1873 ENSURE_GUI_THREAD (mem_fun(*this, &AudioTimeAxisView::map_frozen));
1876 switch (audio_track()->freeze_state()) {
1877 case AudioTrack::Frozen:
1878 playlist_button.set_sensitive (false);
1879 rec_enable_button->set_sensitive (false);
1882 playlist_button.set_sensitive (true);
1883 rec_enable_button->set_sensitive (true);
1889 AudioTimeAxisView::show_all_xfades ()
1892 view->show_all_xfades ();
1897 AudioTimeAxisView::hide_all_xfades ()
1900 view->hide_all_xfades ();
1905 AudioTimeAxisView::hide_dependent_views (TimeAxisViewItem& tavi)
1907 AudioRegionView* rv;
1909 if (view && (rv = dynamic_cast<AudioRegionView*>(&tavi)) != 0) {
1910 view->hide_xfades_involving (*rv);
1915 AudioTimeAxisView::reveal_dependent_views (TimeAxisViewItem& tavi)
1917 AudioRegionView* rv;
1919 if (view && (rv = dynamic_cast<AudioRegionView*>(&tavi)) != 0) {
1920 view->reveal_xfades_involving (*rv);
1925 AudioTimeAxisView::route_active_changed ()
1927 RouteUI::route_active_changed ();
1929 if (is_audio_track()) {
1930 if (_route.active()) {
1931 controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
1932 controls_base_selected_name = "AudioTrackControlsBaseSelected";
1933 controls_base_unselected_name = "AudioTrackControlsBaseUnselected";
1935 controls_ebox.set_name ("AudioTrackControlsBaseInactiveUnselected");
1936 controls_base_selected_name = "AudioTrackControlsBaseInactiveSelected";
1937 controls_base_unselected_name = "AudioTrackControlsBaseInactiveUnselected";
1940 if (_route.active()) {
1941 controls_ebox.set_name ("BusControlsBaseUnselected");
1942 controls_base_selected_name = "BusControlsBaseSelected";
1943 controls_base_unselected_name = "BusControlsBaseUnselected";
1945 controls_ebox.set_name ("BusControlsBaseInactiveUnselected");
1946 controls_base_selected_name = "BusControlsBaseInactiveSelected";
1947 controls_base_unselected_name = "BusControlsBaseInactiveUnselected";
1953 AudioTimeAxisView::get_child_xml_node (const string & childname)
1955 return RouteUI::get_child_xml_node (childname);
1959 AudioTimeAxisView::color_handler (ColorID id, uint32_t val)
1962 case cTimeStretchOutline:
1963 timestretch_rect->property_outline_color_rgba() = val;
1965 case cTimeStretchFill:
1966 timestretch_rect->property_fill_color_rgba() = val;
1974 AudioTimeAxisView::select_me (GdkEventButton* ev)
1976 editor.get_selection().add (this);