diff --git a/Common/Context.h b/Common/Context.h index f2966b1e6e2eba3f7b40877355443fc4f2f97e2a..f0f2d71d48e4cbdf1f5eec25a196fb9a857e879c 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -38,6 +38,7 @@ public : char *error_filename; // the name of the error file char *display; // forced display host:0.0 under X11 int terminal; // show we print to the terminal console? + char *editor; // text editor command (with included '%s') int position[2]; // position of the menu window on the screen int gl_position[2]; // position of the graphic window on the screen diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 236c21d02ef337d9b659445a772574e25104ebc8..53fba59f0ff554d18de9fe47e21aa96fe3ea3074 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -19,6 +19,11 @@ StringXString GeneralOptions_String[] = { { F|S, "TmpFileName" , opt_general_tmp_filename , ".gmsh-tmp" }, { F|S, "ErrorFileName" , opt_general_error_filename , ".gmsh-errors" }, { F|S, "OptionsFileName" , opt_general_options_filename , ".gmsh-options" }, +#ifdef WIN32 + { F|O, "Editor" , opt_general_editor , "wordpad %s" }, +#else + { F|O, "Editor" , opt_general_editor , "emacs %s &" }, +#endif { 0, NULL , NULL , NULL } } ; diff --git a/Common/Options.cpp b/Common/Options.cpp index 46d8d86d20c0050e49a4e81f692e951b01d396b4..7394b6272b527121377d10c759ea05d6287b646c 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.12 2001-04-22 18:13:02 geuzaine Exp $ +// $Id: Options.cpp,v 1.13 2001-05-03 08:41:55 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -435,6 +435,10 @@ char * opt_general_options_filename(OPT_ARGS_STR){ #endif return CTX.options_filename; } +char * opt_general_editor(OPT_ARGS_STR){ + if(action & GMSH_SET) CTX.editor = val; + return CTX.editor; +} char * opt_view_name(OPT_ARGS_STR){ diff --git a/Common/Options.h b/Common/Options.h index d984dcb4ef0ae42eea073a5f051407600a1d44c9..9edd600656c22dc99728d881f1c14fe93f2c8bf4 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -23,6 +23,7 @@ char * opt_general_tmp_filename(OPT_ARGS_STR); char * opt_general_error_filename(OPT_ARGS_STR); char * opt_general_session_filename(OPT_ARGS_STR); char * opt_general_options_filename(OPT_ARGS_STR); +char * opt_general_editor(OPT_ARGS_STR); char * opt_view_name(OPT_ARGS_STR); char * opt_view_format(OPT_ARGS_STR); char * opt_view_filename(OPT_ARGS_STR); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 2d0e399dccaf7da2edbfef6ad26934084330d519..52c077f6e2333f04802f8c811529075985269194 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.47 2001-05-03 00:09:42 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.48 2001-05-03 08:41:55 geuzaine Exp $ #include <map> #include "Gmsh.h" @@ -1325,7 +1325,10 @@ void getdp_file_open_cb(CALLBACK_ARGS){ GetDP(GetDP_Info.file); } void getdp_file_edit_cb(CALLBACK_ARGS){ - Msg(WARNING, "Should lauch a file editor"); + char cmd[1000]; + sprintf(cmd, CTX.editor, GetDP_Info.file); + Msg(INFO, "Starting text editor '%s'", cmd); + system(cmd); } void getdp_choose_mesh_cb(CALLBACK_ARGS){ char *newfile;