From e4bb552915b08fc82ac20c1c71a9329b90f4f5ea Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 3 May 2001 08:41:55 +0000
Subject: [PATCH] *** empty log message ***

---
 Common/Context.h        | 1 +
 Common/DefaultOptions.h | 5 +++++
 Common/Options.cpp      | 6 +++++-
 Common/Options.h        | 1 +
 Fltk/Callbacks.cpp      | 7 +++++--
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index f2966b1e6e..f0f2d71d48 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 236c21d02e..53fba59f0f 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 46d8d86d20..7394b6272b 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 d984dcb4ef..9edd600656 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 2d0e399dcc..52c077f6e2 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;
-- 
GitLab