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

Duncan Hanson duncan.hanson at gmail.com
Wed May 16 01:01:29 CEST 2007


SVN commit 665128 by dhanson:

CCBUG:86915 first draft of KstVectorView. Currently, scalars are connected to the VectorView via signals. I'd like to just check them in the update loop, but this doesn't seem to work right now.

 M  +2 -0      libkstapp/Makefile.am  
 M  +9 -0      libkstapp/dialoglauncher-gui.cpp  
 M  +2 -0      libkstapp/dialoglauncher-gui.h  
 M  +5 -0      libkstapp/kst.cpp  
 M  +2 -0      libkstapp/kst.h  
 M  +2 -0      libkstapp/kstdatamanager_i.cpp  
 M  +5 -0      libkstapp/kstdoc.cpp  
 A             libkstapp/kstvvdialog_i.cpp   [License: GPL (v2+)]
 A             libkstapp/kstvvdialog_i.h   [License: GPL (v2+)]
 A             libkstapp/vectorviewdialogwidget.ui  
 M  +2 -1      libkstmath/Makefile.am  
 M  +4 -0      libkstmath/dialoglauncher.cpp  
 M  +2 -0      libkstmath/dialoglauncher.h  
 M  +6 -0      libkstmath/kstdefaultnames.cpp  
 M  +1 -0      libkstmath/kstdefaultnames.h  
 A             libkstmath/kstvectorview.cpp   [License: GPL (v2+)]
 A             libkstmath/kstvectorview.h   [License: GPL (v2+)]
 M  +2 -1      widgets/scalarselector.ui  
 M  +28 -3     widgets/scalarselector.ui.h  


--- branches/work/kst/1.5/kst/src/libkstapp/Makefile.am #665127:665128
@@ -21,6 +21,7 @@
 	imagedialogwidget.ui \
 	matrixdialogwidget.ui \
 	plugindialogwidget.ui \
+	vectorviewdialogwidget.ui \
 	basicdialogwidget.ui \
 	eventmonitorwidget.ui \
 	pluginmanager.ui \
@@ -81,6 +82,7 @@
 	kstpsddialog_i.cpp \
 	kstgraphfiledialog_i.cpp \
 	kstimagedialog_i.cpp \
+	kstvvdialog_i.cpp \
 	kstquickstartdialog_i.cpp \
 	updatethread.cpp \
 	emailthread.cpp \
--- branches/work/kst/1.5/kst/src/libkstapp/dialoglauncher-gui.cpp #665127:665128
@@ -25,6 +25,7 @@
 #include "kstplugindialog_i.h"
 #include "kstbasicdialog_i.h"
 #include "kstpsddialog_i.h"
+#include "kstvvdialog_i.h"
 #include "kstvectordialog_i.h"
 
 
@@ -90,7 +91,15 @@
   }
 }
 
+void KstGuiDialogs::showVectorViewDialog(const QString& name, bool edit) {
+  if (!edit) {
+    KstVvDialogI::globalInstance()->showNew(name);
+  } else {
+    KstVvDialogI::globalInstance()->showEdit(name);
+  }
+}
 
+
 void KstGuiDialogs::newVectorDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
   KstVectorDialogI *ad = new KstVectorDialogI(parent, "vector dialog");
   if (createdSlot) {
--- branches/work/kst/1.5/kst/src/libkstapp/dialoglauncher-gui.h #665127:665128
@@ -36,6 +36,8 @@
 
     void showPSDDialog(const QString& name = QString::null, bool edit = false);
 
+    void showVectorViewDialog(const QString& name = QString::null, bool edit = false);
+
     void newMatrixDialog(QWidget *parent, const char *createdSlot = 0L, const char *selectedSlot = 0L, const char *updateSlot = 0L);
     void showMatrixDialog(const QString& name = QString::null, bool edit = false);
 
--- branches/work/kst/1.5/kst/src/libkstapp/kst.cpp #665127:665128
@@ -67,6 +67,7 @@
 #include "kstfilterdialog_i.h"
 #include "kstgraphfiledialog_i.h"
 #include "ksthsdialog_i.h"
+#include "kstvvdialog_i.h"
 #include "kstiface_impl.h"
 #include "kstimagedialog_i.h"
 #include "kstlegenddefaults.h"
@@ -2113,6 +2114,9 @@
     if (!onlyVisible || KstHsDialogI::globalInstance()->isShown()) {
       KstHsDialogI::globalInstance()->update();
     }
+    if (!onlyVisible || KstVvDialogI::globalInstance()->isShown()) {
+      KstVvDialogI::globalInstance()->update();
+    }
     if (!onlyVisible || KstPsdDialogI::globalInstance()->isShown()) {
       KstPsdDialogI::globalInstance()->update();
     }
@@ -2161,6 +2165,7 @@
     KstCsdDialogI::globalInstance()->updateWindow();
     KstEqDialogI::globalInstance()->updateWindow();
     KstHsDialogI::globalInstance()->updateWindow();
+    KstVvDialogI::globalInstance()->updateWindow();
     KstPsdDialogI::globalInstance()->updateWindow();
     KstCurveDialogI::globalInstance()->updateWindow();
     KstImageDialogI::globalInstance()->updateWindow();
--- branches/work/kst/1.5/kst/src/libkstapp/kst.h #665127:665128
@@ -502,6 +502,8 @@
     KAction *EqDialogAction;
     /* Histogram Edit Action */
     KAction *HsDialogAction;
+    /* VectorView Edit Action */
+    KAction *VvDialogAction;
     /* Spectrum Edit Action */
     KAction *PsdDialogAction;
     /* Data Manager Action */
--- branches/work/kst/1.5/kst/src/libkstapp/kstdatamanager_i.cpp #665127:665128
@@ -54,6 +54,7 @@
 #include "kstplugindialog_i.h"
 #include "kstpsddialog_i.h"
 #include "kstvectordialog_i.h"
+#include "kstvvdialog_i.h"
 #include "kstviewwindow.h"
 #include "matrixselector.h"
 #include "vectorselector.h"
@@ -669,6 +670,7 @@
   createObjectAction(i18n("Event Monitor"), _data, KstEventMonitorI::globalInstance(), SLOT(show()));
   createObjectAction(i18n("Image"), _data, KstImageDialogI::globalInstance(), SLOT(show()));
   createObjectAction(i18n("Spectrogram"), _data, KstCsdDialogI::globalInstance(), SLOT(show()));
+  createObjectAction(i18n("VectorView"), _data, KstVvDialogI::globalInstance(), SLOT(show()));
 
   //Create plugin actions...
   setupPluginActions();
--- branches/work/kst/1.5/kst/src/libkstapp/kstdoc.cpp #665127:665128
@@ -54,6 +54,7 @@
 #include "kstgraphfiledialog_i.h"
 #include "kstequation.h"
 #include "ksteventmonitorentry.h"
+#include "kstvectorview.h"
 #include "ksthistogram.h"
 #include "kstimage.h"
 #include "kstmatrixdefaults.h"
@@ -441,6 +442,10 @@
         KstDataObjectPtr p = new KstCSD(e);
         KstWriteLocker dowl(&KST::dataObjectList.lock());
         KST::dataObjectList.append(p);
+      } else if (e.tagName() == "vectorview") {
+        KstDataObjectPtr p = new KstVectorView(e);
+        KstWriteLocker dowl(&KST::dataObjectList.lock());
+        KST::dataObjectList.append(p);
       } else if (e.tagName() == "histogram") {
         KstDataObjectPtr p = new KstHistogram(e);
         KstWriteLocker dowl(&KST::dataObjectList.lock());
--- branches/work/kst/1.5/kst/src/libkstmath/Makefile.am #665127:665128
@@ -38,7 +38,8 @@
 	eparse-eh.cpp \
 	eparse.c \
 	psdcalculator.cpp \
-	escan.c
+	escan.c \
+	kstvectorview.cpp
 
 libkstmath_la_LDFLAGS = -version-info @KST_LIBKST_VERSION@ $(all_libraries) -no-undefined
 libkstmath_la_LIBADD = $(LIB_KDECORE) ../libkst/libkst.la
--- branches/work/kst/1.5/kst/src/libkstmath/dialoglauncher.cpp #665127:665128
@@ -78,6 +78,10 @@
   Q_UNUSED(edit)
 }
 
+void KstDialogs::showVectorViewDialog(const QString& name, bool edit) {
+  Q_UNUSED(name)
+  Q_UNUSED(edit)
+}
 
 void KstDialogs::newVectorDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
   Q_UNUSED(parent)
--- branches/work/kst/1.5/kst/src/libkstmath/dialoglauncher.h #665127:665128
@@ -53,6 +53,8 @@
 
     virtual void showCurveDialog(const QString& name = QString::null, bool edit = false);
 
+    virtual void showVectorViewDialog(const QString& name = QString::null, bool edit = false);
+
     virtual void newVectorDialog(QWidget *parent, const char *createdSlot = 0L, const char *selectedSlot = 0L, const char *updateSlot = 0L);
     virtual void showVectorDialog(const QString& name = QString::null, bool edit = false);
 };
--- branches/work/kst/1.5/kst/src/libkstmath/kstdefaultnames.cpp #665127:665128
@@ -93,7 +93,13 @@
                       true);
 }
 
+QString KST::suggestVectorViewName( KstObjectTag vector_name ) {
+  return suggestDataObjectName(vector_name.tag(), 
+                      i18n("Minimal abbreviation for 'VectorView'", "V"),
+                      true);
+}
 
+
 QString KST::suggestEQName(const QString& name_in) {
   return suggestDataObjectName(name_in, 
                       i18n("Minimal abbreviation for 'Equation'", "E"),
--- branches/work/kst/1.5/kst/src/libkstmath/kstdefaultnames.h #665127:665128
@@ -29,6 +29,7 @@
   extern KST_EXPORT QString suggestCSDName(KstObjectTag vector_name);
   extern KST_EXPORT QString suggestEQName(const QString& name_in);
   extern KST_EXPORT QString suggestHistogramName(KstObjectTag vector_name);
+  extern KST_EXPORT QString suggestVectorViewName(KstObjectTag vector_name);
   extern KST_EXPORT QString suggestPluginName(const QString& pname, KstObjectTag vname = KstObjectTag::invalidTag);
   extern KST_EXPORT QString suggestImageName(KstObjectTag matrix_name);
 }
--- branches/work/kst/1.5/kst/src/widgets/scalarselector.ui #665127:665128
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
 <class>ScalarSelector</class>
 <widget class="QWidget">
     <property name="name">
@@ -132,6 +132,7 @@
 <functions>
     <function access="private">init()</function>
     <function returnType="QString">selectedScalar()</function>
+    <function returnType="KstScalarPtr">selectedScalarPtr()</function>
 </functions>
 <exportmacro>KST_EXPORT</exportmacro>
 <layoutdefaults spacing="6" margin="11"/>
--- branches/work/kst/1.5/kst/src/widgets/scalarselector.ui.h #665127:665128
@@ -143,7 +143,7 @@
                 setSelection(p);
             } else {
                 p = new KstScalar(KstObjectTag(se->_name->text(), KstObjectTag::globalTagContext), 0L, val);
-                
+
                 p->setOrphan(true);
                 p->setEditable(true);
                 emit newScalarCreated();
@@ -193,12 +193,37 @@
 QString ScalarSelector::selectedScalar()
 {
     KstScalarPtr ptr = *KST::scalarList.findTag(_scalar->currentText());
-    if (ptr)
+    if (ptr) {
         return _scalar->currentText();
-    else
+    } else {
         return QString::null;
+    }
 }
 
+KstScalarPtr ScalarSelector::selectedScalarPtr()
+//returns a pointer to the selected scalar.
+//if the scalar does not exist, but
+	//the text entered is a number and
+	//the selector is editable then
+//a new scalar is created with the given value and returned.
+{
+  KstScalarPtr ptr = *KST::scalarList.findTag(_scalar->currentText());
+  
+  if (!ptr) {
+    if (_scalar->editable()) {
+      KstWriteLocker sl(&KST::scalarList.lock());
+      bool ok;
+      double val = _scalar->currentText().toDouble(&ok);
+
+      if (ok) {
+        ptr = new KstScalar(KstObjectTag::fromString(_scalar->currentText()), 0L, val, true, false);
+      }
+    }
+  }
+
+  return ptr;
+}
+
 void ScalarSelector::allowDirectEntry( bool allowed )
 {
     _scalar->setEditable(allowed);


More information about the Kst mailing list