Fix SNAFU on region trimming with grid enabled caused by my recent supposed fix.
git-svn-id: svn://localhost/ardour2/branches/3.0@7055 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8f59346592
commit
056ceba16a
@ -1677,8 +1677,8 @@ public:
|
||||
/* trimming */
|
||||
void point_trim (GdkEvent *, nframes64_t);
|
||||
void single_contents_trim (RegionView&, nframes64_t, bool, bool);
|
||||
void single_start_trim (RegionView&, nframes64_t, bool, bool);
|
||||
void single_end_trim (RegionView&, nframes64_t, bool, bool);
|
||||
void single_start_trim (RegionView&, nframes64_t, bool);
|
||||
void single_end_trim (RegionView&, nframes64_t, bool);
|
||||
|
||||
void thaw_region_after_trim (RegionView& rv);
|
||||
|
||||
|
@ -1736,9 +1736,6 @@ void
|
||||
TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
{
|
||||
RegionView* rv = _primary;
|
||||
nframes64_t frame_delta = 0;
|
||||
|
||||
bool left_direction;
|
||||
|
||||
/* snap modifier works differently here..
|
||||
its current state has to be passed to the
|
||||
@ -1756,12 +1753,6 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
|
||||
nframes64_t const pf = adjusted_current_frame (event);
|
||||
|
||||
if (last_pointer_frame() > pf) {
|
||||
left_direction = true;
|
||||
} else {
|
||||
left_direction = false;
|
||||
}
|
||||
|
||||
if (first_move) {
|
||||
|
||||
string trim_type;
|
||||
@ -1802,12 +1793,6 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
}
|
||||
}
|
||||
|
||||
if (left_direction) {
|
||||
frame_delta = (last_pointer_frame() - pf);
|
||||
} else {
|
||||
frame_delta = (pf - last_pointer_frame());
|
||||
}
|
||||
|
||||
bool non_overlap_trim = false;
|
||||
|
||||
if (event && Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
@ -1816,26 +1801,16 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
|
||||
switch (_operation) {
|
||||
case StartTrim:
|
||||
if ((left_direction == false) && (pf <= rv->region()->first_frame()/speed)) {
|
||||
break;
|
||||
} else {
|
||||
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
_editor->single_start_trim (*i->view, frame_delta, left_direction, non_overlap_trim);
|
||||
}
|
||||
break;
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
_editor->single_start_trim (*i->view, pf, non_overlap_trim);
|
||||
}
|
||||
break;
|
||||
|
||||
case EndTrim:
|
||||
if ((left_direction == true) && (pf > (nframes64_t) (rv->region()->last_frame()/speed))) {
|
||||
break;
|
||||
} else {
|
||||
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
_editor->single_end_trim (*i->view, frame_delta, left_direction, non_overlap_trim);
|
||||
}
|
||||
break;
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
_editor->single_end_trim (*i->view, pf, non_overlap_trim);
|
||||
}
|
||||
break;
|
||||
|
||||
case ContentsTrim:
|
||||
{
|
||||
@ -1845,6 +1820,19 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||
swap_direction = true;
|
||||
}
|
||||
|
||||
nframes64_t frame_delta = 0;
|
||||
|
||||
bool left_direction = false;
|
||||
if (last_pointer_frame() > pf) {
|
||||
left_direction = true;
|
||||
}
|
||||
|
||||
if (left_direction) {
|
||||
frame_delta = (last_pointer_frame() - pf);
|
||||
} else {
|
||||
frame_delta = (pf - last_pointer_frame());
|
||||
}
|
||||
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
_editor->single_contents_trim (*i->view, frame_delta, left_direction, swap_direction);
|
||||
}
|
||||
|
@ -2156,7 +2156,7 @@ Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left
|
||||
}
|
||||
|
||||
void
|
||||
Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool no_overlap)
|
||||
Editor::single_start_trim (RegionView& rv, nframes64_t new_bound, bool no_overlap)
|
||||
{
|
||||
boost::shared_ptr<Region> region (rv.region());
|
||||
|
||||
@ -2164,8 +2164,6 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di
|
||||
return;
|
||||
}
|
||||
|
||||
nframes64_t new_bound;
|
||||
|
||||
double speed = 1.0;
|
||||
TimeAxisView* tvp = clicked_axisview;
|
||||
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
|
||||
@ -2174,12 +2172,6 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di
|
||||
speed = tv->track()->speed();
|
||||
}
|
||||
|
||||
if (left_direction) {
|
||||
new_bound = (nframes64_t) (region->position()/speed) - frame_delta;
|
||||
} else {
|
||||
new_bound = (nframes64_t) (region->position()/speed) + frame_delta;
|
||||
}
|
||||
|
||||
nframes64_t pre_trim_first_frame = region->first_frame();
|
||||
|
||||
region->trim_front ((nframes64_t) (new_bound * speed), this);
|
||||
@ -2207,7 +2199,7 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di
|
||||
}
|
||||
|
||||
void
|
||||
Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool no_overlap)
|
||||
Editor::single_end_trim (RegionView& rv, nframes64_t new_bound, bool no_overlap)
|
||||
{
|
||||
boost::shared_ptr<Region> region (rv.region());
|
||||
|
||||
@ -2215,8 +2207,6 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire
|
||||
return;
|
||||
}
|
||||
|
||||
nframes64_t new_bound;
|
||||
|
||||
double speed = 1.0;
|
||||
TimeAxisView* tvp = clicked_axisview;
|
||||
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
|
||||
@ -2225,12 +2215,6 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire
|
||||
speed = tv->track()->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;
|
||||
}
|
||||
|
||||
nframes64_t pre_trim_last_frame = region->last_frame();
|
||||
|
||||
region->trim_end ((nframes64_t) (new_bound * speed), this);
|
||||
@ -2242,8 +2226,8 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire
|
||||
|
||||
bool regions_touching = false;
|
||||
|
||||
if (region_right != 0 && (pre_trim_last_frame == region_right->first_frame() - 1)){
|
||||
regions_touching = true;
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user