Ensure a create note drag rectangle starts with both ends snapped,
otherwise it is possible to drag a note with a size large enough to be considered valid and smaller than half the grid distance. These get snapped to zero length and thus appear infinitely long in the view. A second try at fixing #3159. git-svn-id: svn://localhost/ardour2/branches/3.0@7151 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
943edf1b5d
commit
bd2cbe9e76
@ -424,7 +424,7 @@ MidiRegionView::canvas_event(GdkEvent* ev)
|
||||
|
||||
drag_rect->property_y1() = midi_stream_view()->note_to_y(
|
||||
midi_stream_view()->y_to_note(event_y));
|
||||
drag_rect->property_x2() = event_x;
|
||||
drag_rect->property_x2() = trackview.editor().frame_to_pixel(event_frame);
|
||||
drag_rect->property_y2() = drag_rect->property_y1()
|
||||
+ floor(midi_stream_view()->note_height());
|
||||
drag_rect->property_outline_what() = 0xFF;
|
||||
@ -565,13 +565,15 @@ MidiRegionView::create_note_at(double x, double y, double length)
|
||||
assert(note <= 127.0);
|
||||
|
||||
// Start of note in frames relative to region start
|
||||
nframes64_t start_frames = snap_frame_to_frame(trackview.editor().pixel_to_frame(x));
|
||||
nframes64_t const start_frames = snap_frame_to_frame(trackview.editor().pixel_to_frame(x));
|
||||
assert(start_frames >= 0);
|
||||
|
||||
// Snap length
|
||||
length = frames_to_beats(
|
||||
snap_frame_to_frame(start_frames + beats_to_frames(length)) - start_frames);
|
||||
|
||||
assert (length != 0);
|
||||
|
||||
const boost::shared_ptr<NoteType> new_note(new NoteType(0,
|
||||
frames_to_beats(start_frames + _region->start()), length,
|
||||
(uint8_t)note, 0x40));
|
||||
|
@ -281,7 +281,7 @@ class MidiRegionView : public RegionView
|
||||
nframes64_t beats_to_frames(double beats) const;
|
||||
|
||||
/** Convert a timestamp in frames to beats (both relative to region start) */
|
||||
double frames_to_beats(nframes64_t beats) const;
|
||||
double frames_to_beats(nframes64_t) const;
|
||||
|
||||
void goto_previous_note ();
|
||||
void goto_next_note ();
|
||||
|
Loading…
Reference in New Issue
Block a user