From 0d17c518f8dd7831f6a03d3f7ab63435e85dcae7 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 13 Jan 2001 15:41:35 +0000 Subject: [PATCH] *** empty log message *** --- Box/Box.cpp | 5 +- Common/Context.cpp | 26 +++++- Common/Context.h | 9 +- Common/GetOptions.cpp | 13 ++- Common/Message.h | 1 + Common/Options.h | 189 +++++++++++++++++++++--------------------- Fltk/Callbacks.cpp | 4 +- Fltk/GUI.cpp | 47 +++++++---- Fltk/GUI.h | 1 + Fltk/Main.cpp | 6 +- Fltk/Message.cpp | 34 ++++---- Fltk/Opengl.cpp | 4 +- Geo/Geo.cpp | 10 +-- Makefile | 16 ++-- Motif/Main.cpp | 5 +- Motif/Message.cpp | 4 +- Parser/OpenFile.h | 5 +- 17 files changed, 220 insertions(+), 159 deletions(-) diff --git a/Box/Box.cpp b/Box/Box.cpp index c6e405dcdc..04f2563e0e 100644 --- a/Box/Box.cpp +++ b/Box/Box.cpp @@ -1,8 +1,9 @@ -// $Id: Box.cpp,v 1.19 2001-01-09 14:24:04 geuzaine Exp $ +// $Id: Box.cpp,v 1.20 2001-01-13 15:41:35 geuzaine Exp $ #include <signal.h> #include "Gmsh.h" +#include "GmshVersion.h" #include "Const.h" #include "Geo.h" #include "Mesh.h" @@ -12,8 +13,6 @@ #include "OpenFile.h" #include "GetOptions.h" #include "MinMax.h" -#include "Version.h" - #include "Static.h" /* dummy defs for link purposes */ diff --git a/Common/Context.cpp b/Common/Context.cpp index 3932fadc4a..a4e3b1a922 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -1,4 +1,4 @@ -// $Id: Context.cpp,v 1.32 2001-01-12 13:28:54 geuzaine Exp $ +// $Id: Context.cpp,v 1.33 2001-01-13 15:41:35 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -286,6 +286,30 @@ void Print_Context(char *filename){ } } +void Print_Configuration(char *filename){ + FILE *file; + + file = fopen(filename,"w"); + if(!file){ + Msg(WARNING, "Unable to Open File '%s'", filename); + return; + } + + fprintf(file, "// Default Gmsh Configuration\n"); + fprintf(file, "// This is an automatically generated file: Do not edit!\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); +} + /* 3 rotations successives autour de x, y et z: diff --git a/Common/Context.h b/Common/Context.h index b28187a03b..f0c7e3b77c 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -53,12 +53,16 @@ typedef struct{ }rgbacolors; class Context_T { - public : +public : 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 *display; // forced display host:0.0 under X11 + int position[2]; // position of the menu window on the screen + int gl_position[2]; // position of the graphic window on the screen + int interactive; // 0=full gfx; -1=just parse; 1,2,3=batch mesh int verbosity; // 0=silent -> 3=debug int expose; // 1 if everything is ready to expose and draw @@ -97,7 +101,7 @@ class Context_T { //end(only used for Motif) int fontsize; // font size for fltk UI - int glfontsize; // font size for opengl graphics + int gl_fontsize; // font size for opengl graphics // OpenGL stuff int viewport[4]; // current viewport @@ -206,5 +210,6 @@ void Print_ColorOptions(StringXColor s[], char *prefix, FILE *file); void Init_Colors (int num); void Init_Context (void); void Print_Context(char *filename); +void Print_Configuration(char *filename); #endif diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index 327d730aea..8469a84efa 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,11 +1,13 @@ -// $Id: GetOptions.cpp,v 1.3 2001-01-11 12:53:57 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.4 2001-01-13 15:41:35 geuzaine Exp $ + #include "Gmsh.h" +#include "GmshVersion.h" #include "Const.h" #include "Context.h" #include "Geo.h" #include "Mesh.h" #include "Views.h" -#include "./Version.h" +#include "OpenFile.h" extern Context_T CTX; @@ -77,6 +79,13 @@ 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); + + // Get command line options + TheFileNameTab[0] = "unnamed.geo" ; *nbfiles = 0; diff --git a/Common/Message.h b/Common/Message.h index df153d4ba1..39c4beb234 100644 --- a/Common/Message.h +++ b/Common/Message.h @@ -59,6 +59,7 @@ void Signal (int signum); void Msg (int level, char *fmt, ...); double Cpu (void); void Progress(int); +void Exit(int); void AddALineInTheEditGeometryForm (char* line); #endif diff --git a/Common/Options.h b/Common/Options.h index 72162f9080..68e2a1dca7 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -37,100 +37,101 @@ StringXString PrintOptions_String[] = { // NUMBERS StringXNumber GeneralOptions_Number[] = { - { "Viewport0" , GMSH_INT, (void*)&CTX.viewport[0] , 0. }, - { "Viewport1" , GMSH_INT, (void*)&CTX.viewport[1] , 0. }, - { "Viewport2" , GMSH_INT, (void*)&CTX.viewport[2] , 1. }, - { "Viewport3" , GMSH_INT, (void*)&CTX.viewport[3] , 1. }, - { "FontSize" , GMSH_INT, (void*)&CTX.glfontsize , 11. }, - { "Rotation0" , GMSH_DOUBLE, (void*)&CTX.r[0] , 0.0 }, - { "Rotation1" , GMSH_DOUBLE, (void*)&CTX.r[1] , 0.0 }, - { "Rotation2" , GMSH_DOUBLE, (void*)&CTX.r[2] , 0.0 }, - { "TrackballQuaternion0" , - GMSH_FLOAT, (void*)&CTX.quaternion[0] , 0.0 }, - { "TrackballQuaternion1" , - GMSH_FLOAT, (void*)&CTX.quaternion[1] , 0.0 }, - { "TrackballQuaternion2" , - GMSH_FLOAT, (void*)&CTX.quaternion[2] , 0.0 }, - { "TrackballQuaternion3" , - GMSH_FLOAT, (void*)&CTX.quaternion[3] , 1.0 }, - { "Translation0" , GMSH_DOUBLE, (void*)&CTX.t[0] , 0.0 }, - { "Translation1" , GMSH_DOUBLE, (void*)&CTX.t[1] , 0.0 }, - { "Translation2" , GMSH_DOUBLE, (void*)&CTX.t[2] , 0.0 }, - { "Scale0" , GMSH_DOUBLE, (void*)&CTX.s[0] , 1.0 }, - { "Scale1" , GMSH_DOUBLE, (void*)&CTX.s[1] , 1.0 }, - { "Scale2" , GMSH_DOUBLE, (void*)&CTX.s[2] , 1.0 }, - { "Shininess" , GMSH_FLOAT, (void*)&CTX.shine , 0.4 }, - { "Verbosity" , GMSH_INT, (void*)&CTX.verbosity , 2. }, - { "Orthographic" , GMSH_INT, (void*)&CTX.ortho , 1. }, - { "FastRedraw" , GMSH_INT, (void*)&CTX.fast , 1. }, - { "Axes" , GMSH_INT, (void*)&CTX.axes , 1. }, - { "SmallAxes" , GMSH_INT, (void*)&CTX.small_axes , 1. }, - { "DisplayLists" , GMSH_INT, (void*)&CTX.display_lists , 0. }, - { "SameVisual" , GMSH_INT, (void*)&CTX.same_visual , 0. }, - { "Flash" , GMSH_INT, (void*)&CTX.flash , 0. }, - { "AlphaBlending", GMSH_INT, (void*)&CTX.alpha , 0. }, - { "Trackball" , GMSH_INT, (void*)&CTX.useTrackball , 1. }, - { "Clip0" , GMSH_INT, (void*)&CTX.clip[0] , 0. }, - { "Clip00" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][0] , 0.0 }, - { "Clip01" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][1] , 0.0 }, - { "Clip02" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][2] , 0.0 }, - { "Clip03" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][3] , 0.0 }, - { "Clip1" , GMSH_INT, (void*)&CTX.clip[1] , 0. }, - { "Clip10" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][0] , 0.0 }, - { "Clip11" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][1] , 0.0 }, - { "Clip12" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][2] , 0.0 }, - { "Clip13" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][3] , 0.0 }, - { "Clip2" , GMSH_INT, (void*)&CTX.clip[2] , 0. }, - { "Clip20" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][0] , 0.0 }, - { "Clip21" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][1] , 0.0 }, - { "Clip22" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][2] , 0.0 }, - { "Clip23" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][3] , 0.0 }, - { "Clip3" , GMSH_INT, (void*)&CTX.clip[3] , 0. }, - { "Clip30" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][0] , 0.0 }, - { "Clip31" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][1] , 0.0 }, - { "Clip32" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][2] , 0.0 }, - { "Clip33" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][3] , 0.0 }, - { "Clip4" , GMSH_INT, (void*)&CTX.clip[4] , 0. }, - { "Clip40" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][0] , 0.0 }, - { "Clip41" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][1] , 0.0 }, - { "Clip42" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][2] , 0.0 }, - { "Clip43" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][3] , 0.0 }, - { "Clip5" , GMSH_INT, (void*)&CTX.clip[5] , 0. }, - { "Clip50" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][0] , 0.0 }, - { "Clip51" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][1] , 0.0 }, - { "Clip52" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][2] , 0.0 }, - { "Clip53" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][3] , 0.0 }, - { "Light0" , GMSH_INT, (void*)&CTX.light[0] , 1. }, - { "Light00" , GMSH_FLOAT, (void*)&CTX.light_position[0][0] , 0.5 }, - { "Light01" , GMSH_FLOAT, (void*)&CTX.light_position[0][1] , 0.3 }, - { "Light02" , GMSH_FLOAT, (void*)&CTX.light_position[0][2] , 1.0 }, - { "Light03" , GMSH_FLOAT, (void*)&CTX.light_position[0][3] , 0.0 }, - { "Light1" , GMSH_INT, (void*)&CTX.light[1] , 0. }, - { "Light10" , GMSH_FLOAT, (void*)&CTX.light_position[1][0] , 0.0 }, - { "Light11" , GMSH_FLOAT, (void*)&CTX.light_position[1][1] , 0.0 }, - { "Light12" , GMSH_FLOAT, (void*)&CTX.light_position[1][2] , 0.0 }, - { "Light13" , GMSH_FLOAT, (void*)&CTX.light_position[1][3] , 0.0 }, - { "Light2" , GMSH_INT, (void*)&CTX.light[2] , 0. }, - { "Light20" , GMSH_FLOAT, (void*)&CTX.light_position[2][0] , 0.0 }, - { "Light21" , GMSH_FLOAT, (void*)&CTX.light_position[2][1] , 0.0 }, - { "Light22" , GMSH_FLOAT, (void*)&CTX.light_position[2][2] , 0.0 }, - { "Light23" , GMSH_FLOAT, (void*)&CTX.light_position[2][3] , 0.0 }, - { "Light3" , GMSH_INT, (void*)&CTX.light[3] , 0. }, - { "Light30" , GMSH_FLOAT, (void*)&CTX.light_position[3][0] , 0.0 }, - { "Light31" , GMSH_FLOAT, (void*)&CTX.light_position[3][1] , 0.0 }, - { "Light32" , GMSH_FLOAT, (void*)&CTX.light_position[3][2] , 0.0 }, - { "Light33" , GMSH_FLOAT, (void*)&CTX.light_position[3][3] , 0.0 }, - { "Light4" , GMSH_INT, (void*)&CTX.light[4] , 0. }, - { "Light40" , GMSH_FLOAT, (void*)&CTX.light_position[4][0] , 0.0 }, - { "Light41" , GMSH_FLOAT, (void*)&CTX.light_position[4][1] , 0.0 }, - { "Light42" , GMSH_FLOAT, (void*)&CTX.light_position[4][2] , 0.0 }, - { "Light43" , GMSH_FLOAT, (void*)&CTX.light_position[4][3] , 0.0 }, - { "Light5" , GMSH_INT, (void*)&CTX.light[5] , 0. }, - { "Light50" , GMSH_FLOAT, (void*)&CTX.light_position[5][0] , 0.0 }, - { "Light51" , GMSH_FLOAT, (void*)&CTX.light_position[5][1] , 0.0 }, - { "Light52" , GMSH_FLOAT, (void*)&CTX.light_position[5][2] , 0.0 }, - { "Light53" , GMSH_FLOAT, (void*)&CTX.light_position[5][3] , 0.0 }, - { NULL , GMSH_DOUBLE, NULL , 0. } + { "Viewport0" , GMSH_INT, (void*)&CTX.viewport[0] , 0. }, + { "Viewport1" , GMSH_INT, (void*)&CTX.viewport[1] , 0. }, + { "Viewport2" , GMSH_INT, (void*)&CTX.viewport[2] , 700. }, + { "Viewport3" , GMSH_INT, (void*)&CTX.viewport[3] , 500. }, + { "GraphicsPosition0" , GMSH_INT, (void*)&CTX.gl_position[0] , 20. }, + { "GraphicsPosition1" , GMSH_INT, (void*)&CTX.gl_position[1] , 30. }, + { "GraphicsFontSize" , GMSH_INT, (void*)&CTX.gl_fontsize , 11. }, + { "MenuPosition0" , GMSH_INT, (void*)&CTX.position[0] , 800. }, + { "MenuPosition1" , GMSH_INT, (void*)&CTX.position[1] , 50. }, + { "MenuFontSize" , GMSH_INT, (void*)&CTX.fontsize , 12. }, + { "Rotation0" , GMSH_DOUBLE, (void*)&CTX.r[0] , 0.0 }, + { "Rotation1" , GMSH_DOUBLE, (void*)&CTX.r[1] , 0.0 }, + { "Rotation2" , GMSH_DOUBLE, (void*)&CTX.r[2] , 0.0 }, + { "TrackballQuaternion0" , GMSH_FLOAT, (void*)&CTX.quaternion[0] , 0.0 }, + { "TrackballQuaternion1" , GMSH_FLOAT, (void*)&CTX.quaternion[1] , 0.0 }, + { "TrackballQuaternion2" , GMSH_FLOAT, (void*)&CTX.quaternion[2] , 0.0 }, + { "TrackballQuaternion3" , GMSH_FLOAT, (void*)&CTX.quaternion[3] , 1.0 }, + { "Translation0" , GMSH_DOUBLE, (void*)&CTX.t[0] , 0.0 }, + { "Translation1" , GMSH_DOUBLE, (void*)&CTX.t[1] , 0.0 }, + { "Translation2" , GMSH_DOUBLE, (void*)&CTX.t[2] , 0.0 }, + { "Scale0" , GMSH_DOUBLE, (void*)&CTX.s[0] , 1.0 }, + { "Scale1" , GMSH_DOUBLE, (void*)&CTX.s[1] , 1.0 }, + { "Scale2" , GMSH_DOUBLE, (void*)&CTX.s[2] , 1.0 }, + { "Shininess" , GMSH_FLOAT, (void*)&CTX.shine , 0.4 }, + { "Verbosity" , GMSH_INT, (void*)&CTX.verbosity , 2. }, + { "Orthographic" , GMSH_INT, (void*)&CTX.ortho , 1. }, + { "FastRedraw" , GMSH_INT, (void*)&CTX.fast , 1. }, + { "Axes" , GMSH_INT, (void*)&CTX.axes , 1. }, + { "SmallAxes" , GMSH_INT, (void*)&CTX.small_axes , 1. }, + { "DisplayLists" , GMSH_INT, (void*)&CTX.display_lists , 0. }, + { "SameVisual" , GMSH_INT, (void*)&CTX.same_visual , 0. }, + { "Flash" , GMSH_INT, (void*)&CTX.flash , 0. }, + { "AlphaBlending" , GMSH_INT, (void*)&CTX.alpha , 0. }, + { "Trackball" , GMSH_INT, (void*)&CTX.useTrackball , 1. }, + { "Clip0" , GMSH_INT, (void*)&CTX.clip[0] , 0. }, + { "Clip00" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][0] , 0.0 }, + { "Clip01" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][1] , 0.0 }, + { "Clip02" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][2] , 0.0 }, + { "Clip03" , GMSH_DOUBLE, (void*)&CTX.clip_plane[0][3] , 0.0 }, + { "Clip1" , GMSH_INT, (void*)&CTX.clip[1] , 0. }, + { "Clip10" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][0] , 0.0 }, + { "Clip11" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][1] , 0.0 }, + { "Clip12" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][2] , 0.0 }, + { "Clip13" , GMSH_DOUBLE, (void*)&CTX.clip_plane[1][3] , 0.0 }, + { "Clip2" , GMSH_INT, (void*)&CTX.clip[2] , 0. }, + { "Clip20" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][0] , 0.0 }, + { "Clip21" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][1] , 0.0 }, + { "Clip22" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][2] , 0.0 }, + { "Clip23" , GMSH_DOUBLE, (void*)&CTX.clip_plane[2][3] , 0.0 }, + { "Clip3" , GMSH_INT, (void*)&CTX.clip[3] , 0. }, + { "Clip30" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][0] , 0.0 }, + { "Clip31" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][1] , 0.0 }, + { "Clip32" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][2] , 0.0 }, + { "Clip33" , GMSH_DOUBLE, (void*)&CTX.clip_plane[3][3] , 0.0 }, + { "Clip4" , GMSH_INT, (void*)&CTX.clip[4] , 0. }, + { "Clip40" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][0] , 0.0 }, + { "Clip41" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][1] , 0.0 }, + { "Clip42" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][2] , 0.0 }, + { "Clip43" , GMSH_DOUBLE, (void*)&CTX.clip_plane[4][3] , 0.0 }, + { "Clip5" , GMSH_INT, (void*)&CTX.clip[5] , 0. }, + { "Clip50" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][0] , 0.0 }, + { "Clip51" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][1] , 0.0 }, + { "Clip52" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][2] , 0.0 }, + { "Clip53" , GMSH_DOUBLE, (void*)&CTX.clip_plane[5][3] , 0.0 }, + { "Light0" , GMSH_INT, (void*)&CTX.light[0] , 1. }, + { "Light00" , GMSH_FLOAT, (void*)&CTX.light_position[0][0] , 0.5 }, + { "Light01" , GMSH_FLOAT, (void*)&CTX.light_position[0][1] , 0.3 }, + { "Light02" , GMSH_FLOAT, (void*)&CTX.light_position[0][2] , 1.0 }, + { "Light03" , GMSH_FLOAT, (void*)&CTX.light_position[0][3] , 0.0 }, + { "Light1" , GMSH_INT, (void*)&CTX.light[1] , 0. }, + { "Light10" , GMSH_FLOAT, (void*)&CTX.light_position[1][0] , 0.0 }, + { "Light11" , GMSH_FLOAT, (void*)&CTX.light_position[1][1] , 0.0 }, + { "Light12" , GMSH_FLOAT, (void*)&CTX.light_position[1][2] , 0.0 }, + { "Light13" , GMSH_FLOAT, (void*)&CTX.light_position[1][3] , 0.0 }, + { "Light2" , GMSH_INT, (void*)&CTX.light[2] , 0. }, + { "Light20" , GMSH_FLOAT, (void*)&CTX.light_position[2][0] , 0.0 }, + { "Light21" , GMSH_FLOAT, (void*)&CTX.light_position[2][1] , 0.0 }, + { "Light22" , GMSH_FLOAT, (void*)&CTX.light_position[2][2] , 0.0 }, + { "Light23" , GMSH_FLOAT, (void*)&CTX.light_position[2][3] , 0.0 }, + { "Light3" , GMSH_INT, (void*)&CTX.light[3] , 0. }, + { "Light30" , GMSH_FLOAT, (void*)&CTX.light_position[3][0] , 0.0 }, + { "Light31" , GMSH_FLOAT, (void*)&CTX.light_position[3][1] , 0.0 }, + { "Light32" , GMSH_FLOAT, (void*)&CTX.light_position[3][2] , 0.0 }, + { "Light33" , GMSH_FLOAT, (void*)&CTX.light_position[3][3] , 0.0 }, + { "Light4" , GMSH_INT, (void*)&CTX.light[4] , 0. }, + { "Light40" , GMSH_FLOAT, (void*)&CTX.light_position[4][0] , 0.0 }, + { "Light41" , GMSH_FLOAT, (void*)&CTX.light_position[4][1] , 0.0 }, + { "Light42" , GMSH_FLOAT, (void*)&CTX.light_position[4][2] , 0.0 }, + { "Light43" , GMSH_FLOAT, (void*)&CTX.light_position[4][3] , 0.0 }, + { "Light5" , GMSH_INT, (void*)&CTX.light[5] , 0. }, + { "Light50" , GMSH_FLOAT, (void*)&CTX.light_position[5][0] , 0.0 }, + { "Light51" , GMSH_FLOAT, (void*)&CTX.light_position[5][1] , 0.0 }, + { "Light52" , GMSH_FLOAT, (void*)&CTX.light_position[5][2] , 0.0 }, + { "Light53" , GMSH_FLOAT, (void*)&CTX.light_position[5][3] , 0.0 }, + { NULL , GMSH_DOUBLE, NULL , 0. } } ; StringXNumber GeometryOptions_Number[] = { diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 4c3e090bd4..ff56502f7a 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.19 2001-01-12 13:28:55 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.20 2001-01-13 15:41:35 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -375,7 +375,7 @@ void file_remove_all_views_cb(CALLBACK_ARGS) { } void file_quit_cb(CALLBACK_ARGS) { - exit(0); + Exit(0); } // Option General Menu diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index e1cbdd5115..0cd5db6ccb 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -6,12 +6,12 @@ #include "Gmsh.h" #include "GmshUI.h" +#include "GmshVersion.h" #include "Context.h" #include "Const.h" #include "Geo.h" #include "Mesh.h" #include "Draw.h" -#include "Version.h" #include "GUI.h" #include "Callbacks.h" #include "Bitmaps.h" @@ -389,7 +389,7 @@ void GUI::create_menu_window(){ m_popup_butt[i]->hide(); } - m_window->position(800,50); + m_window->position(CTX.position[0],CTX.position[1]); m_window->end(); } else{ @@ -518,34 +518,40 @@ void GUI::create_graphic_window(){ if(!init_graphic_window){ init_graphic_window = 1 ; - g_window = new Fl_Window(700,520); - g_opengl_window = new Opengl_Window(0,0,700,500); + int sh = 2*CTX.fontsize-4; // status bar height + int width = CTX.viewport[2]-CTX.viewport[0]; + int glheight = CTX.viewport[3]-CTX.viewport[1]; + int height = glheight + sh; + + + g_window = new Fl_Window(width, height); + g_opengl_window = new Opengl_Window(0,0,width,glheight); { - Fl_Group *o = new Fl_Group(0,500,700,20); + Fl_Group *o = new Fl_Group(0,glheight,width,sh); o->box(FL_THIN_UP_BOX); x = 2; - g_status_butt[0] = new Fl_Button(x,502,15,16,"X"); x+=15; + g_status_butt[0] = new Fl_Button(x,glheight+2,15,sh-4,"X"); x+=15; g_status_butt[0]->callback(status_xyz1p_cb, (void*)0); //g_status_butt[0]->tooltip("Set X view"); - g_status_butt[1] = new Fl_Button(x,502,15,16,"Y"); x+=15; + g_status_butt[1] = new Fl_Button(x,glheight+2,15,sh-4,"Y"); x+=15; g_status_butt[1]->callback(status_xyz1p_cb, (void*)1); - g_status_butt[2] = new Fl_Button(x,502,15,16,"Z"); x+=15; + g_status_butt[2] = new Fl_Button(x,glheight+2,15,sh-4,"Z"); x+=15; g_status_butt[2]->callback(status_xyz1p_cb, (void*)2); - g_status_butt[3] = new Fl_Button(x,502,20,16,"1:1"); x+=20; + g_status_butt[3] = new Fl_Button(x,glheight+2,20,sh-4,"1:1"); x+=20; g_status_butt[3]->callback(status_xyz1p_cb, (void*)3); - g_status_butt[4] = new Fl_Button(x,502,15,16,"?"); x+=15; + g_status_butt[4] = new Fl_Button(x,glheight+2,15,sh-4,"?"); x+=15; g_status_butt[4]->callback(status_xyz1p_cb, (void*)4); - g_status_butt[5] = new Fl_Button(x,502,15,16); x+=15; + g_status_butt[5] = new Fl_Button(x,glheight+2,15,sh-4); x+=15; g_status_butt[5]->callback(status_play_cb); start_bmp = new Fl_Bitmap(start_bits,start_width,start_height); start_bmp->label(g_status_butt[5]); stop_bmp = new Fl_Bitmap(stop_bits,stop_width,stop_height); - g_status_butt[6] = new Fl_Button(x,502,15,16); x+=15; + g_status_butt[6] = new Fl_Button(x,glheight+2,15,sh-4); x+=15; g_status_butt[6]->callback(status_cancel_cb); abort_bmp = new Fl_Bitmap(abort_bits,abort_width,abort_height); abort_bmp->label(g_status_butt[6]); @@ -558,9 +564,9 @@ void GUI::create_graphic_window(){ g_status_butt[i]->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); } - g_status_label[0] = new Fl_Box(x,502,(700-x)/3,16); - g_status_label[1] = new Fl_Box(x+(700-x)/3,502,(700-x)/3,16); - g_status_label[2] = new Fl_Box(x+2*(700-x)/3,502,(700-x)/3-2,16); + g_status_label[0] = new Fl_Box(x,glheight+2,(width-x)/3,sh-4); + g_status_label[1] = new Fl_Box(x+(width-x)/3,glheight+2,(height-x)/3,sh-4); + g_status_label[2] = new Fl_Box(x+2*(width-x)/3,glheight+2,(height-x)/3-2,sh-4); for(i = 0 ; i<3 ; i++){ g_status_label[i]->box(FL_FLAT_BOX); g_status_label[i]->labelsize(CTX.fontsize); @@ -571,7 +577,7 @@ void GUI::create_graphic_window(){ } g_window->resizable(g_opengl_window); - g_window->position(20,30); + g_window->position(CTX.gl_position[0],CTX.gl_position[1]); g_window->end(); } else{ @@ -589,6 +595,15 @@ void GUI::set_size(int new_w, int new_h){ g_window->size(new_w,new_h+g_window->h()-g_opengl_window->h()); } +// Get the position of the 2 main windows + +void GUI::get_position(int m[2], int g[2]){ + m[0] = m_window->x(); + m[1] = m_window->y(); + g[0] = g_window->x(); + g[1] = g_window->y(); +} + // Set graphic window title void GUI::set_title(char *str){ diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 02993512e1..1eecaa0527 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -175,6 +175,7 @@ public: void draw_overlay(); void set_size(int w, int h); void set_menu_size(int nb_butt); + void get_position(int m[2], int g[2]); void set_context(Context_Item menu[], int flag); int get_context(); void set_anim(int mode); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index e45aa9cadd..bab90fd6ec 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,9 +1,10 @@ -// $Id: Main.cpp,v 1.9 2001-01-12 14:58:09 geuzaine Exp $ +// $Id: Main.cpp,v 1.10 2001-01-13 15:41:35 geuzaine Exp $ #include <signal.h> #include "Gmsh.h" #include "GmshUI.h" +#include "GmshVersion.h" #include "Geo.h" #include "Verif.h" @@ -13,7 +14,6 @@ #include "ColorTable.h" #include "Parser.h" #include "Static.h" -#include "Version.h" #include "GUI.h" #include "OpenFile.h" #include "GetOptions.h" @@ -27,7 +27,7 @@ int main(int argc, char *argv[]){ Init_Context(); - // Command line options + // Configuration file and command line options Get_Options(argc, argv, &nbf); diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index e62220f2e9..592c6aae42 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.8 2001-01-12 13:28:55 geuzaine Exp $ +// $Id: Message.cpp,v 1.9 2001-01-13 15:41:35 geuzaine Exp $ #include <signal.h> #ifndef WIN32 @@ -7,7 +7,7 @@ #include "Gmsh.h" #include "GmshUI.h" -#include "Version.h" +#include "GmshVersion.h" #include "Context.h" #include "GUI.h" @@ -45,10 +45,6 @@ void Signal (int sig_num){ /* M s g */ /* ------------------------------------------------------------------------ */ -#define PUT_IN_COMMAND_WIN \ - vfprintf(stderr, fmt, args); \ - fprintf(stderr, "\n"); - void Msg(int level, char *fmt, ...){ va_list args; int abort = 0, verb = 0, window = -1, log = 1; @@ -56,11 +52,11 @@ void Msg(int level, char *fmt, ...){ switch(level){ case STATUS1N : log = 0; //fallthrough - case STATUS1 : window = 0; break ; + case STATUS1 : verb = 1; window = 0; break ; case STATUS2N : log = 0; //fallthrough - case STATUS2 : window = 1; break ; + case STATUS2 : verb = 1; window = 1; break ; case STATUS3N : log = 0; //fallthrough - case STATUS3 : window = 2; break ; + case STATUS3 : verb = 1; window = 2; break ; case FATAL : str = FATAL_STR; abort = 1; break ; case FATAL1 : str = FATAL_STR; break ; @@ -98,10 +94,8 @@ void Msg(int level, char *fmt, ...){ static char buff1[1024], buff2[1024], buff[4][1024]; - if(CTX.interactive){ - if(verb) return; + if(CTX.interactive) window = -1; - } else WID->check(); @@ -131,12 +125,24 @@ void Msg(int level, char *fmt, ...){ } if(abort){ - WID->save_message("error.log"); - exit(1); + WID->save_message(".gmshlog"); + Exit(1); } } +/* ------------------------------------------------------------------------ */ +/* Exit */ +/* ------------------------------------------------------------------------ */ + +void Exit(int level){ + if(!CTX.interactive){ + WID->get_position(CTX.position, CTX.gl_position); + Print_Configuration(CTX.configfilename); + } + exit(level); +} + /* ------------------------------------------------------------------------ */ /* C p u */ /* ------------------------------------------------------------------------ */ diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index 7f6fb9494b..11be21a18a 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.12 2001-01-11 22:27:55 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.13 2001-01-13 15:41:35 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -69,7 +69,7 @@ void Draw_String(char *s){ } } - gl_font(FL_HELVETICA, CTX.glfontsize); + gl_font(FL_HELVETICA, CTX.gl_fontsize); gl_draw(s); } diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index dd84ea2933..1daeef8012 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -1,4 +1,4 @@ -// $Id: Geo.cpp,v 1.16 2001-01-12 13:28:57 geuzaine Exp $ +// $Id: Geo.cpp,v 1.17 2001-01-13 15:41:35 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -33,7 +33,7 @@ double evaluate_scalarfunction (char *var, double val, char *funct){ FILE *tempf; tempf = yyin; - if(!(yyin = fopen("gmsh.tmp","w"))){ + if(!(yyin = fopen(".gmshtmp","w"))){ Msg(GERROR, "Unable to Open Temporary File"); return 0.; } @@ -43,7 +43,7 @@ double evaluate_scalarfunction (char *var, double val, char *funct){ fprintf(yyin,"%s = %g ;\n",var,val); fprintf(yyin,"ValeurTemporaire__ = %s ;\n",funct); fclose(yyin); - yyin = fopen("gmsh.tmp","r"); + yyin = fopen(".gmshtmp","r"); while(!feof(yyin)){ yyparse(); } @@ -63,7 +63,7 @@ double evaluate_scalarfunction (char *var, double val, char *funct){ void add_infile(char *text, char *fich){ FILE *file; - if(!(yyin = fopen("gmsh.tmp","w"))){ + if(!(yyin = fopen(".gmshtmp","w"))){ Msg(GERROR, "Unable to Open Temporary File"); return; } @@ -74,7 +74,7 @@ void add_infile(char *text, char *fich){ fprintf(yyin,"%s\n",text); Msg(STATUS1,"%s",text); fclose(yyin); - yyin = fopen("gmsh.tmp","r"); + yyin = fopen(".gmshtmp","r"); while(!feof(yyin)){ yyparse(); } diff --git a/Makefile b/Makefile index d92fc1c6bc..cc86b81e71 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.38 2001-01-11 16:34:38 colignon Exp $ +# $Id: Makefile,v 1.39 2001-01-13 15:41:35 geuzaine Exp $ # ---------------------------------------------------------------------- # Makefile for Gmsh # ---------------------------------------------------------------------- @@ -186,15 +186,15 @@ nodepend: done tag: - $(RM) $(RMFLAGS) Common/Version.h - echo "#define GMSH_VERSION $(GMSH_RELEASE)" > Common/Version.h - echo "#define GMSH_DATE \"`date`\"" >> Common/Version.h - echo "#define GMSH_HOST \"`hostname`\"" >> Common/Version.h - echo "#define GMSH_PACKAGER \"`logname`\"" >> Common/Version.h - echo "#define GMSH_OS \"`uname -sr`\"" >> Common/Version.h + $(RM) $(RMFLAGS) Common/GmshVersion.h + echo "#define GMSH_VERSION $(GMSH_RELEASE)" > Common/GmshVersion.h + echo "#define GMSH_DATE \"`date`\"" >> Common/GmshVersion.h + echo "#define GMSH_HOST \"`hostname`\"" >> Common/GmshVersion.h + echo "#define GMSH_PACKAGER \"`logname`\"" >> Common/GmshVersion.h + echo "#define GMSH_OS \"`uname -sr`\"" >> Common/GmshVersion.h initialtag: - @if [ ! -r Common/Version.h ]; then \ + @if [ ! -r Common/GmshVersion.h ]; then \ $(MAKE) tag ; \ fi diff --git a/Motif/Main.cpp b/Motif/Main.cpp index 014f0198d1..7a567c446e 100644 --- a/Motif/Main.cpp +++ b/Motif/Main.cpp @@ -1,9 +1,10 @@ -// $Id: Main.cpp,v 1.5 2001-01-12 13:29:02 geuzaine Exp $ +// $Id: Main.cpp,v 1.6 2001-01-13 15:41:35 geuzaine Exp $ #include <signal.h> #include "Gmsh.h" #include "GmshUI.h" +#include "GmshVersion.h" #include "Geo.h" #include "Verif.h" #include "Mesh.h" @@ -28,8 +29,6 @@ #include "Static.h" #include "XStatic.h" -#include "Version.h" - char* ShowVisualClass(int cls){ if(cls==TrueColor) return "TrueColor"; if(cls==DirectColor) return "DirectColor"; diff --git a/Motif/Message.cpp b/Motif/Message.cpp index 7b0b3cc0ca..ce7ba4beb6 100644 --- a/Motif/Message.cpp +++ b/Motif/Message.cpp @@ -1,11 +1,11 @@ -// $Id: Message.cpp,v 1.3 2001-01-12 13:29:02 geuzaine Exp $ +// $Id: Message.cpp,v 1.4 2001-01-13 15:41:35 geuzaine Exp $ #include <signal.h> #include <sys/resource.h> #include "Gmsh.h" #include "GmshUI.h" -#include "Version.h" +#include "GmshVersion.h" #include "Context.h" #include "Widgets.h" diff --git a/Parser/OpenFile.h b/Parser/OpenFile.h index b8e084b340..d89e36d0b5 100644 --- a/Parser/OpenFile.h +++ b/Parser/OpenFile.h @@ -3,7 +3,8 @@ #include "Const.h" -void OpenProblem(char *name); -void MergeProblem(char *name); +void ParseFile(char *filename); +void OpenProblem(char *filename); +void MergeProblem(char *filename); #endif -- GitLab