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); } }
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); } }
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; } } }
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); } }
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); }
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); }
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); } }
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); } }
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); } }
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); }
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); } }
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); } }