From 11351324dbdfcaf59b2d0e62f0465f5e1210a98d Mon Sep 17 00:00:00 2001
From: Matthew D Jones <Matthew.D.Jones@tessella.com>
Date: Tue, 11 Aug 2015 09:26:52 +0100
Subject: [PATCH] Re #11422 Enable "n=" GUI element when power scale type
 selected

---
 Code/Mantid/MantidPlot/src/ScaleDetails.cpp | 19 +++++++++++++++++++
 Code/Mantid/MantidPlot/src/ScaleDetails.h   |  1 +
 2 files changed, 20 insertions(+)

diff --git a/Code/Mantid/MantidPlot/src/ScaleDetails.cpp b/Code/Mantid/MantidPlot/src/ScaleDetails.cpp
index 3df4dbe7242..8fa96658a46 100644
--- a/Code/Mantid/MantidPlot/src/ScaleDetails.cpp
+++ b/Code/Mantid/MantidPlot/src/ScaleDetails.cpp
@@ -403,6 +403,7 @@ void ScaleDetails::initWidgets()
     m_spnMajorValue->setValue(lst.count());
 
     checkstep();
+    checkscaletype();
 
     connect(m_grpAxesBreaks,SIGNAL(clicked()), this, SLOT(setModified()));
     connect(m_chkInvert,SIGNAL(clicked()), this, SLOT(setModified()));
@@ -415,8 +416,10 @@ void ScaleDetails::initWidgets()
     connect(m_cmbMinorValue,SIGNAL(currentIndexChanged(int)), this, SLOT(setModified()));
     connect(m_cmbUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setModified()));
     connect(m_cmbScaleType,SIGNAL(currentIndexChanged(int)), this, SLOT(setModified()));
+    connect(m_cmbScaleType,SIGNAL(currentIndexChanged(int)), this, SLOT(checkscaletype()));
     connect(m_dspnEnd, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
     connect(m_dspnStart, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
+    connect(m_dspnN, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
     connect(m_dspnStep, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
     connect(m_dspnBreakStart, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
     connect(m_dspnStepBeforeBreak, SIGNAL(valueChanged(double)), this, SLOT(setModified()));
@@ -632,6 +635,22 @@ void ScaleDetails::checkstep()
   }
 }
 
+/*
+ * Enable the "n =" widget if X^n scale type is selected
+ */
+void ScaleDetails::checkscaletype()
+{
+  // If "power X^n" scale option is selected
+  if (m_cmbScaleType->currentIndex() == 2)
+  {
+    m_dspnN->setEnabled(true);
+  }
+  else
+  {
+    m_dspnN->setEnabled(false);
+  }
+}
+
 /**
  * Recalculates the minimum value allowed in step to stop too many labels being rendered
  */
diff --git a/Code/Mantid/MantidPlot/src/ScaleDetails.h b/Code/Mantid/MantidPlot/src/ScaleDetails.h
index ca65cecc237..56343b04e69 100644
--- a/Code/Mantid/MantidPlot/src/ScaleDetails.h
+++ b/Code/Mantid/MantidPlot/src/ScaleDetails.h
@@ -67,6 +67,7 @@ private slots:
   void radiosSwitched();
   void setModified();
   void recalcStepMin();
+  void checkscaletype();
 
 private:
   bool m_modified, m_initialised;
-- 
GitLab