ardour
port_matrix.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2009 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __gtk_ardour_port_matrix_h__
21 #define __gtk_ardour_port_matrix_h__
22 
23 #include <list>
24 #include <gtkmm/box.h>
25 #include <gtkmm/scrollbar.h>
26 #include <gtkmm/table.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/checkbutton.h>
29 #include <gtkmm/notebook.h>
30 #include <boost/shared_ptr.hpp>
31 
32 #include "ardour/bundle.h"
33 #include "ardour/types.h"
34 #include "ardour/session_handle.h"
35 
36 #include "port_group.h"
37 #include "port_matrix_types.h"
38 
48 namespace ARDOUR {
49  class Bundle;
50 }
51 
52 namespace Gtk {
53  namespace Menu_Helpers {
54  class MenuList;
55  }
56 }
57 
58 class PortMatrixBody;
59 
60 class PortMatrix : public Gtk::Table, public ARDOUR::SessionHandlePtr
61 {
62 public:
63  PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType);
64  ~PortMatrix ();
65 
67 
69  return _type;
70  }
71 
72  void disassociate_all ();
73  void setup_scrollbars ();
75 
76  int min_height_divisor () const {
77  return _min_height_divisor;
78  }
81  }
82 
83  enum Arrangement {
86  };
87 
88 
91  return _arrangement;
92  }
93 
94  bool show_only_bundles () const {
95  return _show_only_bundles;
96  }
97 
98  PortGroupList const * columns () const;
100 
102  int column_index () const {
103  return _column_index;
104  }
105 
106  PortGroupList const * rows () const;
108 
110  int row_index () const {
111  return _row_index;
112  }
113 
114  PortGroupList const * ports (int d) const {
115  return &_ports[d];
116  }
117 
119 
120  void init ();
121  void setup ();
122  virtual void setup_ports (int) = 0;
123  void setup_all_ports ();
124 
125  std::pair<uint32_t, uint32_t> max_size () const;
126 
127  bool should_show (ARDOUR::DataType) const;
128  uint32_t count_of_our_type (ARDOUR::ChanCount) const;
130 
132 
133  void flip ();
134  bool key_press (GdkEventKey *);
135 
139  virtual void set_state (ARDOUR::BundleChannel c[2], bool s) = 0;
140 
144  virtual PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const = 0;
145  virtual bool list_is_global (int) const = 0;
146 
150  virtual void remove_channel (ARDOUR::BundleChannel);
153  return false;
154  }
156  virtual std::string disassociation_verb () const = 0;
157  virtual std::string channel_noun () const;
158 
159  enum Result {
162  };
163 
164  sigc::signal<void, Result> Finished;
165 
167 
168 protected:
169 
177 
178 private:
179 
180  void hscroll_changed ();
181  void vscroll_changed ();
182  void routes_changed ();
183  void reconnect_to_routes ();
184  void select_arrangement ();
190  void setup_global_ports ();
191  void setup_global_ports_proxy ();
192  void toggle_show_only_bundles ();
193  bool on_scroll_event (GdkEventScroll *);
195  void setup_notebooks ();
196  void remove_notebook_pages (Gtk::Notebook &);
197  void notebook_page_selected (GtkNotebookPage *, guint);
199  void body_dimensions_changed ();
200  void session_going_away ();
201  void add_remove_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int);
202  void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int, int);
204  void update_tab_highlighting ();
205  std::pair<int, int> check_flip () const;
206  bool can_flip () const;
207 
208  Gtk::Window* _parent;
209 
215 
217  Gtk::HScrollbar _hscroll;
218  Gtk::VScrollbar _vscroll;
219  Gtk::Notebook _vnotebook;
220  Gtk::Notebook _hnotebook;
221  Gtk::Label _vlabel;
222  Gtk::Label _hlabel;
223  Gtk::VBox _vbox;
224  Gtk::HBox _hbox;
225  Gtk::Label _hspacer;
226  Gtk::Label _vspacer;
227  Gtk::Menu* _menu;
235 };
236 
237 #endif
virtual void set_state(ARDOUR::BundleChannel c[2], bool s)=0
void popup_menu(ARDOUR::BundleChannel, ARDOUR::BundleChannel, uint32_t)
Definition: port_matrix.cc:418
void remove_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, uint32_t)
Definition: port_matrix.cc:551
void setup_all_ports()
Definition: port_matrix.cc:642
void setup_scrollbars()
Definition: port_matrix.cc:247
void update_tab_highlighting()
void setup()
Definition: port_matrix.cc:210
PortMatrixBody * _body
Definition: port_matrix.h:216
Gtk::HBox _hbox
Definition: port_matrix.h:224
virtual std::string channel_noun() const
Gtk::Label _hlabel
Definition: port_matrix.h:222
void setup_notebooks()
Definition: port_matrix.cc:798
boost::shared_ptr< ARDOUR::IO > io_from_bundle(boost::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.cc:707
virtual bool can_add_channels(boost::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.cc:718
void vscroll_changed()
Definition: port_matrix.cc:241
int _min_height_divisor
Definition: port_matrix.h:231
Definition: ardour_ui.h:130
void remove_notebook_pages(Gtk::Notebook &)
Definition: port_matrix.cc:874
virtual bool can_rename_channels(boost::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.h:152
virtual void remove_channel(ARDOUR::BundleChannel)
Definition: port_matrix.cc:747
void add_remove_option(Gtk::Menu_Helpers::MenuList &, boost::weak_ptr< ARDOUR::Bundle >, int)
Definition: port_matrix.cc:964
void notebook_page_selected(GtkNotebookPage *, guint)
Definition: port_matrix.cc:884
ARDOUR::DataType _type
Definition: port_matrix.h:211
Gtk::HScrollbar _hscroll
Definition: port_matrix.h:217
bool should_show(ARDOUR::DataType) const
tuple f
Definition: signals.py:35
Gtk::Menu * _menu
Definition: port_matrix.h:227
virtual PortMatrixNode::State get_state(ARDOUR::BundleChannel c[2]) const =0
uint32_t count_of_our_type(ARDOUR::ChanCount) const
bool _inhibit_toggle_show_only_bundles
Definition: port_matrix.h:233
bool _show_only_bundles
Definition: port_matrix.h:232
Gtk::Label _hspacer
Definition: port_matrix.h:225
virtual bool list_is_global(int) const =0
void disassociate_all_on_bundle(boost::weak_ptr< ARDOUR::Bundle >, int)
Definition: port_matrix.cc:574
column labels on top, row labels to the right
Definition: port_matrix.h:84
A list of PortGroups.
Definition: port_group.h:100
Gtk::Window * _parent
Definition: port_matrix.h:208
PortMatrixNode::State get_association(PortMatrixNode) const
void session_going_away()
Definition: port_matrix.cc:896
void add_disassociate_option(Gtk::Menu_Helpers::MenuList &, boost::weak_ptr< ARDOUR::Bundle >, int, int)
Definition: port_matrix.cc:979
PBD::ScopedConnectionList _route_connections
Definition: port_matrix.h:212
virtual bool can_remove_channels(boost::shared_ptr< ARDOUR::Bundle >) const
Definition: port_matrix.cc:741
void setup_global_ports_proxy()
Definition: port_matrix.cc:632
bool on_scroll_event(GdkEventScroll *)
Definition: port_matrix.cc:683
Definition: amp.h:29
PBD::ScopedConnectionList _bundle_changed_connections
Definition: port_matrix.h:214
PortGroupList const * ports(int d) const
Definition: port_matrix.h:114
virtual std::string disassociation_verb() const =0
uint32_t count_of_our_type_min_1(ARDOUR::ChanCount) const
PortMatrix(Gtk::Window *, ARDOUR::Session *, ARDOUR::DataType)
Definition: port_matrix.cc:52
void hscroll_changed()
Definition: port_matrix.cc:235
void set_min_height_divisor(int f)
Definition: port_matrix.h:79
void set_type(ARDOUR::DataType)
Definition: port_matrix.cc:229
std::pair< int, int > check_flip() const
row labels to the left, column labels on the bottom
Definition: port_matrix.h:85
bool show_only_bundles() const
Definition: port_matrix.h:94
ARDOUR::DataType type() const
Definition: port_matrix.h:68
void select_arrangement()
Definition: port_matrix.cc:308
Gtk::Label _vspacer
Definition: port_matrix.h:226
std::pair< uint32_t, uint32_t > max_size() const
Definition: port_matrix.cc:672
Gtk::Notebook _vnotebook
Definition: port_matrix.h:219
virtual void add_channel(boost::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
Definition: port_matrix.cc:724
int row_index() const
Definition: port_matrix.h:110
Gtk::Notebook _hnotebook
Definition: port_matrix.h:220
void disassociate_all()
Definition: port_matrix.cc:275
boost::shared_ptr< const PortGroup > visible_ports(int d) const
Definition: port_matrix.cc:929
int min_height_divisor() const
Definition: port_matrix.h:76
sigc::signal< void, Result > Finished
Definition: port_matrix.h:164
boost::shared_ptr< const PortGroup > visible_columns() const
Definition: port_matrix.cc:396
bool key_press(GdkEventKey *)
void rename_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, uint32_t)
Definition: port_matrix.cc:563
boost::shared_ptr< const PortGroup > visible_rows() const
Definition: port_matrix.cc:409
void body_dimensions_changed()
Definition: port_matrix.cc:902
Gtk::VScrollbar _vscroll
Definition: port_matrix.h:218
virtual void rename_channel(ARDOUR::BundleChannel)
Definition: port_matrix.h:155
int _column_index
Definition: port_matrix.h:230
virtual void setup_ports(int)=0
Gtk::VBox _vbox
Definition: port_matrix.h:223
static bool bundle_with_channels(boost::shared_ptr< ARDOUR::Bundle >)
void route_processors_changed(ARDOUR::RouteProcessorChange)
Definition: port_matrix.cc:189
Gtk::Label _vlabel
Definition: port_matrix.h:221
bool _ignore_notebook_page_selected
Definition: port_matrix.h:234
Arrangement _arrangement
Definition: port_matrix.h:228
void setup_global_ports()
Definition: port_matrix.cc:619
void routes_changed()
Definition: port_matrix.cc:201
void port_connected_or_disconnected()
Definition: port_matrix.cc:994
Arrangement arrangement() const
Definition: port_matrix.h:90
virtual void remove_all_channels(boost::weak_ptr< ARDOUR::Bundle >)
Definition: port_matrix.cc:769
PortGroupList const * columns() const
Definition: port_matrix.cc:390
PBD::ScopedConnectionList _changed_connections
Definition: port_matrix.h:213
void init()
Definition: port_matrix.cc:122
int column_index() const
Definition: port_matrix.h:102
void add_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
Definition: port_matrix.cc:787
void toggle_show_only_bundles()
Definition: port_matrix.cc:655
PortGroupList _ports[2]
Definition: port_matrix.h:176
bool can_flip() const
void reconnect_to_routes()
Definition: port_matrix.cc:177
PortGroupList const * rows() const
Definition: port_matrix.cc:403
int _row_index
Definition: port_matrix.h:229
void disassociate_all_on_channel(boost::weak_ptr< ARDOUR::Bundle >, uint32_t, int)
Definition: port_matrix.cc:589