revert recent change to cleaner names for MIDI ports, which breaks certain other...
[ardour.git] / gtk2_ardour / editor_routes.cc
index edbcefa0f5a2a1011cb5088d341971351bc4d57c..1368979e5896ef313775fb2f61437db3011747e5 100644 (file)
@@ -137,7 +137,7 @@ EditorRoutes::EditorRoutes (Editor* e)
        solo_isolate_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
        solo_isolate_state_column->set_alignment(ALIGN_CENTER);
        solo_isolate_state_column->set_expand(false);
-       solo_isolate_state_column->set_fixed_width(15);
+       solo_isolate_state_column->set_fixed_width(22);
 
        // Solo safe toggle
        CellRendererPixbufMulti* solo_safe_renderer = manage (new CellRendererPixbufMulti ());
@@ -231,6 +231,8 @@ EditorRoutes::focus_in (GdkEventFocus*)
                 old_focus = 0;
         }
 
+        name_editable = 0;
+
         /* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
         return true;
 }
@@ -247,8 +249,12 @@ EditorRoutes::focus_out (GdkEventFocus*)
 }
 
 bool
-EditorRoutes::enter_notify (GdkEventCrossing* ev)
+EditorRoutes::enter_notify (GdkEventCrossing*)
 {
+       if (name_editable) {
+               return true;
+       }
+       
         /* arm counter so that ::selection_filter() will deny selecting anything for the 
            next two attempts to change selection status.
         */
@@ -291,13 +297,13 @@ EditorRoutes::on_tv_rec_enable_changed (std::string const & path_string)
        // Get the model row that has been toggled.
        Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
 
-       TimeAxisView *tv = row[_columns.tv];
-       AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+       TimeAxisViewtv = row[_columns.tv];
+       RouteTimeAxisView *rtv = dynamic_cast<RouteTimeAxisView*> (tv);
 
-       if (atv != 0 && atv->is_audio_track()){
+       if (rtv && rtv->track()) {
                boost::shared_ptr<RouteList> rl (new RouteList);
-               rl->push_back (atv->route());
-               _session->set_record_enabled (rl, !atv->track()->record_enabled(), Session::rt_cleanup);
+               rl->push_back (rtv->route());
+               _session->set_record_enabled (rl, !rtv->track()->record_enabled(), Session::rt_cleanup);
        }
 }
 
@@ -324,12 +330,16 @@ EditorRoutes::on_tv_solo_enable_toggled (std::string const & path_string)
        Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
 
        TimeAxisView *tv = row[_columns.tv];
-       AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+       RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
 
-       if (atv != 0) {
+       if (rtv != 0) {
                boost::shared_ptr<RouteList> rl (new RouteList);
-               rl->push_back (atv->route());
-               _session->set_solo (rl, !atv->route()->soloed(), Session::rt_cleanup);
+               rl->push_back (rtv->route());
+               if (Config->get_solo_control_is_listen_control()) {
+                       _session->set_listen (rl, !rtv->route()->listening_via_monitor(), Session::rt_cleanup);
+               } else {
+                       _session->set_solo (rl, !rtv->route()->self_soloed(), Session::rt_cleanup);
+               }
        }
 }
 
@@ -340,10 +350,10 @@ EditorRoutes::on_tv_solo_isolate_toggled (std::string const & path_string)
        Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
 
        TimeAxisView *tv = row[_columns.tv];
-       AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+       RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
 
-       if (atv != 0) {
-               atv->route()->set_solo_isolated (!atv->route()->solo_isolated(), this);
+       if (rtv) {
+               rtv->route()->set_solo_isolated (!rtv->route()->solo_isolated(), this);
        }
 }
 
@@ -354,10 +364,10 @@ EditorRoutes::on_tv_solo_safe_toggled (std::string const & path_string)
        Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
 
        TimeAxisView *tv = row[_columns.tv];
-       AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+       RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
 
-       if (atv != 0) {
-               atv->route()->set_solo_safe (!atv->route()->solo_safe(), this);
+       if (rtv) {
+               rtv->route()->set_solo_safe (!rtv->route()->solo_safe(), this);
        }
 }
 
@@ -436,12 +446,15 @@ EditorRoutes::redisplay ()
                n++;
        }
 
+
        /* whenever we go idle, update the track view list to reflect the new order.
           we can't do this here, because we could mess up something that is traversing
           the track order and has caused a redisplay of the list.
        */
        Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
 
+        _editor->reset_controls_layout_height (position);
+        _editor->reset_controls_layout_width ();
        _editor->full_canvas_height = position + _editor->canvas_timebars_vsize;
        _editor->vertical_adjustment.set_upper (_editor->full_canvas_height);
 
@@ -513,7 +526,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
                row[_columns.route] = (*x)->route ();
                row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
                row[_columns.mute_state] = (*x)->route()->muted();
-               row[_columns.solo_state] = (*x)->route()->soloed();
+               row[_columns.solo_state] = RouteUI::solo_visual_state ((*x)->route());
                row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
                row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
                row[_columns.name_editable] = true;
@@ -544,6 +557,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
 
                (*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
                (*x)->route()->solo_changed.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::update_solo_display, this, _1), gui_context());
+               (*x)->route()->listen_changed.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::update_solo_display, this, _1), gui_context());
                (*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
                (*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context());
        }
@@ -884,8 +898,6 @@ EditorRoutes::key_press (GdkEventKey* ev)
         boost::shared_ptr<RouteList> rl (new RouteList);
         TreePath path;
 
-        cerr << "our key press\n";
-
         switch (ev->keyval) {
         case GDK_Tab:
         case GDK_ISO_Left_Tab:
@@ -895,7 +907,7 @@ EditorRoutes::key_press (GdkEventKey* ev)
                 if (name_editable) {
                         name_editable->editing_done ();
                         name_editable = 0;
-                }
+                } 
 
                 col = _display.get_column (5); // select&focus on name column
 
@@ -916,9 +928,11 @@ EditorRoutes::key_press (GdkEventKey* ev)
                 break;
 
         case 's':
-                if (get_relevant_routes (rl)) {
-                        _session->set_solo (rl, !rl->front()->soloed(), Session::rt_cleanup);
-                }
+               if (Config->get_solo_control_is_listen_control()) {
+                       _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup);
+               } else {
+                       _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup);
+               }
                 return true;
                 break;
 
@@ -1018,7 +1032,7 @@ EditorRoutes::button_press (GdkEventButton* ev)
 }
 
 bool
-EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const &path , bool selected)
+EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
 {
         if (selection_countdown) {
                 if (--selection_countdown == 0) {
@@ -1319,6 +1333,14 @@ void
 EditorRoutes::name_edit_started (CellEditable* ce, const Glib::ustring&)
 {
         name_editable = ce;
+
+        /* give it a special name */
+
+        Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
+
+        if (e) {
+                e->set_name (X_("RouteNameEditorEntry"));
+        }
 }
 
 void