diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h index 56a19bc98052..00cc6d7b66ff 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h @@ -2,6 +2,7 @@ #define MANTID_CUSTOMINTERFACES_INDIRECTBAYESTAB_H_ #include "MantidAPI/MatrixWorkspace.h" +#include "MantidQtCustomInterfaces/IndirectTab.h" #include "MantidQtMantidWidgets/RangeSelector.h" #include "MantidQtAPI/QwtWorkspaceSpectrumData.h" @@ -71,7 +72,7 @@ namespace MantidQt /// precision for integer properties in bayes tabs static const unsigned int INT_DECIMALS = 0; - class DLLExport IndirectBayesTab : public QWidget + class DLLExport IndirectBayesTab : public IndirectTab { Q_OBJECT @@ -84,8 +85,6 @@ namespace MantidQt /// Base methods implemented in derived classes virtual QString help() = 0; - virtual bool validate() = 0; - virtual void run() = 0; virtual void loadSettings(const QSettings& settings) = 0; signals: @@ -94,53 +93,27 @@ namespace MantidQt /// Send signal to parent window to show a message box to user void showMessageBox(const QString& message); - protected slots: - /// Slot for when the min range on the range selector changes - virtual void minValueChanged(double min) = 0; - /// Slot for when the min range on the range selector changes - virtual void maxValueChanged(double max) = 0; - /// Slot to handle when a user edits a property - virtual void updateProperties(QtProperty* prop, double val) = 0; + protected slots: + /// Slot to update the guides when the range properties change + void updateProperties(QtProperty* prop, double val); protected: - /// Function to plot a workspace to the miniplot using a workspace name - void plotMiniPlot(const QString& workspace, size_t index); - /// Function to plot a workspace to the miniplot using a workspace pointer - void plotMiniPlot(const Mantid::API::MatrixWorkspace_const_sptr & workspace, size_t wsIndex); - /// Function to set the range selector on the mini plot - void setMiniPlotGuides(QtProperty* lower, QtProperty* upper, const std::pair& bounds); /// Function to run a string as python code void runPythonScript(const QString& pyInput); /// Function to read an instrument's resolution from the IPF using a string bool getInstrumentResolution(const QString& filename, std::pair& res); /// Function to read an instrument's resolution from the IPF using a workspace pointer bool getInstrumentResolution(Mantid::API::MatrixWorkspace_const_sptr ws, std::pair& res); - /// Function to set the range limits of the plot - void setPlotRange(QtProperty* min, QtProperty* max, const std::pair& bounds); /// Function to set the position of the lower guide on the plot void updateLowerGuide(QtProperty* lower, QtProperty* upper, double value); /// Function to set the position of the upper guide on the plot void updateUpperGuide(QtProperty* lower, QtProperty* upper, double value); - /// Function to get the range of the curve displayed on the mini plot - std::pair getCurveRange(); - - /// Plot of the input - QwtPlot* m_plot; - /// Curve on the plot - QwtPlotCurve* m_curve; - /// Range selector widget for mini plot - MantidQt::MantidWidgets::RangeSelector* m_rangeSelector; + /// Tree of the properties QtTreePropertyBrowser* m_propTree; - /// Internal list of the properties - QMap m_properties; - /// Double manager to create properties - QtDoublePropertyManager* m_dblManager; - /// Double editor facotry for the properties browser - DoubleEditorFactory* m_dblEdFac; }; } // namespace CustomInterfaces } // namespace Mantid -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h index 1d457dc69f91..a6481550d644 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectTab.h @@ -43,7 +43,7 @@ namespace CustomInterfaces /** IndirectTab : TODO: DESCRIPTION @author Dan Nixon - @date 13/08/2013 + @date 08/10/2014 Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory @@ -76,7 +76,7 @@ namespace CustomInterfaces public slots: void runTab(); void setupTab(); - void validateTab(); + bool validateTab(); protected slots: /// Slot to handle when an algorithm finishes running diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h index 582079841a94..8b1ad5c6aab9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h @@ -17,6 +17,7 @@ namespace MantidQt // Inherited methods from IndirectBayesTab QString help() { return "JumpFit"; }; + void setup(); bool validate(); void run(); /// Load default settings into the interface @@ -28,19 +29,19 @@ namespace MantidQt /// Slot to handle plotting a different spectrum of the workspace void handleWidthChange(const QString& text); /// Slot for when the min range on the range selector changes - virtual void minValueChanged(double min); + void minValueChanged(double min); /// Slot for when the min range on the range selector changes - virtual void maxValueChanged(double max); + void maxValueChanged(double max); /// Slot to update the guides when the range properties change void updateProperties(QtProperty* prop, double val); /// Find all spectra with width data in the workspace void findAllWidths(Mantid::API::MatrixWorkspace_const_sptr ws); private: - //The ui form + // The UI form Ui::JumpFit m_uiForm; // map of axis labels to spectrum number - std::map spectraList; + std::map spectraList; }; } // namespace CustomInterfaces diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h index eefcaad95e9c..f574f325c3d6 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Quasi.h @@ -17,6 +17,7 @@ namespace MantidQt // Inherited methods from IndirectBayesTab QString help() { return "Quasi"; }; + void setup(); bool validate(); void run(); /// Load default settings into the interface @@ -24,9 +25,9 @@ namespace MantidQt private slots: /// Slot for when the min range on the range selector changes - virtual void minValueChanged(double min); + void minValueChanged(double min); /// Slot for when the min range on the range selector changes - virtual void maxValueChanged(double max); + void maxValueChanged(double max); /// Slot to update the guides when the range properties change void updateProperties(QtProperty* prop, double val); /// Slot to handle when a new sample file is available diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h index d84a5506743a..1ed67276dacf 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ResNorm.h @@ -17,6 +17,7 @@ namespace MantidQt // Inherited methods from IndirectBayesTab QString help() { return "ResNorm"; }; + void setup(); bool validate(); void run(); /// Load default settings into the interface @@ -26,9 +27,9 @@ namespace MantidQt /// Handle when the vanadium input is ready void handleVanadiumInputReady(const QString& filename); /// Slot for when the min range on the range selector changes - virtual void minValueChanged(double min); + void minValueChanged(double min); /// Slot for when the min range on the range selector changes - virtual void maxValueChanged(double max); + void maxValueChanged(double max); /// Slot to update the guides when the range properties change void updateProperties(QtProperty* prop, double val); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h index 998ce12dc601..b35d2dec4adf 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Stretch.h @@ -17,6 +17,7 @@ namespace MantidQt // Inherited methods from IndirectBayesTab QString help() { return "Stretch"; }; + void setup(); bool validate(); void run(); /// Load default settings into the interface @@ -24,9 +25,9 @@ namespace MantidQt private slots: /// Slot for when the min range on the range selector changes - virtual void minValueChanged(double min); + void minValueChanged(double min); /// Slot for when the min range on the range selector changes - virtual void maxValueChanged(double max); + void maxValueChanged(double max); /// Slot to update the guides when the range properties change void updateProperties(QtProperty* prop, double val); /// Slot to handle when a new sample file is available diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp index 8f791ef1f140..073f0c610255 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayes.cpp @@ -110,9 +110,9 @@ void IndirectBayes::runClicked() { int tabIndex = m_uiForm.indirectBayesTabs->currentIndex(); - if(m_bayesTabs[tabIndex]->validate()) + if(m_bayesTabs[tabIndex]->validateTab()) { - m_bayesTabs[tabIndex]->run(); + m_bayesTabs[tabIndex]->runTab(); } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp index 7139ae889bf1..d3f43bcae84e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp @@ -12,22 +12,13 @@ namespace MantidQt //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectBayesTab::IndirectBayesTab(QWidget * parent) : QWidget(parent), - m_plot(new QwtPlot(parent)), m_curve(new QwtPlotCurve()), m_rangeSelector(new MantidWidgets::RangeSelector(m_plot)), - m_propTree(new QtTreePropertyBrowser()), m_properties(), m_dblManager(new QtDoublePropertyManager()), - m_dblEdFac(new DoubleEditorFactory()) + IndirectBayesTab::IndirectBayesTab(QWidget * parent) : IndirectTab(parent), + m_propTree(new QtTreePropertyBrowser()) { m_propTree->setFactoryForManager(m_dblManager, m_dblEdFac); - m_rangeSelector->setInfoOnly(false); - connect(m_rangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double))); - connect(m_rangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double))); + // Connect double maneger signals connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateProperties(QtProperty*, double))); - - // initilise plot - m_plot->setCanvasBackground(Qt::white); - m_plot->setAxisFont(QwtPlot::xBottom, parent->font()); - m_plot->setAxisFont(QwtPlot::yLeft, parent->font()); } //---------------------------------------------------------------------------------------------- @@ -58,62 +49,6 @@ namespace MantidQt emit executePythonScript(pyInput, true); } - /** - * Plot a workspace to the miniplot given a workspace name and - * a specturm index. - * - * This method uses the analysis data service to retrieve the workspace. - * - * @param workspace :: The name of the workspace - * @param index :: The spectrum index of the workspace - */ - void IndirectBayesTab::plotMiniPlot(const QString& workspace, size_t index) - { - auto ws = Mantid::API::AnalysisDataService::Instance().retrieveWS(workspace.toStdString()); - plotMiniPlot(ws, index); - } - - /** - * Plot a workspace to the miniplot given a workspace pointer and - * a specturm index. - * - * @param workspace :: Pointer to the workspace - * @param wsIndex :: The spectrum index of the workspace - */ - void IndirectBayesTab::plotMiniPlot(const Mantid::API::MatrixWorkspace_const_sptr & workspace, size_t wsIndex) - { - using Mantid::MantidVec; - - //check if we can plot - if( wsIndex >= workspace->getNumberHistograms() || workspace->readX(0).size() < 2 ) - { - return; - } - - QwtWorkspaceSpectrumData wsData(*workspace, static_cast(wsIndex), false); - - if ( m_curve != NULL ) - { - m_curve->attach(0); - delete m_curve; - m_curve = NULL; - } - - size_t nhist = workspace->getNumberHistograms(); - if ( wsIndex >= nhist ) - { - emit showMessageBox("Error: Workspace index out of range."); - } - else - { - m_curve = new QwtPlotCurve(); - m_curve->setData(wsData); - m_curve->attach(m_plot); - - m_plot->replot(); - } - } - /** * Checks the workspace's intrument for a resolution parameter to use as * a default for the energy range on the mini plot @@ -155,52 +90,6 @@ namespace MantidQt return false; } - /** - * Gets the range of the curve plotted in the mini plot - * - * @return A pair containing the maximum and minimum points of the curve - */ - std::pair IndirectBayesTab::getCurveRange() - { - size_t npts = m_curve->data().size(); - - if( npts < 2 ) - throw std::invalid_argument("Too few points on data curve to determine range."); - - return std::make_pair(m_curve->data().x(0), m_curve->data().x(npts-1)); - } - - /** - * Sets the edge bounds of plot to prevent the user inputting invalid values - * - * @param min :: The lower bound property in the property browser - * @param max :: The upper bound property in the property browser - * @param bounds :: The upper and lower bounds to be set - */ - void IndirectBayesTab::setPlotRange(QtProperty* min, QtProperty* max, const std::pair& bounds) - { - m_dblManager->setMinimum(min, bounds.first); - m_dblManager->setMaximum(min, bounds.second); - m_dblManager->setMinimum(max, bounds.first); - m_dblManager->setMaximum(max, bounds.second); - m_rangeSelector->setRange(bounds.first, bounds.second); - } - - /** - * Set the position of the guides on the mini plot - * - * @param lower :: The lower bound property in the property browser - * @param upper :: The upper bound property in the property browser - * @param bounds :: The upper and lower bounds to be set - */ - void IndirectBayesTab::setMiniPlotGuides(QtProperty* lower, QtProperty* upper, const std::pair& bounds) - { - m_dblManager->setValue(lower, bounds.first); - m_dblManager->setValue(upper, bounds.second); - m_rangeSelector->setMinimum(bounds.first); - m_rangeSelector->setMaximum(bounds.second); - } - /** * Set the position of the lower guide on the mini plot * @@ -217,7 +106,7 @@ namespace MantidQt } else { - m_rangeSelector->setMinimum(value); + m_rangeSelectors["BayesRS"]->setMinimum(value); } } @@ -237,7 +126,7 @@ namespace MantidQt } else { - m_rangeSelector->setMaximum(value); + m_rangeSelectors["BayesRS"]->setMaximum(value); } } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp index e976c9094652..04886e6c4a14 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectTab.cpp @@ -58,7 +58,7 @@ namespace CustomInterfaces setup(); } - void IndirectTab::validateTab() + bool IndirectTab::validateTab() { validate(); } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp index d6492b4c0293..c1f9d4544d53 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp @@ -15,9 +15,19 @@ namespace MantidQt { m_uiForm.setupUi(parent); - //add the plot to the ui form - m_uiForm.plotSpace->addWidget(m_plot); - //add the properties browser to the ui form + // Create the plot + m_plots["JumpFitPlot"] = new QwtPlot(m_parentWidget); + m_plots["JumpFitPlot"]->setCanvasBackground(Qt::white); + m_plots["JumpFitPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["JumpFitPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); + m_uiForm.plotSpace->addWidget(m_plots["JumpFitPlot"]); + + // Create range selector + m_rangeSelectors["JumpFitQ"] = new MantidWidgets::RangeSelector(m_plots["JumpFitPlot"]); + connect(m_rangeSelectors["JumpFitQ"], SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double))); + connect(m_rangeSelectors["JumpFitQ"], SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double))); + + // Add the properties browser to the ui form m_uiForm.treeSpace->addWidget(m_propTree); m_properties["QMin"] = m_dblManager->addProperty("QMin"); @@ -37,6 +47,10 @@ namespace MantidQt connect(m_uiForm.cbWidth, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(handleWidthChange(const QString&))); } + void JumpFit::setup() + { + } + /** * Validate the form to check the program can be run * @@ -145,21 +159,21 @@ namespace MantidQt m_uiForm.cbWidth->setEnabled(true); std::string currentWidth = m_uiForm.cbWidth->currentText().toStdString(); - plotMiniPlot(filename, spectraList[currentWidth]); + plotMiniPlot(filename, spectraList[currentWidth], "JumpFitPlot", "RawPlotCurve"); std::pair res; - std::pair range = getCurveRange(); + std::pair range = getCurveRange("JumpFitPlot"); //Use the values from the instrument parameter file if we can if(getInstrumentResolution(filename, res)) { - setMiniPlotGuides(m_properties["QMin"], m_properties["QMax"], res); + setMiniPlotGuides("JumpFitQ", m_properties["QMin"], m_properties["QMax"], res); } else { - setMiniPlotGuides(m_properties["QMin"], m_properties["QMax"], range); + setMiniPlotGuides("JumpFitQ", m_properties["QMin"], m_properties["QMax"], range); } - setPlotRange(m_properties["QMin"], m_properties["QMax"], range); + setPlotRange("JumpFitQ", m_properties["QMin"], m_properties["QMax"], range); } else { @@ -232,7 +246,7 @@ namespace MantidQt { if(validate()) { - plotMiniPlot(sampleName, spectraList[text.toStdString()]); + plotMiniPlot(sampleName, spectraList[text.toStdString()], "JumpFitPlot", "RawPlotCurve"); } } } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp index f8384fb0cec5..6bdfb0d0aeb9 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp @@ -10,10 +10,19 @@ namespace MantidQt { m_uiForm.setupUi(parent); - //add the plot to the ui form - m_uiForm.plotSpace->addWidget(m_plot); - - //add the properties browser to the ui form + // Create the plot + m_plots["QuasiPlot"] = new QwtPlot(m_parentWidget); + m_plots["QuasiPlot"]->setCanvasBackground(Qt::white); + m_plots["QuasiPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["QuasiPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); + m_uiForm.plotSpace->addWidget(m_plots["QuasiPlot"]); + + // Create range selector + m_rangeSelectors["QuasiERange"] = new MantidWidgets::RangeSelector(m_plots["QuasiPlot"]); + connect(m_rangeSelectors["QuasiERange"], SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double))); + connect(m_rangeSelectors["QuasiERange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double))); + + // Add the properties browser to the UI form m_uiForm.treeSpace->addWidget(m_propTree); m_properties["EMin"] = m_dblManager->addProperty("EMin"); @@ -61,6 +70,10 @@ namespace MantidQt m_uiForm.mwFixWidthDat->readSettings(settings.group()); } + void Quasi::setup() + { + } + /** * Validate the form to check the program can be run * @@ -180,10 +193,10 @@ namespace MantidQt */ void Quasi::handleSampleInputReady(const QString& filename) { - plotMiniPlot(filename, 0); - std::pair range = getCurveRange(); - setMiniPlotGuides(m_properties["EMin"], m_properties["EMax"], range); - setPlotRange(m_properties["EMin"], m_properties["EMax"], range); + plotMiniPlot(filename, 0, "QuasiPlot", "RawPlotCurve"); + std::pair range = getCurveRange("QuasiPlot"); + setMiniPlotGuides("QuasiERange", m_properties["EMin"], m_properties["EMax"], range); + setPlotRange("QuasiERange", m_properties["EMin"], m_properties["EMax"], range); } /** diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp index 5ab1d38bd4f2..f86eb5bad8d4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp @@ -10,10 +10,21 @@ namespace MantidQt { m_uiForm.setupUi(parent); - //add the plot to the ui form - m_uiForm.plotSpace->addWidget(m_plot); - //add the properties browser to the ui form + // Create the plot + m_plots["ResNormPlot"] = new QwtPlot(m_parentWidget); + m_plots["ResNormPlot"]->setCanvasBackground(Qt::white); + m_plots["ResNormPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["ResNormPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); + m_uiForm.plotSpace->addWidget(m_plots["ResNormPlot"]); + + // Create range selector + m_rangeSelectors["ResNormERange"] = new MantidWidgets::RangeSelector(m_plots["ResNormPlot"]); + connect(m_rangeSelectors["ResNormERange"], SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double))); + connect(m_rangeSelectors["ResNormERange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double))); + + // Add the properties browser to the ui form m_uiForm.treeSpace->addWidget(m_propTree); + m_properties["EMin"] = m_dblManager->addProperty("EMin"); m_properties["EMax"] = m_dblManager->addProperty("EMax"); m_properties["VanBinning"] = m_dblManager->addProperty("Van Binning"); @@ -34,6 +45,10 @@ namespace MantidQt connect(m_uiForm.dsVanadium, SIGNAL(dataReady(const QString&)), this, SLOT(handleVanadiumInputReady(const QString&))); } + void ResNorm::setup() + { + } + /** * Validate the form to check the program can be run * @@ -110,9 +125,9 @@ namespace MantidQt */ void ResNorm::handleVanadiumInputReady(const QString& filename) { - plotMiniPlot(filename, 0); + plotMiniPlot(filename, 0, "ResNormPlot", "RawPlotCurve"); std::pair res; - std::pair range = getCurveRange(); + std::pair range = getCurveRange("ResNormPlot"); //Use the values from the instrument parameter file if we can if(getInstrumentResolution(filename, res)) @@ -121,14 +136,14 @@ namespace MantidQt res.first = res.first * 10; res.second = res.second * 10; - setMiniPlotGuides(m_properties["EMin"], m_properties["EMax"], res); + setMiniPlotGuides("ResNormERange", m_properties["EMin"], m_properties["EMax"], res); } else { - setMiniPlotGuides(m_properties["EMin"], m_properties["EMax"], range); + setMiniPlotGuides("ResNormERange", m_properties["EMin"], m_properties["EMax"], range); } - setPlotRange(m_properties["EMin"], m_properties["EMax"], range); + setPlotRange("ResNormERange", m_properties["EMin"], m_properties["EMax"], range); } /** diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp index e75822650e92..b6784bb29f9e 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp @@ -10,9 +10,19 @@ namespace MantidQt { m_uiForm.setupUi(parent); - //add the plot to the ui form - m_uiForm.plotSpace->addWidget(m_plot); - //add the properties browser to the ui form + // Create the plot + m_plots["StretchPlot"] = new QwtPlot(m_parentWidget); + m_plots["StretchPlot"]->setCanvasBackground(Qt::white); + m_plots["StretchPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["StretchPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); + m_uiForm.plotSpace->addWidget(m_plots["StretchPlot"]); + + // Create range selector + m_rangeSelectors["StretchERange"] = new MantidWidgets::RangeSelector(m_plots["StretchPlot"]); + connect(m_rangeSelectors["StretchERange"], SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double))); + connect(m_rangeSelectors["StretchERange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double))); + + // Add the properties browser to the ui form m_uiForm.treeSpace->addWidget(m_propTree); m_properties["EMin"] = m_dblManager->addProperty("EMin"); @@ -48,6 +58,10 @@ namespace MantidQt connect(m_uiForm.chkSequentialFit, SIGNAL(toggled(bool)), m_uiForm.cbPlot, SLOT(setEnabled(bool))); } + void Stretch::setup() + { + } + /** * Validate the form to check the program can be run * @@ -138,10 +152,10 @@ namespace MantidQt */ void Stretch::handleSampleInputReady(const QString& filename) { - plotMiniPlot(filename, 0); - std::pair range = getCurveRange(); - setMiniPlotGuides(m_properties["EMin"], m_properties["EMax"], range); - setPlotRange(m_properties["EMin"], m_properties["EMax"], range); + plotMiniPlot(filename, 0, "StretchPlot", "RawPlotCurve"); + std::pair range = getCurveRange("StretchPlot"); + setMiniPlotGuides("StretchERange", m_properties["EMin"], m_properties["EMax"], range); + setPlotRange("StretchERange", m_properties["EMin"], m_properties["EMax"], range); } /**