diff --git a/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.cpp b/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.cpp index 37ec0e04123a07236b7e3d0e9248bcd7d5bd4402..f98d6cbf98968ef8905da310670dd9b323e925f9 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.cpp @@ -91,6 +91,9 @@ m_autoBgName(QString::fromStdString(Mantid::Kernel::ConfigService::Instance().ge m_autoBackground(NULL), m_decimals(-1) { + QSettings settings; + settings.beginGroup("Mantid/FitBrowser"); + // Make sure plugins are loaded std::string libpath = Mantid::Kernel::ConfigService::Instance().getString("plugins.directory"); if( !libpath.empty() ) @@ -179,6 +182,9 @@ m_decimals(-1) m_costFunctions << "Least squares" << "Ignore positive peaks"; m_enumManager->setEnumNames(m_costFunction,m_costFunctions); + m_plotDiff = m_boolManager->addProperty("Plot Difference"); + bool plotDiff = settings.value("Plot Difference",QVariant(true)).toBool(); + m_boolManager->setValue(m_plotDiff,plotDiff); settingsGroup->addSubProperty(m_workspace); settingsGroup->addSubProperty(m_workspaceIndex); @@ -187,6 +193,7 @@ m_decimals(-1) settingsGroup->addSubProperty(m_output); settingsGroup->addSubProperty(m_minimizer); settingsGroup->addSubProperty(m_costFunction); + settingsGroup->addSubProperty(m_plotDiff); /* Create editors and assign them to the managers */ @@ -264,6 +271,10 @@ m_decimals(-1) /// Destructor FitPropertyBrowser::~FitPropertyBrowser() { + QSettings settings; + settings.beginGroup("Mantid/FitBrowser"); + bool plotDiff = m_boolManager->value(m_plotDiff); + settings.setValue("Plot Difference",plotDiff); if (m_compositeFunction) delete m_compositeFunction; } @@ -2156,3 +2167,9 @@ void FitPropertyBrowser::setDecimals(int d) settings.setValue("decimals",d); updateDecimals(); } + +bool FitPropertyBrowser::plotDiff()const +{ + return m_boolManager->value(m_plotDiff); +} + diff --git a/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.h b/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.h index 80fd93c6cefb8bbdb4e0c5d7ac1a4032cb4df7c5..6bf18f063c3d613538bc86a81467ea01005235eb 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.h +++ b/Code/Mantid/MantidPlot/src/Mantid/FitPropertyBrowser.h @@ -170,6 +170,9 @@ public: int getDecimals()const{return m_decimals;} void setDecimals(int d); + /// Returns true if the difference plot should be drawn + bool plotDiff()const; + public slots: void fit(); void sequentialFit(); @@ -325,6 +328,7 @@ private: QtProperty *m_minimizer; QtProperty *m_costFunction; QtProperty *m_logValue; + QtProperty *m_plotDiff; /// A list of registered functions mutable QStringList m_registeredFunctions; diff --git a/Code/Mantid/MantidPlot/src/Mantid/PeakPickerTool.cpp b/Code/Mantid/MantidPlot/src/Mantid/PeakPickerTool.cpp index 3d7e0b791e9b47b3f453b222b53dce63c64ac82a..6dfb3f206931ce52762d24a7c602f51161bf6fcc 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/PeakPickerTool.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/PeakPickerTool.cpp @@ -541,7 +541,10 @@ void PeakPickerTool::algorithmFinished(const QString& out) graph()->removeCurve(curveResName); new MantidCurve(curveFitName,out,graph(),"spectra",1,false); - new MantidCurve(curveResName,out,graph(),"spectra",2,false); + if (fitBrowser()->plotDiff()) + { + new MantidCurve(curveResName,out,graph(),"spectra",2,false); + } graph()->replot(); }