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());
716 if ((*x)->is_midi_track()) {
717 boost::shared_ptr<MidiTrack> t = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
718 t->StepEditStatusChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
719 t->InputActiveChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_input_active_display, this), gui_context());
722 (*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
723 (*x)->route()->solo_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this), gui_context());
724 (*x)->route()->listen_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this), gui_context());
725 (*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
726 (*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context());
727 (*x)->route()->active_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_active_display, this), gui_context ());
731 update_rec_display ();
732 update_mute_display ();
733 update_solo_display ();
734 update_solo_isolate_display ();
735 update_solo_safe_display ();
736 update_input_active_display ();
737 update_active_display ();
739 _display.set_model (_model);
741 /* now update route order keys from the treeview/track display order */
743 sync_order_keys_from_treeview ();
748 EditorRoutes::handle_gui_changes (string const & what, void*)
750 if (_adding_routes) {
754 if (what == "track_height") {
755 /* Optional :make tracks change height while it happens, instead
761 if (what == "visible_tracks") {
767 EditorRoutes::route_removed (TimeAxisView *tv)
769 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_removed, tv)
771 TreeModel::Children rows = _model->children();
772 TreeModel::Children::iterator ri;
774 for (ri = rows.begin(); ri != rows.end(); ++ri) {
775 if ((*ri)[_columns.tv] == tv) {
776 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
782 /* the deleted signal for the treeview/model will take
788 EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> r)
790 if (!what_changed.contains (ARDOUR::Properties::name)) {
794 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
796 boost::shared_ptr<Route> route = r.lock ();
802 TreeModel::Children rows = _model->children();
803 TreeModel::Children::iterator i;
805 for (i = rows.begin(); i != rows.end(); ++i) {
806 boost::shared_ptr<Route> t = (*i)[_columns.route];
808 (*i)[_columns.text] = route->name();
815 EditorRoutes::update_active_display ()
817 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
818 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
823 EditorRoutes::update_visibility ()
825 TreeModel::Children rows = _model->children();
826 TreeModel::Children::iterator i;
830 for (i = rows.begin(); i != rows.end(); ++i) {
831 TimeAxisView *tv = (*i)[_columns.tv];
832 (*i)[_columns.visible] = tv->marked_for_display ();
835 /* force route order keys catch up with visibility changes
838 sync_order_keys_from_treeview ();
842 EditorRoutes::hide_track_in_display (TimeAxisView& tv)
844 TreeModel::Children rows = _model->children();
845 TreeModel::Children::iterator i;
847 for (i = rows.begin(); i != rows.end(); ++i) {
848 if ((*i)[_columns.tv] == &tv) {
849 tv.set_marked_for_display (false);
850 (*i)[_columns.visible] = false;
858 EditorRoutes::show_track_in_display (TimeAxisView& tv)
860 TreeModel::Children rows = _model->children();
861 TreeModel::Children::iterator i;
864 for (i = rows.begin(); i != rows.end(); ++i) {
865 if ((*i)[_columns.tv] == &tv) {
866 tv.set_marked_for_display (true);
867 (*i)[_columns.visible] = true;
875 EditorRoutes::reset_remote_control_ids ()
877 if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
881 TreeModel::Children rows = _model->children();
888 DEBUG_TRACE (DEBUG::OrderKeys, "editor reset remote control ids\n");
890 TreeModel::Children::iterator ri;
891 bool rid_change = false;
893 uint32_t invisible_key = UINT32_MAX;
895 for (ri = rows.begin(); ri != rows.end(); ++ri) {
897 /* skip two special values */
899 if (rid == Route::MasterBusRemoteControlID) {
903 if (rid == Route::MonitorBusRemoteControlID) {
907 boost::shared_ptr<Route> route = (*ri)[_columns.route];
908 bool visible = (*ri)[_columns.visible];
910 if (!route->is_master() && !route->is_monitor()) {
912 uint32_t new_rid = (visible ? rid : invisible_key--);
914 if (new_rid != route->remote_control_id()) {
915 route->set_remote_control_id_explicit (new_rid);
927 /* tell the world that we changed the remote control IDs */
928 _session->notify_remote_id_change ();
934 EditorRoutes::sync_order_keys_from_treeview ()
936 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
940 TreeModel::Children rows = _model->children();
947 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from treeview\n");
949 TreeModel::Children::iterator ri;
950 bool changed = false;
951 bool rid_change = false;
954 uint32_t invisible_key = UINT32_MAX;
956 for (ri = rows.begin(); ri != rows.end(); ++ri) {
958 boost::shared_ptr<Route> route = (*ri)[_columns.route];
959 bool visible = (*ri)[_columns.visible];
961 uint32_t old_key = route->order_key ();
963 if (order != old_key) {
964 route->set_order_key (order);
969 if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
971 uint32_t new_rid = (visible ? rid : invisible_key--);
973 if (new_rid != route->remote_control_id()) {
974 route->set_remote_control_id_explicit (new_rid);
988 /* tell the world that we changed the editor sort keys */
989 _session->sync_order_keys ();
993 /* tell the world that we changed the remote control IDs */
994 _session->notify_remote_id_change ();
999 EditorRoutes::sync_treeview_from_order_keys ()
1001 /* Some route order key(s) have been changed, make sure that
1002 we update out tree/list model and GUI to reflect the change.
1005 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
1009 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from order keys.\n");
1011 /* we could get here after either a change in the Mixer or Editor sort
1012 * order, but either way, the mixer order keys reflect the intended
1013 * order for the GUI, so reorder the treeview model to match it.
1016 vector<int> neworder;
1017 TreeModel::Children rows = _model->children();
1018 uint32_t old_order = 0;
1019 bool changed = false;
1025 OrderKeySortedRoutes sorted_routes;
1027 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
1028 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1029 sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key ()));
1032 SortByNewDisplayOrder cmp;
1034 sort (sorted_routes.begin(), sorted_routes.end(), cmp);
1035 neworder.assign (sorted_routes.size(), 0);
1039 for (OrderKeySortedRoutes::iterator sr = sorted_routes.begin(); sr != sorted_routes.end(); ++sr, ++n) {
1041 neworder[n] = sr->old_display_order;
1043 if (sr->old_display_order != n) {
1047 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n",
1048 sr->route->name(), sr->old_display_order, n));
1052 Unwinder<bool> uw (_ignore_reorder, true);
1053 _model->reorder (neworder);
1060 EditorRoutes::hide_all_tracks (bool /*with_select*/)
1062 TreeModel::Children rows = _model->children();
1063 TreeModel::Children::iterator i;
1065 DisplaySuspender ds;
1067 for (i = rows.begin(); i != rows.end(); ++i) {
1069 TreeModel::Row row = (*i);
1070 TimeAxisView *tv = row[_columns.tv];
1076 row[_columns.visible] = false;
1081 EditorRoutes::set_all_tracks_visibility (bool yn)
1083 TreeModel::Children rows = _model->children();
1084 TreeModel::Children::iterator i;
1086 DisplaySuspender ds;
1088 for (i = rows.begin(); i != rows.end(); ++i) {
1090 TreeModel::Row row = (*i);
1091 TimeAxisView* tv = row[_columns.tv];
1097 tv->set_marked_for_display (yn);
1098 (*i)[_columns.visible] = yn;
1101 /* force route order keys catch up with visibility changes
1104 sync_order_keys_from_treeview ();
1108 EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
1110 TreeModel::Children rows = _model->children();
1111 TreeModel::Children::iterator i;
1113 DisplaySuspender ds;
1115 for (i = rows.begin(); i != rows.end(); ++i) {
1117 TreeModel::Row row = (*i);
1118 TimeAxisView* tv = row[_columns.tv];
1120 AudioTimeAxisView* atv;
1121 MidiTimeAxisView* mtv;
1127 if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) {
1130 atv->set_marked_for_display (yn);
1131 (*i)[_columns.visible] = yn;
1135 if (atv->is_audio_track()) {
1136 atv->set_marked_for_display (yn);
1137 (*i)[_columns.visible] = yn;
1142 if (!atv->is_audio_track()) {
1143 atv->set_marked_for_display (yn);
1144 (*i)[_columns.visible] = yn;
1149 else if ((mtv = dynamic_cast<MidiTimeAxisView*>(tv)) != 0) {
1152 mtv->set_marked_for_display (yn);
1153 (*i)[_columns.visible] = yn;
1157 if (mtv->is_midi_track()) {
1158 mtv->set_marked_for_display (yn);
1159 (*i)[_columns.visible] = yn;
1166 /* force route order keys catch up with visibility changes
1169 sync_order_keys_from_treeview ();
1173 EditorRoutes::hide_all_routes ()
1175 set_all_tracks_visibility (false);
1179 EditorRoutes::show_all_routes ()
1181 set_all_tracks_visibility (true);
1185 EditorRoutes::show_all_audiotracks()
1187 set_all_audio_midi_visibility (1, true);
1190 EditorRoutes::hide_all_audiotracks ()
1192 set_all_audio_midi_visibility (1, false);
1196 EditorRoutes::show_all_audiobus ()
1198 set_all_audio_midi_visibility (2, true);
1201 EditorRoutes::hide_all_audiobus ()
1203 set_all_audio_midi_visibility (2, false);
1207 EditorRoutes::show_all_miditracks()
1209 set_all_audio_midi_visibility (3, true);
1212 EditorRoutes::hide_all_miditracks ()
1214 set_all_audio_midi_visibility (3, false);
1218 EditorRoutes::key_press (GdkEventKey* ev)
1220 TreeViewColumn *col;
1221 boost::shared_ptr<RouteList> rl (new RouteList);
1224 switch (ev->keyval) {
1226 case GDK_ISO_Left_Tab:
1228 /* If we appear to be editing something, leave that cleanly and appropriately. */
1229 if (name_editable) {
1230 name_editable->editing_done ();
1234 col = _display.get_column (_name_column); // select&focus on name column
1236 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1237 treeview_select_previous (_display, _model, col);
1239 treeview_select_next (_display, _model, col);
1246 if (get_relevant_routes (rl)) {
1247 _session->set_mute (rl, !rl->front()->muted(), Session::rt_cleanup);
1253 if (get_relevant_routes (rl)) {
1254 if (Config->get_solo_control_is_listen_control()) {
1255 _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup);
1257 _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup);
1264 if (get_relevant_routes (rl)) {
1265 _session->set_record_enabled (rl, !rl->front()->record_enabled(), Session::rt_cleanup);
1277 EditorRoutes::get_relevant_routes (boost::shared_ptr<RouteList> rl)
1280 RouteTimeAxisView* rtv;
1281 RefPtr<TreeSelection> selection = _display.get_selection();
1285 if (selection->count_selected_rows() != 0) {
1289 RefPtr<TreeModel> tm = RefPtr<TreeModel>::cast_dynamic (_model);
1290 iter = selection->get_selected (tm);
1293 /* use mouse pointer */
1298 _display.get_pointer (x, y);
1299 _display.convert_widget_to_bin_window_coords (x, y, bx, by);
1301 if (_display.get_path_at_pos (bx, by, path)) {
1302 iter = _model->get_iter (path);
1307 tv = (*iter)[_columns.tv];
1309 rtv = dynamic_cast<RouteTimeAxisView*>(tv);
1311 rl->push_back (rtv->route());
1316 return !rl->empty();
1320 EditorRoutes::button_press (GdkEventButton* ev)
1322 if (Keyboard::is_context_menu_event (ev)) {
1327 TreeModel::Path path;
1328 TreeViewColumn *tvc;
1332 if (!_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, tvc, cell_x, cell_y)) {
1333 /* cancel selection */
1334 _display.get_selection()->unselect_all ();
1335 /* end any editing by grabbing focus */
1336 _display.grab_focus ();
1340 //Scroll editor canvas to selected track
1341 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1343 Gtk::TreeModel::Row row = *_model->get_iter (path);
1344 TimeAxisView *tv = row[_columns.tv];
1347 _editor->ensure_time_axis_view_is_visible (*tv, true);
1355 EditorRoutes::selection_changed ()
1357 _editor->begin_reversible_selection_op (X_("Select Track from Route List"));
1359 if (_display.get_selection()->count_selected_rows() > 0) {
1362 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
1363 TrackViewList selected;
1365 _editor->get_selection().clear_regions ();
1367 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
1369 if ((iter = _model->get_iter (*i))) {
1371 TimeAxisView* tv = (*iter)[_columns.tv];
1372 selected.push_back (tv);
1377 _editor->get_selection().set (selected);
1378 _editor->ensure_time_axis_view_is_visible (*(selected.front()), true);
1381 _editor->get_selection().clear_tracks ();
1384 _editor->commit_reversible_selection_op ();
1388 EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
1390 if (selection_countdown) {
1391 if (--selection_countdown == 0) {
1394 /* no selection yet ... */
1401 struct EditorOrderRouteSorter
1403 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
1404 if (a->is_master()) {
1405 /* master before everything else */
1407 } else if (b->is_master()) {
1408 /* everything else before master */
1411 return a->order_key () < b->order_key ();
1416 EditorRoutes::initial_display ()
1418 DisplaySuspender ds;
1425 RouteList r (*_session->get_routes());
1427 r.sort (EditorOrderRouteSorter ());
1428 _editor->add_routes (r);
1432 EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& context,
1434 const SelectionData& data,
1435 guint info, guint time)
1437 if (data.get_target() == "GTK_TREE_MODEL_ROW") {
1438 _display.on_drag_data_received (context, x, y, data, info, time);
1442 context->drag_finish (true, false, time);
1446 EditorRoutes::move_selected_tracks (bool up)
1448 if (_editor->selection->tracks.empty()) {
1452 typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
1453 std::list<ViewRoute> view_routes;
1454 std::vector<int> neworder;
1455 TreeModel::Children rows = _model->children();
1456 TreeModel::Children::iterator ri;
1458 for (ri = rows.begin(); ri != rows.end(); ++ri) {
1459 TimeAxisView* tv = (*ri)[_columns.tv];
1460 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1462 view_routes.push_back (ViewRoute (tv, route));
1465 list<ViewRoute>::iterator trailing;
1466 list<ViewRoute>::iterator leading;
1470 trailing = view_routes.begin();
1471 leading = view_routes.begin();
1475 while (leading != view_routes.end()) {
1476 if (_editor->selection->selected (leading->first)) {
1477 view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
1478 leading = view_routes.erase (leading);
1487 /* if we could use reverse_iterator in list::insert, this code
1488 would be a beautiful reflection of the code above. but we can't
1489 and so it looks like a bit of a mess.
1492 trailing = view_routes.end();
1493 leading = view_routes.end();
1495 --leading; if (leading == view_routes.begin()) { return; }
1501 if (_editor->selection->selected (leading->first)) {
1502 list<ViewRoute>::iterator tmp;
1504 /* need to insert *after* trailing, not *before* it,
1505 which is what insert (iter, val) normally does.
1511 view_routes.insert (tmp, ViewRoute (leading->first, leading->second));
1513 /* can't use iter = cont.erase (iter); form here, because
1514 we need iter to move backwards.
1522 if (leading == view_routes.begin()) {
1523 /* the one we've just inserted somewhere else
1524 was the first in the list. erase this copy,
1525 and then break, because we're done.
1530 view_routes.erase (leading);
1539 if (leading == view_routes.begin()) {
1548 for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
1549 uint32_t order = leading->second->order_key ();
1550 neworder.push_back (order);
1554 DEBUG_TRACE (DEBUG::OrderKeys, "New order after moving tracks:\n");
1555 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1556 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("\t%1\n", *i));
1558 DEBUG_TRACE (DEBUG::OrderKeys, "-------\n");
1560 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1561 if (*i >= (int) neworder.size()) {
1562 cerr << "Trying to move something to " << *i << " of " << neworder.size() << endl;
1564 assert (*i < (int) neworder.size ());
1568 _model->reorder (neworder);
1572 EditorRoutes::update_input_active_display ()
1574 TreeModel::Children rows = _model->children();
1575 TreeModel::Children::iterator i;
1577 for (i = rows.begin(); i != rows.end(); ++i) {
1578 boost::shared_ptr<Route> route = (*i)[_columns.route];
1580 if (boost::dynamic_pointer_cast<Track> (route)) {
1581 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1584 (*i)[_columns.is_input_active] = mt->input_active();
1591 EditorRoutes::update_rec_display ()
1593 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1594 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1599 EditorRoutes::idle_update_mute_rec_solo_etc()
1601 g_atomic_int_set (const_cast<gint*>(&_queue_tv_update), 0);
1602 TreeModel::Children rows = _model->children();
1603 TreeModel::Children::iterator i;
1605 for (i = rows.begin(); i != rows.end(); ++i) {
1606 boost::shared_ptr<Route> route = (*i)[_columns.route];
1607 (*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, route);
1608 (*i)[_columns.solo_state] = RouteUI::solo_active_state (route);
1609 (*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_active_state (route) ? 1 : 0;
1610 (*i)[_columns.solo_safe_state] = RouteUI::solo_safe_active_state (route) ? 1 : 0;
1611 (*i)[_columns.active] = route->active ();
1612 if (boost::dynamic_pointer_cast<Track> (route)) {
1613 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1615 if (route->record_enabled()) {
1616 if (_session->record_status() == Session::Recording) {
1617 (*i)[_columns.rec_state] = 1;
1619 (*i)[_columns.rec_state] = 2;
1621 } else if (mt && mt->step_editing()) {
1622 (*i)[_columns.rec_state] = 3;
1624 (*i)[_columns.rec_state] = 0;
1627 (*i)[_columns.name_editable] = !route->record_enabled ();
1631 return false; // do not call again (until needed)
1636 EditorRoutes::update_mute_display ()
1638 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1639 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1644 EditorRoutes::update_solo_display ()
1646 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1647 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1652 EditorRoutes::update_solo_isolate_display ()
1654 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1655 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1660 EditorRoutes::update_solo_safe_display ()
1662 if (g_atomic_int_compare_and_exchange (const_cast<gint*>(&_queue_tv_update), 0, 1)) {
1663 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1668 EditorRoutes::views () const
1670 list<TimeAxisView*> v;
1671 for (TreeModel::Children::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
1672 v.push_back ((*i)[_columns.tv]);
1679 EditorRoutes::clear ()
1681 _display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
1683 _display.set_model (_model);
1687 EditorRoutes::name_edit_started (CellEditable* ce, const Glib::ustring&)
1691 /* give it a special name */
1693 Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
1696 e->set_name (X_("RouteNameEditorEntry"));
1701 EditorRoutes::name_edit (std::string const & path, std::string const & new_text)
1705 TreeIter iter = _model->get_iter (path);
1711 boost::shared_ptr<Route> route = (*iter)[_columns.route];
1713 if (route && route->name() != new_text) {
1714 route->set_name (new_text);
1719 EditorRoutes::solo_changed_so_update_mute ()
1721 update_mute_display ();
1725 EditorRoutes::show_tracks_with_regions_at_playhead ()
1727 boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
1729 set<TimeAxisView*> show;
1730 for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
1731 TimeAxisView* tav = _editor->axis_view_from_route (*i);
1737 DisplaySuspender ds;
1739 TreeModel::Children rows = _model->children ();
1740 for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
1741 TimeAxisView* tv = (*i)[_columns.tv];
1742 bool to_show = (show.find (tv) != show.end());
1744 tv->set_marked_for_display (to_show);
1745 (*i)[_columns.visible] = to_show;
1748 /* force route order keys catch up with visibility changes
1751 sync_order_keys_from_treeview ();
1755 EditorRoutes::plugin_setup (boost::shared_ptr<Route> r, boost::shared_ptr<PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
1757 PluginSetupDialog psd (r, pi, flags);