#include "clipedls.h"
#include "edl.h"
#include "filexml.h"
+#include "indexfile.h"
#include "mainindexes.h"
#include "mainmenu.h"
#include "mainsession.h"
int MainUndo::undo()
{
+ mwindow->gui->close_keyvalue_popup();
mwindow->undo_commercial();
+
UndoStackItem *current = undo_stack->current;
if( current ) {
undo_stack->current = next_undo();
}
if( current ) {
// Set the redo text to the current description
- if( mwindow->gui ) {
- UndoStackItem *next = NEXT;
- mwindow->gui->mainmenu->redo->
- update_caption(next ? next->get_description() : "");
- }
+ UndoStackItem *next = NEXT;
+ mwindow->gui->mainmenu->redo->
+ update_caption(next ? next->get_description() : "");
char *current_data = current->get_data();
if( current_data ) {
FileXML file;
}
}
+ 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;
update_caption(current ? current->get_description() : "");
}
}
+ mwindow->reset_caches(1);
reset_creators();
- mwindow->reset_caches();
//dump();
return 0;
}
// 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;
-
+ mwindow->hide_plugins();
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; i<mwindow->edl->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; i<mwindow->edl->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);