Drop references held by any GUI Lua script after execution
[ardour.git] / gtk2_ardour / export_channel_selector.h
index 3dbb9b8265494b553c1db24675dde6cc26a0e706..08eab87ebd5e61020c2dba54ab8deebd6c216318 100644 (file)
@@ -1,22 +1,24 @@
 /*
-    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 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2008-2013 Sakari Bergen <sakari.bergen@beatwaves.net>
+ * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
+ * Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
+ * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
+ *
+ * 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.
+ */
 
 #ifndef __export_channel_selector_h__
 #define __export_channel_selector_h__
 #undef interface
 #endif
 
-#include <gtkmm.h>
 #include <sigc++/signal.h>
 #include <boost/shared_ptr.hpp>
 
+#include <gtkmm/alignment.h>
+#include <gtkmm/box.h>
+#include <gtkmm/cellrenderercombo.h>
+#include <gtkmm/checkbutton.h>
+#include <gtkmm/label.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/spinbutton.h>
+#include <gtkmm/treemodel.h>
+#include <gtkmm/treeview.h>
+
+#include "widgets/ardour_dropdown.h"
+
 namespace ARDOUR {
        class Session;
        class ExportChannelConfiguration;
@@ -48,14 +62,14 @@ class XMLNode;
 
 class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
-  protected:
+protected:
        typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
        typedef std::list<ChannelConfigPtr> ChannelConfigList;
        typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
 
        ProfileManagerPtr manager;
 
-  public:
+public:
        ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
                : SessionHandlePtr (session)
                , manager (manager)
@@ -70,15 +84,14 @@ class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 
 class PortExportChannelSelector : public ExportChannelSelector
 {
-
-  public:
+public:
 
        PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
        ~PortExportChannelSelector ();
 
        void sync_with_manager ();
 
-  private:
+private:
 
        void fill_route_list ();
        void update_channel_count ();
@@ -101,12 +114,12 @@ class PortExportChannelSelector : public ExportChannelSelector
 
        class RouteCols : public Gtk::TreeModelColumnRecord
        {
-         public:
+       public:
 
                struct Channel;
 
                RouteCols () : n_channels (0)
-                       { add (selected); add (name); add (io); add (port_list_col); }
+               { add (selected); add (name); add (io); add (port_list_col); }
 
                void add_channels (uint32_t chans);
                uint32_t n_channels;
@@ -129,7 +142,7 @@ class PortExportChannelSelector : public ExportChannelSelector
                /* Channel struct, that represents the selected port and its name */
 
                struct Channel {
-                 public:
+               public:
                        Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
 
                        Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
@@ -146,7 +159,7 @@ class PortExportChannelSelector : public ExportChannelSelector
 
                class PortCols : public Gtk::TreeModel::ColumnRecord
                {
-                 public:
+               public:
                        PortCols () { add(selected); add(port); add(label); }
 
                        Gtk::TreeModelColumn<bool> selected;  // not used ATM
@@ -158,8 +171,9 @@ class PortExportChannelSelector : public ExportChannelSelector
 
        /* Channels view */
 
-       class ChannelTreeView : public Gtk::TreeView {
-         public:
+       class ChannelTreeView : public Gtk::TreeView
+       {
+       public:
 
                ChannelTreeView (uint32_t max_channels);
                void set_config (ChannelConfigPtr c);
@@ -172,7 +186,7 @@ class PortExportChannelSelector : public ExportChannelSelector
 
                sigc::signal<void> CriticalSelectionChanged;
 
-         private:
+       private:
 
                ChannelConfigPtr config;
                void update_config ();
@@ -199,7 +213,7 @@ class PortExportChannelSelector : public ExportChannelSelector
 
 class RegionExportChannelSelector : public ExportChannelSelector
 {
-  public:
+public:
        RegionExportChannelSelector (ARDOUR::Session * session,
                                     ProfileManagerPtr manager,
                                     ARDOUR::AudioRegion const & region,
@@ -207,7 +221,7 @@ class RegionExportChannelSelector : public ExportChannelSelector
 
        virtual void sync_with_manager ();
 
-  private:
+private:
 
        void handle_selection ();
 
@@ -233,15 +247,17 @@ class TrackExportChannelSelector : public ExportChannelSelector
 {
   public:
        TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
+       ~TrackExportChannelSelector ();
 
        virtual void sync_with_manager ();
 
+       bool track_output () const { return track_output_button.get_active(); }
+
   private:
 
        void fill_list();
-       void add_track (boost::shared_ptr<ARDOUR::Route> route);
+       void add_track (boost::shared_ptr<ARDOUR::Route> route, bool selected);
        void update_config();
-
        ChannelConfigList configs;
 
        Gtk::VBox main_layout;
@@ -252,8 +268,9 @@ class TrackExportChannelSelector : public ExportChannelSelector
                Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
                Gtk::TreeModelColumn<std::string>     label;
                Gtk::TreeModelColumn<bool>            selected;
+               Gtk::TreeModelColumn<uint32_t>        order_key;
 
-               TrackCols () { add (route); add(label); add(selected); }
+               TrackCols () { add (route); add(label); add(selected); add(order_key); }
        };
        TrackCols                    track_cols;
 
@@ -262,10 +279,16 @@ class TrackExportChannelSelector : public ExportChannelSelector
 
        Gtk::ScrolledWindow          track_scroller;
 
-       Gtk::HBox                    options_box;
-       Gtk::RadioButton::Group      source_group;
-       Gtk::RadioButton             region_contents_button;
-       Gtk::RadioButton             track_output_button;
+       Gtk::HBox                     options_box;
+       Gtk::CheckButton              track_output_button;
+       ArdourWidgets::ArdourDropdown select_menu;
+       Gtk::CheckMenuItem*           exclude_hidden;
+       Gtk::CheckMenuItem*           exclude_muted;
+       void select_tracks ();
+       void select_busses ();
+       void select_none ();
+
+       void track_outputs_selected ();
 };
 
 #endif /* __export_channel_selector_h__ */