if (_mouse_state != SelectTouchDragging) {
_pressed_button = ev->button;
- _mouse_state = Pressed;
+
+ if (m == MouseDraw || (m == MouseContent && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
+
+ if (midi_view()->note_mode() == Percussive) {
+ editor->drags()->set (new HitCreateDrag (dynamic_cast<Editor *> (editor), group, this), (GdkEvent *) ev);
+ } else {
+ editor->drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (editor), group, this), (GdkEvent *) ev);
+ }
+
+ _mouse_state = AddDragging;
+ remove_ghost_note ();
+ hide_verbose_cursor ();
+ } else {
+ _mouse_state = Pressed;
+ }
return true;
}
case MouseTimeFX:
{
_mouse_changed_selection = true;
-
- if (Keyboard::is_insert_note_event(ev)) {
-
- double event_x, event_y;
-
- event_x = ev->x;
- event_y = ev->y;
- group->canvas_to_item (event_x, event_y);
-
- Evoral::Beats beats = get_grid_beats(editor.pixel_to_sample(event_x) + _region->position());
- create_note_at (editor.pixel_to_sample (event_x), event_y, beats, ev->state, true);
- } else {
- clear_editor_note_selection ();
- }
+ clear_editor_note_selection ();
break;
}
case MouseDraw:
- {
- Evoral::Beats beats = get_grid_beats(editor.pixel_to_sample(event_x) + _region->position());
- create_note_at (editor.pixel_to_sample (event_x), event_y, beats, ev->state, true);
- break;
- }
+ break;
+
default:
break;
}
break;
case AddDragging:
- /* Only create a ghost note when we added a note, not when we were drag-selecting. */
- create_ghost_note (ev->x, ev->y, ev->state);
+ /* Don't a ghost note when we added a note - wait until motion to avoid visual confusion.
+ we don't want one when we were drag-selecting either. */
case SelectRectDragging:
editor.drags()->end_grab ((GdkEvent *) ev);
_mouse_state = None;
MouseMode m = editor.current_mouse_mode();
- if (m == MouseDraw || (m == MouseContent && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
- editor.drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (&editor), group, this), (GdkEvent *) ev);
- _mouse_state = AddDragging;
- remove_ghost_note ();
- hide_verbose_cursor ();
- return true;
- } else if (m == MouseContent) {
+ if (m == MouseContent && !Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())) {
editor.drags()->set (new MidiRubberbandSelectDrag (dynamic_cast<Editor *> (&editor), this), (GdkEvent *) ev);
if (!Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
clear_editor_note_selection ();
detectable auto-repeat is the name of the game and only sends
repeated presses, carry out key actions at key press, not release.
*/
-
bool unmodified = Keyboard::no_modifier_keys_pressed (ev);
if (unmodified && (ev->keyval == GDK_Alt_L || ev->keyval == GDK_Alt_R)) {
- _mouse_state = SelectTouchDragging;
+
+ if (_mouse_state != AddDragging) {
+ _mouse_state = SelectTouchDragging;
+ }
+
return true;
} else if (ev->keyval == GDK_Escape && unmodified) {
double y1;
/* trim note display to not overlap the end of its region */
- if (note->length() > 0) {
+ if (note->length().to_double() > 0.0) {
double note_end_time = note->end_time().to_double();
if (note_end_time > mr->start_beats() + mr->length_beats()) {
framepos_t const unsnapped_frame = editor.pixel_to_sample (x);
const int32_t divisions = editor.get_grid_music_divisions (state);
- const Evoral::Beats snapped_beats = snap_frame_to_grid_underneath (unsnapped_frame, divisions, true);
+ const bool shift_snap = midi_view()->note_mode() != Percussive;
+ const Evoral::Beats snapped_beats = snap_frame_to_grid_underneath (unsnapped_frame, divisions, shift_snap);
/* ghost note may have been snapped before region */
if (_ghost_note && snapped_beats.to_double() < 0.0) {