[Kst] branches/work/kst/1.5/kst/src/extensions/js

Andrew Walker arwalker at sumusltd.com
Wed Jul 25 21:57:46 CEST 2007


SVN commit 692540 by arwalker:

CCBUG:148038 SILENT make label objects accessible via javaScript

 M  +3 -0      Makefile.am  
 M  +27 -1     bind_axis.cpp  
 M  +8 -0      bind_axis.h  
 A             bind_axislabel.cpp   [License: GPL (v2+)]
 A             bind_axislabel.h   [License: GPL (v2+)]
 A             bind_axisticklabel.cpp   [License: GPL (v2+)]
 A             bind_axisticklabel.h   [License: GPL (v2+)]
 M  +15 -1     bind_plot.cpp  
 M  +5 -0      bind_plot.h  
 A             bind_plotlabel.cpp   [License: GPL (v2+)]
 A             bind_plotlabel.h   [License: GPL (v2+)]


--- branches/work/kst/1.5/kst/src/extensions/js/Makefile.am #692539:692540
@@ -84,6 +84,9 @@
 			    bind_size.cpp \
 			    bind_box.cpp \
 			    bind_label.cpp \
+			    bind_axisticklabel.cpp \
+			    bind_axislabel.cpp \
+			    bind_plotlabel.cpp \
 			    bind_legend.cpp \
 			    bind_ellipse.cpp \
 			    bind_picture.cpp \
--- branches/work/kst/1.5/kst/src/extensions/js/bind_axis.cpp #692539:692540
@@ -16,6 +16,8 @@
  ***************************************************************************/
 
 #include "bind_axis.h"
+#include "bind_axislabel.h"
+#include "bind_axisticklabel.h"
 #include "bind_timeinterpretation.h"
 
 #include <kst.h>
@@ -82,6 +84,8 @@
   { "label", &KstBindAxis::setLabel, &KstBindAxis::label },
   { "type", 0L, &KstBindAxis::type },
   { "interpretation", 0L, &KstBindAxis::interpretation },
+  { "title", 0L, &KstBindAxis::title },
+  { "tickLabel", 0L, &KstBindAxis::tickLabel },
   { 0L, 0L, 0L }
 };
 
@@ -135,7 +139,7 @@
       return (this->*axisProperties[i].get)(exec);
     }
   }
-  
+
   return KstBinding::get(exec, propertyName);
 }
 
@@ -173,6 +177,28 @@
 }
 
 
+KJS::Value KstBindAxis::title(KJS::ExecState *exec) const {
+  if (!_d) {
+    KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
+    exec->setException(eobj);
+    return KJS::Undefined();
+  }
+  KstReadLocker rl(_d);
+  return KJS::Object(new KstBindAxisLabel(exec, _d, _xAxis));
+}
+
+
+KJS::Value KstBindAxis::tickLabel(KJS::ExecState *exec) const {
+  if (!_d) {
+    KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
+    exec->setException(eobj);
+    return KJS::Undefined();
+  }
+  KstReadLocker rl(_d);
+  return KJS::Object(new KstBindAxisTickLabel(exec, _d, _xAxis));
+}
+
+
 KJS::Value KstBindAxis::label(KJS::ExecState *exec) const {
   if (!_d) {
     KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
--- branches/work/kst/1.5/kst/src/extensions/js/bind_axis.h #692539:692540
@@ -173,6 +173,14 @@
                     displayed.
      */
     KJS::Value interpretation(KJS::ExecState *exec) const;
+    /* @property AxisLabel label
+       @description The label for this axis.
+    */
+    KJS::Value title(KJS::ExecState *exec) const;
+    /* @property AxisTickLabel label
+       @description The tick label for this axis.
+    */
+    KJS::Value tickLabel(KJS::ExecState *exec) const;
 
   protected:
     friend class KstBindTimeInterpretation;
--- branches/work/kst/1.5/kst/src/extensions/js/bind_plot.cpp #692539:692540
@@ -16,9 +16,12 @@
  ***************************************************************************/
 
 #include "bind_plot.h"
+#include "bind_plotlabel.h"
 #include "bind_axis.h"
 #include "bind_curvecollection.h"
+#include "bind_label.h"
 #include "bind_legend.h"
+#include "bind_axislabel.h"
 
 #include <kst2dplot.h>
 #include <kstplotlabel.h>
@@ -117,6 +120,7 @@
   { "topLabel", &KstBindPlot::setTopLabel, &KstBindPlot::topLabel },
   { "xAxis", 0L, &KstBindPlot::xAxis },
   { "yAxis", 0L, &KstBindPlot::yAxis },
+  { "title", 0L, &KstBindPlot::title },
   { "tied", &KstBindPlot::setTied, &KstBindPlot::tied },
   { 0L, 0L, 0L }
 };
@@ -277,7 +281,6 @@
 
 
 KJS::Value KstBindPlot::xAxis(KJS::ExecState *exec) const {
-  Q_UNUSED(exec)
   Kst2DPlotPtr d = makePlot(_d);
   if (d) {
     KstReadLocker rl(d);
@@ -298,6 +301,17 @@
 }
 
 
+KJS::Value KstBindPlot::title(KJS::ExecState *exec) const {
+  Q_UNUSED(exec)
+  Kst2DPlotPtr d = makePlot(_d);
+  if (d) {
+    KstReadLocker rl(d);
+    return KJS::Object(new KstBindPlotLabel(exec, d));
+  }
+  return KJS::Object();
+}
+
+
 KJS::Value KstBindPlot::createLegend(KJS::ExecState *exec, const KJS::List& args) {
   Kst2DPlotPtr d = makePlot(_d);
   if (!d) {
--- branches/work/kst/1.5/kst/src/extensions/js/bind_plot.h #692539:692540
@@ -83,6 +83,11 @@
        @description The Y-axis for this plot.
     */
     KJS::Value yAxis(KJS::ExecState *exec) const;
+    /* @property PlotLabel title
+       @readonly
+       @description The title for this plot.
+    */
+    KJS::Value title(KJS::ExecState *exec) const;
     /* @property boolean tied
        @description True if the plot zoom state is tied.
     */


More information about the Kst mailing list