Ardour  9.0-pre0-582-g084a23a80d
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 #include "ardour/types.h"
30 
31 #include "widgets/ardour_button.h"
32 
33 namespace PBD
34 {
35  class PropertyChange;
36 }
37 
38 namespace ARDOUR
39 {
40  class Bundle;
41  class IO;
42  class Route;
43  class Session;
44  class Track;
45  class Port;
46 }
47 
48 class RouteUI;
49 
51 {
52 public:
53  virtual ~IOButtonBase () {}
54 
55 protected:
56  static void set_label (IOButtonBase&, ARDOUR::Session&, std::shared_ptr<ARDOUR::Bundle>&, std::shared_ptr<ARDOUR::IO>);
57  static ARDOUR::DataType guess_main_type (std::shared_ptr<ARDOUR::IO>);
58 
59  virtual void update () = 0;
60  void maybe_update (PBD::PropertyChange const& what_changed);
61 
64 };
65 
66 class IOButton : public IOButtonBase
67 {
68 public:
69  IOButton (bool input);
71 
72  void set_route (std::shared_ptr<ARDOUR::Route>, RouteUI*);
73 
74 private:
75  void update ();
79  void port_pretty_name_changed (std::string);
80  void port_connected_or_disconnected (std::weak_ptr<ARDOUR::Port>, std::weak_ptr<ARDOUR::Port>);
81  void maybe_add_bundle_to_menu (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const&, ARDOUR::DataType = ARDOUR::DataType::NIL);
82  void disconnect ();
84  void bundle_chosen (std::shared_ptr<ARDOUR::Bundle>);
85 
86  std::shared_ptr<ARDOUR::IO> io () const;
87  std::shared_ptr<ARDOUR::Track> track () const;
88 
89  bool _input;
90  std::shared_ptr<ARDOUR::Route> _route;
93  std::list<std::shared_ptr<ARDOUR::Bundle> > _menu_bundles;
94 };
95 
96 #endif
virtual void update()=0
static ARDOUR::DataType guess_main_type(std::shared_ptr< ARDOUR::IO >)
PBD::ScopedConnectionList _connections
Definition: io_button.h:62
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:63
virtual ~IOButtonBase()
Definition: io_button.h:53
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:90
Gtk::Menu _menu
Definition: io_button.h:92
RouteUI * _route_ui
Definition: io_button.h:91
std::list< std::shared_ptr< ARDOUR::Bundle > > _menu_bundles
Definition: io_button.h:93
bool button_release(GdkEventButton *)
bool _input
Definition: io_button.h:89
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