Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12182)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12184)
@@ -1,3 +1,2 @@
-/*
 /*
  * QtGl.cpp
@@ -381,88 +380,15 @@
         exit(-1);
     }
-    ifstream fin1("Trigger-Patches.txt");
-    if (!fin1.is_open())
-    {
-        cout << "Error: file \"Trigger-Patches\" missing. aborting." << endl;
-        exit(-1);
-    }
-    string buf;
-    vector<int> patchHW(1440);
-    int l = 0;
-    while (getline(fin1, buf, '\n'))
-    {
-        buf = Tools::Trim(buf);
-        if (buf[0]=='#')
-            continue;
-
-        stringstream str(buf);
-        for (int i=0; i<9; i++)
-        {
-            unsigned int n;
-            str >> n;
-
-            if (n>=patchHW.size())
-                continue;
-
-            patchHW[n] = l;
-        }
-        l++;
-    }
-    if (l!=160)
-        cerr << "WARNING - Problems reading Trigger-Patches.txt" << endl;
 
     assignPixelMap(mypMap);
-    assignTriggerPatchesMap(patchHW);
-
-    GLfloat tempPixelsCoords[MAX_NUM_PIXELS][3];
-    for (int i=0;i<1440;i++)
-        for (int j=0;j<3;j++)
-            tempPixelsCoords[hardwareMapping[i]][j] = pixelsCoords[i][j];
-    for (int i=0;i<1440;i++)
-        for (int j=0;j<3;j++)
-            pixelsCoords[i][j] = tempPixelsCoords[i][j];
-
-    for (int i=0;i<1440;i++)
-    updateNeighbors(i);
     buildVerticesList();
 
-/*    ifstream fin1("Trigger-Patches.txt");
-   if (!fin1.is_open())
-   {
-       cout << "Error: file \"Trigger-Patches.txt\" missing. Aborting." << endl;
-       exit(-1);
-   }
-   l=0;
-    while (getline(fin1, buf, '\n'))
-    {
-        buf = Trim(buf);
-        if (buf[0]=='#')
-            continue;
-
-        stringstream str(buf);
-        for (int i=0; i<9; i++)
-        {
-            unsigned int n;
-            str >> n;
-
-            if (n>=1440)
-                continue;
-
-            patches[l][i] = hardwareMapping[n];
-        }
-        l++;
-    }*/
-
-    buildPatchesIndices();
-    float color[3];
     for (int i=0;i<160;i++)
     {
-        color[0] = 0.5; color[1] = 0.5; color[2] = 0.3;
+        const float color[3] = { 0.5, 0.5, 0.3 };
+
         for (int j=0;j<3;j++)
             patchesColor[i][j] = color[j];
     }
-
-    for (int i=0;i<1440;i++)
-        updateNeighbors(i);
 
     //calibrationLoaded = false;
@@ -487,47 +413,4 @@
 }
 
-void RawDataViewer::buildPatchesIndices()
-{
-    vector<edge>::iterator it;
-    bool erased = false;
-//        patchesIndices.resize(NTMARK);
-    for (int i=0;i<NTMARK;i++)//for all patches
-    {
-        patchesIndices[i].clear();
-        for (int j=0;j<9;j++)//for all cells of the current patch
-        {
-//            if (patches[i][j] == 690 ||
-//                patches[i][j] == 70)
-//                continue;
-            for (int k=0;k<6;k++)//for all sides of the current cell
-            {
-                int first = k-1;
-                int second = k;
-                if (first < 0)
-                    first = 5;
-                erased = false;
-                for (it=(patchesIndices[i]).begin(); it != (patchesIndices[i]).end(); it++)//check if this side is here already or not
-                {
-                    if (((*it).first == verticesIndices[patches[i][j]][first] &&
-                         (*it).second == verticesIndices[patches[i][j]][second]) ||
-                        ((*it).first == verticesIndices[patches[i][j]][second] &&
-                         (*it).second == verticesIndices[patches[i][j]][first]))
-                    {
-                        patchesIndices[i].erase(it);
-                        erased = true;
-                        break;
-                    }
-                }
-                if (!erased)
-                {
-                    edge temp;
-                    temp.first = verticesIndices[patches[i][j]][first];
-                    temp.second = verticesIndices[patches[i][j]][second];
-                    patchesIndices[i].push_back(temp);
-                }
-            }
-        }
-    }
-}
 /************************************************************
  * PAINT GL. main drawing function.
@@ -2481,4 +2364,95 @@
 
 }
+
+/*
+class MainWindow : public QMainWindow, protected Ui::MainWindow
+{
+    Q_OBJECT;
+
+public:
+    MainWindow(QWidget *p=0) : QMainWindow(p)
+    {
+        setupUi(this);
+    }
+
+    int SetupConfiguration(Configuration &conf)
+    {
+        RawDataViewer *canvas = GLWindow;
+
+        if (conf.Has("color.range"))
+        {
+            vector<double> value = conf.Vec<double>("color.range");
+            if (value.size() != 5)
+            {
+                cout << "Error, colorRange option should have exactly 5 double values" << endl;
+                return -1;
+            }
+            for (int i=0;i<5;i++)
+                canvas->ss[i] = value[i];
+        }
+
+        if (conf.Has("color.red"))
+        {
+            vector<double> value = conf.Vec<double>("color.red");
+            if (value.size() != 5)
+            {
+                cout << "Error, colorRed option should have exactly 5 double values" << endl;
+                return -1;
+            }
+            for (int i=0;i<5;i++)
+                canvas->rr[i] = value[i];
+        }
+
+        if (conf.Has("color.green"))
+        {
+            vector<double> value = conf.Vec<double>("color.green");
+            if (value.size() != 5)
+            {
+                cout << "Error, colorGreen option should have exactly 5 double values" << endl;
+                return -1;
+            }
+            for (int i=0;i<5;i++)
+                canvas->gg[i] = value[i];
+        }
+
+        if (conf.Has("color.blue"))
+        {
+            vector<double> value = conf.Vec<double>("color.blue");
+            if (value.size() != 5)
+            {
+                cout << "Error, colorBlue option should have exactly 5 double values" << endl;
+                return -1;
+            }
+            for (int i=0;i<5;i++)
+                canvas->bb[i] = value[i];
+        }
+
+        colorRange0->setValue(canvas->ss[0]);
+        colorRange1->setValue(canvas->ss[1]);
+        colorRange2->setValue(canvas->ss[2]);
+        colorRange3->setValue(canvas->ss[3]);
+        colorRange4->setValue(canvas->ss[4]);
+        redValue0->setValue(canvas->rr[0]);
+        redValue1->setValue(canvas->rr[1]);
+        redValue2->setValue(canvas->rr[2]);
+        redValue3->setValue(canvas->rr[3]);
+        redValue4->setValue(canvas->rr[4]);
+        greenValue0->setValue(canvas->gg[0]);
+        greenValue1->setValue(canvas->gg[1]);
+        greenValue2->setValue(canvas->gg[2]);
+        greenValue3->setValue(canvas->gg[3]);
+        greenValue4->setValue(canvas->gg[4]);
+        blueValue0->setValue(canvas->bb[0]);
+        blueValue1->setValue(canvas->bb[1]);
+        blueValue2->setValue(canvas->bb[2]);
+        blueValue3->setValue(canvas->bb[3]);
+        blueValue4->setValue(canvas->bb[4]);
+
+        return 0;
+    }
+
+};
+*/
+
 /************************************************************
  * MAIN PROGRAM FUNCTION.
@@ -2499,4 +2473,10 @@
     }
 
+    /*
+    MainWindow myUi;
+    if (myUi.SetupConfiguration(conf)<0)
+        return -1;
+     */
+
    QMainWindow mainWindow;
 
@@ -2555,5 +2535,4 @@
             canvas->bb[i] = value[i];
     }
-
 
 
@@ -2564,5 +2543,4 @@
 //    QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)),
 //                     canvas, SLOT(setEventStep(int)));
-
     myUi.colorRange0->setValue(canvas->ss[0]);
     myUi.colorRange1->setValue(canvas->ss[1]);
