-Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool swap_direction, bool obey_snap)
-{
- boost::shared_ptr<Region> region (rv.region());
-
- if (region->locked()) {
- return;
- }
-
- nframes64_t new_bound;
-
- double speed = 1.0;
- TimeAxisView* tvp = clicked_axisview;
- RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
-
- if (tv && tv->is_track()) {
- speed = tv->get_diskstream()->speed();
- }
-
- if (left_direction) {
- if (swap_direction) {
- new_bound = (nframes64_t) (region->position()/speed) + frame_delta;
- } else {
- new_bound = (nframes64_t) (region->position()/speed) - frame_delta;
- }
- } else {
- if (swap_direction) {
- new_bound = (nframes64_t) (region->position()/speed) - frame_delta;
- } else {
- new_bound = (nframes64_t) (region->position()/speed) + frame_delta;
- }
- }
-
- if (obey_snap) {
- snap_to (new_bound);
- }
- region->trim_start ((nframes64_t) (new_bound * speed), this);
- rv.region_changed (StartChanged);
-}
-
-void
-Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool obey_snap, bool no_overlap)
-{
- boost::shared_ptr<Region> region (rv.region());
-
- if (region->locked()) {
- return;
- }
-
- nframes64_t new_bound;
-
- double speed = 1.0;
- TimeAxisView* tvp = clicked_axisview;
- RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
-
- if (tv && tv->is_track()) {
- speed = tv->get_diskstream()->speed();
- }
-
- if (left_direction) {
- new_bound = (nframes64_t) (region->position()/speed) - frame_delta;
- } else {
- new_bound = (nframes64_t) (region->position()/speed) + frame_delta;
- }
-
- if (obey_snap) {
- snap_to (new_bound, (left_direction ? 0 : 1));
- }
-
- nframes64_t pre_trim_first_frame = region->first_frame();
-
- region->trim_front ((nframes64_t) (new_bound * speed), this);
-
- if (no_overlap) {
- //Get the next region on the left of this region and shrink/expand it.
- boost::shared_ptr<Playlist> playlist (region->playlist());
- boost::shared_ptr<Region> region_left = playlist->find_next_region (pre_trim_first_frame, End, 0);
-
- bool regions_touching = false;
-
- if (region_left != 0 && (pre_trim_first_frame == region_left->last_frame() + 1)){
- regions_touching = true;
- }
-
- //Only trim region on the left if the first frame has gone beyond the left region's last frame.
- if (region_left != 0 &&
- (region_left->last_frame() > region->first_frame() || regions_touching))
- {
- region_left->trim_end(region->first_frame(), this);
- }
- }
-
-
-
- rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged));
-}
-
-void
-Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool obey_snap, bool no_overlap)
-{
- boost::shared_ptr<Region> region (rv.region());
-
- if (region->locked()) {
- return;
- }
-
- nframes64_t new_bound;
-
- double speed = 1.0;
- TimeAxisView* tvp = clicked_axisview;
- RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
-
- if (tv && tv->is_track()) {
- speed = tv->get_diskstream()->speed();
- }
-
- if (left_direction) {
- new_bound = (nframes64_t) ((region->last_frame() + 1)/speed) - frame_delta;
- } else {
- new_bound = (nframes64_t) ((region->last_frame() + 1)/speed) + frame_delta;
- }
-
- if (obey_snap) {
- snap_to (new_bound);
- }
-
- nframes64_t pre_trim_last_frame = region->last_frame();
-
- region->trim_end ((nframes64_t) (new_bound * speed), this);
-
- if (no_overlap) {
- //Get the next region on the right of this region and shrink/expand it.
- boost::shared_ptr<Playlist> playlist (region->playlist());
- boost::shared_ptr<Region> region_right = playlist->find_next_region (pre_trim_last_frame, Start, 1);
-
- bool regions_touching = false;
-
- if (region_right != 0 && (pre_trim_last_frame == region_right->first_frame() - 1)){
- regions_touching = true;
- }
-
- //Only trim region on the right if the last frame has gone beyond the right region's first frame.
- if (region_right != 0 &&
- (region_right->first_frame() < region->last_frame() || regions_touching))
- {
- region_right->trim_front(region->last_frame() + 1, this);
- }
-
- rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged));
- }
- else {
- rv.region_changed (LengthChanged);
- }
-}
-
-
-void
-Editor::point_trim (GdkEvent* event)