[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Apr 8 22:54:40 CEST 2004


CVS commit by arwalker: 

Make the search for a unique Analysis Scalar and unique Anonymous 
Vector more efficient by remembering the last name that was used.


  M +4 -3      kstscalar.cpp   1.21
  M +5 -5      kstvector.cpp   1.63


--- kdeextragear-2/kst/kst/kstscalar.cpp  #1.20:1.21
@@ -23,4 +23,6 @@
 #include <qstylesheet.h>
 
+static int iAnonymousScalarCounter = 0;
+
 /** Create the base scalar */
 KstScalar::KstScalar(const QString& in_tag, double val) : KstObject(), _orphan(false) {
@@ -28,8 +30,7 @@ KstScalar::KstScalar(const QString& in_t
   if (_tag.isEmpty()) {
     QString nt = i18n("Anonymous Scalar %1");
-    int i = 0;
-    // FIXME: make me more efficient
+    
     do {
-      _tag = nt.arg(i++);
+      _tag = nt.arg(iAnonymousScalarCounter++);
     } while (KST::vectorTagNameNotUnique(_tag, false));
   } else {

--- kdeextragear-2/kst/kst/kstvector.cpp  #1.62:1.63
@@ -24,5 +24,5 @@
 #include <assert.h>
 #include <kdebug.h>
-
+#include <klocale.h>
 #include "enodes.h"    
 #include "kstdoc.h"
@@ -45,4 +45,5 @@
 #endif
 
+static int iAnonymousVectorCounter = 0;
 
 // Use 1 for a simple for() loop
@@ -72,9 +73,8 @@ KstVector::KstVector(const QString& name
 
   if (name.isEmpty()) {
-    QString nt = "Anonymous Vector %1";
-    int i = 0;
-    // FIXME: make me more efficient
+    QString nt = i18n("Anonymous Vector %1");
+    
     do {
-      KstObject::setTagName(nt.arg(i++));
+      KstObject::setTagName(nt.arg(iAnonymousVectorCounter++));
     } while (KST::vectorTagNameNotUnique(tagName(), false));
   } else {





More information about the Kst mailing list