From 71420c759af0adc8593120dd82607ca6b1738ede Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 2 Feb 2012 14:06:04 +0000
Subject: [PATCH] add way to highlight attributes (for Francois)

---
 Common/GmshMessage.cpp | 1 +
 Fltk/inputRange.h      | 2 ++
 Fltk/onelabWindow.cpp  | 7 ++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index c0c7357b49..bf75b4ffc4 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -664,6 +664,7 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
   if(copt.count("ShortHelp")) ps[0].setShortHelp(copt["ShortHelp"][0]);
   if(copt.count("Loop")) ps[0].setAttribute("Loop", copt["Loop"][0]);
   if(copt.count("Graph")) ps[0].setAttribute("Graph", copt["Graph"][0]);
+  if(copt.count("Hightlight")) ps[0].setAttribute("Highlight", copt["Hightlight"][0]);
   _onelabClient->set(ps[0]);
 #endif
 }
diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h
index 849ff56280..440f885b84 100644
--- a/Fltk/inputRange.h
+++ b/Fltk/inputRange.h
@@ -312,4 +312,6 @@ class inputRange : public Fl_Group {
   std::string loop(){ return _loop_val; }
   void graph(const std::string &val){ _set_graph_value(val); }
   std::string graph(){ return _graph_val; }
+  void color(int col){ _input->color(col); }
+  int color(){ return _input->color(); }
 };
diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp
index eee7db129b..df43c356cb 100644
--- a/Fltk/onelabWindow.cpp
+++ b/Fltk/onelabWindow.cpp
@@ -967,7 +967,8 @@ void onelabWindow::rebuildTree()
     std::string label = numbers[i].getShortName();
     _tree->begin();
     if(numbers[i].getChoices().size() == 2 &&
-       numbers[i].getChoices()[0] == 0 && numbers[i].getChoices()[1] == 1){
+       numbers[i].getChoices()[0] == 0 &&
+       numbers[i].getChoices()[1] == 1){
       Fl_Check_Button *but = new Fl_Check_Button(1, 1, width, 1);
       _treeWidgets.push_back(but);
       but->copy_label(label.c_str());
@@ -987,6 +988,8 @@ void onelabWindow::rebuildTree()
       but->choices(numbers[i].getChoices());
       but->loop(numbers[i].getAttribute("Loop"));
       but->graph(numbers[i].getAttribute("Graph"));
+      if(numbers[i].getAttribute("Highlight").size())
+        but->color(FL_YELLOW);
       but->align(FL_ALIGN_RIGHT);
       but->callback(onelab_input_range_cb, (void*)n);
       but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
@@ -1030,6 +1033,8 @@ void onelabWindow::rebuildTree()
     menu.push_back(it);
     but->menubutton()->copy(&menu[0]);
     but->value(strings[i].getValue().c_str());
+    if(strings[i].getAttribute("Highlight").size())
+      but->color(FL_YELLOW);
     but->align(FL_ALIGN_RIGHT);
     but->callback(onelab_input_choice_cb, (void*)n);
     but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
-- 
GitLab