pos = _current_pointer_frame - _pointer_frame_offset;
}
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- _editor->snap_to (pos);
- }
+ _editor->snap_to_with_modifier (pos, event);
return pos;
}
sync_frame = *pending_region_position + (sync_dir*sync_offset);
- /* we snap if the snap modifier is not enabled.
- */
-
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- _editor->snap_to (sync_frame);
- }
+ _editor->snap_to_with_modifier (sync_frame, event);
*pending_region_position = _primary->region()->adjust_to_sync (sync_frame);
}
void
-RegionMoveDrag::finished (GdkEvent* event, bool movement_occurred)
+RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
{
- bool nocommit = true;
vector<RegionView*> copies;
boost::shared_ptr<Diskstream> ds;
boost::shared_ptr<Playlist> from_playlist;
if (!movement_occurred) {
/* just a click */
- goto out;
+ return;
}
- nocommit = false;
-
if (Config->get_edit_mode() == Splice && !_editor->pre_drag_region_selection.empty()) {
_editor->selection->set (_editor->pre_drag_region_selection);
_editor->pre_drag_region_selection.clear ();
/* get the playlist where this drag started. we can't use rv->region()->playlist()
because we may have copied the region and it has not been attached to a playlist.
*/
+
+ source_tv = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view());
+ ds = source_tv->get_diskstream();
+ from_playlist = ds->playlist();
- assert ((source_tv = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view())));
- assert ((ds = source_tv->get_diskstream()));
- assert ((from_playlist = ds->playlist()));
+ assert (source_tv);
+ assert (ds);
+ assert (from_playlist);
/* moved to a different audio track, without copying */
}
out:
- if (!nocommit) {
- for (set<boost::shared_ptr<Playlist> >::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) {
- _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
- }
-
- _editor->commit_reversible_command ();
+ for (set<boost::shared_ptr<Playlist> >::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) {
+ _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
}
+
+ _editor->commit_reversible_command ();
for (vector<RegionView*>::iterator x = copies.begin(); x != copies.end(); ++x) {
delete *x;
void
-RegionInsertDrag::finished (GdkEvent* event, bool movement_occurred)
+RegionInsertDrag::finished (GdkEvent* /*event*/, bool /*movement_occurred*/)
{
_editor->update_canvas_now ();
};
void
-RegionSpliceDrag::motion (GdkEvent* event, bool)
+RegionSpliceDrag::motion (GdkEvent* /*event*/, bool)
{
RouteTimeAxisView* tv;
layer_t layer;
}
void
-RegionSpliceDrag::finished (GdkEvent* event, bool)
+RegionSpliceDrag::finished (GdkEvent* /*event*/, bool)
{
}
void
-RegionCreateDrag::motion (GdkEvent* event, bool first_move)
+RegionCreateDrag::motion (GdkEvent* /*event*/, bool first_move)
{
if (first_move) {
// TODO: create region-create-drag region view here
void
-RegionGainDrag::motion (GdkEvent* event, bool)
+RegionGainDrag::motion (GdkEvent* /*event*/, bool)
{
}
left_direction = false;
}
- if (obey_snap) {
- _editor->snap_to (_current_pointer_frame);
- }
+ _editor->snap_to_with_modifier (_current_pointer_frame, event);
if (first_move) {
nframes64_t where = _editor->event_frame (event, 0, 0);
- _editor->snap_to (where);
+ _editor->snap_to_with_modifier (where, event);
_editor->playhead_cursor->set_position (where);
}
}
}
- _pointer_frame_offset = _grab_frame - _cursor->current_frame;
-
_editor->show_verbose_time_cursor (_cursor->current_frame, 10);
}
void
-ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
{
Drag::start_grab (event, _editor->fader_cursor);
//translate cx to frames
nframes64_t cx_frames = _editor->unit_to_frame (cx);
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !_x_constrained) {
- _editor->snap_to (cx_frames);
+ if (!_x_constrained) {
+ _editor->snap_to_with_modifier (cx_frames, event);
}
float const fraction = 1.0 - (cy / _point->line().height());
_point->line().end_drag (_point);
}
+bool
+ControlPointDrag::active (Editing::MouseMode m)
+{
+ if (m == Editing::MouseGain) {
+ /* always active in mouse gain */
+ return true;
+ }
+
+ /* otherwise active if the point is on an automation line (ie not if its on a region gain line) */
+ return dynamic_cast<AutomationLine*> (&(_point->line())) != 0;
+}
+
LineDrag::LineDrag (Editor* e, ArdourCanvas::Item* i)
: Drag (e, i),
_line (0),
}
void
-LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
{
_line = reinterpret_cast<AutomationLine*> (_item->get_data ("line"));
assert (_line);
return;
}
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && Config->get_rubberbanding_snaps_to_grid()) {
+ if (Config->get_rubberbanding_snaps_to_grid()) {
if (first_move) {
- _editor->snap_to (_grab_frame);
+ _editor->snap_to_with_modifier (_grab_frame, event);
}
- _editor->snap_to (_current_pointer_frame);
+ _editor->snap_to_with_modifier (_current_pointer_frame, event);
}
/* base start and end on initial click position */
Selection::Operation op = Keyboard::selection_type (event->button.state);
- bool commit;
+ bool committed;
_editor->begin_reversible_command (_("rubberband selection"));
if (_grab_frame < _last_pointer_frame) {
- commit = _editor->select_all_within (_grab_frame, _last_pointer_frame, y1, y2, _editor->track_views, op);
+ committed = _editor->select_all_within (_grab_frame, _last_pointer_frame, y1, y2, _editor->track_views, op);
} else {
- commit = _editor->select_all_within (_last_pointer_frame, _grab_frame, y1, y2, _editor->track_views, op);
+ committed = _editor->select_all_within (_last_pointer_frame, _grab_frame, y1, y2, _editor->track_views, op);
}
- if (commit) {
+ if (!committed) {
_editor->commit_reversible_command ();
}
{
RegionView* rv = _primary;
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- _editor->snap_to (_current_pointer_frame);
- }
+ _editor->snap_to_with_modifier (_current_pointer_frame, event);
if (_current_pointer_frame == _last_pointer_frame) {
return;
}
void
-TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
+TimeFXDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
{
_primary->get_time_axis_view().hide_timestretch ();
}
void
-ScrubDrag::motion (GdkEvent* event, bool)
+ScrubDrag::motion (GdkEvent* /*event*/, bool)
{
_editor->scrub ();
}
void
-ScrubDrag::finished (GdkEvent* event, bool movement_occurred)
+ScrubDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
{
if (movement_occurred && _editor->session) {
/* make sure we stop */
break;
}
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- _editor->snap_to (_current_pointer_frame);
- }
+ _editor->snap_to_with_modifier (_current_pointer_frame, event);
/* only alter selection if the current frame is
different from the last frame position.
if (movement_occurred) {
motion (event, false);
+ _drag_rect->hide();
switch (_operation) {
case CreateRangeMarker:
XMLNode &after = _editor->session->locations()->get_state();
_editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
_editor->commit_reversible_command ();
-
- _drag_rect->hide();
break;
}
case CreateTransportMarker:
// popup menu to pick loop or punch
_editor->new_transport_marker_context_menu (&event->button, _item);
-
break;
}
} else {
nframes64_t start;
nframes64_t end;
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- _editor->snap_to (_current_pointer_frame);
-
- if (first_move) {
- _editor->snap_to (_grab_frame);
- }
+ _editor->snap_to_with_modifier (_current_pointer_frame, event);
+
+ if (first_move) {
+ _editor->snap_to_with_modifier (_grab_frame, event);
}
if (_current_pointer_frame == _last_pointer_frame) {