Small optimisation. Fix mouseover highlighting in the port matrix.

git-svn-id: svn://localhost/ardour2/branches/3.0@5369 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-07-17 14:21:54 +00:00
parent be40312e01
commit 748ad24ace
5 changed files with 22 additions and 13 deletions

View File

@ -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

View File

@ -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;

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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 {