Index: trunk/FACT++/gui/FactGui.h
===================================================================
--- trunk/FACT++/gui/FactGui.h	(revision 13941)
+++ trunk/FACT++/gui/FactGui.h	(revision 13942)
@@ -39,8 +39,14 @@
 
 #include "src/FAD.h"
+#include "src/HeadersMCP.h"
 #include "src/HeadersFTM.h"
 #include "src/HeadersFAD.h"
+#include "src/HeadersFSC.h"
 #include "src/HeadersBIAS.h"
 #include "src/HeadersDrive.h"
+#include "src/HeadersFeedback.h"
+#include "src/HeadersRateScan.h"
+#include "src/HeadersRateControl.h"
+#include "src/HeadersMagicWeather.h"
 
 using namespace std;
@@ -2571,21 +2577,21 @@
             fStatusMCPLabel->setToolTip(s.comment.c_str());
 
-            if (s.index<2) // No Dim connection
+            if (s.index<MCP::State::kDisconnected) // No Dim connection
                 SetLedColor(fStatusMCPLed, kLedGray, time);
-            if (s.index==2) // Disconnected
+            if (s.index==MCP::State::kDisconnected) // Disconnected
                 SetLedColor(fStatusMCPLed, kLedRed, time);
-            if (s.index==3) // Connecting
+            if (s.index==MCP::State::kConnecting) // Connecting
                 SetLedColor(fStatusMCPLed, kLedOrange, time);
-            if (s.index==4) // Connected
+            if (s.index==MCP::State::kConnected) // Connected
                 SetLedColor(fStatusMCPLed, kLedYellow, time);
-            if (s.index==5 || s.index==10 || s.index>9) // Idle, TriggerOn, TakingData
+            if (s.index==MCP::State::kIdle || s.index>=MCP::State::kConfigured) // Idle, TriggerOn, TakingData
                 SetLedColor(fStatusMCPLed, kLedGreen, time);
 
-            if (s.index>=7 && s.index<=9)
+            if (s.index>MCP::State::kIdle && s.index<MCP::State::kConfigured)
                 SetLedColor(fStatusMCPLed, kLedGreenBar, time);
 
-            fMcpStartRun->setEnabled(s.index>=5);
-            fMcpStopRun->setEnabled(s.index>=5);
-            fMcpReset->setEnabled(s.index==5||(s.index>=7 && s.index<=10));
+            fMcpStartRun->setEnabled(s.index>=MCP::State::kIdle);
+            fMcpStopRun->setEnabled(s.index>=MCP::State::kIdle);
+            fMcpReset->setEnabled(s.index>=MCP::State::kIdle && MCP::State::kConfigured);
         }
 
@@ -2689,9 +2695,9 @@
             bool enable = false;
 
-            if (s.index<1) // No Dim connection
+            if (s.index<FSC::State::kDisconnected)  // No Dim connection
                 SetLedColor(fStatusFSCLed, kLedGray, time);
-            if (s.index==1) // Dim connection / FTM disconnected
+            if (s.index==FSC::State::kDisconnected) // Dim connection / FTM disconnected
                 SetLedColor(fStatusFSCLed, kLedRed, time);
-            if (s.index>=2) // Dim connection / FTM disconnected
+            if (s.index>=FSC::State::kConnected)    // Dim connection / FTM disconnected
             {
                 SetLedColor(fStatusFSCLed, kLedGreen, time);
@@ -2707,9 +2713,9 @@
             fStatusDriveLabel->setToolTip(s.comment.c_str());
 
-            if (s.index<1) // No Dim connection
+            if (s.index<Drive::State::kDisconnected) // No Dim connection
                 SetLedColor(fStatusDriveLed, kLedGray, time);
-            if (s.index==1) // Dim connection / No connection to cosy
+            if (s.index==Drive::State::kDisconnected) // Dim connection / No connection to cosy
                 SetLedColor(fStatusDriveLed, kLedRed, time);
-            if (s.index==2 || s.index==3)  // Not Ready
+            if (s.index==Drive::State::kConnected || s.index==Drive::State::kNotReady)  // Not Ready
                 SetLedColor(fStatusDriveLed, kLedGreenBar, time);
             if (s.index==Drive::State::kConnected || s.index==Drive::State::kArmed)  // Connected / Armed
@@ -2719,5 +2725,5 @@
             if (s.index==Drive::State::kTracking)  // Tracking
                 SetLedColor(fStatusDriveLed, kLedGreenCheck, time);
-            if (s.index==99)  // Error
+            if (s.index>=0xff)  // Error
                 SetLedColor(fStatusDriveLed, kLedGreenWarn, time);
         }
@@ -2747,5 +2753,5 @@
                 SetLedColor(fStatusBiasLed, kLedWarnTriangleBorder, time);
 
-            fBiasWidget->setEnabled(s.index>=3);
+            fBiasWidget->setEnabled(s.index>=BIAS::State::kInitializing);
         }
 
@@ -2755,27 +2761,43 @@
             fStatusFeedbackLabel->setToolTip(s.comment.c_str());
 
-            if (s.index>8) // Running
-                SetLedColor(fStatusFeedbackLed, kLedGreenCheck, time);
-            if (s.index==7 || s.index==8) // Idle
+            const bool connected = s.index> Feedback::State::kConnecting;
+            const bool idle      = s.index>=Feedback::State::kTempCtrlIdle    && s.index<=Feedback::State::kCurrentCtrlIdle;
+            const bool running   = s.index>=Feedback::State::kTempCtrlRunning && s.index<=Feedback::State::kCurrentCtrlRunning;
+            const bool calib     = s.index==Feedback::State::kCalibrating;
+
+            if (s.index<=Feedback::State::kConnecting) // NoDim / Disconnected
+                SetLedColor(fStatusFeedbackLed, kLedRed, time);
+            if (s.index<Feedback::State::kDisconnected) // No Dim connection
+                SetLedColor(fStatusFeedbackLed, kLedGray, time);
+            if (s.index==Feedback::State::kConnecting) // Connecting
+                SetLedColor(fStatusFeedbackLed, kLedOrange, time);
+            if (connected) // Connected
+                SetLedColor(fStatusFeedbackLed, kLedYellow, time);
+             if (idle)
                 SetLedColor(fStatusFeedbackLed, kLedGreen, time);
-            if (s.index>=4 && s.index<=6) // Connected
-                SetLedColor(fStatusFeedbackLed, kLedYellow, time);
-            if (s.index==3) // Connecting
-                SetLedColor(fStatusFeedbackLed, kLedOrange, time);
-            if (s.index<3) // NoDim / Disconnected 
-                SetLedColor(fStatusFeedbackLed, kLedRed, time);
-            if (s.index<1) // No Dim connection
-                SetLedColor(fStatusFeedbackLed, kLedGray, time);
-
-            fFeedbackWidget->setEnabled(s.index>=3);
-            fFeedbackCalibrate->setEnabled(s.index==4 || s.index==6);
-            fFeedbackStop->setEnabled(s.index>4);
-            fFeedbackTempStart->setEnabled(s.index==4 || s.index==5);
-            fFeedbackTempOffset->setEnabled(s.index<=6);
-            fFeedbackOutputEnable->setEnabled(s.index<=9);
-            fFeedbackOutputDisable->setEnabled(s.index!=7 && s.index!=8 && s.index!=9);
-
-            fFeedbackFrameLeft->setEnabled(s.index!=7 && s.index!=9 && s.index!=10 && s.index!=12);
-            fFeedbackCanvLeft->setEnabled(s.index!=7 && s.index!=9 && s.index!=10 && s.index!=12);
+             if (running)
+                 SetLedColor(fStatusFeedbackLed, kLedGreenCheck, time);
+             if (calib)
+                SetLedColor(fStatusFeedbackLed, kLedInProgress, time);
+
+            fFeedbackWidget->setEnabled(connected);
+
+            fFeedbackCalibrate->setEnabled(s.index==Feedback::State::kConnectedFSC || s.index==Feedback::State::kConnected);
+            fFeedbackTempStart->setEnabled(s.index==Feedback::State::kConnectedFSC || s.index==Feedback::State::kConnected);
+
+            fFeedbackStop->setEnabled(s.index>Feedback::State::kConnected);
+
+            fFeedbackTempOffset->setEnabled(s.index<=Feedback::State::kConnected);
+            fFeedbackOutputEnable->setEnabled(s.index<Feedback::State::kTempCtrlRunning);
+            fFeedbackOutputDisable->setEnabled(running);
+
+            const bool enable =
+                s.index!=Feedback::State::kTempCtrlIdle       ||
+                s.index!=Feedback::State::kCurrentCtrlIdle    ||
+                s.index!=Feedback::State::kTempCtrlRunning    ||
+                s.index!=Feedback::State::kCurrentCtrlRunning;
+
+            fFeedbackFrameLeft->setEnabled(enable);
+            fFeedbackCanvLeft->setEnabled(enable);
         }
 
@@ -2785,17 +2807,17 @@
             fStatusRateControlLabel->setToolTip(s.comment.c_str());
 
-            if (s.index==7) // InProgress
+            if (s.index==RateControl::State::kInProgress)
                 SetLedColor(fStatusRateControlLed, kLedGreenCheck, time);
-            if (s.index==6) // GlobalThresholdSet
+            if (s.index==RateControl::State::kGlobalThresholdSet)
                 SetLedColor(fStatusRateControlLed, kLedGreen, time);
-            if (s.index==5) // SettingGlobalThreshold
+            if (s.index==RateControl::State::kSettingGlobalThreshold)
                 SetLedColor(fStatusRateControlLed, kLedInProgress, time);
-            if (s.index==4) // Connected
+            if (s.index==RateControl::State::kConnected)
                 SetLedColor(fStatusRateControlLed, kLedGreenBar, time);
-            if (s.index==3) // Connecting
+            if (s.index==RateControl::State::kConnecting)
                 SetLedColor(fStatusRateControlLed, kLedOrange, time);
-            if (s.index<3) // NoDim / Disconnected 
+            if (s.index<RateControl::State::kConnecting)
                 SetLedColor(fStatusRateControlLed, kLedRed, time);
-            if (s.index<1) // No Dim connection
+            if (s.index<RateControl::State::kDisconnected)
                 SetLedColor(fStatusRateControlLed, kLedGray, time);
         }
@@ -2831,9 +2853,9 @@
             fStatusWeatherLabel->setText(s.name.c_str());
 
-            if (s.index==3)
+            if (s.index==MagicWeather::State::kReceiving)
                 SetLedColor(fStatusWeatherLed, kLedGreen, time);
-            if (s.index<3) // No valid data
+            if (s.index<MagicWeather::State::kReceiving)
                 SetLedColor(fStatusWeatherLed, kLedRed, time);
-            if (s.index<1) // No Dim connection
+            if (s.index<MagicWeather::State::kConnected)
                 SetLedColor(fStatusWeatherLed, kLedGray, time);
         }
@@ -2852,5 +2874,5 @@
 
         if (server=="RATESCAN")
-            fRateScanControls->setEnabled(s.index>=4);
+            fRateScanControls->setEnabled(s.index>=RateScan::State::kConnected);
 
         if (server=="SCHEDULER")
