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

Barth Netterfield netterfield at astro.utoronto.ca
Mon Apr 2 13:19:34 UTC 2012


SVN commit 1288005 by netterfield:

-Restore loading of previous kst files
-Fix crash loading invalid kst files
-Fix some compiler warnings




 M  +2 -2      libkst/scalarfactory.cpp  
 M  +0 -1      libkstapp/labeldimensionstab.cpp  
 M  +7 -2      libkstapp/plotitem.cpp  
 M  +10 -1     libkstapp/viewitem.cpp  
 M  +1 -0      libkstapp/viewitem.h  
 M  +1 -0      libkstmath/curvefactory.cpp  
 M  +4 -0      plugins/filters/cumulativesum/cumulativesum.cpp  


--- branches/work/kst/portto4/kst/src/libkst/scalarfactory.cpp #1288004:1288005
@@ -71,8 +71,8 @@
 
   ScalarPtr scalar = store->createObject<Scalar>();
   scalar->setValue(value);
-  scalar->setOrphan(true);
-  scalar->setEditable(true);
+  scalar->setOrphan(orphan);
+  scalar->setEditable(editable);
   scalar->setDescriptiveName(descriptiveName);
 
   return scalar;
--- branches/work/kst/portto4/kst/src/libkstapp/labeldimensionstab.cpp #1288004:1288005
@@ -19,7 +19,6 @@
   : DialogTab(parent), _labelItem(labelItem) {
   setupUi(this);
 
-  qDebug() << "label dim tab const" << _labelItem->fixLeft();
   connect(_lockPosToData, SIGNAL(clicked(bool)), this, SLOT(lockPosToDataChanged(bool)));
   connect(_left, SIGNAL(toggled(bool)), this, SLOT(fixLeftChanged(bool)));
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1288004:1288005
@@ -81,7 +81,7 @@
   _bottomPadding(0.0),
   _rightPadding(0.0),
   _topPadding(0.0),
-  _globalFontScale(0.0),
+  _globalFontScale(14.0),
   _numberAxisLabelScaleFactor(1.0),
   _useNumberAxisLabelScale(true),
   _showLegend(false),
@@ -3659,10 +3659,15 @@
           font.fromString(av.toString());
           rc->setGlobalFont(font);
         }
+        double fontscale = 0.0;
         av = attrs.value("globalfontscale");
         if (!av.isNull()) {
-          rc->setGlobalFontScale(QVariant(av.toString()).toDouble());
+          fontscale = QVariant(av.toString()).toDouble();
         }
+        if (fontscale < 0.1) {
+          fontscale = 14.0;
+        }
+        rc->setGlobalFontScale(fontscale);
         av = attrs.value("globalfontcolor");
         if (!av.isNull()) {
           rc->setGlobalFontColor(QColor(av.toString()));
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1288004:1288005
@@ -83,6 +83,7 @@
     _highlighted(false),
     _allowedGrips(TopLeftGrip | TopRightGrip | BottomRightGrip | BottomLeftGrip |
                 TopMidGrip | RightMidGrip | BottomMidGrip | LeftMidGrip),
+    _lockPosToData(false),
     _editDialog(0)
 {
   _initializeShortName();
@@ -434,7 +435,7 @@
     } else if (xml.name().toString() == "relativesize") {
       knownTag = true;
       double width = 0, height = 0, centerx = 0, centery = 0, posx = 0, posy = 0;
-      double leftx = 0, lefty = 0, rightx = 0, righty = 0;
+      double leftx = -1.0, lefty = -1.0, rightx = -1.0, righty = -1.0;
       bool lock_aspect_ratio = false;
       av = attrs.value("width");
       if (!av.isNull()) {
@@ -480,6 +481,12 @@
       if (!av.isNull()) {
         lock_aspect_ratio = QVariant(av.toString()).toBool();
       }
+      if (rightx <-0.99) { // old kst file: generate from center
+        rightx = centerx + width/2.0;
+        leftx  = centerx - width/2.0;
+        righty = centery + height/2.0;
+        lefty  = centery + height/2.0;
+      }
       setRelativeWidth(width);
       setRelativeHeight(height);
       setRelativeCenter(QPointF(centerx, centery));
@@ -512,6 +519,8 @@
           }
           _dataRelativeRect = QRectF(x,y,w,h);
         }
+      } else {
+        setLockPosToData(false);
       }
     } else if (xml.name().toString() == "transform") {
       knownTag = true;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1288004:1288005
@@ -113,6 +113,7 @@
     QPointF relativePosition() const { return _parentRelativePosition; }
     void setRelativePosition(const QPointF pos) { _parentRelativePosition = pos; }
     void setRelativeLeft(const QPointF &pos) { _parentRelativeLeft = pos;}
+    QPointF relativeRight() const {return _parentRelativeRight;}
     void setRelativeRight(const QPointF &pos) { _parentRelativeRight = pos;}
 
     QRectF dataRelativeRect() const { return _dataRelativeRect;}
--- branches/work/kst/portto4/kst/src/libkstmath/curvefactory.cpp #1288004:1288005
@@ -159,6 +159,7 @@
   curve->setPointType(pointType);
   curve->setHeadType(headType);
   curve->setPointDensity(pointDensity);
+  curve->setIgnoreAutoScale(ignoreAutoScale);
 
   curve->setDescriptiveName(descriptiveName);
 
--- branches/work/kst/portto4/kst/src/plugins/filters/cumulativesum/cumulativesum.cpp #1288004:1288005
@@ -128,8 +128,12 @@
 
 
 QString CumulativeSumSource::_automaticDescriptiveName() const {
+  if (vector()) {
   return QString(vector()->descriptiveName() + " Integral");
+  } else {
+    return QString("Integral");
 }
+}
 
 QString CumulativeSumSource::descriptionTip() const {
   QString tip;


More information about the Kst mailing list