From: Good Guy Date: Tue, 18 Dec 2018 03:20:58 +0000 (-0700) Subject: repair selected_to_clipboard bug X-Git-Tag: 2019-08~146 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=d5d61fcb8b007418eb9f481ae61be2b4f738cd5b;p=goodguy%2Fcinelerra.git repair selected_to_clipboard bug --- diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 03319cfc..6e2df1c9 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -905,15 +905,16 @@ void MWindow::match_output_size(Track *track) void MWindow::selected_to_clipboard(int packed) { - int64_t start = INT64_MAX, end = -INT64_MAX, pos = 0; + double start = DBL_MAX, end = DBL_MIN; Track *first_track=0, *last_track = 0; for( Track *track=edl->tracks->first; track; track=track->next ) { if( !track->record ) continue; int empty = 1; for( Edit *edit=track->edits->first; edit; edit=edit->next ) { if( !edit->is_selected || edit->silence() ) continue; - if( start > (pos=edit->startproject) ) start = pos; - if( end < (pos+=edit->length) ) end = pos; + double edit_pos = track->from_units(edit->startproject); + if( start > edit_pos ) start = edit_pos; + if( end < (edit_pos+=edit->length) ) end = edit_pos; empty = 0; } if( empty ) continue; @@ -939,16 +940,18 @@ void MWindow::selected_to_clipboard(int packed) Track *new_track = 0; if( !packed ) new_track = new_edl->add_new_track(track->data_type); + int64_t start_pos = track->to_units(start, 0); + int64_t end_pos = track->to_units(end, 0); int64_t startproject = 0; for( Edit *edit=track->edits->first; edit; edit=edit->next ) { - if( edit->startproject < start ) continue; - if( edit->startproject >= end ) break; + if( edit->startproject < start_pos ) continue; + if( edit->startproject >= end_pos ) break; if( !edit->is_selected || edit->silence() ) continue; if( !new_track ) new_track = new_edl->add_new_track(track->data_type); if( new_track ) { if( !packed ) { - int64_t edit_position = edit->startproject - start; + int64_t edit_position = edit->startproject - start_pos; if( edit_position > startproject ) { Edit *silence = new Edit(new_edl, new_track); silence->startproject = startproject;