diff options
author | nick_m <mainsbridge@gmail.com> | 2015-09-14 05:24:28 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2015-10-20 00:53:27 +1100 |
commit | 17294ab9ec2d0b826dce88930148fda0f5e978b3 (patch) | |
tree | fbcca294ff1009370e3a12366b5fd8df17abee06 /libs/evoral | |
parent | 03df442d0e5878868a7bc945cf23371271e67c42 (diff) |
Make control point selection more consistent.
- disallow simultaneous events via ControlList::editor_add ()
- clicking on an automation line selects the points that define it.
- don't 'flash' a region selection when using mousedraw mode.
- cp click selection resembles region selection.
- region gain points respect snap modifier (a la automation points).
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/evoral/ControlList.hpp | 3 | ||||
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index 3784b25720..80096b65a4 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -125,7 +125,8 @@ public: void shift (double before, double distance); virtual void add (double when, double value, bool with_guards=true, bool with_initial=true); - virtual void editor_add (double when, double value, bool with_guard); + + virtual bool editor_add (double when, double value, bool with_guard); void fast_simple_add (double when, double value); diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index d8665d3396..d9c1b993bd 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -451,12 +451,19 @@ ControlList::in_write_pass () const return _in_write_pass; } -void +bool ControlList::editor_add (double when, double value, bool with_guard) { /* this is for making changes from a graphical line editor */ + ControlEvent cp (when, 0.0f); + iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator); + + if (i != _events.end () && (*i)->when == when) { + return false; + } + if (_events.empty()) { /* as long as the point we're adding is not at zero, @@ -477,15 +484,18 @@ ControlList::editor_add (double when, double value, bool with_guard) maybe_add_insert_guard (when); } - ControlEvent cp (when, 0.0f); - iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator); + iterator result; DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %2\n", when, value)); - _events.insert (i, new ControlEvent (when, value)); + result = _events.insert (i, new ControlEvent (when, value)); - mark_dirty (); + if (i == result) { + return false; + } + mark_dirty (); maybe_signal_changed (); + return true; } void |