X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_processor_selection.cc;h=7428267b50b4d77d8d7398f10ca90d390a9ca77c;hb=b14ece32c2b7570c1c0d93b9e88de44f6377909c;hp=30943e22d04475765a1d4b1b07d7b815e9797b82;hpb=22b07e0233a29d9633ffa825a79503befaf2e16e;p=ardour.git diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc index 30943e22d0..7428267b50 100644 --- a/gtk2_ardour/route_processor_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -26,14 +26,14 @@ #include "route_processor_selection.h" #include "route_ui.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; using namespace PBD; +unsigned int RouteProcessorSelection::_no_route_change_signal = 0; RouteProcessorSelection::RouteProcessorSelection() - : _no_route_change_signal (false) { } @@ -42,7 +42,7 @@ RouteProcessorSelection::operator= (const RouteProcessorSelection& other) { if (&other != this) { processors = other.processors; - routes = other.routes; + axes = other.axes; } return *this; } @@ -51,7 +51,7 @@ bool operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b) { // XXX MUST TEST PROCESSORS SOMEHOW - return a.routes == b.routes; + return a.axes == b.axes; } void @@ -71,12 +71,12 @@ RouteProcessorSelection::clear_processors () void RouteProcessorSelection::clear_routes () { - for (RouteUISelection::iterator i = routes.begin(); i != routes.end(); ++i) { + for (AxisViewSelection::iterator i = axes.begin(); i != axes.end(); ++i) { (*i)->set_selected (false); } - routes.clear (); + axes.clear (); drop_connections (); - if (!_no_route_change_signal) { + if (0 == _no_route_change_signal) { RoutesChanged (); } } @@ -98,61 +98,65 @@ RouteProcessorSelection::set (XMLNode* node) } void -RouteProcessorSelection::add (RouteUI* r) +RouteProcessorSelection::add (AxisView* r) { - if (find (routes.begin(), routes.end(), r) == routes.end()) { - if (routes.insert (r).second) { - r->set_selected (true); + if (axes.insert (r).second) { - MixerStrip* ms = dynamic_cast (r); + r->set_selected (true); - if (ms) { - ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context()); - } + MixerStrip* ms = dynamic_cast (r); - if (!_no_route_change_signal) { - RoutesChanged(); - } + if (ms) { + ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context()); + } + + if (0 == _no_route_change_signal) { + RoutesChanged(); } } } void -RouteProcessorSelection::remove (RouteUI* r) +RouteProcessorSelection::remove (AxisView* r) { ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r); - RouteUISelection::iterator i; - if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { + AxisViewSelection::iterator i; + if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) { (*i)->set_selected (false); - routes.erase (i); - if (!_no_route_change_signal) { + axes.erase (i); + if (0 == _no_route_change_signal) { RoutesChanged (); } } } void -RouteProcessorSelection::set (RouteUI* r) +RouteProcessorSelection::set (AxisView* r) { clear_routes (); add (r); } bool -RouteProcessorSelection::selected (RouteUI* r) +RouteProcessorSelection::selected (AxisView* r) { - return find (routes.begin(), routes.end(), r) != routes.end(); + return find (axes.begin(), axes.end(), r) != axes.end(); } bool RouteProcessorSelection::empty () { - return processors.empty () && routes.empty (); + return processors.empty () && axes.empty (); } void RouteProcessorSelection::block_routes_changed (bool yn) { - _no_route_change_signal = yn; + if (yn) { + ++_no_route_change_signal; + } else { + assert (_no_route_change_signal > 0); + --_no_route_change_signal; + } }