diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-04 17:07:47 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-04 18:08:35 +0200 |
commit | 5292a8f4ae1469d6287a75814c8661f4fb8ba311 (patch) | |
tree | b0ec2d4c7da7bda4cdf28a821dd608e161b612d8 /libs/gtkmm2ext | |
parent | 28faa0de0f789340b2c5327187f17dc2a613686a (diff) |
Allow DnDVbox to sort the selection, using original order
In preparation for Processors to be copy/pasted in the same order
as they appear on the strip -- not order in which they are selected.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/dndvbox.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index 750ba5c056..c695765ea8 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -127,8 +127,19 @@ public: } /** @return Selected children */ - std::list<T*> selection () const { - return _selection; + std::list<T*> selection (bool sorted = false) const { + if (!sorted) { + return _selection; + } else { + /* simple insertion-sort */ + std::list<T*> rv; + for (typename std::list<T*>::const_iterator i = _children.begin(); i != _children.end(); ++i) { + if (selected (*i)) { + rv.push_back (*i); + } + } + return rv; + } } /** Set the `active' child; this is simply a child which is set to have the @@ -406,8 +417,6 @@ private: } else { /* drag started in another DnDVBox; raise a signal to say what happened */ - - std::list<T*> dropped = _drag_source->selection (); DropFromAnotherBox (_drag_source, drop.first, context); } |