From 264cf6b6938d0dff7e7aad926077208294097812 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 7 May 2012 14:09:54 +0000
Subject: [PATCH] don't hide ModelName + better treatment of ReadOnly

---
 Fltk/inputRange.h     |  1 +
 Fltk/onelabWindow.cpp | 17 ++++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h
index 440f885b84..720197382d 100644
--- a/Fltk/inputRange.h
+++ b/Fltk/inputRange.h
@@ -314,4 +314,5 @@ class inputRange : public Fl_Group {
   std::string graph(){ return _graph_val; }
   void color(int col){ _input->color(col); }
   int color(){ return _input->color(); }
+  Fl_Value_Input *input(){ return _input; }
 };
diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp
index cd38d72c38..25aa759470 100644
--- a/Fltk/onelabWindow.cpp
+++ b/Fltk/onelabWindow.cpp
@@ -436,7 +436,6 @@ static void guessModelName(onelab::client *c)
     std::string name(split[0] + split[1] + ext);
     onelab::string o(c->getName() + "/1ModelName", name, "Model name");
     o.setKind("file");
-    o.setVisible(false);
     c->set(o);
   }
 }
@@ -1095,10 +1094,10 @@ void onelabWindow::_addParameter(onelab::number &p)
     Fl_Color c;
     if(getFlColor(p.getAttribute("Highlight"), c))
       but->color(c);
-    if(p.getReadOnly()){
-      getFlColor("AliceBlue", c); // rendre également la case non éditable
-      but->color(c);
-    }
+    if(p.getReadOnly())
+      but->deactivate();
+    else
+      but->activate();
     but->align(FL_ALIGN_RIGHT);
     but->callback(onelab_input_range_cb, (void*)n);
     but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
@@ -1143,10 +1142,10 @@ void onelabWindow::_addParameter(onelab::string &p)
   Fl_Color c;
   if(getFlColor(p.getAttribute("Highlight"), c))
     but->input()->color(c);
-  if(p.getReadOnly()){
-    getFlColor("ALiceBlue", c); // rendre également la case non éditable
-    but->input()->color(c);
-  }
+  if(p.getReadOnly())
+    but->input()->deactivate();
+  else
+    but->input()->activate();
   but->align(FL_ALIGN_RIGHT);
   but->callback(onelab_input_choice_cb, (void*)n);
   but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
-- 
GitLab