Bug 64891

Summary: mouse data doesn't change as live data is scrolling by
Product: [Applications] kst Reporter: Matthew Truch <matt>
Component: generalAssignee: George Staikos <staikos>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Matthew Truch 2003-09-25 03:47:01 UTC
Version:           0.92 (using KDE KDE 3.1)
Installed from:    RedHat RPMs

When the mouse is over a plot, the lower right of the kst window shows the current mouse location.  However, when you are looking at live data, and the data is scrolling by, this location (indicated at the lower right) does not change (until the mouse has been moved).  The data should be updated as the data scrolls by even if the mouse is not moved.
Comment 1 George Staikos 2003-09-25 11:40:35 UTC
Working on the patch for this now. 
Comment 2 George Staikos 2003-09-27 01:21:42 UTC
Subject: kdeextragear-2/kst

CVS commit by staikos: 

This seems to update the mouse properly.
CCMAIL: 64891-done@bugs.kde.org


  M +23 -0     kst/kstview.cpp   1.47
  M +4 -3      tests/datagenerator.pl   1.2


--- kdeextragear-2/kst/kst/kstview.cpp  #1.46:1.47
@@ -364,4 +364,27 @@ void KstView::update() {
   needrecreate = true;
   paintEvent(NULL);
+  int plot = MouseInfo->getPlotNum();
+  if (plot >= 0) {
+    KstPlot* pPlot = KST::plotList.at(plot);
+    QRect plot_rect = pPlot->GetPlotRegion();
+    QPoint pos = mapFromGlobal(QCursor::pos());
+    double xmin, ymin, xmax, ymax, xpos, ypos;
+    pPlot->getLScale(xmin, ymin, xmax, ymax);
+    xpos = (double)(pos.x() - plot_rect.left())/(double)plot_rect.width();
+    xpos = xpos * (xmax - xmin) + xmin;
+    ypos = (double)(pos.y() - plot_rect.top())/(double)plot_rect.height();
+    ypos = ypos * (ymin - ymax) + ymax;
+
+    if (pPlot->isXLog()) {
+      xpos = pow(10.0, xpos);
+    }
+
+    if (pPlot->isYLog()) {
+      ypos = pow(10.0, ypos);
+    }
+
+    QString msg = i18n("(%1, %2)").arg(xpos,0,'G').arg(ypos,0,'G');
+    emit newDataMsg(msg);
+  }
 }
 

--- kdeextragear-2/kst/tests/datagenerator.pl  #1.1:1.2
@@ -9,9 +9,10 @@
 while (true) {
         print OUTPUT "$i ";
-        print OUTPUT sin($i) + rand(0.4) - 0.2;
+        $ii = $i/10;
+        print OUTPUT sin($ii) + rand(0.4) - 0.2;
         print OUTPUT " ";
-        print OUTPUT cos($i) + rand(0.4) - 0.2;
+        print OUTPUT cos($ii) + rand(0.4) - 0.2;
         print OUTPUT " ";
-        print OUTPUT sin($i * $i) * (cos($i) + rand(0.4) - 0.2);
+        print OUTPUT sin($ii * $ii) * (cos($ii) + rand(0.4) - 0.2);
         print OUTPUT " ";
         print OUTPUT "\n";