diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 91b87d65b73719f2c77e9736562dd944578ddc08..d60930b7dee9b65295227ef31c9fb4b57bdc01cd 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.57 2001-03-10 19:55:06 remacle Exp $ +// $Id: GUI.cpp,v 1.58 2001-03-17 21:33:13 geuzaine Exp $ // To make the interface as visually consistent as possible, please: // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. @@ -1656,11 +1656,11 @@ void GUI::add_message(char *msg){ msg_browser->bottomline(msg_browser->size()); } -void GUI::save_message(char *name){ +void GUI::save_message(char *filename){ FILE *fp; - if(!(fp = fopen(name,"w"))) { - Msg(WARNING, "Unable to Open File '%s'", name); + if(!(fp = fopen(filename,"w"))) { + Msg(WARNING, "Unable to Open File '%s'", filename); return; } for(int i = 1 ; i<=msg_browser->size() ; i++){ @@ -1669,11 +1669,16 @@ void GUI::save_message(char *name){ else fprintf(fp, "%s\n", c); } - Msg(INFO, "Log Creation Complete '%s'", name); - Msg(STATUS2, "Wrote '%s'", name); + Msg(INFO, "Log Creation Complete '%s'", filename); + Msg(STATUS2, "Wrote '%s'", filename); fclose(fp); } +void GUI::fatal_error(char *filename){ + fl_alert("A fatal error has occurred, which will force Gmsh to exit " + "(all messages have been saved in the error log file '%s')", filename); +} + //******************************* Create the about window ****************************** void GUI::create_about_window(){ diff --git a/Fltk/GUI.h b/Fltk/GUI.h index d5a6c5a8db6118a6c60932961cfca35009dde99e..c5ae752c489c4c113acd41d94f6dda88c5c451e8 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -23,6 +23,7 @@ #include <FL/Fl_Browser.H> #include <FL/x.H> #include <FL/Fl_Color_Chooser.H> +#include <FL/fl_ask.H> #include "Opengl_Window.h" #include "Colorbar_Window.h" @@ -202,12 +203,13 @@ public: void set_status(char *msg, int num); void add_message(char *msg); void save_message(char *filename); + void fatal_error(char *filename); void set_statistics(); void update_view_window(int numview); void set_title(char *str); void add_handler(); int global_shortcuts(int event); - int try_selection, quit_selection, end_selection; + int selection, try_selection, quit_selection, end_selection; }; diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 439d9befe9e1e54f036f9e1236c1cb2550da76e7..29538d8efea92ec13dcaea46a507000fb52c8fe6 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.15 2001-02-23 08:18:50 geuzaine Exp $ +// $Id: Message.cpp,v 1.16 2001-03-17 21:33:13 geuzaine Exp $ #include <signal.h> #if !defined(WIN32) || defined(__CYGWIN__) @@ -129,7 +129,10 @@ void Msg(int level, char *fmt, ...){ } if(abort){ - if(WID) WID->save_message(CTX.error_filename); + if(WID){ + WID->save_message(CTX.error_filename); + WID->fatal_error(CTX.error_filename); + } Exit(1); } } diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index 2c63845e00de8632c972051f6aa1d76a292d7bb5..f3cf59b6af5798e45fb8836b8678e8c2766bf17a 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.18 2001-02-04 15:52:26 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.19 2001-03-17 21:33:13 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -106,19 +106,22 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ GLuint ii[SELECTION_BUFFER_SIZE],jj[SELECTION_BUFFER_SIZE]; *v = NULL; *c = NULL; *s = NULL; - + + WID->selection = type; WID->try_selection = 0; WID->quit_selection = 0; WID->end_selection = 0; - + while(1){ WID->wait(); if(WID->quit_selection){ WID->quit_selection = 0; + WID->selection = 0; return 0; } if(WID->end_selection){ WID->end_selection = 0; + WID->selection = 0; return -1; } if(WID->try_selection){ @@ -129,6 +132,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ BeginHighlight(); HighlightEntity(*v,*c,*s,1); EndHighlight(1); + WID->selection = 0; return(1); } } diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index f4e7e0b8afd12aa31db8cf49cdbf0517e274f38a..5372c50275f59cc349087e10684e24f4bf87043b 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.13 2001-02-05 07:56:57 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.14 2001-03-17 21:33:13 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -21,6 +21,7 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev, Curve **thec, Surface **thes, Mesh *m); void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2, GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2); +int check_type(int type, Vertex *v, Curve *c, Surface *s); static int ZOOM = 0 ; static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1; @@ -262,8 +263,11 @@ int Opengl_Window::handle(int event) { Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj); ov = v; oc = c; os = s; v = NULL; c = NULL; s = NULL; Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M); - if(ov != v || oc != c || os != s) { + if(check_type(WID->selection, v, c, s)) + WID->g_window->cursor(FL_CURSOR_CROSS,FL_BLACK,FL_WHITE); + else + WID->g_window->cursor(FL_CURSOR_DEFAULT,FL_BLACK,FL_WHITE); BeginHighlight(); HighlightEntity(v,c,s,0); EndHighlight(0);