Add active toggle to editor route list (#4236).
authorCarl Hetherington <carl@carlh.net>
Mon, 19 Sep 2011 22:34:30 +0000 (22:34 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 19 Sep 2011 22:34:30 +0000 (22:34 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10098 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_routes.cc
gtk2_ardour/editor_routes.h

index 714c5faad92a2da2363ef3507259fb47fc81006a..8867328d25d75b11db9b2f714e784bcc34652c23 100644 (file)
@@ -182,6 +182,7 @@ EditorRoutes::EditorRoutes (Editor* e)
 
         _name_column = _display.append_column (_("Name"), _columns.text) - 1;
        _visible_column = _display.append_column (_("V"), _columns.visible) - 1;
+       _active_column = _display.append_column (_("A"), _columns.active) - 1;
 
        _display.set_headers_visible (true);
        _display.set_name ("TrackListDisplay");
@@ -222,6 +223,18 @@ EditorRoutes::EditorRoutes (Editor* e)
        visible_col->set_fixed_width(30);
        visible_col->set_alignment(ALIGN_CENTER);
 
+       CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (_active_column));
+
+       active_cell->property_activatable() = true;
+       active_cell->property_radio() = false;
+       active_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::active_changed));
+
+       TreeViewColumn* active_col = dynamic_cast<TreeViewColumn*> (_display.get_column (_active_column));
+       active_col->set_expand (false);
+       active_col->set_sizing (TREE_VIEW_COLUMN_FIXED);
+       active_col->set_fixed_width (30);
+       active_col->set_alignment (ALIGN_CENTER);
+       
        _model->signal_row_deleted().connect (sigc::mem_fun (*this, &EditorRoutes::route_deleted));
        _model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
 
@@ -544,6 +557,19 @@ EditorRoutes::visible_changed (std::string const & path)
        }
 }
 
+void
+EditorRoutes::active_changed (std::string const & path)
+{
+       if (_session && _session->deletion_in_progress ()) {
+               return;
+       }
+
+       Gtk::TreeModel::Row row = *_model->get_iter (path);
+       boost::shared_ptr<Route> route = row[_columns.route];
+       bool const active = row[_columns.active];
+       route->set_active (!active, this);
+}
+
 void
 EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
 {
@@ -560,6 +586,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
 
                row[_columns.text] = (*x)->route()->name();
                row[_columns.visible] = (*x)->marked_for_display();
+               row[_columns.active] = (*x)->route()->active ();
                row[_columns.tv] = *x;
                row[_columns.route] = (*x)->route ();
                row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
@@ -608,6 +635,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
                (*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());
+               (*x)->route()->active_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_active_display, this), gui_context ());
        }
 
        update_rec_display ();
@@ -616,6 +644,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
        update_solo_isolate_display ();
        update_solo_safe_display ();
        update_input_active_display ();
+       update_active_display ();
        resume_redisplay ();
        _redisplay_does_not_sync_order_keys = false;
 }
@@ -689,6 +718,18 @@ EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost:
        }
 }
 
+void
+EditorRoutes::update_active_display ()
+{
+       TreeModel::Children rows = _model->children();
+       TreeModel::Children::iterator i;
+
+       for (i = rows.begin(); i != rows.end(); ++i) {
+               boost::shared_ptr<Route> route = (*i)[_columns.route];
+               (*i)[_columns.active] = route->active ();
+       }
+}
+
 void
 EditorRoutes::update_visibility ()
 {
index 2ade937eff362b822ed549729b82f602a819495b..3efde73288e70f0a2416972d53e3f06adb217a23 100644 (file)
@@ -69,6 +69,7 @@ private:
        void show_menu ();
        void route_deleted (Gtk::TreeModel::Path const &);
        void visible_changed (std::string const &);
+       void active_changed (std::string const &);
        void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
        bool button_press (GdkEventButton *);
        void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route>);
@@ -79,6 +80,7 @@ private:
        void update_solo_isolate_display ();
        void update_solo_safe_display ();
        void update_input_active_display ();
+       void update_active_display ();
        void set_all_tracks_visibility (bool);
        void set_all_audio_midi_visibility (int, bool);
        void show_all_routes ();
@@ -115,6 +117,7 @@ private:
                        add (name_editable);
                        add (is_input_active);
                        add (is_midi);
+                       add (active);
                }
 
                Gtk::TreeModelColumn<std::string>    text;
@@ -130,6 +133,7 @@ private:
                Gtk::TreeModelColumn<bool>           name_editable;
                Gtk::TreeModelColumn<bool>           is_input_active;
                Gtk::TreeModelColumn<bool>           is_midi;
+               Gtk::TreeModelColumn<bool>           active;
        };
 
        Gtk::ScrolledWindow _scroller;
@@ -138,6 +142,7 @@ private:
        ModelColumns _columns;
        int _name_column;
        int _visible_column;
+       int _active_column;
 
        bool _ignore_reorder;
        bool _no_redisplay;