1 /*
2  * Copyright (C) 2015 Ben Loftis <ben@harrisonconsoles.com>
3  * Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef __gtkardour_monitor_output_selector_h__
22 #define __gtkardour_monitor_output_selector_h__
23 
24 #include "port_matrix.h"
25 #include "ardour_window.h"
26 
27 class MonitorSelector : public PortMatrix
28 {
29 public:
30 	MonitorSelector (Gtk::Window*, ARDOUR::Session *, boost::shared_ptr<ARDOUR::IO>);
31 
32 	void set_state (ARDOUR::BundleChannel c[2], bool);
33 	PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
34 
35 	std::string disassociation_verb () const;
36 	std::string channel_noun () const;
37 
38 	uint32_t n_io_ports () const;
io()39 	boost::shared_ptr<ARDOUR::IO> const io () { return _io; }
40 	void setup_ports (int);
41 	bool list_is_global (int) const;
42 
find_inputs_for_io_outputs()43 	bool find_inputs_for_io_outputs () const {
44 		return _find_inputs_for_io_outputs;
45 	}
46 
ours()47 	int ours () const {
48 		return _ours;
49 	}
50 
other()51 	int other () const {
52 		return _other;
53 	}
54 
can_add_channels(boost::shared_ptr<ARDOUR::Bundle>)55 	bool can_add_channels (boost::shared_ptr<ARDOUR::Bundle>) const { return false; }
can_remove_channels(boost::shared_ptr<ARDOUR::Bundle>)56 	bool can_remove_channels (boost::shared_ptr<ARDOUR::Bundle>) const { return false; }
can_rename_channels(boost::shared_ptr<ARDOUR::Bundle>)57 	bool can_rename_channels (boost::shared_ptr<ARDOUR::Bundle>) const { return false; }
58 
59 private:
60 	void io_changed ();
61 	void io_changed_proxy ();
62 
63 	int _other;
64 	int _ours;
65 	boost::shared_ptr<ARDOUR::IO> _io;
66 	boost::shared_ptr<PortGroup> _port_group;
67 	bool _find_inputs_for_io_outputs;
68 	PBD::ScopedConnection _io_connection;
69 };
70 
71 class MonitorSelectorWindow : public ArdourWindow
72 {
73 public:
74 	MonitorSelectorWindow (ARDOUR::Session *, boost::shared_ptr<ARDOUR::IO>, bool can_cancel = false);
75 
selector()76 	MonitorSelector& selector() { return _selector; }
77 
78 protected:
79 	void on_map ();
80 	void on_show ();
81 
82 private:
83 	MonitorSelector _selector;
84 
85 	void io_name_changed (void *src);
86 	bool wm_delete (GdkEventAny*);
87 };
88 
89 #endif /* __gtkardour_monitor_output_selector_h__ */
90