X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmainundo.C;h=2e960b3b2fb1c7f62ba01a6b84cf9fc1880508d1;hb=45a8ba3455cf252332c03533a7590df5267ce9aa;hp=ba9b6c337ed85ca1e1a8a824cc41add662e27783;hpb=3abbd84aa85907d646b13c98295ce778d2a71215;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/mainundo.C b/cinelerra-5.1/cinelerra/mainundo.C index ba9b6c33..2e960b3b 100644 --- a/cinelerra-5.1/cinelerra/mainundo.C +++ b/cinelerra-5.1/cinelerra/mainundo.C @@ -25,6 +25,7 @@ #include "clipedls.h" #include "edl.h" #include "filexml.h" +#include "indexfile.h" #include "mainindexes.h" #include "mainmenu.h" #include "mainsession.h" @@ -186,7 +187,9 @@ int MainUndo::redo_load_flags() int MainUndo::undo() { + mwindow->gui->close_keyvalue_popup(); mwindow->undo_commercial(); + UndoStackItem *current = undo_stack->current; if( current ) { undo_stack->current = next_undo(); @@ -216,14 +219,14 @@ int MainUndo::undo() } } + mwindow->reset_caches(1); reset_creators(); - mwindow->reset_caches(); return 0; } - int MainUndo::redo() { + mwindow->gui->close_keyvalue_popup(); UndoStackItem *current = next_redo(); if( current ) { undo_stack->current = current; @@ -243,8 +246,8 @@ int MainUndo::redo() update_caption(current ? current->get_description() : ""); } } + mwindow->reset_caches(1); reset_creators(); - mwindow->reset_caches(); //dump(); return 0; } @@ -253,25 +256,30 @@ int MainUndo::redo() // Here the master EDL loads int MainUndo::load_from_undo(FileXML *file, uint32_t load_flags) { - delete mwindow->gui->keyvalue_popup; - mwindow->gui->keyvalue_popup = 0; - if( load_flags & LOAD_SESSION ) { mwindow->gui->unlock_window(); mwindow->close_mixers(); mwindow->gui->lock_window("MainUndo::load_from_undo"); } - if( (load_flags & LOAD_ALL) == LOAD_ALL ) { - mwindow->edl->remove_user(); + EDL *prev_edl = mwindow->edl; + if( (load_flags & LOAD_ALL) == LOAD_ALL ) mwindow->init_edl(); - } mwindow->edl->load_xml(file, load_flags); for( Asset *asset=mwindow->edl->assets->first; asset; asset=asset->next ) { - mwindow->mainindexes->add_next_asset(0, asset); + mwindow->mainindexes->add_indexable(asset); } - for( int i=0; iedl->nested_edls.size(); ++i ) { - EDL *nested_edl = mwindow->edl->nested_edls[i]; - mwindow->mainindexes->add_next_asset(0, nested_edl); + if( prev_edl != mwindow->edl ) { + for( int i=0; iedl->nested_edls.size(); ++i ) { + EDL *nested_edl = mwindow->edl->nested_edls[i]; + if( !nested_edl->path[0] ) continue; + int k = prev_edl->nested_edls.size(); + while( --k >= 0 && // if nested edl was updated, force index rebuild + strcmp(nested_edl->path, prev_edl->nested_edls[k]->path) ); + if( k >= 0 && prev_edl->nested_edls[k]->equivalent_output(nested_edl) >= 0 ) + IndexFile::delete_index_files(mwindow->preferences, nested_edl); + mwindow->mainindexes->add_indexable(nested_edl); + } + prev_edl->remove_user(); } mwindow->mainindexes->start_build(); mwindow->update_plugin_guis(1);