[Kst] extragear/graphics/kst/kst/extensions/js

George Staikos staikos at kde.org
Fri Dec 9 04:03:48 CET 2005


SVN commit 486872 by staikos:

add tied property


 M  +1 -1      TODO  
 M  +1 -2      bind_curvecollection.cpp  
 M  +27 -0     bind_plot.cpp  
 M  +6 -1      bind_plot.h  


--- trunk/extragear/graphics/kst/kst/extensions/js/TODO #486871:486872
@@ -24,8 +24,8 @@
 - No image binding
 - line and arrow orientations don't fully work
 - plot properties are really weak
+   - make an axis class to hold axis properties?
 - "delete" support - in order drop references?
 - Do we expose the "kst" object?  If not, we need to add some additional things
  like exit()
-- Legend object is incomplete
 - Make .position and .size directly manipulated?
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_curvecollection.cpp #486871:486872
@@ -157,8 +157,7 @@
     }
     KstWriteLocker rl(p);
     if (!p->Curves.contains(c.data())) {
-      p->Curves.append(c.data());
-      p->setDirty();
+      p->addCurve(c.data());
       KstApp::inst()->paintAll(KstPainter::P_PAINT);
     }
     return KJS::Undefined();
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_plot.cpp #486871:486872
@@ -116,6 +116,7 @@
   { "topLabel", &KstBindPlot::setTopLabel, &KstBindPlot::topLabel },
   { "xLabel", &KstBindPlot::setXLabel, &KstBindPlot::xLabel },
   { "yLabel", &KstBindPlot::setYLabel, &KstBindPlot::yLabel },
+  { "tied", &KstBindPlot::setTied, &KstBindPlot::tied },
   { 0L, 0L, 0L }
 };
 
@@ -345,6 +346,32 @@
 }
 
 
+void KstBindPlot::setTied(KJS::ExecState *exec, const KJS::Value& value) {
+  if (value.type() != KJS::BooleanType) {
+    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
+    exec->setException(eobj);
+    return;
+  }
+  Kst2DPlotPtr d = makePlot(_d);
+  if (d) {
+    KstWriteLocker wl(d);
+    d->setTied(value.toBoolean(exec));
+    KstApp::inst()->paintAll(KstPainter::P_PAINT);
+  }
+}
+
+
+KJS::Value KstBindPlot::tied(KJS::ExecState *exec) const {
+  Q_UNUSED(exec)
+  Kst2DPlotPtr d = makePlot(_d);
+  if (d) {
+    KstReadLocker rl(d);
+    return KJS::Boolean(d->isTied());
+  }
+  return KJS::Boolean(false);
+}
+
+
 #undef makePlot
 
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_plot.h #486871:486872
@@ -59,7 +59,7 @@
     KJS::Value curves(KJS::ExecState *exec) const;
     /* @property Legend legend
        @readonly
-       @description The Legend for this plot.
+       @description The Legend for this plot.  May be null.
     */
     KJS::Value legend(KJS::ExecState *exec) const;
     /* @method Legend createLegend
@@ -82,6 +82,11 @@
     */
     void setYLabel(KJS::ExecState *exec, const KJS::Value& value);
     KJS::Value yLabel(KJS::ExecState *exec) const;
+    /* @property boolean tied
+       @description True if the plot zoom state is tied.
+    */
+    void setTied(KJS::ExecState *exec, const KJS::Value& value);
+    KJS::Value tied(KJS::ExecState *exec) const;
 
   protected:
     KstBindPlot(int id);


More information about the Kst mailing list