From 83a9d4f7b021a135d25cf5c6dd973f16734334cd Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 16 Mar 2013 18:23:22 +0000
Subject: [PATCH] when opening solver files (through file->open or e.g. in the
 finder) we now perform onelab_cb(reset); I think this is the right(TM) thing
 to do

---
 Common/OpenFile.cpp  |  2 ++
 Fltk/onelabGroup.cpp | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index f311029c36..c7662fe56f 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -681,6 +681,8 @@ void OpenProjectMacFinder(const char *fileName)
     // Gmsh is running
     OpenProject(fileName);
     drawContext::global()->draw();
+    if(CTX::instance()->launchSolverAtStartup >= 0)
+      solver_cb(0, (void*)CTX::instance()->launchSolverAtStartup);
   }
 #endif
 }
diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp
index c023d21363..fcde484ccd 100644
--- a/Fltk/onelabGroup.cpp
+++ b/Fltk/onelabGroup.cpp
@@ -1758,8 +1758,14 @@ void solver_cb(Fl_Widget *w, void *data)
 
   if(FlGui::instance()->onelab->isBusy())
     FlGui::instance()->onelab->show();
-  else
-    onelab_cb(0, (num >= 0) ? (void*)"check" : (void*)"refresh");
+  else{
+    if(CTX::instance()->launchSolverAtStartup >= 0)
+      onelab_cb(0, (void*)"reset");
+    else if(num >= 0)
+      onelab_cb(0, (void*)"check");
+    else
+      onelab_cb(0, (void*)"refresh");
+  }
 
   CTX::instance()->launchSolverAtStartup = -1;
 }
-- 
GitLab