21 #include <gtkmm/scrolledwindow.h>
22 #include <gtkmm/adjustment.h>
23 #include <gtkmm/label.h>
24 #include <gtkmm/menu.h>
25 #include <gtkmm/menushell.h>
26 #include <gtkmm/menu_elems.h>
27 #include <gtkmm/window.h>
28 #include <gtkmm/stock.h>
29 #include <gtkmm/messagedialog.h>
57 , _arrangement (TOP_TO_RIGHT)
60 , _min_height_divisor (1)
61 , _show_only_bundles (false)
62 , _inhibit_toggle_show_only_bundles (false)
63 , _ignore_notebook_page_selected (false)
90 set_row_spacing (0, 8);
91 set_col_spacing (0, 8);
92 set_row_spacing (2, 8);
93 set_col_spacing (2, 8);
141 for (
int i = 0; i < 2; ++i) {
182 for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
191 if (c.
type == RouteProcessorChange::MeterPointChange) {
249 Adjustment* a =
_hscroll.get_adjustment ();
252 a->set_step_increment (32);
253 a->set_page_increment (128);
264 a->set_step_increment (32);
265 a->set_page_increment (128);
280 for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
281 for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
282 for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) {
283 for (uint32_t l = 0; l < (*k)->bundle->nchannels().n_total(); ++l) {
310 uint32_t
const N[2] = {
340 _vlabel.set_label (
_(
"<b>Sources</b>"));
341 _hlabel.set_label (
_(
"<b>Destinations</b>"));
348 #define REMOVE_FROM_GTK_PARENT(WGT) if ((WGT).get_parent()) { (WGT).get_parent()->remove(WGT);}
355 attach (*
_body, 2, 3, 1, 2, FILL | EXPAND, FILL | EXPAND);
356 attach (
_vscroll, 3, 4, 1, 2, SHRINK);
357 attach (
_hscroll, 2, 3, 3, 4, FILL | EXPAND, SHRINK);
358 attach (
_vbox, 1, 2, 1, 2, SHRINK);
359 attach (
_hbox, 2, 3, 2, 3, FILL | EXPAND, SHRINK);
366 _hlabel.set_label (
_(
"<b>Sources</b>"));
367 _vlabel.set_label (
_(
"<b>Destinations</b>"));
380 attach (*
_body, 1, 2, 2, 3, FILL | EXPAND, FILL | EXPAND);
381 attach (
_vscroll, 3, 4, 2, 3, SHRINK);
382 attach (
_hscroll, 1, 2, 3, 4, FILL | EXPAND, SHRINK);
383 attach (
_vbox, 2, 3, 2, 3, SHRINK);
384 attach (
_hbox, 1, 2, 1, 2, FILL | EXPAND, SHRINK);
420 using namespace Menu_Helpers;
425 _menu->set_name (
"ArdourContextMenu");
427 MenuList& items =
_menu->items ();
434 bool need_separator =
false;
436 for (
int dim = 0; dim < 2; ++dim) {
438 if (bc[dim].bundle) {
440 Menu* m = manage (
new Menu);
441 MenuList& sub = m->items ();
449 snprintf (buf,
sizeof (buf),
_(
"Add %s %s"), (*i).to_i18n_string(),
channel_noun().c_str());
457 snprintf (buf,
sizeof (buf),
_(
"Add %s %s"), (*i).to_i18n_string(),
channel_noun().c_str());
465 buf,
sizeof (buf),
_(
"Rename '%s'..."),
477 if (bc[dim].channel != -1) {
484 if (bc[dim].bundle->nchannels().n_total() > 1) {
485 for (uint32_t i = 0; i < bc[dim].
bundle->nchannels().n_total(); ++i) {
486 if (
should_show (bc[dim].bundle->channel_type(i))) {
508 if (bc[dim].channel != -1) {
518 for (uint32_t i = 0; i < bc[dim].
bundle->nchannels().n_total(); ++i) {
519 if (
should_show (bc[dim].bundle->channel_type(i))) {
527 need_separator =
true;
532 if (need_separator) {
533 items.push_back (SeparatorElem ());
539 Gtk::CheckMenuItem* i =
dynamic_cast<Gtk::CheckMenuItem*
> (&items.back());
544 items.push_back (MenuElem (
_(
"Flip"), sigc::mem_fun (*
this, &
PortMatrix::flip)));
545 items.back().set_sensitive (
can_flip ());
598 for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
599 for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
601 if (!
should_show ((*i)->bundle->channel_type(j))) {
624 for (
int i = 0; i < 2; ++i) {
671 pair<uint32_t, uint32_t>
677 m.second +=
_hscroll.get_height () +
_hbox.get_height () + 4;
685 double const h =
_hscroll.get_value ();
686 double const v =
_vscroll.get_value ();
688 switch (ev->direction) {
692 case GDK_SCROLL_DOWN:
695 case GDK_SCROLL_LEFT:
698 case GDK_SCROLL_RIGHT:
729 int const r = io->
add_port (
"",
this, t);
731 Gtk::MessageDialog msg (
_(
"It is not possible to add a port here, as the first processor in the track or buss cannot "
732 "support the new configuration."
734 msg.set_title (
_(
"Cannot add port"));
757 Label l (
_(
"This port cannot be removed.\nEither the first plugin in the track or buss cannot accept\nthe new number of inputs or the last plugin has more outputs."));
758 d.get_vbox()->pack_start (l);
759 d.add_button (Stock::OK, RESPONSE_ACCEPT);
800 int const h_current_page =
_hnotebook.get_current_page ();
801 int const v_current_page =
_vnotebook.get_current_page ();
812 HBox* dummy = manage (
new HBox);
814 Label* label = manage (
new Label ((*i)->name));
816 label->set_use_markup ();
830 HBox* dummy = manage (
new HBox);
832 Label* label = manage (
new Label ((*i)->name));
833 label->set_use_markup ();
848 if (h_current_page != -1 &&
_hnotebook.get_n_pages() > h_current_page) {
854 if (v_current_page != -1 &&
_vnotebook.get_n_pages() > v_current_page) {
876 int const N = n.get_n_pages ();
878 for (
int i = 0; i <
N; ++i) {
914 _parent->get_size (curr_width, curr_height);
916 pair<uint32_t, uint32_t> m =
max_size ();
919 m.first = max (
int (m.first), curr_width);
920 m.second = max (
int (m.second), curr_height);
932 PortGroupList::List::const_iterator j = p.
begin ();
951 while (i !=
int (n) && j != p.
end ()) {
966 using namespace Menu_Helpers;
981 using namespace Menu_Helpers;
1011 for (
int i = 0; i < 2; ++i) {
1017 for (PortGroupList::List::const_iterator j = gl->
begin(); j != gl->
end(); ++j) {
1018 bool has_connection =
false;
1020 PortGroup::BundleList::const_iterator k = bl.begin ();
1021 while (k != bl.end()) {
1023 has_connection =
true;
1034 page = notebook->get_n_pages() - p - 1;
1037 Gtk::Label* label =
dynamic_cast<Gtk::Label*
> (notebook->get_tab_label(*notebook->get_nth_page (page)));
1038 string c = label->get_label ();
1039 if (c.length() && c[0] ==
'<' && !has_connection) {
1041 label->set_text ((*j)->name);
1042 }
else if (c.length() && c[0] !=
'<' && has_connection) {
1044 label->set_markup (
string_compose (
"<b>%1</b>", Glib::Markup::escape_text ((*j)->name)));
1055 return _(
"channel");
1062 return (
_type == DataType::NIL || t ==
_type);
1068 if (
_type == DataType::NIL) {
1094 bool have_off_diagonal_association =
false;
1095 bool have_diagonal_association =
false;
1096 bool have_diagonal_not_association =
false;
1098 for (uint32_t i = 0; i < node.
row.
bundle->nchannels().n_total(); ++i) {
1100 for (uint32_t j = 0; j < node.
column.
bundle->nchannels().n_total(); ++j) {
1115 have_diagonal_association =
true;
1117 have_off_diagonal_association =
true;
1123 have_diagonal_not_association =
true;
1133 if (have_diagonal_association && !have_off_diagonal_association && !have_diagonal_not_association) {
1135 }
else if (!have_diagonal_association && !have_off_diagonal_association) {
1179 return make_pair (-1, -1);
1193 return make_pair (-1, -1);
1200 return make_pair (new_row, new_column);
1214 if (n.first == -1) {
1225 if (k->keyval == GDK_f) {
virtual void set_state(ARDOUR::BundleChannel c[2], bool s)=0
void popup_menu(ARDOUR::BundleChannel, ARDOUR::BundleChannel, uint32_t)
void remove_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, uint32_t)
void resize_window_to_proportion_of_monitor(Gtk::Window *, int, int)
void update_tab_highlighting()
virtual std::string channel_noun() const
boost::shared_ptr< ARDOUR::IO > io_from_bundle(boost::shared_ptr< ARDOUR::Bundle >) const
List::const_iterator begin() const
std::string channel_name(uint32_t) const
void set_xoffset(uint32_t)
the ports are not associated
virtual bool can_add_channels(boost::shared_ptr< ARDOUR::Bundle >) const
void remove_notebook_pages(Gtk::Notebook &)
virtual bool can_rename_channels(boost::shared_ptr< ARDOUR::Bundle >) const
virtual void remove_channel(ARDOUR::BundleChannel)
void add_remove_option(Gtk::Menu_Helpers::MenuList &, boost::weak_ptr< ARDOUR::Bundle >, int)
void notebook_page_selected(GtkNotebookPage *, guint)
std::list< BundleRecord * > BundleList
uint32_t full_scroll_width()
bool should_show(ARDOUR::DataType) const
std::string name
name for the group
static uint32_t grid_spacing()
virtual PortMatrixNode::State get_state(ARDOUR::BundleChannel c[2]) const =0
uint32_t count_of_our_type(ARDOUR::ChanCount) const
uint32_t column_labels_border_x() const
int add_port(std::string connection, void *src, DataType type=DataType::NIL)
bool _inhibit_toggle_show_only_bundles
PBD::Signal0< void > BundleAddedOrRemoved
#define ENSURE_GUI_THREAD(obj, method,...)
std::pair< uint32_t, uint32_t > max_size() const
boost::shared_ptr< ARDOUR::IO > io_from_bundle(boost::shared_ptr< ARDOUR::Bundle >) const
ARDOUR::BundleChannel row
virtual bool list_is_global(int) const =0
List::const_iterator end() const
void disassociate_all_on_bundle(boost::weak_ptr< ARDOUR::Bundle >, int)
int remove_port(boost::shared_ptr< Port >, void *src)
column labels on top, row labels to the right
PBD::Signal5< void, boost::weak_ptr< Port >, std::string, boost::weak_ptr< Port >, std::string, bool > PortConnectedOrDisconnected
void rebuild_and_draw_grid()
PortMatrixNode::State get_association(PortMatrixNode) const
void session_going_away()
void add_disassociate_option(Gtk::Menu_Helpers::MenuList &, boost::weak_ptr< ARDOUR::Bundle >, int, int)
PBD::ScopedConnectionList _route_connections
virtual bool can_remove_channels(boost::shared_ptr< ARDOUR::Bundle >) const
void setup_global_ports_proxy()
bool on_scroll_event(GdkEventScroll *)
#define REMOVE_FROM_GTK_PARENT(WGT)
PortGroup::BundleList const & bundles() const
PBD::ScopedConnectionList _bundle_changed_connections
PortGroupList const * ports(int d) const
PBD::Signal0< void > Changed
virtual std::string disassociation_verb() const =0
ChanCount nchannels() const
bool deletion_in_progress() const
PBD::Signal1< void, ARDOUR::Bundle::Change > BundleChanged
uint32_t full_scroll_height()
uint32_t count_of_our_type_min_1(ARDOUR::ChanCount) const
boost::shared_ptr< RouteList > get_routes() const
sigc::signal< void > DimensionsChanged
PortMatrix(Gtk::Window *, ARDOUR::Session *, ARDOUR::DataType)
DataType channel_type(uint32_t) const
PBD::ScopedConnectionList _session_connections
void set_type(ARDOUR::DataType)
void set_yoffset(uint32_t)
std::pair< int, int > check_flip() const
row labels to the left, column labels on the bottom
bool show_only_bundles() const
ARDOUR::BundleChannel column
boost::shared_ptr< Port > nth(uint32_t n) const
void select_arrangement()
std::pair< uint32_t, uint32_t > max_size() const
uint32_t get(DataType t) const
virtual void add_channel(boost::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
boost::shared_ptr< Bundle > bundle
boost::shared_ptr< const PortGroup > visible_ports(int d) const
used when we are examining bundles; the bundles are partially associated
PBD::Signal0< void > PortRegisteredOrUnregistered
boost::shared_ptr< const PortGroup > visible_columns() const
bool key_press(GdkEventKey *)
int channel
channel index, or -1 for "all"
void rename_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, uint32_t)
boost::shared_ptr< const PortGroup > visible_rows() const
virtual void set_session(ARDOUR::Session *)
void body_dimensions_changed()
virtual void rename_channel(ARDOUR::BundleChannel)
virtual void setup_ports(int)=0
uint32_t column_labels_height() const
std::string escape_underscores(std::string const &)
static bool bundle_with_channels(boost::shared_ptr< ARDOUR::Bundle >)
void route_processors_changed(ARDOUR::RouteProcessorChange)
bool _ignore_notebook_page_selected
void setup_global_ports()
static const ChanCount ZERO
void port_connected_or_disconnected()
virtual void remove_all_channels(boost::weak_ptr< ARDOUR::Bundle >)
PortGroupList const * columns() const
ARDOUR::Session * _session
uint32_t alloc_scroll_height()
PBD::ScopedConnectionList _changed_connections
std::string string_compose(const std::string &fmt, const T1 &o1)
void add_channel_proxy(boost::weak_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
void toggle_show_only_bundles()
PBD::Signal1< void, RouteList & > RouteAdded
void reconnect_to_routes()
PortGroupList const * rows() const
uint32_t alloc_scroll_width()
void disassociate_all_on_channel(boost::weak_ptr< ARDOUR::Bundle >, uint32_t, int)