{
//printf("Edits::insert_new_edit 1\n");
Edit *current = split_edit(position);
- if(current) current = PREVIOUS;
//printf("Edits::insert_new_edit 1\n");
Edit *new_edit = create_edit();
+ if( current ) new_edit->hard_right = current->hard_left;
+ if( current ) current = PREVIOUS;
+ if( current ) new_edit->hard_left = current->hard_right;
//printf("Edits::insert_new_edit 1\n");
insert_after(current, new_edit);
new_edit->startproject = position;
int64_t current_start = current->startproject;
int64_t next_end = next_edit->startproject + next_edit->length;
current->length = next_end - current_start;
+ current->hard_right = next_edit->hard_right;
remove(next_edit);
result = 1;
}
}
- if( last && last->silence() && !last->transition ) {
+ if( last && last->silence() &&
+ !last->transition && !last->hard_left && !last->hard_right ) {
delete last;
result = 1;
}
{
//printf("Edits::clear_recursive 1\n");
track->clear(start, end,
- edit_edits, edit_labels, edit_plugins, edit_autos, 0,
- trim_edits);
+ edit_edits, edit_labels, edit_plugins, edit_autos, trim_edits);
}
int Edits::modify_handles(double oldposition, double newposition, int currentend,
int edit_mode, int edit_edits, int edit_labels, int edit_plugins, int edit_autos,
- Edits *trim_edits)
+ Edits *trim_edits, int group_id)
{
int result = 0;
Edit *current_edit;
+ Edit *left = 0, *right = 0;
+ if( group_id > 0 ) {
+ double start = DBL_MAX, end = DBL_MIN;
+ for( Edit *edit=first; edit; edit=edit->next ) {
+ if( edit->group_id != group_id ) continue;
+ double edit_start = edit->track->from_units(edit->startproject);
+ if( edit_start < start ) { start = edit_start; left = edit; }
+ double edit_end = edit->track->from_units(edit->startproject+edit->length);
+ if( edit_end > end ) { end = edit_end; right = edit; }
+ }
+ }
//printf("Edits::modify_handles 1 %d %f %f\n", currentend, newposition, oldposition);
if(currentend == 0) {
// left handle
for(current_edit = first; current_edit && !result;) {
- if(edl->equivalent(track->from_units(current_edit->startproject),
- oldposition)) {
+ if( group_id > 0 ? current_edit == left :
+ edl->equivalent(track->from_units(current_edit->startproject),
+ oldposition) ) {
// edit matches selection
//printf("Edits::modify_handles 3 %f %f\n", newposition, oldposition);
+ double delta = newposition - oldposition;
oldposition = track->from_units(current_edit->startproject);
+ if( group_id > 0 ) newposition = oldposition + delta;
result = 1;
- if(newposition >= oldposition) {
+ if( newposition >= oldposition ) {
//printf("Edits::modify_handle 1 %s %f %f\n", track->title, oldposition, newposition);
// shift start of edit in
current_edit->shift_start_in(edit_mode,
edit_autos,
trim_edits);
}
- else
- {
+ else {
//printf("Edits::modify_handle 2 %s\n", track->title);
// move start of edit out
current_edit->shift_start_out(edit_mode,
else {
// right handle selected
for(current_edit = first; current_edit && !result;) {
- if(edl->equivalent(track->from_units(current_edit->startproject) +
- track->from_units(current_edit->length), oldposition)) {
- oldposition = track->from_units(current_edit->startproject) +
+ if( group_id > 0 ? current_edit == right :
+ edl->equivalent(track->from_units(current_edit->startproject) +
+ track->from_units(current_edit->length), oldposition) ) {
+ double delta = newposition - oldposition;
+ oldposition = track->from_units(current_edit->startproject) +
track->from_units(current_edit->length);
+ if( group_id > 0 ) newposition = oldposition + delta;
result = 1;
//printf("Edits::modify_handle 3\n");
return 0;
}
-
void Edits::paste_silence(int64_t start, int64_t end)
{
Edit *new_edit = editof(start, PLAY_FORWARD, 0);
if (!new_edit) return;
- if( !new_edit->silence() ) {
+ if( !new_edit->silence() || new_edit->hard_right ) {
new_edit = insert_new_edit(start);
new_edit->length = end - start;
}