[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Sat Oct 16 03:38:14 CEST 2004


CVS commit by netterfield: 

...in which:
  Curves learn how to save bar status and type.
  Curves get a little more efficient (but still B-compat) in saving curves.
  An unused variable gets deleted.


  M +0 -3      kstbasecurve.cpp   1.18
  M +0 -2      kstbasecurve.h   1.29
  M +0 -1      ksthistogram.cpp   1.31
  M +31 -10    kstvcurve.cpp   1.49


--- kdeextragear-2/kst/kst/kstbasecurve.cpp  #1.17:1.18
@@ -39,7 +39,4 @@ void KstBaseCurve::commonConstructor() {
   MaxX = MinX = MeanX = MaxY = MinY = MeanY = NS = 0;
   MinPosX = MinPosY = 0;
-  NumUsed = 0;
-  HasPoints = false;
-  HasLines = true;
   Color = in_color;
   NS = 0;

--- kdeextragear-2/kst/kst/kstbasecurve.h  #1.28:1.29
@@ -114,6 +114,4 @@ protected:
   int NS;
 
-  int NumUsed;
-
   bool HasPoints;
   bool HasLines;

--- kdeextragear-2/kst/kst/ksthistogram.cpp  #1.30:1.31
@@ -116,5 +116,4 @@ void KstHistogram::commonConstructor(con
                                      const QColor &in_color) {
   _typeString = i18n("Histogram");
-  NumUsed = 0;
 
   NormMode = in_norm_mode;

--- kdeextragear-2/kst/kst/kstvcurve.cpp  #1.48:1.49
@@ -51,9 +51,13 @@ KstVCurve::KstVCurve(QDomElement &e)
 : KstBaseCurve(e) {
   QString in_tag, xname, yname, exname, eyname;
-  // FIXME: what is meant by next(-1)?  QColor(-1) isn't really valid..
-  QColor in_color(KstColorSequence::next(-1));
+  // QColor in_color(KstColorSequence::next(-1));
+  QColor in_color("red"); // the above line is invalid.
 
   setHasPoints(false);
-  setHasLines(true);
+  setHasLines(false);
+  setHasBars(false);
+  setLineWidth(0);
+  setLineStyle(0);
+  setBarStyle(0);
 
   /* parse the DOM tree */
@@ -74,8 +78,12 @@ KstVCurve::KstVCurve(QDomElement &e)
       } else if (e.tagName() == "color") {
         in_color.setNamedColor(e.text());
+
+      // the following options are only needed to change from the default
       } else if (e.tagName() == "hasLines") {
         HasLines = (e.text() != "0");
       } else if (e.tagName() == "hasPoints") {
         HasPoints = (e.text() != "0");
+      } else if (e.tagName() == "hasBars") {
+        HasBars = (e.text() != "0");
       } else if (e.tagName() == "pointType") {
         Point.setType(e.text().toInt());
@@ -84,6 +92,7 @@ KstVCurve::KstVCurve(QDomElement &e)
       } else if (e.tagName() == "lineStyle") {
         LineStyle = e.text().toInt();
+      } else if (e.tagName() == "barStyle") {
+        BarStyle = e.text().toInt();
       }
-
     }
     n = n.nextSibling();
@@ -99,5 +108,4 @@ KstVCurve::KstVCurve(QDomElement &e)
 void KstVCurve::commonConstructor(const QString &in_tag, const QColor &in_color) {
   _typeString = i18n("Curve");
-  NumUsed = 0;
   Color = in_color;
   setTagName(in_tag);
@@ -272,9 +280,22 @@ void KstVCurve::save(QTextStream &ts, co
   }
   ts << l2 << "<color>" << Color.name() << "</color>" << endl;
-  ts << l2 << "<hasLines>" << HasLines << "</hasLines>" << endl;
-  ts << l2 << "<hasPoints>" << HasPoints << "</hasPoints>" << endl;
-  ts << l2 << "<pointType>" << Point.type() << "</pointType>" << endl;
+  if (HasLines) {
+    ts << l2 << "<hasLines/>" << endl;
   ts << l2 << "<lineWidth>" << LineWidth << "</lineWidth>" << endl;
   ts << l2 << "<lineStyle>" << LineStyle << "</lineStyle>" << endl;
+  }
+  if (HasPoints) {
+    ts << l2 << "<hasPoints/>" << endl;
+    ts << l2 << "<pointType>" << Point.type() << "</pointType>" << endl;
+  }
+  if (HasBars) {
+    ts << l2 << "<hasBars/>" << endl;
+    ts << l2 << "<barStyle>" << BarStyle << "</barStyle>" << endl;
+  }
+//   ts << l2 << "<hasLines>" << HasLines << "</hasLines>" << endl;
+//   ts << l2 << "<hasPoints>" << HasPoints << "</hasPoints>" << endl;
+//   ts << l2 << "<pointType>" << Point.type() << "</pointType>" << endl;
+//   ts << l2 << "<lineWidth>" << LineWidth << "</lineWidth>" << endl;
+//   ts << l2 << "<lineStyle>" << LineStyle << "</lineStyle>" << endl;
   ts << indent << "</curve>" << endl;
 }





More information about the Kst mailing list