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 "route_sorter.h"
55 using namespace ARDOUR;
56 using namespace ARDOUR_UI_UTILS;
59 using namespace Gtkmm2ext;
61 using Gtkmm2ext::Keyboard;
69 EditorRoutes::EditorRoutes (Editor* e)
71 , _ignore_reorder (false)
72 , _no_redisplay (false)
73 , _adding_routes (false)
74 , _route_deletion_in_progress (false)
75 , _redisplay_active (0)
76 , _queue_tv_update (0)
79 , selection_countdown (0)
82 static const int column_width = 22;
84 _scroller.add (_display);
85 _scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
87 _model = ListStore::create (_columns);
88 _display.set_model (_model);
90 // Record enable toggle
91 CellRendererPixbufMulti* rec_col_renderer = manage (new CellRendererPixbufMulti());
93 rec_col_renderer->set_pixbuf (0, ::get_icon("record-normal-disabled"));
94 rec_col_renderer->set_pixbuf (1, ::get_icon("record-normal-in-progress"));
95 rec_col_renderer->set_pixbuf (2, ::get_icon("record-normal-enabled"));
96 rec_col_renderer->set_pixbuf (3, ::get_icon("record-step"));
97 rec_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_rec_enable_changed));
99 TreeViewColumn* rec_state_column = manage (new TreeViewColumn("R", *rec_col_renderer));
101 rec_state_column->add_attribute(rec_col_renderer->property_state(), _columns.rec_state);
102 rec_state_column->add_attribute(rec_col_renderer->property_visible(), _columns.is_track);
104 rec_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
105 rec_state_column->set_alignment(ALIGN_CENTER);
106 rec_state_column->set_expand(false);
107 rec_state_column->set_fixed_width(column_width);
111 CellRendererPixbufMulti* input_active_col_renderer = manage (new CellRendererPixbufMulti());
112 input_active_col_renderer->set_pixbuf (0, ::get_icon("midi-input-inactive"));
113 input_active_col_renderer->set_pixbuf (1, ::get_icon("midi-input-active"));
114 input_active_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_input_active_changed));
116 TreeViewColumn* input_active_column = manage (new TreeViewColumn ("I", *input_active_col_renderer));
118 input_active_column->add_attribute(input_active_col_renderer->property_state(), _columns.is_input_active);
119 input_active_column->add_attribute (input_active_col_renderer->property_visible(), _columns.is_midi);
121 input_active_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
122 input_active_column->set_alignment(ALIGN_CENTER);
123 input_active_column->set_expand(false);
124 input_active_column->set_fixed_width(column_width);
126 // Mute enable toggle
127 CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti());
129 mute_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("mute-disabled"));
130 mute_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("muted-by-others"));
131 mute_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("mute-enabled"));
132 mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled));
134 TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
136 mute_state_column->add_attribute(mute_col_renderer->property_state(), _columns.mute_state);
137 mute_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
138 mute_state_column->set_alignment(ALIGN_CENTER);
139 mute_state_column->set_expand(false);
140 mute_state_column->set_fixed_width(15);
142 // Solo enable toggle
143 CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti());
145 solo_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("solo-disabled"));
146 solo_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("solo-enabled"));
147 solo_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("soloed-by-others"));
148 solo_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_enable_toggled));
150 TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer));
152 solo_state_column->add_attribute(solo_col_renderer->property_state(), _columns.solo_state);
153 solo_state_column->add_attribute(solo_col_renderer->property_visible(), _columns.solo_visible);
154 solo_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
155 solo_state_column->set_alignment(ALIGN_CENTER);
156 solo_state_column->set_expand(false);
157 solo_state_column->set_fixed_width(column_width);
159 // Solo isolate toggle
160 CellRendererPixbufMulti* solo_iso_renderer = manage (new CellRendererPixbufMulti());
162 solo_iso_renderer->set_pixbuf (0, ::get_icon("solo-isolate-disabled"));
163 solo_iso_renderer->set_pixbuf (1, ::get_icon("solo-isolate-enabled"));
164 solo_iso_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_isolate_toggled));
166 TreeViewColumn* solo_isolate_state_column = manage (new TreeViewColumn("SI", *solo_iso_renderer));
168 solo_isolate_state_column->add_attribute(solo_iso_renderer->property_state(), _columns.solo_isolate_state);
169 solo_isolate_state_column->add_attribute(solo_iso_renderer->property_visible(), _columns.solo_visible);
170 solo_isolate_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
171 solo_isolate_state_column->set_alignment(ALIGN_CENTER);
172 solo_isolate_state_column->set_expand(false);
173 solo_isolate_state_column->set_fixed_width(column_width);
176 CellRendererPixbufMulti* solo_safe_renderer = manage (new CellRendererPixbufMulti ());
178 solo_safe_renderer->set_pixbuf (0, ::get_icon("solo-safe-disabled"));
179 solo_safe_renderer->set_pixbuf (1, ::get_icon("solo-safe-enabled"));
180 solo_safe_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_safe_toggled));
182 TreeViewColumn* solo_safe_state_column = manage (new TreeViewColumn(_("SS"), *solo_safe_renderer));
183 solo_safe_state_column->add_attribute(solo_safe_renderer->property_state(), _columns.solo_safe_state);
184 solo_safe_state_column->add_attribute(solo_safe_renderer->property_visible(), _columns.solo_visible);
185 solo_safe_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
186 solo_safe_state_column->set_alignment(ALIGN_CENTER);
187 solo_safe_state_column->set_expand(false);
188 solo_safe_state_column->set_fixed_width(column_width);
190 _name_column = _display.append_column ("", _columns.text) - 1;
191 _visible_column = _display.append_column ("", _columns.visible) - 1;
192 _active_column = _display.append_column ("", _columns.active) - 1;
194 _display.append_column (*input_active_column);
195 _display.append_column (*rec_state_column);
196 _display.append_column (*mute_state_column);
197 _display.append_column (*solo_state_column);
198 _display.append_column (*solo_isolate_state_column);
199 _display.append_column (*solo_safe_state_column);
206 { 0, _("Name"), _("Track/Bus Name") },
207 { 1, _("V"), _("Track/Bus visible ?") },
208 { 2, _("A"), _("Track/Bus active ?") },
209 { 3, _("I"), _("MIDI input enabled") },
210 { 4, _("R"), _("Record enabled") },
211 { 5, _("M"), _("Muted") },
212 { 6, _("S"), _("Soloed") },
213 { 7, _("SI"), _("Solo Isolated") },
214 { 8, _("SS"), _("Solo Safe (Locked)") },
218 for (int i = 0; ci[i].index >= 0; ++i) {
219 col = _display.get_column (ci[i].index);
220 l = manage (new Label (ci[i].label));
221 ARDOUR_UI::instance()->set_tip (*l, ci[i].tooltip);
222 col->set_widget (*l);
226 _display.set_headers_visible (true);
227 _display.get_selection()->set_mode (SELECTION_SINGLE);
228 _display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
229 _display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::selection_changed));
230 _display.set_reorderable (true);
231 _display.set_name (X_("EditGroupList"));
232 _display.set_rules_hint (true);
233 _display.set_size_request (100, -1);
234 _display.add_object_drag (_columns.route.index(), "routes");
236 CellRendererText* name_cell = dynamic_cast<CellRendererText*> (_display.get_column_cell_renderer (_name_column));
239 name_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorRoutes::name_edit_started));
241 TreeViewColumn* name_column = _display.get_column (_name_column);
243 assert (name_column);
245 name_column->add_attribute (name_cell->property_editable(), _columns.name_editable);
246 name_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
247 name_column->set_expand(true);
248 name_column->set_min_width(50);
250 name_cell->property_editable() = true;
251 name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRoutes::name_edit));
253 // Set the visible column cell renderer to radio toggle
254 CellRendererToggle* visible_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (_visible_column));
256 visible_cell->property_activatable() = true;
257 visible_cell->property_radio() = false;
258 visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::visible_changed));
260 TreeViewColumn* visible_col = dynamic_cast<TreeViewColumn*> (_display.get_column (_visible_column));
261 visible_col->set_expand(false);
262 visible_col->set_sizing(TREE_VIEW_COLUMN_FIXED);
263 visible_col->set_fixed_width(30);
264 visible_col->set_alignment(ALIGN_CENTER);
266 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (_active_column));
268 active_cell->property_activatable() = true;
269 active_cell->property_radio() = false;
270 active_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::active_changed));
272 TreeViewColumn* active_col = dynamic_cast<TreeViewColumn*> (_display.get_column (_active_column));
273 active_col->set_expand (false);
274 active_col->set_sizing (TREE_VIEW_COLUMN_FIXED);
275 active_col->set_fixed_width (30);
276 active_col->set_alignment (ALIGN_CENTER);
278 _model->signal_row_deleted().connect (sigc::mem_fun (*this, &EditorRoutes::row_deleted));
279 _model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
281 _display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
282 _scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRoutes::key_press), false);
284 _scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorRoutes::focus_in), false);
285 _scroller.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditorRoutes::focus_out));
287 _display.signal_enter_notify_event().connect (sigc::mem_fun (*this, &EditorRoutes::enter_notify), false);
288 _display.signal_leave_notify_event().connect (sigc::mem_fun (*this, &EditorRoutes::leave_notify), false);
290 _display.set_enable_search (false);
292 Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context());
296 EditorRoutes::focus_in (GdkEventFocus*)
298 Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
301 old_focus = win->get_focus ();
308 /* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
313 EditorRoutes::focus_out (GdkEventFocus*)
316 old_focus->grab_focus ();
324 EditorRoutes::enter_notify (GdkEventCrossing*)
330 /* arm counter so that ::selection_filter() will deny selecting anything for the
331 * next two attempts to change selection status.
333 selection_countdown = 2;
334 _scroller.grab_focus ();
335 Keyboard::magic_widget_grab_focus ();
340 EditorRoutes::leave_notify (GdkEventCrossing*)
342 selection_countdown = 0;
345 old_focus->grab_focus ();
349 Keyboard::magic_widget_drop_focus ();
354 EditorRoutes::set_session (Session* s)
356 SessionHandlePtr::set_session (s);
361 _session->SoloChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::solo_changed_so_update_mute, this), gui_context());
362 _session->RecordStateChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
367 EditorRoutes::on_input_active_changed (std::string const & path_string)
369 // Get the model row that has been toggled.
370 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
372 TimeAxisView* tv = row[_columns.tv];
373 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
376 boost::shared_ptr<MidiTrack> mt;
377 mt = rtv->midi_track();
379 mt->set_input_active (!mt->input_active());
385 EditorRoutes::on_tv_rec_enable_changed (std::string const & path_string)
388 // Get the model row that has been toggled.
389 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
391 TimeAxisView* tv = row[_columns.tv];
392 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
394 if (rtv && rtv->track()) {
395 boost::shared_ptr<RouteList> rl (new RouteList);
396 rl->push_back (rtv->route());
397 _session->set_record_enabled (rl, !rtv->track()->record_enabled(), Session::rt_cleanup);
402 EditorRoutes::on_tv_mute_enable_toggled (std::string const & path_string)
404 // Get the model row that has been toggled.
405 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
407 TimeAxisView *tv = row[_columns.tv];
408 RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
411 boost::shared_ptr<RouteList> rl (new RouteList);
412 rl->push_back (rtv->route());
413 _session->set_mute (rl, !rtv->route()->muted(), Session::rt_cleanup);
418 EditorRoutes::on_tv_solo_enable_toggled (std::string const & path_string)
420 // Get the model row that has been toggled.
421 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
423 TimeAxisView *tv = row[_columns.tv];
424 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
427 boost::shared_ptr<RouteList> rl (new RouteList);
428 rl->push_back (rtv->route());
429 if (Config->get_solo_control_is_listen_control()) {
430 _session->set_listen (rl, !rtv->route()->listening_via_monitor(), Session::rt_cleanup);
432 _session->set_solo (rl, !rtv->route()->self_soloed(), Session::rt_cleanup);
438 EditorRoutes::on_tv_solo_isolate_toggled (std::string const & path_string)
440 // Get the model row that has been toggled.
441 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
443 TimeAxisView *tv = row[_columns.tv];
444 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
447 rtv->route()->set_solo_isolated (!rtv->route()->solo_isolated(), this);
452 EditorRoutes::on_tv_solo_safe_toggled (std::string const & path_string)
454 // Get the model row that has been toggled.
455 Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
457 TimeAxisView *tv = row[_columns.tv];
458 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
461 rtv->route()->set_solo_safe (!rtv->route()->solo_safe(), this);
466 EditorRoutes::build_menu ()
468 using namespace Menu_Helpers;
473 MenuList& items = _menu->items();
474 _menu->set_name ("ArdourContextMenu");
476 items.push_back (MenuElem (_("Show All"), sigc::mem_fun (*this, &EditorRoutes::show_all_routes)));
477 items.push_back (MenuElem (_("Hide All"), sigc::mem_fun (*this, &EditorRoutes::hide_all_routes)));
478 items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiotracks)));
479 items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiotracks)));
480 items.push_back (MenuElem (_("Show All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiobus)));
481 items.push_back (MenuElem (_("Hide All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiobus)));
482 items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_miditracks)));
483 items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_miditracks)));
484 items.push_back (MenuElem (_("Show Tracks With Regions Under Playhead"), sigc::mem_fun (*this, &EditorRoutes::show_tracks_with_regions_at_playhead)));
488 EditorRoutes::show_menu ()
494 _menu->popup (1, gtk_get_current_event_time());
498 EditorRoutes::redisplay_real ()
500 TreeModel::Children rows = _model->children();
501 TreeModel::Children::iterator i;
504 /* n will be the count of tracks plus children (updated by TimeAxisView::show_at),
505 * so we will use that to know where to put things.
509 for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
510 TimeAxisView *tv = (*i)[_columns.tv];
511 boost::shared_ptr<Route> route = (*i)[_columns.route];
514 // just a "title" row
518 bool visible = tv->marked_for_display ();
520 /* show or hide the TimeAxisView */
522 position += tv->show_at (position, n, &_editor->edit_controls_vbox);
530 /* whenever we go idle, update the track view list to reflect the new order.
531 * we can't do this here, because we could mess up something that is traversing
532 * the track order and has caused a redisplay of the list.
534 Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
536 _editor->reset_controls_layout_height (position);
537 _editor->reset_controls_layout_width ();
538 _editor->_full_canvas_height = position;
540 if ((_editor->vertical_adjustment.get_value() + _editor->_visible_canvas_height) > _editor->vertical_adjustment.get_upper()) {
542 * We're increasing the size of the canvas while the bottom is visible.
543 * We scroll down to keep in step with the controls layout.
545 _editor->vertical_adjustment.set_value (_editor->_full_canvas_height - _editor->_visible_canvas_height);
550 EditorRoutes::redisplay ()
552 if (_no_redisplay || !_session || _session->deletion_in_progress()) {
556 // model deprecated g_atomic_int_exchange_and_add(, 1)
557 g_atomic_int_inc(&_redisplay_active);
558 if (!g_atomic_int_compare_and_exchange (&_redisplay_active, 1, 1)) {
564 while (!g_atomic_int_compare_and_exchange (&_redisplay_active, 1, 0)) {
565 g_atomic_int_set(&_redisplay_active, 1);
571 EditorRoutes::row_deleted (Gtk::TreeModel::Path const &)
573 /* this happens as the second step of a DnD within the treeview, and
574 * when a route is actually removed. we don't differentiate between
577 * note that the sync_orders_keys() step may not actually change any
578 * RID's (e.g. the last track may be removed, so all other tracks keep
579 * the same RID), which means that no redisplay would happen. so we
580 * have to force a redisplay.
583 DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview row deleted\n");
586 sync_order_keys_from_treeview ();
590 EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, int* /*what*/)
592 /* reordering implies that RID's will change, so sync_order_keys() will
596 DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview reordered\n");
597 sync_order_keys_from_treeview ();
601 EditorRoutes::visible_changed (std::string const & path)
603 if (_session && _session->deletion_in_progress()) {
610 if ((iter = _model->get_iter (path))) {
611 TimeAxisView* tv = (*iter)[_columns.tv];
613 bool visible = (*iter)[_columns.visible];
615 if (tv->set_marked_for_display (!visible)) {
616 update_visibility ();
623 EditorRoutes::active_changed (std::string const & path)
625 if (_session && _session->deletion_in_progress ()) {
629 Gtk::TreeModel::Row row = *_model->get_iter (path);
630 boost::shared_ptr<Route> route = row[_columns.route];
631 bool const active = row[_columns.active];
632 route->set_active (!active, this);
636 EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
638 PBD::Unwinder<bool> at (_adding_routes, true);
640 bool from_scratch = (_model->children().size() == 0);
641 Gtk::TreeModel::Children::iterator insert_iter = _model->children().end();
643 for (Gtk::TreeModel::Children::iterator it = _model->children().begin(); it != _model->children().end(); ++it) {
644 boost::shared_ptr<Route> r = (*it)[_columns.route];
646 if (r->order_key() == (routes.front()->route()->order_key() + routes.size())) {
653 _editor->selection->tracks.clear();
658 _display.set_model (Glib::RefPtr<ListStore>());
660 for (list<RouteTimeAxisView*>::iterator x = routes.begin(); x != routes.end(); ++x) {
662 boost::shared_ptr<MidiTrack> midi_trk = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
664 TreeModel::Row row = *(_model->insert (insert_iter));
666 row[_columns.text] = (*x)->route()->name();
667 row[_columns.visible] = (*x)->marked_for_display();
668 row[_columns.active] = (*x)->route()->active ();
669 row[_columns.tv] = *x;
670 row[_columns.route] = (*x)->route ();
671 row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
674 row[_columns.is_input_active] = midi_trk->input_active ();
675 row[_columns.is_midi] = true;
677 row[_columns.is_input_active] = false;
678 row[_columns.is_midi] = false;
681 row[_columns.mute_state] = (*x)->route()->muted() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off;
682 row[_columns.solo_state] = RouteUI::solo_active_state ((*x)->route());
683 row[_columns.solo_visible] = !(*x)->route()->is_master ();
684 row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
685 row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
686 row[_columns.name_editable] = true;
689 _editor->selection->add(*x);
692 boost::weak_ptr<Route> wr ((*x)->route());
694 (*x)->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
695 (*x)->route()->PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, wr), gui_context());
697 if ((*x)->is_track()) {
698 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
699 t->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
702 if ((*x)->is_midi_track()) {
703 boost::shared_ptr<MidiTrack> t = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
704 t->StepEditStatusChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
705 t->InputActiveChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_input_active_display, this), gui_context());
708 (*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
709 (*x)->route()->solo_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this, _1), gui_context());
710 (*x)->route()->listen_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_display, this, _1), gui_context());
711 (*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
712 (*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context());
713 (*x)->route()->active_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_active_display, this), gui_context ());
717 update_rec_display ();
718 update_mute_display ();
719 update_solo_display (true);
720 update_solo_isolate_display ();
721 update_solo_safe_display ();
722 update_input_active_display ();
723 update_active_display ();
725 _display.set_model (_model);
727 /* now update route order keys from the treeview/track display order */
729 sync_order_keys_from_treeview ();
733 EditorRoutes::handle_gui_changes (string const & what, void*)
735 if (_adding_routes) {
739 if (what == "track_height") {
740 /* Optional :make tracks change height while it happens, instead
746 if (what == "visible_tracks") {
752 EditorRoutes::route_removed (TimeAxisView *tv)
754 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_removed, tv)
756 TreeModel::Children rows = _model->children();
757 TreeModel::Children::iterator ri;
759 for (ri = rows.begin(); ri != rows.end(); ++ri) {
760 if ((*ri)[_columns.tv] == tv) {
761 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
767 /* the deleted signal for the treeview/model will take
773 EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> r)
775 if (!what_changed.contains (ARDOUR::Properties::name)) {
779 ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
781 boost::shared_ptr<Route> route = r.lock ();
787 TreeModel::Children rows = _model->children();
788 TreeModel::Children::iterator i;
790 for (i = rows.begin(); i != rows.end(); ++i) {
791 boost::shared_ptr<Route> t = (*i)[_columns.route];
793 (*i)[_columns.text] = route->name();
800 EditorRoutes::update_active_display ()
802 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
803 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
808 EditorRoutes::update_visibility ()
810 TreeModel::Children rows = _model->children();
811 TreeModel::Children::iterator i;
813 DisplaySuspender ds ();
815 for (i = rows.begin(); i != rows.end(); ++i) {
816 TimeAxisView *tv = (*i)[_columns.tv];
817 (*i)[_columns.visible] = tv->marked_for_display ();
820 /* force route order keys catch up with visibility changes
823 sync_order_keys_from_treeview ();
827 EditorRoutes::hide_track_in_display (TimeAxisView& tv)
829 TreeModel::Children rows = _model->children();
830 TreeModel::Children::iterator i;
832 for (i = rows.begin(); i != rows.end(); ++i) {
833 if ((*i)[_columns.tv] == &tv) {
834 tv.set_marked_for_display (false);
835 (*i)[_columns.visible] = false;
843 EditorRoutes::show_track_in_display (TimeAxisView& tv)
845 TreeModel::Children rows = _model->children();
846 TreeModel::Children::iterator i;
849 for (i = rows.begin(); i != rows.end(); ++i) {
850 if ((*i)[_columns.tv] == &tv) {
851 tv.set_marked_for_display (true);
852 (*i)[_columns.visible] = true;
860 EditorRoutes::reset_remote_control_ids ()
862 if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
866 TreeModel::Children rows = _model->children();
873 DEBUG_TRACE (DEBUG::OrderKeys, "editor reset remote control ids\n");
875 TreeModel::Children::iterator ri;
876 bool rid_change = false;
878 uint32_t invisible_key = UINT32_MAX;
880 for (ri = rows.begin(); ri != rows.end(); ++ri) {
882 boost::shared_ptr<Route> route = (*ri)[_columns.route];
883 bool visible = (*ri)[_columns.visible];
886 if (!route->is_master() && !route->is_monitor()) {
888 uint32_t new_rid = (visible ? rid : invisible_key--);
890 if (new_rid != route->remote_control_id()) {
891 route->set_remote_control_id_explicit (new_rid);
903 /* tell the world that we changed the remote control IDs */
904 _session->notify_remote_id_change ();
910 EditorRoutes::sync_order_keys_from_treeview ()
912 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
916 TreeModel::Children rows = _model->children();
923 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from treeview\n");
925 TreeModel::Children::iterator ri;
926 bool changed = false;
927 bool rid_change = false;
930 uint32_t invisible_key = UINT32_MAX;
932 for (ri = rows.begin(); ri != rows.end(); ++ri) {
934 boost::shared_ptr<Route> route = (*ri)[_columns.route];
935 bool visible = (*ri)[_columns.visible];
937 uint32_t old_key = route->order_key ();
939 if (order != old_key) {
940 route->set_order_key (order);
945 if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
947 uint32_t new_rid = (visible ? rid : invisible_key--);
949 if (new_rid != route->remote_control_id()) {
950 route->set_remote_control_id_explicit (new_rid);
964 /* tell the world that we changed the editor sort keys */
965 _session->sync_order_keys ();
969 /* tell the world that we changed the remote control IDs */
970 _session->notify_remote_id_change ();
975 EditorRoutes::sync_treeview_from_order_keys ()
977 /* Some route order key(s) have been changed, make sure that
978 we update out tree/list model and GUI to reflect the change.
981 if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
985 DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from order keys.\n");
987 /* we could get here after either a change in the Mixer or Editor sort
988 * order, but either way, the mixer order keys reflect the intended
989 * order for the GUI, so reorder the treeview model to match it.
992 vector<int> neworder;
993 TreeModel::Children rows = _model->children();
994 uint32_t old_order = 0;
995 bool changed = false;
1001 OrderKeySortedRoutes sorted_routes;
1003 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
1004 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1005 sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key ()));
1008 SortByNewDisplayOrder cmp;
1010 sort (sorted_routes.begin(), sorted_routes.end(), cmp);
1011 neworder.assign (sorted_routes.size(), 0);
1015 for (OrderKeySortedRoutes::iterator sr = sorted_routes.begin(); sr != sorted_routes.end(); ++sr, ++n) {
1017 neworder[n] = sr->old_display_order;
1019 if (sr->old_display_order != n) {
1023 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n",
1024 sr->route->name(), sr->old_display_order, n));
1028 Unwinder<bool> uw (_ignore_reorder, true);
1029 _model->reorder (neworder);
1036 EditorRoutes::hide_all_tracks (bool /*with_select*/)
1038 TreeModel::Children rows = _model->children();
1039 TreeModel::Children::iterator i;
1041 DisplaySuspender ds;
1043 for (i = rows.begin(); i != rows.end(); ++i) {
1045 TreeModel::Row row = (*i);
1046 TimeAxisView *tv = row[_columns.tv];
1052 row[_columns.visible] = false;
1057 EditorRoutes::set_all_tracks_visibility (bool yn)
1059 TreeModel::Children rows = _model->children();
1060 TreeModel::Children::iterator i;
1062 DisplaySuspender ds;
1064 for (i = rows.begin(); i != rows.end(); ++i) {
1066 TreeModel::Row row = (*i);
1067 TimeAxisView* tv = row[_columns.tv];
1073 tv->set_marked_for_display (yn);
1074 (*i)[_columns.visible] = yn;
1077 /* force route order keys catch up with visibility changes
1080 sync_order_keys_from_treeview ();
1084 EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
1086 TreeModel::Children rows = _model->children();
1087 TreeModel::Children::iterator i;
1089 DisplaySuspender ds;
1091 for (i = rows.begin(); i != rows.end(); ++i) {
1093 TreeModel::Row row = (*i);
1094 TimeAxisView* tv = row[_columns.tv];
1096 AudioTimeAxisView* atv;
1097 MidiTimeAxisView* mtv;
1103 if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) {
1106 (*i)[_columns.visible] = yn;
1110 if (atv->is_audio_track()) {
1111 (*i)[_columns.visible] = yn;
1116 if (!atv->is_audio_track()) {
1117 (*i)[_columns.visible] = yn;
1122 else if ((mtv = dynamic_cast<MidiTimeAxisView*>(tv)) != 0) {
1125 (*i)[_columns.visible] = yn;
1129 if (mtv->is_midi_track()) {
1130 (*i)[_columns.visible] = yn;
1137 /* force route order keys catch up with visibility changes
1140 sync_order_keys_from_treeview ();
1144 EditorRoutes::hide_all_routes ()
1146 set_all_tracks_visibility (false);
1150 EditorRoutes::show_all_routes ()
1152 set_all_tracks_visibility (true);
1156 EditorRoutes::show_all_audiotracks()
1158 set_all_audio_midi_visibility (1, true);
1161 EditorRoutes::hide_all_audiotracks ()
1163 set_all_audio_midi_visibility (1, false);
1167 EditorRoutes::show_all_audiobus ()
1169 set_all_audio_midi_visibility (2, true);
1172 EditorRoutes::hide_all_audiobus ()
1174 set_all_audio_midi_visibility (2, false);
1178 EditorRoutes::show_all_miditracks()
1180 set_all_audio_midi_visibility (3, true);
1183 EditorRoutes::hide_all_miditracks ()
1185 set_all_audio_midi_visibility (3, false);
1189 EditorRoutes::key_press (GdkEventKey* ev)
1191 TreeViewColumn *col;
1192 boost::shared_ptr<RouteList> rl (new RouteList);
1195 switch (ev->keyval) {
1197 case GDK_ISO_Left_Tab:
1199 /* If we appear to be editing something, leave that cleanly and appropriately. */
1200 if (name_editable) {
1201 name_editable->editing_done ();
1205 col = _display.get_column (_name_column); // select&focus on name column
1207 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1208 treeview_select_previous (_display, _model, col);
1210 treeview_select_next (_display, _model, col);
1217 if (get_relevant_routes (rl)) {
1218 _session->set_mute (rl, !rl->front()->muted(), Session::rt_cleanup);
1224 if (get_relevant_routes (rl)) {
1225 if (Config->get_solo_control_is_listen_control()) {
1226 _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup);
1228 _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup);
1235 if (get_relevant_routes (rl)) {
1236 _session->set_record_enabled (rl, !rl->front()->record_enabled(), Session::rt_cleanup);
1248 EditorRoutes::get_relevant_routes (boost::shared_ptr<RouteList> rl)
1251 RouteTimeAxisView* rtv;
1252 RefPtr<TreeSelection> selection = _display.get_selection();
1256 if (selection->count_selected_rows() != 0) {
1260 RefPtr<TreeModel> tm = RefPtr<TreeModel>::cast_dynamic (_model);
1261 iter = selection->get_selected (tm);
1264 /* use mouse pointer */
1269 _display.get_pointer (x, y);
1270 _display.convert_widget_to_bin_window_coords (x, y, bx, by);
1272 if (_display.get_path_at_pos (bx, by, path)) {
1273 iter = _model->get_iter (path);
1278 tv = (*iter)[_columns.tv];
1280 rtv = dynamic_cast<RouteTimeAxisView*>(tv);
1282 rl->push_back (rtv->route());
1287 return !rl->empty();
1291 EditorRoutes::button_press (GdkEventButton* ev)
1293 if (Keyboard::is_context_menu_event (ev)) {
1298 TreeModel::Path path;
1299 TreeViewColumn *tvc;
1303 if (!_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, tvc, cell_x, cell_y)) {
1304 /* cancel selection */
1305 _display.get_selection()->unselect_all ();
1306 /* end any editing by grabbing focus */
1307 _display.grab_focus ();
1311 //Scroll editor canvas to selected track
1312 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1314 Gtk::TreeModel::Row row = *_model->get_iter (path);
1315 TimeAxisView *tv = row[_columns.tv];
1318 _editor->ensure_time_axis_view_is_visible (*tv, true);
1326 EditorRoutes::selection_changed ()
1328 if (_display.get_selection()->count_selected_rows() > 0) {
1331 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
1332 TrackViewList selected;
1334 _editor->get_selection().clear_regions ();
1336 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
1338 if ((iter = _model->get_iter (*i))) {
1340 TimeAxisView* tv = (*iter)[_columns.tv];
1341 selected.push_back (tv);
1346 _editor->get_selection().set (selected);
1347 _editor->ensure_time_axis_view_is_visible (*(selected.front()), true);
1350 _editor->get_selection().clear_tracks ();
1355 EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
1357 if (selection_countdown) {
1358 if (--selection_countdown == 0) {
1361 /* no selection yet ... */
1368 struct EditorOrderRouteSorter
1370 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
1371 if (a->is_master()) {
1372 /* master before everything else */
1374 } else if (b->is_master()) {
1375 /* everything else before master */
1378 return a->order_key () < b->order_key ();
1383 EditorRoutes::initial_display ()
1385 DisplaySuspender ds;
1392 boost::shared_ptr<RouteList> routes = _session->get_routes();
1394 if (ARDOUR_UI::instance()->session_is_new ()) {
1396 /* new session: stamp all routes with the right editor order
1400 _editor->add_routes (*(routes.get()));
1404 /* existing session: sort a copy of the route list by
1405 * editor-order and add its contents to the display.
1408 RouteList r (*routes);
1409 EditorOrderRouteSorter sorter;
1412 _editor->add_routes (r);
1418 EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& context,
1420 const SelectionData& data,
1421 guint info, guint time)
1423 if (data.get_target() == "GTK_TREE_MODEL_ROW") {
1424 _display.on_drag_data_received (context, x, y, data, info, time);
1428 context->drag_finish (true, false, time);
1432 EditorRoutes::move_selected_tracks (bool up)
1434 if (_editor->selection->tracks.empty()) {
1438 typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
1439 std::list<ViewRoute> view_routes;
1440 std::vector<int> neworder;
1441 TreeModel::Children rows = _model->children();
1442 TreeModel::Children::iterator ri;
1444 for (ri = rows.begin(); ri != rows.end(); ++ri) {
1445 TimeAxisView* tv = (*ri)[_columns.tv];
1446 boost::shared_ptr<Route> route = (*ri)[_columns.route];
1448 view_routes.push_back (ViewRoute (tv, route));
1451 list<ViewRoute>::iterator trailing;
1452 list<ViewRoute>::iterator leading;
1456 trailing = view_routes.begin();
1457 leading = view_routes.begin();
1461 while (leading != view_routes.end()) {
1462 if (_editor->selection->selected (leading->first)) {
1463 view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
1464 leading = view_routes.erase (leading);
1473 /* if we could use reverse_iterator in list::insert, this code
1474 would be a beautiful reflection of the code above. but we can't
1475 and so it looks like a bit of a mess.
1478 trailing = view_routes.end();
1479 leading = view_routes.end();
1481 --leading; if (leading == view_routes.begin()) { return; }
1487 if (_editor->selection->selected (leading->first)) {
1488 list<ViewRoute>::iterator tmp;
1490 /* need to insert *after* trailing, not *before* it,
1491 which is what insert (iter, val) normally does.
1497 view_routes.insert (tmp, ViewRoute (leading->first, leading->second));
1499 /* can't use iter = cont.erase (iter); form here, because
1500 we need iter to move backwards.
1508 if (leading == view_routes.begin()) {
1509 /* the one we've just inserted somewhere else
1510 was the first in the list. erase this copy,
1511 and then break, because we're done.
1516 view_routes.erase (leading);
1525 if (leading == view_routes.begin()) {
1534 for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
1535 uint32_t order = leading->second->order_key ();
1536 neworder.push_back (order);
1540 DEBUG_TRACE (DEBUG::OrderKeys, "New order after moving tracks:\n");
1541 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1542 DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("\t%1\n", *i));
1544 DEBUG_TRACE (DEBUG::OrderKeys, "-------\n");
1546 for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
1547 if (*i >= (int) neworder.size()) {
1548 cerr << "Trying to move something to " << *i << " of " << neworder.size() << endl;
1550 assert (*i < (int) neworder.size ());
1554 _model->reorder (neworder);
1558 EditorRoutes::update_input_active_display ()
1560 TreeModel::Children rows = _model->children();
1561 TreeModel::Children::iterator i;
1563 for (i = rows.begin(); i != rows.end(); ++i) {
1564 boost::shared_ptr<Route> route = (*i)[_columns.route];
1566 if (boost::dynamic_pointer_cast<Track> (route)) {
1567 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1570 (*i)[_columns.is_input_active] = mt->input_active();
1577 EditorRoutes::update_rec_display ()
1579 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
1580 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1585 EditorRoutes::idle_update_mute_rec_solo_etc()
1587 g_atomic_int_set (&_queue_tv_update, 0);
1588 TreeModel::Children rows = _model->children();
1589 TreeModel::Children::iterator i;
1591 for (i = rows.begin(); i != rows.end(); ++i) {
1592 boost::shared_ptr<Route> route = (*i)[_columns.route];
1593 (*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, route);
1594 (*i)[_columns.solo_state] = RouteUI::solo_active_state (route);
1595 (*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_active_state (route) ? 1 : 0;
1596 (*i)[_columns.solo_safe_state] = RouteUI::solo_safe_active_state (route) ? 1 : 0;
1597 (*i)[_columns.active] = route->active ();
1599 if (boost::dynamic_pointer_cast<Track> (route)) {
1600 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
1602 if (route->record_enabled()) {
1603 if (_session->record_status() == Session::Recording) {
1604 (*i)[_columns.rec_state] = 1;
1606 (*i)[_columns.rec_state] = 2;
1608 } else if (mt && mt->step_editing()) {
1609 (*i)[_columns.rec_state] = 3;
1611 (*i)[_columns.rec_state] = 0;
1614 (*i)[_columns.name_editable] = !route->record_enabled ();
1618 return false; // do not call again (until needed)
1623 EditorRoutes::update_mute_display ()
1625 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
1626 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1631 EditorRoutes::update_solo_display (bool /* selfsoloed */)
1633 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
1634 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1639 EditorRoutes::update_solo_isolate_display ()
1641 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
1642 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1647 EditorRoutes::update_solo_safe_display ()
1649 if (g_atomic_int_compare_and_exchange (&_queue_tv_update, 0, 1)) {
1650 Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorRoutes::idle_update_mute_rec_solo_etc));
1655 EditorRoutes::views () const
1657 list<TimeAxisView*> v;
1658 for (TreeModel::Children::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
1659 v.push_back ((*i)[_columns.tv]);
1666 EditorRoutes::clear ()
1668 _display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
1670 _display.set_model (_model);
1674 EditorRoutes::name_edit_started (CellEditable* ce, const Glib::ustring&)
1678 /* give it a special name */
1680 Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
1683 e->set_name (X_("RouteNameEditorEntry"));
1688 EditorRoutes::name_edit (std::string const & path, std::string const & new_text)
1692 TreeIter iter = _model->get_iter (path);
1698 boost::shared_ptr<Route> route = (*iter)[_columns.route];
1700 if (route && route->name() != new_text) {
1701 route->set_name (new_text);
1706 EditorRoutes::solo_changed_so_update_mute ()
1708 update_mute_display ();
1712 EditorRoutes::show_tracks_with_regions_at_playhead ()
1714 boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
1716 set<TimeAxisView*> show;
1717 for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
1718 TimeAxisView* tav = _editor->axis_view_from_route (*i);
1724 DisplaySuspender ds;
1726 TreeModel::Children rows = _model->children ();
1727 for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
1728 TimeAxisView* tv = (*i)[_columns.tv];
1729 (*i)[_columns.visible] = (show.find (tv) != show.end());