X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fvwindow.C;h=451c71320e3be4f4794fb9483b9c89f1abbed6a4;hp=717972a1e663a15554cca1c1cd011f4535e113c4;hb=7ead44762b23da404eee89b63e0474153fdf58a1;hpb=ad2996ab94e6e12c9c14a5b9f14792f76111dff7 diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index 717972a1..451c7132 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -137,8 +137,6 @@ void VWindow::handle_done_event(int result) } } - - BC_Window* VWindow::new_gui() { //printf("VWindow::create_objects 1\n"); @@ -164,6 +162,12 @@ BC_Window* VWindow::new_gui() return gui; } +void VWindow::handle_close_event(int result) +{ + delete playback_engine; + playback_engine = 0; +} + EDL* VWindow::get_edl() { @@ -179,7 +183,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) ) @@ -196,14 +203,19 @@ 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(!running()) return; + if( playback_engine->is_playing_back ) + stop_playback(1); + // if(asset && this->asset && // asset->id == this->asset->id && // asset == this->asset) return; + gui->lock_window("VWindow::change_source 2"); //printf("VWindow::change_source %d\n", __LINE__); @@ -243,7 +255,7 @@ void VWindow::change_source(Indexable *indexable) if(asset) mwindow->asset_to_edl(this->edl, asset); else - mwindow->edl_to_nested(this->edl, nested_edl); + this->edl->to_nested(nested_edl); // Update GUI gui->change_source(this->edl, title); @@ -252,17 +264,23 @@ void VWindow::change_source(Indexable *indexable) //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) @@ -282,6 +300,7 @@ void VWindow::change_source(EDL *edl) } else gui->change_source(edl, _("Viewer")); + gui->unlock_window(); } @@ -328,14 +347,12 @@ void VWindow::update_position(int change_type, { //printf("VWindow::update_position %d\n", __LINE__); //edl->dump(); - playback_engine->que->send_command(CURRENT_FRAME, - change_type, - edl, - 1); + playback_engine->refresh_frame(change_type, edl); 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(); } } @@ -387,42 +404,31 @@ void VWindow::set_outpoint() } } -void VWindow::clear_inpoint() +void VWindow::unset_inoutpoint() { EDL *edl = get_edl(); if(edl) { - edl->local_session->unset_inpoint(); + edl->unset_inoutpoint(); gui->timebar->update(1); } } -void VWindow::clear_outpoint() +void VWindow::copy(int all) { EDL *edl = get_edl(); if(edl) { - edl->local_session->unset_outpoint(); - gui->timebar->update(1); - } -} - -void VWindow::copy() -{ - 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();