summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-11-25 23:24:02 +0000
committerCarl Hetherington <carl@carlh.net>2009-11-25 23:24:02 +0000
commitfe59ade87415d72072009f1e77a892f9989819a0 (patch)
tree3b6ef6d791831a55ad2a0e975dffad3233c7e53f
parente81ee94d47f83ee46fbd2a25861dd3896aca131d (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
-rw-r--r--gtk2_ardour/port_group.cc70
-rw-r--r--gtk2_ardour/port_group.h19
-rw-r--r--gtk2_ardour/port_matrix.cc48
-rw-r--r--libs/ardour/ardour/io.h3
-rw-r--r--libs/ardour/io.cc16
5 files changed, 68 insertions, 88 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;
}
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 5d64fae580..da0b88e5fe 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -205,7 +205,6 @@ class IO : public SessionObject, public Latent
void bundle_changed (Bundle::Change);
-
int get_port_counts (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c);
int get_port_counts_2X (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c);
int create_ports (const XMLNode&, int version);
@@ -219,7 +218,7 @@ class IO : public SessionObject, public Latent
std::string build_legal_port_name (DataType type);
int32_t find_port_hole (const char* base);
- void setup_bundles ();
+ void setup_bundle ();
std::string bundle_channel_name (uint32_t, uint32_t) const;
};
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 7c92ab87cd..c645894591 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -81,7 +81,7 @@ IO::IO (Session& s, const string& name, Direction dir, DataType default_type)
{
_active = true;
pending_state_node = 0;
- setup_bundles ();
+ setup_bundle ();
}
IO::IO (Session& s, const XMLNode& node, DataType dt)
@@ -93,7 +93,7 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
pending_state_node = 0;
set_state (node, Stateful::loading_state_version);
- setup_bundles ();
+ setup_bundle ();
}
IO::~IO ()
@@ -260,7 +260,7 @@ IO::remove_port (Port* port, void* src)
}
if (change & ConfigurationChanged) {
- setup_bundles ();
+ setup_bundle ();
}
if (change != NoChange) {
@@ -324,7 +324,7 @@ IO::add_port (string destination, void* src, DataType type)
// pan_changed (src); /* EMIT SIGNAL */
changed (ConfigurationChanged, src); /* EMIT SIGNAL */
- setup_bundles ();
+ setup_bundle ();
_session.set_dirty ();
return 0;
@@ -439,7 +439,7 @@ IO::ensure_ports (ChanCount count, bool clear, bool lockit, void* src)
if (changed) {
this->changed (ConfigurationChanged, src); /* EMIT SIGNAL */
- setup_bundles ();
+ setup_bundle ();
_session.set_dirty ();
}
@@ -1105,7 +1105,7 @@ IO::set_name (const string& requested_name)
bool const r = SessionObject::set_name (name);
- setup_bundles ();
+ setup_bundle ();
return r;
}
@@ -1322,11 +1322,11 @@ IO::midi(uint32_t n) const
}
/**
- * Setup bundles that describe our inputs and outputs. Also creates bundles if necessary.
+ * Setup a bundle that describe our inputs or outputs. Also creates the bundle if necessary.
*/
void
-IO::setup_bundles ()
+IO::setup_bundle ()
{
char buf[32];