[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Apr 27 19:17:56 CEST 2004


CVS commit by arwalker: 

Added the dynamic fit curve menu.


  M +21 -0     kstview.cpp   1.92
  M +3 -2      kstview.h   1.29


--- kdeextragear-2/kst/kst/kstview.cpp  #1.91:1.92
@@ -126,4 +126,5 @@ KstView::KstView(KstApp *parent, const c
   _removeMenu = new KPopupMenu(this);
   _editCurveMenu = new KPopupMenu(this);
+  _fitCurveMenu = new KPopupMenu(this);
   _addMenuId = popupmenu->insertItem(i18n("&Add To Plot"), _addMenu);
   popupmenu->setItemEnabled(_addMenuId, false);
@@ -132,4 +133,6 @@ KstView::KstView(KstApp *parent, const c
   _editCurveMenuId = popupmenu->insertItem(i18n("Edit &Curve"), _editCurveMenu);
   popupmenu->setItemEnabled(_editCurveMenuId, false);
+  _fitCurveMenuId = popupmenu->insertItem(i18n("&Fit Curve"), _fitCurveMenu);
+  popupmenu->setItemEnabled(_fitCurveMenuId, false);
 
   setFocusPolicy(QWidget::StrongFocus);
@@ -142,4 +145,9 @@ KstView::~KstView() {
   delete MouseInfo;
   MouseInfo = 0L;
+
+  delete _addMenu;
+  delete _removeMenu;
+  delete _editCurveMenu;
+  delete _fitCurveMenu;
 }
 
@@ -774,4 +782,5 @@ void KstView::mousePressEvent(QMouseEven
         _removeMenu->clear();
         _editCurveMenu->clear();
+        _fitCurveMenu->clear();
         _matchMenu->clear();
         _currentPlot = p;
@@ -787,4 +796,5 @@ void KstView::mousePressEvent(QMouseEven
             removeItemEnabled = true;
             _editCurveMenu->insertItem((*it)->tagName(), this, SLOT(dynamicMenuEdit(int)), 0, id);
+            _fitCurveMenu->insertItem((*it)->tagName(), this, SLOT(dynamicMenuFit(int)), 0, id);
           }
           _curveIds[id] = (*it)->tagName();
@@ -795,4 +805,5 @@ void KstView::mousePressEvent(QMouseEven
         popupmenu->setItemEnabled(_removeMenuId, removeItemEnabled);
         popupmenu->setItemEnabled(_editCurveMenuId, removeItemEnabled);
+        popupmenu->setItemEnabled(_fitCurveMenuId, removeItemEnabled);
 
         for (uint j = 0; j < KST::plotList.count(); ++j) {
@@ -1539,4 +1550,14 @@ void KstView::dynamicMenuEdit(int id) {
 }
 
+void KstView::dynamicMenuFit(int id) {
+  KstReadLocker ml(&KST::dataObjectList.lock());
+  KstDataObjectList::Iterator i = KST::dataObjectList.findTag(_curveIds[id]);
+  if (i != KST::dataObjectList.end()) {
+    (*i)->showDialog();
+  }
+
+  _currentPlot = 0L;
+}
+
 void KstView::dynamicMenu(bool add, int id) {
   if (!_currentPlot) {

--- kdeextragear-2/kst/kst/kstview.h  #1.28:1.29
@@ -132,6 +132,6 @@ private:
   QPoint _draggablePoint;
 
-  KPopupMenu *_addMenu, *_removeMenu, *_editCurveMenu, *_matchMenu;
-  int _addMenuId, _removeMenuId, _editCurveMenuId, _matchMenuId;
+  KPopupMenu *_addMenu, *_removeMenu, *_editCurveMenu, *_fitCurveMenu, *_matchMenu;
+  int _addMenuId, _removeMenuId, _editCurveMenuId, _fitCurveMenuId, _matchMenuId;
   KstPlot *_currentPlot;
   QMap<int,QString> _curveIds;
@@ -143,4 +143,5 @@ private slots:
   void dynamicMenuRemove(int);
   void dynamicMenuEdit(int);
+  void dynamicMenuFit(int);
   void dynamicMenuMatch(int);
   void deleteCurrentPlot();





More information about the Kst mailing list