diff --git a/Common/Context.cpp b/Common/Context.cpp index a4e3b1a922b734b2edf767ffc19a278f75311bf8..81ba42abf4db58c517abec569ea4fcd67ee676c9 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -1,4 +1,4 @@ -// $Id: Context.cpp,v 1.33 2001-01-13 15:41:35 geuzaine Exp $ +// $Id: Context.cpp,v 1.34 2001-01-24 09:28:03 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -295,8 +295,13 @@ void Print_Configuration(char *filename){ return; } - fprintf(file, "// Default Gmsh Configuration\n"); - fprintf(file, "// This is an automatically generated file: Do not edit!\n"); + 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]); diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index 8469a84efa9d2ebd80dce3b4b647b27c0c3409f9..b38b10254ceb8ee7f4c636c23fde42c41ad86773 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,4 +1,4 @@ -// $Id: GetOptions.cpp,v 1.4 2001-01-13 15:41:35 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.5 2001-01-24 09:28:03 geuzaine Exp $ #include "Gmsh.h" #include "GmshVersion.h" @@ -47,15 +47,18 @@ char gmsh_options[] = " -noview hide all views on startup\n" " -link link all views on startup\n" "Display options:\n" +#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" +#else " -fontsize int size of the font for the user interface (default: 12)\n" +#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" - " -flash allow colormap flashing\n" - " -samevisual force same visual for graphics and UI\n" #endif "Other options:\n" #ifndef _BLACKBOX diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index ff56502f7a8d92e8cd069d21c7bb136240a70bda..e6874b42abf00492b71343cb41653fd0b89c5f18 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.20 2001-01-13 15:41:35 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.21 2001-01-24 09:28:03 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -1450,16 +1450,19 @@ void view_options_custom_range_cb(CALLBACK_ARGS){ WID->activate_custom(0); v->RangeType = DRAW_POST_DEFAULT; } + v->Changed = 1; ENDVIEWMOD } void view_options_custom_min_cb(CALLBACK_ARGS){ STARTVIEWMOD v->CustomMin = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_custom_max_cb(CALLBACK_ARGS){ STARTVIEWMOD v->CustomMax = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_linear_range_cb(CALLBACK_ARGS){ @@ -1470,6 +1473,7 @@ void view_options_linear_range_cb(CALLBACK_ARGS){ else{ v->ScaleType = DRAW_POST_LOGARITHMIC; } + v->Changed = 1; ENDVIEWMOD } void view_options_logarithmic_range_cb(CALLBACK_ARGS){ @@ -1480,17 +1484,20 @@ void view_options_logarithmic_range_cb(CALLBACK_ARGS){ else{ v->RangeType = DRAW_POST_LINEAR; } + v->Changed = 1; ENDVIEWMOD } void view_options_nbiso_cb(CALLBACK_ARGS){ STARTVIEWMOD v->NbIso = (int)((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_iso_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->IntervalsType = DRAW_POST_ISO; + v->Changed = 1; } ENDVIEWMOD } @@ -1498,6 +1505,7 @@ void view_options_fillediso_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->IntervalsType = DRAW_POST_DISCRETE; + v->Changed = 1; } ENDVIEWMOD } @@ -1505,6 +1513,7 @@ void view_options_continuousiso_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->IntervalsType = DRAW_POST_CONTINUOUS; + v->Changed = 1; } ENDVIEWMOD } @@ -1512,42 +1521,50 @@ void view_options_numericiso_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->IntervalsType = DRAW_POST_NUMERIC; + v->Changed = 1; } ENDVIEWMOD } void view_options_xoffset_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Offset[0] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_yoffset_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Offset[1] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_zoffset_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Offset[2] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_xraise_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Raise[0] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_yraise_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Raise[1] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_zraise_cb(CALLBACK_ARGS){ STARTVIEWMOD v->Raise[2] = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_timestep_cb(CALLBACK_ARGS){ STARTVIEWMOD v->TimeStep = (int)((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD Init(); Draw(); @@ -1556,6 +1573,7 @@ void view_options_vector_line_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_SEGMENT; + v->Changed = 1; } ENDVIEWMOD } @@ -1563,6 +1581,7 @@ void view_options_vector_arrow_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_ARROW; + v->Changed = 1; } ENDVIEWMOD } @@ -1570,6 +1589,7 @@ void view_options_vector_cone_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_CONE; + v->Changed = 1; } ENDVIEWMOD } @@ -1577,18 +1597,21 @@ void view_options_vector_displacement_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_DISPLACEMENT; + v->Changed = 1; } ENDVIEWMOD } void view_options_vector_scale_cb(CALLBACK_ARGS){ STARTVIEWMOD v->ArrowScale = ((Fl_Value_Input*)w)->value() ; + v->Changed = 1; ENDVIEWMOD } void view_options_vector_cog_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_LOCATE_COG; + v->Changed = 1; } ENDVIEWMOD } @@ -1596,6 +1619,7 @@ void view_options_vector_vertex_cb(CALLBACK_ARGS){ STARTVIEWMOD if(((Fl_Check_Button*)w)->value()){ v->ArrowType = DRAW_POST_LOCATE_VERTEX; + v->Changed = 1; } ENDVIEWMOD } diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 952698b75e8e49a15a822a2141a124a712435c1b..e82b9d95780b8a312b5f79d1d5433cfc2b9b7731 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -261,6 +261,13 @@ int GUI::global_shortcuts(int event){ mesh_3d_cb(0,0); return 1; } + else if(Fl::test_shortcut(FL_CTRL+'z')){ + g_window->iconize(); + return 1; + } + else if(Fl::test_shortcut(FL_Escape)){ + return 1; + } return 0; } @@ -268,7 +275,7 @@ int GUI::global_shortcuts(int event){ //***************************** The GUI constructor ************************************ -GUI::GUI() { +GUI::GUI(int argc, char **argv) { IW = 10*CTX.fontsize; // input field width BW = 3*IW/2; // width of a button with external label @@ -290,8 +297,23 @@ GUI::GUI() { // All static windows are contructed (even if some are not // displayed) since the shortcuts should be valid even for hidden // windows - create_menu_window(); m_window->show(); - create_graphic_window(); g_window->show(); + + create_menu_window(argc, argv); + create_graphic_window(argc, argv); + +#ifndef WIN32 + fl_open_display(); + Pixmap p1 = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), + g1_bits, g1_width, g1_height); + Pixmap p2 = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), + g2_bits, g2_width, g2_height); + m_window->icon((char *)p1); + g_window->icon((char *)p2); +#endif + + m_window->show(1, argv); + g_window->show(1, argv); + create_general_options_window(); create_geometry_options_window(); create_mesh_options_window(); @@ -320,7 +342,7 @@ void GUI::check(){ //********************************* Create the menu window ***************************** -void GUI::create_menu_window(){ +void GUI::create_menu_window(int argc, char **argv){ static int init_menu_window = 0; int i, y; @@ -398,7 +420,7 @@ void GUI::create_menu_window(){ if(m_window->shown()) m_window->redraw(); else - m_window->show(); + m_window->show(1, argv); } } @@ -457,7 +479,7 @@ void GUI::set_context(Context_Item *menu_asked, int flag){ else if(menu[0].label[0] == '1') m_module_butt->value(1); else if(menu[0].label[0] == '2') m_module_butt->value(2); else { - Msg(WARNING, "Something Wrong in your Context Definition"); + Msg(WARNING, "Something Wrong in your Dynamic Context Definition"); return; } @@ -471,8 +493,6 @@ void GUI::set_context(Context_Item *menu_asked, int flag){ m_toggle_butt[i]->value(v->Visible); m_toggle_butt[i]->label(v->Name); m_popup_butt[i]->show(); - // v->NbTimeStep>1 : sensitive timestep - // v->ScalarOnly : sensitive vector, apply bgmesh } for(i = List_Nbr(Post_ViewList) ; i < NB_BUTT_MAX ; i++) { m_push_butt[i]->hide(); @@ -513,7 +533,7 @@ int GUI::get_context(){ //******************************** Create the graphic window *************************** -void GUI::create_graphic_window(){ +void GUI::create_graphic_window(int argc, char **argv){ static int init_graphic_window = 0; int i, x; @@ -587,7 +607,7 @@ void GUI::create_graphic_window(){ if(g_window->shown()) g_window->redraw(); else - g_window->show(); + g_window->show(1, argv); } } @@ -772,14 +792,14 @@ void GUI::create_general_options_window(){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "OK"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)gen_window); + o->callback(ok_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(ok_cb); + o->callback(cancel_cb, (void*)gen_window); } if(CTX.center_windows) @@ -876,14 +896,14 @@ void GUI::create_geometry_options_window(){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "OK"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)geo_window); + o->callback(ok_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(ok_cb); + o->callback(cancel_cb, (void*)geo_window); } if(CTX.center_windows) @@ -1041,14 +1061,14 @@ void GUI::create_mesh_options_window(){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "OK"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)mesh_window); + o->callback(ok_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(ok_cb); + o->callback(cancel_cb, (void*)mesh_window); } if(CTX.center_windows) @@ -1122,14 +1142,14 @@ void GUI::create_post_options_window(){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "OK"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)post_window); + o->callback(ok_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(ok_cb); + o->callback(cancel_cb, (void*)post_window); } if(CTX.center_windows) @@ -1215,14 +1235,14 @@ void GUI::create_statistics_window(){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-BB/3-2*WB, height-BH-WB, BB+BB/3, BH, "update"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)stat_window); + o->callback(opt_statistics_update_cb); } { - Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "update"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(opt_statistics_update_cb); + o->callback(cancel_cb, (void*)stat_window); } if(CTX.center_windows) @@ -1323,14 +1343,14 @@ void GUI::create_message_window(){ msg_browser->textsize(CTX.fontsize); { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "save"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)msg_window); + o->callback(opt_message_save_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "save"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(opt_message_save_cb); + o->callback(cancel_cb, (void*)msg_window); } msg_window->resizable(msg_browser); @@ -1630,14 +1650,14 @@ void GUI::create_view_window(int num){ } { - Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "cancel"); + Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "OK"); o->labelsize(CTX.fontsize); - o->callback(cancel_cb, (void*)view_window); + o->callback(ok_cb); } { - Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK"); + Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "cancel"); o->labelsize(CTX.fontsize); - o->callback(ok_cb); + o->callback(cancel_cb, (void*)view_window); } if(CTX.center_windows) diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 3e95129815c7ca8d51b23a6349c64e7122888917..098b9db34b0b48bdb392d69c13fa41314ef752e1 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -21,6 +21,7 @@ #include <FL/Fl_Multiline_Output.H> #include <FL/Fl_Bitmap.H> #include <FL/Fl_Browser.H> +#include <FL/x.H> #include "Opengl_Window.h" #include "Colorbar_Window.h" @@ -149,11 +150,11 @@ class GUI{ public: // the constructor - GUI(); + GUI(int argc, char **argv); // create the windows - void create_menu_window(); - void create_graphic_window(); + void create_menu_window(int argc, char **argv); + void create_graphic_window(int argc, char **argv); void create_general_options_window(); void create_geometry_options_window(); void create_mesh_options_window(); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index ada6e07c3319ecc254628b574df62880192b3b26..171d956ed98b6da38ea4d55feabd391686c18cde 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.11 2001-01-13 15:48:31 geuzaine Exp $ +// $Id: Main.cpp,v 1.12 2001-01-24 09:28:03 geuzaine Exp $ #include <signal.h> @@ -88,7 +88,7 @@ int main(int argc, char *argv[]){ // Create the GUI - WID = new GUI(); + WID = new GUI(argc, argv); // The GUI is ready CTX.interactive = 0 ; diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp index e1cddb66b227f1df2fff89eb8226231dc4e6b005..aec37631a8dc1d0ed0ee56526cbf6958be3b9e0f 100644 --- a/Graphics/CreateFile.cpp +++ b/Graphics/CreateFile.cpp @@ -1,4 +1,4 @@ -// $Id: CreateFile.cpp,v 1.10 2001-01-12 13:28:58 geuzaine Exp $ +// $Id: CreateFile.cpp,v 1.11 2001-01-24 09:28:03 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -63,13 +63,15 @@ void CreateFile (char *name, int format) { else if(!strcmp(ext,".yuv")) CreateFile(name, FORMAT_YUV); else { if(strlen(name) < 5) - Msg(GERROR, "Unknown Extension for Automatic Format Detection"); + Msg(GERROR, "Unknown Extension in \"%s\" for Automatic Format Detection", + name); else{ strcpy(ext,name+(strlen(name)-5)); if(!strcmp(ext,".jpeg")) CreateFile(name, FORMAT_JPEG); else if(!strcmp(ext,".gref")) CreateFile(name, FORMAT_GREF); else if(!strcmp(ext,".Gref")) CreateFile(name, FORMAT_GREF); - else Msg(GERROR, "Unknown Extension \"%s\" for Automatic Format Detection", ext); + else Msg(GERROR, "Unknown Extension in \"%s\" for Automatic Format Detection", + name); } } }