Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 10952)
+++ /trunk/FACT++/gui/FactGui.h	(revision 10953)
@@ -1841,7 +1841,7 @@
                 cout << "Select: " << idx << endl;
 
+                fPixelIdx->setValue(idx);
                 ChoosePixel(*cam, idx);
 
-                fPixelIdx->setValue(idx);
             }
             return;
Index: /trunk/FACT++/gui/MainWindow.cc
===================================================================
--- /trunk/FACT++/gui/MainWindow.cc	(revision 10952)
+++ /trunk/FACT++/gui/MainWindow.cc	(revision 10953)
@@ -247,9 +247,20 @@
 void MainWindow::on_fPixelEnable_stateChanged(int b)
 {
-    cout << "PIXEL: " << fPixelIdx->value() << " " << b << endl;
     if (!fInHandler)
         Dim::SendCommand(b==Qt::Unchecked ?
                          "FTM_CONTROL/DISABLE_PIXEL" : "FTM_CONTROL/ENABLE_PIXEL",
                          uint16_t(fPixelIdx->value()));
+}
+
+void MainWindow::on_fPixelDisableOthers_clicked()
+{
+    Dim::SendCommand("FTM_CONTROL/DISABLE_ALL_PIXELS_EXCEPT",
+                     uint16_t(fPixelIdx->value()));
+}
+
+void MainWindow::on_fThresholdDisableOthers_clicked()
+{
+    Dim::SendCommand("FTM_CONTROL/DISABLE_ALL_PATCHES_EXCEPT",
+                     uint16_t(fThresholdIdx->value()));
 }
 
Index: /trunk/FACT++/gui/MainWindow.h
===================================================================
--- /trunk/FACT++/gui/MainWindow.h	(revision 10952)
+++ /trunk/FACT++/gui/MainWindow.h	(revision 10953)
@@ -93,4 +93,7 @@
     virtual void on_fPixelIdx_valueChanged(int) { }
 
+    void on_fPixelDisableOthers_clicked();
+    virtual void on_fThresholdDisableOthers_clicked();
+
     virtual void on_fRatePatch1_valueChanged(int) { }
     virtual void on_fRatePatch2_valueChanged(int) { }
Index: /trunk/FACT++/gui/design.ui
===================================================================
--- /trunk/FACT++/gui/design.ui	(revision 10952)
+++ /trunk/FACT++/gui/design.ui	(revision 10953)
@@ -2491,4 +2491,34 @@
               </item>
               <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_22">
+                <property name="topMargin">
+                 <number>0</number>
+                </property>
+                <item>
+                 <spacer name="horizontalSpacer_29">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeType">
+                   <enum>QSizePolicy::Minimum</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="fPixelDisableOthers">
+                  <property name="text">
+                   <string>Disable others</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+              <item>
                <spacer name="verticalSpacer_16">
                 <property name="orientation">
@@ -2534,4 +2564,34 @@
                 </property>
                </widget>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_23">
+                <property name="topMargin">
+                 <number>0</number>
+                </property>
+                <item>
+                 <spacer name="horizontalSpacer_31">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeType">
+                   <enum>QSizePolicy::Minimum</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="fThresholdDisableOthers">
+                  <property name="text">
+                   <string>Disable others</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
               </item>
               <item>
@@ -2589,5 +2649,12 @@
                  <widget class="QLabel" name="label_130">
                   <property name="text">
-                   <string>Patch ID</string>
+                   <string>Patch</string>
+                  </property>
+                 </widget>
+                </item>
+                <item row="0" column="0">
+                 <widget class="QLabel" name="label_132">
+                  <property name="text">
+                   <string>Crate</string>
                   </property>
                  </widget>
@@ -2596,12 +2663,5 @@
                  <widget class="QLabel" name="label_131">
                   <property name="text">
-                   <string>Board ID</string>
-                  </property>
-                 </widget>
-                </item>
-                <item row="0" column="0">
-                 <widget class="QLabel" name="label_132">
-                  <property name="text">
-                   <string>Crate ID</string>
+                   <string>Board</string>
                   </property>
                  </widget>
Index: /trunk/FACT++/src/ftmctrl.cc
===================================================================
--- /trunk/FACT++/src/ftmctrl.cc	(revision 10952)
+++ /trunk/FACT++/src/ftmctrl.cc	(revision 10953)
@@ -898,11 +898,27 @@
     }
 
-    bool EnablePixel(uint16_t idx, bool enable)
+    bool EnablePixel(int16_t idx, bool enable)
+    {
+        if (idx<-1 || idx>FTM::StaticData::kMaxPixelIdx)
+            return false;
+
+        if (idx==-1)
+            for (int i=0; i<FTM::StaticData::kMaxPixelIdx; i++)
+                fStaticData.EnablePixel(idx, enable);
+        else
+            fStaticData.EnablePixel(idx, enable);
+
+        CmdSendStatDat();
+
+        return true;
+    }
+
+    bool DisableAllPixelsExcept(uint16_t idx)
     {
         if (idx>FTM::StaticData::kMaxPixelIdx)
             return false;
 
-        cout << "ENABLE " << idx << " " << enable << endl;
-        fStaticData.EnablePixel(idx, enable);
+        for (int i=0; i<FTM::StaticData::kMaxPixelIdx; i++)
+            fStaticData.EnablePixel(i, i==idx);
 
         CmdSendStatDat();
@@ -911,10 +927,21 @@
     }
 
+    bool DisableAllPatchesExcept(uint16_t idx)
+    {
+        if (idx>159)
+            return false;
+
+        for (int i=0; i<FTM::StaticData::kMaxPixelIdx; i++)
+            fStaticData.EnablePixel(i, i/9==idx);
+
+        CmdSendStatDat();
+
+        return true;
+    }
+
     bool TogglePixel(uint16_t idx)
     {
         if (idx>FTM::StaticData::kMaxPixelIdx)
             return false;
-
-        cout << "TOGGLE " << idx << endl;
 
         fStaticData.EnablePixel(idx, !fStaticData.Enabled(idx));
@@ -1379,5 +1406,28 @@
             return T::kSM_FatalError;
 
-        fFTM.EnablePixel(evt.GetUShort(), b);
+        if (!fFTM.EnablePixel(evt.GetUShort(), b))
+            T::Warn("EnablePixel -  Value out of range.");
+
+        return T::GetCurrentState();
+    }
+
+    int DisableAllPixelsExcept(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "DisableAllPixelsExcept", 2))
+            return T::kSM_FatalError;
+
+        if (!fFTM.DisableAllPixelsExcept(evt.GetUShort()))
+            T::Warn("DisableAllPixelsExcept -  Value out of range.");
+
+        return T::GetCurrentState();
+    }
+
+    int DisableAllPatchesExcept(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "DisableAllPatchesExcept", 2))
+            return T::kSM_FatalError;
+
+        if (!fFTM.DisableAllPatchesExcept(evt.GetUShort()))
+            T::Warn("DisableAllPatchesExcept -  Value out of range.");
 
         return T::GetCurrentState();
@@ -1389,5 +1439,6 @@
             return T::kSM_FatalError;
 
-        fFTM.TogglePixel(evt.GetUShort());
+        if (!fFTM.TogglePixel(evt.GetUShort()))
+            T::Warn("TogglePixel -  Value out of range.");
 
         return T::GetCurrentState();
@@ -1549,8 +1600,16 @@
         AddEvent("DISABLE_PIXEL", "S:1", kStateIdle)
             (boost::bind(&StateMachineFTM::EnablePixel, this, _1, false))
-            ("");
+            ("(-1 or all)");
 
         AddEvent("ENABLE_PIXEL", "S:1", kStateIdle)
             (boost::bind(&StateMachineFTM::EnablePixel, this, _1, true))
+            ("(-1 or all)");
+
+        AddEvent("DISABLE_ALL_PIXELS_EXCEPT", "S:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::DisableAllPixelsExcept, this, _1))
+            ("");
+
+        AddEvent("DISABLE_ALL_PATCHES_EXCEPT", "S:1", kStateIdle)
+            (boost::bind(&StateMachineFTM::DisableAllPatchesExcept, this, _1))
             ("");
 
