{
_ending = true;
- cerr << "Aborting drag\n";
-
for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
(*i)->abort ();
delete *i;
NoteResizeDrag::NoteResizeDrag (Editor* e, ArdourCanvas::Item* i)
: Drag (e, i)
, region (0)
+ , relative (false)
+ , at_front (true)
, _snap_delta (0)
{
DEBUG_TRACE (DEBUG::Drags, "New NoteResizeDrag\n");
} else {
relative = true;
}
-
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
-
if (ms.size() > 1) {
/* has to be relative, may make no sense otherwise */
relative = true;
}
-
/* select this note; if it is already selected, preserve the existing selection,
otherwise make this note the only one selected.
*/
region->note_selected (cnote, cnote->selected ());
-
- _editor->begin_reversible_command (_("resize notes"));
-
- for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) {
- MidiRegionSelection::iterator next;
- next = r;
- ++next;
- MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
- if (mrv) {
- mrv->begin_resizing (at_front);
- }
- r = next;
- }
}
void
-NoteResizeDrag::motion (GdkEvent* event, bool /*first_move*/)
+NoteResizeDrag::motion (GdkEvent* event, bool first_move)
{
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
+ if (first_move) {
+ _editor->begin_reversible_command (_("resize notes"));
+
+ for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) {
+ MidiRegionSelection::iterator next;
+ next = r;
+ ++next;
+ MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
+ if (mrv) {
+ mrv->begin_resizing (at_front);
+ }
+ r = next;
+ }
+ }
+
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (nb);
}
void
-NoteResizeDrag::finished (GdkEvent* event, bool /*movement_occurred*/)
+NoteResizeDrag::finished (GdkEvent* event, bool movement_occurred)
{
+ if (!movement_occurred) {
+ return;
+ }
+
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
}
}
}
+
if (apply_snap_delta) {
sd = _snap_delta;
}
+
mrv->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative, sd, snap);
}
}
{
DEBUG_TRACE (DEBUG::Drags, "New MarkerDrag\n");
- _marker = reinterpret_cast<Marker*> (_item->get_data ("marker"));
+ _marker = reinterpret_cast<ArdourMarker*> (_item->get_data ("marker"));
assert (_marker);
_points.push_back (ArdourCanvas::Duple (0, 0));
}
}
-MarkerDrag::CopiedLocationMarkerInfo::CopiedLocationMarkerInfo (Location* l, Marker* m)
+MarkerDrag::CopiedLocationMarkerInfo::CopiedLocationMarkerInfo (Location* l, ArdourMarker* m)
{
location = new Location (*l);
markers.push_back (m);
case Selection::Extend:
{
Locations::LocationList ll;
- list<Marker*> to_add;
+ list<ArdourMarker*> to_add;
framepos_t s, e;
_editor->selection->markers.range (s, e);
s = min (_marker->position(), s);
switch (_marker->type()) {
- case Marker::SessionStart:
- case Marker::RangeStart:
- case Marker::LoopStart:
- case Marker::PunchIn:
+ case ArdourMarker::SessionStart:
+ case ArdourMarker::RangeStart:
+ case ArdourMarker::LoopStart:
+ case ArdourMarker::PunchIn:
f_delta = newframe - copy_location->start();
break;
- case Marker::SessionEnd:
- case Marker::RangeEnd:
- case Marker::LoopEnd:
- case Marker::PunchOut:
+ case ArdourMarker::SessionEnd:
+ case ArdourMarker::RangeEnd:
+ case ArdourMarker::LoopEnd:
+ case ArdourMarker::PunchOut:
f_delta = newframe - copy_location->end();
break;
default:
/* move all markers to their original location */
- for (vector<Marker*>::iterator m = x->markers.begin(); m != x->markers.end(); ++m) {
+ for (vector<ArdourMarker*>::iterator m = x->markers.begin(); m != x->markers.end(); ++m) {
bool is_start;
Location * location = _editor->find_location_from_marker (*m, is_start);
AutomationTimeAxisView* atv;
- _line->end_drag (false, 0);
-
if ((atv = dynamic_cast<AutomationTimeAxisView*>(_editor->clicked_axisview)) != 0) {
framepos_t where = _editor->window_event_sample (event, 0, 0);
atv->add_automation_event (event, where, event->button.y, false);
/* XXX what if its a music time selection? */
if (s) {
- if ( s->get_play_range() && s->transport_rolling() ) {
+ if (s->get_play_range() && s->transport_rolling()) {
s->request_play_range (&_editor->selection->time, true);
} else {
if (ARDOUR_UI::config()->get_follow_edits() && !s->transport_rolling()) {
s->request_locate (_editor->get_selection().time.start());
}
}
- }
+ if (_editor->get_selection().time.length() != 0) {
+ s->set_range_selection (_editor->get_selection().time.start(), _editor->get_selection().time.end_frame());
+ } else {
+ s->clear_range_selection ();
+ }
+ }
+
} else {
/* just a click, no pointer movement.
*/
if (_nothing_to_drag) {
return;
}
- _editor->begin_reversible_command (_("automation range move"));
- for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
- i->line->start_drag_multiple (i->points, y_fraction (i->line, current_pointer_y()), i->state);
- }
}
void
-AutomationRangeDrag::motion (GdkEvent*, bool /*first_move*/)
+AutomationRangeDrag::motion (GdkEvent*, bool first_move)
{
if (_nothing_to_drag) {
return;
}
+ if (first_move) {
+ _editor->begin_reversible_command (_("automation range move"));
+ for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
+ i->line->start_drag_multiple (i->points, y_fraction (i->line, current_pointer_y()), i->state);
+ }
+ }
+
for (list<Line>::iterator l = _lines.begin(); l != _lines.end(); ++l) {
float const f = y_fraction (l->line, current_pointer_y());
/* we are ignoring x position for this drag, so we can just pass in anything */
}
void
-AutomationRangeDrag::finished (GdkEvent* event, bool)
+AutomationRangeDrag::finished (GdkEvent* event, bool motion_occurred)
{
- if (_nothing_to_drag) {
+ if (_nothing_to_drag || !motion_occurred) {
return;
}