diff options
author | Carl Hetherington <carl@carlh.net> | 2009-11-25 23:24:02 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-11-25 23:24:02 +0000 |
commit | fe59ade87415d72072009f1e77a892f9989819a0 (patch) | |
tree | 3b6ef6d791831a55ad2a0e975dffad3233c7e53f /gtk2_ardour | |
parent | e81ee94d47f83ee46fbd2a25861dd3896aca131d (diff) |
Seconds out, the people vs. the port matrix, round 7.
Some spacing adjustments. Remove the hacky RouteBundle which caused more problems
than it solved. Put notebook tabs close to the headings in the matrix. Some other
minor tweaks.
git-svn-id: svn://localhost/ardour2/branches/3.0@6179 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/port_group.cc | 70 | ||||
-rw-r--r-- | gtk2_ardour/port_group.h | 19 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix.cc | 48 |
3 files changed, 59 insertions, 78 deletions
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index ab2c2a7b35..7a7fb4ad25 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -212,7 +212,9 @@ PortGroupList::set_type (DataType t) } void -PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boost::shared_ptr<RouteBundle> rb, bool inputs, set<boost::shared_ptr<IO> >& used_io) +PortGroupList::maybe_add_processor_to_list ( + boost::weak_ptr<Processor> wp, list<boost::shared_ptr<Bundle> >* route_bundles, bool inputs, set<boost::shared_ptr<IO> >& used_io + ) { boost::shared_ptr<Processor> p (wp.lock()); @@ -227,7 +229,7 @@ PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boo boost::shared_ptr<IO> io = inputs ? iop->input() : iop->output(); if (io && used_io.find (io) == used_io.end()) { - rb->add_processor_bundle (io->bundle ()); + route_bundles->push_back (io->bundle ()); used_io.insert (io); } } @@ -256,18 +258,21 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups) for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { - /* keep track of IOs that we have taken bundles from, so that maybe_add_processor... below - can avoid taking the same IO from both Route::output() and the main_outs Delivery */ + list<boost::shared_ptr<Bundle> > route_bundles; + + /* keep track of IOs that we have taken bundles from, + so that we can avoid taking the same IO from both + Route::output() and the main_outs Delivery */ set<boost::shared_ptr<IO> > used_io; boost::shared_ptr<IO> io = inputs ? (*i)->input() : (*i)->output(); used_io.insert (io); - boost::shared_ptr<RouteBundle> rb (new RouteBundle (io->bundle())); + route_bundles.push_back (io->bundle ()); - (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs, used_io)); + (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_list), &route_bundles, inputs, used_io)); - /* Work out which group to put this bundle in */ + /* Work out which group to put these bundles in */ boost::shared_ptr<PortGroup> g; if (_type == DataType::AUDIO) { @@ -290,10 +295,12 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups) if (g) { TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->get()); - if (tv) { - g->add_bundle (rb, io, tv->color ()); - } else { - g->add_bundle (rb, io); + for (list<boost::shared_ptr<Bundle> >::iterator i = route_bundles.begin(); i != route_bundles.end(); ++i) { + if (tv) { + g->add_bundle (*i, io, tv->color ()); + } else { + g->add_bundle (*i, io); + } } } } @@ -610,44 +617,3 @@ PortGroupList::empty () const return (i == _groups.end()); } - -RouteBundle::RouteBundle (boost::shared_ptr<Bundle> r) - : _route (r) -{ - _route->Changed.connect (sigc::hide (sigc::mem_fun (*this, &RouteBundle::reread_component_bundles))); - reread_component_bundles (); -} - -void -RouteBundle::reread_component_bundles () -{ - suspend_signals (); - - remove_channels (); - - set_name (_route->name()); - - for (uint32_t i = 0; i < _route->nchannels(); ++i) { - add_channel (_route->channel_name (i)); - PortList const & pl = _route->channel_ports (i); - for (uint32_t j = 0; j < pl.size(); ++j) { - add_port_to_channel (i, pl[j]); - } - } - - for (std::vector<boost::shared_ptr<Bundle> >::iterator i = _processor.begin(); i != _processor.end(); ++i) { - add_channels_from_bundle (*i); - } - - resume_signals (); -} - -void -RouteBundle::add_processor_bundle (boost::shared_ptr<Bundle> p) -{ - p->Changed.connect (sigc::hide (sigc::mem_fun (*this, &RouteBundle::reread_component_bundles))); - _processor.push_back (p); - - reread_component_bundles (); -} - diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h index 77b1fc91df..6940b75093 100644 --- a/gtk2_ardour/port_group.h +++ b/gtk2_ardour/port_group.h @@ -132,7 +132,9 @@ class PortGroupList : public sigc::trackable void emit_changed (); void emit_bundle_changed (ARDOUR::Bundle::Change); boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, bool) const; - void maybe_add_processor_to_bundle (boost::weak_ptr<ARDOUR::Processor>, boost::shared_ptr<RouteBundle>, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &); + void maybe_add_processor_to_list ( + boost::weak_ptr<ARDOUR::Processor>, std::list<boost::shared_ptr<ARDOUR::Bundle> > *, bool, std::set<boost::shared_ptr<ARDOUR::IO> > & + ); ARDOUR::DataType _type; mutable PortGroup::BundleList _bundles; @@ -143,19 +145,4 @@ class PortGroupList : public sigc::trackable ARDOUR::Bundle::Change _pending_bundle_change; }; - -class RouteBundle : public ARDOUR::Bundle -{ -public: - RouteBundle (boost::shared_ptr<ARDOUR::Bundle>); - - void add_processor_bundle (boost::shared_ptr<ARDOUR::Bundle>); - -private: - void reread_component_bundles (); - - boost::shared_ptr<ARDOUR::Bundle> _route; - std::vector<boost::shared_ptr<ARDOUR::Bundle> > _processor; -}; - #endif /* __gtk_ardour_port_group_h__ */ diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index 00a7f819e2..ccf240f1bb 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -66,24 +66,21 @@ PortMatrix::PortMatrix (Window* parent, Session& session, DataType type) _hbox.pack_start (_hnotebook); _hbox.pack_start (_hlabel); - attach (*_body, 1, 2, 1, 2); - attach (_vscroll, 2, 3, 1, 2, SHRINK); - attach (_hscroll, 1, 2, 2, 3, FILL | EXPAND, SHRINK); - attach (_vbox, 0, 1, 1, 2, SHRINK); - attach (_hbox, 1, 2, 0, 1, FILL | EXPAND, SHRINK); - _vnotebook.signal_switch_page().connect (mem_fun (*this, &PortMatrix::v_page_selected)); + _vnotebook.property_tab_border() = 4; _hnotebook.signal_switch_page().connect (mem_fun (*this, &PortMatrix::h_page_selected)); + _hnotebook.property_tab_border() = 4; for (int i = 0; i < 2; ++i) { _ports[i].set_type (type); } - _vlabel.set_angle (90); - _hlabel.set_use_markup (); _vlabel.set_use_markup (); - _hlabel.set_alignment (0, 0.5); _vlabel.set_alignment (0.5, 0); + _vlabel.set_padding (4, 16); + _hlabel.set_use_markup (); + _hlabel.set_alignment (0, 0.5); + _hlabel.set_padding (16, 4); show_all (); } @@ -261,7 +258,17 @@ PortMatrix::select_arrangement () _arrangement = LEFT_TO_BOTTOM; _vlabel.set_label (_("<b>Sources</b>")); _hlabel.set_label (_("<b>Destinations</b>")); + _vlabel.set_angle (90); + + attach (*_body, 1, 2, 0, 1); + attach (_vscroll, 2, 3, 0, 1, SHRINK); + attach (_hscroll, 1, 2, 2, 3, FILL | EXPAND, SHRINK); + attach (_vbox, 0, 1, 0, 1, SHRINK); + attach (_hbox, 1, 2, 1, 2, FILL | EXPAND, SHRINK); + set_col_spacing (0, 4); + set_row_spacing (0, 4); + } else { _row_index = 1; @@ -269,6 +276,16 @@ PortMatrix::select_arrangement () _arrangement = TOP_TO_RIGHT; _hlabel.set_label (_("<b>Sources</b>")); _vlabel.set_label (_("<b>Destinations</b>")); + _vlabel.set_angle (-90); + + attach (*_body, 0, 1, 1, 2); + attach (_vscroll, 2, 3, 1, 2, SHRINK); + attach (_hscroll, 0, 1, 2, 3, FILL | EXPAND, SHRINK); + attach (_vbox, 1, 2, 1, 2, SHRINK); + attach (_hbox, 0, 1, 0, 1, FILL | EXPAND, SHRINK); + + set_col_spacing (1, 4); + set_row_spacing (1, 4); } } @@ -581,6 +598,9 @@ void PortMatrix::setup_notebooks () { _in_setup_notebooks = true; + + int const h_current_page = _hnotebook.get_current_page (); + int const v_current_page = _vnotebook.get_current_page (); remove_notebook_pages (_hnotebook); remove_notebook_pages (_vnotebook); @@ -589,7 +609,7 @@ PortMatrix::setup_notebooks () HBox* dummy = manage (new HBox); dummy->show (); Label* label = manage (new Label ((*i)->name)); - label->set_angle (90); + label->set_angle (_arrangement == LEFT_TO_BOTTOM ? 90 : -90); _vnotebook.prepend_page (*dummy, *label); } @@ -602,6 +622,14 @@ PortMatrix::setup_notebooks () _vnotebook.set_tab_pos (POS_LEFT); _hnotebook.set_tab_pos (POS_TOP); + if (h_current_page != -1 && _hnotebook.get_n_pages() > h_current_page) { + _hnotebook.set_current_page (h_current_page); + } + + if (v_current_page != -1 && _vnotebook.get_n_pages() > v_current_page) { + _vnotebook.set_current_page (v_current_page); + } + _in_setup_notebooks = false; } |