diff options
author | Carl Hetherington <carl@carlh.net> | 2011-10-19 16:53:36 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-10-19 16:53:36 +0000 |
commit | 153ee4e441eeebc9aceaa3121e4a785c6011a962 (patch) | |
tree | dea646c4907092772834b1b8b01df28a5eca9c72 /libs/ardour/route.cc | |
parent | a9ebb3576e53c30b27016a442168daf8e9880707 (diff) |
Fix insertion of processors at the point at which the processor menu was opened; give a visual cue to indicate where a processor will be inserted. Kind of experimental.
git-svn-id: svn://localhost/ardour2/branches/3.0@10236 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r-- | libs/ardour/route.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 47e09cd2a7..97a6e200ba 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -853,6 +853,34 @@ Route::add_processor (boost::shared_ptr<Processor> processor, Placement placemen } +/** Add a processor to a route such that it ends up with a given index into the visible processors. + * @param index Index to add the processor at, or -1 to add at the end of the list. + */ + +int +Route::add_processor_by_index (boost::shared_ptr<Processor> processor, int index, ProcessorStreams* err, bool activation_allowed) +{ + /* XXX this is not thread safe - we don't hold the lock across determining the iter + to add before and actually doing the insertion. dammit. + */ + + if (index == -1) { + return add_processor (processor, _processors.end(), err, activation_allowed); + } + + ProcessorList::iterator i = _processors.begin (); + int j = 0; + while (i != _processors.end() && j < index) { + if ((*i)->display_to_user()) { + ++j; + } + + ++i; + } + + return add_processor (processor, i, err, activation_allowed); +} + /** Add a processor to the route. * @param iter an iterator in _processors; the new processor will be inserted immediately before this location. */ |