[Kst] branches/work/kst/portto4/kst/src/libkstapp

Barth Netterfield netterfield at astro.utoronto.ca
Sun Jun 6 00:14:40 CEST 2010


SVN commit 1134960 by netterfield:

remove memory leak in shared axis boxes.



 M  +21 -4     plotitem.cpp  
 M  +0 -1      sharedaxisboxitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1134959:1134960
@@ -2747,9 +2747,15 @@
   qDebug() << "zoomFixedExpression" << projection << "current" << projectionRect();
 #endif
   if (projection.isValid()) {
-    if (isInSharedAxisBox() && !force) {
+    if (isInSharedAxisBox()) {
+      if (!force) {
       sharedAxisBox()->zoomFixedExpression(projection, this);
     } else {
+        yAxis()->setAxisZoomMode(PlotAxis::FixedExpression);
+        xAxis()->setAxisZoomMode(PlotAxis::FixedExpression);
+        setProjectionRect(QRectF(projection.x(), projection.y(), projection.width(), projection.height()));
+      }
+    } else {
       ZoomCommand *cmd = new ZoomFixedExpressionCommand(this, projection, force);
       _undoStack->push(cmd);
       cmd->redo();
@@ -2763,9 +2769,15 @@
   qDebug() << "zoomXRange" << projection << endl;
 #endif
   if (projection.isValid()) {
-    if (isInSharedAxisBox() && !force) {
+    if (isInSharedAxisBox()) {
+      if (!force) {
+        qDebug() << "zoom X range: telling shared axis box";
       sharedAxisBox()->zoomXRange(projection, this);
     } else {
+        xAxis()->setAxisZoomMode(PlotAxis::FixedExpression);
+        setProjectionRect(QRectF(projection.x(), projectionRect().y(), projection.width(), projectionRect().height()));
+      }
+    } else {
       ZoomCommand *cmd = new ZoomXRangeCommand(this, projection, force);
       _undoStack->push(cmd);
       cmd->redo();
@@ -2779,9 +2791,14 @@
   qDebug() << "zoomYRange" << projection << endl;
 #endif
   if (projection.isValid()) {
-    if (isInSharedAxisBox() && !force) {
+    if (isInSharedAxisBox()) {
+      if (!force) {
       sharedAxisBox()->zoomYRange(projection, this);
     } else {
+        yAxis()->setAxisZoomMode(PlotAxis::FixedExpression);
+        setProjectionRect(QRectF(projectionRect().x(), projection.y(), projectionRect().width(), projection.height()));
+      }
+    } else {
       ZoomCommand *cmd = new ZoomYRangeCommand(this, projection, force);
       _undoStack->push(cmd);
       cmd->redo();
@@ -2794,7 +2811,7 @@
 #if DEBUG_ZOOM
   qDebug() << "zoomMaximum" << endl;
 #endif
-  if (isInSharedAxisBox() && !force) {
+  if (isInSharedAxisBox() && (!force)) {
     sharedAxisBox()->zoomMaximum(this);
   } else {
     ZoomCommand *cmd = new ZoomMaximumCommand(this, force);
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #1134959:1134960
@@ -371,7 +371,6 @@
     } else {
       computedRect = plot->computedProjectionRect();
     }
-    
     plot->xAxis()->setAxisZoomMode(existingXMode);
     plot->yAxis()->setAxisZoomMode(existingYMode);
   }


More information about the Kst mailing list