From a124f582c643ce1a2eaa80410a1be752e33539d9 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 11 Jan 2013 10:14:11 +0000
Subject: [PATCH] tweak

---
 Fltk/FlGui.cpp | 18 ++++++++++++------
 Fltk/FlGui.h   |  6 ++++--
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index 644eee4e9d..2ba90986c7 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -657,11 +657,11 @@ char FlGui::selectEntity(int type)
      selectedElements);
 }
 
-void FlGui::setStatus(const char *msg, bool opengl)
+void FlGui::setStatus(const std::string &msg, bool opengl)
 {
   if(!opengl){
     static char buff[1024];
-    strncpy(buff, msg, sizeof(buff) - 1);
+    strncpy(buff, msg.c_str(), sizeof(buff) - 1);
     buff[sizeof(buff) - 1] = '\0';
     for(unsigned int i = 0; i < graph.size(); i++){
       graph[i]->getProgress()->label(buff);
@@ -670,21 +670,21 @@ void FlGui::setStatus(const char *msg, bool opengl)
   }
   else{
     openglWindow *gl = getCurrentOpenglWindow();
-    int n = strlen(msg);
+    int n = msg.size();
     int i = 0;
     while(i < n) if(msg[i++] == '\n') break;
-    gl->screenMessage[0] = std::string(msg);
+    gl->screenMessage[0] = msg;
     if(i)
       gl->screenMessage[0].resize(i - 1);
     if(i < n)
-      gl->screenMessage[1] = std::string(&msg[i]);
+      gl->screenMessage[1] = msg.substr(i);
     else
       gl->screenMessage[1].clear();
     drawContext::global()->draw();
   }
 }
 
-void FlGui::setProgress(const char *msg, double val, double min, double max)
+void FlGui::setProgress(const std::string &msg, double val, double min, double max)
 {
   for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){
     if(FlGui::instance()->graph[i]->getProgress()->value() != val)
@@ -697,6 +697,12 @@ void FlGui::setProgress(const char *msg, double val, double min, double max)
   setStatus(msg);
 }
 
+void FlGui::setProgressColor(int col)
+{
+  for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
+    FlGui::instance()->graph[i]->getProgress()->labelcolor(col);
+}
+
 void FlGui::storeCurrentWindowsInfo()
 {
   CTX::instance()->glPosition[0] = graph[0]->getWindow()->x();
diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h
index a8034c05e2..0aa3834585 100644
--- a/Fltk/FlGui.h
+++ b/Fltk/FlGui.h
@@ -108,9 +108,11 @@ class FlGui{
   // select an entity in the most recent graphic window
   char selectEntity(int type);
   // display status message
-  void setStatus(const char *msg, bool opengl=false);
+  void setStatus(const std::string &msg, bool opengl=false);
   // display status message and update progress bar
-  void setProgress(const char *msg, double val, double min, double max);
+  void setProgress(const std::string &msg, double val, double min, double max);
+  // set color of progress message
+  void setProgressColor(int col);
   // create the window for physical context dependant definitions
   void callForSolverPlugin(int dim);
   // add line in message console(s)
-- 
GitLab