single click in timefx mode should still show dialog, allow user to set parameters

This commit is contained in:
Paul Davis 2016-02-22 10:29:17 -05:00
parent 03ecf6cecd
commit ff9bb1886a

View File

@ -4716,9 +4716,14 @@ TimeFXDrag::motion (GdkEvent* event, bool)
void
TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
{
if (!movement_occurred) {
return;
}
/* this may have been a single click, no drag. We still want the dialog
to show up in that case, so that the user can manually edit the
parameters for the timestretch.
*/
float fraction = 1.0;
if (movement_occurred) {
motion (event, false);
@ -4733,14 +4738,15 @@ TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
framecnt_t newlen = adjusted_frame_pos - _primary->region()->position();
float percentage = (double) newlen / (double) _primary->region()->length();
fraction = (double) newlen / (double) _primary->region()->length();
#ifndef USE_RUBBERBAND
// Soundtouch uses percentage / 100 instead of normal (/ 1)
// Soundtouch uses fraction / 100 instead of normal (/ 1)
if (_primary->region()->data_type() == DataType::AUDIO) {
percentage = (float) ((double) newlen - (double) _primary->region()->length()) / ((double) newlen) * 100.0f;
fraction = (float) ((double) newlen - (double) _primary->region()->length()) / ((double) newlen) * 100.0f;
}
#endif
}
if (!_editor->get_selection().regions.empty()) {
/* primary will already be included in the selection, and edit
@ -4749,7 +4755,7 @@ TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
selection.
*/
if (_editor->time_stretch (_editor->get_selection().regions, percentage) == -1) {
if (_editor->time_stretch (_editor->get_selection().regions, fraction) == -1) {
error << _("An error occurred while executing time stretch operation") << endmsg;
}
}