InstrumentWindowPickTab::InstrumentWindowPickTab(InstrumentWindow* instrWindow): QFrame(instrWindow),m_instrWindow(instrWindow),m_currentDetID(-1) { mInstrumentDisplay = m_instrWindow->getInstrumentDisplay(); m_plotSum = true; QVBoxLayout* layout=new QVBoxLayout(this); // set up the selection display m_selectionInfoDisplay = new QTextEdit(this); // set up the plot widget m_plot = new OneCurvePlot(this); m_plot->setYAxisLabelRotation(-90); m_plot->setXScale(0,1); m_plot->setYScale(-1.2,1.2); connect(m_plot,SIGNAL(showContextMenu()),this,SLOT(plotContextMenu())); connect(m_plot,SIGNAL(clickedAt(double,double)),this,SLOT(addPeak(double,double))); m_sumDetectors = new QAction("Sum",this); m_integrateTimeBins = new QAction("Integrate",this); m_logY = new QAction("Y log scale",this); m_linearY = new QAction("Y linear scale",this); connect(m_sumDetectors,SIGNAL(triggered()),this,SLOT(sumDetectors())); connect(m_integrateTimeBins,SIGNAL(triggered()),this,SLOT(integrateTimeBins())); connect(m_logY,SIGNAL(triggered()),m_plot,SLOT(setYLogScale())); connect(m_linearY,SIGNAL(triggered()),m_plot,SLOT(setYLinearScale())); CollapsibleStack* panelStack = new CollapsibleStack(this); m_infoPanel = panelStack->addPanel("Selection",m_selectionInfoDisplay); m_plotPanel = panelStack->addPanel("Name",m_plot); m_activeTool = new QLabel(this); // set up the tool bar m_one = new QPushButton(); m_one->setCheckable(true); m_one->setAutoExclusive(true); m_one->setChecked(true); m_one->setToolTip("Select single pixel"); m_one->setIcon(QIcon(":/PickTools/selection-pointer.png")); m_box = new QPushButton(); m_box->setCheckable(true); m_box->setAutoExclusive(true); m_box->setIcon(QIcon(":/PickTools/selection-box.png")); m_tube = new QPushButton(); m_tube->setCheckable(true); m_tube->setAutoExclusive(true); m_tube->setIcon(QIcon(":/PickTools/selection-tube.png")); m_tube->setToolTip("Select whole tube"); m_peak = new QPushButton(); m_peak->setCheckable(true); m_peak->setAutoExclusive(true); m_peak->setIcon(QIcon(":/PickTools/selection-peak.png")); m_peak->setToolTip("Select single crystal peak"); QHBoxLayout* toolBox = new QHBoxLayout(); toolBox->addWidget(m_one); toolBox->addWidget(m_box); m_box->setVisible(false); //Hidden by Owen Arnold 14/02/2011 because box picking doesn't exhibit correct behaviour and is not necessary for current release toolBox->addWidget(m_tube); toolBox->addWidget(m_peak); toolBox->addStretch(); toolBox->setSpacing(2); connect(m_one,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_box,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_tube,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_peak,SIGNAL(clicked()),this,SLOT(setSelectionType())); setSelectionType(); // lay out the widgets layout->addWidget(m_activeTool); layout->addLayout(toolBox); layout->addWidget(panelStack); setPlotCaption(); }
/** * Constructor. * @param instrWindow :: Parent InstrumentWindow. */ InstrumentWindowPickTab::InstrumentWindowPickTab(InstrumentWindow* instrWindow): InstrumentWindowTab(instrWindow), m_currentDetID(-1), m_tubeXUnits(DETECTOR_ID), m_freezePlot(false) { // connect to InstrumentWindow signals connect(m_instrWindow,SIGNAL(integrationRangeChanged(double,double)),this,SLOT(changedIntegrationRange(double,double))); m_plotSum = true; QVBoxLayout* layout=new QVBoxLayout(this); // set up the selection display m_selectionInfoDisplay = new QTextEdit(this); // set up the plot widget m_plot = new OneCurvePlot(this); m_plot->setYAxisLabelRotation(-90); m_plot->setXScale(0,1); m_plot->setYScale(-1.2,1.2); connect(m_plot,SIGNAL(showContextMenu()),this,SLOT(plotContextMenu())); connect(m_plot,SIGNAL(clickedAt(double,double)),this,SLOT(addPeak(double,double))); // Plot context menu actions m_sumDetectors = new QAction("Sum",this); m_sumDetectors->setCheckable(true); m_sumDetectors->setChecked(true); m_integrateTimeBins = new QAction("Integrate",this); m_integrateTimeBins->setCheckable(true); m_summationType = new QActionGroup(this); m_summationType->addAction(m_sumDetectors); m_summationType->addAction(m_integrateTimeBins); m_logY = new QAction("Y log scale",this); m_linearY = new QAction("Y linear scale",this); m_yScale = new QActionGroup(this); m_yScale->addAction(m_linearY); m_yScale->addAction(m_logY); m_logY->setCheckable(true); m_linearY->setCheckable(true); m_linearY->setChecked(true); connect(m_sumDetectors,SIGNAL(triggered()),this,SLOT(sumDetectors())); connect(m_integrateTimeBins,SIGNAL(triggered()),this,SLOT(integrateTimeBins())); connect(m_logY,SIGNAL(triggered()),m_plot,SLOT(setYLogScale())); connect(m_linearY,SIGNAL(triggered()),m_plot,SLOT(setYLinearScale())); m_unitsMapper = new QSignalMapper(this); m_detidUnits = new QAction("Detector ID",this); m_detidUnits->setCheckable(true); m_unitsMapper->setMapping(m_detidUnits,DETECTOR_ID); connect(m_detidUnits,SIGNAL(triggered()),m_unitsMapper,SLOT(map())); m_lengthUnits = new QAction("Tube length",this); m_lengthUnits->setCheckable(true); m_unitsMapper->setMapping(m_lengthUnits,LENGTH); connect(m_lengthUnits,SIGNAL(triggered()),m_unitsMapper,SLOT(map())); m_phiUnits = new QAction("Phi",this); m_phiUnits->setCheckable(true); m_unitsMapper->setMapping(m_phiUnits,PHI); connect(m_phiUnits,SIGNAL(triggered()),m_unitsMapper,SLOT(map())); m_unitsGroup = new QActionGroup(this); m_unitsGroup->addAction(m_detidUnits); m_unitsGroup->addAction(m_lengthUnits); m_unitsGroup->addAction(m_phiUnits); // re #4169 disabled until fixed or removed connect(m_unitsMapper,SIGNAL(mapped(int)),this,SLOT(setTubeXUnits(int))); // Instrument display context menu actions m_storeCurve = new QAction("Store curve",this); connect(m_storeCurve,SIGNAL(triggered()),this,SLOT(storeCurve())); m_savePlotToWorkspace = new QAction("Save plot to workspace",this); connect(m_savePlotToWorkspace,SIGNAL(triggered()),this,SLOT(savePlotToWorkspace())); CollapsibleStack* panelStack = new CollapsibleStack(this); m_infoPanel = panelStack->addPanel("Selection",m_selectionInfoDisplay); m_plotPanel = panelStack->addPanel("Name",m_plot); m_activeTool = new QLabel(this); // set up the tool bar m_one = new QPushButton(); m_one->setCheckable(true); m_one->setAutoExclusive(true); m_one->setChecked(true); m_one->setToolTip("Select single pixel"); m_one->setIcon(QIcon(":/PickTools/selection-pointer.png")); m_tube = new QPushButton(); m_tube->setCheckable(true); m_tube->setAutoExclusive(true); m_tube->setIcon(QIcon(":/PickTools/selection-tube.png")); m_tube->setToolTip("Select whole tube"); m_peak = new QPushButton(); m_peak->setCheckable(true); m_peak->setAutoExclusive(true); m_peak->setIcon(QIcon(":/PickTools/selection-peak.png")); m_peak->setToolTip("Add single crystal peak"); m_peakSelect = new QPushButton(); m_peakSelect->setCheckable(true); m_peakSelect->setAutoExclusive(true); m_peakSelect->setIcon(QIcon(":/PickTools/eraser.png")); m_peakSelect->setToolTip("Erase single crystal peak(s)"); QHBoxLayout* toolBox = new QHBoxLayout(); toolBox->addWidget(m_one); toolBox->addWidget(m_tube); toolBox->addWidget(m_peak); toolBox->addWidget(m_peakSelect); toolBox->addStretch(); toolBox->setSpacing(2); connect(m_one,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_tube,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_peak,SIGNAL(clicked()),this,SLOT(setSelectionType())); connect(m_peakSelect,SIGNAL(clicked()),this,SLOT(setSelectionType())); setSelectionType(); // lay out the widgets layout->addWidget(m_activeTool); layout->addLayout(toolBox); layout->addWidget(panelStack); setPlotCaption(); }