diff --git a/Common/Context.h b/Common/Context.h index 45c61735ea4b7b6a17bb1237cb15d60b1668c390..694e850e023ef09a654bc798e3637fe4c3d14bb5 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -214,7 +214,7 @@ class CTX { int jpegQuality, jpegSmoothing, geoLabels, text, texAsEquation; int gifDither, gifSort, gifInterlace, gifTransparent; int posElementary, posElement, posGamma, posEta, posRho, posDisto; - int compositeWindows; + int compositeWindows, deleteTmpFiles; } print; // color options struct{ diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp index f8a16b916ac02cb33edda512bffb0186459d1540..1629b17a0bb07f35216bfd87d0f509d677671d16 100644 --- a/Common/CreateFile.cpp +++ b/Common/CreateFile.cpp @@ -479,14 +479,14 @@ void CreateOutputFile(std::string fileName, int format) char *args[] = {(char*)"gmsh", (char*)parFileName.c_str()}; try{ mpeg_encode_main(2, args); - UnlinkFile(parFileName); - for(unsigned int i = 0; i < frames.size(); i++) - UnlinkFile(CTX::instance()->homeDir + frames[i]); } catch (const char *error){ Msg::Error("mpeg_encode: %s", error); - Msg::Info("Temporary image were saved in: %s.gmsh-*.ppm", - CTX::instance()->homeDir.c_str()); + } + if(opt_print_delete_tmp_files(0, GMSH_GET, 0)){ + UnlinkFile(parFileName); + for(unsigned int i = 0; i < frames.size(); i++) + UnlinkFile(CTX::instance()->homeDir + frames[i]); } } break; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 8f0433905adb5d6683fb6326145aa7f5cf8a8078..f1f8fdb039c290841adc5d8bda9f14848991465f 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1604,6 +1604,9 @@ StringXNumber PrintOptions_Number[] = { { F|O, "CompositeWindows" , opt_print_composite_windows , 0. , "Composite all window tiles in the same output image (for bitmap output only)" }, + { F|O, "DeleteTemporaryFiles" , opt_print_delete_tmp_files , 1. , + "Delete temporary files used during printing" }, + { F|O, "EpsBackground" , opt_print_eps_background , 1. , "Save image background in PostScript/PDF output" }, { F|O, "EpsBestRoot" , opt_print_eps_best_root , 1. , diff --git a/Common/Options.cpp b/Common/Options.cpp index bd1c63736a2454cd468c7c50137758e90d2b9778..36d156561f52220403fbf0053ef8249c4e84bf68 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -8514,6 +8514,13 @@ double opt_print_composite_windows(OPT_ARGS_NUM) return CTX::instance()->print.compositeWindows; } +double opt_print_delete_tmp_files(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->print.deleteTmpFiles = (int)val; + return CTX::instance()->print.deleteTmpFiles; +} + // Color option routines #if defined(HAVE_FLTK) diff --git a/Common/Options.h b/Common/Options.h index 58eccd97a9a4a3b6247c2fb6e57c87caaed45107..0d1975287c61d56c620aca17721f2352de810b63 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -736,6 +736,7 @@ double opt_print_gif_transparent(OPT_ARGS_NUM); double opt_print_text(OPT_ARGS_NUM); double opt_print_tex_as_equation(OPT_ARGS_NUM); double opt_print_composite_windows(OPT_ARGS_NUM); +double opt_print_delete_tmp_files(OPT_ARGS_NUM); // COLORS diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index fff4053506ff0e1ce9bf0bfa4a8205c8fc6847cb..0013d9aed53bde45dbd0dd7c1f9b1f7560d79c82 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -356,7 +356,7 @@ int mpegFileDialog(const char *name) struct _mpegFileDialog{ Fl_Window *window; Fl_Round_Button *b[2]; - Fl_Check_Button *c[1]; + Fl_Check_Button *c[2]; Fl_Value_Input *v[1]; Fl_Button *ok, *cancel; }; @@ -364,7 +364,7 @@ int mpegFileDialog(const char *name) if(!dialog){ dialog = new _mpegFileDialog; - int h = 3 * WB + 5 * BH, w = 2 * BB + 3 * WB, y = WB; + int h = 3 * WB + 6 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "MPEG Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); @@ -390,6 +390,10 @@ int mpegFileDialog(const char *name) (WB, y, 2 * BB + WB, BH, "Composite all window tiles"); y += BH; dialog->c[0]->type(FL_TOGGLE_BUTTON); + dialog->c[1] = new Fl_Check_Button + (WB, y, 2 * BB + WB, BH, "Delete temporary files"); y += BH; + dialog->c[1]->type(FL_TOGGLE_BUTTON); + dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel"); dialog->window->end(); @@ -400,6 +404,7 @@ int mpegFileDialog(const char *name) dialog->b[1]->value(CTX::instance()->post.animCycle); dialog->v[0]->value(CTX::instance()->post.animDelay); dialog->c[0]->value(CTX::instance()->print.compositeWindows); + dialog->c[1]->value(CTX::instance()->print.deleteTmpFiles); dialog->window->show(); while(dialog->window->shown()){ @@ -411,6 +416,7 @@ int mpegFileDialog(const char *name) opt_post_anim_cycle(0, GMSH_SET | GMSH_GUI, (int)dialog->b[1]->value()); opt_post_anim_delay(0, GMSH_SET | GMSH_GUI, dialog->v[0]->value()); opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, (int)dialog->c[0]->value()); + opt_print_delete_tmp_files(0, GMSH_SET | GMSH_GUI, (int)dialog->c[1]->value()); CreateOutputFile(name, FORMAT_MPEG); dialog->window->hide(); return 1;