X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=73df71401e603fe569df21ebde0bac0dd3630c5b;hp=93e0a457aba68912903ef05b7d5fe21e10700cc1;hb=a6e4ede4b9a11b56b3aece044ff2a1546630ca38;hpb=2fba7eab40198b35d9edb20c16bcc1b8c262f7a2 diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 93e0a457..73df7140 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -301,6 +301,7 @@ MWindow::~MWindow() gui->del_keyboard_listener( (int (BC_WindowBase::*)(BC_WindowBase *)) &MWindowGUI::keyboard_listener); + reset_caches(); #if 0 // release the hounds if( awindow && awindow->gui ) awindow->gui->close(0); @@ -329,7 +330,6 @@ MWindow::~MWindow() gui->close(0); join(); #endif - reset_caches(); dead_plugins->remove_all_objects(); // must delete theme before destroying plugindb // theme destructor will be deleted by delete_plugins @@ -3081,7 +3081,6 @@ void MWindow::set_auto_keyframes(int value) gui->mbuttons->edit_panel->keyframe->update(value); gui->flush(); cwindow->gui->lock_window("MWindow::set_auto_keyframes"); - cwindow->gui->edit_panel->keyframe->update(value); cwindow->gui->flush(); cwindow->gui->unlock_window(); } @@ -3092,7 +3091,6 @@ void MWindow::set_span_keyframes(int value) gui->mbuttons->edit_panel->span_keyframe->update(value); gui->flush(); cwindow->gui->lock_window("MWindow::set_span_keyframes"); - cwindow->gui->edit_panel->span_keyframe->update(value); cwindow->gui->flush(); cwindow->gui->unlock_window(); } @@ -3781,7 +3779,7 @@ void MWindow::update_project(int load_mode) if(debug) PRINT_TRACE } -void MWindow::stack_push(EDL *new_edl, Indexable *idxbl) +void MWindow::stack_push(EDL *new_edl, Indexable *idxbl, Edit *edit) { int got_indexes = 0; for( int i=0; inested_edls.size(); ++i ) { @@ -3807,7 +3805,9 @@ void MWindow::stack_push(EDL *new_edl, Indexable *idxbl) undo_before(); StackItem &item = stack.append(); item.edl = edl; + item.edit = edit; item.new_edl = new_edl; + item.duration = new_edl->tracks->total_length(); item.undo = undo; item.idxbl = idxbl; item.mtime = 0; @@ -3840,6 +3840,17 @@ void MWindow::stack_pop() // session edl replaced, overwrite and save clip data if( item.new_edl != edl ) item.new_edl->overwrite_clip(edl); + Edit *edit = item.edit; +// resize the referring edit if the edl duration changed + if( edit ) { + double duration = item.new_edl->tracks->total_length(); + double dt = duration - item.duration; + if( fabs(dt) > 1e-4 ) { + int64_t du = edit->track->to_units(dt,0); + if( (edit->length+=du) < 0 ) + edit->length = 0; + } + } edl->remove_user(); edl = item.edl; delete undo; @@ -3849,6 +3860,7 @@ void MWindow::stack_pop() stack.remove(); if( idxbl ) { gui->unlock_window(); + gui->resource_thread->close_indexable(idxbl); remove_from_caches(idxbl); remove_indexfile(idxbl); mainindexes->add_indexable(idxbl); @@ -3952,6 +3964,7 @@ void MWindow::clip_to_media() return; } undo_before(); + awindow->gui->close_view_popup(); int clips_total = session->drag_clips->total; for( int i=0; idrag_clips->values[i]; @@ -4428,6 +4441,7 @@ int MWindow::create_aspect_ratio(float &w, float &h, int width, int height) void MWindow::reset_caches() { + awindow->gui->close_view_popup(); frame_cache->remove_all(); wave_cache->remove_all(); audio_cache->remove_all(); @@ -4451,6 +4465,7 @@ void MWindow::reset_caches() void MWindow::remove_from_caches(Indexable *idxbl) { + awindow->gui->close_view_popup(); frame_cache->remove_item(idxbl); wave_cache->remove_item(idxbl); if( gui->render_engine && @@ -4458,11 +4473,7 @@ void MWindow::remove_from_caches(Indexable *idxbl) delete gui->render_engine; gui->render_engine = 0; } - if( gui->resource_thread->render_engine_id == idxbl->id ) { - gui->resource_thread->render_engine_id = -1; - delete gui->resource_thread->render_engine; - gui->resource_thread->render_engine = 0; - } + gui->resource_thread->close_indexable(idxbl); if( !idxbl->is_asset ) return; Asset *asset = (Asset *)idxbl; audio_cache->delete_entry(asset); @@ -4488,6 +4499,7 @@ void MWindow::remove_from_caches(Indexable *idxbl) if( zwindow->zgui->playback_engine->video_cache ) zwindow->zgui->playback_engine->video_cache->delete_entry(asset); } + awindow->gui->start_vicon_drawing(); } void MWindow::remove_assets_from_project(int push_undo, int redraw, int delete_indexes, @@ -4648,6 +4660,14 @@ void MWindow::dump_exe(FILE *fp) fprintf(fp, "\n"); } +void MWindow::dump_caches(FILE *fp) +{ + fprintf(fp, "audio cache: "); + audio_cache->dump(fp); + fprintf(fp, "video cache: "); + video_cache->dump(fp); +} + void MWindow::trap_hook(FILE *fp, void *vp) { MWindow *mwindow = (MWindow *)vp; @@ -4659,6 +4679,8 @@ void MWindow::trap_hook(FILE *fp, void *vp) mwindow->dump_undo(fp); fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp); mwindow->dump_exe(fp); + fprintf(fp, "\nCACHES:\n"); + mwindow->dump_caches(fp); } @@ -5085,13 +5107,17 @@ PatchGUI *MWindow::get_patchgui(Track *track) return patchgui; } -int MWindow::get_cpus() +int MWindow::get_cpus(int out_w, int out_h) { - int out_w = edl->session->output_w; - int out_h = edl->session->output_h; + if( !out_w ) out_w = edl->session->output_w; + if( !out_h ) out_h = edl->session->output_h; int cpus = out_w*out_h/0x80000 + 1; if( cpus > preferences->processors ) cpus = preferences->processors; return cpus; } +int MWindow::get_cpus() +{ + return get_cpus(edl->session->output_w, edl->session->output_h); +}