[Kst] branches/work/kst/hierarchy/kst/src

Eli Fidler eli at staikos.net
Sat Dec 16 00:17:35 CET 2006


SVN commit 613996 by fidler:

merge trunk 612791:613686



 M  +43 -5     libkstapp/kst.cpp  
 M  +1 -0      libkstapp/kst.h  
 M  +0 -1      plugins/interpolations/Makefile.am  
 M  +8 -8      plugins/interpolations/akima/Makefile.am  
 A             plugins/interpolations/akima/akima.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/akima/akima.cpp#613686
 A             plugins/interpolations/akima/akima.h   trunk/extragear/graphics/kst/src/plugins/interpolations/akima/akima.h#613686
 D             plugins/interpolations/akima/kstinterp_akima.cpp  
 D             plugins/interpolations/akima/kstinterp_akima.xml  
 A             plugins/interpolations/akima/kstobject_akima.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/akima/kstobject_akima.desktop#613686
 M  +8 -8      plugins/interpolations/akima_periodic/Makefile.am  
 A             plugins/interpolations/akima_periodic/akima_periodic.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/akima_periodic/akima_periodic.cpp#613686
 A             plugins/interpolations/akima_periodic/akima_periodic.h   trunk/extragear/graphics/kst/src/plugins/interpolations/akima_periodic/akima_periodic.h#613686
 D             plugins/interpolations/akima_periodic/kstinterp_akima_periodic.cpp  
 D             plugins/interpolations/akima_periodic/kstinterp_akima_periodic.xml  
 A             plugins/interpolations/akima_periodic/kstobject_akima_periodic.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/akima_periodic/kstobject_akima_periodic.desktop#613686
 M  +8 -8      plugins/interpolations/cspline/Makefile.am  
 A             plugins/interpolations/cspline/cspline.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline/cspline.cpp#613686
 A             plugins/interpolations/cspline/cspline.h   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline/cspline.h#613686
 D             plugins/interpolations/cspline/kstinterp_cspline.cpp  
 D             plugins/interpolations/cspline/kstinterp_cspline.xml  
 A             plugins/interpolations/cspline/kstobject_cspline.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline/kstobject_cspline.desktop#613686
 M  +8 -8      plugins/interpolations/cspline_periodic/Makefile.am  
 A             plugins/interpolations/cspline_periodic/cspline_periodic.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline_periodic/cspline_periodic.cpp#613686
 A             plugins/interpolations/cspline_periodic/cspline_periodic.h   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline_periodic/cspline_periodic.h#613686
 D             plugins/interpolations/cspline_periodic/kstinterp_cspline_periodic.cpp  
 D             plugins/interpolations/cspline_periodic/kstinterp_cspline_periodic.xml  
 A             plugins/interpolations/cspline_periodic/kstobject_cspline_periodic.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/cspline_periodic/kstobject_cspline_periodic.desktop#613686
 M  +42 -55    plugins/interpolations/interpolations.h  
 M  +8 -8      plugins/interpolations/linear/Makefile.am  
 D             plugins/interpolations/linear/kstinterp_linear.cpp  
 D             plugins/interpolations/linear/kstinterp_linear.xml  
 A             plugins/interpolations/linear/kstobject_linear.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/linear/kstobject_linear.desktop#613686
 A             plugins/interpolations/linear/linear.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/linear/linear.cpp#613686
 A             plugins/interpolations/linear/linear.h   trunk/extragear/graphics/kst/src/plugins/interpolations/linear/linear.h#613686
 M  +8 -8      plugins/interpolations/polynomial/Makefile.am  
 D             plugins/interpolations/polynomial/kstinterp_polynomial.cpp  
 D             plugins/interpolations/polynomial/kstinterp_polynomial.xml  
 A             plugins/interpolations/polynomial/kstobject_polynomial.desktop   trunk/extragear/graphics/kst/src/plugins/interpolations/polynomial/kstobject_polynomial.desktop#613686
 A             plugins/interpolations/polynomial/polynomial.cpp   trunk/extragear/graphics/kst/src/plugins/interpolations/polynomial/polynomial.cpp#613686
 A             plugins/interpolations/polynomial/polynomial.h   trunk/extragear/graphics/kst/src/plugins/interpolations/polynomial/polynomial.h#613686


--- branches/work/kst/hierarchy/kst/src/libkstapp/kst.cpp #613995:613996
@@ -561,8 +561,7 @@
   /************/
   PluginDialogAction = new KAction(i18n("New &Plugin..."),
                                   "kst_pluginnew", 0,
-                                   KstPluginDialogI::globalInstance(),
-                                   SLOT(show()), actionCollection(),
+                                   this, SLOT(selectDataPlugin()), actionCollection(),
                                    "plugindialog_action");
   PluginDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                         "to create a new plugin instance."));
@@ -620,6 +619,7 @@
                                        "viewscalarsdialog_action");
   ViewScalarsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                             "to view scalar values."));
+  ViewScalarsDialogAction->setEnabled(false);
 
   /************/
   ViewStringsDialogAction = new KAction(i18n("View Strin&g Values"),
@@ -638,6 +638,7 @@
                                        "viewvectorsdialog_action");
   ViewVectorsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                             "to view vector values."));
+  ViewVectorsDialogAction->setEnabled(false);
 
   /************/
   ViewMatricesDialogAction = new KAction(i18n("View &Matrix Values"),
@@ -647,6 +648,7 @@
                                        "viewmatricesdialog_action");
   ViewMatricesDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                             "to view matrix values."));
+  ViewMatricesDialogAction->setEnabled(false);
 
   /************/
   ViewFitsDialogAction = new KAction(i18n("View &Fit Results"),
@@ -656,6 +658,7 @@
                                        "viewfitsdialog_action");
   ViewFitsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                             "to view fit values."));
+  ViewFitsDialogAction->setEnabled(false);
 
   /************/
   ChangeNptsDialogAction = new KAction(i18n("Change Data Sample &Ranges..."),
@@ -975,6 +978,43 @@
 }
 
 
+void KstApp::selectDataPlugin() {
+  QStringList l;
+
+  //The new KstDataObject plugins...
+  const QStringList newPlugins = KstDataObject::pluginList();
+  l += newPlugins;
+
+  //The old C style plugins...
+  QStringList oldPlugins;
+
+  const QMap<QString,QString> readable =
+    PluginCollection::self()->readableNameList();
+  QMap<QString,QString>::const_iterator it = readable.begin();
+  for (; it != readable.end(); ++it) {
+    oldPlugins << it.key();
+  }
+
+  l += oldPlugins;
+
+  bool ok = false;
+  QStringList plugin =
+      KInputDialog::getItemList( i18n( "Data Plugins" ), i18n( "Create..." ), l, 0, false, &ok, this );
+
+  if ( !ok || plugin.isEmpty() )
+    return;
+
+  const QString p = plugin.join("");
+
+  if ( newPlugins.contains( p ) ) {
+    KstDataObjectPtr ptr = KstDataObject::plugin(p);
+    ptr->showDialog();
+  } else if ( oldPlugins.contains( p ) ) {
+      KstPluginDialogI::globalInstance()->showNew(readable[p]);
+  }
+}
+
+
 void KstApp::forceUpdate() {
   _updateThread->forceUpdate();
 }
@@ -2192,12 +2232,10 @@
     if (!onlyVisible || changeNptsDialog->isShown()) {
       changeNptsDialog->updateChangeNptsDialog();
     }
-    if (!onlyVisible) { // FIXME: might want to make this sensible one day
-      updateDataDialogs(false);
-    }
     if (!onlyVisible || vectorSaveDialog->isShown()) {
       vectorSaveDialog->init();
     }
+    updateDataDialogs(false);
     updateDataManager(onlyVisible);
     updateViewManager(onlyVisible);
 #ifdef BENCHMARK
--- branches/work/kst/hierarchy/kst/src/libkstapp/kst.h #613995:613996
@@ -225,6 +225,7 @@
     void showContextMenu(QWidget *w, const QPoint& pos);
     void showContextMenu(const QPoint& pos);
     void delayedDocInit();
+    void selectDataPlugin();
 
   public slots:
     void fromEnd();
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/Makefile.am #613995:613996
@@ -1,2 +1 @@
 SUBDIRS=linear cspline cspline_periodic akima akima_periodic polynomial
-
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/akima/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_akima.la
+kde_module_LTLIBRARIES=kstobject_akima.la
 
-kstinterp_akima_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_akima_la_LIBADD = $(GSL_LIBS)
-kstinterp_akima_la_SOURCES = kstinterp_akima.cpp
+kstobject_akima_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_akima_la_SOURCES=akima.cpp
+kstobject_akima_la_LIBADD = $(GSL_LIBS)
 
-METASOURCES=AUTO
+services_DATA=kstobject_akima.desktop
+servicesdir=$(kde_servicesdir)/kst
 
-install_DATA=kstinterp_akima.xml
+METASOURCES=AUTO
\ No newline at end of file
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/akima_periodic/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_akima_periodic.la
+kde_module_LTLIBRARIES=kstobject_akima_periodic.la
 
-kstinterp_akima_periodic_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_akima_periodic_la_LIBADD = $(GSL_LIBS)
-kstinterp_akima_periodic_la_SOURCES = kstinterp_akima_periodic.cpp
+kstobject_akima_periodic_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_akima_periodic_la_SOURCES=akima_periodic.cpp
+kstobject_akima_periodic_la_LIBADD = $(GSL_LIBS)
 
+services_DATA=kstobject_akima_periodic.desktop
+servicesdir=$(kde_servicesdir)/kst
+
 METASOURCES=AUTO
-
-install_DATA=kstinterp_akima_periodic.xml
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/cspline/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_cspline.la
+kde_module_LTLIBRARIES=kstobject_cspline.la
 
-kstinterp_cspline_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_cspline_la_LIBADD = $(GSL_LIBS)
-kstinterp_cspline_la_SOURCES = kstinterp_cspline.cpp
+kstobject_cspline_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_cspline_la_SOURCES=cspline.cpp
+kstobject_cspline_la_LIBADD = $(GSL_LIBS)
 
-METASOURCES=AUTO
+services_DATA=kstobject_cspline.desktop
+servicesdir=$(kde_servicesdir)/kst
 
-install_DATA=kstinterp_cspline.xml
+METASOURCES=AUTO
\ No newline at end of file
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/cspline_periodic/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_cspline_periodic.la
+kde_module_LTLIBRARIES=kstobject_cspline_periodic.la
 
-kstinterp_cspline_periodic_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_cspline_periodic_la_LIBADD = $(GSL_LIBS)
-kstinterp_cspline_periodic_la_SOURCES = kstinterp_cspline_periodic.cpp
+kstobject_cspline_periodic_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_cspline_periodic_la_SOURCES=cspline_periodic.cpp
+kstobject_cspline_periodic_la_LIBADD = $(GSL_LIBS)
 
+services_DATA=kstobject_cspline_periodic.desktop
+servicesdir=$(kde_servicesdir)/kst
+
 METASOURCES=AUTO
-
-install_DATA=kstinterp_cspline_periodic.xml
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/interpolations.h #613995:613996
@@ -4,75 +4,62 @@
  *  Released under the terms of the GPL.
  */
 
-#define KST_UNUSED(x) if(x){};
+#define X           0
+#define Y           1
+#define X_INTERP    2
 
-#define X 					0
-#define Y 					1
-#define X_INTERP 		2
+#include <kstvector.h>
 
-int interpolate(
-  const double *const inArrays[], 
-  const int inArrayLens[],
-  const double inScalars[],
-  double *outArrays[], 
-  int outArrayLens[],
-	double outScalars[],
-  const gsl_interp_type* pType);
+bool interpolate(KstVectorPtr x_array,
+                 KstVectorPtr y_array,
+                 KstVectorPtr x1_array,
+                 KstVectorPtr y_interpolated,
+                 const gsl_interp_type* pType) {
 
-int interpolate(
-  const double *const inArrays[], 
-  const int inArrayLens[],
-  const double inScalars[],
-  double *outArrays[], 
-  int outArrayLens[],
-	double outScalars[],
-  const gsl_interp_type* pType) {
-  
-  KST_UNUSED( inScalars )
-  KST_UNUSED( outScalars )
-  
-  gsl_interp_accel*	pAccel = NULL;
-  gsl_interp*				pInterp = NULL;
-  gsl_spline*				pSpline = NULL;
-  int i = 0;
+  gsl_interp_accel *pAccel = NULL;
+  gsl_interp *pInterp = NULL;
+  gsl_spline *pSpline = NULL;
   int iLengthData;
-  int	iLengthInterp;
-  int iReturn = -1;
+  int iLengthInterp;
+  bool iReturn = false;
   double* pResult[1];
-  
-  iLengthData = inArrayLens[X];
-  if( inArrayLens[Y] < iLengthData ) {
-    iLengthData = inArrayLens[Y];
+
+  iLengthData = x_array->length();
+  if (y_array->length() < iLengthData) {
+    iLengthData = y_array->length();
   }
-  
-  iLengthInterp = inArrayLens[X_INTERP];
-  if( iLengthInterp > 0 ) {
-    if( outArrayLens[0] != iLengthInterp ) {
-      pResult[0] = (double*)realloc( outArrays[0], iLengthInterp * sizeof( double ) );
+
+  iLengthInterp = x1_array->length();
+  if (iLengthInterp > 0) {
+    if (y_interpolated->length() != iLengthInterp) {
+      y_interpolated->resize(iLengthInterp, true);
+      pResult[0] = (double*)realloc( y_interpolated->value(), iLengthInterp * sizeof( double ) );
     } else {
-      pResult[0] = outArrays[0];
+      pResult[0] = y_interpolated->value();
     }
-    
-    if( pResult[0] != NULL ) {
-      outArrays[0] = pResult[0];
-      outArrayLens[0] = iLengthInterp;
-     
+
+    if (pResult[0] != NULL) {
+
+      for (int i = 0; i < iLengthInterp; ++i) {
+        y_interpolated->value()[i] = pResult[0][i];
+      }
+
       pInterp = gsl_interp_alloc( pType, iLengthData );
-      if( pInterp != NULL ) {
+      if (pInterp != NULL) {
         //
         // check that we have enough data points...
         //
-        if( (unsigned int)iLengthData > gsl_interp_min_size( pInterp ) ) {    
+        if ((unsigned int)iLengthData > gsl_interp_min_size( pInterp )) {
           pAccel  = gsl_interp_accel_alloc( );
-          if( pAccel != NULL ) {
+          if (pAccel != NULL) {
             pSpline = gsl_spline_alloc( pType, iLengthData );
-            if( pSpline != NULL ) {
-              if( !gsl_spline_init( pSpline, inArrays[X], inArrays[Y], iLengthData ) ) {
-                for( i=0; i<iLengthInterp; i++ ) {
-                  outArrays[0][i] = gsl_spline_eval( pSpline, inArrays[X_INTERP][i], pAccel );
+            if (pSpline != NULL) {
+              if (!gsl_spline_init( pSpline, x_array->value(), y_array->value(), iLengthData )) {
+                for( int i=0; i<iLengthInterp; i++) {
+                  y_interpolated->value()[i] = gsl_spline_eval( pSpline, x1_array->value()[i], pAccel );
                 }
-                
-                iReturn = 0;
+
+                iReturn = true;
               }
               gsl_spline_free( pSpline );
             }
@@ -83,6 +70,6 @@
       }
     }
   }
-  
+
   return iReturn;
 }
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/linear/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_linear.la
+kde_module_LTLIBRARIES=kstobject_linear.la
 
-kstinterp_linear_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_linear_la_LIBADD = $(GSL_LIBS)
-kstinterp_linear_la_SOURCES = kstinterp_linear.cpp
+kstobject_linear_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_linear_la_SOURCES=linear.cpp
+kstobject_linear_la_LIBADD = $(GSL_LIBS)
 
-METASOURCES=AUTO
+services_DATA=kstobject_linear.desktop
+servicesdir=$(kde_servicesdir)/kst
 
-install_DATA=kstinterp_linear.xml
+METASOURCES=AUTO
\ No newline at end of file
--- branches/work/kst/hierarchy/kst/src/plugins/interpolations/polynomial/Makefile.am #613995:613996
@@ -1,12 +1,12 @@
-installdir=$(kde_moduledir)/kstplugins
-INCLUDES=-I$(srcdir)/../../../kst $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
 
-install_LTLIBRARIES = kstinterp_polynomial.la
+kde_module_LTLIBRARIES=kstobject_polynomial.la
 
-kstinterp_polynomial_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-kstinterp_polynomial_la_LIBADD = $(GSL_LIBS)
-kstinterp_polynomial_la_SOURCES = kstinterp_polynomial.cpp
+kstobject_polynomial_la_LDFLAGS=$(all_libraries) -module -avoid-version
+kstobject_polynomial_la_SOURCES=polynomial.cpp
+kstobject_polynomial_la_LIBADD = $(GSL_LIBS)
 
-METASOURCES=AUTO
+services_DATA=kstobject_polynomial.desktop
+servicesdir=$(kde_servicesdir)/kst
 
-install_DATA=kstinterp_polynomial.xml
+METASOURCES=AUTO
\ No newline at end of file


More information about the Kst mailing list