From 4075da9a1fedb4d7daf861b1dc51342fa77a20db Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 3 Feb 2001 14:03:46 +0000 Subject: [PATCH] *** empty log message *** --- Common/Context.h | 4 +-- Common/GetOptions.cpp | 13 ++++++++- Common/GetOptions.h | 2 +- Common/Options.h | 2 +- Fltk/Callbacks.cpp | 6 ++--- Fltk/GUI.cpp | 61 +++++++++++++++++++++++-------------------- Fltk/GUI.h | 14 +++++++++- Motif/CbInput.cpp | 15 +++++------ Motif/CbOptions.cpp | 6 ++--- Motif/Main.cpp | 7 ++--- Motif/Widgets.cpp | 6 ++--- 11 files changed, 80 insertions(+), 56 deletions(-) diff --git a/Common/Context.h b/Common/Context.h index d37cb38dcb..2369df5496 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -162,8 +162,8 @@ public : struct{ int draw, scales, link ; int smooth ; - int initial_visibility, initial_nbiso, initial_intervals ; - long anim_delay, nb_views ; + int initial_visibility, initial_nbiso, initial_intervals, nb_views ; + double anim_delay ; }post; // print options diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index 71a8ac17f6..bb6bb4bbf7 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,6 +1,7 @@ -// $Id: GetOptions.cpp,v 1.6 2001-01-29 08:43:44 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.7 2001-02-03 14:03:46 geuzaine Exp $ #include "Gmsh.h" +#include "GmshUI.h" #include "GmshVersion.h" #include "Const.h" #include "Context.h" @@ -19,12 +20,14 @@ char gmsh_progname[] = "This is Gmsh" ; char gmsh_copyright[] = "Copyright (C) 1997-2001 J.-F. Remacle, C. Geuzaine"; char gmsh_version[] = "Version : " ; char gmsh_os[] = "Operating System : " GMSH_OS ; +char gmsh_gui[] = "GUI toolkit : " ; char gmsh_date[] = "Build Date : " GMSH_DATE ; char gmsh_host[] = "Build Host : " GMSH_HOST ; char gmsh_packager[] = "Packager : " GMSH_PACKAGER ; 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" @@ -255,6 +258,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { !strcmp(argv[i]+1, "-info")){ fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION); fprintf(stderr, "%s\n", gmsh_os); +#if _XMOTIF + fprintf(stderr, "%s%s\n", gmsh_gui, XmVERSION_STRING); +#elif _FLTK + fprintf(stderr, "%sFLTK %d.%d.%d\n", gmsh_gui, FL_MAJOR_VERSION, + FL_MINOR_VERSION, FL_PATCH_VERSION); +#else + fprintf(stderr, "%snone\n", gmsh_gui); +#endif fprintf(stderr, "%s\n", gmsh_date); fprintf(stderr, "%s\n", gmsh_host); fprintf(stderr, "%s\n", gmsh_packager); diff --git a/Common/GetOptions.h b/Common/GetOptions.h index fee547c223..12891821bf 100644 --- a/Common/GetOptions.h +++ b/Common/GetOptions.h @@ -3,7 +3,7 @@ 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_options[]; +extern char gmsh_email[], gmsh_gui[], gmsh_options[]; extern char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName; extern char ThePathForIncludes[NAME_STR_L]; diff --git a/Common/Options.h b/Common/Options.h index 1c7abf5fc7..da9ad297c8 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -201,7 +201,7 @@ StringXNumber PostProcessingOptions_Number[] = { { "Visibility" , GMSH_INT, (void*)&CTX.post.initial_visibility , 1. }, { "IntervalsMode" , GMSH_INT, (void*)&CTX.post.initial_intervals , DRAW_POST_ISO }, { "IntervalsNumber" , GMSH_INT, (void*)&CTX.post.initial_nbiso , 15. }, - { "AnimationDelay" , GMSH_INT, (void*)&CTX.post.anim_delay , 0. }, + { "AnimationDelay" , GMSH_DOUBLE, (void*)&CTX.post.anim_delay , 0.25 }, { "NbViews" , GMSH_INT, (void*)&CTX.post.nb_views , 0. }, { NULL , GMSH_DOUBLE, NULL , 0. } } ; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 63e92ea566..eefc4b04a9 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.24 2001-02-03 13:10:26 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.25 2001-02-03 14:03:46 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -202,7 +202,7 @@ void status_play_cb(CALLBACK_ARGS){ anim_time = GetTime(); while(1){ if(stop_anim) break ; - if(GetTime() - anim_time > CTX.post.anim_delay){ + if(GetTime() - anim_time > 1.e6*CTX.post.anim_delay){ anim_time = GetTime(); MarkAllViewsChanged(2); Draw(); @@ -505,7 +505,7 @@ void opt_post_smooth_cb(CALLBACK_ARGS) { CTX.post.smooth = !CTX.post.smooth; } void opt_post_anim_delay_cb(CALLBACK_ARGS) { - CTX.post.anim_delay = (long)(1.e6*((Fl_Value_Input*)w)->value()); + CTX.post.anim_delay = ((Fl_Value_Input*)w)->value(); } // Option Statistics Menu diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 384817019d..8d86734bce 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.32 2001-02-03 13:10:26 geuzaine Exp $ +// $Id: GUI.cpp,v 1.33 2001-02-03 14:03:46 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. @@ -279,15 +279,15 @@ int GUI::global_shortcuts(int event){ return 1; } else if(Fl::test_shortcut('s')){ - CTX.post.anim_delay += 100000 ; - post_value[0]->value(1.e-6*CTX.post.anim_delay); + CTX.post.anim_delay += 0.01 ; + post_value[0]->value(CTX.post.anim_delay); post_value[0]->redraw(); return 1; } else if(Fl::test_shortcut(FL_SHIFT+'s')){ - CTX.post.anim_delay -= 100000 ; - if(CTX.post.anim_delay < 0) CTX.post.anim_delay = 0 ; - post_value[0]->value(1.e-6*CTX.post.anim_delay); + CTX.post.anim_delay -= 0.01 ; + if(CTX.post.anim_delay < 0.) CTX.post.anim_delay = 0. ; + post_value[0]->value(CTX.post.anim_delay); post_value[0]->redraw(); return 1; } @@ -442,12 +442,14 @@ int GUI::global_shortcuts(int event){ else if(Fl::test_shortcut(FL_ALT+'t')){ MarkAllViewsChanged(1); Post_View *v = (Post_View*)List_Pointer(Post_ViewList, view_number); - view_butt[6]->value(v->IntervalsType==DRAW_POST_ISO); - view_butt[6]->redraw(); - view_butt[7]->value(v->IntervalsType==DRAW_POST_DISCRETE); - view_butt[7]->redraw(); - view_butt[8]->value(v->IntervalsType==DRAW_POST_CONTINUOUS); - view_butt[8]->redraw(); + if(init_view_window){ + view_butt[6]->value(v->IntervalsType==DRAW_POST_ISO); + view_butt[6]->redraw(); + view_butt[7]->value(v->IntervalsType==DRAW_POST_DISCRETE); + view_butt[7]->redraw(); + view_butt[8]->value(v->IntervalsType==DRAW_POST_CONTINUOUS); + view_butt[8]->redraw(); + } redraw_opengl(); return 1; } @@ -467,6 +469,19 @@ GUI::GUI(int argc, char **argv) { BH = 2*CTX.fontsize+2; // button height WB = CTX.fontsize-6; // window border + init_menu_window = 0; + init_graphic_window = 0; + init_general_options_window = 0; + init_geometry_options_window = 0; + init_mesh_options_window = 0; + init_post_options_window = 0; + init_statistics_window = 0; + init_message_window = 0; + init_help_window = 0; + init_about_window = 0; + init_view_window = 0; + init_geometry_context_window = 0; + init_mesh_context_window = 0; if(strlen(CTX.display)) Fl::display(CTX.display); @@ -527,7 +542,6 @@ void GUI::check(){ //********************************* Create the menu window ***************************** void GUI::create_menu_window(int argc, char **argv){ - static int init_menu_window = 0; int i, y; if(!init_menu_window){ @@ -719,7 +733,6 @@ int GUI::get_context(){ //******************************** Create the graphic window *************************** void GUI::create_graphic_window(int argc, char **argv){ - static int init_graphic_window = 0; int i, x; if(!init_graphic_window){ @@ -868,7 +881,6 @@ void GUI::redraw_overlay(){ //************************ Create the window for general options *********************** void GUI::create_general_options_window(){ - static int init_general_options_window = 0; int i; if(!init_general_options_window){ @@ -1002,7 +1014,6 @@ void GUI::create_general_options_window(){ //************************ Create the window for geometry options ********************** void GUI::create_geometry_options_window(){ - static int init_geometry_options_window = 0; int i; if(!init_geometry_options_window){ @@ -1106,7 +1117,6 @@ void GUI::create_geometry_options_window(){ //****************************** Create the window for mesh options ******************** void GUI::create_mesh_options_window(){ - static int init_mesh_options_window = 0; int i; if(!init_mesh_options_window){ @@ -1272,7 +1282,6 @@ void GUI::create_mesh_options_window(){ //******************** Create the window for post-processing options ******************* void GUI::create_post_options_window(){ - static int init_post_options_window = 0; int i; if(!init_post_options_window){ @@ -1326,7 +1335,7 @@ void GUI::create_post_options_window(){ post_value[0]->maximum(10); post_value[0]->step(0.01); post_value[0]->callback(opt_post_anim_delay_cb); - post_value[0]->value(1.e-6*CTX.post.anim_delay); + post_value[0]->value(CTX.post.anim_delay); post_value[0]->labelsize(CTX.fontsize); post_value[0]->type(FL_HORIZONTAL); post_value[0]->align(FL_ALIGN_RIGHT); @@ -1364,7 +1373,6 @@ void GUI::create_post_options_window(){ //*********************** Create the window for the statistics ************************* void GUI::create_statistics_window(){ - static int init_statistics_window = 0; int i; if(!init_statistics_window){ @@ -1520,7 +1528,6 @@ void GUI::set_statistics(){ //********************** Create the window for the messages **************************** void GUI::create_message_window(){ - static int init_message_window = 0; if(!init_message_window){ init_message_window = 1 ; @@ -1587,7 +1594,6 @@ void GUI::save_message(char *name){ #include "Help.h" void GUI::create_help_window(){ - static int init_help_window = 0; if(!init_help_window){ init_help_window = 1 ; @@ -1634,7 +1640,6 @@ void GUI::create_help_window(){ //******************************* Create the about window ****************************** void GUI::create_about_window(){ - static int init_about_window = 0; if(!init_about_window){ init_about_window = 1 ; @@ -1652,10 +1657,11 @@ void GUI::create_about_window(){ Fl_Button *o2 = new Fl_Button(WB+80, WB, width-2*WB-80, height-2*WB); static char buffer[1024]; - sprintf(buffer, "%s\n\n%s%.2f\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s" + sprintf(buffer, "%s\n\n%s%.2f\n%s\n%sFLTK %d.%d.%d\n%s\n%s\n%s\n%s\n%s\n\n%s" "\n\nType 'gmsh -help' for command line options", - gmsh_progname, gmsh_version, GMSH_VERSION, - gmsh_os, gmsh_date, gmsh_host, gmsh_packager, + gmsh_progname, gmsh_version, GMSH_VERSION, gmsh_os, + gmsh_gui, FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION, + gmsh_date, gmsh_host, gmsh_packager, gmsh_url, gmsh_email, gmsh_copyright); o2->label(buffer); o2->box(FL_FLAT_BOX); @@ -1681,7 +1687,6 @@ void GUI::create_about_window(){ //************************* Create the window for view options ************************* void GUI::create_view_window(int num){ - static int init_view_window = 0; int i; if(!init_view_window){ @@ -2002,7 +2007,6 @@ void GUI::activate_custom(int val){ //*************** Create the window for geometry context dependant definitions ********* void GUI::create_geometry_context_window(int num){ - static int init_geometry_context_window = 0; static Fl_Group *g[10]; int i; @@ -2211,7 +2215,6 @@ char *GUI::get_geometry_symmetry(int num){//a, b, c, d //************** Create the window for mesh context dependant definitions ************** void GUI::create_mesh_context_window(int num){ - static int init_mesh_context_window = 0; static Fl_Group *g[10]; int i; diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 466f3fb139..7f3fb27d74 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -81,6 +81,7 @@ class GUI{ // We keep the following widgets for easy further reference // menu window + int init_menu_window; Fl_Window *m_window ; Fl_Menu_Bar *m_menu_bar ; Fl_Choice *m_module_butt ; @@ -90,49 +91,58 @@ class GUI{ Fl_Menu_Button *m_popup_butt [NB_BUTT_MAX] ; // graphic window + int init_graphic_window; Fl_Window *g_window ; Opengl_Window *g_opengl_window ; Fl_Button *g_status_butt[7] ; Fl_Box *g_status_label[3] ; // general options window + int init_general_options_window; Fl_Window *gen_window ; Fl_Check_Button *gen_butt[10] ; Fl_Value_Input *gen_value[10] ; // geometry options window + int init_geometry_options_window; Fl_Window *geo_window ; Fl_Check_Button *geo_butt[10] ; Fl_Input *geo_input ; Fl_Value_Input *geo_value[10] ; // mesh options window + int init_mesh_options_window; Fl_Window *mesh_window ; Fl_Check_Button *mesh_butt[20] ; Fl_Input *mesh_input ; Fl_Value_Input *mesh_value[20] ; // post-processing options window + int init_post_options_window; Fl_Window *post_window ; Fl_Check_Button *post_butt[20] ; Fl_Value_Input *post_value[20] ; // statistics window + int init_statistics_window; Fl_Window *stat_window ; Fl_Output *stat_value[50] ; // message window + int init_message_window; Fl_Window *msg_window ; Fl_Browser *msg_browser ; // help window + int init_help_window; Fl_Window *help_window ; // about window + int init_about_window; Fl_Window *about_window ; // view options window - int view_number ; + int init_view_window, view_number ; Fl_Window *view_window ; Fl_Group *view_colors, *view_colorbar, *view_range, *view_intervals ; Fl_Group *view_offsetraise, *view_timestep, *view_vector ; @@ -142,10 +152,12 @@ class GUI{ Colorbar_Window *view_colorbar_window ; // geometry context window + int init_geometry_context_window; Fl_Window *context_geometry_window ; Fl_Input *context_geometry_input[30] ; // mesh context window + int init_mesh_context_window; Fl_Window *context_mesh_window ; Fl_Input *context_mesh_input[20] ; diff --git a/Motif/CbInput.cpp b/Motif/CbInput.cpp index c22a0088e1..90613144c4 100644 --- a/Motif/CbInput.cpp +++ b/Motif/CbInput.cpp @@ -1,4 +1,4 @@ -// $Id: CbInput.cpp,v 1.4 2001-01-29 08:43:44 geuzaine Exp $ +// $Id: CbInput.cpp,v 1.5 2001-02-03 14:03:46 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -25,7 +25,6 @@ void KeyboardAccel(XEvent *event){ XComposeStatus stat; KeySym keysym; char buf[100]; - double delay ; XLookupString(&event->xkey, buf, sizeof(buf), &keysym, &stat); @@ -85,16 +84,14 @@ void KeyboardAccel(XEvent *event){ /* post shortcuts */ case XK_s: - CTX.post.anim_delay += 100000 ; - delay = CTX.post.anim_delay / 1.e6 ; - XtVaSetValues(WID.OD.postAnimScale, XmNvalue, (int)(10*delay), NULL); + CTX.post.anim_delay += 0.01 ; + XtVaSetValues(WID.OD.postAnimScale, XmNvalue, (int)(CTX.post.anim_delay), NULL); XmUpdateDisplay(WID.OD.postAnimScale); break ; case XK_S: - CTX.post.anim_delay -= 100000 ; - if(CTX.post.anim_delay < 0) CTX.post.anim_delay = 0 ; - delay = CTX.post.anim_delay / 1.e6 ; - XtVaSetValues(WID.OD.postAnimScale, XmNvalue, (int)(10*delay), NULL); + CTX.post.anim_delay -= 0.01 ; + if(CTX.post.anim_delay < 0.) CTX.post.anim_delay = 0. ; + XtVaSetValues(WID.OD.postAnimScale, XmNvalue, (int)(CTX.post.anim_delay), NULL); XmUpdateDisplay(WID.OD.postAnimScale); break ; diff --git a/Motif/CbOptions.cpp b/Motif/CbOptions.cpp index d591c92669..f72989b4bb 100644 --- a/Motif/CbOptions.cpp +++ b/Motif/CbOptions.cpp @@ -1,4 +1,4 @@ -// $Id: CbOptions.cpp,v 1.4 2001-01-29 08:43:44 geuzaine Exp $ +// $Id: CbOptions.cpp,v 1.5 2001-02-03 14:03:46 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -323,7 +323,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){ if(stop_anim) break ; } else{ - if(GetTime() - anim_time > CTX.post.anim_delay){ + if(GetTime() - anim_time > 1.e6*CTX.post.anim_delay){ anim_time = GetTime(); MarkAllViewsChanged(2); Draw(); @@ -338,7 +338,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){ break ; case OPTIONS_POST_ANIM_DELAY: XmScaleGetValue(WID.OD.postAnimScale, &e); - CTX.post.anim_delay = (long)(1.e5*e) ; + CTX.post.anim_delay = e ; break ; /* mesh + geom : a changer...*/ diff --git a/Motif/Main.cpp b/Motif/Main.cpp index 6188270242..2e3ed91c5c 100644 --- a/Motif/Main.cpp +++ b/Motif/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.7 2001-01-29 08:43:45 geuzaine Exp $ +// $Id: Main.cpp,v 1.8 2001-02-03 14:03:46 geuzaine Exp $ #include <signal.h> @@ -109,10 +109,11 @@ int main(int argc, char *argv[]){ /* Text for about window */ - sprintf(TextAbout, "%s\n \n%s%.2f\n%s\n%s\n%s\n%s\n%s\n%s\n \n%s\n \n" + sprintf(TextAbout, "%s\n \n%s%.2f\n%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n \n%s\n \n" "Type 'gmsh -help' for command line options", gmsh_progname, gmsh_version, GMSH_VERSION, - gmsh_os, gmsh_date, gmsh_host, gmsh_packager, + gmsh_os, gmsh_gui, XmVERSION_STRING, + gmsh_date, gmsh_host, gmsh_packager, gmsh_url, gmsh_email, gmsh_copyright); /* Xlib Threads init */ diff --git a/Motif/Widgets.cpp b/Motif/Widgets.cpp index be888863b2..6ffa4039d6 100644 --- a/Motif/Widgets.cpp +++ b/Motif/Widgets.cpp @@ -1,4 +1,4 @@ -// $Id: Widgets.cpp,v 1.1 2001-01-08 08:20:11 geuzaine Exp $ +// $Id: Widgets.cpp,v 1.2 2001-02-03 14:03:46 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -1238,10 +1238,10 @@ void CreateWidgets_OD(Widgets_T *w){ i=0; XtSetArg(arg[i], XmNminimum, 0); i++; - XtSetArg(arg[i], XmNmaximum, 100); i++; + XtSetArg(arg[i], XmNmaximum, 10); i++; XtSetArg(arg[i], XmNdecimalPoints, 1); i++; XtSetArg(arg[i], XmNshowValue, True); i++; - XtSetArg(arg[i], XmNvalue, CTX.post.anim_delay/1.e5); i++; + XtSetArg(arg[i], XmNvalue, CTX.post.anim_delay); i++; XtSetArg(arg[i], XmNorientation, XmHORIZONTAL); i++; w->OD.postAnimScale = XmCreateScale(w->OD.postAnimFrameRowCol, "ODpostAnimScale", arg, i); XtManageChild(w->OD.postAnimScale); -- GitLab