コード例 #1
0
void KstBindLine::setLineStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    return createPropertyTypeError(exec);
  }
  KstViewLinePtr d = makeLine(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (w) {
      case 0:
        d->setPenStyle(Qt::SolidLine);
        break;
      case 1:
        d->setPenStyle(Qt::DashLine);
        break;
      case 2:
        d->setPenStyle(Qt::DotLine);
        break;
      case 3:
        d->setPenStyle(Qt::DashDotLine);
        break;
      case 4:
        d->setPenStyle(Qt::DashDotDotLine);
        break;
      default:
        return createPropertyRangeError(exec);
    }
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
コード例 #2
0
void KstBindCubicBezier::setLineStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstViewBezierPtr d = makeBezier(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (w) {
      case 0:
        d->setPenStyle(Qt::SolidLine);
        break;
      case 1:
        d->setPenStyle(Qt::DashLine);
        break;
      case 2:
        d->setPenStyle(Qt::DotLine);
        break;
      case 3:
        d->setPenStyle(Qt::DashDotLine);
        break;
      case 4:
        d->setPenStyle(Qt::DashDotDotLine);
        break;
      default:
        return;
    }
    KstApp::inst()->paintAll(P_PAINT);
  }
}
コード例 #3
0
void KstBindImage::setMap(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned i = 0;

  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    return createPropertyTypeError(exec);
  }

  if (i > 2) {
    return createPropertyRangeError(exec);
  }

  KstImagePtr d = makeImage(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (i) {
      case 0:
        d->setHasContourMap(false);
        d->setHasColorMap(true);
        break;
      case 1:
        d->setHasContourMap(true);
        d->setHasColorMap(false);
        break;
      case 2:
        d->setHasContourMap(true);
        d->setHasColorMap(true);
        break;
    }
  }
}
コード例 #4
0
void KstBindLine::setCapStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstViewLinePtr d = makeLine(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (w) {
      case 0:
        d->setCapStyle(Qt::FlatCap);
        break;
      case 1:
        d->setCapStyle(Qt::SquareCap);
        break;
      case 2:
        d->setCapStyle(Qt::RoundCap);
        break;
      default:
        return;
    }
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
コード例 #5
0
void KstBindSize::setW(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned int w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  _sz.setWidth(w);
}
コード例 #6
0
void KstBindTimeInterpretation::setOutput(KJS::ExecState *exec, const KJS::Value& value) {
  if (!_d) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
    exec->setException(eobj);
    return;
  }
  unsigned i = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstWriteLocker wl(_d->_d);
  bool isIt;
  KstAxisInterpretation interp;
  KstAxisDisplay disp, newDisp;
  switch (i) {
    default:
    case 0:
      newDisp = AXIS_DISPLAY_DDMMYYHHMMSS_SS;
      break;
    case 1:
      newDisp = AXIS_DISPLAY_YYMMDDHHMMSS_SS;
      break;
    case 2:
      newDisp = AXIS_DISPLAY_JD;
      break;
    case 3:
      newDisp = AXIS_DISPLAY_MJD;
      break;
    case 4:
      newDisp = AXIS_DISPLAY_RJD;
      break;
    case 5:
      newDisp = AXIS_DISPLAY_YEAR;
      break;
    case 6:
      newDisp = AXIS_DISPLAY_KDE_SHORTDATE;
      break;
    case 7:
      newDisp = AXIS_DISPLAY_KDE_LONGDATE;
      break;
  }
    
  if (_d->_xAxis) {
    _d->_d->getXAxisInterpretation(isIt, interp, disp);
    _d->_d->setXAxisInterpretation(isIt, interp, newDisp);
  } else {
    _d->_d->getYAxisInterpretation(isIt, interp, disp);
    _d->_d->setYAxisInterpretation(isIt, interp, newDisp);
  }
  _d->_d->setDirty();
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
}
コード例 #7
0
void KstBindLegend::setFontSize(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned int i = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    return createPropertyTypeError(exec);
  }
  KstViewLegendPtr d = makeLegend(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setFontSize(i);
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
コード例 #8
0
void KstBindLine::setWidth(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    return createPropertyTypeError(exec);
  }
  KstViewLinePtr d = makeLine(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setWidth(w);
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
コード例 #9
0
void KstBindCurve::setBarStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned i = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstVCurvePtr d = makeCurve(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setBarStyle(i);
  }
}
コード例 #10
0
void KstBindPlotLabel::setDataPrecision(KJS::ExecState *exec, const KJS::Value& value) {
  uint i = 0;
  if (!_d) {
    return createPropertyInternalError(exec);
  }
  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    return createPropertyTypeError(exec);
  }
  KstWriteLocker wl(_d);
  _d->topLabel()->setDataPrecision(i);
  _d->setDirty();
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
}
コード例 #11
0
void KstBindPowerSpectrum::setLength(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned val;
  if (value.type() != KJS::NumberType || !value.toUInt32(val)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstPSDPtr d = makePSD(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setLen(val);
  }
}
コード例 #12
0
void KstBindEllipse::setBorderWidth(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstViewEllipsePtr d = makeEllipse(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setBorderWidth(w);
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}