Ardour  8.12
io_button.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2021 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2013-2021 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _gtkardour_io_button_h_
21 #define _gtkardour_io_button_h_
22 
23 #include <list>
24 #include <memory>
25 
26 #include <gtkmm/menu.h>
27 
28 #include "ardour/data_type.h"
29 
30 #include "widgets/ardour_button.h"
31 
32 namespace PBD
33 {
34  class PropertyChange;
35 }
36 
37 namespace ARDOUR
38 {
39  class Bundle;
40  class IO;
41  class Route;
42  class Session;
43  class Track;
44  class Port;
45 }
46 
47 class RouteUI;
48 
50 {
51 public:
52  virtual ~IOButtonBase () {}
53 
54 protected:
55  static void set_label (IOButtonBase&, ARDOUR::Session&, std::shared_ptr<ARDOUR::Bundle>&, std::shared_ptr<ARDOUR::IO>);
56  static ARDOUR::DataType guess_main_type (std::shared_ptr<ARDOUR::IO>);
57 
58  virtual void update () = 0;
59  void maybe_update (PBD::PropertyChange const& what_changed);
60 
63 };
64 
65 class IOButton : public IOButtonBase
66 {
67 public:
68  IOButton (bool input);
70 
71  void set_route (std::shared_ptr<ARDOUR::Route>, RouteUI*);
72 
73 private:
74  void update ();
78  void port_pretty_name_changed (std::string);
79  void port_connected_or_disconnected (std::weak_ptr<ARDOUR::Port>, std::weak_ptr<ARDOUR::Port>);
80  void maybe_add_bundle_to_menu (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const&, ARDOUR::DataType = ARDOUR::DataType::NIL);
81  void disconnect ();
83  void bundle_chosen (std::shared_ptr<ARDOUR::Bundle>);
84 
85  std::shared_ptr<ARDOUR::IO> io () const;
86  std::shared_ptr<ARDOUR::Track> track () const;
87 
88  bool _input;
89  std::shared_ptr<ARDOUR::Route> _route;
92  std::list<std::shared_ptr<ARDOUR::Bundle> > _menu_bundles;
93 };
94 
95 #endif
virtual void update()=0
static ARDOUR::DataType guess_main_type(std::shared_ptr< ARDOUR::IO >)
PBD::ScopedConnectionList _connections
Definition: io_button.h:61
void maybe_update(PBD::PropertyChange const &what_changed)
static void set_label(IOButtonBase &, ARDOUR::Session &, std::shared_ptr< ARDOUR::Bundle > &, std::shared_ptr< ARDOUR::IO >)
PBD::ScopedConnectionList _bundle_connections
Definition: io_button.h:62
virtual ~IOButtonBase()
Definition: io_button.h:52
void port_connected_or_disconnected(std::weak_ptr< ARDOUR::Port >, std::weak_ptr< ARDOUR::Port >)
std::shared_ptr< ARDOUR::Route > _route
Definition: io_button.h:89
Gtk::Menu _menu
Definition: io_button.h:91
RouteUI * _route_ui
Definition: io_button.h:90
std::list< std::shared_ptr< ARDOUR::Bundle > > _menu_bundles
Definition: io_button.h:92
bool button_release(GdkEventButton *)
bool _input
Definition: io_button.h:88
std::shared_ptr< ARDOUR::IO > io() const
void set_route(std::shared_ptr< ARDOUR::Route >, RouteUI *)
std::shared_ptr< ARDOUR::Track > track() const
void port_pretty_name_changed(std::string)
IOButton(bool input)
void update()
void button_resized(Gtk::Allocation &)
void add_port(ARDOUR::DataType)
bool button_press(GdkEventButton *)
void maybe_add_bundle_to_menu(std::shared_ptr< ARDOUR::Bundle >, ARDOUR::BundleList const &, ARDOUR::DataType=ARDOUR::DataType::NIL)
void bundle_chosen(std::shared_ptr< ARDOUR::Bundle >)
void disconnect()
std::vector< std::shared_ptr< Bundle > > BundleList
Definition: axis_view.h:42