From 44203ce955f33135065456f55f1f685131174ba6 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 11 Jan 2015 04:07:31 +1100 Subject: Fix AutomationTrackItem rubberband click thinking it was unhandled. Fix several other cases where a single mouse click could cause several (not nested) selection ops. Fix missing selection memento for midi notes and midi commands. Rename some variables. Fix random style issues. --- gtk2_ardour/midi_time_axis.cc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'gtk2_ardour/midi_time_axis.cc') diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 5d8dc83bc1..33d192aa1c 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1308,6 +1308,8 @@ MidiTimeAxisView::set_note_selection (uint8_t note) { uint16_t chn_mask = midi_track()->get_playback_channel_mask(); + _editor.begin_reversible_selection_op(_("Set Note Selection")); + if (_view->num_selected_regionviews() == 0) { _view->foreach_regionview ( sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_selection_region_view), @@ -1317,6 +1319,8 @@ MidiTimeAxisView::set_note_selection (uint8_t note) sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_selection_region_view), note, chn_mask)); } + + _editor.commit_reversible_selection_op(); } void @@ -1324,6 +1328,8 @@ MidiTimeAxisView::add_note_selection (uint8_t note) { const uint16_t chn_mask = midi_track()->get_playback_channel_mask(); + _editor.begin_reversible_selection_op(_("Add Note Selection")); + if (_view->num_selected_regionviews() == 0) { _view->foreach_regionview ( sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::add_note_selection_region_view), @@ -1333,6 +1339,8 @@ MidiTimeAxisView::add_note_selection (uint8_t note) sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::add_note_selection_region_view), note, chn_mask)); } + + _editor.commit_reversible_selection_op(); } void @@ -1340,6 +1348,8 @@ MidiTimeAxisView::extend_note_selection (uint8_t note) { const uint16_t chn_mask = midi_track()->get_playback_channel_mask(); + _editor.begin_reversible_selection_op(_("Extend Note Selection")); + if (_view->num_selected_regionviews() == 0) { _view->foreach_regionview ( sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::extend_note_selection_region_view), @@ -1349,6 +1359,8 @@ MidiTimeAxisView::extend_note_selection (uint8_t note) sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::extend_note_selection_region_view), note, chn_mask)); } + + _editor.commit_reversible_selection_op(); } void @@ -1356,6 +1368,8 @@ MidiTimeAxisView::toggle_note_selection (uint8_t note) { const uint16_t chn_mask = midi_track()->get_playback_channel_mask(); + _editor.begin_reversible_selection_op(_("Toggle Note Selection")); + if (_view->num_selected_regionviews() == 0) { _view->foreach_regionview ( sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::toggle_note_selection_region_view), @@ -1365,6 +1379,15 @@ MidiTimeAxisView::toggle_note_selection (uint8_t note) sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::toggle_note_selection_region_view), note, chn_mask)); } + + _editor.commit_reversible_selection_op(); +} + +void +MidiTimeAxisView::get_per_region_note_selection (list > > > >& selection) +{ + _view->foreach_regionview ( + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::get_per_region_note_selection_region_view), sigc::ref(selection))); } void @@ -1391,6 +1414,24 @@ MidiTimeAxisView::toggle_note_selection_region_view (RegionView* rv, uint8_t not dynamic_cast(rv)->toggle_matching_notes (note, chn_mask); } +void +MidiTimeAxisView::get_per_region_note_selection_region_view (RegionView* rv, list > > > > &selection) +{ + Evoral::Sequence::Notes selected; + dynamic_cast(rv)->selection_as_notelist (selected, false); + + std::set > > notes; + + Evoral::Sequence::Notes::iterator sel_it; + for (sel_it = selected.begin(); sel_it != selected.end(); ++sel_it) { + notes.insert (*sel_it); + } + + if (!notes.empty()) { + selection.push_back (make_pair ((rv)->region()->id(), notes)); + } +} + void MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t) { -- cgit v1.2.3