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

fatal error messages + selection cursor

parent 9d3cbd15
No related branches found
No related tags found
No related merge requests found
// $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: // To make the interface as visually consistent as possible, please:
// - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc.
...@@ -1656,11 +1656,11 @@ void GUI::add_message(char *msg){ ...@@ -1656,11 +1656,11 @@ void GUI::add_message(char *msg){
msg_browser->bottomline(msg_browser->size()); msg_browser->bottomline(msg_browser->size());
} }
void GUI::save_message(char *name){ void GUI::save_message(char *filename){
FILE *fp; FILE *fp;
if(!(fp = fopen(name,"w"))) { if(!(fp = fopen(filename,"w"))) {
Msg(WARNING, "Unable to Open File '%s'", name); Msg(WARNING, "Unable to Open File '%s'", filename);
return; return;
} }
for(int i = 1 ; i<=msg_browser->size() ; i++){ for(int i = 1 ; i<=msg_browser->size() ; i++){
...@@ -1669,11 +1669,16 @@ void GUI::save_message(char *name){ ...@@ -1669,11 +1669,16 @@ void GUI::save_message(char *name){
else fprintf(fp, "%s\n", c); else fprintf(fp, "%s\n", c);
} }
Msg(INFO, "Log Creation Complete '%s'", name); Msg(INFO, "Log Creation Complete '%s'", filename);
Msg(STATUS2, "Wrote '%s'", name); Msg(STATUS2, "Wrote '%s'", filename);
fclose(fp); 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 ****************************** //******************************* Create the about window ******************************
void GUI::create_about_window(){ void GUI::create_about_window(){
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <FL/Fl_Browser.H> #include <FL/Fl_Browser.H>
#include <FL/x.H> #include <FL/x.H>
#include <FL/Fl_Color_Chooser.H> #include <FL/Fl_Color_Chooser.H>
#include <FL/fl_ask.H>
#include "Opengl_Window.h" #include "Opengl_Window.h"
#include "Colorbar_Window.h" #include "Colorbar_Window.h"
...@@ -202,12 +203,13 @@ public: ...@@ -202,12 +203,13 @@ public:
void set_status(char *msg, int num); void set_status(char *msg, int num);
void add_message(char *msg); void add_message(char *msg);
void save_message(char *filename); void save_message(char *filename);
void fatal_error(char *filename);
void set_statistics(); void set_statistics();
void update_view_window(int numview); void update_view_window(int numview);
void set_title(char *str); void set_title(char *str);
void add_handler(); void add_handler();
int global_shortcuts(int event); int global_shortcuts(int event);
int try_selection, quit_selection, end_selection; int selection, try_selection, quit_selection, end_selection;
}; };
......
// $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> #include <signal.h>
#if !defined(WIN32) || defined(__CYGWIN__) #if !defined(WIN32) || defined(__CYGWIN__)
...@@ -129,7 +129,10 @@ void Msg(int level, char *fmt, ...){ ...@@ -129,7 +129,10 @@ void Msg(int level, char *fmt, ...){
} }
if(abort){ 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); Exit(1);
} }
} }
......
// $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 "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -107,6 +107,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ ...@@ -107,6 +107,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
*v = NULL; *c = NULL; *s = NULL; *v = NULL; *c = NULL; *s = NULL;
WID->selection = type;
WID->try_selection = 0; WID->try_selection = 0;
WID->quit_selection = 0; WID->quit_selection = 0;
WID->end_selection = 0; WID->end_selection = 0;
...@@ -115,10 +116,12 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ ...@@ -115,10 +116,12 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
WID->wait(); WID->wait();
if(WID->quit_selection){ if(WID->quit_selection){
WID->quit_selection = 0; WID->quit_selection = 0;
WID->selection = 0;
return 0; return 0;
} }
if(WID->end_selection){ if(WID->end_selection){
WID->end_selection = 0; WID->end_selection = 0;
WID->selection = 0;
return -1; return -1;
} }
if(WID->try_selection){ if(WID->try_selection){
...@@ -129,6 +132,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ ...@@ -129,6 +132,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
BeginHighlight(); BeginHighlight();
HighlightEntity(*v,*c,*s,1); HighlightEntity(*v,*c,*s,1);
EndHighlight(1); EndHighlight(1);
WID->selection = 0;
return(1); return(1);
} }
} }
......
// $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 "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -21,6 +21,7 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev, ...@@ -21,6 +21,7 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
Curve **thec, Surface **thes, Mesh *m); Curve **thec, Surface **thes, Mesh *m);
void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2, void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2); GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
int check_type(int type, Vertex *v, Curve *c, Surface *s);
static int ZOOM = 0 ; static int ZOOM = 0 ;
static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1; static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1;
...@@ -262,8 +263,11 @@ int Opengl_Window::handle(int event) { ...@@ -262,8 +263,11 @@ int Opengl_Window::handle(int event) {
Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj); Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj);
ov = v; oc = c; os = s; v = NULL; c = NULL; s = NULL; ov = v; oc = c; os = s; v = NULL; c = NULL; s = NULL;
Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M); Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M);
if(ov != v || oc != c || os != s) { 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(); BeginHighlight();
HighlightEntity(v,c,s,0); HighlightEntity(v,c,s,0);
EndHighlight(0); EndHighlight(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment