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/gtk_ui.h>
35 #include <gtkmm2ext/selector.h>
36 #include <gtkmm2ext/stop_signal.h>
37 #include <gtkmm2ext/bindable_button.h>
38 #include <gtkmm2ext/utils.h>
40 #include <ardour/audioplaylist.h>
41 #include <ardour/audio_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;
84 using namespace LADSPA;
86 using namespace Editing;
89 AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas)
91 RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
92 TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
93 parent_canvas (canvas),
95 edit_group_button (_("g")), // group
96 playlist_button (_("p")),
97 size_button (_("h")), // height
98 automation_button (_("a")),
99 visual_button (_("v"))
103 subplugin_menu.set_name ("ArdourContextMenu");
105 playlist_action_menu = 0;
106 automation_action_menu = 0;
110 timestretch_rect = 0;
112 pan_automation_item = 0;
113 gain_automation_item = 0;
116 view = new StreamView (*this);
118 add_gain_automation_child ();
119 add_pan_automation_child ();
121 ignore_toggle = false;
123 mute_button->set_active (false);
124 solo_button->set_active (false);
126 mute_button->set_name ("TrackMuteButton");
127 solo_button->set_name ("SoloButton");
128 edit_group_button.set_name ("TrackGroupButton");
129 playlist_button.set_name ("TrackPlaylistButton");
130 automation_button.set_name ("TrackAutomationButton");
131 size_button.set_name ("TrackSizeButton");
132 visual_button.set_name ("TrackVisualButton");
133 hide_button.set_name ("TrackRemoveButton");
135 hide_button.add (*(manage (new Image (get_xpm("small_x.xpm")))));
137 solo_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
138 mute_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
139 playlist_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
140 automation_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
141 size_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
142 visual_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
143 hide_button.signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
145 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
146 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
147 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
148 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
149 edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click), false);
150 playlist_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::playlist_click));
151 automation_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::automation_click));
152 size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click), false);
153 visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
154 hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
156 if (is_audio_track()) {
157 rec_enable_button->set_active (false);
158 rec_enable_button->set_name ("TrackRecordEnableButton");
159 rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &AudioTimeAxisView::select_me), false);
160 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
161 controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
162 ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
165 controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
166 controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::FILL|Gtk::EXPAND, 0, 0);
168 controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
170 ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
171 ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
172 ARDOUR_UI::instance()->tooltips().set_tip(edit_group_button,_("Edit Group"));
173 ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height"));
174 ARDOUR_UI::instance()->tooltips().set_tip(playlist_button,_("Playlist"));
175 ARDOUR_UI::instance()->tooltips().set_tip(automation_button, _("Automation"));
176 ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options"));
177 ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track"));
181 controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
182 controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
183 controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
184 controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
186 if (is_audio_track() && audio_track()->mode() == ARDOUR::Normal) {
187 controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
190 /* remove focus from the buttons */
192 automation_button.unset_flags (Gtk::CAN_FOCUS);
193 solo_button->unset_flags (Gtk::CAN_FOCUS);
194 mute_button->unset_flags (Gtk::CAN_FOCUS);
195 edit_group_button.unset_flags (Gtk::CAN_FOCUS);
196 size_button.unset_flags (Gtk::CAN_FOCUS);
197 playlist_button.unset_flags (Gtk::CAN_FOCUS);
198 hide_button.unset_flags (Gtk::CAN_FOCUS);
199 visual_button.unset_flags (Gtk::CAN_FOCUS);
201 /* map current state of the route */
203 update_diskstream_display ();
206 redirects_changed (0);
207 reset_redirect_automation_curves ();
212 set_state (*xml_node);
214 _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
215 _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
216 _route.redirects_changed.connect (mem_fun(*this, &AudioTimeAxisView::redirects_changed));
217 _route.name_changed.connect (mem_fun(*this, &AudioTimeAxisView::route_name_changed));
218 _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
219 _route.panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans));
221 if (is_audio_track()) {
225 audio_track()->FreezeChange.connect (mem_fun(*this, &AudioTimeAxisView::map_frozen));
227 audio_track()->diskstream_changed.connect (mem_fun(*this, &AudioTimeAxisView::diskstream_changed));
228 get_diskstream()->speed_changed.connect (mem_fun(*this, &AudioTimeAxisView::speed_changed));
230 controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
231 controls_base_selected_name = "AudioTrackControlsBaseSelected";
232 controls_base_unselected_name = "AudioTrackControlsBaseUnselected";
234 /* ask for notifications of any new RegionViews */
236 view->AudioRegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added));
240 /* pick up the correct freeze state */
248 controls_ebox.set_name ("BusControlsBaseUnselected");
249 controls_base_selected_name = "BusControlsBaseSelected";
250 controls_base_unselected_name = "BusControlsBaseUnselected";
253 editor.ZoomChanged.connect (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
254 ColorChanged.connect (mem_fun (*this, &AudioTimeAxisView::color_handler));
257 AudioTimeAxisView::~AudioTimeAxisView ()
259 GoingAway (); /* EMIT_SIGNAL */
262 delete playlist_menu;
266 if (playlist_action_menu) {
267 delete playlist_action_menu;
268 playlist_action_menu = 0;
271 vector_delete (&redirect_automation_curves);
273 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
284 AudioTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
287 xml_node->add_property ("shown_editor", "yes");
289 return TimeAxisView::show_at (y, nth, parent);
293 AudioTimeAxisView::hide ()
296 xml_node->add_property ("shown_editor", "no");
298 TimeAxisView::hide ();
302 AudioTimeAxisView::set_playlist (AudioPlaylist *newplaylist)
306 modified_connection.disconnect ();
307 state_changed_connection.disconnect ();
309 if ((pl = dynamic_cast<AudioPlaylist*> (playlist())) != 0) {
310 state_changed_connection = pl->StateChanged.connect (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed));
311 modified_connection = pl->Modified.connect (mem_fun(*this, &AudioTimeAxisView::playlist_modified));
316 AudioTimeAxisView::playlist_modified ()
321 AudioTimeAxisView::edit_click (GdkEventButton *ev)
323 if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
324 _route.set_edit_group (0, this);
328 using namespace Menu_Helpers;
330 MenuList& items = edit_group_menu.items ();
331 RadioMenuItem::Group group;
334 items.push_back (RadioMenuElem (group, _("No group"),
335 bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
337 if (_route.edit_group() == 0) {
338 static_cast<RadioMenuItem*>(&items.back())->set_active ();
341 _session.foreach_edit_group (bind (mem_fun (*this, &AudioTimeAxisView::add_edit_group_menu_item), &group));
342 edit_group_menu.popup (ev->button, ev->time);
348 AudioTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
350 using namespace Menu_Helpers;
352 MenuList &items = edit_group_menu.items();
354 cerr << "adding edit group called " << eg->name() << endl;
356 items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
357 if (_route.edit_group() == eg) {
358 static_cast<RadioMenuItem*>(&items.back())->set_active ();
363 AudioTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
366 _route.set_edit_group (eg, this);
370 AudioTimeAxisView::playlist_state_changed (Change ignored)
372 // ENSURE_GUI_THREAD (bind (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed), ignored));
377 AudioTimeAxisView::playlist_changed ()
382 if (is_audio_track()) {
383 set_playlist (get_diskstream()->playlist());
388 AudioTimeAxisView::label_view ()
390 string x = _route.name();
392 if (x != name_entry.get_text()) {
393 name_entry.set_text (x);
396 ARDOUR_UI::instance()->tooltips().set_tip (name_entry, x);
400 AudioTimeAxisView::route_name_changed (void *src)
402 editor.route_name_changed (this);
407 AudioTimeAxisView::take_name_changed (void *src)
416 AudioTimeAxisView::playlist_click ()
418 // always build a new action menu
420 if (playlist_action_menu == 0) {
421 playlist_action_menu = new Menu;
422 playlist_action_menu->set_name ("ArdourContextMenu");
425 build_playlist_menu(playlist_action_menu);
427 playlist_action_menu->popup (1, 0);
431 AudioTimeAxisView::automation_click ()
433 if (automation_action_menu == 0) {
434 /* this seems odd, but the automation action
435 menu is built as part of the display menu.
437 build_display_menu ();
439 automation_action_menu->popup (1, 0);
443 AudioTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end)
449 TimeAxisView::show_timestretch (start, end);
459 /* check that the time selection was made in our route, or our edit group.
460 remember that edit_group() == 0 implies the route is *not* in a edit group.
463 if (!(ts.track == this || (ts.group != 0 && ts.group == _route.edit_group()))) {
464 /* this doesn't apply to us */
468 /* ignore it if our edit group is not active */
470 if ((ts.track != this) && _route.edit_group() && !_route.edit_group()->is_active()) {
475 if (timestretch_rect == 0) {
476 timestretch_rect = new SimpleRect (*canvas_display);
477 timestretch_rect->property_x1() = 0.0;
478 timestretch_rect->property_y1() = 0.0;
479 timestretch_rect->property_x2() = 0.0;
480 timestretch_rect->property_y2() = 0.0;
481 timestretch_rect->property_fill_color_rgba() = color_map[cTimeStretchFill];
482 timestretch_rect->property_outline_color_rgba() = color_map[cTimeStretchOutline];
485 timestretch_rect->show ();
486 timestretch_rect->raise_to_top ();
488 x1 = start / editor.get_current_zoom();
489 x2 = (end - 1) / editor.get_current_zoom();
492 timestretch_rect->property_x1() = x1;
493 timestretch_rect->property_y1() = 1.0;
494 timestretch_rect->property_x2() = x2;
495 timestretch_rect->property_y2() = y2;
499 AudioTimeAxisView::hide_timestretch ()
501 TimeAxisView::hide_timestretch ();
503 if (timestretch_rect) {
504 timestretch_rect->hide ();
509 AudioTimeAxisView::show_selection (TimeSelection& ts)
513 /* ignore it if our edit group is not active or if the selection was started
514 in some other track or edit group (remember that edit_group() == 0 means
515 that the track is not in an edit group).
518 if (((ts.track != this && !is_child (ts.track)) && _route.edit_group() && !_route.edit_group()->is_active()) ||
519 (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route.edit_group())))) {
525 TimeAxisView::show_selection (ts);
529 AudioTimeAxisView::set_state (const XMLNode& node)
531 const XMLProperty *prop;
533 TimeAxisView::set_state (node);
535 if ((prop = node.property ("shown_editor")) != 0) {
536 if (prop->value() == "no") {
537 _marked_for_display = false;
539 _marked_for_display = true;
542 _marked_for_display = true;
545 XMLNodeList nlist = node.children();
546 XMLNodeConstIterator niter;
550 show_gain_automation = false;
551 show_pan_automation = false;
553 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
556 if (child_node->name() == "gain") {
557 XMLProperty *prop=child_node->property ("shown");
560 if (prop->value() == "yes") {
561 show_gain_automation = true;
567 if (child_node->name() == "pan") {
568 XMLProperty *prop=child_node->property ("shown");
571 if (prop->value() == "yes") {
572 show_pan_automation = true;
581 AudioTimeAxisView::set_height (TrackHeight h)
583 bool height_changed = (height == 0) || (h != height_style);
585 TimeAxisView::set_height (h);
589 view->set_height ((double) height);
591 switch (height_style) {
593 xml_node->add_property ("track_height", "largest");
596 controls_table.show_all();
599 xml_node->add_property ("track_height", "large");
602 controls_table.show_all();
605 xml_node->add_property ("track_height", "larger");
608 controls_table.show_all();
611 xml_node->add_property ("track_height", "normal");
614 controls_table.show_all();
617 xml_node->add_property ("track_height", "smaller");
618 controls_table.show_all ();
621 edit_group_button.hide ();
623 visual_button.hide ();
625 automation_button.hide ();
626 playlist_button.hide ();
629 xml_node->add_property ("track_height", "small");
630 controls_table.hide_all ();
631 controls_table.show ();
634 name_label.set_text (_route.name());
638 if (height_changed) {
639 /* only emit the signal if the height really changed */
640 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
645 AudioTimeAxisView::select_track_color ()
647 if (RouteUI::choose_color ()) {
650 view->apply_color (_color, StreamView::RegionColor);
656 AudioTimeAxisView::reset_redirect_automation_curves ()
658 for (vector<RedirectAutomationLine*>::iterator i = redirect_automation_curves.begin(); i != redirect_automation_curves.end(); ++i) {
664 AudioTimeAxisView::reset_samples_per_unit ()
666 set_samples_per_unit (editor.get_current_zoom());
670 AudioTimeAxisView::set_samples_per_unit (double spu)
674 if (get_diskstream() != 0) {
675 speed = get_diskstream()->speed();
679 view->set_samples_per_unit (spu * speed);
682 TimeAxisView::set_samples_per_unit (spu * speed);
686 AudioTimeAxisView::build_display_menu ()
688 using namespace Menu_Helpers;
690 /* get the size menu ready */
696 TimeAxisView::build_display_menu ();
698 /* now fill it with our stuff */
700 MenuList& items = display_menu->items();
701 display_menu->set_name ("ArdourContextMenu");
703 items.push_back (MenuElem (_("Height"), *size_menu));
704 items.push_back (MenuElem (_("Color"), mem_fun(*this, &AudioTimeAxisView::select_track_color)));
707 items.push_back (SeparatorElem());
708 items.push_back (MenuElem (_("Hide all crossfades"), mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
709 items.push_back (MenuElem (_("Show all crossfades"), mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
710 items.push_back (SeparatorElem());
712 build_remote_control_menu ();
713 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
715 automation_action_menu = manage (new Menu);
716 MenuList& automation_items = automation_action_menu->items();
717 automation_action_menu->set_name ("ArdourContextMenu");
719 automation_items.push_back (MenuElem (_("Show all automation"),
720 mem_fun(*this, &AudioTimeAxisView::show_all_automation)));
722 automation_items.push_back (MenuElem (_("Show existing automation"),
723 mem_fun(*this, &AudioTimeAxisView::show_existing_automation)));
725 automation_items.push_back (MenuElem (_("Hide all automation"),
726 mem_fun(*this, &AudioTimeAxisView::hide_all_automation)));
728 automation_items.push_back (SeparatorElem());
730 automation_items.push_back (CheckMenuElem (_("Fader"),
731 mem_fun(*this, &AudioTimeAxisView::toggle_gain_track)));
732 gain_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
733 gain_automation_item->set_active(show_gain_automation);
735 automation_items.push_back (CheckMenuElem (_("Pan"),
736 mem_fun(*this, &AudioTimeAxisView::toggle_pan_track)));
737 pan_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
738 pan_automation_item->set_active(show_pan_automation);
740 automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
742 items.push_back (MenuElem (_("Automation"), *automation_action_menu));
744 Menu *waveform_menu = manage(new Menu);
745 MenuList& waveform_items = waveform_menu->items();
746 waveform_menu->set_name ("ArdourContextMenu");
748 waveform_items.push_back (CheckMenuElem (_("Show waveforms"), mem_fun(*this, &AudioTimeAxisView::toggle_waveforms)));
749 waveform_item = static_cast<CheckMenuItem *> (&waveform_items.back());
750 ignore_toggle = true;
751 waveform_item->set_active (editor.show_waveforms());
752 ignore_toggle = false;
754 RadioMenuItem::Group group;
756 waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
757 traditional_item = static_cast<RadioMenuItem *> (&waveform_items.back());
759 waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
760 rectified_item = static_cast<RadioMenuItem *> (&waveform_items.back());
762 items.push_back (MenuElem (_("Waveform"), *waveform_menu));
764 if (is_audio_track()) {
766 Menu* alignment_menu = manage (new Menu);
767 MenuList& alignment_items = alignment_menu->items();
768 alignment_menu->set_name ("ArdourContextMenu");
770 RadioMenuItem::Group align_group;
772 alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), ExistingMaterial)));
773 align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
774 if (get_diskstream()->alignment_style() == ExistingMaterial) {
775 align_existing_item->set_active();
777 alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), CaptureTime)));
778 align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
779 if (get_diskstream()->alignment_style() == CaptureTime) {
780 align_capture_item->set_active();
783 items.push_back (MenuElem (_("Alignment"), *alignment_menu));
785 get_diskstream()->AlignmentStyleChanged.connect (mem_fun(*this, &AudioTimeAxisView::align_style_changed));
788 items.push_back (SeparatorElem());
789 items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
790 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
791 route_active_menu_item->set_active (_route.active());
793 items.push_back (SeparatorElem());
794 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
799 AudioTimeAxisView::align_style_changed ()
801 switch (get_diskstream()->alignment_style()) {
802 case ExistingMaterial:
803 if (!align_existing_item->get_active()) {
804 align_existing_item->set_active();
808 if (!align_capture_item->get_active()) {
809 align_capture_item->set_active();
816 AudioTimeAxisView::set_align_style (AlignStyle style)
818 get_diskstream()->set_align_style (style);
822 AudioTimeAxisView::rename_current_playlist ()
824 ArdourPrompter prompter (true);
830 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
834 prompter.set_prompt (_("Name for playlist"));
835 prompter.set_initial_text (pl->name());
836 prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
837 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
839 switch (prompter.run ()) {
840 case Gtk::RESPONSE_ACCEPT:
841 prompter.get_result (name);
853 AudioTimeAxisView::use_copy_playlist (bool prompt)
859 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
863 name = Playlist::bump_name (pl->name(), _session);
867 ArdourPrompter prompter (true);
869 prompter.set_prompt (_("Name for Playlist"));
870 prompter.set_initial_text (name);
871 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
872 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
873 prompter.show_all ();
875 switch (prompter.run ()) {
876 case Gtk::RESPONSE_ACCEPT:
877 prompter.get_result (name);
886 ds->use_copy_playlist ();
893 AudioTimeAxisView::use_new_playlist (bool prompt)
899 if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
903 name = Playlist::bump_name (pl->name(), _session);
907 ArdourPrompter prompter (true);
909 prompter.set_prompt (_("Name for Playlist"));
910 prompter.set_initial_text (name);
911 prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
912 prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
914 switch (prompter.run ()) {
915 case Gtk::RESPONSE_ACCEPT:
916 prompter.get_result (name);
925 ds->use_new_playlist ();
932 AudioTimeAxisView::clear_playlist ()
937 if ((ds = get_diskstream()) != 0) {
938 if ((pl = ds->playlist()) != 0) {
939 editor.clear_playlist (*pl);
945 AudioTimeAxisView::toggle_waveforms ()
947 if (view && waveform_item && !ignore_toggle) {
948 view->set_show_waveforms (waveform_item->get_active());
953 AudioTimeAxisView::set_show_waveforms (bool yn)
956 waveform_item->set_active (yn);
958 view->set_show_waveforms (yn);
963 AudioTimeAxisView::set_show_waveforms_recording (bool yn)
966 view->set_show_waveforms_recording (yn);
971 AudioTimeAxisView::set_waveform_shape (WaveformShape shape)
974 view->set_waveform_shape (shape);
979 AudioTimeAxisView::speed_changed ()
981 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
985 AudioTimeAxisView::diskstream_changed (void *src)
987 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::update_diskstream_display));
991 AudioTimeAxisView::update_diskstream_display ()
995 if ((ds = get_diskstream()) != 0) {
996 set_playlist (ds->playlist ());
1003 AudioTimeAxisView::selection_click (GdkEventButton* ev)
1005 PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route.edit_group());
1007 switch (Keyboard::selection_type (ev->state)) {
1008 case Selection::Toggle:
1009 /* XXX this is not right */
1010 editor.get_selection().add (*tracks);
1013 case Selection::Set:
1014 editor.get_selection().set (*tracks);
1017 case Selection::Extend:
1018 /* not defined yet */
1026 AudioTimeAxisView::set_selected_regionviews (AudioRegionSelection& regions)
1029 view->set_selected_regionviews (regions);
1034 AudioTimeAxisView::set_selected_points (PointSelection& points)
1036 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1037 (*i)->set_selected_points (points);
1042 AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable*>& results)
1046 if (get_diskstream() != 0) {
1047 speed = get_diskstream()->speed();
1050 jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
1051 jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
1053 if (view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
1054 view->get_selectables (start_adjusted, end_adjusted, results);
1057 /* pick up visible automation tracks */
1059 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1060 if (!(*i)->hidden()) {
1061 (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
1067 AudioTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
1070 view->get_inverted_selectables (sel, results);
1073 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1074 if (!(*i)->hidden()) {
1075 (*i)->get_inverted_selectables (sel, results);
1083 AudioTimeAxisView::edit_group() const
1085 return _route.edit_group();
1089 AudioTimeAxisView::name() const
1091 return _route.name();
1095 AudioTimeAxisView::playlist () const
1097 AudioDiskstream *ds;
1099 if ((ds = get_diskstream()) != 0) {
1100 return ds->playlist();
1107 AudioTimeAxisView::name_entry_changed ()
1111 x = name_entry.get_text ();
1113 if (x == _route.name()) {
1117 if (x.length() == 0) {
1118 name_entry.set_text (_route.name());
1122 strip_whitespace_edges(x);
1124 if (_session.route_name_unique (x)) {
1125 _route.set_name (x, this);
1127 ARDOUR_UI::instance()->popup_error (_("a track already exists with that name"));
1128 name_entry.set_text (_route.name());
1133 AudioTimeAxisView::visual_click ()
1135 popup_display_menu (0);
1139 AudioTimeAxisView::hide_click ()
1141 editor.hide_track_in_display (*this);
1145 AudioTimeAxisView::find_next_region (jack_nframes_t pos, RegionPoint point, int32_t dir)
1147 AudioDiskstream *stream;
1148 AudioPlaylist *playlist;
1150 if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
1151 return playlist->find_next_region (pos, point, dir);
1158 AudioTimeAxisView::add_gain_automation_child ()
1161 AutomationLine* line;
1163 gain_track = new GainAutomationTimeAxisView (_session,
1169 _route.gain_automation_curve());
1171 line = new AutomationGainLine ("automation gain",
1174 *gain_track->canvas_display,
1175 _route.gain_automation_curve());
1177 line->set_line_color (color_map[cAutomationLine]);
1180 gain_track->add_line (*line);
1182 add_child (gain_track);
1184 gain_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::gain_hidden));
1190 if ((node = gain_track->get_state_node()) != 0) {
1191 if ((prop = node->property ("shown")) != 0) {
1192 if (prop->value() == "yes") {
1199 gain_track->hide ();
1204 AudioTimeAxisView::add_pan_automation_child ()
1208 pan_track = new PanAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("pan"));
1212 add_child (pan_track);
1214 pan_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::pan_hidden));
1221 if ((node = pan_track->get_state_node()) != 0) {
1222 if ((prop = node->property ("shown")) != 0) {
1223 if (prop->value() == "yes") {
1235 AudioTimeAxisView::update_pans ()
1239 pan_track->clear_lines ();
1241 /* we don't draw lines for "greater than stereo" panning.
1244 if (_route.n_outputs() > 2) {
1248 for (p = _route.panner().begin(); p != _route.panner().end(); ++p) {
1250 AutomationLine* line;
1252 line = new AutomationPanLine ("automation pan", _session, *pan_track,
1253 *pan_track->canvas_display,
1254 (*p)->automation());
1256 if (p == _route.panner().begin()) {
1257 /* first line is a nice orange */
1258 line->set_line_color (color_map[cLeftPanAutomationLine]);
1260 /* second line is a nice blue */
1261 line->set_line_color (color_map[cRightPanAutomationLine]);
1264 pan_track->add_line (*line);
1269 AudioTimeAxisView::toggle_gain_track ()
1272 bool showit = gain_automation_item->get_active();
1274 if (showit != gain_track->marked_for_display()) {
1276 gain_track->set_marked_for_display (true);
1277 gain_track->canvas_display->show();
1278 gain_track->get_state_node()->add_property ("shown", X_("yes"));
1280 gain_track->set_marked_for_display (false);
1281 gain_track->hide ();
1282 gain_track->get_state_node()->add_property ("shown", X_("no"));
1285 /* now trigger a redisplay */
1288 _route.gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
1294 AudioTimeAxisView::gain_hidden ()
1296 gain_track->get_state_node()->add_property (X_("shown"), X_("no"));
1298 if (gain_automation_item && !_hidden) {
1299 gain_automation_item->set_active (false);
1302 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1306 AudioTimeAxisView::toggle_pan_track ()
1308 bool showit = pan_automation_item->get_active();
1310 if (showit != pan_track->marked_for_display()) {
1312 pan_track->set_marked_for_display (true);
1313 pan_track->canvas_display->show();
1314 pan_track->get_state_node()->add_property ("shown", X_("yes"));
1316 pan_track->set_marked_for_display (false);
1318 pan_track->get_state_node()->add_property ("shown", X_("no"));
1321 /* now trigger a redisplay */
1324 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1330 AudioTimeAxisView::pan_hidden ()
1332 pan_track->get_state_node()->add_property ("shown", "no");
1334 if (pan_automation_item && !_hidden) {
1335 pan_automation_item->set_active (false);
1338 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1341 AudioTimeAxisView::RedirectAutomationInfo::~RedirectAutomationInfo ()
1343 for (vector<RedirectAutomationNode*>::iterator i = lines.begin(); i != lines.end(); ++i) {
1349 AudioTimeAxisView::RedirectAutomationNode::~RedirectAutomationNode ()
1351 parent.remove_ran (this);
1359 AudioTimeAxisView::remove_ran (RedirectAutomationNode* ran)
1362 remove_child (ran->view);
1366 AudioTimeAxisView::RedirectAutomationNode*
1367 AudioTimeAxisView::find_redirect_automation_node (Redirect *redirect, uint32_t what)
1369 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1371 if ((*i)->redirect == redirect) {
1373 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1374 if ((*ii)->what == what) {
1385 legalize_for_xml_node (string str)
1387 string::size_type pos;
1388 string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=:";
1394 while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
1395 legal.replace (pos, 1, "_");
1404 AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t what)
1406 RedirectAutomationLine* ral;
1408 RedirectAutomationNode* ran;
1410 if ((ran = find_redirect_automation_node (redirect, what)) == 0) {
1411 fatal << _("programming error: ")
1412 << string_compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
1413 redirect->name(), what)
1423 name = redirect->describe_parameter (what);
1425 /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
1427 char state_name[256];
1428 snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (redirect->name()).c_str(), what);
1430 ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *redirect, state_name);
1432 ral = new RedirectAutomationLine (name,
1433 *redirect, what, _session, *ran->view,
1434 *ran->view->canvas_display, redirect->automation_list (what));
1436 ral->set_line_color (color_map[cRedirectAutomationLine]);
1437 ral->queue_reset ();
1439 ran->view->add_line (*ral);
1441 ran->view->Hiding.connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_automation_track_hidden), ran, redirect));
1443 if (!ran->view->marked_for_display()) {
1446 ran->menu_item->set_active (true);
1449 add_child (ran->view);
1451 view->foreach_regionview (bind (mem_fun(*this, &AudioTimeAxisView::add_ghost_to_redirect), ran->view));
1453 redirect->mark_automation_visible (what, true);
1457 AudioTimeAxisView::redirect_automation_track_hidden (AudioTimeAxisView::RedirectAutomationNode* ran, Redirect* r)
1460 ran->menu_item->set_active (false);
1463 r->mark_automation_visible (ran->what, false);
1465 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1469 AudioTimeAxisView::add_existing_redirect_automation_curves (Redirect *redirect)
1472 RedirectAutomationLine *ral;
1474 redirect->what_has_visible_automation (s);
1476 for (set<uint32_t>::iterator i = s.begin(); i != s.end(); ++i) {
1478 if ((ral = find_redirect_automation_curve (redirect, *i)) != 0) {
1479 ral->queue_reset ();
1481 add_redirect_automation_curve (redirect, (*i));
1487 AudioTimeAxisView::add_redirect_to_subplugin_menu (Redirect* r)
1489 using namespace Menu_Helpers;
1490 RedirectAutomationInfo *rai;
1491 list<RedirectAutomationInfo*>::iterator x;
1493 const std::set<uint32_t>& automatable = r->what_can_be_automated ();
1494 std::set<uint32_t> has_visible_automation;
1496 r->what_has_visible_automation(has_visible_automation);
1498 if (automatable.empty()) {
1502 for (x = redirect_automation.begin(); x != redirect_automation.end(); ++x) {
1503 if ((*x)->redirect == r) {
1508 if (x == redirect_automation.end()) {
1510 rai = new RedirectAutomationInfo (r);
1511 redirect_automation.push_back (rai);
1519 /* any older menu was deleted at the top of redirects_changed()
1520 when we cleared the subplugin menu.
1523 rai->menu = manage (new Menu);
1524 MenuList& items = rai->menu->items();
1525 rai->menu->set_name ("ArdourContextMenu");
1529 for (std::set<uint32_t>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
1531 RedirectAutomationNode* ran;
1532 CheckMenuItem* mitem;
1534 string name = r->describe_parameter (*i);
1536 items.push_back (CheckMenuElem (name));
1537 mitem = dynamic_cast<CheckMenuItem*> (&items.back());
1539 if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
1540 mitem->set_active(true);
1543 if ((ran = find_redirect_automation_node (r, *i)) == 0) {
1547 ran = new RedirectAutomationNode (*i, mitem, *this);
1549 rai->lines.push_back (ran);
1553 ran->menu_item = mitem;
1557 mitem->signal_toggled().connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
1560 /* add the menu for this redirect, because the subplugin
1561 menu is always cleared at the top of redirects_changed().
1562 this is the result of some poor design in gtkmm and/or
1566 subplugin_menu.items().push_back (MenuElem (r->name(), *rai->menu));
1571 AudioTimeAxisView::redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo* rai,
1572 AudioTimeAxisView::RedirectAutomationNode* ran)
1574 bool showit = ran->menu_item->get_active();
1575 bool redraw = false;
1577 if (ran->view == 0 && showit) {
1578 add_redirect_automation_curve (rai->redirect, ran->what);
1582 if (showit != ran->view->marked_for_display()) {
1585 ran->view->set_marked_for_display (true);
1586 ran->view->canvas_display->show();
1588 rai->redirect->mark_automation_visible (ran->what, true);
1589 ran->view->set_marked_for_display (false);
1597 if (redraw && !no_redraw) {
1599 /* now trigger a redisplay */
1601 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1607 AudioTimeAxisView::redirects_changed (void *src)
1609 using namespace Menu_Helpers;
1611 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1612 (*i)->valid = false;
1615 subplugin_menu.items().clear ();
1617 _route.foreach_redirect (this, &AudioTimeAxisView::add_redirect_to_subplugin_menu);
1618 _route.foreach_redirect (this, &AudioTimeAxisView::add_existing_redirect_automation_curves);
1620 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ) {
1622 list<RedirectAutomationInfo*>::iterator tmp;
1630 redirect_automation.erase (i);
1637 /* change in visibility was possible */
1639 _route.gui_changed ("track_height", this);
1642 RedirectAutomationLine *
1643 AudioTimeAxisView::find_redirect_automation_curve (Redirect *redirect, uint32_t what)
1645 RedirectAutomationNode* ran;
1647 if ((ran = find_redirect_automation_node (redirect, what)) != 0) {
1649 return dynamic_cast<RedirectAutomationLine*> (ran->view->lines.front());
1657 AudioTimeAxisView::show_all_automation ()
1661 pan_automation_item->set_active (true);
1662 gain_automation_item->set_active (true);
1664 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1665 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1666 if ((*ii)->view == 0) {
1667 add_redirect_automation_curve ((*i)->redirect, (*ii)->what);
1670 (*ii)->menu_item->set_active (true);
1676 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1680 AudioTimeAxisView::show_existing_automation ()
1684 pan_automation_item->set_active (true);
1685 gain_automation_item->set_active (true);
1687 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1688 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1689 if ((*ii)->view != 0) {
1690 (*ii)->menu_item->set_active (true);
1697 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1701 AudioTimeAxisView::hide_all_automation ()
1705 pan_automation_item->set_active (false);
1706 gain_automation_item->set_active (false);
1708 for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) {
1709 for (vector<RedirectAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
1710 (*ii)->menu_item->set_active (false);
1715 _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
1719 AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
1721 Playlist* what_we_got;
1722 AudioDiskstream* ds = get_diskstream();
1727 /* route is a bus, not a track */
1731 playlist = ds->playlist();
1734 TimeSelection time (selection.time);
1735 float speed = ds->speed();
1736 if (speed != 1.0f) {
1737 for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
1738 (*i).start = session_frame_to_track_frame((*i).start, speed);
1739 (*i).end = session_frame_to_track_frame((*i).end, speed);
1745 _session.add_undo (playlist->get_memento());
1746 if ((what_we_got = playlist->cut (time)) != 0) {
1747 editor.get_cut_buffer().add (what_we_got);
1748 _session.add_redo_no_execute (playlist->get_memento());
1753 if ((what_we_got = playlist->copy (time)) != 0) {
1754 editor.get_cut_buffer().add (what_we_got);
1759 _session.add_undo (playlist->get_memento());
1760 if ((what_we_got = playlist->cut (time)) != 0) {
1761 _session.add_redo_no_execute (playlist->get_memento());
1762 what_we_got->unref ();
1772 AudioTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection, size_t nth)
1774 if (!is_audio_track()) {
1778 Playlist* playlist = get_diskstream()->playlist();
1779 PlaylistSelection::iterator p;
1781 for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth);
1783 if (p == selection.playlists.end()) {
1787 if (get_diskstream()->speed() != 1.0f)
1788 pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
1790 _session.add_undo (playlist->get_memento());
1791 playlist->paste (**p, pos, times);
1792 _session.add_redo_no_execute (playlist->get_memento());
1798 AudioTimeAxisView::region_view_added (AudioRegionView* arv)
1800 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1801 AutomationTimeAxisView* atv;
1803 if ((atv = dynamic_cast<AutomationTimeAxisView*> (*i)) != 0) {
1804 arv->add_ghost (*atv);
1810 AudioTimeAxisView::add_ghost_to_redirect (AudioRegionView* arv, AutomationTimeAxisView* atv)
1812 arv->add_ghost (*atv);
1816 AudioTimeAxisView::get_child_list()
1819 list<TimeAxisView*>redirect_children;
1821 for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
1822 if (!(*i)->hidden()) {
1823 redirect_children.push_back(*i);
1826 return redirect_children;
1831 AudioTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
1833 using namespace Menu_Helpers;
1835 if (!menu || !is_audio_track()) {
1839 MenuList& playlist_items = menu->items();
1840 menu->set_name ("ArdourContextMenu");
1841 playlist_items.clear();
1843 if (playlist_menu) {
1844 delete playlist_menu;
1846 playlist_menu = new Menu;
1847 playlist_menu->set_name ("ArdourContextMenu");
1849 playlist_items.push_back (MenuElem (string_compose (_("Current: %1"), get_diskstream()->playlist()->name())));
1850 playlist_items.push_back (SeparatorElem());
1852 playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &AudioTimeAxisView::rename_current_playlist)));
1853 playlist_items.push_back (SeparatorElem());
1855 playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists)));
1856 playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists)));
1857 playlist_items.push_back (SeparatorElem());
1858 playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists)));
1859 playlist_items.push_back (SeparatorElem());
1860 playlist_items.push_back (MenuElem(_("Select"), mem_fun(*this, &AudioTimeAxisView::show_playlist_selector)));
1865 AudioTimeAxisView::show_playlist_selector ()
1867 editor.playlist_selector().show_for (this);
1872 AudioTimeAxisView::map_frozen ()
1874 if (!is_audio_track()) {
1878 ENSURE_GUI_THREAD (mem_fun(*this, &AudioTimeAxisView::map_frozen));
1880 switch (audio_track()->freeze_state()) {
1881 case AudioTrack::Frozen:
1882 playlist_button.set_sensitive (false);
1883 rec_enable_button->set_sensitive (false);
1886 playlist_button.set_sensitive (true);
1887 rec_enable_button->set_sensitive (true);
1893 AudioTimeAxisView::show_all_xfades ()
1896 view->show_all_xfades ();
1901 AudioTimeAxisView::hide_all_xfades ()
1904 view->hide_all_xfades ();
1909 AudioTimeAxisView::hide_dependent_views (TimeAxisViewItem& tavi)
1911 AudioRegionView* rv;
1913 if (view && (rv = dynamic_cast<AudioRegionView*>(&tavi)) != 0) {
1914 view->hide_xfades_involving (*rv);
1919 AudioTimeAxisView::reveal_dependent_views (TimeAxisViewItem& tavi)
1921 AudioRegionView* rv;
1923 if (view && (rv = dynamic_cast<AudioRegionView*>(&tavi)) != 0) {
1924 view->reveal_xfades_involving (*rv);
1929 AudioTimeAxisView::route_active_changed ()
1931 RouteUI::route_active_changed ();
1933 if (is_audio_track()) {
1934 if (_route.active()) {
1935 controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
1936 controls_base_selected_name = "AudioTrackControlsBaseSelected";
1937 controls_base_unselected_name = "AudioTrackControlsBaseUnselected";
1939 controls_ebox.set_name ("AudioTrackControlsBaseInactiveUnselected");
1940 controls_base_selected_name = "AudioTrackControlsBaseInactiveSelected";
1941 controls_base_unselected_name = "AudioTrackControlsBaseInactiveUnselected";
1944 if (_route.active()) {
1945 controls_ebox.set_name ("BusControlsBaseUnselected");
1946 controls_base_selected_name = "BusControlsBaseSelected";
1947 controls_base_unselected_name = "BusControlsBaseUnselected";
1949 controls_ebox.set_name ("BusControlsBaseInactiveUnselected");
1950 controls_base_selected_name = "BusControlsBaseInactiveSelected";
1951 controls_base_unselected_name = "BusControlsBaseInactiveUnselected";
1957 AudioTimeAxisView::get_child_xml_node (const string & childname)
1959 return RouteUI::get_child_xml_node (childname);
1963 AudioTimeAxisView::color_handler (ColorID id, uint32_t val)
1966 case cTimeStretchOutline:
1967 timestretch_rect->property_outline_color_rgba() = val;
1969 case cTimeStretchFill:
1970 timestretch_rect->property_fill_color_rgba() = val;
1978 AudioTimeAxisView::select_me (GdkEventButton* ev)
1980 editor.get_selection().add (this);