Index: trunk/FACT++/gui/FactGui.h
===================================================================
--- trunk/FACT++/gui/FactGui.h	(revision 11606)
+++ trunk/FACT++/gui/FactGui.h	(revision 11607)
@@ -396,4 +396,5 @@
     DimStampedInfo fDimFadPrescaler;
     DimStampedInfo fDimFadRefClock;
+    DimStampedInfo fDimFadRoi;
     DimStampedInfo fDimFadStatus;
     DimStampedInfo fDimFadStatistics1;
@@ -1069,5 +1070,29 @@
         SetLedColor(fFadLedRefClock, abs(diff)>3?kLedRed:kLedGreen, d.time);
 
-        handleFadToolTip(d.time, fFadLedRefClock, ptr+2);
+        handleFadToolTip(d.time, fFadLedRefClock, ptr);
+    }
+
+    void handleFadRoi(const DimData &d)
+    {
+        if (d.size()==0)
+        {
+            fFadRoi->setEnabled(false);
+            fFadRoiCh9->setEnabled(false);
+            SetLedColor(fFadLedRoi, kLedGray, d.time);
+            return;
+        }
+
+        if (!CheckSize(d, 2*sizeof(uint16_t)))
+            return;
+
+        const uint16_t *ptr = d.ptr<uint16_t>();
+
+        fFadRoi->setEnabled(true);
+	fFadRoiCh9->setEnabled(true);
+
+	fFadRoi->setValue(ptr[0]);
+	fFadRoiCh9->setValue(ptr[1]);
+
+        SetLedColor(fFadLedRoi, kLedGray, d.time);
     }
 
@@ -2294,4 +2319,7 @@
         if (getInfo()==&fDimFadRefClock)
             return PostInfoHandler(&FactGui::handleFadRefClock);
+
+	if (getInfo()==&fDimFadRoi)
+            return PostInfoHandler(&FactGui::handleFadRoi);
 
         if (getInfo()==&fDimFadPrescaler)
@@ -2739,18 +2767,19 @@
         fDimFtmCounter         ("FTM_CONTROL/COUNTER",          (void*)NULL, 0, this),
         //-
-        fDimFadWriteStats      ("FAD_CONTROL/STATS",            (void*)NULL, 0, this),
-        fDimFadRuns            ("FAD_CONTROL/RUNS",             (void*)NULL, 0, this),
-        fDimFadEvents          ("FAD_CONTROL/EVENTS",           (void*)NULL, 0, this),
-        fDimFadEventData       ("FAD_CONTROL/EVENT_DATA",       (void*)NULL, 0, this),
-        fDimFadConnections     ("FAD_CONTROL/CONNECTIONS",      (void*)NULL, 0, this),
-        fDimFadFwVersion       ("FAD_CONTROL/FIRMWARE_VERSION", (void*)NULL, 0, this),
-        fDimFadRunNumber       ("FAD_CONTROL/RUN_NUMBER",       (void*)NULL, 0, this),
-        fDimFadDNA             ("FAD_CONTROL/DNA",              (void*)NULL, 0, this),
-        fDimFadTemperature     ("FAD_CONTROL/TEMPERATURE",      (void*)NULL, 0, this),
-        fDimFadPrescaler       ("FAD_CONTROL/PRESCALER",        (void*)NULL, 0, this),
-        fDimFadRefClock        ("FAD_CONTROL/REFERENCE_CLOCK",  (void*)NULL, 0, this),
-        fDimFadStatus          ("FAD_CONTROL/STATUS",           (void*)NULL, 0, this),
-        fDimFadStatistics1     ("FAD_CONTROL/STATISTICS1",      (void*)NULL, 0, this),
-        fDimFadStatistics2     ("FAD_CONTROL/STATISTICS2",      (void*)NULL, 0, this),
+        fDimFadWriteStats      ("FAD_CONTROL/STATS",              (void*)NULL, 0, this),
+        fDimFadRuns            ("FAD_CONTROL/RUNS",               (void*)NULL, 0, this),
+        fDimFadEvents          ("FAD_CONTROL/EVENTS",             (void*)NULL, 0, this),
+        fDimFadEventData       ("FAD_CONTROL/EVENT_DATA",         (void*)NULL, 0, this),
+        fDimFadConnections     ("FAD_CONTROL/CONNECTIONS",        (void*)NULL, 0, this),
+        fDimFadFwVersion       ("FAD_CONTROL/FIRMWARE_VERSION",   (void*)NULL, 0, this),
+        fDimFadRunNumber       ("FAD_CONTROL/RUN_NUMBER",         (void*)NULL, 0, this),
+        fDimFadDNA             ("FAD_CONTROL/DNA",                (void*)NULL, 0, this),
+        fDimFadTemperature     ("FAD_CONTROL/TEMPERATURE",        (void*)NULL, 0, this),
+        fDimFadPrescaler       ("FAD_CONTROL/PRESCALER",          (void*)NULL, 0, this),
+        fDimFadRefClock        ("FAD_CONTROL/REFERENCE_CLOCK",    (void*)NULL, 0, this),
+        fDimFadRoi             ("FAD_CONTROL/REGION_OF_INTEREST", (void*)NULL, 0, this),
+        fDimFadStatus          ("FAD_CONTROL/STATUS",             (void*)NULL, 0, this),
+        fDimFadStatistics1     ("FAD_CONTROL/STATISTICS1",        (void*)NULL, 0, this),
+        fDimFadStatistics2     ("FAD_CONTROL/STATISTICS2",        (void*)NULL, 0, this),
         //-
         fEventData(0)
Index: trunk/FACT++/gui/design.ui
===================================================================
--- trunk/FACT++/gui/design.ui	(revision 11606)
+++ trunk/FACT++/gui/design.ui	(revision 11607)
@@ -3175,5 +3175,5 @@
                      </item>
                      <item row="3" column="1">
-                      <widget class="QPushButton" name="fStatusDNSLed_3">
+                      <widget class="QPushButton" name="fFadLedRoi">
                        <property name="enabled">
                         <bool>true</bool>
@@ -3293,20 +3293,4 @@
                       </widget>
                      </item>
-                     <item row="3" column="2">
-                      <widget class="QSpinBox" name="spinBox_2">
-                       <property name="enabled">
-                        <bool>false</bool>
-                       </property>
-                       <property name="alignment">
-                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-                       </property>
-                       <property name="readOnly">
-                        <bool>true</bool>
-                       </property>
-                       <property name="buttonSymbols">
-                        <enum>QAbstractSpinBox::NoButtons</enum>
-                       </property>
-                      </widget>
-                     </item>
                      <item row="0" column="2">
                       <widget class="QDoubleSpinBox" name="fFadFwVersion">
@@ -3335,14 +3319,4 @@
                       </widget>
                      </item>
-                     <item row="3" column="3">
-                      <widget class="QSpinBox" name="fFadRoiCmd">
-                       <property name="alignment">
-                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-                       </property>
-                       <property name="maximum">
-                        <number>1024</number>
-                       </property>
-                      </widget>
-                     </item>
                      <item row="1" column="0">
                       <widget class="QLabel" name="label_145">
@@ -3416,5 +3390,5 @@
                       </widget>
                      </item>
-                     <item row="4" column="1">
+                     <item row="5" column="1">
                       <spacer name="verticalSpacer_26">
                        <property name="orientation">
@@ -3432,5 +3406,5 @@
                       </spacer>
                      </item>
-                     <item row="5" column="2">
+                     <item row="6" column="2">
                       <widget class="QLabel" name="label_128">
                        <property name="text">
@@ -3442,5 +3416,5 @@
                       </widget>
                      </item>
-                     <item row="5" column="3">
+                     <item row="6" column="3">
                       <widget class="QLabel" name="label_129">
                        <property name="text">
@@ -3452,5 +3426,5 @@
                       </widget>
                      </item>
-                     <item row="6" column="2">
+                     <item row="7" column="2">
                       <widget class="QDoubleSpinBox" name="fFadTempMin">
                        <property name="alignment">
@@ -3468,5 +3442,5 @@
                       </widget>
                      </item>
-                     <item row="6" column="3">
+                     <item row="7" column="3">
                       <widget class="QDoubleSpinBox" name="fFadTempMax">
                        <property name="alignment">
@@ -3484,5 +3458,5 @@
                       </widget>
                      </item>
-                     <item row="7" column="2">
+                     <item row="8" column="2">
                       <widget class="QDoubleSpinBox" name="fFadRefClockMin">
                        <property name="enabled">
@@ -3518,5 +3492,5 @@
                       </widget>
                      </item>
-                     <item row="7" column="3">
+                     <item row="8" column="3">
                       <widget class="QDoubleSpinBox" name="fFadRefClockMax">
                        <property name="sizePolicy">
@@ -3546,5 +3520,5 @@
                       </widget>
                      </item>
-                     <item row="6" column="0">
+                     <item row="7" column="0">
                       <widget class="QLabel" name="label_111">
                        <property name="text">
@@ -3553,5 +3527,5 @@
                       </widget>
                      </item>
-                     <item row="6" column="1">
+                     <item row="7" column="1">
                       <widget class="QPushButton" name="fFadLedTemp">
                        <property name="enabled">
@@ -3591,5 +3565,5 @@
                       </widget>
                      </item>
-                     <item row="7" column="0">
+                     <item row="8" column="0">
                       <widget class="QLabel" name="label_101">
                        <property name="text">
@@ -3598,5 +3572,5 @@
                       </widget>
                      </item>
-                     <item row="7" column="1">
+                     <item row="8" column="1">
                       <widget class="QPushButton" name="fFadLedRefClock">
                        <property name="enabled">
@@ -3636,5 +3610,5 @@
                       </widget>
                      </item>
-                     <item row="8" column="1">
+                     <item row="9" column="1">
                       <widget class="QPushButton" name="fFadLedRefClockTooLow">
                        <property name="enabled">
@@ -3674,5 +3648,5 @@
                       </widget>
                      </item>
-                     <item row="8" column="0">
+                     <item row="9" column="0">
                       <widget class="QLabel" name="label_103">
                        <property name="text">
@@ -3681,5 +3655,5 @@
                       </widget>
                      </item>
-                     <item row="9" column="0">
+                     <item row="10" column="0">
                       <widget class="QLabel" name="label_92">
                        <property name="text">
@@ -3688,5 +3662,5 @@
                       </widget>
                      </item>
-                     <item row="9" column="1">
+                     <item row="10" column="1">
                       <widget class="QPushButton" name="fFadLedPllLock">
                        <property name="enabled">
@@ -3726,18 +3700,85 @@
                       </widget>
                      </item>
+                     <item row="3" column="2">
+                      <widget class="QSpinBox" name="fFadRoi">
+                       <property name="enabled">
+                        <bool>false</bool>
+                       </property>
+                       <property name="alignment">
+                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                       </property>
+                       <property name="readOnly">
+                        <bool>true</bool>
+                       </property>
+                       <property name="buttonSymbols">
+                        <enum>QAbstractSpinBox::NoButtons</enum>
+                       </property>
+                       <property name="minimum">
+                        <number>-1</number>
+                       </property>
+                       <property name="maximum">
+                        <number>1024</number>
+                       </property>
+                       <property name="value">
+                        <number>-1</number>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="3" column="3">
+                      <widget class="QSpinBox" name="fFadRoiCmd">
+                       <property name="alignment">
+                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                       </property>
+                       <property name="maximum">
+                        <number>1024</number>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="4" column="2">
+                      <widget class="QSpinBox" name="fFadRoiCh9">
+                       <property name="enabled">
+                        <bool>false</bool>
+                       </property>
+                       <property name="alignment">
+                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                       </property>
+                       <property name="readOnly">
+                        <bool>true</bool>
+                       </property>
+                       <property name="buttonSymbols">
+                        <enum>QAbstractSpinBox::NoButtons</enum>
+                       </property>
+                       <property name="minimum">
+                        <number>-1</number>
+                       </property>
+                       <property name="maximum">
+                        <number>1024</number>
+                       </property>
+                       <property name="value">
+                        <number>-1</number>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="4" column="3">
+                      <widget class="QSpinBox" name="fFadRoiCh9Cmd">
+                       <property name="enabled">
+                        <bool>false</bool>
+                       </property>
+                       <property name="alignment">
+                        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                       </property>
+                       <property name="maximum">
+                        <number>1024</number>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="4" column="0">
+                      <widget class="QLabel" name="label_161">
+                       <property name="text">
+                        <string>Region of interest (ch9)</string>
+                       </property>
+                      </widget>
+                     </item>
                     </layout>
-                   </item>
-                   <item row="1" column="2">
-                    <spacer name="horizontalSpacer_29">
-                     <property name="orientation">
-                      <enum>Qt::Horizontal</enum>
-                     </property>
-                     <property name="sizeHint" stdset="0">
-                      <size>
-                       <width>40</width>
-                       <height>20</height>
-                      </size>
-                     </property>
-                    </spacer>
                    </item>
                    <item row="1" column="0">
@@ -3760,4 +3801,17 @@
                      </property>
                     </widget>
+                   </item>
+                   <item row="1" column="2">
+                    <spacer name="horizontalSpacer_29">
+                     <property name="orientation">
+                      <enum>Qt::Horizontal</enum>
+                     </property>
+                     <property name="sizeHint" stdset="0">
+                      <size>
+                       <width>40</width>
+                       <height>20</height>
+                      </size>
+                     </property>
+                    </spacer>
                    </item>
                   </layout>
