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).
This commit is contained in:
nick_m 2015-09-14 05:24:28 +10:00
parent 03df442d0e
commit 17294ab9ec
9 changed files with 224 additions and 116 deletions

View file

@ -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));
if (i == result) {
return false;
}
mark_dirty ();
maybe_signal_changed ();
return true;
}
void