Ardour  8.12
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 #ifndef __gtk_ardour_port_matrix_h__
22 #define __gtk_ardour_port_matrix_h__
23 
24 #include <list>
25 #include <memory>
26 
27 #include <gtkmm/box.h>
28 #include <gtkmm/scrollbar.h>
29 #include <gtkmm/table.h>
30 #include <gtkmm/label.h>
31 #include <gtkmm/checkbutton.h>
32 #include <gtkmm/notebook.h>
33 
34 #include "ardour/bundle.h"
35 #include "ardour/types.h"
36 #include "ardour/session_handle.h"
37 
38 #include "port_group.h"
39 #include "port_matrix_types.h"
40 
50 namespace ARDOUR {
51  class Bundle;
52 }
53 
54 namespace Gtk {
55  namespace Menu_Helpers {
56  class MenuList;
57  }
58 }
59 
60 class PortMatrixBody;
61 
63 {
64 public:
67 
69 
71  return _type;
72  }
73 
77 
78  int min_height_divisor () const {
79  return _min_height_divisor;
80  }
81  void set_min_height_divisor (int f) {
83  }
84 
85  enum Arrangement {
88  };
89 
90 
93  return _arrangement;
94  }
95 
96  bool show_only_bundles () const {
97  return _show_only_bundles;
98  }
99 
100  PortGroupList const * columns () const;
101  std::shared_ptr<const PortGroup> visible_columns () const;
102 
104  int column_index () const {
105  return _column_index;
106  }
107 
108  PortGroupList const * rows () const;
109  std::shared_ptr<const PortGroup> visible_rows () const;
110 
112  int row_index () const {
113  return _row_index;
114  }
115 
116  PortGroupList const * ports (int d) const {
117  return &_ports[d];
118  }
119 
120  std::shared_ptr<const PortGroup> visible_ports (int d) const;
121 
122  void init ();
123  void setup ();
124  virtual void setup_ports (int) = 0;
126 
127  std::pair<uint32_t, uint32_t> max_size () const;
128 
132 
134 
135  void flip ();
137 
141  virtual void set_state (ARDOUR::BundleChannel c[2], bool s) = 0;
142 
147  virtual bool list_is_global (int) const = 0;
148 
149  virtual bool can_add_channels (std::shared_ptr<ARDOUR::Bundle>) const;
150  virtual void add_channel (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
151  virtual bool can_remove_channels (std::shared_ptr<ARDOUR::Bundle>) const;
153  virtual void remove_all_channels (std::weak_ptr<ARDOUR::Bundle>);
154  virtual bool can_rename_channels (std::shared_ptr<ARDOUR::Bundle>) const {
155  return false;
156  }
157  virtual bool can_add_port (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType t) const;
159  virtual std::string disassociation_verb () const = 0;
160  virtual std::string channel_noun () const;
161 
162  enum Result {
164  Accepted
165  };
166 
167  sigc::signal<void, Result> Finished;
168 
169  static bool bundle_with_channels (std::shared_ptr<ARDOUR::Bundle>);
170 
171 protected:
172 
180 
181 private:
182 
185  void routes_changed ();
188  bool can_add_port_proxy (std::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType) const;
189  void add_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
190  void remove_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, uint32_t);
191  void rename_channel_proxy (std::weak_ptr<ARDOUR::Bundle>, uint32_t);
192  void disassociate_all_on_channel (std::weak_ptr<ARDOUR::Bundle>, uint32_t, int);
193  void disassociate_all_on_bundle (std::weak_ptr<ARDOUR::Bundle>, int);
198  std::shared_ptr<ARDOUR::IO> io_from_bundle (std::shared_ptr<ARDOUR::Bundle>) const;
205  void add_remove_option (Gtk::Menu_Helpers::MenuList &, std::weak_ptr<ARDOUR::Bundle>, int);
206  void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, std::weak_ptr<ARDOUR::Bundle>, int, int);
209  std::pair<int, int> check_flip () const;
210  bool can_flip () const;
211  void parameter_changed (std::string);
212 
214 
220 
240 };
241 
242 #endif
A list of PortGroups.
Definition: port_group.h:103
PBD::ScopedConnectionList _bundle_changed_connections
Definition: port_matrix.h:219
void add_remove_option(Gtk::Menu_Helpers::MenuList &, std::weak_ptr< ARDOUR::Bundle >, int)
bool _show_only_bundles
Definition: port_matrix.h:237
virtual std::string disassociation_verb() const =0
int column_index() const
Definition: port_matrix.h:104
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:224
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:228
virtual std::string channel_noun() const
Gtk::Label _vspacer
Definition: port_matrix.h:231
Gtk::Menu * _menu
Definition: port_matrix.h:232
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:92
Gtk::Notebook _hnotebook
Definition: port_matrix.h:225
Gtk::HBox _hbox
Definition: port_matrix.h:229
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:70
void port_connected_or_disconnected()
void add_channel_proxy(std::weak_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
int row_index() const
Definition: port_matrix.h:112
void set_type(ARDOUR::DataType)
PBD::ScopedConnectionList _changed_connections
Definition: port_matrix.h:218
void notebook_page_selected(GtkNotebookPage *, guint)
Gtk::Label _hlabel
Definition: port_matrix.h:227
std::shared_ptr< const PortGroup > visible_ports(int d) const
PBD::ScopedConnectionList _route_connections
Definition: port_matrix.h:217
virtual bool can_remove_channels(std::shared_ptr< ARDOUR::Bundle >) const
PortGroupList const * ports(int d) const
Definition: port_matrix.h:116
bool _inhibit_toggle_show_only_bundles
Definition: port_matrix.h:238
Arrangement _arrangement
Definition: port_matrix.h:233
void set_min_height_divisor(int f)
Definition: port_matrix.h:81
int min_height_divisor() const
Definition: port_matrix.h:78
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:87
@ TOP_TO_RIGHT
column labels on top, row labels to the right
Definition: port_matrix.h:86
ARDOUR::DataType _type
Definition: port_matrix.h:216
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:221
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:234
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:226
void routes_changed()
Gtk::Label _hspacer
Definition: port_matrix.h:230
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:223
Gtk::HScrollbar _hscroll
Definition: port_matrix.h:222
bool show_only_bundles() const
Definition: port_matrix.h:96
bool _ignore_notebook_page_selected
Definition: port_matrix.h:239
virtual void remove_channel(ARDOUR::BundleChannel)
PortMatrixNode::State get_association(PortMatrixNode) const
Gtk::Window * _parent
Definition: port_matrix.h:213
sigc::signal< void, Result > Finished
Definition: port_matrix.h:167
std::pair< int, int > check_flip() const
virtual void rename_channel(ARDOUR::BundleChannel)
Definition: port_matrix.h:158
virtual bool can_rename_channels(std::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.h:154
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:236
void setup_all_ports()
PortGroupList _ports[2]
Definition: port_matrix.h:179
int _column_index
Definition: port_matrix.h:235
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