X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fport_matrix.h;h=09c334b5efe7222f3e5bb570f08e0e6e26e0b378;hb=5a8553f02cb9bcbd75b797c6260539f7a8f8e47a;hp=93afd0310e4117dd11e18e83031cd4f7447dd0b3;hpb=73a0cd56f8bab790e0bbcf09b4f51e20175f4dc8;p=ardour.git diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h index 93afd0310e..09c334b5ef 100644 --- a/gtk2_ardour/port_matrix.h +++ b/gtk2_ardour/port_matrix.h @@ -28,10 +28,13 @@ #include #include #include + #include "ardour/bundle.h" +#include "ardour/types.h" +#include "ardour/session_handle.h" + #include "port_group.h" #include "port_matrix_types.h" -#include "i18n.h" /** The `port matrix' UI. This is a widget which lets the user alter * associations between one set of ports and another. e.g. to connect @@ -46,12 +49,18 @@ namespace ARDOUR { class Bundle; } +namespace Gtk { + namespace Menu_Helpers { + class MenuList; + } +} + class PortMatrixBody; -class PortMatrix : public Gtk::Table +class PortMatrix : public Gtk::Table, public ARDOUR::SessionHandlePtr { public: - PortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType); + PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType); ~PortMatrix (); void set_type (ARDOUR::DataType); @@ -76,7 +85,7 @@ public: LEFT_TO_BOTTOM ///< row labels to the left, column labels on the bottom }; - + /** @return Arrangement in use */ Arrangement arrangement () const { return _arrangement; @@ -87,7 +96,7 @@ public: } PortGroupList const * columns () const; - boost::shared_ptr visible_columns () const; + boost::shared_ptr visible_columns () const; /** @return index into the _ports array for the list which is displayed as columns */ int column_index () const { @@ -95,7 +104,7 @@ public: } PortGroupList const * rows () const; - boost::shared_ptr visible_rows () const; + boost::shared_ptr visible_rows () const; /** @return index into the _ports array for the list which is displayed as rows */ int row_index () const { @@ -106,10 +115,8 @@ public: return &_ports[d]; } - boost::shared_ptr visible_ports (int d) const { - return _visible_ports[d]; - } - + boost::shared_ptr visible_ports (int d) const; + void init (); void setup (); virtual void setup_ports (int) = 0; @@ -117,6 +124,15 @@ public: std::pair max_size () const; + bool should_show (ARDOUR::DataType) const; + uint32_t count_of_our_type (ARDOUR::ChanCount) const; + uint32_t count_of_our_type_min_1 (ARDOUR::ChanCount) const; + + PortMatrixNode::State get_association (PortMatrixNode) const; + + void flip (); + bool key_press (GdkEventKey *); + /** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1]. * @param s New state. */ @@ -128,16 +144,17 @@ public: virtual PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const = 0; virtual bool list_is_global (int) const = 0; - virtual bool can_add_channel (boost::shared_ptr) const; - virtual void add_channel (boost::shared_ptr); + virtual bool can_add_channels (boost::shared_ptr) const; + virtual void add_channel (boost::shared_ptr, ARDOUR::DataType); virtual bool can_remove_channels (boost::shared_ptr) const; virtual void remove_channel (ARDOUR::BundleChannel); + virtual void remove_all_channels (boost::weak_ptr); virtual bool can_rename_channels (boost::shared_ptr) const { return false; } virtual void rename_channel (ARDOUR::BundleChannel) {} virtual std::string disassociation_verb () const = 0; - virtual std::string channel_noun () const { return _("channel"); } + virtual std::string channel_noun () const; enum Result { Cancelled, @@ -146,6 +163,8 @@ public: sigc::signal Finished; + static bool bundle_with_channels (boost::shared_ptr); + protected: /** We have two port group lists. One will be presented on the rows of the matrix, @@ -155,8 +174,6 @@ protected: from left to right as you go from list 0 to list 1. Hence subclasses which deal with inputs and outputs should put outputs in list 0 and inputs in list 1. */ PortGroupList _ports[2]; - boost::shared_ptr _visible_ports[2]; - ARDOUR::Session& _session; private: @@ -165,25 +182,36 @@ private: void routes_changed (); void reconnect_to_routes (); void select_arrangement (); - void add_channel_proxy (boost::weak_ptr); + void add_channel_proxy (boost::weak_ptr, ARDOUR::DataType); void remove_channel_proxy (boost::weak_ptr, uint32_t); void rename_channel_proxy (boost::weak_ptr, uint32_t); void disassociate_all_on_channel (boost::weak_ptr, uint32_t, int); + void disassociate_all_on_bundle (boost::weak_ptr, int); void setup_global_ports (); + void setup_global_ports_proxy (); void toggle_show_only_bundles (); bool on_scroll_event (GdkEventScroll *); boost::shared_ptr io_from_bundle (boost::shared_ptr) const; - void bundle_changed (ARDOUR::Bundle::Change); void setup_notebooks (); void remove_notebook_pages (Gtk::Notebook &); - void v_page_selected (GtkNotebookPage *, guint); - void h_page_selected (GtkNotebookPage *, guint); + void notebook_page_selected (GtkNotebookPage *, guint); + void route_processors_changed (ARDOUR::RouteProcessorChange); + void body_dimensions_changed (); + void session_going_away (); + void add_remove_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr, int); + void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr, int, int); + void port_connected_or_disconnected (); + void update_tab_highlighting (); + std::pair check_flip () const; + bool can_flip () const; Gtk::Window* _parent; - /// port type that we are working with + /** port type that we are working with, or NIL if we are working with all of them */ ARDOUR::DataType _type; - std::vector _route_connections; + PBD::ScopedConnectionList _route_connections; + PBD::ScopedConnectionList _changed_connections; + PBD::ScopedConnectionList _bundle_changed_connections; PortMatrixBody* _body; Gtk::HScrollbar _hscroll; @@ -192,6 +220,10 @@ private: Gtk::Notebook _hnotebook; Gtk::Label _vlabel; Gtk::Label _hlabel; + Gtk::VBox _vbox; + Gtk::HBox _hbox; + Gtk::Label _hspacer; + Gtk::Label _vspacer; Gtk::Menu* _menu; Arrangement _arrangement; int _row_index; @@ -199,7 +231,7 @@ private: int _min_height_divisor; bool _show_only_bundles; bool _inhibit_toggle_show_only_bundles; - bool _in_setup_notebooks; + bool _ignore_notebook_page_selected; }; #endif