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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Sep 8 13:27:56 UTC 2011


SVN commit 1252193 by netterfield:

BUG: 272576
If automatic legend names are the same, disambiguate using the filename of the Y vector.


 M  +1 -4      libkst/datavector.cpp  
 M  +3 -2      libkst/labelinfo.h  
 M  +2 -1      libkst/matrix.cpp  
 M  +12 -1     libkstapp/legenditem.cpp  
 M  +3 -1      libkstapp/scriptserver.cpp  
 M  +2 -3      libkstmath/histogram.cpp  
 M  +1 -0      libkstmath/psd.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1252192:1252193
@@ -330,10 +330,7 @@
 
   label_info.name = descriptiveName();// _field;
 
-  // un-escape escaped special characters so they aren't escaped 2x.
-  //label_info.name.replace("\\_", "_").replace("\\^","^").replace("\\[", "[").replace("\\]", "]");
-  // now escape the special characters.
-  //label_info.name.replace('_', "\\_").replace('^', "\\^").replace('[', "\\[").replace(']', "\\]");
+  label_info.file = filename();
 
   return label_info;
 }
--- branches/work/kst/portto4/kst/src/libkst/labelinfo.h #1252192:1252193
@@ -29,12 +29,13 @@
 
 struct KSTCORE_EXPORT LabelInfo
 {
-  LabelInfo() : name(QString()), quantity(QString()), units(QString()) {}
-  bool operator==(const LabelInfo &l) const { return (l.name==name) && (l.quantity==quantity) && (l.units==units); }
+  LabelInfo() : name(QString()), quantity(QString()), units(QString()), file(QString()) {}
+  bool operator==(const LabelInfo &l) const { return (l.name==name) && (l.quantity==quantity) && (l.units==units) && (l.file==file); }
   bool operator!=(const LabelInfo &l) const { return !(*this==l); }
   QString name;
   QString quantity;
   QString units;
+  QString file;
   QString singleRenderItemLabel() const;
 };
 
--- branches/work/kst/portto4/kst/src/libkst/matrix.cpp #1252192:1252193
@@ -676,8 +676,9 @@
     ds<<(qint32)_nX<<(qint32)_nY<<_minX<<_minY<<_stepX<<_stepY; //fixme: this makes it not compatible w/ change(...)
 
     uint i;
+    uint n = _nX*_nY;
     // fill in the raw array with the data
-    for (i = 0; i < _nX*_nY; i++) {
+    for (i = 0; i < n; i++) {
       ds << _z[i];
     }
     unlock();
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1252192:1252193
@@ -24,7 +24,7 @@
 #include <QGraphicsItem>
 #include <QGraphicsScene>
 
-#define LEGENDITEMMAXWIDTH 400
+#define LEGENDITEMMAXWIDTH 900
 #define LEGENDITEMMAXHEIGHT 100
 
 namespace Kst {
@@ -150,9 +150,20 @@
           label = relation->descriptiveName();
         }
       }
+      int i_dup = names.indexOf(label);
+      if (i_dup<0) {
       names.append(label);
+      } else {
+        RelationPtr dup_relation = legendItems.at(i_dup);
+        if (!dup_relation->yLabelInfo().file.isEmpty()) {
+          names.replace(i_dup, label + " (" + dup_relation->yLabelInfo().file + ')');
     }
+        if (!relation->yLabelInfo().file.isEmpty()) {
+          names.append(label + " (" + relation->yLabelInfo().file + ')');
   }
+      }
+    }
+  }
 
   for (int i = 0; i<count; i++) {
     RelationPtr relation = legendItems.at(i);
--- branches/work/kst/portto4/kst/src/libkstapp/scriptserver.cpp #1252192:1252193
@@ -87,7 +87,7 @@
         socket.disconnectFromServer();
         connectTo=initial+QString::number(connectTo.remove(initial).toInt()+1);
     }
-    qDebug()<<"Created script server with name "<<connectTo;
+    //qDebug()<<"Created script server with name "<<connectTo;
     connect(_server,SIGNAL(newConnection()),this,SLOT(procConnection()));
 
     //setup _map={QByteArray->ScriptMemberFn}
@@ -233,6 +233,8 @@
     while(_varMap.size()) {
         delete _varMap.take(_varMap.keys().first());
     }
+
+    //qDebug() << "Script server deleted";
 }
 
 /** Conv. function which takes a response, and executes if 'if' statement is unexistant or true. */
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.cpp #1252192:1252193
@@ -200,14 +200,13 @@
       break;
   }
 
-  label_info.name.clear();
-  label_info.units.clear();
-  _hVector->setLabelInfo(label_info);
   _bVector->setLabelInfo(_inputVectors[RAWVECTOR]->labelInfo());
 
   label_info.quantity.clear();
   label_info.units.clear();
   label_info.name = i18n( "Histogram of %1").arg(_bVector->labelInfo().name);
+  label_info.file = _bVector->labelInfo().file;
+
   _hVector->setTitleInfo(label_info);
 
   double *bins = _bVector->value();
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #1252192:1252193
@@ -453,6 +453,7 @@
   label_info.quantity.clear();
   label_info.units.clear();
   label_info.name = _inputVectors[INVECTOR]->labelInfo().name;
+  label_info.file = _inputVectors[INVECTOR]->labelInfo().file;
   _sVector->setTitleInfo(label_info);
 
 }


More information about the Kst mailing list