X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowedit.C;h=85b5f7439b1e94918e04d4955f3fb3e23b4c64cd;hb=8d1431081df60da0719db2c77e4c56830521c7e8;hp=b09300849d0eb1a4ad55eeec60d11df569ee4b53;hpb=4b6c39e6cf4a3fd9c1b347db6de686ab55d6cac8;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index b0930084..85b5f743 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -427,10 +427,8 @@ int MWindow::copy(double start, double end) edl->copy(start, end, 0, 0, 0, &file, "", 1); const char *file_string = file.string(); long file_length = strlen(file_string); - gui->get_clipboard()->to_clipboard(file_string, file_length, - SECONDARY_SELECTION); - gui->get_clipboard()->to_clipboard(file_string, file_length, - BC_PRIMARY_SELECTION); + gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION); + gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION); save_backup(); return 0; } @@ -443,10 +441,8 @@ int MWindow::copy_automation() edl->tracks->copy_automation(start, end, &file, 0, 1); const char *file_string = file.string(); long file_length = strlen(file_string); - gui->get_clipboard()->to_clipboard(file_string, file_length, - BC_PRIMARY_SELECTION); - gui->get_clipboard()->to_clipboard(file_string, file_length, - SECONDARY_SELECTION); + gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION); + gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION); return 0; } @@ -458,10 +454,8 @@ int MWindow::copy_default_keyframe() edl->tracks->copy_automation(start, end, &file, 1, 0); const char *file_string = file.string(); long file_length = strlen(file_string); - gui->get_clipboard()->to_clipboard(file_string, file_length, - BC_PRIMARY_SELECTION); - gui->get_clipboard()->to_clipboard(file_string, file_length, - SECONDARY_SELECTION); + gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION); + gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION); return 0; } @@ -1087,12 +1081,12 @@ void MWindow::paste() { double start = edl->local_session->get_selectionstart(); //double end = edl->local_session->get_selectionend(); - int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); + int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION); if( len ) { - char *string = new char[len + 1]; + char *string = new char[len]; undo->update_undo_before(); - gui->get_clipboard()->from_clipboard(string, len, BC_PRIMARY_SELECTION); + gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); clear(0); @@ -1153,15 +1147,11 @@ int MWindow::paste_assets(double position, Track *dest_track, int overwrite) } void MWindow::load_assets(ArrayList *new_assets, - double position, - int load_mode, - Track *first_track, - RecordLabels *labels, - int edit_labels, - int edit_plugins, - int edit_autos, - int overwrite) + double position, int load_mode, Track *first_track, RecordLabels *labels, + int edit_labels, int edit_plugins, int edit_autos, int overwrite) { + if( load_mode == LOADMODE_RESOURCESONLY ) + load_mode = LOADMODE_ASSETSONLY; const int debug = 0; if( debug ) printf("MWindow::load_assets %d\n", __LINE__); if( position < 0 ) position = edl->local_session->get_selectionstart(); @@ -1209,14 +1199,12 @@ if( debug ) printf("MWindow::load_assets %d\n", __LINE__); int MWindow::paste_automation() { - int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); + int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION); if( len ) { undo->update_undo_before(); - char *string = new char[len + 1]; - gui->get_clipboard()->from_clipboard(string, - len, - BC_PRIMARY_SELECTION); + char *string = new char[len]; + gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); @@ -1242,14 +1230,12 @@ int MWindow::paste_automation() int MWindow::paste_default_keyframe() { - int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); + int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION); if( len ) { undo->update_undo_before(); - char *string = new char[len + 1]; - gui->get_clipboard()->from_clipboard(string, - len, - BC_PRIMARY_SELECTION); + char *string = new char[len]; + gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); double start = edl->local_session->get_selectionstart(); @@ -1444,7 +1430,8 @@ int MWindow::paste_edls(ArrayList *new_edls, int load_mode, } //PRINT_TRACE // Insert edl - if( load_mode != LOADMODE_RESOURCESONLY ) { + if( load_mode != LOADMODE_RESOURCESONLY && + load_mode != LOADMODE_ASSETSONLY ) { // Insert labels //printf("MWindow::paste_edls %f %f\n", current_position, edl_length); if( load_mode == LOADMODE_PASTE || @@ -2026,9 +2013,11 @@ void MWindow::save_clip(EDL *new_edl, const char *txt) cp[n] = 0; edl->update_assets(new_edl); + int cur_x, cur_y; + gui->get_abs_cursor_xy(cur_x, cur_y, 0); gui->unlock_window(); - awindow->clip_edit->create_clip(new_edl); + awindow->clip_edit->create_clip(new_edl, cur_x, cur_y); gui->lock_window("MWindow::save_clip"); save_backup(); @@ -2285,6 +2274,67 @@ void MWindow::remap_audio(int pattern) } } +void MWindow::set_proxy(int use_scaler, int new_scale, + ArrayList *orig_assets, ArrayList *proxy_assets) +{ + int orig_use_scaler = edl->session->proxy_use_scaler; + int orig_scale = edl->session->proxy_scale; +// rescale to full size asset in read_frame + edl->session->proxy_use_scaler = use_scaler; + edl->session->proxy_scale = new_scale; + + if( use_scaler ) { + for( int i=0; isize(); ++i ) { + Asset *proxy_asset = (Asset *)proxy_assets->get(i); + proxy_asset->width = orig_assets->get(i)->get_w(); + proxy_asset->height = orig_assets->get(i)->get_h(); + } + new_scale = 1; + } + + if( !orig_use_scaler && new_scale != orig_scale ) { +// project size + float orig_w = (float)edl->session->output_w * orig_scale; + float orig_h = (float)edl->session->output_h * orig_scale; + edl->session->output_w = Units::round(orig_w / new_scale); + edl->session->output_h = Units::round(orig_h / new_scale); + +// track sizes + for( Track *track=edl->tracks->first; track; track=track->next ) { + if( track->data_type != TRACK_VIDEO ) continue; + orig_w = (float)track->track_w * orig_scale; + orig_h = (float)track->track_h * orig_scale; + track->track_w = Units::round(orig_w / new_scale); + track->track_h = Units::round(orig_h / new_scale); + ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])-> + set_proxy(orig_scale, new_scale); + } + } + +// change original assets to proxy assets + for( int i=0; isize(); i++ ) { + Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i)); +// replace track contents + for( Track *track = edl->tracks->first; track; track = track->next ) { + if( track->data_type != TRACK_VIDEO ) continue; + for( Edit *edit = track->edits->first; edit; edit = edit->next ) { + if( !edit->asset ) continue; + if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) { + edit->asset = proxy_asset; + } + } + } + } +} + void MWindow::cut_commercials() { undo->update_undo_before();