Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 11642)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 11650)
@@ -15,4 +15,6 @@
 #include </home/lyard/Code/display.C>
 #endif
+
+#define VALUES_SPAN 4096
 
 #include <QtGui/QFileDialog>
@@ -27,6 +29,6 @@
 
 //bounding box for diplaying the impulse curve
-float bboxMin[2] = {-1,-0.9};
-float bboxMax[2] = {1,-0.3};
+float bboxMin[2] = {-0.8,-0.9};
+float bboxMax[2] = {0.8,-0.3};
 /************************************************************
  * UPDATE NEIGHBORS recalculate the neighbors of the current pixels.
@@ -428,7 +430,7 @@
         else
 #ifdef LOAD_RAW
-        color = float(eventsData[eventNum][i][whichSlice]+32767)/65535.0f;
+        color = float(eventsData[eventNum][i][whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
 #else
-        color = float(eventData[nRoi*i + whichSlice]+32767)/65535.0f;
+        color = float(eventData[nRoi*i + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1);
 #endif
         int index = 0;
@@ -491,5 +493,10 @@
     if (!nRoi)
         return;
+
+    float xZoom, yZoom;
+    xZoom = yZoom = 1.0f;
+
     glBegin(GL_LINES);
+    glLineWidth(1.0f);
     glColor3f(0.5,0.5,0.5);
     glVertex2f(bboxMin[0], bboxMin[1]);
@@ -497,5 +504,6 @@
     glVertex2f(bboxMin[0], bboxMin[1]);
     glVertex2f(bboxMin[0], bboxMax[1]);
-
+    glVertex2f(bboxMin[0], (bboxMin[1]+bboxMax[1])/2.0f);
+    glVertex2f(bboxMax[0], (bboxMin[1]+bboxMax[1])/2.0f);
     float xRange = bboxMax[0] - bboxMin[0];
     float yRange = bboxMax[1] - bboxMin[1];
@@ -505,12 +513,12 @@
 #ifdef LOAD_RAW
         glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
-                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+32767) /65535.0);
+                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+(VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));
         glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
-                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+32767) /65535.0);
+                   bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+(VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));
 #else
         glVertex2f(bboxMin[0] + xRange*i/(float)nRoi,
-                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+32767) /65535.0);
+                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+(VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));
         glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi,
-                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+32767) /65535.0);
+                   bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+(VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));
 #endif
     }
@@ -520,11 +528,25 @@
     glVertex2f(bboxMin[0] + xRange*whichSlice/(float)nRoi,
                bboxMax[1]);
-
     glEnd();
+    glEnable(GL_MULTISAMPLE);
+    setFont(QFont("Times", 12));
+    qglColor(QColor(255,223,127));
+    float xShift = 0.10f;
+    float yShift = 0.01f;
+    renderText(bboxMin[0]-xShift/2.0f, bboxMax[1]+3*yShift, 0, QString("Volts"));
+    renderText(bboxMin[0]-xShift, bboxMax[1]-yShift,0,QString("+1.05"));
+    renderText(bboxMin[0]-xShift,  ((bboxMin[1]+bboxMax[1])/2.0f) - yShift, 0, QString("+0.00"));//((bboxMin[1]+bboxMax[1])/2.0f)
+    renderText(bboxMin[0]-xShift, bboxMin[1]-yShift, 0, QString("-1.05"));
+
+    renderText(bboxMax[0]+xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("Slices"));
+    renderText(bboxMin[0]-yShift/2.0f, bboxMin[1]-4*yShift, 0, QString("0"));
+    renderText(((bboxMin[0]+bboxMax[0])/2.0f)-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("512"));
+    renderText(bboxMax[0]-xShift/2.0f, bboxMin[1]-4*yShift, 0, QString("1024"));
+
 }
 /************************************************************
  * CONSTRUCTOR.
  ************************************************************/
-RawDataViewer::RawDataViewer(QWidget *parent) : QGLWidget(parent)
+RawDataViewer::RawDataViewer(QWidget *cParent) : QGLWidget(cParent)
 {
     setFormat(QGLFormat(QGL::DoubleBuffer));// | QGL::DepthBuffer));
@@ -668,15 +690,15 @@
  * RESIZE GL. reshapes the ortho projection to match the current window size
  ************************************************************/
-void RawDataViewer::resizeGL(int width, int height)
-{
-    glViewport(0, 0, width, height);
+void RawDataViewer::resizeGL(int cWidth, int cHeight)
+{
+    glViewport(0, 0, cWidth, cHeight);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    GLfloat windowRatio = (float)width/(float)height;
+    GLfloat windowRatio = (float)cWidth/(float)cHeight;
     if (windowRatio < 1)
     {
         windowRatio = 1.0f/windowRatio;
         gluOrtho2D(-viewSize, viewSize, -viewSize*windowRatio, viewSize*windowRatio);
-        pixelSize = 2*viewSize/(float)width;
+        pixelSize = 2*viewSize/(float)cWidth;
         shownSizex = 2*viewSize;
         shownSizey = 2*viewSize*windowRatio;
@@ -685,5 +707,5 @@
     {
         gluOrtho2D(-viewSize*windowRatio, viewSize*windowRatio, -viewSize, viewSize);
-        pixelSize = 2*viewSize/(float)height;
+        pixelSize = 2*viewSize/(float)cHeight;
         shownSizex = 2*viewSize*windowRatio;
         shownSizey = 2*viewSize;
@@ -735,8 +757,8 @@
  * MOUSE PRESS EVENT. mouse click handler.
  ************************************************************/
-void RawDataViewer::mousePressEvent(QMouseEvent *event)
-{
-    lastPos = event->pos();
-    setCorrectSlice(event);
+void RawDataViewer::mousePressEvent(QMouseEvent *cEvent)
+{
+    lastPos = cEvent->pos();
+    setCorrectSlice(cEvent);
     updateGL();
 }
@@ -746,16 +768,16 @@
  * clicked, and if so, which slice should be displayed
  ************************************************************/
-void RawDataViewer::setCorrectSlice(QMouseEvent* event)
+void RawDataViewer::setCorrectSlice(QMouseEvent* cEvent)
 {
     if (!drawImpulse)
         return;
-    float x = (float)event->x() * pixelSize - shownSizex/2;
-    float y = ((float)height()-(float)event->y())*pixelSize - shownSizey/2;
-    if (x < bboxMin[0] ||
-        x > bboxMax[0] ||
-        y < bboxMin[1] ||
-        y > bboxMax[1])
+    float cx = (float)cEvent->x() * pixelSize - shownSizex/2;
+    float cy = ((float)height()-(float)cEvent->y())*pixelSize - shownSizey/2;
+    if (cx < bboxMin[0] ||
+        cx > bboxMax[0] ||
+        cy < bboxMin[1] ||
+        cy > bboxMax[1])
         return;
-    whichSlice = (x - bboxMin[0])*1024/(bboxMax[0] - bboxMin[0]);
+    whichSlice = (cx - bboxMin[0])*1024/(bboxMax[0] - bboxMin[0]);
     emit signalCurrentSlice(whichSlice);
 }
@@ -764,13 +786,13 @@
  * MOUSE MOVE EVENT. used to track the dragging of slices display
  ************************************************************/
-void RawDataViewer::mouseMoveEvent(QMouseEvent *event)
-{
-    if (event->buttons() & Qt::LeftButton) {
-        setCorrectSlice(event);
+void RawDataViewer::mouseMoveEvent(QMouseEvent *cEvent)
+{
+    if (cEvent->buttons() & Qt::LeftButton) {
+        setCorrectSlice(cEvent);
         updateGL();
-    } else if (event->buttons() & Qt::RightButton) {
+    } else if (cEvent->buttons() & Qt::RightButton) {
         updateGL();
     }
-    lastPos = event->pos();
+    lastPos = cEvent->pos();
 }
 
@@ -778,7 +800,7 @@
  * MOUSE DOUBLE CLICK EVENT. used to select pixels
  ************************************************************/
-void RawDataViewer::mouseDoubleClickEvent(QMouseEvent *event)
-{
-    int face = PixelAtPosition(event->pos());
+void RawDataViewer::mouseDoubleClickEvent(QMouseEvent *cEvent)
+{
+    int face = PixelAtPosition(cEvent->pos());
     if (face != -1) {
         selectedPixel = face;
@@ -790,5 +812,5 @@
  * PIXEL AT POSITION. figures out which camera pixel was clicked.
  ************************************************************/
-int RawDataViewer::PixelAtPosition(const QPoint &pos)
+int RawDataViewer::PixelAtPosition(const QPoint &cPos)
 {
     const int MaxSize = 512;
@@ -809,5 +831,5 @@
     glLoadIdentity();
     GLfloat windowRatio = GLfloat(width()) / GLfloat(height());
-    gluPickMatrix(GLdouble(pos.x()), GLdouble(viewport[3] - pos.y()),
+    gluPickMatrix(GLdouble(cPos.x()), GLdouble(viewport[3] - cPos.y()),
             1.0, 1.0, viewport);
 
@@ -946,5 +968,5 @@
  * UICONNECTOR CONSTRUCTOR
  ************************************************************/
-UIConnector::UIConnector(QWidget* parent)
+UIConnector::UIConnector(QWidget*)
 {
     timer.setInterval(1000.0);
@@ -1236,8 +1258,8 @@
  * CURRENT EVENT HAS CHANGED. ui handler
  ************************************************************/
-void UIConnector::currentEventHasChanged(int event)
+void UIConnector::currentEventHasChanged(int cEvent)
 {
     ostringstream str;
-    str << "Displaying Event " << event;
+    str << "Displaying Event " << cEvent;
     QString qstr(str.str().c_str());
     emit updateCurrentEventDisplay(qstr);
