From 4213a161fe5d5cb07f233f23386b51a754526eae Mon Sep 17 00:00:00 2001
From: Dhanya Thattil <dhanya.thattil@psi.ch>
Date: Fri, 14 Jun 2019 16:38:42 +0200
Subject: [PATCH] WIP

---
 slsDetectorGui/forms/form_tab_plot.ui         | 1549 +++++++----------
 slsDetectorGui/include/qDrawPlot.h            |   32 +-
 slsDetectorGui/include/qTabPlot.h             |   73 +-
 .../src/SlsQt2DPlotLayout.cxx                 |   59 -
 slsDetectorGui/src/qDrawPlot.cpp              |    4 +-
 slsDetectorGui/src/qTabPlot.cpp               | 1148 ++++++------
 6 files changed, 1222 insertions(+), 1643 deletions(-)

diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui
index e16c6ae46..596c11aef 100755
--- a/slsDetectorGui/forms/form_tab_plot.ui
+++ b/slsDetectorGui/forms/form_tab_plot.ui
@@ -74,10 +74,10 @@
    </property>
    <property name="geometry">
     <rect>
-     <x>15</x>
-     <y>70</y>
-     <width>371</width>
-     <height>51</height>
+     <x>400</x>
+     <y>61</y>
+     <width>351</width>
+     <height>67</height>
     </rect>
    </property>
    <property name="title">
@@ -89,13 +89,13 @@
    <property name="flat">
     <bool>false</bool>
    </property>
-   <widget class="QStackedWidget" name="stackedWidget_2">
+   <widget class="QStackedWidget" name="stackedWidget2D">
     <property name="geometry">
      <rect>
-      <x>5</x>
-      <y>15</y>
-      <width>361</width>
-      <height>31</height>
+      <x>12</x>
+      <y>22</y>
+      <width>334</width>
+      <height>39</height>
      </rect>
     </property>
     <property name="currentIndex">
@@ -105,10 +105,10 @@
      <widget class="QWidget" name="gridLayoutWidget_5">
       <property name="geometry">
        <rect>
-        <x>20</x>
-        <y>5</y>
-        <width>336</width>
-        <height>26</height>
+        <x>8</x>
+        <y>0</y>
+        <width>317</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QGridLayout" name="gridLayout_5">
@@ -125,7 +125,7 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="2">
+       <item row="0" column="1">
         <widget class="QCheckBox" name="chkContour">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -138,7 +138,7 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="4">
+       <item row="0" column="2">
         <widget class="QCheckBox" name="chkLogz">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -151,38 +151,6 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="1">
-        <spacer name="horizontalSpacer_15">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>15</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="0" column="3">
-        <spacer name="horizontalSpacer_16">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
       </layout>
      </widget>
     </widget>
@@ -190,10 +158,10 @@
      <widget class="QWidget" name="horizontalLayoutWidget_6">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>100</width>
-        <height>26</height>
+        <x>9</x>
+        <y>0</y>
+        <width>314</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_4">
@@ -216,92 +184,102 @@
          </property>
         </widget>
        </item>
+       <item>
+        <spacer name="horizontalSpacer_15">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>30</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="btnResetAccumulate_2">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="palette">
+          <palette>
+           <active>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </inactive>
+           <disabled>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </disabled>
+          </palette>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>Reset Accumulation  </string>
+         </property>
+         <property name="icon">
+          <iconset resource="../include/icons.qrc">
+           <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
-     <widget class="QPushButton" name="btnResetAccumulate_2">
-      <property name="geometry">
-       <rect>
-        <x>175</x>
-        <y>3</y>
-        <width>156</width>
-        <height>26</height>
-       </rect>
-      </property>
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>16777215</width>
-        <height>16777215</height>
-       </size>
-      </property>
-      <property name="palette">
-       <palette>
-        <active>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </active>
-        <inactive>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </inactive>
-        <disabled>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </disabled>
-       </palette>
-      </property>
-      <property name="focusPolicy">
-       <enum>Qt::NoFocus</enum>
-      </property>
-      <property name="text">
-       <string>Reset Accumulation  </string>
-      </property>
-      <property name="icon">
-       <iconset resource="../include/icons.qrc">
-        <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
-      </property>
-      <property name="iconSize">
-       <size>
-        <width>16</width>
-        <height>16</height>
-       </size>
-      </property>
-     </widget>
     </widget>
     <widget class="QWidget" name="pagePedestal_2">
      <widget class="QWidget" name="horizontalLayoutWidget_5">
       <property name="geometry">
        <rect>
-        <x>20</x>
-        <y>5</y>
-        <width>81</width>
-        <height>26</height>
+        <x>8</x>
+        <y>0</y>
+        <width>316</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_3">
@@ -324,92 +302,102 @@
          </property>
         </widget>
        </item>
+       <item>
+        <spacer name="horizontalSpacer_16">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>60</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="btnRecalPedestal_2">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="palette">
+          <palette>
+           <active>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </inactive>
+           <disabled>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </disabled>
+          </palette>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>Recalculate Pedestal  </string>
+         </property>
+         <property name="icon">
+          <iconset resource="../include/icons.qrc">
+           <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
-     <widget class="QPushButton" name="btnRecalPedestal_2">
-      <property name="geometry">
-       <rect>
-        <x>160</x>
-        <y>3</y>
-        <width>171</width>
-        <height>26</height>
-       </rect>
-      </property>
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>16777215</width>
-        <height>16777215</height>
-       </size>
-      </property>
-      <property name="palette">
-       <palette>
-        <active>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </active>
-        <inactive>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </inactive>
-        <disabled>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </disabled>
-       </palette>
-      </property>
-      <property name="focusPolicy">
-       <enum>Qt::NoFocus</enum>
-      </property>
-      <property name="text">
-       <string>Recalculate Pedestal  </string>
-      </property>
-      <property name="icon">
-       <iconset resource="../include/icons.qrc">
-        <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
-      </property>
-      <property name="iconSize">
-       <size>
-        <width>16</width>
-        <height>16</height>
-       </size>
-      </property>
-     </widget>
     </widget>
     <widget class="QWidget" name="page_9">
      <widget class="QWidget" name="horizontalLayoutWidget_10">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>311</width>
-        <height>26</height>
+        <x>10</x>
+        <y>0</y>
+        <width>313</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutThreshold_2">
@@ -439,7 +427,7 @@
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
+           <width>10</width>
            <height>20</height>
           </size>
          </property>
@@ -546,10 +534,10 @@
      <widget class="QWidget" name="horizontalLayoutWidget_12">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>335</width>
-        <height>26</height>
+        <x>9</x>
+        <y>0</y>
+        <width>318</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_8">
@@ -569,7 +557,7 @@
          </property>
          <property name="toolTip">
           <string>&lt;nobr&gt;
-Displays minimum, maximum and sum of values for each plot.
+Displays statistics, ie. minimum, maximum and sum of values for each plot.
 &lt;nobr&gt;</string>
          </property>
          <property name="text">
@@ -577,22 +565,6 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
         </widget>
        </item>
-       <item>
-        <spacer name="horizontalSpacer_19">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>10</width>
-           <height>10</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
        <item>
         <widget class="QCheckBox" name="chkGainPlot">
          <property name="enabled">
@@ -614,22 +586,6 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
         </widget>
        </item>
-       <item>
-        <spacer name="horizontalSpacer_22">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>10</width>
-           <height>10</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
        <item>
         <widget class="QCheckBox" name="chkGapPixels">
          <property name="enabled">
@@ -661,10 +617,10 @@ Displays minimum, maximum and sum of values for each plot.
      <widget class="QWidget" name="horizontalLayoutWidget_14">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>311</width>
-        <height>26</height>
+        <x>9</x>
+        <y>0</y>
+        <width>315</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutThreshold_4">
@@ -816,14 +772,84 @@ Displays minimum, maximum and sum of values for each plot.
      </widget>
     </widget>
    </widget>
+   <widget class="QPushButton" name="btnLeft2D">
+    <property name="geometry">
+     <rect>
+      <x>2</x>
+      <y>31</y>
+      <width>16</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="focusPolicy">
+     <enum>Qt::NoFocus</enum>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="../include/icons.qrc">
+      <normaloff>:/icons/images/leftArrow.png</normaloff>:/icons/images/leftArrow.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>16</width>
+      <height>16</height>
+     </size>
+    </property>
+    <property name="flat">
+     <bool>true</bool>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="btnRight2D">
+    <property name="geometry">
+     <rect>
+      <x>337</x>
+      <y>32</y>
+      <width>16</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="focusPolicy">
+     <enum>Qt::NoFocus</enum>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="../include/icons.qrc">
+      <normaloff>:/icons/images/rightArrow.png</normaloff>:/icons/images/rightArrow.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>16</width>
+      <height>16</height>
+     </size>
+    </property>
+    <property name="flat">
+     <bool>true</bool>
+    </property>
+   </widget>
   </widget>
   <widget class="QGroupBox" name="box1D">
    <property name="geometry">
     <rect>
-     <x>15</x>
-     <y>70</y>
+     <x>12</x>
+     <y>61</y>
      <width>371</width>
-     <height>51</height>
+     <height>64</height>
     </rect>
    </property>
    <property name="title">
@@ -835,30 +861,30 @@ Displays minimum, maximum and sum of values for each plot.
    <property name="flat">
     <bool>false</bool>
    </property>
-   <widget class="QStackedWidget" name="stackedWidget">
+   <widget class="QStackedWidget" name="stackedWidget1D">
     <property name="geometry">
      <rect>
-      <x>4</x>
-      <y>15</y>
-      <width>366</width>
-      <height>31</height>
+      <x>12</x>
+      <y>22</y>
+      <width>355</width>
+      <height>40</height>
      </rect>
     </property>
     <property name="currentIndex">
-     <number>5</number>
+     <number>2</number>
     </property>
     <widget class="QWidget" name="page">
-     <widget class="QWidget" name="gridLayoutWidget_2">
+     <widget class="QWidget" name="horizontalLayoutWidget_2">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>108</width>
-        <height>26</height>
+        <x>5</x>
+        <y>0</y>
+        <width>333</width>
+        <height>35</height>
        </rect>
       </property>
-      <layout class="QGridLayout" name="gridLayout_2">
-       <item row="0" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
         <widget class="QCheckBox" name="chkSuperimpose">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -874,21 +900,22 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
         </widget>
        </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="horizontalLayoutWidget_2">
-      <property name="geometry">
-       <rect>
-        <x>210</x>
-        <y>5</y>
-        <width>128</width>
-        <height>26</height>
-       </rect>
-      </property>
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <property name="spacing">
-        <number>1</number>
-       </property>
+       <item>
+        <spacer name="horizontalSpacer_22">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>30</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
        <item>
         <widget class="QLabel" name="lblPersistency">
          <property name="enabled">
@@ -918,7 +945,7 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
          <property name="maximumSize">
           <size>
-           <width>40</width>
+           <width>16777215</width>
            <height>16777215</height>
           </size>
          </property>
@@ -943,10 +970,10 @@ Displays minimum, maximum and sum of values for each plot.
      <widget class="QWidget" name="gridLayoutWidget_8">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>321</width>
-        <height>26</height>
+        <x>6</x>
+        <y>0</y>
+        <width>330</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QGridLayout" name="gridLayout_10">
@@ -1018,88 +1045,13 @@ Displays minimum, maximum and sum of values for each plot.
      </widget>
     </widget>
     <widget class="QWidget" name="pageAccumulate">
-     <widget class="QPushButton" name="btnResetAccumulate">
-      <property name="geometry">
-       <rect>
-        <x>175</x>
-        <y>3</y>
-        <width>161</width>
-        <height>26</height>
-       </rect>
-      </property>
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>16777215</width>
-        <height>16777215</height>
-       </size>
-      </property>
-      <property name="palette">
-       <palette>
-        <active>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </active>
-        <inactive>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </inactive>
-        <disabled>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </disabled>
-       </palette>
-      </property>
-      <property name="focusPolicy">
-       <enum>Qt::NoFocus</enum>
-      </property>
-      <property name="text">
-       <string>Reset Accumulation  </string>
-      </property>
-      <property name="icon">
-       <iconset resource="../include/icons.qrc">
-        <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
-      </property>
-      <property name="iconSize">
-       <size>
-        <width>16</width>
-        <height>16</height>
-       </size>
-      </property>
-     </widget>
      <widget class="QWidget" name="horizontalLayoutWidget_7">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>100</width>
-        <height>26</height>
+        <x>8</x>
+        <y>0</y>
+        <width>329</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_5">
@@ -1122,6 +1074,91 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
         </widget>
        </item>
+       <item>
+        <spacer name="horizontalSpacer_23">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>30</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="btnResetAccumulate">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="palette">
+          <palette>
+           <active>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </inactive>
+           <disabled>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </disabled>
+          </palette>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>Reset Accumulation  </string>
+         </property>
+         <property name="icon">
+          <iconset resource="../include/icons.qrc">
+           <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>
@@ -1129,10 +1166,10 @@ Displays minimum, maximum and sum of values for each plot.
      <widget class="QWidget" name="horizontalLayoutWidget_8">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>81</width>
-        <height>26</height>
+        <x>6</x>
+        <y>0</y>
+        <width>331</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_6">
@@ -1155,83 +1192,93 @@ Displays minimum, maximum and sum of values for each plot.
          </property>
         </widget>
        </item>
+       <item>
+        <spacer name="horizontalSpacer_24">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>60</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="btnRecalPedestal">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="palette">
+          <palette>
+           <active>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </inactive>
+           <disabled>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>20</red>
+               <green>20</green>
+               <blue>20</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </disabled>
+          </palette>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>Recalculate Pedestal  </string>
+         </property>
+         <property name="icon">
+          <iconset resource="../include/icons.qrc">
+           <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>24</width>
+           <height>24</height>
+          </size>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
-     <widget class="QPushButton" name="btnRecalPedestal">
-      <property name="geometry">
-       <rect>
-        <x>165</x>
-        <y>3</y>
-        <width>171</width>
-        <height>26</height>
-       </rect>
-      </property>
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>16777215</width>
-        <height>16777215</height>
-       </size>
-      </property>
-      <property name="palette">
-       <palette>
-        <active>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </active>
-        <inactive>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </inactive>
-        <disabled>
-         <colorrole role="Shadow">
-          <brush brushstyle="SolidPattern">
-           <color alpha="255">
-            <red>20</red>
-            <green>20</green>
-            <blue>20</blue>
-           </color>
-          </brush>
-         </colorrole>
-        </disabled>
-       </palette>
-      </property>
-      <property name="focusPolicy">
-       <enum>Qt::NoFocus</enum>
-      </property>
-      <property name="text">
-       <string>Recalculate Pedestal  </string>
-      </property>
-      <property name="icon">
-       <iconset resource="../include/icons.qrc">
-        <normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
-      </property>
-      <property name="iconSize">
-       <size>
-        <width>16</width>
-        <height>16</height>
-       </size>
-      </property>
-     </widget>
     </widget>
     <widget class="QWidget" name="page_8">
      <property name="toolTip">
@@ -1242,10 +1289,10 @@ All values between &lt;b&gt;from&lt;/b&gt; and &lt;b&gt;to&lt;/b&gt; will be res
      <widget class="QWidget" name="horizontalLayoutWidget_11">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>311</width>
-        <height>26</height>
+        <x>8</x>
+        <y>0</y>
+        <width>327</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutThreshold">
@@ -1387,10 +1434,10 @@ All values between &lt;b&gt;from&lt;/b&gt; and &lt;b&gt;to&lt;/b&gt; will be res
      <widget class="QWidget" name="horizontalLayoutWidget_9">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>132</width>
-        <height>26</height>
+        <x>6</x>
+        <y>0</y>
+        <width>140</width>
+        <height>35</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutSave_7">
@@ -1428,10 +1475,10 @@ Displays minimum, maximum and sum of values for each plot.
      <widget class="QWidget" name="horizontalLayoutWidget_13">
       <property name="geometry">
        <rect>
-        <x>25</x>
-        <y>5</y>
-        <width>311</width>
-        <height>26</height>
+        <x>5</x>
+        <y>0</y>
+        <width>331</width>
+        <height>36</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="layoutThreshold_3">
@@ -1583,14 +1630,84 @@ Displays minimum, maximum and sum of values for each plot.
      </widget>
     </widget>
    </widget>
+   <widget class="QPushButton" name="btnLeft1D">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>30</y>
+      <width>16</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="focusPolicy">
+     <enum>Qt::NoFocus</enum>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="../include/icons.qrc">
+      <normaloff>:/icons/images/leftArrow.png</normaloff>:/icons/images/leftArrow.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>16</width>
+      <height>16</height>
+     </size>
+    </property>
+    <property name="flat">
+     <bool>true</bool>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="btnRight1D">
+    <property name="geometry">
+     <rect>
+      <x>351</x>
+      <y>31</y>
+      <width>16</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="focusPolicy">
+     <enum>Qt::NoFocus</enum>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="../include/icons.qrc">
+      <normaloff>:/icons/images/rightArrow.png</normaloff>:/icons/images/rightArrow.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>16</width>
+      <height>16</height>
+     </size>
+    </property>
+    <property name="flat">
+     <bool>true</bool>
+    </property>
+   </widget>
   </widget>
   <widget class="QGroupBox" name="boxSave">
    <property name="geometry">
     <rect>
-     <x>410</x>
-     <y>70</y>
-     <width>351</width>
-     <height>51</height>
+     <x>20</x>
+     <y>130</y>
+     <width>356</width>
+     <height>57</height>
     </rect>
    </property>
    <property name="title">
@@ -1606,9 +1723,9 @@ Displays minimum, maximum and sum of values for each plot.
     <property name="geometry">
      <rect>
       <x>10</x>
-      <y>20</y>
-      <width>233</width>
-      <height>26</height>
+      <y>22</y>
+      <width>342</width>
+      <height>35</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="layoutSave">
@@ -1631,231 +1748,73 @@ Displays minimum, maximum and sum of values for each plot.
        </property>
       </widget>
      </item>
-    </layout>
-   </widget>
-   <widget class="QPushButton" name="btnSave">
-    <property name="geometry">
-     <rect>
-      <x>264</x>
-      <y>19</y>
-      <width>76</width>
-      <height>25</height>
-     </rect>
-    </property>
-    <property name="sizePolicy">
-     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-      <horstretch>0</horstretch>
-      <verstretch>0</verstretch>
-     </sizepolicy>
-    </property>
-    <property name="maximumSize">
-     <size>
-      <width>16777215</width>
-      <height>16777215</height>
-     </size>
-    </property>
-    <property name="palette">
-     <palette>
-      <active>
-       <colorrole role="Shadow">
-        <brush brushstyle="SolidPattern">
-         <color alpha="255">
-          <red>20</red>
-          <green>20</green>
-          <blue>20</blue>
-         </color>
-        </brush>
-       </colorrole>
-      </active>
-      <inactive>
-       <colorrole role="Shadow">
-        <brush brushstyle="SolidPattern">
-         <color alpha="255">
-          <red>20</red>
-          <green>20</green>
-          <blue>20</blue>
-         </color>
-        </brush>
-       </colorrole>
-      </inactive>
-      <disabled>
-       <colorrole role="Shadow">
-        <brush brushstyle="SolidPattern">
-         <color alpha="255">
-          <red>20</red>
-          <green>20</green>
-          <blue>20</blue>
-         </color>
-        </brush>
-       </colorrole>
-      </disabled>
-     </palette>
-    </property>
-    <property name="focusPolicy">
-     <enum>Qt::NoFocus</enum>
-    </property>
-    <property name="text">
-     <string>Save  </string>
-    </property>
-    <property name="icon">
-     <iconset resource="../include/icons.qrc">
-      <normaloff>:/icons/images/save.png</normaloff>:/icons/images/save.png</iconset>
-    </property>
-    <property name="iconSize">
-     <size>
-      <width>16</width>
-      <height>16</height>
-     </size>
-    </property>
-   </widget>
-  </widget>
-  <widget class="QGroupBox" name="boxScan">
-   <property name="geometry">
-    <rect>
-     <x>410</x>
-     <y>5</y>
-     <width>351</width>
-     <height>51</height>
-    </rect>
-   </property>
-   <property name="title">
-    <string>2D Scan  -  Y Axis Values</string>
-   </property>
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>false</bool>
-   </property>
-   <widget class="QWidget" name="horizontalLayoutWidget_3">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>20</y>
-      <width>357</width>
-      <height>26</height>
-     </rect>
-    </property>
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <property name="spacing">
-      <number>0</number>
-     </property>
      <item>
-      <widget class="QRadioButton" name="radioLevel0">
+      <widget class="QPushButton" name="btnSave">
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 0&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>Level 0</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_6">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
+       <property name="maximumSize">
         <size>
-         <width>7</width>
-         <height>10</height>
+         <width>16777215</width>
+         <height>16777215</height>
         </size>
        </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="radioLevel1">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
+       <property name="palette">
+        <palette>
+         <active>
+          <colorrole role="Shadow">
+           <brush brushstyle="SolidPattern">
+            <color alpha="255">
+             <red>20</red>
+             <green>20</green>
+             <blue>20</blue>
+            </color>
+           </brush>
+          </colorrole>
+         </active>
+         <inactive>
+          <colorrole role="Shadow">
+           <brush brushstyle="SolidPattern">
+            <color alpha="255">
+             <red>20</red>
+             <green>20</green>
+             <blue>20</blue>
+            </color>
+           </brush>
+          </colorrole>
+         </inactive>
+         <disabled>
+          <colorrole role="Shadow">
+           <brush brushstyle="SolidPattern">
+            <color alpha="255">
+             <red>20</red>
+             <green>20</green>
+             <blue>20</blue>
+            </color>
+           </brush>
+          </colorrole>
+         </disabled>
+        </palette>
        </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 1&lt;/nobr&gt;</string>
+       <property name="focusPolicy">
+        <enum>Qt::NoFocus</enum>
        </property>
        <property name="text">
-        <string>Level 1</string>
+        <string>Save  </string>
        </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_7">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
+       <property name="icon">
+        <iconset resource="../include/icons.qrc">
+         <normaloff>:/icons/images/save.png</normaloff>:/icons/images/save.png</iconset>
        </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
+       <property name="iconSize">
         <size>
-         <width>7</width>
-         <height>10</height>
+         <width>24</width>
+         <height>24</height>
         </size>
        </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="radioFileIndex">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 0 or a Scan Level 1, not both&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>Frame Index</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_8">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>7</width>
-         <height>10</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="radioAllFrames">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Disabled only for Angle Plots, Moench and Eiger Detectors&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>All Frames</string>
-       </property>
-       <property name="checked">
-        <bool>false</bool>
-       </property>
       </widget>
      </item>
     </layout>
@@ -1865,9 +1824,9 @@ Displays minimum, maximum and sum of values for each plot.
    <property name="geometry">
     <rect>
      <x>15</x>
-     <y>200</y>
+     <y>190</y>
      <width>746</width>
-     <height>141</height>
+     <height>149</height>
     </rect>
    </property>
    <property name="title">
@@ -1883,9 +1842,9 @@ Displays minimum, maximum and sum of values for each plot.
     <property name="geometry">
      <rect>
       <x>10</x>
-      <y>15</y>
+      <y>20</y>
       <width>726</width>
-      <height>121</height>
+      <height>125</height>
      </rect>
     </property>
     <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0,0,0,0">
@@ -2261,7 +2220,7 @@ Displays minimum, maximum and sum of values for each plot.
     </rect>
    </property>
    <property name="title">
-    <string>Plot Arguments</string>
+    <string>Plot Type</string>
    </property>
    <property name="alignment">
     <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@@ -2275,7 +2234,7 @@ Displays minimum, maximum and sum of values for each plot.
       <x>10</x>
       <y>20</y>
       <width>355</width>
-      <height>26</height>
+      <height>27</height>
      </rect>
     </property>
     <layout class="QGridLayout" name="gridLayout_6">
@@ -2362,19 +2321,19 @@ Displays minimum, maximum and sum of values for each plot.
   <widget class="QGroupBox" name="boxFrequency">
    <property name="geometry">
     <rect>
-     <x>15</x>
-     <y>135</y>
-     <width>371</width>
-     <height>49</height>
+     <x>400</x>
+     <y>5</y>
+     <width>357</width>
+     <height>58</height>
     </rect>
    </property>
    <property name="toolTip">
     <string>&lt;nobr&gt;
-Interval between plots has 2 modes. A condition to be satisfied, in order to avoid losing images:
+Streaming Interval between 2 plots. Default is time interval with 200 ms.
 &lt;/nobr&gt;&lt;br&gt;&lt;br&gt;&lt;nobr&gt;
-&lt;b&gt;Time Interval&lt;/b&gt;: (Acquisition Period) * (nth Image) &gt;= 250ms.
+&lt;b&gt;Time Interval&lt;/b&gt;: Streaming time interval when an image should be streamed. 
 &lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
-&lt;b&gt;Every nth Image&lt;/b&gt;: minimum of 250ms.
+&lt;b&gt;Every nth Image&lt;/b&gt;: Only every nth image is streamed. 
 &lt;/nobr&gt;</string>
    </property>
    <property name="title">
@@ -2390,9 +2349,9 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
     <property name="geometry">
      <rect>
       <x>10</x>
-      <y>16</y>
-      <width>351</width>
-      <height>26</height>
+      <y>19</y>
+      <width>340</width>
+      <height>32</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="layoutSave_2">
@@ -2539,10 +2498,10 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
    </property>
    <property name="geometry">
     <rect>
-     <x>410</x>
-     <y>135</y>
+     <x>400</x>
+     <y>130</y>
      <width>351</width>
-     <height>51</height>
+     <height>60</height>
     </rect>
    </property>
    <property name="title">
@@ -2558,9 +2517,9 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
     <property name="geometry">
      <rect>
       <x>10</x>
-      <y>12</y>
-      <width>365</width>
-      <height>36</height>
+      <y>23</y>
+      <width>339</width>
+      <height>37</height>
      </rect>
     </property>
     <layout class="QGridLayout" name="gridLayout_4">
@@ -2694,7 +2653,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
        </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>20</width>
+         <width>10</width>
          <height>20</height>
         </size>
        </property>
@@ -2710,7 +2669,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
        </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>20</width>
+         <width>10</width>
          <height>20</height>
         </size>
        </property>
@@ -2782,214 +2741,18 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
     </layout>
    </widget>
   </widget>
-  <widget class="QPushButton" name="btnRight">
-   <property name="geometry">
-    <rect>
-     <x>362</x>
-     <y>95</y>
-     <width>16</width>
-     <height>16</height>
-    </rect>
-   </property>
-   <property name="sizePolicy">
-    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="focusPolicy">
-    <enum>Qt::NoFocus</enum>
-   </property>
-   <property name="text">
-    <string/>
-   </property>
-   <property name="icon">
-    <iconset resource="../include/icons.qrc">
-     <normaloff>:/icons/images/rightArrow.png</normaloff>:/icons/images/rightArrow.png</iconset>
-   </property>
-   <property name="iconSize">
-    <size>
-     <width>16</width>
-     <height>16</height>
-    </size>
-   </property>
-   <property name="flat">
-    <bool>true</bool>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="btnLeft">
-   <property name="geometry">
-    <rect>
-     <x>23</x>
-     <y>94</y>
-     <width>16</width>
-     <height>16</height>
-    </rect>
-   </property>
-   <property name="sizePolicy">
-    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="focusPolicy">
-    <enum>Qt::NoFocus</enum>
-   </property>
-   <property name="text">
-    <string/>
-   </property>
-   <property name="icon">
-    <iconset resource="../include/icons.qrc">
-     <normaloff>:/icons/images/leftArrow.png</normaloff>:/icons/images/leftArrow.png</iconset>
-   </property>
-   <property name="iconSize">
-    <size>
-     <width>16</width>
-     <height>16</height>
-    </size>
-   </property>
-   <property name="flat">
-    <bool>true</bool>
-   </property>
-  </widget>
-  <widget class="QGroupBox" name="boxHistogram">
-   <property name="geometry">
-    <rect>
-     <x>410</x>
-     <y>5</y>
-     <width>351</width>
-     <height>51</height>
-    </rect>
-   </property>
-   <property name="title">
-    <string>Histogram  -  X Axis Values</string>
-   </property>
-   <property name="checkable">
-    <bool>false</bool>
-   </property>
-   <property name="checked">
-    <bool>false</bool>
-   </property>
-   <widget class="QWidget" name="horizontalLayoutWidget_15">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>20</y>
-      <width>331</width>
-      <height>26</height>
-     </rect>
-    </property>
-    <layout class="QHBoxLayout" name="horizontalLayout_3">
-     <property name="spacing">
-      <number>0</number>
-     </property>
-     <item>
-      <widget class="QRadioButton" name="radioHistIntensity">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 0&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>Intensity</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_10">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>7</width>
-         <height>10</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="radioHistLevel0">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 1&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>Level 0</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_11">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>7</width>
-         <height>10</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="radioHistLevel1">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>&lt;nobr&gt;Enabled only when there is a Scan Level 0 or a Scan Level 1, not both&lt;/nobr&gt;</string>
-       </property>
-       <property name="text">
-        <string>Level 1</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </widget>
-  </widget>
   <zorder>box1D</zorder>
   <zorder>box2D</zorder>
   <zorder>boxSave</zorder>
-  <zorder>boxScan</zorder>
   <zorder>boxPlotAxis</zorder>
   <zorder>groupBox_3</zorder>
   <zorder>boxFrequency</zorder>
   <zorder>boxSnapshot</zorder>
-  <zorder>btnRight</zorder>
-  <zorder>btnLeft</zorder>
-  <zorder>boxHistogram</zorder>
  </widget>
  <tabstops>
   <tabstop>radioNoPlot</tabstop>
   <tabstop>radioHistogram</tabstop>
   <tabstop>radioDataGraph</tabstop>
-  <tabstop>boxScan</tabstop>
-  <tabstop>radioLevel0</tabstop>
-  <tabstop>radioLevel1</tabstop>
-  <tabstop>radioFileIndex</tabstop>
-  <tabstop>radioAllFrames</tabstop>
   <tabstop>chkInterpolate</tabstop>
   <tabstop>chkContour</tabstop>
   <tabstop>chkLogz</tabstop>
@@ -3015,11 +2778,9 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
   <tabstop>dispZMin</tabstop>
   <tabstop>chkZMax</tabstop>
   <tabstop>dispZMax</tabstop>
-  <tabstop>spinPersistency</tabstop>
   <tabstop>chk1DLog</tabstop>
   <tabstop>chkPoints</tabstop>
   <tabstop>chkLines</tabstop>
-  <tabstop>chkSuperimpose</tabstop>
  </tabstops>
  <resources>
   <include location="../include/icons.qrc"/>
diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h
index b286febbc..cd45afaee 100755
--- a/slsDetectorGui/include/qDrawPlot.h
+++ b/slsDetectorGui/include/qDrawPlot.h
@@ -67,18 +67,27 @@ public:
 	 * file index wont increase and so you need secondary titles to differentitate between plots*/
 	void SetFileWrite(bool enable){fileSaveEnable = enable;};
 
+
 	/**	sets plot Title prefix*/
 	void SetPlotTitlePrefix(QString title)      	{plotTitle_prefix = title;}
-	/**	sets 1D X Axis Title */
-	void SetHistXAxisTitle(QString title)   	{histXAxisTitle = title;}
-	/**	sets 1D Y Axis Title */
-	void SetHistYAxisTitle(QString title)   	{histYAxisTitle = title;}
-	/**	sets 2D X Axis Title */
-	void SetImageXAxisTitle(QString title)   {imageXAxisTitle = title;}
-	/**	sets 2D Y Axis Title */
-	void SetImageYAxisTitle(QString title)   {imageYAxisTitle = title;}
+	
+	void SetXAxisTitle(QString title) {
+		if(plot_in_scope==1) {
+			histXAxisTitle = title;
+		} else {
+			imageXAxisTitle = title;
+		}
+	}
+
+	void SetYAxisTitle(QString title) {
+		if(plot_in_scope==1) {
+			histYAxisTitle = title;
+		} else {
+			imageYAxisTitle = title;
+		}
+	}
 	/**	sets 2D Z Axis Title */
-	void SetImageZAxisTitle(QString title)   {imageZAxisTitle = title;}
+	void SetZAxisTitle(QString title)   {imageZAxisTitle = title;}
 	/** Disables zoom if any of the axes range are checked and fixed with a value */
 	void DisableZoom(bool disable);
 	/**	Enables plot from the plot tab*/
@@ -98,8 +107,6 @@ public:
 	 * @param xy is xmin,xmax,ymin or ymax */
 	void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;};
 
-	/** Get minimum Plot timer - between plots */
-	double GetMinimumPlotTimer(){return PLOT_TIMER_MS;};
 	/** Set Plot timer - between plots in ms*/
 	void SetPlotTimer(double time);
 	/** Set  Plot frame factor - between plots, also for receiver if exists */
@@ -500,9 +507,6 @@ double XYRangeValues[4];
 /**if the specific min/max of x/y is enabled */
 bool IsXYRange[4];
 
-/** Default timer between plots*/
-static const double PLOT_TIMER_MS;
-
 /** Specific timer value between plots */
 double timerValue;
 /** every nth frame when to plot */
diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h
index 91a29ec0a..0fef0feb1 100755
--- a/slsDetectorGui/include/qTabPlot.h
+++ b/slsDetectorGui/include/qTabPlot.h
@@ -24,36 +24,39 @@ public:
 
 public slots:
 	void SetFrequency();
-	 void EnableScanBox();
+	void EnableScanBox();
 
 private slots:
-	void Select1DPlot(bool b);
 
-	/**Enables Persistency depending on Superimpose checkbox */
+xxxxxxxxxxxxxxx
+	void Set1DPlotOptionsRight();
+	void Set1DPlotOptionsLeft();
+	void Set2DPlotOptionsRight();
+	void Set2DPlotOptionsLeft();
 	void EnablePersistency(bool enable);
-	void SetTitles();
-	void EnableTitles();
-	void checkAspectRatio();
-
-	/** maintain aspect ratio
-	 * @param axis axis to be changed: 0 for x(y axis values changed), 1 for y (xaxis values changes), -1 for the larger one (aspect ratio checked)
-	 */
-	void maintainAspectRatio(int axis);
-	void EnableXRange();
-	void EnableYRange();
-	void EnableRange();
-	void SetXAxisRange();
-	void SetYAxisRange();
-	void SetAxesRange();
-	void SetZRange();
-	void EnableZRange();
-	bool CheckZRange(QString value);
-	void SetPlot();
-	void SetPlotOptionsRightPage();
-	void SetPlotOptionsLeftPage();
 	void SetBinary();
-	void SetHistogramOptions();
-	void EnableGapPixels(bool enable);
+	void SetGapPixels(bool enable);
+	void SetTitles();
+	void SetXRange();
+	void SetYRange();
+	void CheckAspectRatio();
+	void SetXYRange();
+	/** 
+	 * Maintain aspect ratio 
+	 */
+	void MaintainAspectRatio(int dimension);
+	void SetZRange();
+
+
+
+
+	void Select1DPlot(bool b);
+	void SetPlot();
+
+
+
+
+
 
 signals:
 	void DisableZoomSignal(bool);
@@ -62,36 +65,30 @@ signals:
 private:
 	void SetupWidgetWindow();
 	void Initialization();
+	void GetGapPixels();
+	void EnableRange();
+	void SetAxesRange();
+	bool CheckZRange(QString value);
 
 	multiSlsDetector *myDet;
 	qDrawPlot *myPlot;
 	bool isOneD;
 	bool isOriginallyOneD;
 
-	/**is set if its a possible wrong interval between plots*/
-	bool wrongInterval;
-
+	QButtonGroup	*btnGroupPlotType;
+	/** interval between plots */
 	QStackedLayout	*stackedLayout;
 	QSpinBox 		*spinNthFrame;
 	QDoubleSpinBox 	*spinTimeGap;
 	QComboBox 		*comboTimeGapUnit;
-	QButtonGroup 	*btnGroupScan;
-	QButtonGroup	*btnGroupPlotType;
-	QButtonGroup	*btnGroupHistogram;
-	QPalette 		*red;
-	QString 		intervalTip;
 
-	/** some Default Values */
+	/** default plot and axis titles */
 	static QString defaultPlotTitle;
 	static QString defaultHistXAxisTitle;
 	static QString defaultHistYAxisTitle;
 	static QString defaultImageXAxisTitle;
 	static QString defaultImageYAxisTitle;
 	static QString defaultImageZAxisTitle;
-
-	/** scans */
-	static const QString modeNames[5];
-
 };
 
 
diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
index 805dac109..4714aec7f 100755
--- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
+++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
@@ -22,10 +22,8 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
 
 	z_range_ne = new SlsQtNumberEntry(this,1,(char*)"Set the z axis range from",2,(char*)"to",2);
 	z_range_ne->setFixedWidth(402);
-#ifndef IAN
 	zRangeChecked = false;
 	z_range_ne->hide();
-#endif
 
 	CreateTheButtons();
 	Layout();
@@ -43,69 +41,32 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
 
 
 void SlsQt2DPlotLayout::CreateTheButtons(){
-	/** Dhanya: All these buttons are already in another class, logz is used and a wrapper around it*/
-#ifdef IAN
-  btnInterpolate = new QToolButton(this);
-    btnInterpolate->setText("Interpolate");
-    btnInterpolate->setCheckable(true);
-    btnInterpolate->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-
-  btnContour = new QToolButton(this);
-    btnContour->setText("Contour");
-    btnContour->setCheckable(true);
-    btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-#endif
   btnLogz = new QToolButton(this);
     btnLogz->setText("Log Scale (Z)");
     btnLogz->setCheckable(true);
     btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-#ifndef IAN
     btnLogz->hide();
-#endif
 }
 
 
 void SlsQt2DPlotLayout::Layout(){
 	if(the_layout) delete the_layout;
 	the_layout =  new QGridLayout(this);
-#ifdef IAN
-    the_layout->addWidget(btnInterpolate,1,1);
-    the_layout->addWidget(btnContour,1,2);
-    the_layout->addWidget(btnLogz,1,3);
-	the_layout->addWidget(the_plot,2,1,3,3);
-	the_layout->addWidget(z_range_ne,5,1,1,3);
-	the_layout->setMargin(12);
-#else
 	the_layout->addWidget(the_plot,2,0,3,3);
 	the_layout->addWidget(z_range_ne,5,0,1,3);
-#endif
 }
 
 void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
-#ifndef IAN
 	connect(this,		SIGNAL(InterpolateSignal(bool)),			the_plot,	SLOT(InterpolatedPlot(bool)));
 	connect(this,		SIGNAL(ContourSignal(bool)),				the_plot,	SLOT(showContour(bool)));
-#else
-    connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool)));
-    connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool)));
-    connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool)));
-    btnInterpolate->setChecked(false);
-    btnContour->setChecked(false);
-#endif
 	connect(z_range_ne,	SIGNAL(CheckBoxChanged(bool)),				this,		SLOT(ResetRange()));
 	connect(z_range_ne,	SIGNAL(AValueChanged(SlsQtNumberEntry*)),	this,		SLOT(ResetRange()));
 	btnLogz->setChecked(false);
 }
 
 void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
-#ifdef IAN
-	if(z_range_ne->CheckBoxState()){
-#endif
 		//just reset histogram range before update
 		the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
-#ifdef IAN
-	}
-#endif
 	the_plot->Update();
 }
 
@@ -113,11 +74,7 @@ void SlsQt2DPlotLayout::ResetRange(){
 	//refind z limits
 	the_plot->SetZMinMax();
 	if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
-#ifdef IAN
-	if(z_range_ne->CheckBoxState()){
-#else
 	if(zRangeChecked){
-#endif
 		//first time check validity
 		bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
 		if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
@@ -175,49 +132,34 @@ void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double m
 
 
 void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
-#ifndef IAN
 #ifdef VERBOSE
 	cout<<"Setting ZScale to log:"<<yes<<endl;
 #endif
 	btnLogz->setChecked(yes);
-#endif
 	the_plot->LogZ(yes);
 	ResetRange();
 }
 
 
 void SlsQt2DPlotLayout::SetXTitle(QString st){
-#ifndef IAN
 	QwtText title(st);
 	title.setFont(QFont("Sans Serif",11,QFont::Normal));
 	GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
-#else
-	GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
-#endif
 }
 
 void SlsQt2DPlotLayout::SetYTitle(QString st){
-#ifndef IAN
 	QwtText title(st);
 	title.setFont(QFont("Sans Serif",11,QFont::Normal));
 	GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
-#else
-	GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
-#endif
 }
 
 void SlsQt2DPlotLayout::SetZTitle(QString st){
-#ifndef IAN
 	QwtText title(st);
 	title.setFont(QFont("Sans Serif",11,QFont::Normal));
 	GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
-#else
-	GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
-#endif
 }
 
 
-#ifndef IAN
 void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){
 #ifdef VERBOSE
 	cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl;
@@ -236,4 +178,3 @@ void SlsQt2DPlotLayout::EnableZRange(bool enable){
 	ResetRange();
 
 }
-#endif
diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp
index 5ba504819..e58e27b54 100755
--- a/slsDetectorGui/src/qDrawPlot.cpp
+++ b/slsDetectorGui/src/qDrawPlot.cpp
@@ -24,8 +24,6 @@
 
 //-------------------------------------------------------------------------------------------------------------------------------------------------
 
-const double qDrawPlot::PLOT_TIMER_MS = DEFAULT_STREAMING_TIMER_IN_MS;
-
 qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector), plot1D_hists(0) {
     SetupWidgetWindow();
     Initialization();
@@ -177,7 +175,7 @@ void qDrawPlot::SetupWidgetWindow() {
     IsXYRange[2] = false;
     IsXYRange[3] = false;
 
-    timerValue = PLOT_TIMER_MS;
+    timerValue = DEFAULT_STREAMING_TIMER_IN_MS;
     frameFactor = 0;
     isFrameEnabled = false;
     isTriggerEnabled = false;
diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp
index fd977d0b1..660aadfa2 100755
--- a/slsDetectorGui/src/qTabPlot.cpp
+++ b/slsDetectorGui/src/qTabPlot.cpp
@@ -11,8 +11,6 @@
 #include <math.h>
 #include <string>
 
-
-
 QString qTabPlot::defaultPlotTitle("");
 QString qTabPlot::defaultHistXAxisTitle("Channel Number");
 QString qTabPlot::defaultHistYAxisTitle("Counts");
@@ -21,76 +19,62 @@ QString qTabPlot::defaultImageYAxisTitle("Pixel");
 QString qTabPlot::defaultImageZAxisTitle("Intensity");
 
 
-qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) : QWidget(parent),
-                                                                                     myDet(detector),
-                                                                                     myPlot(plot),
-                                                                                     isOneD(false),
-                                                                                     isOriginallyOneD(false),
-                                                                                     wrongInterval(0),
-                                                                                     stackedLayout(0),
-                                                                                     spinNthFrame(0),
-                                                                                     spinTimeGap(0),
-                                                                                     comboTimeGapUnit(0),
-                                                                                     btnGroupScan(0),
-                                                                                     btnGroupPlotType(0),
-                                                                                     btnGroupHistogram(0) {
+qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) : 
+    QWidget(parent), myDet(detector), myPlot(plot), isOneD(false), isOriginallyOneD(false), wrongInterval(0), 
+    stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr),
+     btnGroupPlotType(0) {
     setupUi(this);
     SetupWidgetWindow();
-    Initialization();
     FILE_LOG(logDEBUG) << "Plot ready";
 }
 
-
-qTabPlot::~qTabPlot() {
-    delete myDet;
-    delete myPlot;
-}
+qTabPlot::~qTabPlot() {}
 
 void qTabPlot::SetupWidgetWindow() {
-    //error for interval between plots
-    red = new QPalette();
-    ;
-    red->setColor(QPalette::Active, QPalette::WindowText, Qt::red);
-    intervalTip = boxFrequency->toolTip();
-
-    //scan arguments
-    btnGroupScan = new QButtonGroup(this);
-    btnGroupScan->addButton(radioLevel0, 0);
-    btnGroupScan->addButton(radioLevel1, 1);
-    btnGroupScan->addButton(radioFileIndex, 2);
-    btnGroupScan->addButton(radioAllFrames, 3);
-
-    //plot type
+    // button group for plot type
     btnGroupPlotType = new QButtonGroup(this);
     btnGroupPlotType->addButton(radioNoPlot, 0);
     btnGroupPlotType->addButton(radioDataGraph, 1);
     btnGroupPlotType->addButton(radioHistogram, 2);
-
-    //histogram arguments
-    btnGroupHistogram = new QButtonGroup(this);
-    btnGroupHistogram->addButton(radioHistIntensity, 0);
-    btnGroupHistogram->addButton(radioHistLevel0, 1);
-    btnGroupHistogram->addButton(radioHistLevel1, 2);
-
+    // Plotting Frequency
+    stackedLayout = new QStackedLayout;
+    stackedLayout->setSpacing(0);
+    spinNthFrame = new QSpinBox;
+    spinNthFrame->setMinimum(1);
+    spinNthFrame->setMaximum(2000000000);
+    spinNthFrame->setValue(1);
+    spinTimeGap = new QDoubleSpinBox;
+    spinTimeGap->setMinimum(0);
+    spinTimeGap->setDecimals(3);
+    spinTimeGap->setMaximum(999999);
+    spinTimeGap->setValue(DEFAULT_STREAMING_TIMER_IN_MS);
+    comboTimeGapUnit = new QComboBox;
+    comboTimeGapUnit->addItem("hr");
+    comboTimeGapUnit->addItem("min");
+    comboTimeGapUnit->addItem("s");
+    comboTimeGapUnit->addItem("ms");
+    comboTimeGapUnit->setCurrentIndex(3);
+    QWidget *wTimeInterval = new QWidget;
+    QHBoxLayout *h1 = new QHBoxLayout;
+    wTimeInterval->setLayout(h1);
+    h1->setContentsMargins(0, 0, 0, 0);
+    h1->setSpacing(3);
+    h1->addWidget(spinTimeGap);
+    h1->addWidget(comboTimeGapUnit);
+    stackedLayout->addWidget(wTimeInterval);
+    stackedLayout->addWidget(spinNthFrame);
+    stackWidget->setLayout(stackedLayout);
+    // 1D and 2D options
+    stackedWidget1D->setCurrentIndex(0);
+    stackedWidget2D->setCurrentIndex(0);
     // Plot Axis
-    dispTitle->setEnabled(false);
-    dispXAxis->setEnabled(false);
-    dispYAxis->setEnabled(false);
-    dispZAxis->setEnabled(false);
-    dispXMin->setEnabled(false);
-    dispYMin->setEnabled(false);
-    dispZMin->setEnabled(false);
-    dispXMax->setEnabled(false);
-    dispYMax->setEnabled(false);
-    dispZMax->setEnabled(false);
     dispXMin->setValidator(new QDoubleValidator(dispXMin));
     dispYMin->setValidator(new QDoubleValidator(dispYMin));
     dispZMin->setValidator(new QDoubleValidator(dispZMin));
     dispXMax->setValidator(new QDoubleValidator(dispXMax));
     dispYMax->setValidator(new QDoubleValidator(dispYMax));
     dispZMax->setValidator(new QDoubleValidator(dispZMax));
-
-    //default titles
+    // Plot titles
     dispTitle->setText("");
     myPlot->SetPlotTitlePrefix("");
     dispXAxis->setText(defaultHistXAxisTitle);
@@ -104,165 +88,50 @@ void qTabPlot::SetupWidgetWindow() {
     myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
     myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
 
-    // Plotting Frequency
-
-    stackedLayout = new QStackedLayout;
-    stackedLayout->setSpacing(0);
-    spinNthFrame = new QSpinBox;
-    spinNthFrame->setMinimum(1);
-    spinNthFrame->setMaximum(2000000000);
-    spinTimeGap = new QDoubleSpinBox;
-    spinTimeGap->setMinimum(0);
-    spinTimeGap->setDecimals(3);
-    spinTimeGap->setMaximum(999999);
-    spinTimeGap->setValue(myPlot->GetMinimumPlotTimer());
-    comboTimeGapUnit = new QComboBox;
-    comboTimeGapUnit->addItem("hr");
-    comboTimeGapUnit->addItem("min");
-    comboTimeGapUnit->addItem("s");
-    comboTimeGapUnit->addItem("ms");
-    comboTimeGapUnit->setCurrentIndex(3);
-    QWidget *w = new QWidget;
-    QHBoxLayout *h1 = new QHBoxLayout;
-    w->setLayout(h1);
-    h1->setContentsMargins(0, 0, 0, 0);
-    h1->setSpacing(3);
-    h1->addWidget(spinTimeGap);
-    h1->addWidget(comboTimeGapUnit);
-
-    stackedLayout->addWidget(w);
-    stackedLayout->addWidget(spinNthFrame);
-    stackWidget->setLayout(stackedLayout);
-
-    stackedWidget->setCurrentIndex(0);
-    stackedWidget_2->setCurrentIndex(0);
-
-    // Depending on whether the detector is 1d or 2d
-    switch (myDet->getDetectorTypeAsEnum()) {
+	// enabling according to det type
+	switch(myDet->getDetectorTypeAsEnum()) {
+    case slsDetectorDefs::GOTTHARD:
+        isOriginallyOneD = true;
+        break;
     case slsDetectorDefs::EIGER:
         isOriginallyOneD = false;
         pagePedestal->setEnabled(false);
         pagePedestal_2->setEnabled(false);
-        chkBinary->setEnabled(false);
-        chkBinary_2->setEnabled(false);
         chkGapPixels->setEnabled(true);
         break;
-    case slsDetectorDefs::GOTTHARD:
-        isOriginallyOneD = true;
-        break;
     case slsDetectorDefs::JUNGFRAU:
     case slsDetectorDefs::MOENCH:
         isOriginallyOneD = false;
         chkGainPlot->setEnabled(true);
         break;
     default:
-        cout << "ERROR: Detector Type is Generic" << endl;
-        exit(-1);
+        break;
     }
 
     Select1DPlot(isOriginallyOneD);
 
-    //to check if this should be enabled
-    // EnableScanBox();
+    Initialization();
 
-    //disable histogram initially
-    boxHistogram->hide();
-
-    if (chkGapPixels->isEnabled()) {
-        int ret = myDet->enableGapPixels(-1);
-        qDefs::checkErrorMessage(myDet, "qTabPlot::SetupWidgetWindow");
-        chkGapPixels->setChecked((ret == 1) ? true : false);
-    }
-
-    qDefs::checkErrorMessage(myDet, "qTabPlot::SetupWidgetWindow");
-}
-
-
-void qTabPlot::SetPlotOptionsRightPage() {
-    if (isOneD) {
-        int i = stackedWidget->currentIndex();
-        if (i == (stackedWidget->count() - 1))
-            stackedWidget->setCurrentIndex(0);
-        else
-            stackedWidget->setCurrentIndex(i + 1);
-        box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
-    } else {
-        int i = stackedWidget_2->currentIndex();
-        if (i == (stackedWidget_2->count() - 1))
-            stackedWidget_2->setCurrentIndex(0);
-        else
-            stackedWidget_2->setCurrentIndex(i + 1);
-        box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
-    }
-}
-
-void qTabPlot::SetPlotOptionsLeftPage() {
-    if (isOneD) {
-        int i = stackedWidget->currentIndex();
-        if (i == 0)
-            stackedWidget->setCurrentIndex(stackedWidget->count() - 1);
-        else
-            stackedWidget->setCurrentIndex(i - 1);
-        box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
-    } else {
-        int i = stackedWidget_2->currentIndex();
-        if (i == 0)
-            stackedWidget_2->setCurrentIndex(stackedWidget_2->count() - 1);
-        else
-            stackedWidget_2->setCurrentIndex(i - 1);
-        box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
-    }
-}
-
-void qTabPlot::Select1DPlot(bool b) {
-#ifdef VERBOSE
-    if (b)
-        cout << "Selecting 1D Plot" << endl;
-    else
-        cout << "Selecting 2D Plot" << endl;
-#endif
-    isOneD = b;
-    lblFrom->setEnabled(false);
-    lblTo->setEnabled(false);
-    lblFrom_2->setEnabled(false);
-    lblTo_2->setEnabled(false);
-    spinFrom->setEnabled(false);
-    spinFrom_2->setEnabled(false);
-    spinTo->setEnabled(false);
-    spinTo_2->setEnabled(false);
-    if (b) {
-        box1D->show();
-        box2D->hide();
-        chkZAxis->setEnabled(false);
-        chkZMin->setEnabled(false);
-        chkZMax->setEnabled(false);
-        myPlot->Select1DPlot();
-    } else {
-        box1D->hide();
-        box2D->show();
-        chkZAxis->setEnabled(true);
-        chkZMin->setEnabled(true);
-        chkZMax->setEnabled(true);
-        myPlot->Select2DPlot();
-    }
+    Refresh();
 }
 
 void qTabPlot::Initialization() {
     // Plot arguments box
     connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
-    // Histogram arguments box
-    connect(btnGroupHistogram, SIGNAL(buttonClicked(int)), this, SLOT(SetHistogramOptions()));
-    // Scan box
-    // connect(boxScan,	  SIGNAL(toggled(bool)),  this, SLOT(EnableScanBox()));
-    // Snapshot box
-    connect(btnClone, SIGNAL(clicked()), myPlot, SLOT(ClonePlot()));
-    connect(btnCloseClones, SIGNAL(clicked()), myPlot, SLOT(CloseClones()));
-    connect(btnSaveClones, SIGNAL(clicked()), myPlot, SLOT(SaveClones()));
-    // 1D Plot box
-    //to change pages
-    connect(btnRight, SIGNAL(clicked()), this, SLOT(SetPlotOptionsRightPage()));
-    connect(btnLeft, SIGNAL(clicked()), this, SLOT(SetPlotOptionsLeftPage()));
 
+    // Plotting frequency box
+    connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
+    connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
+    connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
+    connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
+
+    // navigation buttons for options
+    connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
+    connect(btnLeft1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsLeft()));
+    connect(btnRight2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsRight()));
+    connect(btnLeft2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsLeft()));
+    
+    // 1D options
     connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
     connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
     connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
@@ -275,52 +144,16 @@ void qTabPlot::Initialization() {
     connect(chkContour, SIGNAL(toggled(bool)), myPlot, SIGNAL(ContourSignal(bool)));
     connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogzSignal(bool)));
     connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
-    // Plotting frequency box
-    connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-    connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-    connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
-    connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
-    // Plot Axis *
-    connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
-    connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
-    connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
-    connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
-    connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
-    connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
-    connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
-    connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
-
-    connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
-    connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
-    connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(checkAspectRatio()));
-    connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
-
-    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
-    connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
-    // Save
-    connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
-    connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
-
     //pedstal
     connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
     connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
     connect(chkPedestal_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
     connect(btnRecalPedestal_2, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
-
     //accumulate
     connect(chkAccumulate, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool)));
     connect(btnResetAccumulate, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate()));
     connect(chkAccumulate_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool)));
     connect(btnResetAccumulate_2, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate()));
-
     //binary
     connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
     connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
@@ -328,223 +161,387 @@ void qTabPlot::Initialization() {
     connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
     connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
     connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
-
     //gainplot
     if (chkGainPlot->isEnabled())
         connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SIGNAL(GainPlotSignal(bool)));
-
     // gap pixels
     if (chkGapPixels->isEnabled())
-        connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(EnableGapPixels(bool)));
+        connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
+
+    // Save
+    connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
+    connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
+
+    // Snapshot box
+    connect(btnClone, SIGNAL(clicked()), myPlot, SLOT(ClonePlot()));
+    connect(btnCloseClones, SIGNAL(clicked()), myPlot, SLOT(CloseClones()));
+    connect(btnSaveClones, SIGNAL(clicked()), myPlot, SLOT(SaveClones()));
+
+    // Plot Axis
+    connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+
+    connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(CheckAspectRatio()));
+
+    connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
+    connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
+    connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
+    connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
+    connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
+}
+
+xxxxxxxxxxxxxxx
+
+void qTabPlot::Set1DPlotOptionsRight() {
+    FILE_LOG(logDEBUG) << "1D Options Right";
+    int i = stackedWidget->currentIndex();
+    if (i == (stackedWidget->count() - 1))
+        stackedWidget->setCurrentIndex(0);
+    else
+        stackedWidget->setCurrentIndex(i + 1);
+    box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
+}
+
+void qTabPlot::Set1DPlotOptionsLeft() {
+    FILE_LOG(logDEBUG) << "1D Options Left";
+    int i = stackedWidget->currentIndex();
+    if (i == 0)
+        stackedWidget->setCurrentIndex(stackedWidget->count() - 1);
+    else
+        stackedWidget->setCurrentIndex(i - 1);
+    box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
+}
+
+void qTabPlot::Set2DPlotOptionsRight() {
+    FILE_LOG(logDEBUG) << "2D Options Right";
+    int i = stackedWidget_2->currentIndex();
+    if (i == (stackedWidget_2->count() - 1))
+        stackedWidget_2->setCurrentIndex(0);
+    else
+        stackedWidget_2->setCurrentIndex(i + 1);
+    box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
+}
+
+void qTabPlot::Set2DPlotOptionsLeft() {
+    FILE_LOG(logDEBUG) << "2D Options Left";
+    int i = stackedWidget_2->currentIndex();
+    if (i == 0)
+        stackedWidget_2->setCurrentIndex(stackedWidget_2->count() - 1);
+    else
+        stackedWidget_2->setCurrentIndex(i - 1);
+    box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
 }
 
 void qTabPlot::EnablePersistency(bool enable) {
-#ifdef VERBOSE
-    if (enable)
-        cout << "Enabling Persistency" << endl;
-    else
-        cout << "Disabling Persistency" << endl;
-#endif
-    lblPersistency->setEnabled(enable);
-    spinPersistency->setEnabled(enable);
+    FILE_LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled");
+    lblPersistency->setEnabled(val);
+    spinPersistency->setEnabled(val);
     if (enable)
         myPlot->SetPersistency(spinPersistency->value());
     else
         myPlot->SetPersistency(0);
 }
 
+void qTabPlot::SetBinary() {
+    bool binary1D = chkBinary->isChecked();
+    bool binary2D = chkBinary_2->isChecked(); 
+    if (isOneD) {
+        FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
+        lblFrom->setEnabled(binary1D);
+        lblTo->setEnabled(binary1D);
+        spinFrom->setEnabled(binary1D);
+        spinTo->setEnabled(binary1D);
+        myPlot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
+    } else {
+        FILE_LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
+        lblFrom_2->setEnabled(binary2D);
+        lblTo_2->setEnabled(binary2D);
+        spinFrom_2->setEnabled(binary2D);
+        spinTo_2->setEnabled(binary2D);
+        myPlot->SetBinary(binary2D, spinFrom_2->value(), spinTo_2->value());
+    }
+}
+
+void qTabPlot::GetGapPixels() {
+    FILE_LOG(logDEBUG) << "Getting gap pixels";
+    disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
+
+	try {
+        auto retval = myDet->enableGapPixels(-1);
+		if (retval == -1) {
+			qDefs::Message(qDefs::WARNING, "Gap pixels enable is inconsistent for all detectors.", "qTabPlot::GetGapPixels");
+		} else {
+			chkGapPixels->setChecked(retval == 0 ? false : true);
+		}
+    } catch (const sls::NonCriticalError &e) {
+        qDefs::ExceptionMessage("Could not get gap pixels enable.", e.what(), "qTabPlot::GetGapPixels");
+    }
+
+    connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
+}
+
+void qTabPlot::SetGapPixels(bool enable) {
+	FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
+
+	try {
+        myDet->enableGapPixels(enable);
+    } catch (const sls::NonCriticalError &e) {
+        qDefs::ExceptionMessage("Could not set gap pixels enable.", e.what(), "qTabPlot::SetGapPixels");
+        GetGapPixels();
+    }
+}
+
 void qTabPlot::SetTitles() {
-#ifdef VERBOSE
-    cout << "Setting Plot Titles" << endl;
-#endif
-    // Plot Title
-    if (dispTitle->isEnabled())
-        myPlot->SetPlotTitlePrefix(dispTitle->text());
-    // X Axis
-    if (dispXAxis->isEnabled()) {
-        if (isOneD)
-            myPlot->SetHistXAxisTitle(dispXAxis->text());
-        else
-            myPlot->SetImageXAxisTitle(dispXAxis->text());
-    }
-    // Y Axis
-    if (dispYAxis->isEnabled()) {
-        if (isOneD)
-            myPlot->SetHistYAxisTitle(dispYAxis->text());
-        else
-            myPlot->SetImageYAxisTitle(dispYAxis->text());
-    }
-    // Z Axis
-    if (dispZAxis->isEnabled())
-        myPlot->SetImageZAxisTitle(dispZAxis->text());
-}
+    FILE_LOG(logDEBUG) << "Setting Plot Titles";
+    disconnect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    disconnect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
 
-void qTabPlot::EnableTitles() {
-    // Plot Title
-    dispTitle->setEnabled(chkTitle->isChecked());
-    if (!chkTitle->isChecked()) {
+    // title
+    if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
         myPlot->SetPlotTitlePrefix("");
-        dispTitle->setText("");
+        dispTitle->setText("");   
+    } else {
+        myPlot->SetPlotTitlePrefix(dispTitle->text());
     }
-    // X Axis
-    dispXAxis->setEnabled(chkXAxis->isChecked());
-    if (!chkXAxis->isChecked()) {
-        if (isOneD) {
-            myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
-            dispXAxis->setText(defaultHistXAxisTitle);
-        } else {
-            myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
-            dispXAxis->setText(defaultImageXAxisTitle);
-        }
-    }
-    // Y Axis
-    dispYAxis->setEnabled(chkYAxis->isChecked());
-    if (!chkYAxis->isChecked()) {
-        if (isOneD) {
-            myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
-            dispYAxis->setText(defaultHistYAxisTitle);
-        } else {
-            myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
-            dispYAxis->setText(defaultImageYAxisTitle);
-        }
-    }
-    // Z Axis
-    dispZAxis->setEnabled(chkZAxis->isChecked());
-    if (!chkZAxis->isChecked()) {
-        myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
+    // x
+    if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
+        dispXAxis->setText(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
+        myPlot->SetXAxisTitle(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
+    } else {
+        myPlot->SetXAxisTitle(dispXAxis->text());
+    } 
+    // y
+    if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
+        dispYAxis->setText(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
+        myPlot->SetYAxisTitle(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
+    } else {
+        myPlot->SetYAxisTitle(dispYAxis->text());
+    }  
+    // z
+    if (!chkZAxis->isChecked() || dispZAxis->text().isEmpty()) {
+        myPlot->SetZAxisTitle(defaultImageZAxisTitle);
         dispZAxis->setText(defaultImageZAxisTitle);
+    } else {
+        myPlot->SetZAxisTitle(dispZAxis->text());
     }
+
+    connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
+    connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
+    connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
 }
 
-void qTabPlot::checkAspectRatio() {
+void qTabPlot::SetXRange() {
+    FILE_LOG(logDEBUG) << "Enable X axis range";
+
     if (chkAspectRatio->isChecked()) {
-        maintainAspectRatio(-1);
+        MaintainAspectRatio(static_cast<int>(slsDetectorDefs::Y));
+    } else {
+        SetXYRange();
     }
 }
 
+void qTabPlot::SetYRange() {
+    FILE_LOG(logDEBUG) << "Enable Y axis range";
 
-void qTabPlot::maintainAspectRatio(int axis) {
-#ifdef VERBOSE
-    cout << "Maintaining Aspect Ratio" << endl;
-#endif
-    disconnect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
+    if (chkAspectRatio->isChecked()) {
+        MaintainAspectRatio(static_cast<int>(slsDetectorDefs::X));
+    } else {
+        SetXYRange();
+    }
+}
 
+void qTabPlot::CheckAspectRatio() {
+    if (chkAspectRatio->isChecked()) {
+        MaintainAspectRatio(-1);
+    } else {
+        SetXYRange();
+    }
+}
+
+void qTabPlot::SetXYRange() {
+    FILE_LOG(LOGDEBUG) << "Set XY Range";
+    disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+
+    bool disablezoom = false;
+
+    // xmin
+    // if unchecked, empty or invalid (set to false so it takes the min/max of plot)
+    if (!chkXMin->isChecked() || dispXMin->text().isEmpty()) {
+        myPlot->IsXYRangeValues(false, qDefs::XMINIMUM);
+    } else if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) {
+        qDefs::Message(qDefs::WARNING, "XMin Outside Plot Range", "qTabPlot::SetXRange");
+        dispXMin->setText("");
+        myPlot->IsXYRangeValues(false, qDefs::XMINIMUM);
+    } else {
+        myPlot->SetXYRangeValues(dispXMin->text().toDouble(), qDefs::XMINIMUM);
+        myPlot->IsXYRangeValues(true, qDefs::XMINIMUM);
+        disablezoom = true;
+    } 
+
+    //xmax
+    if (!chkXMax->isChecked() || dispXMax->text().isEmpty()) {
+        myPlot->IsXYRangeValues(false, qDefs::XMAXIMUM);
+    } else if (dispXMax->text().toDouble() < myPlot->GetXMaximum()) {
+        qDefs::Message(qDefs::WARNING, "XMax Outside Plot Range", "qTabPlot::SetXYRange");
+        dispXMax->setText("");
+        myPlot->IsXYRangeValues(false, qDefs::XMAXIMUM);
+    } else {
+        myPlot->SetXYRangeValues(dispXMax->text().toDouble(), qDefs::XMAXIMUM);
+        myPlot->IsXYRangeValues(true, qDefs::XMAXIMUM);
+        disablezoom = true;
+    } 
+    
+    // ymin
+    if (!chkYMin->isChecked() || dispYMin->text().isEmpty()) {
+        myPlot->IsXYRangeValues(false, qDefs::YMINIMUM);
+    } else if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) {
+        qDefs::Message(qDefs::WARNING, "YMin Outside Plot Range", "qTabPlot::SetXYRange");
+        dispYMin->setText("");
+        myPlot->IsXYRangeValues(false, qDefs::YMINIMUM);
+    } else {
+        myPlot->SetXYRangeValues(dispYMin->text().toDouble(), qDefs::YMINIMUM);
+        myPlot->IsXYRangeValues(true, qDefs::YMINIMUM);
+        disablezoom = true;
+    } 
+
+    //ymax
+    if (!chkYMax->isChecked() || dispYMax->text().isEmpty()) {
+        myPlot->IsXYRangeValues(false, qDefs::YMAXIMUM);
+    } else if (dispYMax->text().toDouble() < myPlot->GetYMaximum()) {
+        qDefs::Message(qDefs::WARNING, "YMax Outside Plot Range", "qTabPlot::SetXYRange");
+        dispYMax->setText("");
+        myPlot->IsXYRangeValues(false, qDefs::YMAXIMUM);
+    } else {
+        myPlot->SetXYRangeValues(dispYMax->text().toDouble(), qDefs::YMAXIMUM);
+        myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
+        disablezoom = true;
+    } 
+
+    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+
+    // to update plot with range
+    myPlot->SetXYRange(true);
+    myPlot->DisableZoom(disablezoom);
+    emit DisableZoomSignal(disablezoom);
+}
+
+void qTabPlot::MaintainAspectRatio(int dimension) {
+    FILE_LOG(logDEBUG) << "Maintaining Aspect Ratio";
+
+    disconnect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+
+    // check all, fill all
+    chkXMin->setChecked(true);
+    chkXMax->setChecked(true);
+    chkYMin->setChecked(true);
+    chkYMax->setChecked(true);
+	if (dispXMin->text().isEmpty()) 
+        dispXMin->setText(QString::number(myPlot->GetXMinimum()));
+	if (dispXMax->text().isEmpty()) 
+        dispXMax->setText(QString::number(myPlot->GetXMaximum()));
+	if (dispYMin->text().isEmpty()) 
+        dispYMin->setText(QString::number(myPlot->GetYMinimum()));
+	if (dispYMax->text().isEmpty()) 
+        dispYMax->setText(QString::number(myPlot->GetYMaximum()));
+
+    // calculate ideal aspect ratio with previous limits
     double ranges[4];
-    //get previous plot limits
     ranges[qDefs::XMINIMUM] = myPlot->GetXMinimum();
     ranges[qDefs::XMAXIMUM] = myPlot->GetXMaximum();
     ranges[qDefs::YMINIMUM] = myPlot->GetYMinimum();
     ranges[qDefs::YMAXIMUM] = myPlot->GetYMaximum();
-#ifdef VERYVERBOSE
-    cprintf(BLUE, "ideal values: xmin:%f, xmax:%f ymin:%f ymax:%f\n", ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
-#endif
     double idealAspectratio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
-
-    // enable all
-    chkXMin->setChecked(true);
-    dispXMin->setEnabled(true);
-    chkXMax->setChecked(true);
-    dispXMax->setEnabled(true);
-    chkYMin->setChecked(true);
-    dispYMin->setEnabled(true);
-    chkYMax->setChecked(true);
-    dispYMax->setEnabled(true);
-
-    // if any empty, set it to previous plots boundaries
-    if (dispXMin->text().isEmpty())
-        dispXMin->setText(QString::number(myPlot->GetXMinimum()));
-    if (dispXMax->text().isEmpty())
-        dispXMax->setText(QString::number(myPlot->GetXMaximum()));
-    if (dispYMin->text().isEmpty())
-        dispYMin->setText(QString::number(myPlot->GetYMinimum()));
-    if (dispYMax->text().isEmpty())
-        dispYMax->setText(QString::number(myPlot->GetYMaximum()));
-
-    //get actual limits
+    FILE_LOG(logDEBUG) << "Ideal Aspect ratio: %f for x(%f - %f), y(%f - %f)\n", idealAspectratio, ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
+  
+    // calculate current aspect ratio
     ranges[qDefs::XMINIMUM] = dispXMin->text().toDouble();
     ranges[qDefs::XMAXIMUM] = dispXMax->text().toDouble();
     ranges[qDefs::YMINIMUM] = dispYMin->text().toDouble();
     ranges[qDefs::YMAXIMUM] = dispYMax->text().toDouble();
-#ifdef VERYVERBOSE
-    cprintf(BLUE, "new limits: xmin:%f, xmax:%f ymin:%f ymax:%f\n", ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
-#endif
-    // calcualte new aspect ratio
-    double newAspectRatio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
+    double currentAspectRatio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
+    FILE_LOG(logDEBUG) << "Current Aspect ratio: %f for x(%f - %f), y(%f - %f)\n", currentAspectRatio, ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
 
-    // if not ideal aspect ratio
     if (newAspectRatio != idealAspectratio) {
-
-        // find the larger difference
-        if (axis == -1) {
-            if ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) > (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM])) {
-                //change x
-                axis = 0;
-            } else {
-                //change y
-                axis = 1;
-            }
+        // dimension: 1(x changed: y adjusted), 0(y changed: x adjusted), -1(aspect ratio clicked: larger one adjusted)
+        if (dimension == -1) {
+            dimension = ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) > (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM])) 
+            ? static_cast<int>(slsDetectorDefs::X) : static_cast<int>(slsDetectorDefs::Y);
         }
 
-        // if x changed: y adjusted, y changed: x adjusted, aspect ratio clicked: larger one adjusted
+        // calculate new value to maintain aspect ratio
+        // adjust x
         double newval = 0;
-        switch (axis) {
-        case 0:
-            //change x
+        if (dimension == static_cast<int>(slsDetectorDefs::X)) {
             newval = idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]) + ranges[qDefs::XMINIMUM];
             if (newval <= myPlot->GetXMaximum()) {
                 dispXMax->setText(QString::number(newval));
-#ifdef VERYVERBOSE
-                cprintf(BLUE, "new xmax: %f\n", newval);
-#endif
+                FILE_LOG(logDEBUG) << "New XMax: " << newval;
             } else {
                 newval = ranges[qDefs::XMAXIMUM] - (idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]));
                 dispXMin->setText(QString::number(newval));
-#ifdef VERYVERBOSE
-                cprintf(BLUE, "new xmin: %f\n", newval);
-#endif
+                FILE_LOG(logDEBUG) << "New XMin: " << newval;
             }
-
-            break;
-        case 1:
-            // change y
+        }
+        // adjust y
+        else  {
             newval = ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio) + ranges[qDefs::YMINIMUM];
             if (newval <= myPlot->GetYMaximum()) {
                 dispYMax->setText(QString::number(newval));
-                //#ifdef VERYVERBOSE
-                cprintf(BLUE, "new ymax: %f\n", newval);
-                //#endif
+                FILE_LOG(logDEBUG) << "New YMax: " << newval;
             } else {
                 newval = ranges[qDefs::YMAXIMUM] - ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio);
                 dispYMin->setText(QString::number(newval));
-#ifdef VERYVERBOSE
-                cprintf(BLUE, "new ymin: %f\n", newval);
-#endif
+                FILE_LOG(logDEBUG) << "New YMax: " << newval;
             }
-            break;
-        default:
-            break;
         }
     }
 
-    connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
-    connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
-    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-
-    // disable mouse zooming if any checked
-    myPlot->DisableZoom(true);
-    emit DisableZoomSignal(true);
+    connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
+    connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
+    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
+    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
+    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
 
     // set XY values in plot
     myPlot->SetXYRangeValues(dispXMin->text().toDouble(), qDefs::XMINIMUM);
@@ -557,188 +554,10 @@ void qTabPlot::maintainAspectRatio(int axis) {
     myPlot->IsXYRangeValues(true, qDefs::YMINIMUM);
     myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
 
-    //  To remind the updateplot in qdrawplot to set range after updating plot
-    myPlot->SetXYRange(true);
-}
-
-void qTabPlot::EnableXRange() {
-#ifdef VERBOSE
-    cout << "Enable X Axis Range" << endl;
-#endif
-    // keeping aspect ratio
-    if (chkAspectRatio->isChecked()) {
-        maintainAspectRatio(1);
-        return;
-    }
-    disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-
-    // enable/disable lineedit
-    if (chkXMin->isChecked()) {
-        dispXMin->setEnabled(true);
-        // if any empty, set it to previous plots boundaries
-        if (dispXMin->text().isEmpty())
-            dispXMin->setText(QString::number(myPlot->GetXMinimum()));
-    } else {
-        dispXMin->setEnabled(false);
-    }
-    // enable/disable lineedit
-    if (chkXMax->isChecked()) {
-        dispXMax->setEnabled(true);
-        // if any empty, set it to previous plots boundaries
-        if (dispXMax->text().isEmpty())
-            dispXMax->setText(QString::number(myPlot->GetXMaximum()));
-    } else {
-        dispXMax->setEnabled(false);
-    }
-
-    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-
-    EnableRange();
-}
-
-void qTabPlot::EnableYRange() {
-#ifdef VERBOSE
-    cout << "Enable Y Axis Range" << endl;
-#endif
-    // keeping aspect ratio
-    if (chkAspectRatio->isChecked()) {
-        maintainAspectRatio(0);
-        return;
-    }
-    disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-
-    // enable/disable lineedit
-    if (chkYMin->isChecked()) {
-        dispYMin->setEnabled(true);
-        // if any empty, set it to previous plots boundaries
-        if (dispYMin->text().isEmpty())
-            dispYMin->setText(QString::number(myPlot->GetYMinimum()));
-    } else {
-        dispYMin->setEnabled(false);
-    }
-    // enable/disable lineedit
-    if (chkYMax->isChecked()) {
-        dispYMax->setEnabled(true);
-        // if any empty, set it to previous plots boundaries
-        if (dispYMax->text().isEmpty())
-            dispYMax->setText(QString::number(myPlot->GetYMaximum()));
-    } else {
-        dispYMax->setEnabled(false);
-    }
-
-    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-
-    EnableRange();
-}
-
-void qTabPlot::EnableRange() {
-#ifdef VERBOSE
-    cout << "Enable Axes Range" << endl;
-#endif
-    // disable mouse zooming if any checked
-    bool disableZoom = false;
-    if (chkYMin->isChecked() || chkYMax->isChecked() || chkYMin->isChecked() || chkYMax->isChecked())
-        disableZoom = true;
-    emit DisableZoomSignal(disableZoom);
-    SetAxesRange();
-}
-
-void qTabPlot::SetXAxisRange() {
-#ifdef VERBOSE
-    cout << "Setting X Axis Range" << endl;
-#endif
-
-    disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-
-    if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) {
-        qDefs::Message(qDefs::WARNING, "Outside Plot Range", "qTabPlot::CheckZRange");
-        dispXMin->setText(QString::number(myPlot->GetXMinimum()));
-    }
-
-    if (dispXMax->text().toDouble() > myPlot->GetXMaximum()) {
-        qDefs::Message(qDefs::WARNING, "Outside Plot Range", "qTabPlot::CheckZRange");
-        dispXMax->setText(QString::number(myPlot->GetXMaximum()));
-    }
-
-    connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-    connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
-
-    // keeping aspect ratio
-    if (chkAspectRatio->isChecked()) {
-        maintainAspectRatio(1);
-        return;
-    }
-
-    SetAxesRange();
-}
-
-void qTabPlot::SetYAxisRange() {
-#ifdef VERBOSE
-    cout << "Setting Y Axis Range" << endl;
-#endif
-
-    disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-
-    if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) {
-        qDefs::Message(qDefs::WARNING, "Outside Plot Range", "qTabPlot::CheckZRange");
-        dispYMin->setText(QString::number(myPlot->GetYMinimum()));
-    }
-
-    if (dispYMax->text().toDouble() > myPlot->GetYMaximum()) {
-        qDefs::Message(qDefs::WARNING, "Outside Plot Range", "qTabPlot::CheckZRange");
-        dispYMax->setText(QString::number(myPlot->GetYMaximum()));
-    }
-
-    connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-    connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
-
-    // keeping aspect ratio
-    if (chkAspectRatio->isChecked()) {
-        maintainAspectRatio(0);
-        return;
-    }
-
-    SetAxesRange();
-}
-
-void qTabPlot::SetAxesRange() {
-#ifdef VERBOSE
-    cout << "Setting Axes Range" << endl;
-#endif
-
-    // x min
-    if (dispXMin->isEnabled()) {
-        myPlot->SetXYRangeValues(dispXMin->text().toDouble(), qDefs::XMINIMUM);
-        myPlot->IsXYRangeValues(true, qDefs::XMINIMUM);
-    } else
-        myPlot->IsXYRangeValues(false, qDefs::XMINIMUM);
-    // x max
-    if (dispXMax->isEnabled()) {
-        myPlot->SetXYRangeValues(dispXMax->text().toDouble(), qDefs::XMAXIMUM);
-        myPlot->IsXYRangeValues(true, qDefs::XMAXIMUM);
-    } else
-        myPlot->IsXYRangeValues(false, qDefs::XMAXIMUM);
-    // y min
-    if (dispYMin->isEnabled()) {
-        myPlot->SetXYRangeValues(dispYMin->text().toDouble(), qDefs::YMINIMUM);
-        myPlot->IsXYRangeValues(true, qDefs::YMINIMUM);
-    } else
-        myPlot->IsXYRangeValues(false, qDefs::YMINIMUM);
-    // y max
-    if (dispYMax->isEnabled()) {
-        myPlot->SetXYRangeValues(dispYMax->text().toDouble(), qDefs::YMAXIMUM);
-        myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
-    } else
-        myPlot->IsXYRangeValues(false, qDefs::YMAXIMUM);
-
-    //  To remind the updateplot in qdrawplot to set range after updating plot
+    // to update plot with range
     myPlot->SetXYRange(true);
+    myPlot->DisableZoom(true);
+    emit DisableZoomSignal(true);
 }
 
 
@@ -786,6 +605,131 @@ bool qTabPlot::CheckZRange(QString value) {
 }
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void qTabPlot::Select1DPlot(bool b) {
+#ifdef VERBOSE
+    if (b)
+        cout << "Selecting 1D Plot" << endl;
+    else
+        cout << "Selecting 2D Plot" << endl;
+#endif
+    isOneD = b;
+    lblFrom->setEnabled(false);
+    lblTo->setEnabled(false);
+    lblFrom_2->setEnabled(false);
+    lblTo_2->setEnabled(false);
+    spinFrom->setEnabled(false);
+    spinFrom_2->setEnabled(false);
+    spinTo->setEnabled(false);
+    spinTo_2->setEnabled(false);
+    if (b) {
+        box1D->show();
+        box2D->hide();
+        chkZAxis->setEnabled(false);
+        chkZMin->setEnabled(false);
+        chkZMax->setEnabled(false);
+        myPlot->Select1DPlot();
+    } else {
+        box1D->hide();
+        box2D->show();
+        chkZAxis->setEnabled(true);
+        chkZMin->setEnabled(true);
+        chkZMax->setEnabled(true);
+        myPlot->Select2DPlot();
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 void qTabPlot::SetPlot() {
 #ifdef VERBOSE
     cout << "Entering Set Plot()";
@@ -1293,58 +1237,7 @@ void qTabPlot::SetFrequency() {
  }
 
 
-void qTabPlot::SetBinary() {
-    //1d
-    if (isOneD) {
-        if (chkBinary->isChecked()) {
-#ifdef VERBOSE
-            cout << endl
-                 << "Enabling Binary" << endl;
-#endif
-            lblFrom->setEnabled(true);
-            lblTo->setEnabled(true);
-            spinFrom->setEnabled(true);
-            spinTo->setEnabled(true);
-            myPlot->SetBinary(true, spinFrom->value(), spinTo->value());
-        } else {
-#ifdef VERBOSE
-            cout << endl
-                 << "Disabling Binary" << endl;
-#endif
-            lblFrom->setEnabled(false);
-            lblTo->setEnabled(false);
-            spinFrom->setEnabled(false);
-            spinTo->setEnabled(false);
-            myPlot->SetBinary(false);
-        }
-    }
-    //2d
-    else {
-        if (chkBinary_2->isChecked()) {
-#ifdef VERBOSE
-            cout << endl
-                 << "Enabling Binary" << endl;
-#endif
-            lblFrom_2->setEnabled(true);
-            lblTo_2->setEnabled(true);
-            spinFrom_2->setEnabled(true);
-            spinTo_2->setEnabled(true);
-            myPlot->SetBinary(true, spinFrom_2->value(), spinTo_2->value());
 
-        } else {
-#ifdef VERBOSE
-            cout << endl
-                 << "Disabling Binary" << endl;
-#endif
-
-            lblFrom_2->setEnabled(false);
-            lblTo_2->setEnabled(false);
-            spinFrom_2->setEnabled(false);
-            spinTo_2->setEnabled(false);
-            myPlot->SetBinary(false);
-        }
-    }
-}
 
 
 void qTabPlot::SetHistogramOptions() {
@@ -1358,22 +1251,11 @@ void qTabPlot::SetHistogramOptions() {
 }
 
 
-void qTabPlot::EnableGapPixels(bool enable) {
-#ifdef VERBOSE
-    cout << "Setting Gap pixels to " << enable << endl;
-#endif
-    disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(EnableGapPixels(bool)));
-
-    myDet->enableGapPixels(enable);
-    int ret = myDet->enableGapPixels(-1);
-    qDefs::checkErrorMessage(myDet, "qTabPlot::SetScanArgument");
-    chkGapPixels->setChecked((ret == 1) ? true : false);
-
-    connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(EnableGapPixels(bool)));
-}
-
 
 void qTabPlot::Refresh() {
+
+
+
 #ifdef VERBOSE
     cout << endl
          << "**Updating Plot Tab" << endl;
@@ -1382,13 +1264,9 @@ void qTabPlot::Refresh() {
         if (!radioNoPlot->isChecked())
             boxFrequency->setEnabled(true);
         SetFrequency();
-
+        
         if (chkGapPixels->isEnabled()) {
-            disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(EnableGapPixels(bool)));
-            int ret = myDet->enableGapPixels(-1);
-            qDefs::checkErrorMessage(myDet, "qTabPlot::Refresh");
-            chkGapPixels->setChecked((ret == 1) ? true : false);
-            connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(EnableGapPixels(bool)));
+            GetGapPixels();
         }
 
     } else {