diff --git a/Common/Context.cpp b/Common/Context.cpp index b8481a4e2bde9c444aa1d4616db7aaef695362b4..40e8cebbd32af7143693f5d3f36a32018ce8d8dd 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -1,4 +1,4 @@ -// $Id: Context.cpp,v 1.36 2001-02-12 17:38:02 geuzaine Exp $ +// $Id: Context.cpp,v 1.37 2001-02-17 21:56:58 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -10,7 +10,7 @@ #include "DefaultOptions.h" #include "trackball.c" -extern Context_T CTX ; +extern Context_T CTX ; // STRING OPTIONS @@ -29,7 +29,7 @@ void Set_DefaultStringOptions(int num, StringXString s[]){ while(s[i].str) s[i].function(num, GMSH_SET, s[i++].def) ; } -void UpdateGUI_StringOptions(int num, StringXString s[]){ +void Set_StringOptions_GUI(int num, StringXString s[]){ int i = 0; while(s[i].str) s[i++].function(num, GMSH_GUI, 0) ; } @@ -43,12 +43,14 @@ void * Get_StringOption(char *str, StringXString s[]){ return (void*)s[i].function; } -void Print_StringOptions(int num, StringXString s[], char *prefix, FILE *file){ +void Print_StringOptions(int num, int level, StringXString s[], char *prefix, FILE *file){ int i = 0; char tmp[1024]; while(s[i].str){ - sprintf(tmp, "%s%s = \"%s\";", prefix, s[i].str, s[i].function(num, GMSH_GET, NULL)) ; - if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, "%s", tmp); + if(s[i].level & level){ + sprintf(tmp, "%s%s = \"%s\";", prefix, s[i].str, s[i].function(num, GMSH_GET, NULL)) ; + if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, "%s", tmp); + } i++; } } @@ -70,7 +72,7 @@ void Set_DefaultNumberOptions(int num, StringXNumber s[]){ while(s[i].str) s[i].function(num, GMSH_SET, s[i++].def) ; } -void UpdateGUI_NumberOptions(int num, StringXNumber s[]){ +void Set_NumberOptions_GUI(int num, StringXNumber s[]){ int i = 0; while(s[i].str) s[i++].function(num, GMSH_GUI, 0) ; } @@ -86,12 +88,14 @@ void * Get_NumberOption(char *str, StringXNumber s[]){ } } -void Print_NumberOptions(int num, StringXNumber s[], char *prefix, FILE *file){ +void Print_NumberOptions(int num, int level, StringXNumber s[], char *prefix, FILE *file){ int i = 0; char tmp[1024]; while(s[i].str){ - sprintf(tmp, "%s%s = %g;", prefix, s[i].str, s[i].function(num, GMSH_GET, 0)); - if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, tmp); + if(s[i].level & level){ + sprintf(tmp, "%s%s = %g;", prefix, s[i].str, s[i].function(num, GMSH_GET, 0)); + if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, tmp); + } i++; } } @@ -117,7 +121,7 @@ void Set_DefaultColorOptions(int num, StringXColor s[], int scheme){ } } -void UpdateGUI_ColorOptions(int num, StringXColor s[]){ +void Set_ColorOptions_GUI(int num, StringXColor s[]){ int i = 0; while(s[i].str) s[i++].function(num, GMSH_GUI, 0) ; } @@ -131,16 +135,18 @@ void * Get_ColorOption(char *str, StringXColor s[]) { return (void*)s[i].function; } -void Print_ColorOptions(int num, StringXColor s[], char *prefix, FILE *file){ +void Print_ColorOptions(int num, int level, StringXColor s[], char *prefix, FILE *file){ int i = 0; char tmp[1024]; while(s[i].str){ - sprintf(tmp, "%sColor.%s = {%d,%d,%d};", - prefix, s[i].str, - UNPACK_RED (s[i].function(num, GMSH_GET, 0)), - UNPACK_GREEN(s[i].function(num, GMSH_GET, 0)), - UNPACK_BLUE (s[i].function(num, GMSH_GET, 0))); - if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, tmp); + if(s[i].level & level){ + sprintf(tmp, "%sColor.%s = {%d,%d,%d};", + prefix, s[i].str, + UNPACK_RED (s[i].function(num, GMSH_GET, 0)), + UNPACK_GREEN(s[i].function(num, GMSH_GET, 0)), + UNPACK_BLUE (s[i].function(num, GMSH_GET, 0))); + if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, tmp); + } i++; } } @@ -163,47 +169,19 @@ int Get_ColorForString(StringX4Int SX4I[], int alpha, void Init_Context(int num){ - // Cannot be set by the user - CTX.expose = 0 ; - CTX.db = 1 ; - CTX.overlay = 1 ; - CTX.stream = TO_SCREEN ; - CTX.command_win = 0 ; - CTX.threads = 1 ; // effective on Unix only with -D_USETHREADS - CTX.threads_lock = 0 ; - - CTX.gl_fontheight = 12; - CTX.gl_fontascent = 8; - - // only used for motif - CTX.font = "-*-helvetica-medium-r-*-*-*-*-*-*-*-*-*-*" ; - CTX.fixed_font = "fixed" ; - // end(only used for motif) - - // only for fltk - CTX.fontsize = 12; - // end(fltk) - - CTX.lc = 1.0 ; - CTX.min[0] = CTX.min[1] = CTX.min[2] = 0.0 ; - CTX.max[0] = CTX.max[1] = CTX.max[2] = 1.0 ; - CTX.range[0] = CTX.range[1] = CTX.range[2] = 1.0 ; - - CTX.vxmin = CTX.vymin = CTX.vxmax = CTX.vymax = 0. ; - - CTX.render_mode = GMSH_RENDER ; - CTX.pixel_equiv_x = CTX.pixel_equiv_y = 0. ; - CTX.geom.vis_type = 0 ; - CTX.geom.level = ELEMENTARY ; - CTX.mesh.vis_type = 0 ; - CTX.mesh.draw = 1 ; - CTX.post.draw = 1 ; + // Reference view storing default options + Post_ViewReference = (Post_View*)Malloc(sizeof(Post_View)) ; + Post_ViewReference->CT.size = 255; + Post_ViewReference->CT.ipar[COLORTABLE_MODE] = COLORTABLE_RGB; + ColorTable_InitParam(1, &Post_ViewReference->CT, 1, 1); + ColorTable_Recompute(&Post_ViewReference->CT, 1, 1); // Default string options Set_DefaultStringOptions(num, GeneralOptions_String); Set_DefaultStringOptions(num, GeometryOptions_String); Set_DefaultStringOptions(num, MeshOptions_String); Set_DefaultStringOptions(num, PostProcessingOptions_String); + Set_DefaultStringOptions(num, ViewOptions_String); Set_DefaultStringOptions(num, PrintOptions_String); // Default number options @@ -211,41 +189,65 @@ void Init_Context(int num){ Set_DefaultNumberOptions(num, GeometryOptions_Number); Set_DefaultNumberOptions(num, MeshOptions_Number); Set_DefaultNumberOptions(num, PostProcessingOptions_Number); + Set_DefaultNumberOptions(num, ViewOptions_Number); Set_DefaultNumberOptions(num, PrintOptions_Number); // Default color options - Init_Colors(num); -} - -void Init_Colors(int num){ Set_DefaultColorOptions(num, GeneralOptions_Color, CTX.color_scheme); Set_DefaultColorOptions(num, GeometryOptions_Color, CTX.color_scheme); Set_DefaultColorOptions(num, MeshOptions_Color, CTX.color_scheme); Set_DefaultColorOptions(num, PostProcessingOptions_Color, CTX.color_scheme); + Set_DefaultColorOptions(num, ViewOptions_Color, CTX.color_scheme); Set_DefaultColorOptions(num, PrintOptions_Color, CTX.color_scheme); + + // The following cannot be set by the user + CTX.expose = 0 ; + CTX.db = 1 ; // motif only + CTX.overlay = 1 ; // motif only + CTX.stream = TO_SCREEN ; + CTX.command_win = 0 ; // motif only + CTX.threads = 1 ; // motif only + CTX.threads_lock = 0 ; // motif only + CTX.gl_fontheight = 12; + CTX.gl_fontascent = 8; + CTX.font = "-*-helvetica-medium-r-*-*-*-*-*-*-*-*-*-*" ; // motif only + CTX.fixed_font = "fixed" ; // motif only + CTX.lc = 1.0 ; + CTX.viewport[0] = CTX.viewport[1] = 0 ; + CTX.min[0] = CTX.min[1] = CTX.min[2] = 0.0 ; + CTX.max[0] = CTX.max[1] = CTX.max[2] = 1.0 ; + CTX.range[0] = CTX.range[1] = CTX.range[2] = 1.0 ; + CTX.vxmin = CTX.vymin = CTX.vxmax = CTX.vymax = 0. ; + CTX.render_mode = GMSH_RENDER ; + CTX.pixel_equiv_x = CTX.pixel_equiv_y = 0. ; + CTX.geom.vis_type = 0 ; + CTX.geom.level = ELEMENTARY ; + CTX.mesh.vis_type = 0 ; + CTX.mesh.draw = 1 ; + CTX.post.draw = 1 ; } -void UpdateGUI_Context(int num){ - UpdateGUI_StringOptions(num, GeneralOptions_String); - UpdateGUI_StringOptions(num, GeometryOptions_String); - UpdateGUI_StringOptions(num, MeshOptions_String); - UpdateGUI_StringOptions(num, PostProcessingOptions_String); - UpdateGUI_StringOptions(num, PrintOptions_String); +void Init_Context_GUI(int num){ + Set_StringOptions_GUI(num, GeneralOptions_String); + Set_StringOptions_GUI(num, GeometryOptions_String); + Set_StringOptions_GUI(num, MeshOptions_String); + Set_StringOptions_GUI(num, PostProcessingOptions_String); + Set_StringOptions_GUI(num, PrintOptions_String); - UpdateGUI_NumberOptions(num, GeneralOptions_Number); - UpdateGUI_NumberOptions(num, GeometryOptions_Number); - UpdateGUI_NumberOptions(num, MeshOptions_Number); - UpdateGUI_NumberOptions(num, PostProcessingOptions_Number); - UpdateGUI_NumberOptions(num, PrintOptions_Number); - - UpdateGUI_ColorOptions(num, GeneralOptions_Color); - UpdateGUI_ColorOptions(num, GeometryOptions_Color); - UpdateGUI_ColorOptions(num, MeshOptions_Color); - UpdateGUI_ColorOptions(num, PostProcessingOptions_Color); - UpdateGUI_ColorOptions(num, PrintOptions_Color); + Set_NumberOptions_GUI(num, GeneralOptions_Number); + Set_NumberOptions_GUI(num, GeometryOptions_Number); + Set_NumberOptions_GUI(num, MeshOptions_Number); + Set_NumberOptions_GUI(num, PostProcessingOptions_Number); + Set_NumberOptions_GUI(num, PrintOptions_Number); + + Set_ColorOptions_GUI(num, GeneralOptions_Color); + Set_ColorOptions_GUI(num, GeometryOptions_Color); + Set_ColorOptions_GUI(num, MeshOptions_Color); + Set_ColorOptions_GUI(num, PostProcessingOptions_Color); + Set_ColorOptions_GUI(num, PrintOptions_Color); } -void Print_Context(int num, char *filename){ +void Print_Context(int num, int level, char *filename){ FILE *file; char tmp[256]; int i ; @@ -260,67 +262,66 @@ void Print_Context(int num, char *filename){ else file = NULL ; - Print_StringOptions(num, GeneralOptions_String, "General.", file); - Print_NumberOptions(num, GeneralOptions_Number, "General.", file); - Print_ColorOptions(num, GeneralOptions_Color, "General.", file); - Print_StringOptions(num, GeometryOptions_String, "Geometry.", file); - Print_NumberOptions(num, GeometryOptions_Number, "Geometry.", file); - Print_ColorOptions(num, GeometryOptions_Color, "Geometry.", file); - Print_StringOptions(num, MeshOptions_String, "Mesh.", file); - Print_NumberOptions(num, MeshOptions_Number, "Mesh.", file); - Print_ColorOptions(num, MeshOptions_Color, "Mesh.", file); - Print_StringOptions(num, PostProcessingOptions_String, "PostProcessing.", file); - Print_NumberOptions(num, PostProcessingOptions_Number, "PostProcessing.", file); - Print_ColorOptions(num, PostProcessingOptions_Color, "PostProcessing.", file); - for(i=0; i<List_Nbr(Post_ViewList) ; i++){ - sprintf(tmp, "View[%d].", i); - Print_StringOptions(i, ViewOptions_String, tmp, file); - Print_NumberOptions(i, ViewOptions_Number, tmp, file); - Print_ColorOptions(i, ViewOptions_Color, tmp, file); - strcat(tmp, "ColorTable"); - Print_ColorTable(i, tmp, file); + if((level & GMSH_SESSIONRC) && file){ + fprintf(file, "// Gmsh Session File\n"); + fprintf(file, "// This file takes session specific info (that is info\n"); + fprintf(file, "// you want to keep between two Gmsh sessions). You are\n"); + fprintf(file, "// not supposed to edit it manually, but of course you\n"); + fprintf(file, "// can do. This file will be entirely rewritten every time\n"); + fprintf(file, "// you quit Gmsh. If this file isn't found, defaults\n"); + fprintf(file, "// are used.\n"); } - Print_StringOptions(num, PrintOptions_String, "Print.", file); - Print_NumberOptions(num, PrintOptions_Number, "Print.", file); - Print_ColorOptions(num, PrintOptions_Color, "Print.", file); - if(filename){ - Msg(INFO, "Options Output Complete '%s'", filename); - Msg(STATUS2, "Wrote File '%s'", filename); - fclose(file); + if((level & GMSH_OPTIONSRC) && file){ + fprintf(file, "// Gmsh Option File\n"); + fprintf(file, "// This file takes configuration options that should\n"); + fprintf(file, "// be loaded each time Gmsh is launched. You can create\n"); + fprintf(file, "// this file by hand, or let Gmsh generate it for you (with\n"); + fprintf(file, "// the 'File->Save Options' menu button). If this file\n"); + fprintf(file, "// isn't found, defaults are used.\n"); } -} -void Print_Configuration(int num, char *filename){ - FILE *file; - - file = fopen(filename,"w"); - if(!file){ - Msg(WARNING, "Unable to Open File '%s'", filename); - return; + Print_StringOptions(num, level, GeneralOptions_String, "General.", file); + Print_NumberOptions(num, level, GeneralOptions_Number, "General.", file); + Print_ColorOptions(num, level, GeneralOptions_Color, "General.", file); + Print_StringOptions(num, level, GeometryOptions_String, "Geometry.", file); + Print_NumberOptions(num, level, GeometryOptions_Number, "Geometry.", file); + Print_ColorOptions(num, level, GeometryOptions_Color, "Geometry.", file); + Print_StringOptions(num, level, MeshOptions_String, "Mesh.", file); + Print_NumberOptions(num, level, MeshOptions_Number, "Mesh.", file); + Print_ColorOptions(num, level, MeshOptions_Color, "Mesh.", file); + Print_StringOptions(num, level, PostProcessingOptions_String, "PostProcessing.", file); + Print_NumberOptions(num, level, PostProcessingOptions_Number, "PostProcessing.", file); + Print_ColorOptions(num, level, PostProcessingOptions_Color, "PostProcessing.", file); + if(level & GMSH_FULLRC){ + for(i=0; i<List_Nbr(Post_ViewList) ; i++){ + sprintf(tmp, "View[%d].", i); + Print_StringOptions(i, level, ViewOptions_String, tmp, file); + Print_NumberOptions(i, level, ViewOptions_Number, tmp, file); + Print_ColorOptions(i, level, ViewOptions_Color, tmp, file); + strcat(tmp, "ColorTable"); + Print_ColorTable(i, tmp, file); + } } + else if(level & GMSH_OPTIONSRC){ + Print_StringOptions(num, level, ViewOptions_String, "View.", file); + Print_NumberOptions(num, level, ViewOptions_Number, "View.", file); + Print_ColorOptions(num, level, ViewOptions_Color, "View.", file); + Print_ColorTable(num, "View.ColorTable", file); + } + Print_StringOptions(num, level, PrintOptions_String, "Print.", file); + Print_NumberOptions(num, level, PrintOptions_Number, "Print.", file); + Print_ColorOptions(num, level, PrintOptions_Color, "Print.", file); - fprintf(file, "// Gmsh sessionrc\n"); - fprintf(file, "// This file takes session-specific info (that is info\n"); - fprintf(file, "// you want to keep between two Gmsh sessions). You are\n"); - fprintf(file, "// not supposed to edit it manually, but of course you\n"); - fprintf(file, "// can do. This file will be entirely rewritten every time\n"); - fprintf(file, "// you quit Gmsh. If this file isn't found, defaults\n"); - fprintf(file, "// are used.\n"); - fprintf(file, "General.Viewport0 = %d;\n", CTX.viewport[0]); - fprintf(file, "General.Viewport1 = %d;\n", CTX.viewport[1]); - fprintf(file, "General.Viewport2 = %d;\n", CTX.viewport[2]); - fprintf(file, "General.Viewport3 = %d;\n", CTX.viewport[3]); - fprintf(file, "General.GraphicsFontSize = %d;\n", CTX.gl_fontsize); - fprintf(file, "General.GraphicsPosition0 = %d;\n", CTX.gl_position[0]); - fprintf(file, "General.GraphicsPosition1 = %d;\n", CTX.gl_position[1]); - fprintf(file, "General.MenuFontSize = %d;\n", CTX.fontsize); - fprintf(file, "General.MenuPosition0 = %d;\n", CTX.position[0]); - fprintf(file, "General.MenuPosition1 = %d;\n", CTX.position[1]); - fclose(file); + if(filename){ + if((level & GMSH_OPTIONSRC) || (level & GMSH_FULLRC)){ + Msg(INFO, "Options Output Complete '%s'", filename); + Msg(STATUS2, "Wrote '%s'", filename); + } + fclose(file); + } } - /* 3 rotations successives autour de x, y et z: diff --git a/Common/Context.h b/Common/Context.h index b6529a03cce21a617651d7d36cf28cef6631c704..e9e4a4a5bf73f9c56a43008baa5a964eaec3d680 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -28,12 +28,21 @@ public : // general options char filename[NAME_STR_L]; // the name of the currently opened file char basefilename[NAME_STR_L]; // the same without the extension - char *configfilename; // the name of the configuration file + char *default_filename; // the name of the default file + char *tmp_filename; // the name of the temp file + char *session_filename, sessionrc_filename[NAME_STR_L]; + // the name of the sessionrc configuration file + char *options_filename, optionsrc_filename[NAME_STR_L]; + // the name of the optionrc configuration file + int session_save, options_save; // save session/option file on exit + char *error_filename; // the name of the error file char *display; // forced display host:0.0 under X11 int terminal; // show we print to the terminal console? int position[2]; // position of the menu window on the screen int gl_position[2]; // position of the graphic window on the screen + int msg_position[2]; // position of the message window on the screen + int msg_size[2]; // size of the message window on the screen int center_windows; // center popup windows on the menu window int interactive; // 0=full gfx; -1=just parse; 1,2,3=batch mesh @@ -83,13 +92,14 @@ public : double vxmin, vxmax, vymin, vymax; // current viewport in real coordinates int light[6]; // status of light float light_position[6][4]; // light sources positions + int moving_light; // type of light (follows the model or not) float shine; // specular value int render_mode; // GMSH_RENDER, GMSH_SELECT, GMSH_FEEDBACK int clip[6]; // status of clip planes double clip_plane[6][4]; // clip planes double pixel_equiv_x, pixel_equiv_y ; // approximative equivalent model length of a pixel - int color_scheme ; + int color_scheme ; // general color scheme // geometry options struct{ @@ -101,6 +111,7 @@ public : int level, old_circle; double normals, tangents; double scaling_factor; + int color_scheme ; } geom; // mesh options @@ -117,6 +128,7 @@ public : int format, nb_smoothing, algo, degree; int point_insertion, speed_max, min_circ_points; double normals, tangents, explode; + int color_scheme, color_carousel ; int use_cut_plane; double cut_planea,cut_planeb,cut_planec,cut_planed; double evalCutPlane (double x, double y, double z) @@ -132,7 +144,7 @@ public : struct{ int draw, scales, link ; int smooth ; - int initial_visibility, initial_nbiso, initial_intervals, nb_views ; + int nb_views ; double anim_delay ; }post; @@ -170,9 +182,7 @@ public : }; void Init_Context (int num); -void Init_Colors (int num); -void UpdateGUI_Context (int num); -void Print_Context(int num, char *filename); -void Print_Configuration(int num, char *filename); +void Init_Context_GUI (int num); +void Print_Context(int num, int level, char *filename); #endif diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index cff7f72d85c076626f041dcbe9071acc0719e5f4..2f06a9a3f5e7d4e580c5aa4707467ed6fe96a083 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,10 +1,11 @@ -// $Id: GetOptions.cpp,v 1.10 2001-02-12 17:38:02 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.11 2001-02-17 21:56:58 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" #include "GmshVersion.h" #include "Const.h" #include "Context.h" +#include "Options.h" #include "Geo.h" #include "Mesh.h" #include "Views.h" @@ -27,54 +28,55 @@ char gmsh_url[] = "URL : http://www.geuz.org/gmsh/" ; char gmsh_email[] = "E-Mail : Christophe.Geuzaine@ulg.ac.be\n" " Remacle@scorec.rpi.edu" ; -char gmsh_options[] = - "Usage: %s [options] [files]\n" - "Geometry options:\n" - " -0 parse input files, output flattened geometry, and exit\n" - "Mesh options:\n" - " -1, -2, -3 perform batch 1D, 2D and 3D mesh generation\n" - " -format msh|unv|gref set output mesh format (default: msh)\n" - " -algo iso|aniso select 2D mesh algorithm (default: iso)\n" - " -smooth int set mesh smoothing (default: 0)\n" - " -degree int set mesh degree (default: 1)\n" - " -scale float set global scaling factor (default: 1.0)\n" - " -meshscale float set mesh scaling factor (default: 1.0)\n" - " -clscale float set characteristic length scaling factor (default: 1.0)\n" - " -rand float set random perturbation factor (default: 1.e-5)\n" - " -bgm file load backround mesh from file\n" +void Print_Options(char *name){ + Msg(DIRECT, "Usage: %s [options] [files]", name); + Msg(DIRECT, "Geometry options:"); + Msg(DIRECT, " -0 parse input files, output flattened geometry, and exit"); + Msg(DIRECT, "Mesh options:"); + Msg(DIRECT, " -1, -2, -3 perform batch 1D, 2D and 3D mesh generation"); + Msg(DIRECT, " -format msh|unv|gref set output mesh format (default: msh)"); + Msg(DIRECT, " -algo iso|aniso select 2D mesh algorithm (default: iso)"); + Msg(DIRECT, " -smooth int set mesh smoothing (default: 0)"); + Msg(DIRECT, " -degree int set mesh degree (default: 1)"); + Msg(DIRECT, " -scale float set global scaling factor (default: 1.0)"); + Msg(DIRECT, " -meshscale float set mesh scaling factor (default: 1.0)"); + Msg(DIRECT, " -clscale float set characteristic length scaling factor (default: 1.0)"); + Msg(DIRECT, " -rand float set random perturbation factor (default: 1.e-4)"); + Msg(DIRECT, " -bgm file load backround mesh from file"); #ifndef _BLACKBOX - " -interactive display 2D mesh construction interactively\n" - "Post Processing options:\n" - " -dl enable display lists\n" - " -noview hide all views on startup\n" - " -link link all views on startup\n" - "Display options:\n" + Msg(DIRECT, " -interactive display 2D mesh construction interactively"); + Msg(DIRECT, "Post Processing options:"); + Msg(DIRECT, " -dl enable display lists"); + Msg(DIRECT, " -noview hide all views on startup"); + Msg(DIRECT, " -link link all views on startup"); + Msg(DIRECT, " -convert file file convert an ascii view into a binary one"); + Msg(DIRECT, "Display options:"); #ifdef _MOTIF - " -nodb disable double buffering\n" - " -noov disable overlay visual\n" - " -flash allow colormap flashing\n" - " -samevisual force same visual for graphics and UI\n" + Msg(DIRECT, " -nodb disable double buffering"); + Msg(DIRECT, " -noov disable overlay visual"); + Msg(DIRECT, " -flash allow colormap flashing"); + Msg(DIRECT, " -samevisual force same visual for graphics and UI"); #else - " -fontsize int size of the font for the user interface (default: 12)\n" + Msg(DIRECT, " -fontsize int size of the font for the user interface (default: 12)"); #endif - " -alpha enable alpha blending\n" - " -notrack don't use trackball mode for rotations\n" - " -display string specify display\n" - " -perspective set projection mode to perspective\n" + Msg(DIRECT, " -alpha enable alpha blending"); + Msg(DIRECT, " -notrack don't use trackball mode for rotations"); + Msg(DIRECT, " -display string specify display"); + Msg(DIRECT, " -perspective set projection mode to perspective"); #endif - "Other options:\n" + Msg(DIRECT, "Other options:"); #ifndef _BLACKBOX - " -v int set verbosity level (default: 2)\n" + Msg(DIRECT, " -v int set verbosity level (default: 2)"); #else - " -v be verbose\n" + Msg(DIRECT, " -v be verbose"); #endif #ifdef _MOTIF - " -nothreads disable threads\n" + Msg(DIRECT, " -nothreads disable threads"); #endif - " -version show version number\n" - " -info show detailed version information\n" - " -help show this message\n" - ; + Msg(DIRECT, " -version show version number"); + Msg(DIRECT, " -info show detailed version information"); + Msg(DIRECT, " -help show this message"); +} void Get_Options (int argc, char *argv[], int *nbfiles) { @@ -85,14 +87,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { if(argc < 2) Info(0,argv[0]); #endif - // Get default options in the configuration file - // we should do something more clever here (in $HOME?) - CTX.configfilename = ".gmshrc"; - ParseFile(CTX.configfilename); + // Parse session and option files + + ParseFile(CTX.sessionrc_filename); + ParseFile(CTX.optionsrc_filename); // Get command line options - TheFileNameTab[0] = "unnamed.geo" ; + TheFileNameTab[0] = CTX.default_filename ; *nbfiles = 0; while (i < argc) { @@ -119,6 +121,20 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { exit(1); } } + else if(!strcmp(argv[i]+1, "convert")){ + i++; + CTX.terminal = 1; + if(argv[i] && argv[i+1]){ + ParseFile(argv[i]); + if(List_Nbr(Post_ViewList)) + Write_View(1,(Post_View*)List_Pointer(Post_ViewList, 0),argv[i+1]); + else + fprintf(stderr, ERROR_STR "No view to convert\n"); + } + else + fprintf(stderr, "Usage: %s -convert view.ascii view.binary\n", argv[0]); + exit(1); + } else if(!strcmp(argv[i]+1, "old")){ CTX.geom.old_circle = 1; i++; } @@ -267,7 +283,8 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { !strcmp(argv[i]+1, "-help")){ fprintf(stderr, "%s\n", gmsh_progname); fprintf(stderr, "%s\n", gmsh_copyright); - fprintf(stderr, gmsh_options, argv[0]); + CTX.terminal = 1 ; + Print_Options(argv[0]); exit(1); } @@ -285,9 +302,12 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { exit(1); } } - else if(!strcmp(argv[i]+1, "noterminal")){ + else if(!strcmp(argv[i]+1, "noterm")){ CTX.terminal = 0; i++; } + else if(!strcmp(argv[i]+1, "term")){ + CTX.terminal = 1; i++; + } else if(!strcmp(argv[i]+1, "alpha")){ CTX.alpha = 1; i++; } @@ -307,17 +327,18 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { CTX.mesh.interactive = 1; i++; } else if(!strcmp(argv[i]+1, "noview")){ - CTX.post.initial_visibility = 0 ; i++; + opt_view_visible(0, GMSH_SET, 0); i++; } else if(!strcmp(argv[i]+1, "link")){ CTX.post.link = 2 ; i++; } else if(!strcmp(argv[i]+1, "fill")){ - CTX.post.initial_intervals = DRAW_POST_CONTINUOUS ; i++; + opt_view_intervals_type(0, GMSH_SET, DRAW_POST_CONTINUOUS) ; i++; } else if(!strcmp(argv[i]+1, "nbiso")){ i++ ; - if(argv[i]!=NULL) CTX.post.initial_nbiso = atoi(argv[i++]); + if(argv[i]!=NULL) + opt_view_nb_iso(0, GMSH_SET, atoi(argv[i++])); else{ fprintf(stderr, ERROR_STR "Missing Number\n"); exit(1); @@ -395,7 +416,8 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { else{ fprintf(stderr, "Unknown Option '%s'\n", argv[i]); - fprintf(stderr, gmsh_options, argv[0]); + CTX.terminal = 1 ; + Print_Options(argv[0]); exit(1); } } diff --git a/Common/GetOptions.h b/Common/GetOptions.h index 12891821bf005cff1bc862d4955a3b2d4809c150..cbac01cf89685befe28c40724df9696aabf23af8 100644 --- a/Common/GetOptions.h +++ b/Common/GetOptions.h @@ -3,11 +3,12 @@ extern char gmsh_progname[], gmsh_copyright[], gmsh_version[], gmsh_os[]; extern char gmsh_date[], gmsh_host[], gmsh_packager[], gmsh_url[]; -extern char gmsh_email[], gmsh_gui[], gmsh_options[]; +extern char gmsh_email[], gmsh_gui[]; extern char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName; extern char ThePathForIncludes[NAME_STR_L]; void Get_Options (int argc, char *argv[], int *nbfiles); +void Print_Options (char *name); #endif diff --git a/Common/Makefile b/Common/Makefile index 3fd1b5ee47b6e583343ef6f9c9ad4e5f1edfedb4..94a56511529ce314d9893a30bb831d697faa1076 100644 --- a/Common/Makefile +++ b/Common/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.13 2001-02-12 17:42:18 geuzaine Exp $ +# $Id: Makefile,v 1.14 2001-02-17 21:56:58 geuzaine Exp $ # # Makefile for "libCommon.a" # @@ -78,7 +78,7 @@ Options.o: Options.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ Const.h Options.h GetOptions.o: GetOptions.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h \ - ../DataStr/Tools.h GmshUI.h GmshVersion.h Const.h Context.h \ + ../DataStr/Tools.h GmshUI.h GmshVersion.h Const.h Context.h Options.h \ ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Views.h \ ColorTable.h ../Parser/OpenFile.h ../Common/Const.h diff --git a/Common/Options.h b/Common/Options.h index 8ec882d591fa93435a0b557731f964ea2ac14ddc..d2330c3865ffc98ec5e644d40e2eb8fcc8aaf22d 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -5,6 +5,10 @@ #define GMSH_GET (1<<1) #define GMSH_GUI (1<<2) +#define GMSH_SESSIONRC (1<<0) +#define GMSH_OPTIONSRC (1<<1) +#define GMSH_FULLRC (1<<2) + #define OPT_ARGS_STR int num, int action, char *val #define OPT_ARGS_NUM int num, int action, double val #define OPT_ARGS_COL int num, int action, unsigned int val @@ -15,6 +19,11 @@ // STRINGS char * opt_general_display(OPT_ARGS_STR); +char * opt_general_default_filename(OPT_ARGS_STR); +char * opt_general_tmp_filename(OPT_ARGS_STR); +char * opt_general_error_filename(OPT_ARGS_STR); +char * opt_general_session_filename(OPT_ARGS_STR); +char * opt_general_options_filename(OPT_ARGS_STR); char * opt_view_name(OPT_ARGS_STR); char * opt_view_format(OPT_ARGS_STR); char * opt_view_filename(OPT_ARGS_STR); @@ -22,17 +31,21 @@ char * opt_print_font(OPT_ARGS_STR); // NUMBERS -double opt_general_viewport0(OPT_ARGS_NUM); -double opt_general_viewport1(OPT_ARGS_NUM); -double opt_general_viewport2(OPT_ARGS_NUM); -double opt_general_viewport3(OPT_ARGS_NUM); +double opt_general_fontsize(OPT_ARGS_NUM); +double opt_general_graphics_fontsize(OPT_ARGS_NUM); double opt_general_graphics_position0(OPT_ARGS_NUM); double opt_general_graphics_position1(OPT_ARGS_NUM); -double opt_general_graphics_fontsize(OPT_ARGS_NUM); +double opt_general_viewport2(OPT_ARGS_NUM); +double opt_general_viewport3(OPT_ARGS_NUM); double opt_general_menu_position0(OPT_ARGS_NUM); double opt_general_menu_position1(OPT_ARGS_NUM); -double opt_general_menu_fontsize(OPT_ARGS_NUM); +double opt_general_message_position0(OPT_ARGS_NUM); +double opt_general_message_position1(OPT_ARGS_NUM); +double opt_general_message_size0(OPT_ARGS_NUM); +double opt_general_message_size1(OPT_ARGS_NUM); double opt_general_center_windows(OPT_ARGS_NUM); +double opt_general_session_save(OPT_ARGS_NUM); +double opt_general_options_save(OPT_ARGS_NUM); double opt_general_rotation0(OPT_ARGS_NUM); double opt_general_rotation1(OPT_ARGS_NUM); double opt_general_rotation2(OPT_ARGS_NUM); @@ -88,6 +101,7 @@ double opt_general_clip5a(OPT_ARGS_NUM); double opt_general_clip5b(OPT_ARGS_NUM); double opt_general_clip5c(OPT_ARGS_NUM); double opt_general_clip5d(OPT_ARGS_NUM); +double opt_general_moving_light(OPT_ARGS_NUM); double opt_general_light0(OPT_ARGS_NUM); double opt_general_light00(OPT_ARGS_NUM); double opt_general_light01(OPT_ARGS_NUM); @@ -122,11 +136,11 @@ double opt_geometry_points_num(OPT_ARGS_NUM); double opt_geometry_lines_num(OPT_ARGS_NUM); double opt_geometry_surfaces_num(OPT_ARGS_NUM); double opt_geometry_volumes_num(OPT_ARGS_NUM); -double opt_geometry_hidden(OPT_ARGS_NUM); -double opt_geometry_shade(OPT_ARGS_NUM); +double opt_geometry_aspect(OPT_ARGS_NUM); double opt_geometry_highlight(OPT_ARGS_NUM); double opt_geometry_old_circle(OPT_ARGS_NUM); double opt_geometry_scaling_factor(OPT_ARGS_NUM); +double opt_geometry_color_scheme(OPT_ARGS_NUM); double opt_mesh_quality(OPT_ARGS_NUM); double opt_mesh_normals(OPT_ARGS_NUM); double opt_mesh_tangents(OPT_ARGS_NUM); @@ -145,8 +159,7 @@ double opt_mesh_points_num(OPT_ARGS_NUM); double opt_mesh_lines_num(OPT_ARGS_NUM); double opt_mesh_surfaces_num(OPT_ARGS_NUM); double opt_mesh_volumes_num(OPT_ARGS_NUM); -double opt_mesh_hidden(OPT_ARGS_NUM); -double opt_mesh_shade(OPT_ARGS_NUM); +double opt_mesh_aspect(OPT_ARGS_NUM); double opt_mesh_format(OPT_ARGS_NUM); double opt_mesh_nb_smoothing(OPT_ARGS_NUM); double opt_mesh_algo(OPT_ARGS_NUM); @@ -161,6 +174,8 @@ double opt_mesh_cut_planea(OPT_ARGS_NUM); double opt_mesh_cut_planeb(OPT_ARGS_NUM); double opt_mesh_cut_planec(OPT_ARGS_NUM); double opt_mesh_cut_planed(OPT_ARGS_NUM); +double opt_mesh_color_scheme(OPT_ARGS_NUM); +double opt_mesh_color_carousel(OPT_ARGS_NUM); double opt_post_scales(OPT_ARGS_NUM); double opt_post_link(OPT_ARGS_NUM); double opt_post_smooth(OPT_ARGS_NUM); @@ -169,6 +184,7 @@ double opt_post_initial_intervals(OPT_ARGS_NUM); double opt_post_initial_nbiso(OPT_ARGS_NUM); double opt_post_anim_delay(OPT_ARGS_NUM); double opt_post_nb_views(OPT_ARGS_NUM); +double opt_post_color_scheme(OPT_ARGS_NUM); double opt_view_nb_timestep(OPT_ARGS_NUM); double opt_view_timestep(OPT_ARGS_NUM); double opt_view_min(OPT_ARGS_NUM); @@ -255,18 +271,21 @@ typedef struct { } StringX4Int; typedef struct { + int level; char *str ; char * (*function)(int num, int action, char *val) ; char *def ; } StringXString ; typedef struct { + int level; char *str; double (*function)(int num, int action, double val) ; double def ; } StringXNumber ; typedef struct { + int level; char *str ; unsigned int (*function)(int num, int action, unsigned int val) ; unsigned int def1, def2, def3 ; @@ -280,6 +299,10 @@ void Set_DefaultStringOptions(int num, StringXString s[]); void Set_DefaultNumberOptions(int num, StringXNumber s[]); void Set_DefaultColorOptions(int num, StringXColor s[], int scheme); +void Set_StringOptions_GUI(int num, StringXString s[]); +void Set_NumberOptions_GUI(int num, StringXNumber s[]); +void Set_ColorOptions_GUI(int num, StringXColor s[]); + void * Get_StringOption(char *str, StringXString s[]); void * Get_NumberOption(char *str, StringXNumber s[]); void * Get_ColorOption(char *str, StringXColor s[]); diff --git a/Common/Views.cpp b/Common/Views.cpp index 40a28eb922df62ab45f3bd235ff4809a75b71cd9..88209d07bf6fe10aedf6f46f0ab461fc61753514 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.29 2001-02-12 17:38:02 geuzaine Exp $ +// $Id: Views.cpp,v 1.30 2001-02-17 21:56:58 geuzaine Exp $ #include <set> #include "Gmsh.h" @@ -7,12 +7,12 @@ #include "Options.h" #include "ColorTable.h" -List_T *Post_ViewList = NULL; -Post_View *ActualView; +List_T *Post_ViewList = NULL; +Post_View *Post_ViewReference = NULL, *ActualView; extern Context_T CTX ; -static int ActualViewNum=0; +static int ActualViewNum=0, ActualViewIndex=0; static int NbPoints, NbLines, NbTriangles, NbTetrahedra; /* ------------------------------------------------------------------------ */ @@ -33,7 +33,8 @@ void BeginView(int allocate, int force_number){ if(!Post_ViewList) Post_ViewList = List_Create(100,1,sizeof(Post_View)); if(!force_number){ - v.Num = ++ActualViewNum; + // each view MUST have a unique, non-reattributable, number + v.Num = ++ActualViewNum; List_Add(Post_ViewList, &v); } else{ @@ -43,7 +44,8 @@ void BeginView(int allocate, int force_number){ CTX.post.nb_views = List_Nbr(Post_ViewList); - ActualView = (Post_View*)List_PQuery(Post_ViewList, &v, fcmpPostViewNum); + ActualViewIndex = List_ISearch(Post_ViewList, &v, fcmpPostViewNum); + ActualView = (Post_View*)List_Pointer(Post_ViewList, ActualViewIndex); NbPoints = NbLines = NbTriangles = NbTetrahedra = 0; @@ -81,19 +83,18 @@ void BeginView(int allocate, int force_number){ ActualView->SS = NULL; ActualView->VS = NULL; ActualView->TS = NULL; } + CopyViewOptions(Post_ViewReference, ActualView); + ActualView->Changed = 1; ActualView->Links = 0; ActualView->DuplicateOf = 0; ActualView->ScalarOnly = 1; ActualView->normals = NULL; - - Set_DefaultStringOptions(ActualView->Num-1, ViewOptions_String); - Set_DefaultNumberOptions(ActualView->Num-1, ViewOptions_Number); - Set_DefaultColorOptions(ActualView->Num-1, ViewOptions_Color, 0); ActualView->CT.size = 255; ActualView->CT.ipar[COLORTABLE_MODE] = COLORTABLE_RGB; ColorTable_InitParam(1, &ActualView->CT, 1, 1); ColorTable_Recompute(&ActualView->CT, 1, 1); + } void Stat_ScalarSimplex(int nbnod, int N, double *V){ @@ -232,26 +233,26 @@ void EndView(int add_in_gui, int force_number, char *file_name, char *name){ } // Dummy time values if using old parsed format... - if(!List_Nbr(ActualView->Time)){ + if(ActualView->Time && !List_Nbr(ActualView->Time)){ for(i=0 ; i<ActualView->NbTimeStep ; i++){ d = (double)i; List_Add(ActualView->Time, &d); } } - opt_view_name(ActualView->Num-1, GMSH_SET|GMSH_GUI, name); - opt_view_filename(ActualView->Num-1, GMSH_SET|GMSH_GUI, file_name); - opt_view_nb_timestep(ActualView->Num-1, GMSH_GUI, 0); + opt_view_name(ActualViewIndex, GMSH_SET|GMSH_GUI, name); + opt_view_filename(ActualViewIndex, GMSH_SET|GMSH_GUI, file_name); + opt_view_nb_timestep(ActualViewIndex, GMSH_GUI, 0); if(ActualView->Min > ActualView->Max){ - opt_view_min(ActualView->Num-1, GMSH_SET|GMSH_GUI, 0.); - opt_view_max(ActualView->Num-1, GMSH_SET|GMSH_GUI, 0.); + opt_view_min(ActualViewIndex, GMSH_SET|GMSH_GUI, 0.); + opt_view_max(ActualViewIndex, GMSH_SET|GMSH_GUI, 0.); } else{ - opt_view_min(ActualView->Num-1, GMSH_GUI, 0); - opt_view_max(ActualView->Num-1, GMSH_GUI, 0); + opt_view_min(ActualViewIndex, GMSH_GUI, 0); + opt_view_max(ActualViewIndex, GMSH_GUI, 0); } - opt_view_custom_min(ActualView->Num-1, GMSH_SET|GMSH_GUI, ActualView->Min); - opt_view_custom_max(ActualView->Num-1, GMSH_SET|GMSH_GUI, ActualView->Max); + opt_view_custom_min(ActualViewIndex, GMSH_SET|GMSH_GUI, ActualView->Min); + opt_view_custom_max(ActualViewIndex, GMSH_SET|GMSH_GUI, ActualView->Max); if(CTX.post.smooth) ActualView->smooth(); @@ -269,7 +270,7 @@ bool FreeView(int num){ } v = (Post_View*)List_Pointer(Post_ViewList, num); FreeView(v); - List_Suppress(Post_ViewList, v, fcmpPostViewNum); + List_PSuppress(Post_ViewList, num); CTX.post.nb_views = List_Nbr(Post_ViewList); Msg(INFO, "View %d deleted (%d views left)",num, List_Nbr(Post_ViewList)); @@ -279,33 +280,34 @@ bool FreeView(int num){ void FreeView(Post_View *v){ Post_View vv,*v2; - int free = 1; + int i, numdup, free = 1; if(v->DuplicateOf){ vv.Num = v->DuplicateOf ; - Msg(DEBUG, "This View is a Duplicata"); + Msg(DEBUG, "This view is a duplicata"); if(!(v2 = (Post_View*)List_PQuery(Post_ViewList, &vv, fcmpPostViewNum))){ - Msg(DEBUG, " ->The Original View is Gone"); - if(!(v2 = (Post_View*)List_PQuery(Post_ViewList, v, fcmpPostViewDuplicateOf))){ - Msg(DEBUG, " ->There are no other duplicata"); + Msg(DEBUG, " -the original view is gone"); + numdup = 0; + for(i=0 ; i<List_Nbr(Post_ViewList); i++) + numdup += (((Post_View*)List_Pointer(Post_ViewList, i))->DuplicateOf == v->DuplicateOf); + if(numdup == 1){ + Msg(DEBUG, " -there are no other duplicata, so I can free"); free = 1 ; } else{ + Msg(DEBUG, " -there are still duplicata, so I cannot free"); free = 0 ; } } else{ v2->Links--; free = 0 ; - Msg(DEBUG, " ->The original still exists, so I dont't free anything now"); + Msg(DEBUG, " -the original still exists, so I cannot free"); } } - if(v->Links) - Msg(DEBUG, " ->This view is linked: Cannot free"); - if(free && !v->Links){ - Msg(DEBUG, " ->Freeing View"); + Msg(DEBUG, "FREEING VIEW"); List_Delete(v->Time); List_Delete(v->SP); List_Delete(v->VP); List_Delete(v->TP); List_Delete(v->SL); List_Delete(v->VL); List_Delete(v->TL); @@ -345,7 +347,12 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ ColorTable *Get_ColorTable(int num){ Post_View *v; - if((v = (Post_View*)List_Pointer_Test(Post_ViewList, num))) + + if(!Post_ViewList) + v = Post_ViewReference ; + else + v = (Post_View*)List_Pointer_Test(Post_ViewList, num); + if(v) return &v->CT ; else return NULL ; @@ -353,7 +360,11 @@ ColorTable *Get_ColorTable(int num){ void Print_ColorTable(int num, char *prefix, FILE *file){ char tmp[1024]; - Post_View *v = (Post_View*)List_Pointer_Test(Post_ViewList, num); + Post_View *v; + if(!Post_ViewList) + v = Post_ViewReference ; + else + v = (Post_View*)List_Pointer_Test(Post_ViewList, num); if(!v) return; sprintf(tmp, "%s = {", prefix); if(file) fprintf(file, "%s\n", tmp); else Msg(DIRECT, tmp); @@ -502,6 +513,65 @@ void Read_View(FILE *file, char *filename){ } +/* ------------------------------------------------------------------------ */ +/* W r i t e _ V i e w */ +/* ------------------------------------------------------------------------ */ + +void Write_View(int Flag_BIN, Post_View *v, char *filename){ + FILE *file; + int i, f, One=1; + + if(filename){ + file = fopen(filename,"w"); + if(!file){ + Msg(WARNING, "Unable to Open File '%s'", filename); + return; + } + } + else + file = stdout; + + fprintf(file, "$PostFormat /* Gmsh 1.0, %s */\n", + Flag_BIN ? "binary" : "ascii") ; + fprintf(file, "1.0 %d %d\n", Flag_BIN, sizeof(double)) ; + fprintf(file, "$EndPostFormat\n") ; + for(i=0;i<(int)strlen(v->Name);i++) + if(v->Name[i]==' ') v->Name[i]='_'; + // -> Il faudra changer le format de post pour autoriser les blancs. + // On ajoutera aussi un entier par simplexe (num de region). + // Devrait-on passer a un format liste de noeuds + liste de + // simplexes ? + fprintf(file, "$View /* %s */\n", v->Name); + fprintf(file, "%s ", v->Name); + fprintf(file, "%d %d %d %d %d %d %d %d %d %d %d %d %d\n", + List_Nbr(v->Time), + v->NbSP, v->NbVP, v->NbTP, v->NbSL, v->NbVL, v->NbTL, + v->NbST, v->NbVT, v->NbTT, v->NbSS, v->NbVS, v->NbTS); + if(Flag_BIN){ + f = LIST_FORMAT_BINARY; + fwrite(&One, sizeof(int), 1, file); + } + else + f = LIST_FORMAT_ASCII; + List_WriteToFile(v->Time, file, f); + List_WriteToFile(v->SP, file, f); List_WriteToFile(v->VP, file, f); + List_WriteToFile(v->TP, file, f); List_WriteToFile(v->SL, file, f); + List_WriteToFile(v->VL, file, f); List_WriteToFile(v->TL, file, f); + List_WriteToFile(v->ST, file, f); List_WriteToFile(v->VT, file, f); + List_WriteToFile(v->TT, file, f); List_WriteToFile(v->SS, file, f); + List_WriteToFile(v->VS, file, f); List_WriteToFile(v->TS, file, f); + if(Flag_BIN) fprintf(file, "\n"); + fprintf(file, "$EndView\n"); + + if(filename){ + Msg(INFO, "View Output Complete '%s'", filename); + Msg(STATUS2, "Wrote '%s'", filename); + fclose(file); + } + +} + + /* A little util for smoothing a view. diff --git a/Common/Views.h b/Common/Views.h index c3b1115915a16e82417ff3bc1b6acfd17c37e00b..54d4ed504cdad1fcf554ba62141d6a5484924064 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -55,6 +55,10 @@ class Post_View{ extern List_T *Post_ViewList; +// Reference view storing default options + +extern Post_View *Post_ViewReference; + // IntervalsType #define DRAW_POST_ISO 1 #define DRAW_POST_CONTINUOUS 2 @@ -91,6 +95,7 @@ void EndView (int AddInUI, int Number, char *FileName, char *Name); void FreeView(Post_View *v); bool FreeView(int); void Read_View(FILE *file, char *filename); +void Write_View(int Flag_BIN, Post_View *v, char *filename); void CopyViewOptions(Post_View *src, Post_View *dest); int BGMWithView (Post_View *ErrView);