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; }
void KstEqDialogI::populateEditMultiple() { // list of objects KstEquationList eqlist = kstObjectSubList<KstDataObject,KstEquation>(KST::dataObjectList); _editMultipleWidget->_objectList->insertStringList(eqlist.tagNames()); // also intermediate state for multiple edit _w->_xVectors->_vector->insertItem("", 0); _w->_xVectors->_vector->setCurrentItem(0); _w->_doInterpolation->setTristate(true); _w->_doInterpolation->setNoChange(); _w->_equation->setText(""); // and clean all the fields _equationDirty = false; _xVectorsDirty = false; _doInterpolationDirty = false; }
void KstEqDialog::populateEditMultiple() { KstEquationList eqList; eqList = kstObjectSubList<KstDataObject,KstEquation>(KST::dataObjectList); _editMultipleWidget->_objectList->insertItems(0, eqList.tagNames()); // // also intermediate state for multiple edit... // _w->_xVectors->_vector->insertItem(0, ""); _w->_xVectors->_vector->setCurrentIndex(0); _w->_doInterpolation->setTristate(true); _w->_doInterpolation->setChecked(Qt::PartiallyChecked); _w->_equation->setText(""); // // and clean all the fields... // _equationDirty = false; _xVectorsDirty = false; _doInterpolationDirty = false; }
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; }