コード例 #1
0
KstObjectItem::KstObjectItem(QListView *parent, KstSMatrixPtr x, KstDataManagerI *dm, int localUseCount) 
: QObject(), QListViewItem(parent), _rtti(RTTI_OBJ_STATIC_MATRIX), _name(x->tagName()), _dm(dm) {
  assert(x);
  _inUse = false;
  setText(0, x->tagName());
  setText(1, i18n("Static Matrix"));
  x = 0L; // keep the counts in sync
  update(true, localUseCount);
}
コード例 #2
0
bool KstMatrixDialogI::editSingleSMatrix(KstSMatrixPtr smp) {
  bool xDirection, ok5, ok6;
  double gradientZAtMin, gradientZAtMax;
  int nX, nY;
  double xMin, yMin, xStepSize, yStepSize;
  bool ok1 = true, ok2 = true, ok3 = true, ok4 = true;

  smp->readLock();
  if (_xStepDirty) {
    xStepSize = _w->_xStep->text().toDouble(&ok1);
  } else {
    xStepSize = smp->xStepSize();
  }

  if (_yStepDirty) {
    yStepSize = _w->_yStep->text().toDouble(&ok2);
  } else {
    yStepSize = smp->yStepSize();
  }

  if (_minXDirty) {
    xMin = _w->_minX->text().toDouble(&ok3);
  } else {
    xMin = smp->minX();
  }

  if (_minYDirty) {
    yMin = _w->_minY->text().toDouble(&ok4);
  } else {
    yMin = smp->minY();
  }

  if (_gradientXDirty || _gradientYDirty) {
    xDirection = _w->_gradientX->isChecked();
  } else {
    xDirection = smp->xDirection();
  }
  if (_gradientZAtMinDirty) {
    gradientZAtMin = _w->_gradientZAtMin->text().toDouble(&ok5);
  } else {
    gradientZAtMin = smp->gradZMin();
  }
  if (_gradientZAtMaxDirty) {
    gradientZAtMax = _w->_gradientZAtMax->text().toDouble(&ok6);
  } else {
    gradientZAtMax = smp->gradZMax();
  }
  if (_nXDirty) {
    nX = _w->_nX->value();
  } else {
    nX = smp->xNumSteps();
  }
  if (_nYDirty) {
    nY = _w->_nY->value();
  } else {
    nY = smp->yNumSteps();
  }
  smp->unlock();
  if (!ok5 || !ok6) {
    KMessageBox::sorry(this, i18n("Gradient values are invalid.  Ensure only decimal values are entered."));
    return false;
  }
  // check the other parameters
  if (!checkParameters(ok1, ok2, ok3, ok4, xStepSize, yStepSize)) {
    return false;
  }

  smp->writeLock();
  smp->change(smp->tagName(), nX, nY, xMin, yMin, xStepSize, yStepSize, gradientZAtMin, gradientZAtMax, xDirection);
  smp->unlock();

  return true;
}