diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 644eee4e9d3e81540f539fab6d9730af62b55c84..2ba90986c79ffca04a3a806ad93a3d90ae7f0804 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 a8034c05e2165588a9ab8203bdeadc0a3d63fc55..0aa3834585c910ce5add22a8f46880a7ccc2fcf0 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)