X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fvwindow.C;h=b6dc23c685bae7052b21a4b02e768a072d70f08f;hp=1bb3f0c355a29c8358630acdc719dc1939ef7991;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=8f0d97d1da0cd4cfcacf76c2c1788204749b6757 diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index 1bb3f0c3..b6dc23c6 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -77,26 +77,20 @@ void VWindow::delete_source(int do_main_edl, int update_gui) //printf("VWindow::delete_source %d %d %p %p\n", __LINE__, gui->get_window_lock(), edl, indexable); if(do_main_edl) mwindow->edl->remove_vwindow_edl(get_edl()); - if(edl) - { + if( edl ) { edl->Garbage::remove_user(); -//printf("VWindow::delete_source %d\n", __LINE__); edl = 0; } -// if(mwindow->edl->vwindow_edl && !mwindow->edl->vwindow_edl_shared) -// { -// mwindow->edl->vwindow_edl->Garbage::remove_user(); -// mwindow->edl->vwindow_edl = 0; -// mwindow->edl->vwindow_edl_shared = 0; -// } - -//printf("VWindow::delete_source %d\n", __LINE__); - if(indexable) indexable->Garbage::remove_user(); - indexable = 0; + if( indexable ) { + indexable->Garbage::remove_user(); + indexable = 0; + } - if(update_gui) gui->change_source(0, _("Viewer")); -//printf("VWindow::delete_source %d\n", __LINE__); + if( update_gui ) { + gui->change_source(0, _("Viewer")); + gui->clock->clear(); + } } @@ -183,7 +177,10 @@ Indexable* VWindow::get_source() void VWindow::change_source(int edl_number) { if(!is_running()) return; + if( playback_engine->is_playing_back ) + stop_playback(1); + gui->lock_window("VWindow::change_source 1"); //printf("VWindow::change_source %d %p\n", __LINE__, mwindow->edl->get_vwindow_edl(edl_number)); if( edl_number >= 0 && edl_number < mwindow->edl->total_vwindow_edls() && mwindow->edl->get_vwindow_edl(edl_number) ) @@ -200,73 +197,58 @@ void VWindow::change_source(int edl_number) // indexable = 0; // mwindow->edl->vwindow_edl_shared = 0; } + gui->unlock_window(); } void VWindow::change_source(Indexable *indexable) { + if( !indexable->is_asset ) { + change_source((EDL*)indexable); + return; + } if(!running()) return; -// if(asset && this->asset && -// asset->id == this->asset->id && -// asset == this->asset) return; + if( playback_engine->is_playing_back ) + stop_playback(1); -//printf("VWindow::change_source %d\n", __LINE__); + gui->lock_window("VWindow::change_source 2"); char title[BCTEXTLEN]; FileSystem fs; fs.extract_name(title, indexable->path); -//printf("VWindow::change_source 1\n"); - delete_source(1, 0); -//printf("VWindow::change_source 1\n"); - -// Generate EDL off of main EDL for cutting - Asset *asset = 0; - EDL *nested_edl = 0; - if(indexable->is_asset) - { - this->indexable = asset = new Asset; - asset->copy_from((Asset*)indexable, 0); - } - else - { - this->indexable = nested_edl = new EDL; - nested_edl->create_objects(); - nested_edl->copy_all((EDL*)indexable); - } // Create EDL this->edl = new EDL(mwindow->edl); this->edl->create_objects(); mwindow->edl->append_vwindow_edl(this->edl, 1); -// mwindow->edl->vwindow_edl = new EDL(mwindow->edl); -// mwindow->edl->vwindow_edl_shared = 0; -// mwindow->edl->vwindow_edl->create_objects(); - -//printf("VWindow::change_source 1 %d %p %p\n", __LINE__, asset, nested_edl); - if(asset) - mwindow->asset_to_edl(this->edl, asset); - else - mwindow->edl_to_nested(this->edl, nested_edl); +// Generate EDL off of main EDL for cutting + Asset *asset = new Asset; + asset->copy_from((Asset*)indexable, 0); + this->indexable = asset; + mwindow->asset_to_edl(this->edl, asset); // Update GUI gui->change_source(this->edl, title); update_position(CHANGE_ALL, 1, 1, 1); - - -//printf("VWindow::change_source 2\n"); + gui->unlock_window(); } void VWindow::change_source(EDL *edl) { if(!running()) return; + if( playback_engine->is_playing_back ) + stop_playback(1); + //printf("VWindow::change_source %d %p\n", __LINE__, edl); // EDLs are identical // if(edl && mwindow->edl->vwindow_edl && // edl->id == mwindow->edl->vwindow_edl->id) return; if(edl && get_edl() && edl->id == get_edl()->id) return; + gui->lock_window("VWindow::change_source 3"); + delete_source(1, 0); if(edl) @@ -274,7 +256,8 @@ void VWindow::change_source(EDL *edl) mwindow->edl->append_vwindow_edl(edl, 1); this->edl = edl; this->edl->Garbage::add_user(); - + edl->local_session->preview_start = 0; + edl->local_session->preview_end = -1; // mwindow->edl->vwindow_edl = edl; // in order not to later delete edl if it is shared // edl->Garbage::add_user(); @@ -286,6 +269,7 @@ void VWindow::change_source(EDL *edl) } else gui->change_source(edl, _("Viewer")); + gui->unlock_window(); } @@ -337,6 +321,7 @@ void VWindow::update_position(int change_type, double position = edl->local_session->get_selectionstart(1); if(lock_window) gui->lock_window("VWindow::update_position"); gui->clock->update(position); + gui->timebar->update(1); if(lock_window) gui->unlock_window(); } } @@ -398,22 +383,21 @@ void VWindow::unset_inoutpoint() } } -void VWindow::copy() +void VWindow::copy(int all) { EDL *edl = get_edl(); if(edl) { - double start = edl->local_session->get_selectionstart(); - double end = edl->local_session->get_selectionend(); + double start = all ? 0 : + edl->local_session->get_selectionstart(); + double end = all ? edl->tracks->total_length() : + edl->local_session->get_selectionend(); + EDL *copy_edl = new EDL; // no parent or assets wont be copied + copy_edl->create_objects(); + copy_edl->copy_all(edl); FileXML file; - edl->copy(start, - end, - 0, - 0, - 0, - &file, - "", - 1); + copy_edl->copy(start, end, 0, &file, "", 1); + copy_edl->remove_user(); const char *file_string = file.string(); long file_length = strlen(file_string); mwindow->gui->lock_window();