From e5863a89cf57bdddd8b0a75216115cdd38b2e15b Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 7 Feb 2013 16:51:17 +0000
Subject: [PATCH] fix

---
 Common/CommandLine.cpp | 61 +++++++++++++++++++++---------------------
 Common/GmshMessage.cpp | 17 ++++++------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index a48ac2d2d4..3fd1d273d0 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -6,6 +6,7 @@
 #include <string>
 #include <string.h>
 #include <stdlib.h>
+#include <fstream>
 #include "GmshConfig.h"
 #include "GmshDefines.h"
 #include "GmshVersion.h"
@@ -17,8 +18,6 @@
 #include "GModel.h"
 #include "CreateFile.h"
 #include "OS.h"
-#include <fstream>
-#include <periodical.h>
 
 #if defined(HAVE_FLTK)
 #include <FL/Fl.H>
@@ -33,6 +32,10 @@
 #include "PView.h"
 #endif
 
+#if defined(HAVE_MESH)
+#include "periodical.h"
+#endif
+
 int GetGmshMajorVersion(){ return GMSH_MAJOR_VERSION; }
 int GetGmshMinorVersion(){ return GMSH_MINOR_VERSION; }
 int GetGmshPatchVersion(){ return GMSH_PATCH_VERSION; }
@@ -472,36 +475,32 @@ void GetOptions(int argc, char *argv[])
         else
           Msg::Fatal("Missing number of lloyd iterations");
       }
-	  else if(!strcmp(argv[i] + 1, "microstructure")) {
-	    i++;
-
-		int j;
-		double number;
-		double temp;
-		std::vector<double> coordinates;
-		  
-		if(argv[i]){
-	      std::ifstream file(argv[i++]);
-		  file >> number;
-		  coordinates.clear();
-		  coordinates.resize(3*number);
-			
-		  for(j=0;j<number;j++){
-		    file >> coordinates[3*j];
-			file >> coordinates[3*j+1];
-			file >> coordinates[3*j+2];
-			file >> temp;
-		  }
-			
-		  voroMetal3D vm1;
-		  vm1.execute(coordinates,0.1);
-			
-		  GModel::current()->load("MicrostructurePolycrystal3D.geo");
-						
-		  voroMetal3D vm2;
-		  vm2.correspondance(0.00001);
-		}
+#if defined(HAVE_MESH)
+      else if(!strcmp(argv[i] + 1, "microstructure")) {
+        i++;
+        int j;
+        double number;
+        double temp;
+        std::vector<double> coordinates;
+        if(argv[i]){
+          std::ifstream file(argv[i++]);
+          file >> number;
+          coordinates.clear();
+          coordinates.resize(3*number);
+          for(j = 0; j <number; j++){
+            file >> coordinates[3*j];
+            file >> coordinates[3*j+1];
+            file >> coordinates[3*j+2];
+            file >> temp;
+          }
+          voroMetal3D vm1;
+          vm1.execute(coordinates,0.1);
+          GModel::current()->load("MicrostructurePolycrystal3D.geo");
+          voroMetal3D vm2;
+          vm2.correspondance(0.00001);
+        }
       }
+#endif
       else if(!strcmp(argv[i] + 1, "nopopup")) {
         CTX::instance()->noPopup = 1;
         i++;
diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index d5b6e208f7..65485795f3 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -544,13 +544,13 @@ void Msg::PrintErrorCounter(const char *title)
 
 #if defined(HAVE_FLTK)
   if(FlGui::available()){
-    std::string red("@C1@.");
-    FlGui::instance()->addMessage((red + prefix + line).c_str());
-    FlGui::instance()->addMessage((red + prefix + title).c_str());
-    FlGui::instance()->addMessage((red + prefix + warn).c_str());
-    FlGui::instance()->addMessage((red + prefix + err).c_str());
-    FlGui::instance()->addMessage((red + prefix + help).c_str());
-    FlGui::instance()->addMessage((red + prefix + line).c_str());
+    std::string col = _errorCount ? "@C1@." : "@C5@.";
+    FlGui::instance()->addMessage((col + prefix + line).c_str());
+    FlGui::instance()->addMessage((col + prefix + title).c_str());
+    FlGui::instance()->addMessage((col + prefix + warn).c_str());
+    FlGui::instance()->addMessage((col + prefix + err).c_str());
+    FlGui::instance()->addMessage((col + prefix + help).c_str());
+    FlGui::instance()->addMessage((col + prefix + line).c_str());
     if(_errorCount) fl_beep();
   }
 #endif
@@ -558,7 +558,8 @@ void Msg::PrintErrorCounter(const char *title)
   if(CTX::instance()->terminal){
     const char *c0 = "", *c1 = "";
     if(!streamIsFile(stderr) && streamIsVT100(stderr)){
-      c0 = "\33[31m"; c1 = "\33[0m";  // red
+      c0 = _errorCount ? "\33[1m\33[31m" : "\33[35m"; // bold red or magenta
+      c1 = "\33[0m";
     }
     fprintf(stderr, "%s%s\n%s\n%s\n%s\n%s\n%s%s\n", c0, (prefix + line).c_str(),
             (prefix + title).c_str(), (prefix + warn).c_str(),
-- 
GitLab