13
0

Update GUI: add new section operations

This commit is contained in:
Robin Gareus 2023-06-06 02:40:33 +02:00
parent 4529a17617
commit 3468ffddbb
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 14 additions and 7 deletions

View File

@ -1441,7 +1441,7 @@ private:
std::shared_ptr<ARDOUR::Playlist> 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 */

View File

@ -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));

View File

@ -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;