[Kst] kst_hfi_calib_branch: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Nov 10 16:54:41 CET 2004


CVS commit by staikos: 

better editting in the context menu.  display the type of object that it will
be editting, and allow editting of the associated data objects, not just the
curves.


  M +38 -3     kst2dplot.cpp   1.299.2.3
  M +3 -1      kst2dplot.h   1.124.2.2
  M +3 -0      kstvcurve.h   1.27.2.1


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.299.2.2:1.299.2.3
@@ -46,4 +46,6 @@
 #include "kstsettings.h"
 #include "kstviewwindow.h"
+#include "kstvcurve.h"
+#include "kstvectordialog_i.h"
 
 #define JD1900                  2415020.5
@@ -2579,9 +2581,22 @@ void Kst2DPlot::editCurve(int id) {
   KstBaseCurvePtr curve = *(Curves.findTag(_curveEditMap[id]));
   if (curve) {
-    curve->_showDialog();  // Hmm, this isn't supposed to be called.
+    curve->showDialog();
   }
 }
 
 
+void Kst2DPlot::editObject(int id) {
+  KstDataObjectPtr dop = *(KST::dataObjectList.findTag(_objectEditMap[id]));
+  if (dop) {
+    dop->showDialog();
+  }
+}
+
+
+void Kst2DPlot::editVector(int id) {
+  KstVectorDialogI::globalInstance()->show_Edit(_objectEditMap[id]);
+}
+
+
 void Kst2DPlot::matchAxis(int id) {
   Kst2DPlotPtr p = (Kst2DPlot*)_plotMap[id];
@@ -2709,4 +2724,5 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
     menu->insertSeparator();
 
+    _objectEditMap.clear();
     _curveEditMap.clear();
     _curveFitMap.clear();
@@ -2716,5 +2732,5 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
 
     //
-    // Edit... menu
+    // Edit menu
     //
     submenu = new KPopupMenu(menu);
@@ -2723,6 +2739,25 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
       const QString& tag = Curves[i]->tagName();
       _curveEditMap[i] = tag;
-      submenu->insertItem(tag, i);
+      submenu->insertItem(i18n("Curve: %1").arg(tag), i);
       submenu->connectItem(i, this, SLOT(editCurve(int)));
+      KstVCurvePtr vc = kst_cast<KstVCurve>(Curves[i]);
+      if (vc) {
+        KstObjectPtr provider = vc->yVector()->provider();
+        if (provider) {
+          KstDataObjectPtr dop = kst_cast<KstDataObject>(provider);
+          if (dop) {
+            _objectEditMap[i + n_curves] = dop->tagName();
+            submenu->insertItem(i18n("%1: %2").arg(dop->typeString()).arg(dop->tagName()), i + n_curves);
+            submenu->connectItem(i + n_curves, this, SLOT(editObject(int)));
+          }
+        } else {
+          KstRVectorPtr rv = kst_cast<KstRVector>(vc->yVector());
+          if (rv) {
+            _objectEditMap[i + n_curves] = rv->tagName();
+            submenu->insertItem(i18n("Vector: %1").arg(rv->tagName()), i + n_curves);
+            submenu->connectItem(i + n_curves, this, SLOT(editVector(int)));
+          }
+        }
+      }
       hasEntry = true;
     }

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.124.2.1:1.124.2.2
@@ -296,4 +296,6 @@ public slots:
   virtual void paint(KstPaintType type, QPainter& p);
   void editCurve(int id);
+  void editObject(int id);
+  void editVector(int id);
   void editImage(int id);
   void matchAxis(int id);
@@ -416,5 +418,5 @@ private:
   QPoint _draggablePoint;
 
-  QMap<int, QString> _curveEditMap, _curveFitMap, _curveRemoveMap, _imageEditMap, _imageRemoveMap;
+  QMap<int, QString> _curveEditMap, _curveFitMap, _curveRemoveMap, _imageEditMap, _imageRemoveMap, _objectEditMap;
   QMap<int, QGuardedPtr<Kst2DPlot> > _plotMap;
 

--- kdeextragear-2/kst/kst/kstvcurve.h  #1.27:1.27.2.1
@@ -77,4 +77,7 @@ class KstVCurve: public KstBaseCurve {
     virtual bool uses(KstObjectPtr p) const;
 
+    KstVectorPtr xVector() const { return VX; }
+    KstVectorPtr yVector() const { return VY; }
+
   private:
     inline void commonConstructor(const QString &in_tag,





More information about the Kst mailing list