示例#1
0
void KstBindCurve::setXVector(KJS::ExecState *exec, const KJS::Value& value) {
  KstVectorPtr vp = extractVector(exec, value);
  if (vp) {
    KstVCurvePtr d = makeCurve(_d);
    if (d) {
      KstWriteLocker wl(d);
      d->setXVector(vp);
    }
  }
}
示例#2
0
void KstCurveDialogI::edit_I() {
  int index;
  KstVCurvePtr curve;

  KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
  index = Select->currentItem();
  if (index < 0 || unsigned(index) >= curves.count()) {
    new_I();
    return;
  }

  QString tag_name = Select->currentText();

  /* verify that the curve name is unique */
  if (tag_name != curves[index]->tagName()) {
    if (KST::dataTagNameNotUnique(tag_name)) {
      Select->setFocus();
      return;
    }
  }

  curve = curves[index];
  curve->setTagName(tag_name);

  { // leave this scope here to destroy the iterator
    KstReadLocker ml(&KST::vectorList.lock());
    KstVectorList::Iterator i = KST::vectorList.findTag(_xVector->selectedVector());
    if (i != KST::vectorList.end())
      curve->setXVector(*i);

    i = KST::vectorList.findTag(_yVector->selectedVector());
    if (i != KST::vectorList.end())
      curve->setYVector(*i);

    i = KST::vectorList.findTag(_xError->selectedVector());
    curve->setXError(*i);

    i = KST::vectorList.findTag(_yError->selectedVector());
    curve->setYError(*i);
  }

  curve->setColor(_curveAppearance->color());
  curve->setHasPoints(_curveAppearance->showPoints());
  curve->setHasLines(_curveAppearance->showLines());
  curve->setLineWidth(_curveAppearance->lineWidth());
  curve->setLineStyle(_curveAppearance->lineStyle());
  curve->Point.setType(_curveAppearance->pointType());

  curve->update(-1);
  curve = 0L;
  curves.clear();
  emit modified();
}