summaryrefslogtreecommitdiff
path: root/gtk2_ardour/processor_box.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-02-14 19:45:30 +0000
committerCarl Hetherington <carl@carlh.net>2009-02-14 19:45:30 +0000
commit9a3734a6bd0450faf92a8b1add2d5e052a4534ca (patch)
treec7feafe8169e8782e4133dd38b8cd1e140c639bc /gtk2_ardour/processor_box.cc
parentb35f3088942ff623e9d09fe6acb1f214dddf73ce (diff)
Make DnD copy processors using their XML representations. Remove unused
copy constructors from the Processor hierarchy, and declare them private to explicitly disallow copy construction. git-svn-id: svn://localhost/ardour2/branches/3.0@4556 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/processor_box.cc')
-rw-r--r--gtk2_ardour/processor_box.cc67
1 files changed, 18 insertions, 49 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 34e4f27ae0..ce7d0f5567 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -171,7 +171,14 @@ ProcessorBox::route_going_away ()
void
ProcessorBox::object_drop (const list<boost::shared_ptr<Processor> >& procs)
{
- paste_processor_list (procs);
+ for (std::list<boost::shared_ptr<Processor> >::const_iterator i = procs.begin(); i != procs.end(); ++i) {
+
+ XMLNode& state = (*i)->get_state ();
+ XMLNodeList nlist;
+ nlist.push_back (&state);
+ paste_processor_state (nlist);
+ delete &state;
+ }
}
void
@@ -920,42 +927,15 @@ ProcessorBox::paste_processors ()
cerr << "paste from node called " << _rr_selection.processors.get_node().name() << endl;
- paste_processor_state (_rr_selection.processors.get_node());
+ paste_processor_state (_rr_selection.processors.get_node().children());
}
void
-ProcessorBox::paste_processor_list (const list<boost::shared_ptr<Processor> >& processors)
+ProcessorBox::paste_processor_state (const XMLNodeList& nlist)
{
- list<boost::shared_ptr<Processor> > copies;
-
- for (list<boost::shared_ptr<Processor> >::const_iterator i = processors.begin(); i != processors.end(); ++i) {
-
- boost::shared_ptr<Processor> copy = Processor::clone (*i);
-
- copy->set_placement (_placement);
- copies.push_back (copy);
- }
-
- if (_route->add_processors (copies)) {
-
- string msg = _(
- "Copying the set of processors on the clipboard failed,\n\
-probably because the I/O configuration of the plugins\n\
-could not match the configuration of this track.");
- MessageDialog am (msg);
- am.run ();
- }
-}
-
-void
-ProcessorBox::paste_processor_state (const XMLNode& node)
-{
- XMLNodeList nlist;
XMLNodeConstIterator niter;
list<boost::shared_ptr<Processor> > copies;
- nlist = node.children();
-
cerr << "Pasting processor selection containing " << nlist.size() << endl;
if (nlist.empty()) {
@@ -966,14 +946,20 @@ ProcessorBox::paste_processor_state (const XMLNode& node)
cerr << "try using " << (*niter)->name() << endl;
XMLProperty const * type = (*niter)->property ("type");
assert (type);
+
+ boost::shared_ptr<Processor> p;
try {
if (type->value() == "send") {
XMLNode n (**niter);
Send::make_unique (n, _session);
- copies.push_back (boost::shared_ptr<Processor> (new Send (_session, n)));
+ p.reset (new Send (_session, n));
+
} else {
- copies.push_back (boost::shared_ptr<Processor> (new PluginInsert (_session, **niter)));
+ p.reset (new PluginInsert (_session, **niter));
}
+
+ p->set_placement (_placement);
+ copies.push_back (p);
}
catch (...) {
cerr << "plugin insert constructor failed\n";
@@ -1025,23 +1011,6 @@ ProcessorBox::for_selected_processors (void (ProcessorBox::*method)(boost::share
}
void
-ProcessorBox::clone_processors ()
-{
- RouteSelection& routes (_rr_selection.routes);
-
- if (!routes.empty()) {
- if (_route->copy_processors (*routes.front(), _placement)) {
- string msg = _(
-"Copying the set of processors on the clipboard failed,\n\
-probably because the I/O configuration of the plugins\n\
-could not match the configuration of this track.");
- MessageDialog am (msg);
- am.run ();
- }
- }
-}
-
-void
ProcessorBox::all_processors_active (bool state)
{
_route->all_processors_active (_placement, state);