Bug 64891 - mouse data doesn't change as live data is scrolling by
Summary: mouse data doesn't change as live data is scrolling by
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-25 03:47 UTC by Matthew Truch
Modified: 2003-09-27 01:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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";