summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-07-17 14:21:54 +0000
committerCarl Hetherington <carl@carlh.net>2009-07-17 14:21:54 +0000
commit748ad24ace7a37059b6812a1f9f0145d4725ba66 (patch)
tree162026ac28a6331013f37b0ee1d8cbbb46a08300
parentbe40312e01ea36e1aaa86cae8551e42353849bc2 (diff)
Small optimisation. Fix mouseover highlighting in the port matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@5369 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/port_group.cc20
-rw-r--r--gtk2_ardour/port_group.h1
-rw-r--r--gtk2_ardour/port_matrix_column_labels.cc7
-rw-r--r--gtk2_ardour/port_matrix_labels.cc2
-rw-r--r--gtk2_ardour/port_matrix_row_labels.cc5
5 files changed, 22 insertions, 13 deletions
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index f64b1031ef..149baf3046 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -159,7 +159,7 @@ PortGroup::total_channels () const
/** PortGroupList constructor.
*/
PortGroupList::PortGroupList ()
- : _type (DataType::AUDIO), _signals_suspended (false), _pending_change (false)
+ : _type (DataType::AUDIO), _signals_suspended (false), _pending_change (false), _bundles_dirty (true)
{
}
@@ -319,6 +319,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs)
add_group (other);
emit_changed ();
+ _bundles_dirty = true;
}
boost::shared_ptr<Bundle>
@@ -402,18 +403,23 @@ PortGroupList::clear ()
_bundle_changed_connections.clear ();
emit_changed ();
+ _bundles_dirty = true;
}
PortGroup::BundleList const &
PortGroupList::bundles () const
{
- _bundles.clear ();
-
- for (PortGroupList::List::const_iterator i = begin (); i != end (); ++i) {
- if ((*i)->visible()) {
- std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (_bundles));
+ if (_bundles_dirty) {
+ _bundles.clear ();
+
+ for (PortGroupList::List::const_iterator i = begin (); i != end (); ++i) {
+ if ((*i)->visible()) {
+ std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (_bundles));
+ }
}
+
+ _bundles_dirty = false;
}
return _bundles;
@@ -446,6 +452,7 @@ PortGroupList::add_group (boost::shared_ptr<PortGroup> g)
);
emit_changed ();
+ _bundles_dirty = true;
}
void
@@ -456,6 +463,7 @@ PortGroupList::remove_bundle (boost::shared_ptr<Bundle> b)
}
emit_changed ();
+ _bundles_dirty = true;
}
void
diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h
index f3f84a23ad..21dc9445cc 100644
--- a/gtk2_ardour/port_group.h
+++ b/gtk2_ardour/port_group.h
@@ -134,6 +134,7 @@ class PortGroupList : public sigc::trackable
ARDOUR::DataType _type;
mutable PortGroup::BundleList _bundles;
+ mutable bool _bundles_dirty;
List _groups;
std::vector<sigc::connection> _bundle_changed_connections;
bool _signals_suspended;
diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc
index e630dec4c0..92affb1f31 100644
--- a/gtk2_ardour/port_matrix_column_labels.cc
+++ b/gtk2_ardour/port_matrix_column_labels.cc
@@ -413,8 +413,9 @@ PortMatrixColumnLabels::channel_x (ARDOUR::BundleChannel const &bc) const
{
uint32_t n = 0;
- PortGroup::BundleList::const_iterator i = _matrix->columns()->bundles().begin();
- while (i != _matrix->columns()->bundles().end() && i->bundle != bc.bundle) {
+ PortGroup::BundleList const & b = _matrix->columns()->bundles ();
+ PortGroup::BundleList::const_iterator i = b.begin();
+ while (i != b.end() && i->bundle != bc.bundle) {
if (_matrix->show_only_bundles()) {
n += 1;
} else {
@@ -426,7 +427,7 @@ PortMatrixColumnLabels::channel_x (ARDOUR::BundleChannel const &bc) const
if (!_matrix->show_only_bundles()) {
n += bc.channel;
}
-
+
return n * column_width();
}
diff --git a/gtk2_ardour/port_matrix_labels.cc b/gtk2_ardour/port_matrix_labels.cc
index 8b34b71ffb..d29a9244df 100644
--- a/gtk2_ardour/port_matrix_labels.cc
+++ b/gtk2_ardour/port_matrix_labels.cc
@@ -25,7 +25,6 @@ void
PortMatrixLabels::draw_extra (cairo_t* cr)
{
for (std::vector<ARDOUR::BundleChannel>::const_iterator i = _channel_highlights.begin(); i != _channel_highlights.end(); ++i) {
-
if (_matrix->show_only_bundles()) {
render_bundle_name (
cr,
@@ -50,7 +49,6 @@ void
PortMatrixLabels::clear_channel_highlights ()
{
for (std::vector<ARDOUR::BundleChannel>::const_iterator i = _channel_highlights.begin(); i != _channel_highlights.end(); ++i) {
-
queue_draw_for (*i);
}
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc
index ded591278e..4802d4ca33 100644
--- a/gtk2_ardour/port_matrix_row_labels.cc
+++ b/gtk2_ardour/port_matrix_row_labels.cc
@@ -316,8 +316,9 @@ PortMatrixRowLabels::channel_y (ARDOUR::BundleChannel const& bc) const
{
uint32_t n = 0;
- PortGroup::BundleList::const_iterator i = _matrix->rows()->bundles().begin();
- while (i != _matrix->rows()->bundles().end() && i->bundle != bc.bundle) {
+ PortGroup::BundleList const & bundles = _matrix->rows()->bundles();
+ PortGroup::BundleList::const_iterator i = bundles.begin ();
+ while (i != bundles.end() && i->bundle != bc.bundle) {
if (_matrix->show_only_bundles()) {
n += 1;
} else {