mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
Move note creation code into a Drag; fix snapping of note
starts when drag-created (part of #4505). git-svn-id: svn://localhost/ardour2/branches/3.0@10972 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e3b4fa678d
commit
ab4e7cf472
4 changed files with 131 additions and 130 deletions
|
|
@ -4267,3 +4267,93 @@ EditorRubberbandSelectDrag::deselect_things ()
|
||||||
_editor->selection->clear_points ();
|
_editor->selection->clear_points ();
|
||||||
_editor->selection->clear_lines ();
|
_editor->selection->clear_lines ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NoteCreateDrag::NoteCreateDrag (Editor* e, ArdourCanvas::Item* i, MidiRegionView* rv)
|
||||||
|
: Drag (e, i)
|
||||||
|
, _region_view (rv)
|
||||||
|
, _drag_rect (0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NoteCreateDrag::~NoteCreateDrag ()
|
||||||
|
{
|
||||||
|
delete _drag_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
||||||
|
{
|
||||||
|
_drag_rect = new ArdourCanvas::SimpleRect (*_region_view->get_canvas_group ());
|
||||||
|
|
||||||
|
framepos_t pf = _drags->current_pointer_frame ();
|
||||||
|
|
||||||
|
bool success;
|
||||||
|
Evoral::MusicalTime grid_beats = _editor->get_grid_type_as_beats (success, pf);
|
||||||
|
if (!success) {
|
||||||
|
grid_beats = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
framecnt_t grid_frames = _region_view->region_beats_to_region_frames (grid_beats);
|
||||||
|
|
||||||
|
/* Hack so that we always snap to the note that we are over, instead of snapping
|
||||||
|
to the next one if we're more than halfway through the one we're over.
|
||||||
|
*/
|
||||||
|
if (_editor->snap_mode() == SnapNormal && pf > grid_frames / 2) {
|
||||||
|
pf -= grid_frames / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_note[0] = adjusted_frame (pf, event) - _region_view->region()->position ();
|
||||||
|
|
||||||
|
MidiStreamView* sv = _region_view->midi_stream_view ();
|
||||||
|
double const x = _editor->frame_to_pixel (_note[0]);
|
||||||
|
double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y)));
|
||||||
|
|
||||||
|
_drag_rect->property_x1() = x;
|
||||||
|
_drag_rect->property_y1() = y;
|
||||||
|
_drag_rect->property_x2() = x;
|
||||||
|
_drag_rect->property_y2() = y + floor (_region_view->midi_stream_view()->note_height ());
|
||||||
|
|
||||||
|
_drag_rect->property_outline_what() = 0xff;
|
||||||
|
_drag_rect->property_outline_color_rgba() = 0xffffff99;
|
||||||
|
_drag_rect->property_fill_color_rgba() = 0xffffff66;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NoteCreateDrag::motion (GdkEvent* event, bool)
|
||||||
|
{
|
||||||
|
_note[1] = adjusted_current_frame (event) - _region_view->region()->position ();
|
||||||
|
double const x = _editor->frame_to_pixel (_note[1]);
|
||||||
|
if (_note[1] > _note[0]) {
|
||||||
|
_drag_rect->property_x2() = x;
|
||||||
|
} else {
|
||||||
|
_drag_rect->property_x1() = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NoteCreateDrag::finished (GdkEvent* event, bool)
|
||||||
|
{
|
||||||
|
if (_drag_rect->property_x2() < _drag_rect->property_x1() + 2) {
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
framepos_t const start = min (_note[0], _note[1]);
|
||||||
|
framecnt_t const length = abs (_note[0] - _note[1]);
|
||||||
|
|
||||||
|
_region_view->create_note_at (start, _drag_rect->property_y1(), _region_view->region_frames_to_region_beats (length), true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
NoteCreateDrag::y_to_region (double y) const
|
||||||
|
{
|
||||||
|
double x = 0;
|
||||||
|
_region_view->get_canvas_group()->w2i (x, y);
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NoteCreateDrag::aborted (bool)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -458,6 +458,25 @@ class NoteDrag : public Drag
|
||||||
double _note_height;
|
double _note_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NoteCreateDrag : public Drag
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
|
||||||
|
~NoteCreateDrag ();
|
||||||
|
|
||||||
|
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||||
|
void motion (GdkEvent *, bool);
|
||||||
|
void finished (GdkEvent *, bool);
|
||||||
|
void aborted (bool);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double y_to_region (double) const;
|
||||||
|
|
||||||
|
MidiRegionView* _region_view;
|
||||||
|
ArdourCanvas::SimpleRect* _drag_rect;
|
||||||
|
framepos_t _note[2];
|
||||||
|
};
|
||||||
|
|
||||||
/** Drag to move MIDI patch changes */
|
/** Drag to move MIDI patch changes */
|
||||||
class PatchChangeDrag : public Drag
|
class PatchChangeDrag : public Drag
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
, _note_group(new ArdourCanvas::Group(*group))
|
, _note_group(new ArdourCanvas::Group(*group))
|
||||||
, _note_diff_command (0)
|
, _note_diff_command (0)
|
||||||
, _ghost_note(0)
|
, _ghost_note(0)
|
||||||
, _drag_rect (0)
|
|
||||||
, _step_edit_cursor (0)
|
, _step_edit_cursor (0)
|
||||||
, _step_edit_cursor_width (1.0)
|
, _step_edit_cursor_width (1.0)
|
||||||
, _step_edit_cursor_position (0.0)
|
, _step_edit_cursor_position (0.0)
|
||||||
|
|
@ -134,7 +133,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
, _note_group(new ArdourCanvas::Group(*parent))
|
, _note_group(new ArdourCanvas::Group(*parent))
|
||||||
, _note_diff_command (0)
|
, _note_diff_command (0)
|
||||||
, _ghost_note(0)
|
, _ghost_note(0)
|
||||||
, _drag_rect (0)
|
|
||||||
, _step_edit_cursor (0)
|
, _step_edit_cursor (0)
|
||||||
, _step_edit_cursor_width (1.0)
|
, _step_edit_cursor_width (1.0)
|
||||||
, _step_edit_cursor_position (0.0)
|
, _step_edit_cursor_position (0.0)
|
||||||
|
|
@ -179,7 +177,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||||
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
|
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
|
||||||
, _note_diff_command (0)
|
, _note_diff_command (0)
|
||||||
, _ghost_note(0)
|
, _ghost_note(0)
|
||||||
, _drag_rect (0)
|
|
||||||
, _step_edit_cursor (0)
|
, _step_edit_cursor (0)
|
||||||
, _step_edit_cursor_width (1.0)
|
, _step_edit_cursor_width (1.0)
|
||||||
, _step_edit_cursor_position (0.0)
|
, _step_edit_cursor_position (0.0)
|
||||||
|
|
@ -214,7 +211,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
|
||||||
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
|
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
|
||||||
, _note_diff_command (0)
|
, _note_diff_command (0)
|
||||||
, _ghost_note(0)
|
, _ghost_note(0)
|
||||||
, _drag_rect (0)
|
|
||||||
, _step_edit_cursor (0)
|
, _step_edit_cursor (0)
|
||||||
, _step_edit_cursor_width (1.0)
|
, _step_edit_cursor_width (1.0)
|
||||||
, _step_edit_cursor_position (0.0)
|
, _step_edit_cursor_position (0.0)
|
||||||
|
|
@ -382,7 +378,7 @@ MidiRegionView::enter_notify (GdkEventCrossing* ev)
|
||||||
_mouse_mode_connection, invalidator (*this), ui_bind (&MidiRegionView::mouse_mode_changed, this), gui_context ()
|
_mouse_mode_connection, invalidator (*this), ui_bind (&MidiRegionView::mouse_mode_changed, this), gui_context ()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (trackview.editor().current_mouse_mode() == MouseRange) {
|
if (trackview.editor().current_mouse_mode() == MouseRange && _mouse_state != AddDragging) {
|
||||||
create_ghost_note (ev->x, ev->y);
|
create_ghost_note (ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -432,11 +428,6 @@ MidiRegionView::button_press (GdkEventButton* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_last_x = ev->x;
|
|
||||||
_last_y = ev->y;
|
|
||||||
|
|
||||||
group->w2i (_last_x, _last_y);
|
|
||||||
|
|
||||||
if (_mouse_state != SelectTouchDragging) {
|
if (_mouse_state != SelectTouchDragging) {
|
||||||
|
|
||||||
_pressed_button = ev->button;
|
_pressed_button = ev->button;
|
||||||
|
|
@ -491,7 +482,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
|
||||||
beats = 1;
|
beats = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_note_at (event_x, event_y, beats, true, true);
|
create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -505,7 +496,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
|
||||||
beats = 1;
|
beats = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_note_at (event_x, event_y, beats, true, true);
|
create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -516,30 +507,13 @@ MidiRegionView::button_release (GdkEventButton* ev)
|
||||||
_mouse_state = None;
|
_mouse_state = None;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelectRectDragging: // Select drag done
|
case SelectRectDragging:
|
||||||
|
case AddDragging:
|
||||||
editor.drags()->end_grab ((GdkEvent *) ev);
|
editor.drags()->end_grab ((GdkEvent *) ev);
|
||||||
_mouse_state = None;
|
_mouse_state = None;
|
||||||
|
create_ghost_note (ev->x, ev->y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AddDragging: // Add drag done
|
|
||||||
|
|
||||||
_mouse_state = None;
|
|
||||||
|
|
||||||
if (Keyboard::is_insert_note_event(ev) || trackview.editor().current_mouse_mode() == MouseRange) {
|
|
||||||
|
|
||||||
if (_drag_rect->property_x2() > _drag_rect->property_x1() + 2) {
|
|
||||||
|
|
||||||
const double x = _drag_rect->property_x1();
|
|
||||||
const double length = trackview.editor().pixel_to_frame (_drag_rect->property_x2() - _drag_rect->property_x1());
|
|
||||||
|
|
||||||
create_note_at (x, _drag_rect->property_y1(), region_frames_to_region_beats(length), true, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete _drag_rect;
|
|
||||||
_drag_rect = 0;
|
|
||||||
|
|
||||||
create_ghost_note (ev->x, ev->y);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -551,19 +525,8 @@ MidiRegionView::button_release (GdkEventButton* ev)
|
||||||
bool
|
bool
|
||||||
MidiRegionView::motion (GdkEventMotion* ev)
|
MidiRegionView::motion (GdkEventMotion* ev)
|
||||||
{
|
{
|
||||||
double event_x, event_y;
|
|
||||||
framepos_t event_frame = 0;
|
|
||||||
|
|
||||||
event_x = ev->x;
|
|
||||||
event_y = ev->y;
|
|
||||||
group->w2i(event_x, event_y);
|
|
||||||
|
|
||||||
PublicEditor& editor = trackview.editor ();
|
PublicEditor& editor = trackview.editor ();
|
||||||
|
|
||||||
// convert event_x to global frame
|
|
||||||
framecnt_t grid_frames;
|
|
||||||
event_frame = snap_frame_to_grid_underneath (editor.pixel_to_frame (event_x), grid_frames);
|
|
||||||
|
|
||||||
if (!_ghost_note && editor.current_mouse_mode() != MouseRange
|
if (!_ghost_note && editor.current_mouse_mode() != MouseRange
|
||||||
&& Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())
|
&& Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())
|
||||||
&& _mouse_state != AddDragging) {
|
&& _mouse_state != AddDragging) {
|
||||||
|
|
@ -575,8 +538,7 @@ MidiRegionView::motion (GdkEventMotion* ev)
|
||||||
update_ghost_note (ev->x, ev->y);
|
update_ghost_note (ev->x, ev->y);
|
||||||
} else if (_ghost_note && editor.current_mouse_mode() != MouseRange) {
|
} else if (_ghost_note && editor.current_mouse_mode() != MouseRange) {
|
||||||
|
|
||||||
delete _ghost_note;
|
remove_ghost_note ();
|
||||||
_ghost_note = 0;
|
|
||||||
|
|
||||||
editor.verbose_cursor()->hide ();
|
editor.verbose_cursor()->hide ();
|
||||||
} else if (_ghost_note && editor.current_mouse_mode() == MouseRange) {
|
} else if (_ghost_note && editor.current_mouse_mode() == MouseRange) {
|
||||||
|
|
@ -590,12 +552,7 @@ MidiRegionView::motion (GdkEventMotion* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_mouse_state) {
|
switch (_mouse_state) {
|
||||||
case Pressed: // Maybe start a drag, if we've moved a bit
|
case Pressed:
|
||||||
|
|
||||||
if (fabs (event_x - _last_x) < 1 && fabs (event_y - _last_y) < 1) {
|
|
||||||
/* no appreciable movement since the button was pressed */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_pressed_button == 1 && editor.current_mouse_mode() == MouseObject
|
if (_pressed_button == 1 && editor.current_mouse_mode() == MouseObject
|
||||||
&& !Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())) {
|
&& !Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())) {
|
||||||
|
|
@ -605,33 +562,11 @@ MidiRegionView::motion (GdkEventMotion* ev)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (editor.internal_editing()) {
|
} else if (editor.internal_editing()) {
|
||||||
// Add note drag start
|
|
||||||
|
|
||||||
group->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
|
|
||||||
Gdk::Cursor(Gdk::FLEUR), ev->time);
|
|
||||||
|
|
||||||
_last_x = event_x;
|
|
||||||
_last_y = event_y;
|
|
||||||
_drag_start_x = event_x;
|
|
||||||
_drag_start_y = event_y;
|
|
||||||
|
|
||||||
_drag_rect = new ArdourCanvas::SimpleRect(*group);
|
|
||||||
_drag_rect->property_x1() = editor.frame_to_pixel(event_frame);
|
|
||||||
|
|
||||||
_drag_rect->property_y1() = midi_stream_view()->note_to_y(
|
|
||||||
midi_stream_view()->y_to_note(event_y));
|
|
||||||
_drag_rect->property_x2() = 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;
|
|
||||||
_drag_rect->property_outline_color_rgba() = 0xFFFFFF99;
|
|
||||||
_drag_rect->property_fill_color_rgba() = 0xFFFFFF66;
|
|
||||||
|
|
||||||
|
editor.drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (&editor), group, this), (GdkEvent *) ev);
|
||||||
_mouse_state = AddDragging;
|
_mouse_state = AddDragging;
|
||||||
|
|
||||||
delete _ghost_note;
|
remove_ghost_note ();
|
||||||
_ghost_note = 0;
|
|
||||||
|
|
||||||
editor.verbose_cursor()->hide ();
|
editor.verbose_cursor()->hide ();
|
||||||
|
|
||||||
|
|
@ -641,47 +576,10 @@ MidiRegionView::motion (GdkEventMotion* ev)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case SelectRectDragging:
|
case SelectRectDragging:
|
||||||
|
case AddDragging:
|
||||||
editor.drags()->motion_handler ((GdkEvent *) ev, false);
|
editor.drags()->motion_handler ((GdkEvent *) ev, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AddDragging: // Add note drag motion
|
|
||||||
|
|
||||||
if (ev->is_hint) {
|
|
||||||
int t_x;
|
|
||||||
int t_y;
|
|
||||||
GdkModifierType state;
|
|
||||||
gdk_window_get_pointer(ev->window, &t_x, &t_y, &state);
|
|
||||||
event_x = t_x;
|
|
||||||
event_y = t_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_mouse_state == AddDragging) {
|
|
||||||
event_x = editor.frame_to_pixel(event_frame);
|
|
||||||
|
|
||||||
if (editor.snap_mode() == SnapNormal) {
|
|
||||||
/* event_frame will have been snapped to the start of the note we are under;
|
|
||||||
it's more intuitive if we use the end of that note here
|
|
||||||
*/
|
|
||||||
event_x = editor.frame_to_pixel (event_frame + grid_frames);
|
|
||||||
} else {
|
|
||||||
event_x = editor.frame_to_pixel (event_frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_drag_rect) {
|
|
||||||
|
|
||||||
if (event_x > _drag_start_x) {
|
|
||||||
_drag_rect->property_x2() = event_x;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_drag_rect->property_x1() = event_x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_last_x = event_x;
|
|
||||||
_last_y = event_y;
|
|
||||||
|
|
||||||
case SelectTouchDragging:
|
case SelectTouchDragging:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -878,14 +776,14 @@ MidiRegionView::show_list_editor ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a note to the model, and the view, at a canvas (click) coordinate.
|
/** Add a note to the model, and the view, at a canvas (click) coordinate.
|
||||||
* \param x horizontal position in pixels
|
* \param t time in frames relative to the position of the region
|
||||||
* \param y vertical position in pixels
|
* \param y vertical position in pixels
|
||||||
* \param length duration of the note in beats, which will be snapped to the grid
|
* \param length duration of the note in beats, which will be snapped to the grid
|
||||||
* \param sh true to make the note 1 frame shorter than the snapped version of \a length.
|
* \param sh true to make the note 1 frame shorter than the snapped version of \a length.
|
||||||
* \param snap_x true to snap x to the grid, otherwise false.
|
* \param snap_x true to snap x to the grid, otherwise false.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MidiRegionView::create_note_at (double x, double y, double length, bool sh, bool snap_x)
|
MidiRegionView::create_note_at (framepos_t t, double y, double length, bool sh, bool snap_x)
|
||||||
{
|
{
|
||||||
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
||||||
MidiStreamView* const view = mtv->midi_view();
|
MidiStreamView* const view = mtv->midi_view();
|
||||||
|
|
@ -896,16 +794,16 @@ MidiRegionView::create_note_at (double x, double y, double length, bool sh, bool
|
||||||
assert(note <= 127.0);
|
assert(note <= 127.0);
|
||||||
|
|
||||||
// Start of note in frames relative to region start
|
// Start of note in frames relative to region start
|
||||||
framepos_t start_frames = trackview.editor().pixel_to_frame (x);
|
|
||||||
if (snap_x) {
|
if (snap_x) {
|
||||||
framecnt_t grid_frames;
|
framecnt_t grid_frames;
|
||||||
start_frames = snap_frame_to_grid_underneath (start_frames, grid_frames);
|
t = snap_frame_to_grid_underneath (t, grid_frames);
|
||||||
}
|
}
|
||||||
assert(start_frames >= 0);
|
assert (t >= 0);
|
||||||
|
|
||||||
// Snap length
|
// Snap length
|
||||||
length = region_frames_to_region_beats(
|
length = region_frames_to_region_beats(
|
||||||
snap_frame_to_frame (start_frames + region_beats_to_region_frames(length)) - start_frames);
|
snap_frame_to_frame (t + region_beats_to_region_frames(length)) - t
|
||||||
|
);
|
||||||
|
|
||||||
assert (length != 0);
|
assert (length != 0);
|
||||||
|
|
||||||
|
|
@ -914,7 +812,7 @@ MidiRegionView::create_note_at (double x, double y, double length, bool sh, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const boost::shared_ptr<NoteType> new_note (new NoteType (mtv->get_channel_for_add (),
|
const boost::shared_ptr<NoteType> new_note (new NoteType (mtv->get_channel_for_add (),
|
||||||
region_frames_to_region_beats(start_frames + _region->start()), length,
|
region_frames_to_region_beats(t + _region->start()), length,
|
||||||
(uint8_t)note, 0x40));
|
(uint8_t)note, 0x40));
|
||||||
|
|
||||||
if (_model->contains (new_note)) {
|
if (_model->contains (new_note)) {
|
||||||
|
|
@ -3446,8 +3344,7 @@ MidiRegionView::update_ghost_note (double x, double y)
|
||||||
void
|
void
|
||||||
MidiRegionView::create_ghost_note (double x, double y)
|
MidiRegionView::create_ghost_note (double x, double y)
|
||||||
{
|
{
|
||||||
delete _ghost_note;
|
remove_ghost_note ();
|
||||||
_ghost_note = 0;
|
|
||||||
|
|
||||||
boost::shared_ptr<NoteType> g (new NoteType);
|
boost::shared_ptr<NoteType> g (new NoteType);
|
||||||
_ghost_note = new NoEventCanvasNote (*this, *_note_group, g);
|
_ghost_note = new NoEventCanvasNote (*this, *_note_group, g);
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,8 @@ public:
|
||||||
void trim_front_starting ();
|
void trim_front_starting ();
|
||||||
void trim_front_ending ();
|
void trim_front_ending ();
|
||||||
|
|
||||||
|
void create_note_at (framepos_t, double, double, bool, bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Allows derived types to specify their visibility requirements
|
/** Allows derived types to specify their visibility requirements
|
||||||
* to the TimeAxisViewItem parent class.
|
* to the TimeAxisViewItem parent class.
|
||||||
|
|
@ -321,8 +323,6 @@ private:
|
||||||
|
|
||||||
friend class EditNoteDialog;
|
friend class EditNoteDialog;
|
||||||
|
|
||||||
void create_note_at(double x, double y, double length, bool, bool);
|
|
||||||
|
|
||||||
/** Play the NoteOn event of the given note immediately
|
/** Play the NoteOn event of the given note immediately
|
||||||
* and schedule the playback of the corresponding NoteOff event.
|
* and schedule the playback of the corresponding NoteOff event.
|
||||||
*/
|
*/
|
||||||
|
|
@ -385,11 +385,6 @@ private:
|
||||||
ArdourCanvas::CanvasNote* _ghost_note;
|
ArdourCanvas::CanvasNote* _ghost_note;
|
||||||
double _last_ghost_x;
|
double _last_ghost_x;
|
||||||
double _last_ghost_y;
|
double _last_ghost_y;
|
||||||
double _drag_start_x;
|
|
||||||
double _drag_start_y;
|
|
||||||
double _last_x;
|
|
||||||
double _last_y;
|
|
||||||
ArdourCanvas::SimpleRect* _drag_rect;
|
|
||||||
ArdourCanvas::SimpleRect* _step_edit_cursor;
|
ArdourCanvas::SimpleRect* _step_edit_cursor;
|
||||||
Evoral::MusicalTime _step_edit_cursor_width;
|
Evoral::MusicalTime _step_edit_cursor_width;
|
||||||
Evoral::MusicalTime _step_edit_cursor_position;
|
Evoral::MusicalTime _step_edit_cursor_position;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue