_note_group->raise_to_top();
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
- Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
+ Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
connect_to_diskstream ();
- SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), ui_bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
+ SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
}
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
connect_to_diskstream ();
- SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), ui_bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
+ SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
}
void
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
CanvasNoteEvent::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
- ui_bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
+ boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
gui_context());
if (wfd) {
sigc::mem_fun(this, &MidiRegionView::midi_patch_settings_changed));
trackview.editor().SnapChanged.connect(snap_changed_connection, invalidator(*this),
- ui_bind(&MidiRegionView::snap_changed, this),
+ boost::bind (&MidiRegionView::snap_changed, this),
gui_context());
- Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
+ Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
connect_to_diskstream ();
- SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), ui_bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
+ SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ());
}
const boost::shared_ptr<ARDOUR::MidiRegion>
{
midi_view()->midi_track()->DataRecorded.connect(
*this, invalidator(*this),
- ui_bind(&MidiRegionView::data_recorded, this, _1),
+ boost::bind (&MidiRegionView::data_recorded, this, _1),
gui_context());
}
MidiRegionView::enter_notify (GdkEventCrossing* ev)
{
trackview.editor().MouseModeChanged.connect (
- _mouse_mode_connection, invalidator (*this), ui_bind (&MidiRegionView::mouse_mode_changed, this), gui_context ()
+ _mouse_mode_connection, invalidator (*this), boost::bind (&MidiRegionView::mouse_mode_changed, this), gui_context ()
);
if (trackview.editor().current_mouse_mode() == MouseDraw && _mouse_state != AddDragging) {
Editor* editor = dynamic_cast<Editor *> (&trackview.editor());
MouseMode m = editor->current_mouse_mode();
-
+
if (m == MouseObject && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())) {
pre_press_cursor = editor->get_canvas_cursor ();
editor->set_canvas_cursor (editor->cursors()->midi_pencil);
case Pressed: // Clicked
switch (editor.current_mouse_mode()) {
+ case MouseRange:
+ /* no motion occured - simple click */
+ clear_selection ();
+ break;
+
case MouseObject:
case MouseTimeFX:
{
_mouse_state = AddDragging;
remove_ghost_note ();
editor.verbose_cursor()->hide ();
- cerr << "starting note create drag\n";
-
return true;
- } else {
+ } else if (m == MouseObject) {
editor.drags()->set (new MidiRubberbandSelectDrag (dynamic_cast<Editor *> (&editor), this), (GdkEvent *) ev);
_mouse_state = SelectRectDragging;
return true;
+ } else if (m == MouseRange) {
+ editor.drags()->set (new MidiVerticalSelectDrag (dynamic_cast<Editor *> (&editor), this), (GdkEvent *) ev);
+ _mouse_state = SelectVerticalDragging;
+ return true;
}
}
return false;
case SelectRectDragging:
+ case SelectVerticalDragging:
case AddDragging:
editor.drags()->motion_handler ((GdkEvent *) ev, false);
break;
MidiRegionView::show_list_editor ()
{
if (!_list_editor) {
- _list_editor = new MidiListEditor (trackview.session(), midi_region());
+ _list_editor = new MidiListEditor (trackview.session(), midi_region(), midi_view()->midi_track());
}
_list_editor->present ();
}
ghost->set_duration (_region->length() / samples_per_unit);
ghosts.push_back (ghost);
- GhostRegion::CatchDeletion.connect (*this, invalidator (*this), ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
+ GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context());
return ghost;
}
}
}
+void
+MidiRegionView::update_vertical_drag_selection (double y1, double y2, bool extend)
+{
+ if (y1 > y2) {
+ swap (y1, y2);
+ }
+
+ // TODO: Make this faster by storing the last updated selection rect, and only
+ // adjusting things that are in the area that appears/disappeared.
+ // We probably need a tree to be able to find events in O(log(n)) time.
+
+ for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
+
+ /* check if any corner of the note is inside the rect
+
+ Notes:
+ 1) this is computing "touched by", not "contained by" the rect.
+ 2) this does not require that events be sorted in time.
+ */
+
+ if (((*i)->y1() >= y1 && (*i)->y1() <= y2)) {
+ // within y- (note-) range
+ if (!(*i)->selected()) {
+ add_to_selection (*i);
+ }
+ } else if ((*i)->selected() && !extend) {
+ // Not inside rectangle
+ remove_from_selection (*i);
+ }
+ }
+}
+
void
MidiRegionView::remove_from_selection (CanvasNoteEvent* ev)
{
framepos_t ref_point = source_beats_to_absolute_frames ((*(_selection.begin()))->note()->time());
framepos_t unused;
- framepos_t distance;
+ framecnt_t distance;
if (trackview.editor().snap_mode() == Editing::SnapOff) {
MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, bool can_set_cursor)
{
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
+ Editing::MouseMode mm = editor->current_mouse_mode();
+ bool trimmable = (mm == MouseObject || mm == MouseTimeFX || mm == MouseDraw);
- if (x_fraction > 0.0 && x_fraction < 0.2) {
+ if (trimmable && x_fraction > 0.0 && x_fraction < 0.2) {
editor->set_canvas_cursor (editor->cursors()->left_side_trim);
- } else if (x_fraction >= 0.8 && x_fraction < 1.0) {
+ } else if (trimmable && x_fraction >= 0.8 && x_fraction < 1.0) {
editor->set_canvas_cursor (editor->cursors()->right_side_trim);
} else {
if (pre_enter_cursor && can_set_cursor) {
Evoral::MusicalTime end_point = 0;
duration = (*mcb.notes().rbegin())->end_time() - (*mcb.notes().begin())->time();
- paste_pos_beats = region_frames_to_region_beats (pos - _region->position());
+ paste_pos_beats = absolute_frames_to_source_beats (pos);
beat_delta = (*mcb.notes().begin())->time() - paste_pos_beats;
paste_pos_beats = 0;
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste extended region from %1 to %2\n", region_end, end_frame));
_region->clear_changes ();
- _region->set_length (end_frame);
+ _region->set_length (end_frame - _region->position());
trackview.session()->add_command (new StatefulDiffCommand (_region));
}