[Kst] kdeextragear-2/kst/kst

Rick Chern rchern at interchange.ubc.ca
Thu Aug 19 22:55:28 CEST 2004


CVS commit by rchern: 

Plot marker jumping behaviour in tied zoom mode has been changed.  Main differences:
- jumping to a marker will cause all other tied plots to center on the same x value.  The x zoom level is not changed, consistent with scrolling behaviour
- if a tied plot (that is not the active plot) is in log mode, it will not jump at all if asked to jump to a non-positive center, but all other tied plots will try to jump (if they can)
- if the active plot is unable to jump (no marker available, or negative plot marker in xLog mode) then other tied plots will not jump either, even if they are able to.

The last two points make it possible to have unsynchronized jumps when in tied zoom mode.

This should be like "sharing" plot markers (the markers themselves are not shared, however). 

CCMAIL:  86582-done at bugs.kde.org


  M +71 -41    kst2dplot.cpp   1.235
  M +1 -1      kst2dplot.h   1.94


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.234:1.235
@@ -3033,21 +3033,5 @@ void Kst2DPlot::moveDown(KstViewWidget *
 void Kst2DPlot::moveToNextMarker(KstViewWidget *view) {
   Q_UNUSED(view)
-  moveSelfToMarker(true);
-  updateTiedPlots(&Kst2DPlot::moveSelfToMarker, true);
-  pushScale();
-  setDirty();
-  view->paint();
-}
-
-void Kst2DPlot::moveToPrevMarker(KstViewWidget *view) {
-  Q_UNUSED(view)
-  moveSelfToMarker(false);
-  updateTiedPlots(&Kst2DPlot::moveSelfToMarker, false);
-  pushScale();
-  setDirty();
-  view->paint();
-}
-
-void Kst2DPlot::moveSelfToMarker(bool next) {
+  //do the moving
   double newCenter, currCenter;
   double xmin, xmax, ymin, ymax;
@@ -3055,5 +3039,4 @@ void Kst2DPlot::moveSelfToMarker(bool ne
 
   getLScale(xmin, ymin, xmax, ymax);
-  if (next) {
     currCenter = ((xmax + xmin) / 2.0) + (xmax - xmin)/MARKER_NUM_SEGS;
     if (_xLog) {
@@ -3068,6 +3051,24 @@ void Kst2DPlot::moveSelfToMarker(bool ne
        setXScaleMode(FIXED);
        setLXScale(new_xmin, new_xmax);
+
+    //now move all all the other tied plots to the same center
+    if (_xLog) {
+      newCenter = pow(10, newCenter);
     }
-  } else {
+    updateTiedPlots(&Kst2DPlot::moveSelfToCenter, newCenter);
+    pushScale();
+    setDirty();
+    view->paint();
+  }
+}
+
+void Kst2DPlot::moveToPrevMarker(KstViewWidget *view) {
+  Q_UNUSED(view)
+  //do the moving
+  double newCenter, currCenter;
+  double xmin, xmax, ymin, ymax;
+  double new_xmin, new_xmax;
+
+  getLScale(xmin, ymin, xmax, ymax);
     currCenter = ((xmax + xmin) / 2.0) - (xmax - xmin)/MARKER_NUM_SEGS;
     if (_xLog) {
@@ -3086,6 +3087,34 @@ void Kst2DPlot::moveSelfToMarker(bool ne
        setXScaleMode(FIXED);
        setLXScale(new_xmin, new_xmax);
+
+    //now move all the other tied plots to the same center
+    if (_xLog) {
+      newCenter = pow(10, newCenter);
+    }
+    updateTiedPlots(&Kst2DPlot::moveSelfToCenter, newCenter);
+    pushScale();
+    setDirty();
+    view->paint();
+  }
+}
+
+void Kst2DPlot::moveSelfToCenter(double center) {
+  //log the center if necessary
+  if (_xLog) {
+    center = logX(center);
     }
+
+  //refuse to move if it's not possible
+  if (_xLog && center <= -350) {
+    return;
   }
+
+  double xmin, xmax, ymin, ymax;
+  getLScale(xmin, ymin, xmax, ymax);
+
+  double new_xmin = center - (xmax - xmin)/2.0;
+  double new_xmax = center + (xmax - xmin)/2.0;
+  setXScaleMode(FIXED);
+  setLXScale(new_xmin, new_xmax);
 }
 

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.93:1.94
@@ -213,5 +213,5 @@ public:
   void moveToNextMarker(KstViewWidget *);
   void moveToPrevMarker(KstViewWidget *);
-  void moveSelfToMarker(bool next);
+  void moveSelfToCenter(double center);
   //curve related Plot Marker functions
   void setCurveToMarkers(KstBaseCurvePtr curve, bool risingDetect, bool fallingDetect);





More information about the Kst mailing list