13
0

further to 1a6a72b57, handle deleting a note while a non-selected one is entered.

This commit is contained in:
nick_m 2016-11-19 21:40:41 +11:00
parent a8e05a50e4
commit c9dd1d39d1
2 changed files with 20 additions and 17 deletions

View File

@ -122,7 +122,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
, _last_event_y (0) , _last_event_y (0)
, _grabbed_keyboard (false) , _grabbed_keyboard (false)
, _entered (false) , _entered (false)
, _note_entered (false) , _entered_note (0)
, _mouse_changed_selection (false) , _mouse_changed_selection (false)
{ {
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name())); CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
@ -165,7 +165,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
, _last_event_y (0) , _last_event_y (0)
, _grabbed_keyboard (false) , _grabbed_keyboard (false)
, _entered (false) , _entered (false)
, _note_entered (false) , _entered_note (0)
, _mouse_changed_selection (false) , _mouse_changed_selection (false)
{ {
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name())); CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
@ -213,7 +213,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
, _last_event_y (0) , _last_event_y (0)
, _grabbed_keyboard (false) , _grabbed_keyboard (false)
, _entered (false) , _entered (false)
, _note_entered (false) , _entered_note (0)
, _mouse_changed_selection (false) , _mouse_changed_selection (false)
{ {
init (false); init (false);
@ -245,7 +245,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
, _last_event_y (0) , _last_event_y (0)
, _grabbed_keyboard (false) , _grabbed_keyboard (false)
, _entered (false) , _entered (false)
, _note_entered (false) , _entered_note (0)
, _mouse_changed_selection (false) , _mouse_changed_selection (false)
{ {
init (true); init (true);
@ -424,12 +424,12 @@ MidiRegionView::mouse_mode_changed ()
remove_ghost_note (); remove_ghost_note ();
/* XXX This is problematic as the function is executed for every region /* XXX This is problematic as the function is executed for every region
and only for one region _note_entered can be true. Still it's and only for one region _entered_note can be true. Still it's
necessary as to hide the verbose cursor when we're changing from necessary as to hide the verbose cursor when we're changing from
draw mode to internal edit mode. These lines are the reason why draw mode to internal edit mode. These lines are the reason why
in some situations no verbose cursor is shown when we enter internal in some situations no verbose cursor is shown when we enter internal
edit mode over a note. */ edit mode over a note. */
if (!_note_entered) { if (!_entered_note) {
hide_verbose_cursor (); hide_verbose_cursor ();
} }
} }
@ -464,7 +464,7 @@ MidiRegionView::leave_internal()
{ {
hide_verbose_cursor (); hide_verbose_cursor ();
remove_ghost_note (); remove_ghost_note ();
_note_entered = false; _entered_note = 0;
if (_grabbed_keyboard) { if (_grabbed_keyboard) {
Keyboard::magic_widget_drop_focus(); Keyboard::magic_widget_drop_focus();
@ -597,7 +597,7 @@ MidiRegionView::motion (GdkEventMotion* ev)
{ {
PublicEditor& editor = trackview.editor (); PublicEditor& editor = trackview.editor ();
if (!_note_entered) { if (!_entered_note) {
if (_mouse_state == AddDragging) { if (_mouse_state == AddDragging) {
if (_ghost_note) { if (_ghost_note) {
@ -1388,7 +1388,7 @@ MidiRegionView::~MidiRegionView ()
if (_active_notes) { if (_active_notes) {
end_write(); end_write();
} }
_entered_note = 0;
_selection.clear(); _selection.clear();
clear_events (); clear_events ();
@ -2114,6 +2114,10 @@ MidiRegionView::step_patch (PatchChange& patch, bool bank, int delta)
void void
MidiRegionView::note_deleted (NoteBase* cne) MidiRegionView::note_deleted (NoteBase* cne)
{ {
if (_entered_note && cne == _entered_note) {
_entered_note = 0;
}
if (_selection.empty()) { if (_selection.empty()) {
return; return;
} }
@ -2144,7 +2148,6 @@ MidiRegionView::delete_selection()
apply_diff (); apply_diff ();
_note_entered = false;
hide_verbose_cursor (); hide_verbose_cursor ();
} }
@ -3341,7 +3344,7 @@ MidiRegionView::change_channel(uint8_t channel)
void void
MidiRegionView::note_entered(NoteBase* ev) MidiRegionView::note_entered(NoteBase* ev)
{ {
_note_entered = true; _entered_note = ev;
Editor* editor = dynamic_cast<Editor*>(&trackview.editor()); Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
@ -3364,7 +3367,7 @@ MidiRegionView::note_entered(NoteBase* ev)
void void
MidiRegionView::note_left (NoteBase*) MidiRegionView::note_left (NoteBase*)
{ {
_note_entered = false; _entered_note = 0;
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
(*i)->hide_velocity (); (*i)->hide_velocity ();

View File

@ -501,11 +501,11 @@ private:
framecnt_t _last_display_zoom; framecnt_t _last_display_zoom;
double _last_event_x; double _last_event_x;
double _last_event_y; double _last_event_y;
bool _grabbed_keyboard; bool _grabbed_keyboard;
bool _entered; bool _entered;
bool _note_entered; NoteBase* _entered_note;
bool _mouse_changed_selection; bool _mouse_changed_selection;