From 720303a21710798517bd23300be1532d7a5a674b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jun 2022 04:58:31 +0200 Subject: [PATCH] Fix edit-note dialog length calculation The AudioClock uses samples. Duration calculation is done using the current clock pos. The returned distance is using Beats, can be directly used for all notes regardless of their position. Now that this works correctly the dialog can also be made available for multiple-selection. --- gtk2_ardour/edit_note_dialog.cc | 13 +++---------- gtk2_ardour/editor.cc | 3 --- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc index 4edf600a1f..13ab3930d6 100644 --- a/gtk2_ardour/edit_note_dialog.cc +++ b/gtk2_ardour/edit_note_dialog.cc @@ -118,7 +118,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set n) offset = timecnt_t (_region_view->region()->position(), timepos_t()) + dur; _length_clock.set_is_duration (true, pos); - _length_clock.set_duration (offset, true); + _length_clock.set (pos, true, offset); /* Set up `set all notes...' buttons' sensitivity */ @@ -226,17 +226,10 @@ EditNoteDialog::done (int r) } } } + if (!_length_all.get_sensitive() || _length_all.get_active ()) { - - - /* get current note duration, interpreted as beats at the time indicated by the _time_clock (the new note position) */ - Beats const duration = _length_clock.current_duration (_time_clock.current_time()).beats (); - - /* compute end of note */ - Beats const new_note_end_source_relative_beats = new_note_time_source_relative_beats + duration; - + Beats const new_note_length_beats = _length_clock.current_duration ().beats (); for (set::iterator i = _events.begin(); i != _events.end(); ++i) { - Beats const new_note_length_beats = new_note_end_source_relative_beats - (*i)->note()->time(); if (new_note_length_beats != (*i)->note()->length()) { _region_view->change_note_length (*i, new_note_length_beats); had_change = true; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 4d6af6ccd0..87b3459c4b 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -6614,9 +6614,6 @@ Editor::popup_note_context_menu (ArdourCanvas::Item* item, GdkEvent* event) items.push_back(MenuElem(_("Edit..."), sigc::bind(sigc::mem_fun(*this, &Editor::edit_notes), &mrv))); - if (sel_size != 1) { - items.back().set_sensitive (false); - } items.push_back(MenuElem(_("Transpose..."), sigc::bind(sigc::mem_fun(*this, &Editor::transpose_regions), rs)));