[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Fri Jul 4 18:34:35 CEST 2003


CVS commit by netterfield: 

added Saving/loading arbitrary labels.


  M +1 -0      kst.cpp   1.37
  M +14 -4     kstplot.cpp   1.17


--- kdeextragear-2/kst/kst/kst.cpp  #1.36:1.37
@@ -783,4 +783,5 @@ void KstApp::showPluginManager() {
 void KstApp::registerDocChange() {
   doc->update();
+  doc->setModified();
   updateDialogs();
 }

--- kdeextragear-2/kst/kst/kstplot.cpp  #1.16:1.17
@@ -49,4 +49,5 @@ KstPlot::KstPlot(QDomElement &e, KstBase
   QStringList ctaglist;
   KstLabel *in_toplabel=0, *in_xlabel=0, *in_ylabel=0, *in_ticklabel=0;
+  KstLabel *in_alabel;
   bool x_log=false, y_log=false;
 
@@ -86,17 +87,21 @@ KstPlot::KstPlot(QDomElement &e, KstBase
       } else if (e.tagName() == "xlabel") {
         if (in_xlabel)
-          delete in_toplabel;
+          delete in_xlabel;
         in_xlabel = new KstLabel(" ");
         in_xlabel->read(e);
       } else if (e.tagName() == "ylabel") {
         if (in_ylabel)
-          delete in_toplabel;
+          delete in_ylabel;
         in_ylabel = new KstLabel(" ");
         in_ylabel->read(e);
       } else if (e.tagName() == "ticklabel") {
         if (in_ticklabel)
-          delete in_toplabel;
+          delete in_ticklabel;
         in_ticklabel = new KstLabel(" ");
         in_ticklabel->read(e);
+      } else if (e.tagName() == "label") {
+        in_alabel = new KstLabel(" ");
+        in_alabel->read(e);
+        labelList.append(in_alabel);
       } else if (e.tagName() == "curvetag") {
         ctaglist.append(e.text());
@@ -221,5 +226,4 @@ inline void KstPlot::commonConstructor(c
 
   labelList.setAutoDelete(true);
-  //labelList.append(new KstLabel("test label", CxBy, 0, 0.5, 0.5, false));
 }
 
@@ -1328,4 +1332,10 @@ void KstPlot::save(QTextStream &ts) {
   if (isXLog()) ts << "  <xlog/>\n";
   if (isYLog()) ts << "  <ylog/>\n";
+
+  for (i=0; i<(int)labelList.count(); i++) {
+    ts << "  <label>\n";
+    labelList.at(i)->save(ts);
+    ts << "  </label>\n";
+  }
 
   for (i=0; i<(int)Curves.count(); i++) {




More information about the Kst mailing list