#include "pbd/memento_command.h"
#include "pbd/basename.h"
#include "ardour/diskstream.h"
+#include "ardour/session.h"
#include "ardour/dB.h"
#include "ardour/region_factory.h"
#include "ardour/midi_diskstream.h"
double const ControlPointDrag::_zero_gain_fraction = gain_to_slider_position (dB_to_coefficient (0.0));
-Drag::Drag (Editor* e, ArdourCanvas::Item* i) :
- _editor (e),
- _item (i),
- _pointer_frame_offset (0),
- _grab_frame (0),
- _last_pointer_frame (0),
- _current_pointer_frame (0),
- _had_movement (false),
- _move_threshold_passed (false)
+Drag::Drag (Editor* e, ArdourCanvas::Item* i)
+ : _editor (e)
+ , _item (i)
+ , _pointer_frame_offset (0)
+ , _grab_frame (0)
+ , _last_pointer_frame (0)
+ , _current_pointer_frame (0)
+ , _had_movement (false)
+ , _have_transaction (false)
+ , _move_threshold_passed (false)
{
}
_was_rolling = false;
}
- switch (_editor->snap_type) {
+ switch (_editor->snap_type()) {
case SnapToRegionStart:
case SnapToRegionEnd:
case SnapToRegionSync:
}
}
+ _have_transaction = true;
+
changed_position = (_last_frame_position != (nframes64_t) (_primary->region()->position()));
changed_tracks = (_dest_trackview != &_primary->get_time_axis_view());
}
_editor->begin_reversible_command (trim_type);
+ _have_transaction = true;
for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
(*i)->fake_set_opaque(false);
return;
}
+ /* XXX i hope to god that we can really conclude this ... */
+ _have_transaction = true;
+
if (left_direction) {
frame_delta = (_last_pointer_frame - _current_pointer_frame);
} else {
(*i)->fake_set_opaque (true);
}
}
-
for (set<boost::shared_ptr<Playlist> >::iterator p = _editor->motion_frozen_playlists.begin(); p != _editor->motion_frozen_playlists.end(); ++p) {
(*p)->thaw ();
- _editor->session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
+ if (_have_transaction) {
+ _editor->session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
+ }
}
_editor->motion_frozen_playlists.clear ();
- _editor->commit_reversible_command();
+ if (_have_transaction) {
+ _editor->commit_reversible_command();
+ }
+
} else {
/* no mouse movement */
_editor->point_trim (event);
boost::shared_ptr<AudioRegion> const r = a->audio_region ();
_pointer_frame_offset = _grab_frame - ((nframes64_t) r->fade_in()->back()->when + r->position());
+ _editor->show_verbose_duration_cursor (r->position(), r->position() + r->fade_in()->back()->when, 10);
}
void
boost::shared_ptr<AudioRegion> r = a->audio_region ();
_pointer_frame_offset = _grab_frame - (r->length() - (nframes64_t) r->fade_out()->back()->when + r->position());
+ _editor->show_verbose_duration_cursor (r->last_frame() - r->fade_out()->back()->when, r->last_frame(), 10);
}
void
}
SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o)
- : Drag (e, i),
- _operation (o),
- _copy (false)
+ : Drag (e, i)
+ , _operation (o)
+ , _copy (false)
{
}
nframes64_t end = 0;
nframes64_t length;
+
nframes64_t const pending_position = adjusted_current_frame (event);
/* only alter selection if the current frame is
if (first_move) {
_editor->begin_reversible_command (_("range selection"));
+ _have_transaction = true;
if (_copy) {
/* adding to the selection */
if (first_move) {
_editor->begin_reversible_command (_("trim selection start"));
+ _have_transaction = true;
}
-
+
start = _editor->selection->time[_editor->clicked_selection].start;
end = _editor->selection->time[_editor->clicked_selection].end;
if (first_move) {
_editor->begin_reversible_command (_("trim selection end"));
+ _have_transaction = true;
}
start = _editor->selection->time[_editor->clicked_selection].start;
if (first_move) {
_editor->begin_reversible_command (_("move selection"));
+ _have_transaction = true;
}
start = _editor->selection->time[_editor->clicked_selection].start;
void
SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
{
+ Session* s = _editor->session;
+
if (movement_occurred) {
motion (event, false);
/* XXX this is not object-oriented programming at all. ick */
if (_editor->selection->time.consolidate()) {
_editor->selection->TimeChanged ();
}
- _editor->commit_reversible_command ();
+
+ if (_have_transaction) {
+ _editor->commit_reversible_command ();
+ }
+
+ /* XXX what if its a music time selection? */
+ if (s && (s->config.get_auto_play() || (s->get_play_range() && s->transport_rolling()))) {
+ s->request_play_range (&_editor->selection->time, true);
+ }
+
+
} else {
/* just a click, no pointer movement.*/
_editor->selection->clear_time();
}
+
+ if (s && s->get_play_range () && s->transport_rolling()) {
+ s->request_stop (false, false);
+ }
+
}
- /* XXX what happens if its a music selection? */
- _editor->session->set_audio_range (_editor->selection->time);
_editor->stop_canvas_autoscroll ();
}