Commit 47fdedb2 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #18240 Add ability to drag & drop mask workspaces

parent a514007b
......@@ -152,6 +152,7 @@ signals:
void requestSelectComponent(const QString &);
void preDeletingHandle();
void clearingHandle();
void maskedWorkspaceOverlayed();
protected:
/// Implements AlgorithmObserver's finish handler
......
......@@ -109,7 +109,7 @@ protected slots:
void saveExcludeGroupToFile();
void showSaveMenuTooltip(QAction *);
void toggleMaskGroup();
void enableApplyButtons();
void doubleChanged(QtProperty *);
protected:
......@@ -124,7 +124,6 @@ protected:
void saveMaskingToCalFile(bool invertMask = false);
void saveMaskingToTableWorkspace(bool invertMask = false);
std::string generateMaskWorkspaceName(bool temp = false) const;
void enableApplyButtons();
void setSelectActivity();
Mode getMode() const;
/// Get mask/group border color
......
......@@ -10,6 +10,7 @@
#include "MantidAPI/Axis.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IMaskWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/Workspace.h"
#include "MantidKernel/Unit.h"
......@@ -946,7 +947,9 @@ bool InstrumentWidget::overlay(const QString &wsName) {
auto pws = boost::dynamic_pointer_cast<IPeaksWorkspace>(workspace);
auto table = boost::dynamic_pointer_cast<ITableWorkspace>(workspace);
if (!pws && !table) {
auto maskedWs = boost::dynamic_pointer_cast<IMaskWorkspace>(workspace);
if (!pws && !table && !maskedWs) {
QMessageBox::warning(this, "MantidPlot - Warning",
"Work space called '" + wsName +
"' is not suitable."
......@@ -970,6 +973,14 @@ bool InstrumentWidget::overlay(const QString &wsName) {
surface->loadShapesFromTableWorkspace(table);
updateInstrumentView();
success = true;
} else if (maskedWs && surface) {
auto actor = getInstrumentActor();
actor->setMaskMatrixWorkspace(
boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
maskedWs));
actor->updateColors();
updateInstrumentDetectors();
emit maskedWorkspaceOverlayed();
}
return success;
......
......@@ -331,6 +331,9 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
buttons->addWidget(m_applyToData, 0, 0);
box->setLayout(buttons);
layout->addWidget(box);
connect(m_instrWidget, SIGNAL(maskedWorkspaceOverlayed()), this,
SLOT(enableApplyButtons()));
}
/**
......@@ -1059,6 +1062,7 @@ void InstrumentWidgetMaskTab::enableApplyButtons() {
m_applyToData->setEnabled(false);
m_applyToView->setEnabled(false);
}
m_saveShapesToTable->setEnabled(hasMaskShapes);
m_saveButton->setEnabled(hasDetectorMask && (!enableBinMasking));
m_clearAll->setEnabled(hasMask);
setActivity();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment