_views.push_back (DraggingView (*i, this));
}
- RegionView::RegionViewGoingAway.connect (death_connection, invalidator (*this), ui_bind (&RegionDrag::region_going_away, this, _1), gui_context());
+ RegionView::RegionViewGoingAway.connect (death_connection, invalidator (*this), boost::bind (&RegionDrag::region_going_away, this, _1), gui_context());
}
void
if (first_move) {
- rv->get_time_axis_view().hide_dependent_views (*rv);
+ rv->drag_start ();
/* Absolutely no idea why this is necessary, but it is; without
it, the region view disappears after the reparent.
if (tv->view()->layer_display() == Stacked) {
tv->view()->set_layer_display (Expanded);
}
-
+
/* We're only allowed to go -ve in layer on Expanded views */
if (tv->view()->layer_display() != Expanded && (i->layer + this_delta_layer) < 0) {
this_delta_layer = - i->layer;
}
-
+
/* Set height */
rv->set_height (tv->view()->child_height ());
-
+
/* Update show/hidden status as the region view may have come from a hidden track,
or have moved to one.
*/
rv->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item());
rv->get_canvas_group()->property_y() = i->initial_y;
- rv->get_time_axis_view().reveal_dependent_views (*rv);
+ rv->drag_end ();
/* just change the model */
assert (rtv);
rv->get_canvas_group()->reparent (*rtv->view()->canvas_item());
rv->get_canvas_group()->property_y() = 0;
- rv->get_time_axis_view().reveal_dependent_views (*rv);
+ rv->drag_end ();
rv->fake_set_opaque (false);
rv->move (-_total_x_delta, 0);
rv->set_height (rtv->view()->child_height ());
} else {
_view->playlist()->thaw ();
}
-
- if (_region) {
- _editor->commit_reversible_command ();
- }
}
void
if (arv) {
arv->temporarily_hide_envelope ();
+ arv->drag_start ();
}
boost::shared_ptr<Playlist> pl = rv->region()->playlist();
_editor->motion_frozen_playlists.clear ();
_editor->commit_reversible_command();
+ for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
+ i->view->drag_end ();
+ }
+
} else {
/* no mouse movement */
_editor->point_trim (event, adjusted_current_frame (event));
event->button.x + 10, event->button.y + 10);
_editor->verbose_cursor()->show ();
+
+ if (!_point->can_slide ()) {
+ _x_constrained = true;
+ }
}
void
bool const push = Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
- _point->line().drag_motion (_editor->frame_to_unit (cx_frames), fraction, false, push);
+ _point->line().drag_motion (_editor->frame_to_unit_unrounded (cx_frames), fraction, false, push);
_editor->verbose_cursor()->set_text (_point->line().get_verbose_cursor_string (fraction));
}
cy = min ((double) _line->height(), cy);
double const fraction = 1.0 - (cy / _line->height());
-
- bool push;
-
- if (Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier)) {
- push = false;
- } else {
- push = true;
- }
+ bool const push = !Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
/* we are ignoring x position for this drag, so we can just pass in anything */
_line->drag_motion (0, fraction, true, push);
TimeFXDrag::motion (GdkEvent* event, bool)
{
RegionView* rv = _primary;
+ StreamView* cv = rv->get_time_axis_view().view ();
+
+ pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (grab_y());
+ int layer = tv.first->layer_display() == Overlaid ? 0 : tv.second;
+ int layers = tv.first->layer_display() == Overlaid ? 1 : cv->layers();
framepos_t const pf = adjusted_current_frame (event);
if (pf > rv->region()->position()) {
- rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf);
+ rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf, layers, layer);
}
show_verbose_cursor_time (pf);
int8_t
NoteDrag::total_dy () const
{
- return ((int8_t) (grab_y() / _note_height)) - ((int8_t) (_drags->current_pointer_y() / _note_height));
+ MidiStreamView* msv = _region->midi_stream_view ();
+ double const y = _region->midi_view()->y_position ();
+ /* new current note */
+ uint8_t n = msv->y_to_note (_drags->current_pointer_y () - y);
+ /* clamp */
+ n = max (msv->lowest_note(), n);
+ n = min (msv->highest_note(), n);
+ /* and work out delta */
+ return n - msv->y_to_note (grab_y() - y);
}
void
/* check this range against all the AudioRanges that we are using */
list<AudioRange>::const_iterator k = _ranges.begin ();
while (k != _ranges.end()) {
- if (k->coverage (r.first, r.second) != OverlapNone) {
+ if (k->coverage (r.first, r.second) != Evoral::OverlapNone) {
break;
}
++k;
double const q = j->line->time_converter().from (a - j->line->time_converter().origin_b ());
the_list->add (p, the_list->eval (p));
- j->line->add_always_in_view (p);
the_list->add (q, the_list->eval (q));
- j->line->add_always_in_view (q);
}
/* same thing for the end */
double const q = j->line->time_converter().from (i->end - j->line->time_converter().origin_b ());
the_list->add (p, the_list->eval (p));
- j->line->add_always_in_view (p);
the_list->add (q, the_list->eval (q));
- j->line->add_always_in_view (q);
}
}
motion (event, false);
for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
i->line->end_drag ();
- i->line->clear_always_in_view ();
}
_editor->session()->commit_reversible_command ();
AutomationRangeDrag::aborted (bool)
{
for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
- i->line->clear_always_in_view ();
i->line->reset ();
}
}
, _patch_change (i)
, _cumulative_dx (0)
{
- DEBUG_TRACE (DEBUG::Drags, "New PatchChangeDrag\n");
+ DEBUG_TRACE (DEBUG::Drags, string_compose ("New PatchChangeDrag, patch @ %1, grab @ %2\n",
+ _region_view->source_beats_to_absolute_frames (_patch_change->patch()->time()),
+ grab_frame()));
}
void
f = max (f, r->position ());
f = min (f, r->last_frame ());
- framecnt_t const dxf = f - grab_frame();
- double const dxu = _editor->frame_to_unit (dxf);
+ framecnt_t const dxf = f - grab_frame(); // permitted dx in frames
+ double const dxu = _editor->frame_to_unit (dxf); // permitted fx in units
_patch_change->move (dxu - _cumulative_dx, 0);
_cumulative_dx = dxu;
}
}
boost::shared_ptr<Region> r (_region_view->region ());
-
framepos_t f = adjusted_current_frame (ev);
f = max (f, r->position ());
f = min (f, r->last_frame ());
_region_view->move_patch_change (
*_patch_change,
- _region_view->region_frames_to_region_beats (f - r->position() - r->start())
+ _region_view->region_frames_to_region_beats (f - (r->position() - r->start()))
);
}
}
void
-MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress)
+MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool /*drag_in_progress*/)
{
framepos_t const p = _region_view->region()->position ();
double const y = _region_view->midi_view()->y_position ();
}
void
-MidiVerticalSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress)
+MidiVerticalSelectDrag::select_things (int button_state, framepos_t /*x1*/, framepos_t /*x2*/, double y1, double y2, bool /*drag_in_progress*/)
{
double const y = _region_view->midi_view()->y_position ();
}
void
-NoteCreateDrag::finished (GdkEvent* event, bool had_movement)
+NoteCreateDrag::finished (GdkEvent*, bool had_movement)
{
if (!had_movement) {
return;
{
}
+
+CrossfadeEdgeDrag::CrossfadeEdgeDrag (Editor* e, AudioRegionView* rv, ArdourCanvas::Item* i, bool start_yn)
+ : Drag (e, i)
+ , arv (rv)
+ , start (start_yn)
+{
+}
+
+void
+CrossfadeEdgeDrag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
+{
+ Drag::start_grab (event, cursor);
+}
+
+void
+CrossfadeEdgeDrag::motion (GdkEvent*, bool)
+{
+ double distance;
+ double new_length;
+ framecnt_t len;
+
+ boost::shared_ptr<AudioRegion> ar (arv->audio_region());
+
+ if (start) {
+ distance = _drags->current_pointer_x() - grab_x();
+ len = ar->fade_in()->back()->when;
+ } else {
+ distance = grab_x() - _drags->current_pointer_x();
+ len = ar->fade_out()->back()->when;
+ }
+
+ /* how long should it be ? */
+
+ new_length = len + _editor->unit_to_frame (distance);
+
+ /* now check with the region that this is legal */
+
+ new_length = ar->verify_xfade_bounds (new_length, start);
+
+ if (start) {
+ arv->redraw_start_xfade_to (ar, new_length);
+ } else {
+ arv->redraw_end_xfade_to (ar, new_length);
+ }
+}
+
+void
+CrossfadeEdgeDrag::finished (GdkEvent*, bool)
+{
+ double distance;
+ double new_length;
+ framecnt_t len;
+
+ boost::shared_ptr<AudioRegion> ar (arv->audio_region());
+
+ if (start) {
+ distance = _drags->current_pointer_x() - grab_x();
+ len = ar->fade_in()->back()->when;
+ } else {
+ distance = grab_x() - _drags->current_pointer_x();
+ len = ar->fade_out()->back()->when;
+ }
+
+ new_length = ar->verify_xfade_bounds (len + _editor->unit_to_frame (distance), start);
+
+ _editor->begin_reversible_command ("xfade trim");
+ ar->playlist()->clear_owned_changes ();
+
+ if (start) {
+ ar->set_fade_in_length (new_length);
+ } else {
+ ar->set_fade_out_length (new_length);
+ }
+
+ /* Adjusting the xfade may affect other regions in the playlist, so we need
+ to get undo Commands from the whole playlist rather than just the
+ region.
+ */
+
+ vector<Command*> cmds;
+ ar->playlist()->rdiff (cmds);
+ _editor->session()->add_commands (cmds);
+ _editor->commit_reversible_command ();
+
+}
+
+void
+CrossfadeEdgeDrag::aborted (bool)
+{
+ if (start) {
+ arv->redraw_start_xfade ();
+ } else {
+ arv->redraw_end_xfade ();
+ }
+}
+