From ba8953605dd8359f0ec8a2aacb51102deda05df7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 6 Dec 2012 15:59:01 +0000 Subject: [PATCH] fix duplicate, and clarify its behaviour in smart mode; includes a fix for TimeSelection::length() which didn't account for "no selection" in its return value git-svn-id: svn://localhost/ardour2/branches/3.0@13607 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 11 +++++++++-- gtk2_ardour/time_selection.cc | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5d8ef2b373..e986306976 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3311,8 +3311,15 @@ Editor::duplicate_range (bool with_dialog) times = adjustment.get_value(); } - if (selection->time.length() != 0) { - duplicate_selection (times); + if ((current_mouse_mode() == Editing::MouseRange)) { + if (selection->time.length()) { + duplicate_selection (times); + } + } else if (get_smart_mode()) { + if (selection->time.length()) { + duplicate_selection (times); + } else + duplicate_some_regions (rs, times); } else { duplicate_some_regions (rs, times); } diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc index 419d82dbcc..a0f33e8c99 100644 --- a/gtk2_ardour/time_selection.cc +++ b/gtk2_ardour/time_selection.cc @@ -103,5 +103,9 @@ TimeSelection::end_frame () framecnt_t TimeSelection::length() { + if (empty()) { + return 0; + } + return end_frame() - start() + 1; }