Skip to content
Snippets Groups Projects
Commit c8c83efb authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

simplify

parent d26697cd
No related branches found
No related tags found
No related merge requests found
......@@ -451,22 +451,20 @@ void Msg::ProgressMeter(int n, int N, bool log, const char *fmt, ...)
double percent = 100. * (double)n/(double)N;
if(percent >= _progressMeterCurrent){
char str[1024];
if(percent >= _progressMeterCurrent || n > N - 1){
char str[1024], str2[1024];
va_list args;
va_start(args, fmt);
vsnprintf(str, sizeof(str), fmt, args);
va_end(args);
char str2[1024];
sprintf(str2, "[%3d%%] %s", _progressMeterCurrent, str);
sprintf(str2, "%3d%% : %s", _progressMeterCurrent, str);
if(_client) _client->Progress(str2);
#if defined(HAVE_FLTK)
if(FlGui::available() && _verbosity > 4){
FlGui::instance()->check();
FlGui::instance()->setProgress(str, n, 0, N);
FlGui::instance()->setProgress(str, (n > N - 1) ? 0 : n, 0, N);
}
#endif
......@@ -478,22 +476,6 @@ void Msg::ProgressMeter(int n, int N, bool log, const char *fmt, ...)
while(_progressMeterCurrent < percent)
_progressMeterCurrent += _progressMeterStep;
}
if(n > N - 1){
if(_client) _client->Progress("Done!");
#if defined(HAVE_FLTK)
if(FlGui::available() && _verbosity > 4){
FlGui::instance()->check();
FlGui::instance()->setProgress("", 0, 0, N);
}
#endif
if(log && CTX::instance()->terminal){
fprintf(stdout, "Done! \r");
fflush(stdout);
}
}
}
void Msg::PrintTimers()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment