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

Barth Netterfield netterfield at astro.utoronto.ca
Mon Aug 9 17:57:49 CEST 2010


SVN commit 1161066 by netterfield:

In base/offset mode, make room for the Y label if it gets too big.

also fix:
BUG: 246681



 M  +2 -1      devel-docs/Kst2Specs/Bugs  
 M  +9 -1      src/libkstapp/legenditem.cpp  
 M  +1 -0      src/libkstapp/legenditem.h  
 M  +9 -1      src/libkstapp/plotitem.cpp  
 M  +2 -0      src/libkstapp/plotitem.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1161065:1161066
@@ -20,13 +20,14 @@
 which magically fixes itself upon the next update.  I think I have
 reported this before.
 
-----------------------
+and (same bug)
 
 With live data, add a label which contains a scalar showing the
 "Last" value of a vector.  As the data is scrolling by, sometimes this
 scalar will indicate a value strikingly similar to the "Min" (or perhaps
 "First") value on the plot rather than the Last value.
 
+** This appears to be either a BLASTpol defile bug, or a filesystem issue.  **
 -----------------------
 
 Create a bunch of plots with same X range but different Y range.
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1161065:1161066
@@ -1,7 +1,7 @@
 /***************************************************************************
  *                                                                         *
  *   copyright : (C) 2008 The University of Toronto                        *
- *                                                                         *
+ *                   <netterfield at astro.utoronto.ca>                       *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -342,6 +342,14 @@
 }
 
 
+void LegendItem::remove() {
+  if (_plotItem) {
+    _plotItem->setShowLegend(false);
+  }
+  ViewItem::remove();
+}
+
+
 void LegendItem::setAutoContents(const bool autoContents) {
   _auto = autoContents;
 }
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.h #1161065:1161066
@@ -63,6 +63,7 @@
     void applyDefaults();
   public Q_SLOTS:
     virtual void edit();
+    virtual void remove();
 
   protected:
     virtual QString _automaticDescriptiveName() const;
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1161065:1161066
@@ -64,6 +64,8 @@
   _isInSharedAxisBox(false),
   _plotRectsDirty(true),
   _calculatedLeftLabelMargin(0.0),
+  _calculatedLeftLabelWidth(0.0),
+  _calculatedLeftBaseOffset(0.0),
   _calculatedRightLabelMargin(0.0),
   _calculatedTopLabelMargin(0.0),
   _calculatedBottomLabelMargin(0.0),
@@ -1249,7 +1251,7 @@
 
     QRectF bound = painter->boundingRect(QRectF(), flags, _yAxis->baseLabel());
     bound = QRectF(bound.x(), bound.bottomRight().y() - bound.width(), bound.height(), bound.width());
-    QPointF p = QPointF(rect().left(), plotRect().bottom());
+    QPointF p = QPointF(rect().left() + _calculatedLeftBaseOffset, plotRect().bottom());
     bound.moveBottomLeft(p);
 
     CachedPlotLabel label;
@@ -2074,6 +2076,7 @@
     painter->restore();
 
     _calculatedLeftLabelMargin = leftLabelBound.height();
+    _calculatedLeftLabelWidth = leftLabelBound.width();
 
     //No more than 1/4 the width of the plot
     if (width() < _calculatedLeftLabelMargin * 4)
@@ -2487,8 +2490,13 @@
   }
 
   yLabelRect.setWidth(yLabelRect.width() + _calculatedAxisMarginHLead);
+  _calculatedLeftBaseOffset = 0.0;
   if (!_yAxis->baseLabel().isEmpty()) {
     qreal height = painter->boundingRect(QRectF(), flags, _yAxis->baseLabel()).height();
+    if (painter->boundingRect(QRectF(), flags, _yAxis->baseLabel()).width() + _calculatedLeftLabelWidth/2 + yLabelRect.width()/2 > plotRect().height()/2) {
+      height += leftLabelMargin();
+      _calculatedLeftBaseOffset = leftLabelMargin();
+    }
     if (leftLabelMargin() < height) {
       yLabelRect.setWidth(yLabelRect.width() + (height - leftLabelMargin()));
     }
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #1161065:1161066
@@ -408,6 +408,8 @@
     QRectF _calculatedPlotAxisRect;
 
     qreal _calculatedLeftLabelMargin;
+    qreal _calculatedLeftLabelWidth;
+    qreal _calculatedLeftBaseOffset;
     qreal _calculatedRightLabelMargin;
     qreal _calculatedTopLabelMargin;
     qreal _calculatedTopLabelHeight;


More information about the Kst mailing list