From 55cabf35eb4e1deef59d1243166bc0ae9e5206b1 Mon Sep 17 00:00:00 2001
From: Joao Paulo Martins <joaopaulo.martins@ess.eu>
Date: Tue, 5 Jul 2022 12:50:47 +0200
Subject: [PATCH] Small adjustments in MEBT EMU OPIs

---
 10-Top/emuioc/daq-overview.bob                | 102 +++++++++++++++---
 .../frontend/manager/manager_user_gain.bob    |  34 +++++-
 .../adifc14emu/frontend/mebtemu-fe-detail.bob |   8 +-
 3 files changed, 125 insertions(+), 19 deletions(-)

diff --git a/10-Top/emuioc/daq-overview.bob b/10-Top/emuioc/daq-overview.bob
index de3e406..868fafa 100644
--- a/10-Top/emuioc/daq-overview.bob
+++ b/10-Top/emuioc/daq-overview.bob
@@ -102,9 +102,9 @@
   <widget type="rectangle" version="2.0.0">
     <name>BGGrey03-titlebar_3</name>
     <x>10</x>
-    <y>80</y>
+    <y>70</y>
     <width>210</width>
-    <height>170</height>
+    <height>200</height>
     <line_width>0</line_width>
     <background_color>
       <color name="GROUP-BORDER" red="150" green="155" blue="151">
@@ -117,7 +117,7 @@
     <name>BGGrey02-title_18</name>
     <text>Front-end Configuration </text>
     <x>10</x>
-    <y>80</y>
+    <y>70</y>
     <width>210</width>
     <height>30</height>
     <font>
@@ -136,8 +136,8 @@
     <name>Combo Box</name>
     <pv_name>$(P_FE)range_options</pv_name>
     <x>80</x>
-    <y>120</y>
-    <width>120</width>
+    <y>110</y>
+    <width>75</width>
     <height>20</height>
     <font>
       <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
@@ -148,7 +148,7 @@
     <name>Label_41</name>
     <text>Range</text>
     <x>20</x>
-    <y>120</y>
+    <y>110</y>
     <width>50</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="14.0">
@@ -171,7 +171,7 @@
     <name>Label_43</name>
     <text>FMC gain</text>
     <x>20</x>
-    <y>180</y>
+    <y>200</y>
     <width>70</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="14.0">
@@ -194,7 +194,7 @@
     <name>Label_44</name>
     <text>FE gain</text>
     <x>20</x>
-    <y>150</y>
+    <y>170</y>
     <width>60</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="14.0">
@@ -217,7 +217,7 @@
     <name>Text Entry</name>
     <pv_name>$(P_FE)fmc_gain</pv_name>
     <x>110</x>
-    <y>180</y>
+    <y>200</y>
     <width>90</width>
     <font>
       <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
@@ -231,7 +231,7 @@
     <name>Text Entry_1</name>
     <pv_name>$(P_FE)fe_gain</pv_name>
     <x>110</x>
-    <y>150</y>
+    <y>170</y>
     <width>90</width>
     <font>
       <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
@@ -245,7 +245,7 @@
     <name>Text Update_34</name>
     <pv_name>$(P_FE)_conversion_factor</pv_name>
     <x>110</x>
-    <y>210</y>
+    <y>230</y>
     <width>90</width>
     <font>
       <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
@@ -260,7 +260,7 @@
     <name>Label_52</name>
     <text>Conv. Factor</text>
     <x>20</x>
-    <y>210</y>
+    <y>230</y>
     <width>80</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="14.0">
@@ -1305,4 +1305,82 @@
     </points>
     <arrows>2</arrows>
   </widget>
+  <widget type="action_button" version="3.0.0">
+    <name>Action Button</name>
+    <actions>
+      <action type="write_pv">
+        <pv_name>$(P_FE)apply_gain.PROC</pv_name>
+        <value>1</value>
+        <description>WritePV</description>
+      </action>
+    </actions>
+    <pv_name>$(P_FE)apply_gain.PROC</pv_name>
+    <text>&gt;&gt;</text>
+    <x>157</x>
+    <y>110</y>
+    <width>25</width>
+    <height>20</height>
+    <font>
+      <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
+      </font>
+    </font>
+  </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>Rectangle</name>
+    <x>184</x>
+    <y>111</y>
+    <width>20</width>
+    <height>44</height>
+    <line_width>0</line_width>
+    <line_color>
+      <color name="BLACK" red="0" green="0" blue="0">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="OK" red="61" green="216" blue="61">
+      </color>
+    </background_color>
+    <rules>
+      <rule name="gainOK" prop_id="background_color" out_exp="false">
+        <exp bool_exp="pv0 != pv1">
+          <value>
+            <color name="MAJOR" red="252" green="13" blue="27">
+            </color>
+          </value>
+        </exp>
+        <pv_name>$(P_FE)range_options</pv_name>
+        <pv_name>$(P_FE)range_options-RB</pv_name>
+      </rule>
+    </rules>
+  </widget>
+  <widget type="action_button" version="3.0.0">
+    <name>Action Button_1</name>
+    <actions>
+      <action type="write_pv">
+        <pv_name>$(P_DAQ):OFFCOMP-Fanout.PROC</pv_name>
+        <value>1</value>
+        <description>WritePV</description>
+      </action>
+    </actions>
+    <pv_name>$(P_DAQ):OFFCOMP-Fanout.PROC</pv_name>
+    <text>Offset Adj.</text>
+    <x>80</x>
+    <y>135</y>
+    <width>102</width>
+    <height>20</height>
+    <font>
+      <font name="Fine Print" family="Source Sans Pro" style="REGULAR" size="14.0">
+      </font>
+    </font>
+    <rules>
+      <rule name="disable" prop_id="enabled" out_exp="false">
+        <exp bool_exp="pv0 != pv1">
+          <value>false</value>
+        </exp>
+        <pv_name>$(P_FE)range_options</pv_name>
+        <pv_name>$(P_FE)range_options-RB</pv_name>
+      </rule>
+    </rules>
+    <border_alarm_sensitive>false</border_alarm_sensitive>
+  </widget>
 </display>
diff --git a/99-Shared/adifc14emu/frontend/manager/manager_user_gain.bob b/99-Shared/adifc14emu/frontend/manager/manager_user_gain.bob
index c74c0e1..9f4b23f 100644
--- a/99-Shared/adifc14emu/frontend/manager/manager_user_gain.bob
+++ b/99-Shared/adifc14emu/frontend/manager/manager_user_gain.bob
@@ -99,9 +99,9 @@ $(pv_value)</tooltip>
     </actions>
     <pv_name>$(P)apply_gain.PROC</pv_name>
     <text>Apply gain</text>
-    <x>737</x>
-    <y>144</y>
-    <width>113</width>
+    <x>740</x>
+    <y>145</y>
+    <width>93</width>
     <font>
       <font family="Source Sans Pro" style="BOLD" size="16.0">
       </font>
@@ -685,4 +685,32 @@ $(pv_value)</tooltip>
       </color>
     </border_color>
   </widget>
+  <widget type="rectangle" version="2.0.0">
+    <name>Rectangle_1</name>
+    <x>833</x>
+    <y>145</y>
+    <width>20</width>
+    <height>30</height>
+    <line_width>0</line_width>
+    <line_color>
+      <color name="BLACK" red="0" green="0" blue="0">
+      </color>
+    </line_color>
+    <background_color>
+      <color name="OK" red="61" green="216" blue="61">
+      </color>
+    </background_color>
+    <rules>
+      <rule name="gainOK" prop_id="background_color" out_exp="false">
+        <exp bool_exp="pv0 != pv1">
+          <value>
+            <color name="MAJOR" red="252" green="13" blue="27">
+            </color>
+          </value>
+        </exp>
+        <pv_name>$(P)range_options</pv_name>
+        <pv_name>$(P)range_options-RB</pv_name>
+      </rule>
+    </rules>
+  </widget>
 </display>
diff --git a/99-Shared/adifc14emu/frontend/mebtemu-fe-detail.bob b/99-Shared/adifc14emu/frontend/mebtemu-fe-detail.bob
index 79b9ad5..bef7ebd 100644
--- a/99-Shared/adifc14emu/frontend/mebtemu-fe-detail.bob
+++ b/99-Shared/adifc14emu/frontend/mebtemu-fe-detail.bob
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <display version="2.0.0">
-  <name>RFFE $(SYSTEM)</name>
-  <width>2010</width>
-  <height>1100</height>
+  <name>PBI-EMU02 Front-end Control </name>
+  <width>2100</width>
+  <height>1250</height>
   <background_color>
     <color red="240" green="240" blue="240">
     </color>
@@ -102,7 +102,7 @@
     <x>1109</x>
     <y>486</y>
     <width>900</width>
-    <height>580</height>
+    <height>750</height>
     <resize>2</resize>
   </widget>
   <widget type="embedded" version="2.0.0">
-- 
GitLab