From 5f500a75aca8d6d63ccd0e69bcdb7ad583e18cc6 Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols <federico.montesino-pouzols@stfc.ac.uk> Date: Mon, 27 Oct 2014 16:28:59 +0000 Subject: [PATCH] Added config option: ReusePlotInstances (On/Off), re #8091 --- .../Framework/Kernel/src/ConfigService.cpp | 2 ++ Code/Mantid/MantidPlot/src/ConfigDialog.cpp | 36 ++++++++++++------- Code/Mantid/MantidPlot/src/ConfigDialog.h | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp index a8c19760fe5..913e755dd3f 100644 --- a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp @@ -718,6 +718,8 @@ void ConfigServiceImpl::createUserPropertiesFile() const filestr << std::endl; filestr << "## Show invisible workspaces" << std::endl; filestr << "#MantidOptions.InvisibleWorkspaces=0" << std::endl; + filestr << "## Re-use plot instances for different plot types" << std::endl; + filestr << "#MantidOptions.ReusePlotInstances=Off" << std::endl; filestr << std::endl; filestr << "## Uncomment to disable use of OpenGL to render unwrapped instrument views" << std::endl; filestr << "#MantidOptions.InstrumentView.UseOpenGL=Off" << std::endl; diff --git a/Code/Mantid/MantidPlot/src/ConfigDialog.cpp b/Code/Mantid/MantidPlot/src/ConfigDialog.cpp index f0ff62bef19..6eef2bd9d6f 100644 --- a/Code/Mantid/MantidPlot/src/ConfigDialog.cpp +++ b/Code/Mantid/MantidPlot/src/ConfigDialog.cpp @@ -718,12 +718,26 @@ void ConfigDialog::initMantidOptionsTab() widgetLayout->addWidget(frame); QGridLayout *grid = new QGridLayout(frame); + // if on, for example all plotSpectrum will go to the same window. + m_reusePlotInstances = new QCheckBox("Re-use plot instances for different types of plots"); + m_reusePlotInstances->setChecked(false); + grid->addWidget(m_reusePlotInstances,0,0); + QString setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("MantidOptions.ReusePlotInstances")); + if(!setting.compare("On")) + { + m_reusePlotInstances->setChecked(true); + } + else if(!setting.compare("Off")) + { + m_reusePlotInstances->setChecked(false); + } + //create a checkbox for invisible workspaces options m_invisibleWorkspaces = new QCheckBox("Show Invisible Workspaces"); m_invisibleWorkspaces->setChecked(false); - grid->addWidget(m_invisibleWorkspaces,0,0); + grid->addWidget(m_invisibleWorkspaces,1,0); - QString setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("MantidOptions.InvisibleWorkspaces")); + setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("MantidOptions.InvisibleWorkspaces")); if(!setting.compare("1")) { m_invisibleWorkspaces->setChecked(true); @@ -739,13 +753,13 @@ void ConfigDialog::initMantidOptionsTab() treeCategories->setSortingEnabled(false); treeCategories->setHeaderLabel("Show Algorithm Categories"); - grid->addWidget(treeCategories,1,0); + grid->addWidget(treeCategories,2,0); refreshTreeCategories(); // create a checkbox for the instrument view OpenGL option m_useOpenGL = new QCheckBox("Use OpenGL in Instrument View"); m_useOpenGL->setChecked(true); - grid->addWidget(m_useOpenGL,3,0); + grid->addWidget(m_useOpenGL,4,0); setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance(). getString("MantidOptions.InstrumentView.UseOpenGL")).toUpper(); @@ -2272,16 +2286,12 @@ void ConfigDialog::updateMantidOptionsTab() { Mantid::Kernel::ConfigServiceImpl& mantid_config = Mantid::Kernel::ConfigService::Instance(); + // re-use plot instances (spectra, slice, color-fill, etc.) + QString reusePlotInst = m_reusePlotInstances->isChecked()? "On" : "Off"; + mantid_config.setString("MantidOptions.ReusePlotInstances",reusePlotInst.toStdString()); + //invisible workspaces options - QString showinvisible_ws; - if(m_invisibleWorkspaces->isChecked()) - { - showinvisible_ws="1"; - } - else - { - showinvisible_ws="0"; - } + QString showinvisible_ws = m_invisibleWorkspaces->isChecked()? "1" : "0"; mantid_config.setString("MantidOptions.InvisibleWorkspaces",showinvisible_ws.toStdString()); //OpenGL option diff --git a/Code/Mantid/MantidPlot/src/ConfigDialog.h b/Code/Mantid/MantidPlot/src/ConfigDialog.h index 4bad67ddbe9..a6d342dcb2a 100644 --- a/Code/Mantid/MantidPlot/src/ConfigDialog.h +++ b/Code/Mantid/MantidPlot/src/ConfigDialog.h @@ -200,6 +200,7 @@ private: QWidget* mantidOptionsPage; QWidget* mantidSendToPage; QCheckBox *m_invisibleWorkspaces; + QCheckBox *m_reusePlotInstances; QCheckBox *m_useOpenGL; QCheckBox *m_sendToPrograms; QTreeWidget *treeCategories; -- GitLab