X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=bd75cbbac482ef4196b6bce9407d31febefdb27c;hb=dcaa99e024dc4eac8e22e94ca6c0a92d67570478;hp=cf9988903e223b44a15faf73eb77086f701cd79e;hpb=c1215e4fe370c818f83a8250475cb18cec69cc66;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index cf998890..bd75cbba 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -4124,6 +4124,7 @@ void MWindow::save_backup() sprintf(string2, _("Couldn't open %s for writing."), backup_path); gui->show_message(string2); } + save_undo_data(); } void MWindow::load_backup() @@ -4151,8 +4152,8 @@ void MWindow::load_backup() void MWindow::save_undo_data() { - undo_before(); - undo_after(_("perpetual session"), LOAD_ALL); + if( stack.size() > 0 ) return; + if( !preferences->perpetual_session ) return; char perpetual_path[BCTEXTLEN]; snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", File::get_config_path(), PERPETUAL_FILE); @@ -4164,15 +4165,27 @@ void MWindow::save_undo_data() void MWindow::load_undo_data() { + if( stack.size() > 0 ) return; + if( !preferences->perpetual_session ) return; char perpetual_path[BCTEXTLEN]; snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", File::get_config_path(), PERPETUAL_FILE); FILE *fp = fopen(perpetual_path,"r"); if( !fp ) return; undo->load(fp); + undo_before(); + undo_after(_("perpetual load"), LOAD_ALL); fclose(fp); } +void MWindow::remove_undo_data() +{ + if( stack.size() > 0 ) return; + char perpetual_path[BCTEXTLEN]; + snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s", + File::get_config_path(), PERPETUAL_FILE); + ::remove(perpetual_path); +} int MWindow::copy_target(const char *path, const char *target) {