[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Dec 6 23:14:54 CET 2004


CVS commit by staikos: 

Read From End should not change the number of displayed samples unless there is
an inconsistent state.

BUG: 94193


  M +7 -11     kstdoc.cpp   1.140
  M +10 -0     kstrvector.cpp   1.67
  M +3 -0      kstrvector.h   1.27


--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.139:1.140
@@ -657,4 +657,5 @@ void KstDoc::samplesUp() {
   for (int i = 0; i < (int)rvl.count(); i++) {
     V = rvl[i];
+    V->writeLock();
     f0 = V->reqStartFrame();
     n = V->reqNumFrames();
@@ -670,4 +671,5 @@ void KstDoc::samplesUp() {
     }
     V->changeFrames(f0, n, skip, doSkip, doAve);
+    V->writeUnlock();
   }
 
@@ -687,4 +689,5 @@ void KstDoc::samplesDown() {
   for (int i = 0; i < (int)rvl.count(); i++) {
     V = rvl[i];
+    V->writeLock();
     f0 = V->reqStartFrame();
     if (f0 == -1)
@@ -703,4 +706,5 @@ void KstDoc::samplesDown() {
 
     V->changeFrames(f0, n, skip, doSkip, doAve);
+    V->writeUnlock();
   }
 
@@ -713,19 +717,11 @@ void KstDoc::samplesDown() {
 void KstDoc::samplesEnd() {
   KstRVectorPtr V;
-  int f0, n, skip;
-  bool doSkip, doAve;
-  int fileN;
 
   KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
   for (int i = 0; i < (int)rvl.count(); i++) {
     V = rvl[i];
-    f0 = -1;
-    n = V->numFrames();
-    skip = V->skip();
-    doSkip = V->doSkip();
-    doAve =  V->doAve();
-    fileN = V->fileLength();
-
-    V->changeFrames(f0, n, skip, doSkip, doAve);
+    V->writeLock();
+    V->setFromEnd();
+    V->writeUnlock();
   }
 

--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.66:1.67
@@ -230,4 +230,14 @@ void KstRVector::changeFrames(int in_f0,
 }
 
+void KstRVector::setFromEnd() {
+  ReqF0 = -1;
+  if (ReqNF < 2) {
+    ReqNF = numFrames();
+    if (ReqNF < 2) {
+      ReqF0 = 0;
+    }
+  }
+}
+
 KstRVector::~KstRVector() {  
   _file = 0;

--- kdeextragear-2/kst/kst/kstrvector.h  #1.26:1.27
@@ -109,4 +109,7 @@ public:
   KstDataSourcePtr dataSource() const;
 
+  /** Read from end */
+  void setFromEnd();
+
 private:
   KstObject::UpdateType doUpdate(bool force = false);





More information about the Kst mailing list