WSpacePlot::WSpacePlot(QSize size, bool dg, QWidget* parent, QWidget *colorBarParent, WGraphXAxis::Position xAxisPos, WGraphYAxis::Position yAxisPos, int border) : WGraphWidget(parent,xAxisPos,yAxisPos,border), paintColor(red), dataRange(0.0, 1.0), recRects(0), cellLabelRect(QRect()), colorBar(0), startCell(0,0), currCell(0,0), selecting(true), dragEnabled(false), drawGrid(dg), autoScale(true), multiSelect(true) { if (colorBarParent) { colorBar = new WColorBar(colorBarParent); connect(this,SIGNAL(colorChanged(QColor)), colorBar,SLOT(setColor(QColor))); connect(colorBar,SIGNAL(rangeSelected(WRange)), this,SLOT(selectRange(WRange))); connect(colorBar,SIGNAL(yVisRangeChanged(WRange)), this,SLOT(setDataRange(WRange))); colorBar->show(); } setCursor(crossCursor); if (drawGrid) setBackgroundColor(white); setFocusPolicy(TabFocus); xAxis()->setBaseTick(1.0); yAxis()->setBaseTick(1.0); showGrid(false); setSize(size); autoPanTimer = new QTimer(this); labelClearTimer = new QTimer(this); connect(frame(),SIGNAL(aboutToDraw()),this,SLOT(checkDataRange())); connect(autoPanTimer,SIGNAL(timeout()),this,SLOT(autoPan())); connect(labelClearTimer,SIGNAL(timeout()),this,SLOT(clearCellLabel())); connect(this,SIGNAL(frameResized()),SLOT(calcGeometry())); connect(this,SIGNAL(visRangeChanged()),SLOT(calcGeometry())); }
void BarWidget::setUp(Storage *storage) { DataWidget::setUp(storage); m_min = 0; m_max = 1000; m_numberType = NUM_UINT8; m_rotation = 0; QMenu *bitsMenu = contextMenu->addMenu(tr("Data type")); QMenu *rotMenu = contextMenu->addMenu(tr("Rotation")); QSignalMapper *signalMapBits = new QSignalMapper(this); for(quint8 i = 0; i < NUM_COUNT; ++i) { static const QString dataTypes[] = { tr("unsigned 8bit"), tr("unsigned 16bit"), tr("unsigned 32bit"), tr("unsigned 64bit"), tr("signed 8bit"), tr("signed 16bit"), tr("signed 32bit"), tr("signed 64bit"), tr("float (4 bytes)"), tr("double (8 bytes)") }; if(i%4 == 0 && i != 0) bitsMenu->addSeparator(); m_bitsAct[i] = bitsMenu->addAction(dataTypes[i]); m_bitsAct[i]->setCheckable(true); signalMapBits->setMapping(m_bitsAct[i], i); connect(m_bitsAct[i], SIGNAL(triggered()), signalMapBits, SLOT(map())); } m_bitsAct[0]->setChecked(true); connect(signalMapBits, SIGNAL(mapped(int)), SLOT(setDataType(int))); QSignalMapper *signalMapRot = new QSignalMapper(this); for(quint8 i = 0; i < 2; ++i) { static const QString rotText[] = { tr("Vertical"), tr("Horizontal") }; m_rotAct[i] = rotMenu->addAction(rotText[i]); m_rotAct[i]->setCheckable(true); signalMapRot->setMapping(m_rotAct[i], i); connect(m_rotAct[i], SIGNAL(triggered()), signalMapRot, SLOT(map())); } rotationSelected(0); connect(signalMapRot, SIGNAL(mapped(int)), SLOT(setRotation(int))); QMenu *alarmMenu = contextMenu->addMenu(tr("Alarm")); m_alarmEnable = alarmMenu->addAction(tr("Enable alarm")); m_alarmEnable->setCheckable(true); m_alarmLevel = alarmMenu->addAction(tr("Set alarm level...")); m_alarmLevel->setEnabled(false); m_rangeAct = contextMenu->addAction(tr("Set range...")); m_showScaleAct = contextMenu->addAction(tr("Show scale")); m_showValAct = contextMenu->addAction(tr("Show value")); m_showScaleAct->setCheckable(true); m_showValAct->setCheckable(true); m_showScaleAct->setChecked(true); m_showValAct->setChecked(true); QAction *colorAct = contextMenu->addAction(tr("Set colors")); QAction *formula = contextMenu->addAction(tr("Set formula...")); connect(m_rangeAct, SIGNAL(triggered()), SLOT(rangeSelected())); connect(m_showScaleAct, SIGNAL(triggered(bool)), SLOT(showScale(bool))); connect(m_showValAct, SIGNAL(triggered(bool)), SLOT(showVal(bool))); connect(m_alarmEnable, SIGNAL(triggered(bool)), SLOT(setAlarmEnabled(bool))); connect(m_alarmLevel, SIGNAL(triggered()), SLOT(alarmLevelAct())); connect(colorAct, SIGNAL(triggered()), SLOT(showColorsDialog())); connect(formula, SIGNAL(triggered()), SLOT(showFormulaDialog())); }
ContourCopy::ContourCopy(QWidget *parent, const char *name) : DialogFrame(parent, 3, 1, buttonLabels, buttonTips, true, ImodPrefs->getRoundedStyle(), " ", "", name) { QRadioButton *radio; QHBoxLayout *hBox = diaHBoxLayout(mLayout); mToCombo = new QComboBox(this); hBox->addWidget(mToCombo); mToCombo->addItem("Copy to Object #"); mToCombo->addItem("Copy to Section #"); mToCombo->addItem("Copy to Next Section"); mToCombo->addItem("Copy to Prev Section"); mToCombo->addItem("Duplicate"); if (sData.vw->numTimes) mToCombo->addItem("Copy to Time Index #"); mToCombo->setFocusPolicy(Qt::NoFocus); mToCombo->setCurrentIndex(sData.copyOperation); mToCombo->setToolTip("Select type of place to copy contours to"); connect(mToCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(placeSelected(int))); mToSpinBox = new QSpinBox(this); hBox->addWidget(mToSpinBox); mToSpinBox->setFocusPolicy(Qt::ClickFocus); mToSpinBox->setKeyboardTracking(false); mToSpinBox->setToolTip("Set object, section, or time"); connect(mToSpinBox, SIGNAL(valueChanged(int)), this, SLOT(toValueChanged(int))); QGroupBox *gbox = new QGroupBox("Copy", this); QVBoxLayout *gbLayout = new QVBoxLayout(gbox); mRadioGroup = new QButtonGroup(this); mLayout->addWidget(gbox); connect(mRadioGroup, SIGNAL(buttonClicked(int)), this, SLOT(rangeSelected(int))); radio = diaRadioButton("Just the current contour(s)", gbox, mRadioGroup, gbLayout, 0, "Copy only the selected contour(s) in the current object"); radio = diaRadioButton ("All contours in surface", gbox, mRadioGroup, gbLayout, 1, "Copy contours with same surface number as current one"); radio = diaRadioButton("All contours in object", gbox, mRadioGroup, gbLayout, 2, "Copy all eligible contours in object"); if (sData.vw->numTimes) { mTimeRadio = diaRadioButton ("All contours in all objects", gbox, mRadioGroup, gbLayout, 3, "Copy all contours at this time to selected time"); } // Figure out initial radio button settings, enforce flag settings and // set the button int radioVal = 0; if (sData.doSurface) radioVal = 1; if (sData.doAll) radioVal = 2; if (sData.vw->numTimes && sData.doAllObj) radioVal = 3; rangeSelected(radioVal); diaSetGroup(mRadioGroup, radioVal); mEllipseBox = diaCheckBox("Make equivalent ellipse", this, mLayout); connect(mEllipseBox, SIGNAL(toggled(bool)), this, SLOT(ellipseToggled(bool))); mEllipseBox->setToolTip("Make the copied contour be the equivalent ellipse (one with " "the same second moments as the area)"); diaSetChecked(mEllipseBox, sData.makeEllipse != 0); mEllipseBox->setEnabled(sData.copyOperation == COPY_TO_OBJECT); update(); connect(this, SIGNAL(actionPressed(int)), this, SLOT(buttonPressed(int))); setWindowTitle(imodCaption("3dmod Copy Contours")); }