Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 11877)
+++ /trunk/FACT++/gui/FactGui.h	(revision 11878)
@@ -3132,7 +3132,7 @@
 
         // Loop over the software idx of all pixels
-        for (unsigned int i=0; i<1440; i++)
-            if (fPatchHW[i]==ihw)
-                cam.SetBold(i);
+//        for (unsigned int i=0; i<1440; i++)
+//            if (fPatchHW[i]==ihw)
+//                cam.SetBold(i);
     }
 
Index: /trunk/FACT++/gui/QCameraWidget.cc
===================================================================
--- /trunk/FACT++/gui/QCameraWidget.cc	(revision 11877)
+++ /trunk/FACT++/gui/QCameraWidget.cc	(revision 11878)
@@ -19,4 +19,25 @@
         logScale = false;
         cameraRotation = 0;
+
+        pixelContourColour[0] = 0.1f;
+        pixelContourColour[1] = 0.1f;
+        pixelContourColour[2] = 0.1f;
+        patchesCoulour[0] = 0.15f;
+        patchesCoulour[1] = 0.15f;
+        patchesCoulour[2] = 0.15f;
+        highlightedPatchesCoulour[0] = 0.6f;
+        highlightedPatchesCoulour[1] = 0.6f;
+        highlightedPatchesCoulour[2] = 0.6f;
+        highlightedPixelsCoulour[0] = 0.8f;
+        highlightedPixelsCoulour[1] = 0.8f;
+        highlightedPixelsCoulour[2] = 0.8f;
+
+        tooHighValueCoulour[0] = 1.f;
+        tooHighValueCoulour[1] = 1.f;
+        tooHighValueCoulour[2] = 0.f;
+        tooLowValueCoulour[0] = 0.f;
+        tooLowValueCoulour[1] = 1.f;
+        tooLowValueCoulour[2] = 1.f;
+
         CalculatePixelsColor();
 
@@ -160,10 +181,21 @@
          glScalef(1.5, 1.5, 1.5);
          drawCamera(true);
+
+         glLineWidth(1.0f);
+         glColor3fv(highlightedPixelsCoulour);
+         for (vector<int>::iterator it = highlightedPixels.begin(); it!= highlightedPixels.end(); it++)
+         {
+             drawHexagon(*it, false);
+         }
          drawPatches();
 
         glLineWidth(1.0f);
-        glColor3f(1,1,1);
-        drawHexagon(fWhite, false);
-
+
+        //glColor3f(1.f - pixelsColor[fWhite][0],1.f - pixelsColor[fWhite][1],1.f - pixelsColor[fWhite][2]);
+        if (fWhite != -1)
+        {
+            glColor3f(1.f, 0.f, 0.f);
+            drawHexagon(fWhite, false);
+        }
         DrawCameraText();
 
@@ -186,5 +218,5 @@
         if (!alsoWire)
             return;
-        glColor3f(0.0f,0.0f,0.0f);
+        glColor3fv(pixelContourColour);//0.0f,0.0f,0.0f);
         for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
         {
@@ -195,15 +227,39 @@
     {
         glLineWidth(2.0f);
-        glColor3f(patchColour[0],patchColour[1],patchColour[2]);//0.5f, 0.5f, 0.3f);
-        glBegin(GL_LINES);
-//        for (int i=0;i<NTMARK;i++)
-//        {
-            for (unsigned int j=0;j<patchesIndices[fWhitePatch].size();j++)
-            {
-                glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].first]);
-                glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].second]);
-            }
-//        }
-        glEnd();
+        glColor3fv(patchesCoulour);
+         glBegin(GL_LINES);
+                 for (int i=0;i<NTMARK;i++)
+                {
+                     for (unsigned int j=0;j<patchesIndices[i].size();j++)
+                     {
+                         glVertex2fv(verticesList[patchesIndices[i][j].first]);
+                         glVertex2fv(verticesList[patchesIndices[i][j].second]);
+                     }
+                 }
+         glEnd();
+
+         glColor3fv(highlightedPatchesCoulour);
+         glBegin(GL_LINES);
+         for (vector<int>::iterator it=highlightedPatches.begin(); it!= highlightedPatches.end(); it++)
+         {
+             for (unsigned int j=0;j<patchesIndices[*it].size();j++)
+             {
+                 glVertex2fv(verticesList[patchesIndices[*it][j].first]);
+                 glVertex2fv(verticesList[patchesIndices[*it][j].second]);
+             }
+         }
+         glEnd();
+         if (fWhitePatch != -1)
+         {
+             glColor3f(1.f, 0.5f, 0.f);//patchColour);//[0],patchColour[1],patchColour[2]);//0.5f, 0.5f, 0.3f);
+             glBegin(GL_LINES);
+             for (unsigned int j=0;j<patchesIndices[fWhitePatch].size();j++)
+             {
+                 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].first]);
+                 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].second]);
+             }
+             glEnd();
+         }
+
     }
     void QCameraWidget::Reset()
@@ -276,9 +332,14 @@
             fWhite = face;
             fWhitePatch = pixelsPatch[fWhite];
-            CalculatePatchColor();
+ //           CalculatePatchColor();
             emit signalCurrentPixel(face);
-            updateGL();
             }
-    }
+        else
+        {
+            fWhite = -1;
+            fWhitePatch = -1;
+        }
+        updateGL();
+   }
     void QCameraWidget::mouseMoveEvent(QMouseEvent* cEvent)
     {
@@ -293,20 +354,30 @@
         int face = PixelAtPosition(cEvent->pos());
         if (face != -1) {
+ //           cout << "Event !" << endl;
             fWhite = face;
-            fWhitePatch = pixelsPatch[fWhite];
-            CalculatePatchColor();
+             fWhitePatch = pixelsPatch[fWhite];
+           highlightPixel(face);
+            highlightPatch(fWhitePatch);
+ //           CalculatePatchColor();
             emit signalPixelDoubleClick(face);
-            updateGL();
-        }
+       }
+        else
+        {
+            fWhite = -1;
+            fWhitePatch = -1;
+            clearHighlightedPixels();
+            clearHighlightedPatches();
+        }
+        updateGL();
+
     }
-     void QCameraWidget::SetBold(int idx)
-     {
-         //cout << "Boldness not taken into account yet" << endl;
-     }
+
      void QCameraWidget::SetWhite(int idx)
      {
          fWhite = idx;
          fWhitePatch = pixelsPatch[fWhite];
-         CalculatePatchColor();
+         if (isVisible())
+             updateGL();
+//         CalculatePatchColor();
      }
      void QCameraWidget::SetEnable(int idx, bool b)
@@ -314,7 +385,5 @@
          fEnable[idx] = b;
      }
-     void QCameraWidget::Toggle(int idx)
-     {
-     }
+
      double QCameraWidget::GetData(int idx)
      {
@@ -373,12 +442,24 @@
           for (int i=0;i<ACTUAL_NUM_PIXELS;i++)
            {
-               if (fData[i] < dmin)
+              if (!fEnable[i])
+              {
+//                  cout << "not enabled !" << i << endl;
+                  pixelsColor[i][0] = 0.1f;
+                  pixelsColor[i][1] = 0.1f;
+                  pixelsColor[i][2] = 0.15f;
+                  continue;
+              }
+              if (fData[i] < dmin)
                {
-                   pixelsColor[i][0] = pixelsColor[i][1] = pixelsColor[i][2] = 0;
+                   pixelsColor[i][0] = tooLowValueCoulour[0];
+                   pixelsColor[i][1] = tooLowValueCoulour[1];
+                   pixelsColor[i][2] = tooLowValueCoulour[2];
                    continue;
                }
                if (fData[i] > dmax)
                {
-                   pixelsColor[i][0] = pixelsColor[i][1] = pixelsColor[i][2] = 1;
+                   pixelsColor[i][0] = tooHighValueCoulour[0];
+                   pixelsColor[i][1] = tooHighValueCoulour[1];
+                   pixelsColor[i][2] = tooHighValueCoulour[2];
                    continue;
                }
@@ -390,6 +471,5 @@
                    color = log10(color);
                }
-               if (!fEnable[i])
-                   color = 0;
+
                int index = 0;
                while (ss[index] < color && index < 4)
@@ -411,4 +491,5 @@
      void QCameraWidget::CalculatePatchColor()
      {
+         return;
          //calculate the patch contour color. let's use the anti-colour of the pixels
          GLfloat averagePatchColour[3] = {0.0f,0.0f,0.0f};
@@ -521,4 +602,16 @@
          glVertex2f(twoX, fiveY);
          glVertex2f(oneX, fiveY);
+         float zeroX = oneX - shownSizex/50.f;
+         float zeroY = fiveY - shownSizey/50.f;
+         glColor3fv(tooHighValueCoulour);
+         glVertex2f(zeroX, fiveY);
+         glVertex2f(oneX, fiveY);
+         glVertex2f(oneX, zeroY);
+         glVertex2f(zeroX, zeroY);
+         glColor3fv(tooLowValueCoulour);
+         glVertex2f(zeroX, -fiveY);
+         glVertex2f(oneX, -fiveY);
+         glVertex2f(oneX, -zeroY);
+         glVertex2f(zeroX, -zeroY);
          glEnd();
          //draw linear/log tick marks
@@ -543,8 +636,14 @@
      {
          unitsText = units;
+         pixelColorUpToDate = false;
+         if (isVisible())
+             updateGL();
      }
      void QCameraWidget::setTitle(const string& title)
      {
          titleText = title;
+         pixelColorUpToDate = false;
+         if (isVisible())
+             updateGL();
      }
      void QCameraWidget::linearScalePlease(bool checked)
@@ -571,4 +670,10 @@
          gg[0] = 0.15; gg[1] = 0;     gg[2] = 1;    gg[3] = 0;     gg[4] = 0.85f;
          bb[0] = 0.15; bb[1] = 1;     bb[2] = 0;    bb[3] = 0;     bb[4] = 0.85f;
+         tooHighValueCoulour[0] = 1.f;
+         tooHighValueCoulour[1] = 1.f;
+         tooHighValueCoulour[2] = 0.f;
+         tooLowValueCoulour[0] = 0.f;
+         tooLowValueCoulour[1] = 1.f;
+         tooLowValueCoulour[2] = 1.f;
          pixelColorUpToDate = false;
          if (isVisible())
@@ -582,4 +687,10 @@
          gg[0] = 0.f; gg[1] = 0.10f;     gg[2] = 0.20f;    gg[3] = 0.73f;     gg[4] = 1.f;
          bb[0] = 0.f; bb[1] = 0.03f;     bb[2] = 0.06f;    bb[3] = 0.00f;     bb[4] = 1.f;
+         tooHighValueCoulour[0] = 0.f;
+         tooHighValueCoulour[1] = 1.f;
+         tooHighValueCoulour[2] = 0.f;
+         tooLowValueCoulour[0] = 0.f;
+         tooLowValueCoulour[1] = 0.f;
+         tooLowValueCoulour[2] = 1.f;
          pixelColorUpToDate = false;
          if (isVisible())
@@ -593,4 +704,10 @@
          gg[0] = 0; gg[1] = 0.25f;     gg[2] = 0.5f;    gg[3] = 0.75f;     gg[4] = 1.0f;
          bb[0] = 0; bb[1] = 0.25f;     bb[2] = 0.5f;    bb[3] = 0.75f;     bb[4] = 1.0f;
+         tooHighValueCoulour[0] = 0.f;
+         tooHighValueCoulour[1] = 1.f;
+         tooHighValueCoulour[2] = 0.f;
+         tooLowValueCoulour[0] = 0.f;
+         tooLowValueCoulour[1] = 0.f;
+         tooLowValueCoulour[2] = 1.f;
          pixelColorUpToDate = false;
          if (isVisible())
@@ -604,4 +721,10 @@
          gg[0] = 0.15; gg[1] = 0.5;     gg[2] = 1.f;    gg[3] = 0.5f;     gg[4] = 0.5f;
          bb[0] = 0.15; bb[1] = 0.5;     bb[2] = 1;      bb[3] = 1.f;     bb[4] = 0.f;
+         tooHighValueCoulour[0] = 1.f;
+         tooHighValueCoulour[1] = 0.f;
+         tooHighValueCoulour[2] = 0.f;
+         tooLowValueCoulour[0] = 0.f;
+         tooLowValueCoulour[1] = 1.f;
+         tooLowValueCoulour[2] = 0.f;
          pixelColorUpToDate = false;
          if (isVisible())
@@ -632,2 +755,41 @@
              updateGL();
      }
+     void QCameraWidget::highlightPixel(int idx)
+     {
+         if (idx < 0 || idx > ACTUAL_NUM_PIXELS)
+         {
+           cout << "Error: requested pixel highlight out of bounds" << endl;
+           return;
+         }
+         highlightedPixels.push_back(idx);
+         if (isVisible())
+             updateGL();
+     }
+     void QCameraWidget::highlightPatch(int idx)
+     {
+         if (idx < 0 || idx > NTMARK)
+         {
+             cout << "Error: requested patch highlight out of bounds" << endl;
+             return;
+         }
+         highlightedPatches.push_back(idx);
+         if (isVisible())
+             updateGL();
+
+     }
+     void QCameraWidget::clearHighlightedPatches()
+     {
+         highlightedPatches.clear();
+         if (isVisible())
+             updateGL();
+     }
+     void QCameraWidget::clearHighlightedPixels()
+     {
+         highlightedPixels.clear();
+         if (isVisible())
+             updateGL();
+     }
+
+
+
+
Index: /trunk/FACT++/gui/QCameraWidget.h
===================================================================
--- /trunk/FACT++/gui/QCameraWidget.h	(revision 11877)
+++ /trunk/FACT++/gui/QCameraWidget.h	(revision 11878)
@@ -24,4 +24,7 @@
     vector<bool> fEnable;
 
+    vector<int> highlightedPatches;
+    vector<int> highlightedPixels;
+
     int fWhite;
     int fWhitePatch;
@@ -35,4 +38,10 @@
 
     GLfloat patchColour[3];
+    GLfloat pixelContourColour[3];
+    GLfloat patchesCoulour[3];
+    GLfloat highlightedPatchesCoulour[3];
+    GLfloat highlightedPixelsCoulour[3];
+    GLfloat tooHighValueCoulour[3];
+    GLfloat tooLowValueCoulour[3];
 
     string dataText;
@@ -41,4 +50,8 @@
 
 public:
+    void highlightPixel(int idx);
+    void highlightPatch(int idx);
+    void clearHighlightedPatches();
+    void clearHighlightedPixels();
     void setUnits(const string& units);
     void setTitle(const string& title);
@@ -51,8 +64,6 @@
     void drawCamera(bool alsoWire);
     void drawPatches();
-     void SetBold(int idx);
      void SetWhite(int idx);
      void SetEnable(int idx, bool b);
-     void Toggle(int idx);
      double GetData(int idx);
      void SetMin(int64_t min);
