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

Mike Fenton mike at staikos.net
Wed Apr 2 18:23:14 CEST 2008


SVN commit 792946 by fenton:

Add fix for zoom/shared axis updates.


 M  +11 -11    plotitem.cpp  
 M  +4 -4      plotitem.h  
 M  +60 -32    viewgridlayout.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #792945:792946
@@ -1611,25 +1611,25 @@
 }
 
 
-void PlotItem::setTopSuppressed(bool visible) {
-  setTopLabelVisible(visible);
+void PlotItem::setTopSuppressed(bool suppressed) {
+  setTopLabelVisible(!suppressed);
 }
 
 
-void PlotItem::setRightSuppressed(bool visible) {
-  setRightLabelVisible(visible);
+void PlotItem::setRightSuppressed(bool suppressed) {
+  setRightLabelVisible(!suppressed);
 }
 
 
-void PlotItem::setLeftSuppressed(bool visible) {
-  setLeftLabelVisible(visible);
-  setLeftAxisVisible(visible);
+void PlotItem::setLeftSuppressed(bool suppressed) {
+  setLeftLabelVisible(!suppressed);
+  setLeftAxisVisible(!suppressed);
 }
 
 
-void PlotItem::setBottomSuppressed(bool visible) {
-  setBottomLabelVisible(visible);
-  setBottomAxisVisible(visible);
+void PlotItem::setBottomSuppressed(bool suppressed) {
+  setBottomLabelVisible(!suppressed);
+  setBottomAxisVisible(!suppressed);
 }
 
 
@@ -2354,7 +2354,7 @@
 
   if (rect != _projectionRect) {
     _projectionRect = rect;
-//    emit projectionRectChanged();
+    emit marginsChanged();
     update(); //slow, but need to update everything...
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #792945:792946
@@ -71,10 +71,10 @@
     QString rightLabel() const;
     QString topLabel() const;
 
-    void setTopSuppressed(bool visible);
-    void setBottomSuppressed(bool visible);
-    void setLeftSuppressed(bool visible);
-    void setRightSuppressed(bool visible);
+    void setTopSuppressed(bool suppressed);
+    void setBottomSuppressed(bool suppressed);
+    void setLeftSuppressed(bool suppressed);
+    void setRightSuppressed(bool suppressed);
 
     bool isBottomAxisVisible() const;
     void setBottomAxisVisible(bool visible);
--- branches/work/kst/portto4/kst/src/libkstapp/viewgridlayout.cpp #792945:792946
@@ -287,21 +287,28 @@
   if (!_itemLayouts.contains(key))
     return;
 
+  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
+
   LayoutItem left = _itemLayouts.value(key);
   PlotItem *leftItem = qobject_cast<PlotItem*>(left.viewItem);
-  if (!leftItem)
+  if (!leftItem) {
+    plotItem->setLeftSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
-  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
-
-  //horizontal range check...
-  if (plotItem->projectionRect().left() != leftItem->projectionRect().left() ||
-      plotItem->projectionRect().right() != leftItem->projectionRect().right())
+  //vertical range check...
+  if (plotItem->projectionRect().top() != leftItem->projectionRect().top() ||
+      plotItem->projectionRect().bottom() != leftItem->projectionRect().bottom()) {
+    plotItem->setLeftSuppressed(false);
+    leftItem->setRightSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
   if (item.rowSpan == left.rowSpan && item.columnSpan == left.columnSpan) {
-    plotItem->setLeftSuppressed(false);
-    leftItem->setRightSuppressed(false);
+    plotItem->setLeftSuppressed(true);
+    leftItem->setRightSuppressed(true);
     setSpacing(QSizeF(0.0, spacing().height()));
   }
 }
@@ -312,21 +319,28 @@
   if (!_itemLayouts.contains(key))
     return;
 
+  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
+
   LayoutItem right = _itemLayouts.value(key);
   PlotItem *rightItem = qobject_cast<PlotItem*>(right.viewItem);
-  if (!rightItem)
+  if (!rightItem) {
+    plotItem->setRightSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
-  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
-
-  //horizontal range check...
-  if (plotItem->projectionRect().left() != rightItem->projectionRect().left() ||
-      plotItem->projectionRect().right() != rightItem->projectionRect().right())
+  //vertical range check...
+  if (plotItem->projectionRect().top() != rightItem->projectionRect().top() ||
+      plotItem->projectionRect().bottom() != rightItem->projectionRect().bottom()) {
+    plotItem->setRightSuppressed(false);
+    rightItem->setLeftSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
   if (item.rowSpan == right.rowSpan && item.columnSpan == right.columnSpan) {
-    plotItem->setRightSuppressed(false);
-    rightItem->setLeftSuppressed(false);
+    plotItem->setRightSuppressed(true);
+    rightItem->setLeftSuppressed(true);
     setSpacing(QSizeF(0.0, spacing().height()));
   }
 }
@@ -337,21 +351,28 @@
   if (!_itemLayouts.contains(key))
     return;
 
+  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
+
   LayoutItem top = _itemLayouts.value(key);
   PlotItem *topItem = qobject_cast<PlotItem*>(top.viewItem);
-  if (!topItem)
+  if (!topItem) {
+    plotItem->setTopSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
-  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
-
-  //vertical range check...
-  if (plotItem->projectionRect().top() != topItem->projectionRect().top() ||
-      plotItem->projectionRect().bottom() != topItem->projectionRect().bottom())
+  //horizontal range check...
+  if (plotItem->projectionRect().left() != topItem->projectionRect().left() ||
+      plotItem->projectionRect().right() != topItem->projectionRect().right()) {
+    plotItem->setTopSuppressed(false);
+    topItem->setBottomSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
   if (item.rowSpan == top.rowSpan && item.columnSpan == top.columnSpan) {
-    plotItem->setTopSuppressed(false);
-    topItem->setBottomSuppressed(false);
+    plotItem->setTopSuppressed(true);
+    topItem->setBottomSuppressed(true);
     setSpacing(QSizeF(spacing().width(), 0.0));
   }
 }
@@ -362,21 +383,28 @@
   if (!_itemLayouts.contains(key))
     return;
 
+  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
+
   LayoutItem bottom = _itemLayouts.value(key);
   PlotItem *bottomItem = qobject_cast<PlotItem*>(bottom.viewItem);
-  if (!bottomItem)
+  if (!bottomItem) {
+    plotItem->setBottomSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
-  PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem);
-
-  //vertical range check...
-  if (plotItem->projectionRect().top() != bottomItem->projectionRect().top() ||
-      plotItem->projectionRect().bottom() != bottomItem->projectionRect().bottom())
+  //horizontal range check...
+  if (plotItem->projectionRect().left() != bottomItem->projectionRect().left() ||
+      plotItem->projectionRect().right() != bottomItem->projectionRect().right()) {
+    plotItem->setBottomSuppressed(false);
+    bottomItem->setTopSuppressed(false);
+    setSpacing(QSizeF(spacing().width(), spacing().height()));
     return;
+  }
 
   if (item.rowSpan == bottom.rowSpan && item.columnSpan == bottom.columnSpan) {
-    plotItem->setBottomSuppressed(false);
-    bottomItem->setTopSuppressed(false);
+    plotItem->setBottomSuppressed(true);
+    bottomItem->setTopSuppressed(true);
     setSpacing(QSizeF(spacing().width(), 0.0));
   }
 }


More information about the Kst mailing list