X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_processor_selection.cc;h=729032e637fde74e8df417b98261e329c85471c9;hb=813b92c85b77e67b75778aaa6727eb58303ada45;hp=33dd1bfe7b426bca03a9a2a3a90e53257967aeb5;hpb=05bcdd1d4c583c68ed977164913ff47e94df7adb;p=ardour.git diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc index 33dd1bfe7b..729032e637 100644 --- a/gtk2_ardour/route_processor_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,158 +19,139 @@ #include #include -#include - -#include -#include -#include +#include "pbd/error.h" +#include "gui_thread.h" +#include "mixer_strip.h" #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; -using namespace sigc; -RouteRedirectSelection& -RouteRedirectSelection::operator= (const RouteRedirectSelection& other) +RouteProcessorSelection::RouteProcessorSelection() + : _no_route_change_signal (false) +{ +} + +RouteProcessorSelection& +RouteProcessorSelection::operator= (const RouteProcessorSelection& other) { if (&other != this) { processors = other.processors; - routes = other.routes; + axes = other.axes; } return *this; } bool -operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b) +operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b) { - return a.processors == b.processors && - a.routes == b.routes; + // XXX MUST TEST PROCESSORS SOMEHOW + return a.axes == b.axes; } void -RouteRedirectSelection::clear () +RouteProcessorSelection::clear () { clear_processors (); clear_routes (); } void -RouteRedirectSelection::clear_processors () +RouteProcessorSelection::clear_processors () { processors.clear (); ProcessorsChanged (); } void -RouteRedirectSelection::clear_routes () -{ - routes.clear (); - RoutesChanged (); -} - -void -RouteRedirectSelection::add (boost::shared_ptr r) -{ - if (find (processors.begin(), processors.end(), r) == processors.end()) { - processors.push_back (r); - - // XXX SHAREDPTR FIXME - // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - // r->GoingAway.connect (mem_fun(*this, pmf)); - - ProcessorsChanged(); - } -} - -void -RouteRedirectSelection::add (const vector >& rlist) +RouteProcessorSelection::clear_routes () { - bool changed = false; - - for (vector >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { - if (find (processors.begin(), processors.end(), *i) == processors.end()) { - processors.push_back (*i); - - // XXX SHAREDPTR FIXME - - //void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - // (*i)->GoingAway.connect (mem_fun(*this, pmf)); - changed = true; - } + for (AxisViewSelection::iterator i = axes.begin(); i != axes.end(); ++i) { + (*i)->set_selected (false); } - - if (changed) { - ProcessorsChanged(); + axes.clear (); + drop_connections (); + if (!_no_route_change_signal) { + RoutesChanged (); } } void -RouteRedirectSelection::remove (boost::shared_ptr r) +RouteProcessorSelection::add (XMLNode* node) { - list >::iterator i; - if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) { - processors.erase (i); - ProcessorsChanged (); - } + // XXX check for duplicate + processors.add (node); + ProcessorsChanged(); } void -RouteRedirectSelection::set (boost::shared_ptr r) +RouteProcessorSelection::set (XMLNode* node) { clear_processors (); - add (r); + processors.set (node); + ProcessorsChanged (); } void -RouteRedirectSelection::set (const vector >& rlist) +RouteProcessorSelection::add (AxisView* r) { - clear_processors (); - add (rlist); -} + if (axes.insert (r).second) { -void -RouteRedirectSelection::add (boost::shared_ptr r) -{ - if (find (routes.begin(), routes.end(), r) == routes.end()) { - routes.push_back (r); + r->set_selected (true); - // XXX SHAREDPTR FIXME - // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; - // r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); + MixerStrip* ms = dynamic_cast (r); - RoutesChanged(); + if (ms) { + ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context()); + } + + if (!_no_route_change_signal) { + RoutesChanged(); + } } } void -RouteRedirectSelection::remove (boost::shared_ptr r) +RouteProcessorSelection::remove (AxisView* r) { - list >::iterator i; - if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { - routes.erase (i); - RoutesChanged (); + ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r); + + AxisViewSelection::iterator i; + if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) { + (*i)->set_selected (false); + axes.erase (i); + if (!_no_route_change_signal) { + RoutesChanged (); + } } } void -RouteRedirectSelection::set (boost::shared_ptr r) +RouteProcessorSelection::set (AxisView* r) { clear_routes (); add (r); } bool -RouteRedirectSelection::selected (boost::shared_ptr r) +RouteProcessorSelection::selected (AxisView* r) { - return find (routes.begin(), routes.end(), r) != routes.end(); + return find (axes.begin(), axes.end(), r) != axes.end(); } bool -RouteRedirectSelection::empty () +RouteProcessorSelection::empty () +{ + return processors.empty () && axes.empty (); +} + +void +RouteProcessorSelection::block_routes_changed (bool yn) { - return processors.empty () && routes.empty (); + _no_route_change_signal = yn; } -