bool KstHsDialogI::editObject() { KstHistogramList hsList = kstObjectSubList<KstDataObject,KstHistogram>(KST::dataObjectList); // if editing multiple objects, edit each one if (_editMultipleMode) { // if the user selected no vector, treat it as non-dirty _vectorDirty = _w->_vector->_vector->currentItem() != 0; _nDirty = _w->N->text() != " "; _minDirty = !_w->Min->text().isEmpty(); _maxDirty = !_w->Max->text().isEmpty(); bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KstHistogramList::Iterator hsIter = hsList.findTag(_editMultipleWidget->_objectList->text(i)); if (hsIter == hsList.end()) { return false; } KstHistogramPtr hsPtr = *hsIter; if (!editSingleObject(hsPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { KstHistogramPtr hp = kst_cast<KstHistogram>(_dp); // verify that the curve name is unique QString tag_name = _tagName->text(); if (!hp || (tag_name != hp->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } hp->setTagName(KstObjectTag(tag_name, hp->tag().context())); // FIXME: doesn't allow changing tag context // then edit the object _vectorDirty = true; _minDirty = true; _maxDirty = true; _nDirty = true; _realTimeAutoBinDirty = true; _normIsPercentDirty = true; _normIsFractionDirty = true; _peakIs1Dirty = true; _normIsNumberDirty = true; if (!editSingleObject(hp)) { return false; } } emit modified(); return true; }
bool KstEqDialogI::editObject() { KstEquationList eqList = kstObjectSubList<KstDataObject,KstEquation>(KST::dataObjectList); // if editing multiple objects, edit each one if (_editMultipleMode) { // if the user selected no vector, treat it as non-dirty _xVectorsDirty = _w->_xVectors->_vector->currentItem() != 0; _equationDirty = !_w->_equation->text().isEmpty(); bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KstEquationList::Iterator eqIter = eqList.findTag(_editMultipleWidget->_objectList->text(i)); if (eqIter == eqList.end()) { return false; } KstEquationPtr eqPtr = *eqIter; if (!editSingleObject(eqPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { // verify that the curve name is unique QString tag_name = _tagName->text(); KstEquationPtr ep = kst_cast<KstEquation>(_dp); if (!ep || tag_name != ep->tagName() && KstData::self()->dataTagNameNotUnique(tag_name)) { _tagName->setFocus(); return false; } ep->writeLock(); ep->setTagName(tag_name); ep->unlock(); // then edit the object _equationDirty = true; _xVectorsDirty = true; _doInterpolationDirty = true; if (!editSingleObject(ep)) { return false; } } emit modified(); return true; }
bool BinnedMapDialogI::editObject() { //called upon clicking 'ok' in 'edit' mode //return false if the specified objects can't be editted, otherwise true BinnedMapPtr map = kst_cast<BinnedMap>(_dp); if (!map) { return false; } map->writeLock(); if (_tagName->text() != map->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) { _tagName->setFocus(); map->unlock(); return false; } map->setTagName(KstObjectTag::fromString(_tagName->text())); map->inputVectors().clear(); map->unlock(); // Save the vectors and scalars if (!editSingleObject(map) || !map->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the values you entered.")); return false; } map->setDirty(); emit modified(); return true; }
bool BinnedMapDialogI::newObject() { //called upon clicking 'ok' in 'new' mode //return false if the specified objects can't be made, otherwise true QString tagName = _tagName->text(); if (tagName != defaultTag && KstData::self()->dataTagNameNotUnique(tagName, true, this)) { _tagName->setFocus(); return false; } //Need to create a new object rather than use the one in KstDataObject pluginList BinnedMapPtr map = kst_cast<BinnedMap>(KstDataObject::createPlugin("Binned Map")); Q_ASSERT(map); //should never happen... KstWriteLocker pl(map); if (tagName == defaultTag) { tagName = KST::suggestPluginName("binnedmap"); } map->setTagName(KstObjectTag::fromString(tagName)); // Save the vectors and scalars if (!editSingleObject(map) || !map->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the values you entered.")); return false; } map->setMap(_w->_binnedMap->text()); map->setHitsMap(_w->_hitsMap->text()); if (!map || !map->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the binned map you entered.")); return false; } //xxxx map->setXMin(_w->_Xmin->text().toDouble()); map->setXMax(_w->_Xmax->text().toDouble()); map->setYMin(_w->_Ymin->text().toDouble()); map->setYMax(_w->_Ymax->text().toDouble()); map->setNX(_w->_Xn->value()); map->setNY(_w->_Yn->value()); map->setAutoBin(_w->_realTimeAutoBin->isChecked()); map->setDirty(); KST::dataObjectList.lock().writeLock(); KST::dataObjectList.append(map.data()); KST::dataObjectList.lock().unlock(); map = 0L; // drop the reference emit modified(); return true; }
bool KstBasicDialogI::editObject() { //called upon clicking 'ok' in 'edit' mode //return false if the specified objects can't be editted, otherwise true KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>(_dp); Q_ASSERT(ptr); //should never happen... ptr->writeLock(); if (_tagName->text() != ptr->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) { _tagName->setFocus(); ptr->unlock(); return false; } ptr->setTagName(_tagName->text()); // Must unlock before clear() for (KstVectorMap::Iterator i = ptr->inputVectors().begin(); i != ptr->inputVectors().end(); ++i) { (*i)->unlock(); } for (KstScalarMap::Iterator i = ptr->inputScalars().begin(); i != ptr->inputScalars().end(); ++i) { (*i)->unlock(); } for (KstStringMap::Iterator i = ptr->inputStrings().begin(); i != ptr->inputStrings().end(); ++i) { (*i)->unlock(); } ptr->inputVectors().clear(); ptr->inputScalars().clear(); ptr->inputStrings().clear(); ptr->unlock(); // Save the vectors and scalars if (!editSingleObject(ptr) || !ptr->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the values you entered.")); return false; } ptr->setDirty(); emit modified(); return true; }
bool KstMatrixDialog::editObject() { // // if editing multiple objects, edit each one... // if (_editMultipleMode) { // xxx _fileNameDirty = !_w->_fileName->url().isEmpty(); _gradientZAtMinDirty = !_w->_gradientZAtMin->text().isEmpty(); _gradientZAtMaxDirty = !_w->_gradientZAtMax->text().isEmpty(); _minXDirty = !_w->_minX->text().isEmpty(); _minYDirty = !_w->_minY->text().isEmpty(); _yStepDirty = !_w->_yStep->text().isEmpty(); _xStepDirty = !_w->_xStep->text().isEmpty(); _xStartDirty = _w->_xStart->text() != " "; _yStartDirty = _w->_yStart->text() != " "; _xNumStepsDirty = _w->_xNumSteps->text() != " "; _yNumStepsDirty = _w->_yNumSteps->text() != " "; _skipDirty = _w->_skip->text() != " "; _nXDirty = _w->_nX->text() != " "; _nYDirty = _w->_nY->text() != " "; bool didEdit = false; int i; for (i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->item(i)->isSelected()) { KstMatrixPtr mxPtr; // // get the pointer to the object... // KST::matrixList.lock().readLock(); mxPtr = *KST::matrixList.findTag(_editMultipleWidget->_objectList->item(i)->text()); KST::matrixList.lock().unlock(); if (!mxPtr) { return false; } if (!editSingleObject(mxPtr)) { return false; } didEdit = true; } } if (!didEdit) { QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("Select one or more objects to edit.")); return false; } } else { KstMatrixPtr mp; QString tagName; mp = kst_cast<KstMatrix>(_dp); tagName = _tagName->text(); if (!mp || (tagName != mp->tagName() && KstData::self()->dataTagNameNotUnique(tagName))) { _tagName->setFocus(); return false; } mp->writeLock(); mp->setTag(KstObjectTag(tagName, mp->tag().context())); // FIXME: can't change tag context mp->unlock(); // // then edit the object... // _fileNameDirty = true; _fieldDirty = true; _xStartDirty = true; _xStartCountFromEndDirty = true; _yStartDirty = true; _yStartCountFromEndDirty = true; _xNumStepsDirty = true; _xNumStepsReadToEndDirty = true; _yNumStepsDirty = true; _yNumStepsReadToEndDirty = true; _gradientXDirty = true; _gradientYDirty = true; _gradientZAtMinDirty = true; _gradientZAtMaxDirty = true; _minXDirty = true; _minYDirty = true; _xStepDirty = true; _yStepDirty = true; _doSkipDirty = true; _skipDirty = true; _doAveDirty = true; _nXDirty = true; _nYDirty = true; if (!editSingleObject(mp)) { return false; } } emit modified(); return true; }
// returns true if succesful bool KstCsdDialogI::editObject() { // if the user selected no vector, treat it as non-dirty _vectorDirty = _w->_vector->_vector->currentItem() != 0; _fFTLenDirty = _w->_kstFFTOptions->FFTLen->text() != " "; _sampRateDirty = !_w->_kstFFTOptions->SampRate->text().isEmpty(); _vectorUnitsDirty = !_w->_kstFFTOptions->VectorUnits->text().isEmpty(); _rateUnitsDirty = !_w->_kstFFTOptions->RateUnits->text().isEmpty(); _windowSizeDirty = _w->_windowSize->text() != " "; _apodizeFxnDirty = _w->_kstFFTOptions->ApodizeFxn->currentItem() != 0; _gaussianSigmaDirty = _w->_kstFFTOptions->Sigma->value() != _w->_kstFFTOptions->Sigma->minValue(); _outputDirty = _w->_kstFFTOptions->Output->currentItem() != 0; KstCSDList csList = kstObjectSubList<KstDataObject,KstCSD>(KST::dataObjectList); // if editing multiple objects, edit each one if (_editMultipleMode) { bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KstCSDList::Iterator csIter = csList.findTag(_editMultipleWidget->_objectList->text(i)); if (csIter == csList.end()) { return false; } KstCSDPtr csPtr = *csIter; if (!editSingleObject(csPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { KstCSDPtr cp = kst_cast<KstCSD>(_dp); // verify that the name is unique QString tag_name = _tagName->text(); if (!cp || (tag_name != cp->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } cp->writeLock(); cp->setTagName(tag_name); cp->unlock(); // then edit the object _vectorDirty = true; _apodizeDirty = true; _apodizeFxnDirty = true; _gaussianSigmaDirty = true; _removeMeanDirty = true; _interleavedDirty = true; _sampRateDirty = true; _vectorUnitsDirty = true; _rateUnitsDirty = true; _fFTLenDirty = true; _windowSizeDirty = true; _outputDirty = true; if (!editSingleObject(cp)) { return false; } } emit modified(); return true; }
bool KstPsdDialog::editObject() { KstPSDList psList; // // if the user selected no vector, treat it as non-dirty... // _vectorDirty = _w->_vector->_vector->currentIndex() != 0; _apodizeFxnDirty = _w->_kstFFTOptions->ApodizeFxn->currentIndex() != 0; _fFTLenDirty = _w->_kstFFTOptions->FFTLen->text() != " "; _sampRateDirty = !_w->_kstFFTOptions->SampRate->text().isEmpty(); _vectorUnitsDirty = !_w->_kstFFTOptions->VectorUnits->text().isEmpty(); _rateUnitsDirty = !_w->_kstFFTOptions->RateUnits->text().isEmpty(); _outputDirty = _w->_kstFFTOptions->Output->currentIndex() != 0; psList = kstObjectSubList<KstDataObject,KstPSD>(KST::dataObjectList); if (_editMultipleMode) { bool didEdit = false; int i; for (i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->item(i)->isSelected()) { KstPSDList::Iterator psIter; KstPSDPtr psPtr; psIter = psList.findTag(_editMultipleWidget->_objectList->item(i)->text()); if (psIter == psList.end()) { return false; } psPtr = *psIter; if (!editSingleObject(psPtr)) { return false; } didEdit = true; } } if (!didEdit) { QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("Select one or more objects to edit.")); return false; } } else { KstPSDPtr pp; QString tag_name; pp = kst_cast<KstPSD>(_dp); tag_name = _tagName->text(); if (!pp || (tag_name != pp->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } pp->writeLock(); pp->setTagName(tag_name); pp->unlock(); // then edit the object _vectorDirty = true; _apodizeDirty = true; _apodizeFxnDirty = true; _gaussianSigmaDirty = true; _removeMeanDirty = true; _interleavedDirty = true; _sampRateDirty = true; _vectorUnitsDirty = true; _rateUnitsDirty = true; _fFTLenDirty = true; _outputDirty = true; _interpolateHolesDirty = true; if (!editSingleObject(pp)) { return false; } } emit modified(); return true; }
bool KstVectorDialogI::editObject() { // if editing multiple objects, edit each one if (_editMultipleMode) { // get dirties first _fileNameDirty = !_w->FileName->url().isEmpty(); _skipDirty = _w->_kstDataRange->Skip->text() != " "; _f0Dirty = !_w->_kstDataRange->F0->text().isEmpty(); _nDirty = !_w->_kstDataRange->N->text().isEmpty(); _NDirty = _w->_N->text() != " "; _xMinDirty = !_w->_xMin->text().isEmpty(); _xMaxDirty = !_w->_xMax->text().isEmpty(); // now edit the vectors bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KST::vectorList.lock().readLock(); KstVectorList::Iterator vcIter = KST::vectorList.findTag(_editMultipleWidget->_objectList->text(i)); if (vcIter == KST::vectorList.end()) { KST::vectorList.lock().unlock(); return false; } KstVectorPtr vcPtr = *vcIter; KST::vectorList.lock().unlock(); if (!editSingleObject(vcPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { // verify that the curve name is unique QString tag_name = _tagName->text(); _dp->writeLock(); if (tag_name != _dp->tagName() && KstData::self()->vectorTagNameNotUnique(tag_name)) { _dp->unlock(); _tagName->setFocus(); return false; } _dp->setTagName(KstObjectTag(tag_name, _dp->tag().context())); // FIXME: doesn't allow changing tag context _dp->unlock(); // then edit the object _fileNameDirty = true; _f0Dirty = true; _nDirty = true; _NDirty = true; _countFromEndDirty = true; _readToEndDirty = true; _doFilterDirty = true; _doSkipDirty = true; _skipDirty = true; _xMinDirty = true; _xMaxDirty = true; KstVectorPtr vp = kst_cast<KstVector>(_dp); if (!vp || !editSingleObject(vp)) { return false; } } emit modified(); return true; }
bool KstEventMonitorI::editObject() { KstEventMonitorEntryList emList = kstObjectSubList<KstDataObject,EventMonitorEntry>(KST::dataObjectList); // if editing multiple objects, edit each one if (_editMultipleMode) { // if text fields are empty, treat as non-dirty _lineEditEquationDirty = !_w->lineEditEquation->text().isEmpty(); _lineEditDescriptionDirty = !_w->lineEditDescription->text().isEmpty(); _lineEditEMailRecipientsDirty = !_w->lineEditEMailRecipients->text().isEmpty(); bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KstEventMonitorEntryList::Iterator emIter = emList.findTag(_editMultipleWidget->_objectList->text(i)); if (emIter == emList.end()) { return false; } EventMonitorEntryPtr emPtr = *emIter; if (!editSingleObject(emPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { EventMonitorEntryPtr ep = kst_cast<EventMonitorEntry>(_dp); // verify that the curve name is unique QString tag_name = _tagName->text(); if (!ep || (tag_name != ep->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } ep->writeLock(); ep->setTagName(tag_name); ep->unlock(); // then edit the object _lineEditEquationDirty = true; _lineEditDescriptionDirty = true; _checkBoxDebugDirty = true; _radioButtonLogNoticeDirty = true; _radioButtonLogWarningDirty = true; _radioButtonLogErrorDirty = true; _checkBoxEMailNotifyDirty = true; _lineEditEMailRecipientsDirty = true; _checkBoxELOGNotifyDirty = true; _scriptDirty = true; if (!editSingleObject(ep)) { return false; } } emit modified(); return true; }
bool KstImageDialogI::editObject() { KstImageList imList = kstObjectSubList<KstDataObject,KstImage>(KST::dataObjectList); // if editing multiple objects, edit each one if (_editMultipleMode) { _numContourLinesDirty = _w->_numContourLines->text() != " "; _contourWeightDirty = _w->_contourWeight->text() != " "; _paletteDirty = _w->_colorPalette->currentPaletteIndex() != 0; _matrixDirty = _w->_matrix->_matrix->currentItem() != 0; _lowerZDirty = !_w->_lowerZ->text().isEmpty(); _upperZDirty = !_w->_upperZ->text().isEmpty(); bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); ++i) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KstImageList::Iterator imIter = imList.findTag(_editMultipleWidget->_objectList->text(i)); if (imIter == imList.end()) { return false; } KstImagePtr imPtr = *imIter; if (!editSingleObject(imPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { KstImagePtr ip = kst_cast<KstImage>(_dp); // verify that the curve name is unique QString tag_name = _tagName->text(); if (!ip || (tag_name != ip->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } ip->writeLock(); ip->setTagName(KstObjectTag(tag_name, ip->tag().context())); // FIXME: doesn't allow changing tag context ip->unlock(); // then edit the object _colorOnlyDirty = true; _contourOnlyDirty = true; _colorAndContourDirty = true; _paletteDirty = true; _lowerZDirty = true; _upperZDirty = true; _realTimeAutoThresholdDirty = true; _numContourLinesDirty = true; _contourWeightDirty = true; _useVariableWeightDirty = true; _contourColorDirty = true; if (!editSingleObject(ip)) { return false; } } emit modified(); return true; }
bool KstHsDialog::editObject() { KstHistogramList hsList; hsList = kstObjectSubList<KstDataObject,KstHistogram>(KST::dataObjectList); if (_editMultipleMode) { _vectorDirty = _w->_vector->_vector->currentIndex() != 0; _nDirty = _w->N->text() != " "; _minDirty = !_w->Min->text().isEmpty(); _maxDirty = !_w->Max->text().isEmpty(); bool didEdit = false; int i; for (i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->item(i)->isSelected()) { KstHistogramList::iterator hsIter; KstHistogramPtr hsPtr; hsIter = hsList.findTag(_editMultipleWidget->_objectList->item(i)->text()); if (hsIter == hsList.end()) { return false; } hsPtr = *hsIter; if (!editSingleObject(hsPtr)) { return false; } didEdit = true; } } if (!didEdit) { QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("Select one or more objects to edit.")); return false; } } else { KstHistogramPtr hp; QString tag_name; hp = kst_cast<KstHistogram>(_dp); // // verify that the curve name is unique... // tag_name = _tagName->text(); if (!hp || (tag_name != hp->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } hp->writeLock(); hp->setTagName(tag_name); hp->unlock(); // // then edit the object... // _vectorDirty = true; _minDirty = true; _maxDirty = true; _nDirty = true; _realTimeAutoBinDirty = true; _normIsPercentDirty = true; _normIsFractionDirty = true; _peakIs1Dirty = true; _normIsNumberDirty = true; if (!editSingleObject(hp)) { return false; } } emit modified(); return true; }
bool KstBasicDialogI::newObject() { //called upon clicking 'ok' in 'new' mode //return false if the specified objects can't be made, otherwise true //Need to create a new object rather than use the one in KstDataObject pluginList KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>( KstDataObject::createPlugin(_pluginName)); Q_ASSERT(ptr); //should never happen... ptr->writeLock(); QString tagName = _tagName->text(); if (tagName != defaultTag && KstData::self()->dataTagNameNotUnique(tagName, true, this)) { _tagName->setFocus(); return false; } if (tagName == defaultTag) { tagName = KST::suggestPluginName(ptr->propertyString()); } ptr->setTagName(tagName); ptr->unlock(); // Save the vectors and scalars if (!editSingleObject(ptr) || !ptr->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the values you entered.")); return false; } //set the outputs //output vectors... QStringList ov = ptr->outputVectorList(); QStringList::ConstIterator ovI = ov.begin(); for (; ovI != ov.end(); ++ovI) { if (QLineEdit *w = output(*ovI)) { ptr->setOutputVector(*ovI, w->text()); } } //output scalars... QStringList os = ptr->outputScalarList(); QStringList::ConstIterator osI = os.begin(); for (; osI != os.end(); ++osI) { if (QLineEdit *w = output(*osI)) { ptr->setOutputScalar(*osI, w->text()); } } //ouput strings... QStringList ostr = ptr->outputStringList(); QStringList::ConstIterator ostrI = ostr.begin(); for (; ostrI != ostr.end(); ++ostrI) { if (QLineEdit *w = output(*ostrI)) { ptr->setOutputString(*ostrI, w->text()); } } if (!ptr || !ptr->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the plugin you entered.")); return false; } ptr->setDirty(); KST::dataObjectList.lock().writeLock(); KST::dataObjectList.append(ptr.data()); KST::dataObjectList.lock().unlock(); ptr = 0L; // drop the reference emit modified(); return true; }
bool KstMatrixDialogI::editObject() { // if editing multiple objects, edit each one if (_editMultipleMode) { _fileNameDirty = !_w->_fileName->url().isEmpty(); _gradientZAtMinDirty = !_w->_gradientZAtMin->text().isEmpty(); _gradientZAtMaxDirty = !_w->_gradientZAtMax->text().isEmpty(); _minXDirty = !_w->_minX->text().isEmpty(); _minYDirty = !_w->_minY->text().isEmpty(); _yStepDirty = !_w->_yStep->text().isEmpty(); _xStepDirty = !_w->_xStep->text().isEmpty(); _xStartDirty = _w->_xStart->text() != " "; _yStartDirty = _w->_yStart->text() != " "; _xNumStepsDirty = _w->_xNumSteps->text() != " "; _yNumStepsDirty = _w->_yNumSteps->text() != " "; _skipDirty = _w->_skip->text() != " "; _nXDirty = _w->_nX->text() != " "; _nYDirty = _w->_nY->text() != " "; bool didEdit = false; for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->isSelected(i)) { // get the pointer to the object KST::matrixList.lock().readLock(); KstMatrixPtr mxPtr = *KST::matrixList.findTag(_editMultipleWidget->_objectList->text(i)); KST::matrixList.lock().unlock(); if (!mxPtr) { return false; } if (!editSingleObject(mxPtr)) { return false; } didEdit = true; } } if (!didEdit) { KMessageBox::sorry(this, i18n("Select one or more objects to edit.")); return false; } } else { KstMatrixPtr mp = kst_cast<KstMatrix>(_dp); // verify that the curve name is unique QString tag_name = _tagName->text(); if (!mp || (tag_name != mp->tagName() && KstData::self()->dataTagNameNotUnique(tag_name))) { _tagName->setFocus(); return false; } mp->writeLock(); mp->setTagName(tag_name); mp->unlock(); // then edit the object _fileNameDirty = true; _fieldDirty = true; _xStartDirty = true; _xStartCountFromEndDirty = true; _yStartDirty = true; _yStartCountFromEndDirty = true; _xNumStepsDirty = true; _xNumStepsReadToEndDirty = true; _yNumStepsDirty = true; _yNumStepsReadToEndDirty = true; _gradientXDirty = true; _gradientYDirty = true; _gradientZAtMinDirty = true; _gradientZAtMaxDirty = true; _minXDirty = true; _minYDirty = true; _xStepDirty = true; _yStepDirty = true; _doSkipDirty = true; _skipDirty = true; _doAveDirty = true; _nXDirty = true; _nYDirty = true; if (!editSingleObject(mp)) { return false; } } emit modified(); return true; }
bool KstEqDialog::editObject() { KstEquationList eqList; eqList = kstObjectSubList<KstDataObject,KstEquation>(KST::dataObjectList); if (_editMultipleMode) { // // if the user selected no vector, treat it as non-dirty... // _xVectorsDirty = _w->_xVectors->_vector->currentIndex() != 0; _equationDirty = !_w->_equation->text().isEmpty(); bool didEdit = false; int i; for (i = 0; i < _editMultipleWidget->_objectList->count(); i++) { if (_editMultipleWidget->_objectList->item(i)->isSelected()) { KstEquationList::iterator eqIter; KstEquationPtr eqPtr; eqIter = eqList.findTag(_editMultipleWidget->_objectList->item(i)->text()); if (eqIter == eqList.end()) { return false; } eqPtr = *eqIter; if (!editSingleObject(eqPtr)) { return false; } didEdit = true; } } if (!didEdit) { QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("Select one or more objects to edit.")); return false; } } else { QString tagName = _tagName->text(); KstEquationPtr ep; // // verify that the curve name is unique... // ep = kst_cast<KstEquation>(_dp); if (!ep || (tagName != ep->tagName() && KstData::self()->dataTagNameNotUnique(tagName))) { _tagName->setFocus(); return false; } ep->writeLock(); ep->setTagName(tagName); ep->unlock(); // // then edit the object... // _equationDirty = true; _xVectorsDirty = true; _doInterpolationDirty = true; if (!editSingleObject(ep)) { return false; } } emit modified(); return true; }