[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Wed Dec 14 22:40:09 CET 2005


SVN commit 488539 by staikos:

make time work in count-from-end mode


 M  +1 -1      datasources/planck/planck.cpp  
 M  +8 -2      datawizard.ui.h  
 M  +11 -3     kstchangenptsdialog_i.cpp  
 M  +16 -2     kstvectordialog_i.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/planck/planck.cpp #488538:488539
@@ -326,7 +326,7 @@
     return -1;
   }
 
-  return floor(t - i + 0.5);
+  return floor(t - i + 0.5) * 1000.0;
 }
 
 
--- trunk/extragear/graphics/kst/kst/datawizard.ui.h #488538:488539
@@ -508,8 +508,14 @@
 	f0Value = int(_kstDataRange->f0Value());
     }
     if (_kstDataRange->isRangeRelativeTime()) {
-
-	nValue = ds->sampleForTime(_kstDataRange->nValue());
+	double nValStored = _kstDataRange->nValue();
+	if (_kstDataRange->CountFromEnd->isChecked()) {
+	    int frameCount = ds->frameCount(_xVector->currentText());
+	    double msCount = ds->relativeTimeForSample(frameCount - 1);
+	    nValue = frameCount - 1 - ds->sampleForTime(msCount - nValStored);
+	} else {
+	    nValue = ds->sampleForTime(ds->relativeTimeForSample(f0Value) + nValStored);
+	}
     } else {
 	nValue = int(_kstDataRange->nValue());
     }
--- trunk/extragear/graphics/kst/kst/kstchangenptsdialog_i.cpp #488538:488539
@@ -107,9 +107,17 @@
       }
       
       if (_kstDataRange->isRangeRelativeTime() && vector->dataSource()) {
-        vector->dataSource()->readLock();
-        n = vector->dataSource()->sampleForTime(_kstDataRange->nValue());
-        vector->dataSource()->readUnlock();
+        KstDataSourcePtr ds = vector->dataSource();
+        ds->readLock();
+        double nValStored = _kstDataRange->nValue();
+        if (_kstDataRange->CountFromEnd->isChecked()) {
+          int frameCount = ds->frameCount(vector->field());
+          double msCount = ds->relativeTimeForSample(frameCount - 1);
+          n = frameCount - 1 - ds->sampleForTime(msCount - nValStored);
+        } else {
+          n = ds->sampleForTime(ds->relativeTimeForSample(f0) + nValStored);
+        }
+        ds->readUnlock();
       } else {
         n = int(_kstDataRange->nValue());
       }
--- trunk/extragear/graphics/kst/kst/kstvectordialog_i.cpp #488538:488539
@@ -364,7 +364,14 @@
     }
 
     if (_w->_kstDataRange->isRangeRelativeTime()) {
-      n = file->sampleForTime(_w->_kstDataRange->nValue());
+      double nValStored = _w->_kstDataRange->nValue();
+      if (_w->_kstDataRange->CountFromEnd->isChecked()) {
+        int frameCount = file->frameCount(_w->Field->currentText());
+        double msCount = file->relativeTimeForSample(frameCount - 1);
+        n = frameCount - 1 - file->sampleForTime(msCount - nValStored);
+      } else {
+        n = file->sampleForTime(file->relativeTimeForSample(f0) + nValStored);
+      }
     } else {
       n = int(_w->_kstDataRange->nValue());
     }
@@ -507,7 +514,14 @@
     }
     if (_nDirty) {
       if (_w->_kstDataRange->isRangeRelativeTime()) {
-        n = file->sampleForTime(_w->_kstDataRange->nValue());
+        double nValStored = _w->_kstDataRange->nValue();
+        if (_w->_kstDataRange->CountFromEnd->isChecked()) {
+          int frameCount = file->frameCount(_w->Field->currentText());
+          double msCount = file->relativeTimeForSample(frameCount - 1);
+          n = frameCount - 1 - file->sampleForTime(msCount - nValStored);
+        } else {
+          n = file->sampleForTime(file->relativeTimeForSample(f0) + nValStored);
+        }
       } else {
         n = int(_w->_kstDataRange->nValue());
       }


More information about the Kst mailing list