Use labs() for long instead of abs()
[ardour.git] / gtk2_ardour / export_channel_selector.cc
index 14053f9eb0fe3de23290057052e33babe2bfa667..d55a223b93107642825a291ca7838484db867f8e 100644 (file)
@@ -1,22 +1,27 @@
 /*
-    Copyright (C) 2008 Paul Davis
-    Author: Sakari Bergen
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2008-2013 Sakari Bergen <sakari.bergen@beatwaves.net>
+ * Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
+ * Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2015 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2015 Nick Mainsbridge <mainsbridge@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <algorithm>
 #include <sstream>
@@ -31,6 +36,7 @@
 #include "ardour/io.h"
 #include "ardour/route.h"
 #include "ardour/session.h"
+#include "ardour/selection.h"
 
 #include "export_channel_selector.h"
 #include "route_sorter.h"
@@ -695,6 +701,8 @@ TrackExportChannelSelector::fill_list()
        track_list->clear();
        RouteList routes = _session->get_routelist();
 
+       CoreSelection const& cs (_session->selection());
+
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
                if (!boost::dynamic_pointer_cast<Track>(*it)) {
                        // not a track, must be a bus
@@ -707,7 +715,7 @@ TrackExportChannelSelector::fill_list()
                        }
 
                        // not monitor or master bus
-                       add_track (*it);
+                       add_track (*it, cs.selected (*it));
                }
        }
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
@@ -716,18 +724,18 @@ TrackExportChannelSelector::fill_list()
                                // don't include inactive tracks
                                continue;
                        }
-                       add_track (*it);
+                       add_track (*it, cs.selected (*it));
                }
        }
 }
 
 void
-TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route)
+TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route, bool selected)
 {
        Gtk::TreeModel::iterator iter = track_list->append();
        Gtk::TreeModel::Row row = *iter;
 
-       row[track_cols.selected] = false;
+       row[track_cols.selected] = selected;
        row[track_cols.label] = route->name();
        row[track_cols.route] = route;
        row[track_cols.order_key] = route->presentation_info().order();