Skip to content
Snippets Groups Projects
Commit 98a92f25 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

opt for temp files

parent 5dfdd249
No related branches found
No related tags found
No related merge requests found
...@@ -214,7 +214,7 @@ class CTX { ...@@ -214,7 +214,7 @@ class CTX {
int jpegQuality, jpegSmoothing, geoLabels, text, texAsEquation; int jpegQuality, jpegSmoothing, geoLabels, text, texAsEquation;
int gifDither, gifSort, gifInterlace, gifTransparent; int gifDither, gifSort, gifInterlace, gifTransparent;
int posElementary, posElement, posGamma, posEta, posRho, posDisto; int posElementary, posElement, posGamma, posEta, posRho, posDisto;
int compositeWindows; int compositeWindows, deleteTmpFiles;
} print; } print;
// color options // color options
struct{ struct{
......
...@@ -479,14 +479,14 @@ void CreateOutputFile(std::string fileName, int format) ...@@ -479,14 +479,14 @@ void CreateOutputFile(std::string fileName, int format)
char *args[] = {(char*)"gmsh", (char*)parFileName.c_str()}; char *args[] = {(char*)"gmsh", (char*)parFileName.c_str()};
try{ try{
mpeg_encode_main(2, args); 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){ catch (const char *error){
Msg::Error("mpeg_encode: %s", 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; break;
......
...@@ -1604,6 +1604,9 @@ StringXNumber PrintOptions_Number[] = { ...@@ -1604,6 +1604,9 @@ StringXNumber PrintOptions_Number[] = {
{ F|O, "CompositeWindows" , opt_print_composite_windows , 0. , { F|O, "CompositeWindows" , opt_print_composite_windows , 0. ,
"Composite all window tiles in the same output image (for bitmap output only)" }, "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. , { F|O, "EpsBackground" , opt_print_eps_background , 1. ,
"Save image background in PostScript/PDF output" }, "Save image background in PostScript/PDF output" },
{ F|O, "EpsBestRoot" , opt_print_eps_best_root , 1. , { F|O, "EpsBestRoot" , opt_print_eps_best_root , 1. ,
......
...@@ -8514,6 +8514,13 @@ double opt_print_composite_windows(OPT_ARGS_NUM) ...@@ -8514,6 +8514,13 @@ double opt_print_composite_windows(OPT_ARGS_NUM)
return CTX::instance()->print.compositeWindows; 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 // Color option routines
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
......
...@@ -736,6 +736,7 @@ double opt_print_gif_transparent(OPT_ARGS_NUM); ...@@ -736,6 +736,7 @@ double opt_print_gif_transparent(OPT_ARGS_NUM);
double opt_print_text(OPT_ARGS_NUM); double opt_print_text(OPT_ARGS_NUM);
double opt_print_tex_as_equation(OPT_ARGS_NUM); double opt_print_tex_as_equation(OPT_ARGS_NUM);
double opt_print_composite_windows(OPT_ARGS_NUM); double opt_print_composite_windows(OPT_ARGS_NUM);
double opt_print_delete_tmp_files(OPT_ARGS_NUM);
// COLORS // COLORS
......
...@@ -356,7 +356,7 @@ int mpegFileDialog(const char *name) ...@@ -356,7 +356,7 @@ int mpegFileDialog(const char *name)
struct _mpegFileDialog{ struct _mpegFileDialog{
Fl_Window *window; Fl_Window *window;
Fl_Round_Button *b[2]; Fl_Round_Button *b[2];
Fl_Check_Button *c[1]; Fl_Check_Button *c[2];
Fl_Value_Input *v[1]; Fl_Value_Input *v[1];
Fl_Button *ok, *cancel; Fl_Button *ok, *cancel;
}; };
...@@ -364,7 +364,7 @@ int mpegFileDialog(const char *name) ...@@ -364,7 +364,7 @@ int mpegFileDialog(const char *name)
if(!dialog){ if(!dialog){
dialog = new _mpegFileDialog; 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 = new Fl_Double_Window(w, h, "MPEG Options");
dialog->window->box(GMSH_WINDOW_BOX); dialog->window->box(GMSH_WINDOW_BOX);
dialog->window->set_modal(); dialog->window->set_modal();
...@@ -390,6 +390,10 @@ int mpegFileDialog(const char *name) ...@@ -390,6 +390,10 @@ int mpegFileDialog(const char *name)
(WB, y, 2 * BB + WB, BH, "Composite all window tiles"); y += BH; (WB, y, 2 * BB + WB, BH, "Composite all window tiles"); y += BH;
dialog->c[0]->type(FL_TOGGLE_BUTTON); 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->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->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel");
dialog->window->end(); dialog->window->end();
...@@ -400,6 +404,7 @@ int mpegFileDialog(const char *name) ...@@ -400,6 +404,7 @@ int mpegFileDialog(const char *name)
dialog->b[1]->value(CTX::instance()->post.animCycle); dialog->b[1]->value(CTX::instance()->post.animCycle);
dialog->v[0]->value(CTX::instance()->post.animDelay); dialog->v[0]->value(CTX::instance()->post.animDelay);
dialog->c[0]->value(CTX::instance()->print.compositeWindows); dialog->c[0]->value(CTX::instance()->print.compositeWindows);
dialog->c[1]->value(CTX::instance()->print.deleteTmpFiles);
dialog->window->show(); dialog->window->show();
while(dialog->window->shown()){ while(dialog->window->shown()){
...@@ -411,6 +416,7 @@ int mpegFileDialog(const char *name) ...@@ -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_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_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_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); CreateOutputFile(name, FORMAT_MPEG);
dialog->window->hide(); dialog->window->hide();
return 1; return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment