Ardour  9.0-pre0-582-g084a23a80d
port_matrix.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2008-2012 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
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 #pragma once
22 
23 #include <list>
24 #include <memory>
25 
26 #include <gtkmm/box.h>
27 #include <gtkmm/scrollbar.h>
28 #include <gtkmm/table.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/checkbutton.h>
31 #include <gtkmm/notebook.h>
32 
33 #include "ardour/bundle.h"
34 #include "ardour/types.h"
35 #include "ardour/session_handle.h"
36 
37 #include "port_group.h"
38 #include "port_matrix_types.h"
39 
49 namespace ARDOUR {
50  class Bundle;
51 }
52 
53 namespace Gtk {
54  namespace Menu_Helpers {
55  class MenuList;
56  }
57 }
58 
59 class PortMatrixBody;
60 
62 {
63 public:
66 
68 
70  return _type;
71  }
72 
76 
77  int min_height_divisor () const {
78  return _min_height_divisor;
79  }
80  void set_min_height_divisor (int f) {
82  }
83 
84  enum Arrangement {
87  };
88 
89 
92  return _arrangement;
93  }
94 
95  bool show_only_bundles () const {
96  return _show_only_bundles;
97  }
98 
99  PortGroupList const * columns () const;
100  std::shared_ptr<const PortGroup> visible_columns () const;
101 
103  int column_index () const {
104  return _column_index;
105  }
106 
107  PortGroupList const * rows () const;
108  std::shared_ptr<const PortGroup> visible_rows () const;
109 
111  int row_index () const {
112  return _row_index;
113  }
114 
115  PortGroupList const * ports (int d) const {
116  return &_ports[d];
117  }
118 
119  std::shared_ptr<const PortGroup> visible_ports (int d) const;
120 
121  void init ();
122  void setup ();
123  virtual void setup_ports (int) = 0;
125 
126  std::pair<uint32_t, uint32_t> max_size () const;
127 
131 
133 
134  void flip ();
136 
140  virtual void set_state (ARDOUR::BundleChannel c[2], bool s) = 0;
141 
146  virtual bool list_is_global (int) const = 0;
147 
148  virtual bool can_add_channels (std::shared_ptr<ARDOUR::Bundle>) const;
149  virtual void add_channel (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
150  virtual bool can_remove_channels (std::shared_ptr<ARDOUR::Bundle>) const;
152  virtual void remove_all_channels (std::weak_ptr<ARDOUR::Bundle>);
153  virtual bool can_rename_channels (std::shared_ptr<ARDOUR::Bundle>) const {
154  return false;
155  }
156  virtual bool can_add_port (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType t) const;
158  virtual std::string disassociation_verb () const = 0;
159  virtual std::string channel_noun () const;
160 
161  enum Result {
163  Accepted
164  };
165 
166  sigc::signal<void, Result> Finished;
167 
168  static bool bundle_with_channels (std::shared_ptr<ARDOUR::Bundle>);
169 
170 protected:
171 
179 
180 private:
181 
184  void routes_changed ();
187  bool can_add_port_proxy (std::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType) const;
188  void add_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
189  void remove_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, uint32_t);
190  void rename_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, uint32_t);
191  void disassociate_all_on_channel (std::weak_ptr<ARDOUR::Bundle>, uint32_t, int);
192  void disassociate_all_on_bundle (std::weak_ptr<ARDOUR::Bundle>, int);
197  std::shared_ptr<ARDOUR::IO> io_from_bundle (std::shared_ptr<ARDOUR::Bundle>) const;
204  void add_remove_option (Gtk::Menu_Helpers::MenuList &, std::weak_ptr<ARDOUR::Bundle>, int);
205  void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, std::weak_ptr<ARDOUR::Bundle>, int, int);
208  std::pair<int, int> check_flip () const;
209  bool can_flip () const;
210  void parameter_changed (std::string);
211 
213 
219 
239 };
240 
A list of PortGroups.
Definition: port_group.h:102
PBD::ScopedConnectionList _bundle_changed_connections
Definition: port_matrix.h:218
void add_remove_option(Gtk::Menu_Helpers::MenuList &, std::weak_ptr< ARDOUR::Bundle >, int)
bool _show_only_bundles
Definition: port_matrix.h:236
virtual std::string disassociation_verb() const =0
int column_index() const
Definition: port_matrix.h:103
virtual void set_state(ARDOUR::BundleChannel c[2], bool s)=0
void parameter_changed(std::string)
bool should_show(ARDOUR::DataType) const
void setup()
Gtk::Notebook _vnotebook
Definition: port_matrix.h:223
void setup_notebooks()
void setup_scrollbars()
virtual bool list_is_global(int) const =0
virtual PortMatrixNode::State get_state(ARDOUR::BundleChannel c[2]) const =0
Gtk::VBox _vbox
Definition: port_matrix.h:227
virtual std::string channel_noun() const
Gtk::Label _vspacer
Definition: port_matrix.h:230
Gtk::Menu * _menu
Definition: port_matrix.h:231
void setup_global_ports_proxy()
void remove_channel_proxy(std::weak_ptr< ARDOUR::Bundle >, uint32_t)
void disassociate_all()
void flip()
virtual void setup_ports(int)=0
PortGroupList const * rows() const
Arrangement arrangement() const
Definition: port_matrix.h:91
Gtk::Notebook _hnotebook
Definition: port_matrix.h:224
Gtk::HBox _hbox
Definition: port_matrix.h:228
bool can_add_port_proxy(std::weak_ptr< ARDOUR::Bundle >, ARDOUR::DataType) const
std::shared_ptr< const PortGroup > visible_columns() const
ARDOUR::DataType type() const
Definition: port_matrix.h:69
void port_connected_or_disconnected()
void add_channel_proxy(std::weak_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
int row_index() const
Definition: port_matrix.h:111
void set_type(ARDOUR::DataType)
PBD::ScopedConnectionList _changed_connections
Definition: port_matrix.h:217
void notebook_page_selected(GtkNotebookPage *, guint)
Gtk::Label _hlabel
Definition: port_matrix.h:226
std::shared_ptr< const PortGroup > visible_ports(int d) const
PBD::ScopedConnectionList _route_connections
Definition: port_matrix.h:216
virtual bool can_remove_channels(std::shared_ptr< ARDOUR::Bundle >) const
PortGroupList const * ports(int d) const
Definition: port_matrix.h:115
bool _inhibit_toggle_show_only_bundles
Definition: port_matrix.h:237
Arrangement _arrangement
Definition: port_matrix.h:232
void set_min_height_divisor(int f)
Definition: port_matrix.h:80
int min_height_divisor() const
Definition: port_matrix.h:77
void popup_menu(ARDOUR::BundleChannel, ARDOUR::BundleChannel, uint32_t)
@ LEFT_TO_BOTTOM
row labels to the left, column labels on the bottom
Definition: port_matrix.h:86
@ TOP_TO_RIGHT
column labels on top, row labels to the right
Definition: port_matrix.h:85
ARDOUR::DataType _type
Definition: port_matrix.h:215
void add_disassociate_option(Gtk::Menu_Helpers::MenuList &, std::weak_ptr< ARDOUR::Bundle >, int, int)
bool on_scroll_event(GdkEventScroll *)
This is a default handler for the signal signal_scroll_event().
void session_going_away()
void select_arrangement()
void disassociate_all_on_bundle(std::weak_ptr< ARDOUR::Bundle >, int)
PortMatrixBody * _body
Definition: port_matrix.h:220
void body_dimensions_changed()
static bool bundle_with_channels(std::shared_ptr< ARDOUR::Bundle >)
std::shared_ptr< ARDOUR::IO > io_from_bundle(std::shared_ptr< ARDOUR::Bundle >) const
virtual void add_channel(std::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
int _row_index
Definition: port_matrix.h:233
virtual void remove_all_channels(std::weak_ptr< ARDOUR::Bundle >)
void vscroll_changed()
void reconnect_to_routes()
void toggle_show_only_bundles()
PortGroupList const * columns() const
Gtk::Label _vlabel
Definition: port_matrix.h:225
void routes_changed()
Gtk::Label _hspacer
Definition: port_matrix.h:229
uint32_t count_of_our_type_min_1(ARDOUR::ChanCount) const
void update_tab_highlighting()
bool can_flip() const
Gtk::VScrollbar _vscroll
Definition: port_matrix.h:222
Gtk::HScrollbar _hscroll
Definition: port_matrix.h:221
bool show_only_bundles() const
Definition: port_matrix.h:95
bool _ignore_notebook_page_selected
Definition: port_matrix.h:238
virtual void remove_channel(ARDOUR::BundleChannel)
PortMatrixNode::State get_association(PortMatrixNode) const
Gtk::Window * _parent
Definition: port_matrix.h:212
sigc::signal< void, Result > Finished
Definition: port_matrix.h:166
std::pair< int, int > check_flip() const
virtual void rename_channel(ARDOUR::BundleChannel)
Definition: port_matrix.h:157
virtual bool can_rename_channels(std::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.h:153
void route_processors_changed(ARDOUR::RouteProcessorChange)
void init()
void rename_channel_proxy(std::weak_ptr< ARDOUR::Bundle >, uint32_t)
virtual bool can_add_port(std::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType t) const
std::pair< uint32_t, uint32_t > max_size() const
PortMatrix(Gtk::Window *, ARDOUR::Session *, ARDOUR::DataType)
void setup_global_ports()
void disassociate_all_on_channel(std::weak_ptr< ARDOUR::Bundle >, uint32_t, int)
bool key_press(GdkEventKey *)
int _min_height_divisor
Definition: port_matrix.h:235
void setup_all_ports()
PortGroupList _ports[2]
Definition: port_matrix.h:178
int _column_index
Definition: port_matrix.h:234
void hscroll_changed()
uint32_t count_of_our_type(ARDOUR::ChanCount) const
std::shared_ptr< const PortGroup > visible_rows() const
void remove_notebook_pages(Gtk::Notebook &)
virtual bool can_add_channels(std::shared_ptr< ARDOUR::Bundle >) const
struct _GtkNotebookPage GtkNotebookPage
Definition: gtknotebook.h:58
Definition: ardour_ui.h:188