diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8391734c66..7e8ba558d4 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1441,7 +1441,7 @@ private: std::shared_ptr current_playlist () const; void insert_source_list_selection (float times); - void cut_copy_section (bool copy); + void cut_copy_section (ARDOUR::SectionOperation const op); /* import & embed */ diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 9884e2ba97..255de51b9e 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -368,8 +368,10 @@ Editor::register_actions () reg_sens (editor_actions, "set-punch-from-edit-range", _("Set Punch from Selection"), sigc::mem_fun(*this, &Editor::set_punch_from_selection)); reg_sens (editor_actions, "set-session-from-edit-range", _("Set Session Start/End from Selection"), sigc::mem_fun(*this, &Editor::set_session_extents_from_selection)); - reg_sens (editor_actions, "copy-paste-section", _("Copy/Paste Range Section to Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), true)); - reg_sens (editor_actions, "cut-paste-section", _("Cut/Paste Range Section to Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), false)); + reg_sens (editor_actions, "copy-paste-section", _("Copy/Paste Range Section to Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), CopyPasteSection)); + reg_sens (editor_actions, "cut-paste-section", _("Cut/Paste Range Section to Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), CutPasteSection)); + reg_sens (editor_actions, "insert-section", _("Insert Time Section at Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), InsertSection)); + reg_sens (editor_actions, "delete-section", _("Delete Range Section"), sigc::bind (sigc::mem_fun(*this, &Editor::cut_copy_section), DeleteSection)); /* this is a duplicated action so that the main menu can use a different label */ reg_sens (editor_actions, "main-menu-play-selected-regions", _("Play Selected Regions"), sigc::mem_fun (*this, &Editor::play_selected_region)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a832e24d77..38dde66725 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2701,7 +2701,7 @@ Editor::insert_source_list_selection (float times) } void -Editor::cut_copy_section (bool copy) +Editor::cut_copy_section (ARDOUR::SectionOperation const op) { timepos_t start, end; if (!get_selection_extents (start, end) || !_session) { @@ -2724,7 +2724,12 @@ Editor::cut_copy_section (bool copy) } #endif timepos_t to (get_preferred_edit_position ()); - //_session->cut_copy_section (start, end, to, copy ? CopyPasteSection : CutCopySection); + _session->cut_copy_section (start, end, to, op); + + if (op == DeleteSection) { + selection->clear (); + return; + } timepos_t to_end (to + start.distance (end)); @@ -2735,10 +2740,10 @@ Editor::cut_copy_section (bool copy) selection->clear (); break; case SectionSelectRetainAndMovePlayhead: - _session->request_locate (copy ? to_end.samples (): to.samples ()); + _session->request_locate (op != CutPasteSection ? to_end.samples (): to.samples ()); /* fallthough */ case SectionSelectRetain: - if (!copy || to < end) { + if (op == CutPasteSection || to < end) { selection->set (to, to_end); } break;