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

Barth Netterfield netterfield at astro.utoronto.ca
Sat Dec 25 01:51:04 CET 2010


SVN commit 1209137 by netterfield:

BUG:
Fix bug where arrows are reversed when the plot axis is reversed.
Fix bug in drawing when a plot in a shared axis box is maximized.


 M  +6 -1      plotitem.cpp  
 M  +0 -1      plotitem.h  
 M  +13 -0     viewitem.cpp  
 M  +3 -0      viewitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1209136:1209137
@@ -88,7 +88,6 @@
   _numberAxisLabelScaleFactor(1.0),
   _useNumberAxisLabelScale(true),
   _showLegend(false),
-  _plotMaximized(false),
   _allowUpdates(true),
   _legend(0),
   _zoomMenu(0),
@@ -4104,6 +4103,9 @@
     QRectF compute = item->projectionRect();
 
     qreal dx = (item->xMax() - item->xMin())*0.10;
+    if (item->xAxis()->axisReversed()) {
+      dx *=-1;
+    }
     if (item->xAxis()->axisLog()) {
       compute.setLeft(pow(10, item->xMin() + dx));
       compute.setRight(pow(10, item->xMax() + dx));
@@ -4140,6 +4142,9 @@
     QRectF compute = item->projectionRect();
 
     qreal dx = (item->xMax() - item->xMin())*0.10;
+    if (item->xAxis()->axisReversed()) {
+      dx *=-1;
+    }
     if (item->xAxis()->axisLog()) {
       compute.setLeft(pow(10, item->xMin() - dx));
       compute.setRight(pow(10, item->xMax() - dx));
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #1209136:1209137
@@ -450,7 +450,6 @@
 
     bool _showLegend;
 
-    bool _plotMaximized;
     QPointF _plotMaximizedSourcePosition;
     QRectF _plotMaximizedSourceRect;
     QRectF _plotMaximizedSourceParentRect;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1209136:1209137
@@ -55,6 +55,7 @@
     NamedObject(),
     _isXTiedZoom(false),
     _isYTiedZoom(false),
+    _plotMaximized(false),
     _gripMode(Move),
     _allowedGripModes(Move | Resize | Rotate /*| Scale*/),
     _creationState(None),
@@ -691,10 +692,22 @@
   return selectPath;
 }
 
+bool ViewItem::isMaximized() {
+  if (_plotMaximized) {
+    return true;
+  } else if (parentViewItem()) {
+    return parentViewItem()->isMaximized();
+  } else {
+    return false;
+  }
+}
 
 void ViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
   Q_UNUSED(option);
   Q_UNUSED(widget);
+  if ((!isMaximized()) && view()->childMaximized()) {
+    return;
+  }
   painter->setPen(pen());
   painter->setBrush(brush());
   paint(painter); //this is the overload that subclasses should use...
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1209136:1209137
@@ -210,6 +210,8 @@
       return sceneEvent(event);
     }
 
+    virtual bool isMaximized();
+
   Q_SIGNALS:
     void geometryChanged();
     void creationComplete();
@@ -287,6 +289,7 @@
 
     bool _isXTiedZoom;
     bool _isYTiedZoom;
+    bool _plotMaximized;
 
   private Q_SLOTS:
     void viewMouseModeChanged(View::MouseMode oldMode);


More information about the Kst mailing list