2 Copyright (C) 2000-2009 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.
27 #include "pbd/unknown_type.h"
28 #include "pbd/unwind.h"
30 #include "ardour/debug.h"
31 #include "ardour/midi_track.h"
32 #include "ardour/route.h"
33 #include "ardour/session.h"
35 #include "gtkmm2ext/cell_renderer_pixbuf_multi.h"
36 #include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
37 #include "gtkmm2ext/treeutils.h"
40 #include "ardour_ui.h"
41 #include "audio_time_axis.h"
43 #include "editor_group_tabs.h"
44 #include "editor_routes.h"
45 #include "gui_thread.h"
47 #include "midi_time_axis.h"
48 #include "mixer_strip.h"
49 #include "plugin_setup_dialog.h"
50 #include "route_sorter.h"
57 using namespace ARDOUR;
58 using namespace ARDOUR_UI_UTILS;
61 using namespace Gtkmm2ext;
63 using Gtkmm2ext::Keyboard;
71 EditorRoutes::EditorRoutes (Editor* e)
73 , _ignore_reorder (false)
74 , _no_redisplay (false)
75 , _adding_routes (false)
76 , _route_deletion_in_progress (false)
77 , _redisplay_on_resume (false)
78 , _redisplay_active (0)
79 , _queue_tv_update (0)
82 , selection_countdown (0)
85 static const int column_width = 22;
87 _scroller.add (_display);
88 _scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
90 _model = ListStore::create (_columns);
91 _display.set_model (_model);
93 // Record enable toggle
94 CellRendererPixbufMulti* rec_col_renderer = manage (new CellRendererPixbufMulti());
96 rec_col_renderer->set_pixbuf (0, ::get_icon("record-normal-disabled"));
97 rec_col_renderer->set_pixbuf (1, ::get_icon("record-normal-in-progress"));
98 rec_col_renderer->set_pixbuf (2, ::get_icon("record-normal-enabled"));
99 rec_col_renderer->set_pixbuf (3, ::get_icon("record-step"));
100 rec_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_rec_enable_changed));
102 TreeViewColumn* rec_state_column = manage (new TreeViewColumn("R", *rec_col_renderer));
104 rec_state_column->add_attribute(rec_col_renderer->property_state(), _columns.rec_state);
105 rec_state_column->add_attribute(rec_col_renderer->property_visible(), _columns.is_track);
107 rec_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
108 rec_state_column->set_alignment(ALIGN_CENTER);
109 rec_state_column->set_expand(false);
110 rec_state_column->set_fixed_width(column_width);
114 CellRendererPixbufMulti* input_active_col_renderer = manage (new CellRendererPixbufMulti());
115 input_active_col_renderer->set_pixbuf (0, ::get_icon("midi-input-inactive"));
116 input_active_col_renderer->set_pixbuf (1, ::get_icon("midi-input-active"));
117 input_active_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_input_active_changed));
119 TreeViewColumn* input_active_column = manage (new TreeViewColumn ("I", *input_active_col_renderer));
121 input_active_column->add_attribute(input_active_col_renderer->property_state(), _columns.is_input_active);
122 input_active_column->add_attribute (input_active_col_renderer->property_visible(), _columns.is_midi);
124 input_active_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
125 input_active_column->set_alignment(ALIGN_CENTER);
126 input_active_column->set_expand(false);
127 input_active_column->set_fixed_width(column_width);
129 // Mute enable toggle
130 CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti());
132 mute_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("mute-disabled"));
133 mute_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("muted-by-others"));
134 mute_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("mute-enabled"));
135 mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled));
137 TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
139 mute_state_column->add_attribute(mute_col_renderer->property_state(), _columns.mute_state);
140 mute_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
141 mute_state_column->set_alignment(ALIGN_CENTER);
142 mute_state_column->set_expand(false);
143 mute_state_column->set_fixed_width(15);
145 // Solo enable toggle
146 CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti());
148 solo_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("solo-disabled"));
149 solo_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("solo-enabled"));
150 solo_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("soloed-by-others"));
151 solo_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_enable_toggled));
153 TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer));
155 solo_state_column->add_attribute(solo_col_renderer->property_state(), _columns.solo_state);
156 solo_state_column->add_attribute(solo_col_renderer->property_visible(), _columns.solo_visible);
157 solo_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
158 solo_state_column->set_alignment(ALIGN_CENTER);
159 solo_state_column->set_expand(false);
160 solo_state_column->set_fixed_width(column_width);
162 // Solo isolate toggle
163 CellRendererPixbufMulti* solo_iso_renderer = manage (new CellRendererPixbufMulti());
165 solo_iso_renderer->set_pixbuf (0, ::get_icon("solo-isolate-disabled"));
166 solo_iso_renderer->set_pixbuf (1, ::get_icon("solo-isolate-enabled"));
167 solo_iso_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_isolate_toggled));
169 TreeViewColumn* solo_isolate_state_column = manage (new TreeViewColumn("SI", *solo_iso_renderer));
171 solo_isolate_state_column->add_attribute(solo_iso_renderer->property_state(), _columns.solo_isolate_state);
172 solo_isolate_state_column->add_attribute(solo_iso_renderer->property_visible(), _columns.solo_visible);
173 solo_isolate_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
174 solo_isolate_state_column->set_alignment(ALIGN_CENTER);
175 solo_isolate_state_column->set_expand(false);
176 solo_isolate_state_column->set_fixed_width(column_width);
179 CellRendererPixbufMulti* solo_safe_renderer = manage (new CellRendererPixbufMulti ());
181 solo_safe_renderer->set_pixbuf (0, ::get_icon("solo-safe-disabled"));
182 solo_safe_renderer->set_pixbuf (1, ::get_icon("solo-safe-enabled"));
183 solo_safe_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_safe_toggled));
185 TreeViewColumn* solo_safe_state_column = manage (new TreeViewColumn(_("SS"), *solo_safe_renderer));
186 solo_safe_state_column->add_attribute(solo_safe_renderer->property_state(), _columns.solo_safe_state);
187 solo_safe_state_column->add_attribute(solo_safe_renderer->property_visible(), _columns.solo_visible);
188 solo_safe_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
189 solo_safe_state_column->set_alignment(ALIGN_CENTER);
190 solo_safe_state_column->set_expand(false);
191 solo_safe_state_column->set_fixed_width(column_width);
193 _name_column = _display.append_column ("", _columns.text) - 1;
194 _visible_column = _display.append_column ("", _columns.visible) - 1;
195 _active_column = _display.append_column ("", _columns.active) - 1;
197 _display.append_column (*input_active_column);
198 _display.append_column (*rec_state_column);
199 _display.append_column (*mute_state_column);
200 _display.append_column (*solo_state_column);
201 _display.append_column (*solo_isolate_state_column);
202 _display.append_column (*solo_safe_state_column);
209 { 0, _("Name"), _("Track/Bus Name") },
210 { 1, S_("Visible|V"), _("Track/Bus visible ?") },
211 { 2, S_("Active|A"), _("Track/Bus active ?") },
212 { 3, S_("MidiInput|I"), _("MIDI input enabled") },
213 { 4, S_("Rec|R"), _("Record enabled") },
214 { 5, S_("Mute|M"), _("Muted") },
215 { 6, S_("Solo|S"), _("Soloed") },
216 { 7, S_("SoloIso|SI"), _("Solo Isolated") },
217 { 8, S_("SoloLock|SS"), _("Solo Safe (Locked)") },
221 for (int i = 0; ci[i].index >= 0; ++i) {
222 col = _display.get_column (ci[i].index);
223 l = manage (new Label (ci[i].label));
224 set_tooltip (*l, ci[i].tooltip);
225 col->set_widget (*l);
229 _display.set_headers_visible (true);
230 _display.get_selection()->set_mode (SELECTION_SINGLE);
231 _display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
232 _display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::selection_changed));
233 _display.set_reorderable (true);
234 _display.set_name (X_("EditGroupList"));
235 _display.set_rules_hint (true);
236 _display.set_size_request (100, -1);
237 _display.add_object_drag (_columns.route.index(), "routes");
239 CellRendererText* name_cell = dynamic_cast<CellRendererText*> (_display.get_column_cell_renderer (_name_column));
242 name_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorRoutes::name_edit_started));
244 TreeViewColumn* name_column = _display.get_column (_name_column);
246 assert (name_column);
248 name_column->add_attribute (name_cell->property_editable(), _columns.name_editable);
249 name_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
250 name_column->set_expand(true);
251 name_column->set_min_width(50);
253 name_cell->property_editable() = true;
254 name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRoutes::name_edit));
256 // Set the visible column cell renderer to radio toggle
257 CellRendererToggle* visible_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (_visible_column));
259 visible_cell->property_activatable() = true;
260 visible_cell->property_radio() = false;
261 visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::visible_changed));
263 TreeViewColumn* visible_col = dynamic_cast<TreeViewColumn*> (_display.get_column (_visible_column));
264 visible_col->set_expand(false);
265 visible_col->set_sizing(TREE_VIEW_COLUMN_FIXED);
266 visible_col->set_fixed_width(30);
267 visible_col->set_alignment(ALIGN_CENTER);
269 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (_active_column));
271 active_cell->property_activatable() = true;
272 active_cell->property_radio() = false;
273 active_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::active_changed));
275 TreeViewColumn* active_col = dynamic_cast<TreeViewColumn*> (_display.get_column (_active_column));
276 active_col->set_expand (false);
277 active_col->set_sizing (TREE_VIEW_COLUMN_FIXED);
278 active_col->set_fixed_width (30);
279 active_col->set_alignment (ALIGN_CENTER);
281 _model->signal_row_deleted().connect (sigc::mem_fun (*this, &EditorRoutes::row_deleted));
282 _model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
284 _display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
285 _scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRoutes::key_press), false);
287 _scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorRoutes::focus_in), false);
288 _scroller.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditorRoutes::focus_out));
290 _display.signal_enter_notify_event().connect (sigc::mem_fun (*this, &EditorRoutes::enter_notify), false);
291 _display.signal_leave_notify_event().connect (sigc::mem_fun (*this, &EditorRoutes::leave_notify), false);
293 _display.set_enable_search (false);
295 Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context());
296 Route::PluginSetup.connect_same_thread (*this, boost::bind (&EditorRoutes::plugin_setup, this, _1, _2, _3));
301 EditorRoutes::focus_in (GdkEventFocus*)
303 Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
306 old_focus = win->get_focus ();
313 /* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
318 EditorRoutes::focus_out (GdkEventFocus*)
321 old_focus->grab_focus ();
329 EditorRoutes::enter_notify (GdkEventCrossing*)
335 /* arm counter so that ::selection_filter() will deny selecting anything for the
336 * next two attempts to change selection status.
338 selection_countdown = 2;
339 _scroller.grab_focus ();
340 Keyboard::magic_widget_grab_focus ();
345 EditorRoutes::leave_notify (GdkEventCrossing*)
347 selection_countdown = 0;
350 old_focus->grab_focus ();
354 Keyboard::magic_widget_drop_focus ();
359 EditorRoutes::set_session (Session* s)
361 SessionHandlePtr::set_session (s);
366 _session->SoloChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::solo_changed_so_update_mute, this), gui_context());
367 _session->RecordStateChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
369 /* TODO: check if these needs to be tied in with DisplaySuspender
370 * Given that the UI is single-threaded and DisplaySuspender is only used
371 * in loops in the UI thread all should be fine.
373 _session->BatchUpdateStart.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::suspend_redisplay, this), gui_context());
374 _session->BatchUpdateEnd.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::resume_redisplay, this), gui_context());
379 EditorRoutes::on_input_active_changed (std::string const & path_string)
381 // Get the model row that has been toggled.
382 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
384 TimeAxisView* tv = row[_columns.tv];
385 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
388 boost::shared_ptr<MidiTrack> mt;
389 mt = rtv->midi_track();
391 mt->set_input_active (!mt->input_active());
397 EditorRoutes::on_tv_rec_enable_changed (std::string const & path_string)
400 // Get the model row that has been toggled.
401 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
403 TimeAxisView* tv = row[_columns.tv];
404 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
406 if (rtv && rtv->track()) {
407 boost::shared_ptr<RouteList> rl (new RouteList);
408 rl->push_back (rtv->route());
409 _session->set_record_enabled (rl, !rtv->track()->record_enabled(), Session::rt_cleanup);
414 EditorRoutes::on_tv_mute_enable_toggled (std::string const & path_string)
416 // Get the model row that has been toggled.
417 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
419 TimeAxisView *tv = row[_columns.tv];
420 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
423 boost::shared_ptr<RouteList> rl (new RouteList);
424 rl->push_back (rtv->route());
425 _session->set_mute (rl, !rtv->route()->muted(), Session::rt_cleanup);
430 EditorRoutes::on_tv_solo_enable_toggled (std::string const & path_string)
432 // Get the model row that has been toggled.
433 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
435 TimeAxisView *tv = row[_columns.tv];
436 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
439 boost::shared_ptr<RouteList> rl (new RouteList);
440 rl->push_back (rtv->route());
441 if (Config->get_solo_control_is_listen_control()) {
442 _session->set_listen (rl, !rtv->route()->listening_via_monitor(), Session::rt_cleanup);
444 _session->set_solo (rl, !rtv->route()->self_soloed(), Session::rt_cleanup);
450 EditorRoutes::on_tv_solo_isolate_toggled (std::string const & path_string)
452 // Get the model row that has been toggled.
453 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
455 TimeAxisView *tv = row[_columns.tv];
456 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
459 rtv->route()->set_solo_isolated (!rtv->route()->solo_isolated(), Controllable::UseGroup);
464 EditorRoutes::on_tv_solo_safe_toggled (std::string const & path_string)
466 // Get the model row that has been toggled.
467 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
469 TimeAxisView *tv = row[_columns.tv];
470 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
473 rtv->route()->set_solo_safe (!rtv->route()->solo_safe(), Controllable::UseGroup);
478 EditorRoutes::build_menu ()
480 using namespace Menu_Helpers;
485 MenuList& items = _menu->items();
486 _menu->set_name ("ArdourContextMenu");
488 items.push_back (MenuElem (_("Show All"), sigc::mem_fun (*this, &EditorRoutes::show_all_routes)));
489 items.push_back (MenuElem (_("Hide All"), sigc::mem_fun (*this, &EditorRoutes::hide_all_routes)));
490 items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiotracks)));
491 items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiotracks)));
492 items.push_back (MenuElem (_("Show All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiobus)));
493 items.push_back (MenuElem (_("Hide All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiobus)));
494 items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_miditracks)));
495 items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_miditracks)));
496 items.push_back (MenuElem (_("Only Show Tracks with Regions Under Playhead"), sigc::mem_fun (*this, &EditorRoutes::show_tracks_with_regions_at_playhead)));
500 EditorRoutes::show_menu ()
506 _menu->popup (1, gtk_get_current_event_time());
510 EditorRoutes::redisplay_real ()
512 TreeModel::Children rows = _model->children();
513 TreeModel::Children::iterator i;
516 /* n will be the count of tracks plus children (updated by TimeAxisView::show_at),
517 * so we will use that to know where to put things.
521 for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
522 TimeAxisView *tv = (*i)[_columns.tv];
523 boost::shared_ptr<Route> route = (*i)[_columns.route];
526 // just a "title" row
530 bool visible = tv->marked_for_display ();
532 /* show or hide the TimeAxisView */
534 position += tv->show_at (position, n, &_editor->edit_controls_vbox);
542 /* whenever we go idle, update the track view list to reflect the new order.
543 * we can't do this here, because we could mess up something that is traversing
544 * the track order and has caused a redisplay of the list.
546 Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
548 _editor->reset_controls_layout_height (position);
549 _editor->reset_controls_layout_width ();
550 _editor->_full_canvas_height = position;
552 if ((_editor->vertical_adjustment.get_value() + _editor->_visible_canvas_height) > _editor->vertical_adjustment.get_upper()) {
554 * We're increasing the size of the canvas while the bottom is visible.
555 * We scroll down to keep in step with the controls layout.
557 _editor->vertical_adjustment.set_value (_editor->_full_canvas_height - _editor->_visible_canvas_height);
562 EditorRoutes::redisplay ()
564 if (!_session || _session->deletion_in_progress()) {
569 _redisplay_on_resume = true;
573 // model deprecated g_atomic_int_exchange_and_add(, 1)
574 g_atomic_int_inc(const_cast<gint*>(&_redisplay_active));
575 if (!g_atomic_int_compare_and_exchange (const_cast<gint*>(&_redisplay_active), 1, 1)) {
576 /* recursive re-display can happen if redisplay shows/hides a TrackView
577 * which has children and their display status changes as result.
584 while (!g_atomic_int_compare_and_exchange (const_cast<gint*>(&_redisplay_active), 1, 0)) {
585 g_atomic_int_set(const_cast<gint*>(&_redisplay_active), 1);
591 EditorRoutes::row_deleted (Gtk::TreeModel::Path const &)
593 if (!_session || _session->deletion_in_progress()) {
596 /* this happens as the second step of a DnD within the treeview, and
597 * when a route is actually removed. we don't differentiate between
600 * note that the sync_orders_keys() step may not actually change any
601 * RID's (e.g. the last track may be removed, so all other tracks keep
602 * the same RID), which means that no redisplay would happen. so we
603 * have to force a redisplay.
606 DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview row deleted\n");
609 sync_order_keys_from_treeview ();
613 EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, int* /*what*/)
615 /* reordering implies that RID's will change, so sync_order_keys() will
619 DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview reordered\n");
620 sync_order_keys_from_treeview ();
624 EditorRoutes::visible_changed (std::string const & path)
626 if (_session && _session->deletion_in_progress()) {
633 if ((iter = _model->get_iter (path))) {
634 TimeAxisView* tv = (*iter)[_columns.tv];
636 bool visible = (*iter)[_columns.visible];
638 if (tv->set_marked_for_display (!visible)) {
639 update_visibility ();
646 EditorRoutes::active_changed (std::string const & path)
648 if (_session && _session->deletion_in_progress ()) {
652 Gtk::TreeModel::Row row = *_model->get_iter (path);
653 boost::shared_ptr<Route> route = row[_columns.route];
654 bool const active = row[_columns.active];
655 route->set_active (!active, this);
659 EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
661 PBD::Unwinder<bool> at (_adding_routes, true);
662 bool from_scratch = (_model->children().size() == 0);
663 Gtk::TreeModel::Children::iterator insert_iter = _model->children().end();
665 for (Gtk::TreeModel::Children::iterator it = _model->children().begin(); it != _model->children().end(); ++it) {
666 boost::shared_ptr<Route> r = (*it)[_columns.route];
668 if (r->order_key() == (routes.front()->route()->order_key() + routes.size())) {
676 _display.set_model (Glib::RefPtr<ListStore>());
678 for (list<RouteTimeAxisView*>::iterator x = routes.begin(); x != routes.end(); ++x) {
680 boost::shared_ptr<MidiTrack> midi_trk = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
682 TreeModel::Row row = *(_model->insert (insert_iter));
684 row[_columns.text] = (*x)->route()->name();
685 row[_columns.visible] = (*x)->marked_for_display();
686 row[_columns.active] = (*x)->route()->active ();
687 row[_columns.tv] = *x;
688 row[_columns.route] = (*x)->route ();
689 row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
692 row[_columns.is_input_active] = midi_trk->input_active ();
693 row[_columns.is_midi] = true;
695 row[_columns.is_input_active] = false;
696 row[_columns.is_midi] = false;
699 row[_columns.mute_state] = (*x)->route()->muted() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off;
700 row[_columns.solo_state] = RouteUI::solo_active_state ((*x)->route());
701 row[_columns.solo_visible] = !(*x)->route()->is_master ();
702 row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
703 row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
704 row[_columns.name_editable] = true;
706 boost::weak_ptr<Route> wr ((*x)->route());
708 (*x)->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
709 (*x)->route()->PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, wr), gui_context());
711 if ((*x)->is_track()) {
712 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
713 t->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
714 t->RecordSafeChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
717 if ((*x)->is_midi_track()) {
718 boost::shared_ptr<MidiTrack> t = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
719 t->StepEditStatusChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
720 t->InputActiveChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_input_active_display, this), gui_context());
723 (*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
724 (*x)->route()->solo_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this), gui_context());
725 (*x)->route()->listen_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this), gui_context());
726 (*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
727 (*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context());
728 (*x)->route()->active_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_active_display, this), gui_context ());
732 update_rec_display ();
733 update_mute_display ();
734 update_solo_display ();
735 update_solo_isolate_display ();
736 update_solo_safe_display ();
737 update_input_active_display ();
738 update_active_display ();
740 _display.set_model (_model);
742 /* now update route order keys from the treeview/track display order */
744 sync_order_keys_from_treeview ();
749 EditorRoutes::handle_gui_changes (string const & what, void*)
751 if (_adding_routes) {
755 if (what == "track_height") {
756 /* Optional :make tracks change height while it happens, instead
762 if (what == "visible_tracks") {
768 EditorRoutes::route_removed (TimeAxisView *tv)
770 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_removed, tv)
772 TreeModel::Children rows = _model->children();
773 TreeModel::Children::iterator ri;
775 for (ri = rows.begin(); ri != rows.end(); ++ri) {
776 if ((*ri)[_columns.tv] == tv) {
777 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
783 /* the deleted signal for the treeview/model will take
789 EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> r)
791 if (!what_changed.contains (ARDOUR::Properties::name)) {
795 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
797 boost::shared_ptr<Route> route = r.lock ();
803 TreeModel::Children rows = _model->children();
804 TreeModel::Children::iterator i;
806 for (i = rows.begin(); i != rows.end(); ++i) {
807 boost::shared_ptr<Route> t = (*i)[_columns.route];
809 (*i)[_columns.text] = route->name();
816 EditorRoutes::update_active_display ()
818 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
819 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
824 EditorRoutes::update_visibility ()
826 TreeModel::Children rows = _model->children();
827 TreeModel::Children::iterator i;
831 for (i = rows.begin(); i != rows.end(); ++i) {
832 TimeAxisView *tv = (*i)[_columns.tv];
833 (*i)[_columns.visible] = tv->marked_for_display ();
836 /* force route order keys catch up with visibility changes
839 sync_order_keys_from_treeview ();
843 EditorRoutes::hide_track_in_display (TimeAxisView& tv)
845 TreeModel::Children rows = _model->children();
846 TreeModel::Children::iterator i;
848 for (i = rows.begin(); i != rows.end(); ++i) {
849 if ((*i)[_columns.tv] == &tv) {
850 tv.set_marked_for_display (false);
851 (*i)[_columns.visible] = false;
859 EditorRoutes::show_track_in_display (TimeAxisView& tv)
861 TreeModel::Children rows = _model->children();
862 TreeModel::Children::iterator i;
865 for (i = rows.begin(); i != rows.end(); ++i) {
866 if ((*i)[_columns.tv] == &tv) {
867 tv.set_marked_for_display (true);
868 (*i)[_columns.visible] = true;
876 EditorRoutes::reset_remote_control_ids ()
878 if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
882 TreeModel::Children rows = _model->children();
889 DEBUG_TRACE (DEBUG::OrderKeys, "editor reset remote control ids\n");
891 TreeModel::Children::iterator ri;
892 bool rid_change = false;
894 uint32_t invisible_key = UINT32_MAX;
896 for (ri = rows.begin(); ri != rows.end(); ++ri) {
898 /* skip two special values */
900 if (rid == Route::MasterBusRemoteControlID) {
904 if (rid == Route::MonitorBusRemoteControlID) {
908 boost::shared_ptr<Route> route = (*ri)[_columns.route];
909 bool visible = (*ri)[_columns.visible];
911 if (!route->is_master() && !route->is_monitor()) {
913 uint32_t new_rid = (visible ? rid : invisible_key--);
915 if (new_rid != route->remote_control_id()) {
916 route->set_remote_control_id_explicit (new_rid);
928 /* tell the world that we changed the remote control IDs */
929 _session->notify_remote_id_change ();
935 EditorRoutes::sync_order_keys_from_treeview ()
937 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
941 TreeModel::Children rows = _model->children();
948 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from treeview\n");
950 TreeModel::Children::iterator ri;
951 bool changed = false;
952 bool rid_change = false;
955 uint32_t invisible_key = UINT32_MAX;
957 for (ri = rows.begin(); ri != rows.end(); ++ri) {
959 boost::shared_ptr<Route> route = (*ri)[_columns.route];
960 bool visible = (*ri)[_columns.visible];
962 uint32_t old_key = route->order_key ();
964 if (order != old_key) {
965 route->set_order_key (order);
970 if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
972 uint32_t new_rid = (visible ? rid : invisible_key--);
974 if (new_rid != route->remote_control_id()) {
975 route->set_remote_control_id_explicit (new_rid);
989 /* tell the world that we changed the editor sort keys */
990 _session->sync_order_keys ();
994 /* tell the world that we changed the remote control IDs */
995 _session->notify_remote_id_change ();
1000 EditorRoutes::sync_treeview_from_order_keys ()
1002 /* Some route order key(s) have been changed, make sure that
1003 we update out tree/list model and GUI to reflect the change.
1006 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
1010 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from order keys.\n");
1012 /* we could get here after either a change in the Mixer or Editor sort
1013 * order, but either way, the mixer order keys reflect the intended
1014 * order for the GUI, so reorder the treeview model to match it.
1017 vector<int> neworder;
1018 TreeModel::Children rows = _model->children();
1019 uint32_t old_order = 0;
1020 bool changed = false;
1026 OrderKeySortedRoutes sorted_routes;
1028 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
1029 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1030 sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key ()));
1033 SortByNewDisplayOrder cmp;
1035 sort (sorted_routes.begin(), sorted_routes.end(), cmp);
1036 neworder.assign (sorted_routes.size(), 0);
1040 for (OrderKeySortedRoutes::iterator sr = sorted_routes.begin(); sr != sorted_routes.end(); ++sr, ++n) {
1042 neworder[n] = sr->old_display_order;
1044 if (sr->old_display_order != n) {
1048 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n",
1049 sr->route->name(), sr->old_display_order, n));
1053 Unwinder<bool> uw (_ignore_reorder, true);
1054 _model->reorder (neworder);
1061 EditorRoutes::hide_all_tracks (bool /*with_select*/)
1063 TreeModel::Children rows = _model->children();
1064 TreeModel::Children::iterator i;
1066 DisplaySuspender ds;
1068 for (i = rows.begin(); i != rows.end(); ++i) {
1070 TreeModel::Row row = (*i);
1071 TimeAxisView *tv = row[_columns.tv];
1077 row[_columns.visible] = false;
1082 EditorRoutes::set_all_tracks_visibility (bool yn)
1084 TreeModel::Children rows = _model->children();
1085 TreeModel::Children::iterator i;
1087 DisplaySuspender ds;
1089 for (i = rows.begin(); i != rows.end(); ++i) {
1091 TreeModel::Row row = (*i);
1092 TimeAxisView* tv = row[_columns.tv];
1098 tv->set_marked_for_display (yn);
1099 (*i)[_columns.visible] = yn;
1102 /* force route order keys catch up with visibility changes
1105 sync_order_keys_from_treeview ();
1109 EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
1111 TreeModel::Children rows = _model->children();
1112 TreeModel::Children::iterator i;
1114 DisplaySuspender ds;
1116 for (i = rows.begin(); i != rows.end(); ++i) {
1118 TreeModel::Row row = (*i);
1119 TimeAxisView* tv = row[_columns.tv];
1121 AudioTimeAxisView* atv;
1122 MidiTimeAxisView* mtv;
1128 if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) {
1131 atv->set_marked_for_display (yn);
1132 (*i)[_columns.visible] = yn;
1136 if (atv->is_audio_track()) {
1137 atv->set_marked_for_display (yn);
1138 (*i)[_columns.visible] = yn;
1143 if (!atv->is_audio_track()) {
1144 atv->set_marked_for_display (yn);
1145 (*i)[_columns.visible] = yn;
1150 else if ((mtv = dynamic_cast<MidiTimeAxisView*>(tv)) != 0) {
1153 mtv->set_marked_for_display (yn);
1154 (*i)[_columns.visible] = yn;
1158 if (mtv->is_midi_track()) {
1159 mtv->set_marked_for_display (yn);
1160 (*i)[_columns.visible] = yn;
1167 /* force route order keys catch up with visibility changes
1170 sync_order_keys_from_treeview ();
1174 EditorRoutes::hide_all_routes ()
1176 set_all_tracks_visibility (false);
1180 EditorRoutes::show_all_routes ()
1182 set_all_tracks_visibility (true);
1186 EditorRoutes::show_all_audiotracks()
1188 set_all_audio_midi_visibility (1, true);
1191 EditorRoutes::hide_all_audiotracks ()
1193 set_all_audio_midi_visibility (1, false);
1197 EditorRoutes::show_all_audiobus ()
1199 set_all_audio_midi_visibility (2, true);
1202 EditorRoutes::hide_all_audiobus ()
1204 set_all_audio_midi_visibility (2, false);
1208 EditorRoutes::show_all_miditracks()
1210 set_all_audio_midi_visibility (3, true);
1213 EditorRoutes::hide_all_miditracks ()
1215 set_all_audio_midi_visibility (3, false);
1219 EditorRoutes::key_press (GdkEventKey* ev)
1221 TreeViewColumn *col;
1222 boost::shared_ptr<RouteList> rl (new RouteList);
1225 switch (ev->keyval) {
1227 case GDK_ISO_Left_Tab:
1229 /* If we appear to be editing something, leave that cleanly and appropriately. */
1230 if (name_editable) {
1231 name_editable->editing_done ();
1235 col = _display.get_column (_name_column); // select&focus on name column
1237 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1238 treeview_select_previous (_display, _model, col);
1240 treeview_select_next (_display, _model, col);
1247 if (get_relevant_routes (rl)) {
1248 _session->set_mute (rl, !rl->front()->muted(), Session::rt_cleanup);
1254 if (get_relevant_routes (rl)) {
1255 if (Config->get_solo_control_is_listen_control()) {
1256 _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup);
1258 _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup);
1265 if (get_relevant_routes (rl)) {
1266 _session->set_record_enabled (rl, !rl->front()->record_enabled(), Session::rt_cleanup);
1278 EditorRoutes::get_relevant_routes (boost::shared_ptr<RouteList> rl)
1281 RouteTimeAxisView* rtv;
1282 RefPtr<TreeSelection> selection = _display.get_selection();
1286 if (selection->count_selected_rows() != 0) {
1290 RefPtr<TreeModel> tm = RefPtr<TreeModel>::cast_dynamic (_model);
1291 iter = selection->get_selected (tm);
1294 /* use mouse pointer */
1299 _display.get_pointer (x, y);
1300 _display.convert_widget_to_bin_window_coords (x, y, bx, by);
1302 if (_display.get_path_at_pos (bx, by, path)) {
1303 iter = _model->get_iter (path);
1308 tv = (*iter)[_columns.tv];
1310 rtv = dynamic_cast<RouteTimeAxisView*>(tv);
1312 rl->push_back (rtv->route());
1317 return !rl->empty();
1321 EditorRoutes::button_press (GdkEventButton* ev)
1323 if (Keyboard::is_context_menu_event (ev)) {
1328 TreeModel::Path path;
1329 TreeViewColumn *tvc;
1333 if (!_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, tvc, cell_x, cell_y)) {
1334 /* cancel selection */
1335 _display.get_selection()->unselect_all ();
1336 /* end any editing by grabbing focus */
1337 _display.grab_focus ();
1341 //Scroll editor canvas to selected track
1342 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1344 Gtk::TreeModel::Row row = *_model->get_iter (path);
1345 TimeAxisView *tv = row[_columns.tv];
1348 _editor->ensure_time_axis_view_is_visible (*tv, true);
1356 EditorRoutes::selection_changed ()
1358 _editor->begin_reversible_selection_op (X_("Select Track from Route List"));
1360 if (_display.get_selection()->count_selected_rows() > 0) {
1363 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
1364 TrackViewList selected;
1366 _editor->get_selection().clear_regions ();
1368 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
1370 if ((iter = _model->get_iter (*i))) {
1372 TimeAxisView* tv = (*iter)[_columns.tv];
1373 selected.push_back (tv);
1378 _editor->get_selection().set (selected);
1379 _editor->ensure_time_axis_view_is_visible (*(selected.front()), true);
1382 _editor->get_selection().clear_tracks ();
1385 _editor->commit_reversible_selection_op ();
1389 EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
1391 if (selection_countdown) {
1392 if (--selection_countdown == 0) {
1395 /* no selection yet ... */
1402 struct EditorOrderRouteSorter
1404 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
1405 if (a->is_master()) {
1406 /* master before everything else */
1408 } else if (b->is_master()) {
1409 /* everything else before master */
1412 return a->order_key () < b->order_key ();
1417 EditorRoutes::initial_display ()
1419 DisplaySuspender ds;
1426 RouteList r (*_session->get_routes());
1428 r.sort (EditorOrderRouteSorter ());
1429 _editor->add_routes (r);
1433 EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& context,
1435 const SelectionData& data,
1436 guint info, guint time)
1438 if (data.get_target() == "GTK_TREE_MODEL_ROW") {
1439 _display.on_drag_data_received (context, x, y, data, info, time);
1443 context->drag_finish (true, false, time);
1447 EditorRoutes::move_selected_tracks (bool up)
1449 if (_editor->selection->tracks.empty()) {
1453 typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
1454 std::list<ViewRoute> view_routes;
1455 std::vector<int> neworder;
1456 TreeModel::Children rows = _model->children();
1457 TreeModel::Children::iterator ri;
1459 for (ri = rows.begin(); ri != rows.end(); ++ri) {
1460 TimeAxisView* tv = (*ri)[_columns.tv];
1461 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1463 view_routes.push_back (ViewRoute (tv, route));
1466 list<ViewRoute>::iterator trailing;
1467 list<ViewRoute>::iterator leading;
1471 trailing = view_routes.begin();
1472 leading = view_routes.begin();
1476 while (leading != view_routes.end()) {
1477 if (_editor->selection->selected (leading->first)) {
1478 view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
1479 leading = view_routes.erase (leading);
1488 /* if we could use reverse_iterator in list::insert, this code
1489 would be a beautiful reflection of the code above. but we can't
1490 and so it looks like a bit of a mess.
1493 trailing = view_routes.end();
1494 leading = view_routes.end();
1496 --leading; if (leading == view_routes.begin()) { return; }
1502 if (_editor->selection->selected (leading->first)) {
1503 list<ViewRoute>::iterator tmp;
1505 /* need to insert *after* trailing, not *before* it,
1506 which is what insert (iter, val) normally does.
1512 view_routes.insert (tmp, ViewRoute (leading->first, leading->second));
1514 /* can't use iter = cont.erase (iter); form here, because
1515 we need iter to move backwards.
1523 if (leading == view_routes.begin()) {
1524 /* the one we've just inserted somewhere else
1525 was the first in the list. erase this copy,
1526 and then break, because we're done.
1531 view_routes.erase (leading);
1540 if (leading == view_routes.begin()) {
1549 for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
1550 uint32_t order = leading->second->order_key ();
1551 neworder.push_back (order);
1555 DEBUG_TRACE (DEBUG::OrderKeys, "New order after moving tracks:\n");
1556 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1557 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("\t%1\n", *i));
1559 DEBUG_TRACE (DEBUG::OrderKeys, "-------\n");
1561 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1562 if (*i >= (int) neworder.size()) {
1563 cerr << "Trying to move something to " << *i << " of " << neworder.size() << endl;
1565 assert (*i < (int) neworder.size ());
1569 _model->reorder (neworder);
1573 EditorRoutes::update_input_active_display ()
1575 TreeModel::Children rows = _model->children();
1576 TreeModel::Children::iterator i;
1578 for (i = rows.begin(); i != rows.end(); ++i) {
1579 boost::shared_ptr<Route> route = (*i)[_columns.route];
1581 if (boost::dynamic_pointer_cast<Track> (route)) {
1582 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1585 (*i)[_columns.is_input_active] = mt->input_active();
1592 EditorRoutes::update_rec_display ()
1594 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1595 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1600 EditorRoutes::idle_update_mute_rec_solo_etc()
1602 g_atomic_int_set (const_cast<gint*>(&_queue_tv_update), 0);
1603 TreeModel::Children rows = _model->children();
1604 TreeModel::Children::iterator i;
1606 for (i = rows.begin(); i != rows.end(); ++i) {
1607 boost::shared_ptr<Route> route = (*i)[_columns.route];
1608 (*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, route);
1609 (*i)[_columns.solo_state] = RouteUI::solo_active_state (route);
1610 (*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_active_state (route) ? 1 : 0;
1611 (*i)[_columns.solo_safe_state] = RouteUI::solo_safe_active_state (route) ? 1 : 0;
1612 (*i)[_columns.active] = route->active ();
1613 if (boost::dynamic_pointer_cast<Track> (route)) {
1614 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1616 if (route->record_enabled()) {
1617 if (_session->record_status() == Session::Recording) {
1618 (*i)[_columns.rec_state] = 1;
1620 (*i)[_columns.rec_state] = 2;
1622 } else if (mt && mt->step_editing()) {
1623 (*i)[_columns.rec_state] = 3;
1625 (*i)[_columns.rec_state] = 0;
1628 // TODO figure out how to make this Cell insensitive
1629 // and see RouteUI::check_rec_enable_sensitivity()
1631 (*i)[_columns.name_editable] = !route->record_enabled ();
1635 return false; // do not call again (until needed)
1640 EditorRoutes::update_mute_display ()
1642 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1643 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1648 EditorRoutes::update_solo_display ()
1650 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1651 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1656 EditorRoutes::update_solo_isolate_display ()
1658 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1659 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1664 EditorRoutes::update_solo_safe_display ()
1666 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1667 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1672 EditorRoutes::views () const
1674 list<TimeAxisView*> v;
1675 for (TreeModel::Children::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
1676 v.push_back ((*i)[_columns.tv]);
1683 EditorRoutes::clear ()
1685 _display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
1687 _display.set_model (_model);
1691 EditorRoutes::name_edit_started (CellEditable* ce, const Glib::ustring&)
1695 /* give it a special name */
1697 Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
1700 e->set_name (X_("RouteNameEditorEntry"));
1705 EditorRoutes::name_edit (std::string const & path, std::string const & new_text)
1709 TreeIter iter = _model->get_iter (path);
1715 boost::shared_ptr<Route> route = (*iter)[_columns.route];
1717 if (route && route->name() != new_text) {
1718 route->set_name (new_text);
1723 EditorRoutes::solo_changed_so_update_mute ()
1725 update_mute_display ();
1729 EditorRoutes::show_tracks_with_regions_at_playhead ()
1731 boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
1733 set<TimeAxisView*> show;
1734 for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
1735 TimeAxisView* tav = _editor->axis_view_from_route (*i);
1741 DisplaySuspender ds;
1743 TreeModel::Children rows = _model->children ();
1744 for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
1745 TimeAxisView* tv = (*i)[_columns.tv];
1746 bool to_show = (show.find (tv) != show.end());
1748 tv->set_marked_for_display (to_show);
1749 (*i)[_columns.visible] = to_show;
1752 /* force route order keys catch up with visibility changes
1755 sync_order_keys_from_treeview ();
1759 EditorRoutes::plugin_setup (boost::shared_ptr<Route> r, boost::shared_ptr<PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
1761 PluginSetupDialog psd (r, pi, flags);