Bug 158130

Summary: Matrix can not be updated automatically after changing its source Data range
Product: [Applications] kst Reporter: Yiwen Mao <yiwenv>
Component: generalAssignee: kst
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: the source file used to generate the matrix mentioned in the bug description

Description Yiwen Mao 2008-02-20 22:42:45 UTC
Version:           1.6.0 (using KDE 4.0.0)
Installed from:    Compiled From Sources
OS:                Linux

Problem:
After specifying data range for an existing matrix in Data Manager, the matrix will not be updated automatically until some other operation has been done, such as generating another vector,etc. 
 
Example:
Open kst, construct a matrix from a data source called mx.dat in attached file.
Data-->New Matrix... --> select the file name: mx.dat and field [MATRIX,5,0,0,1,1]
A new matrix [MATRIX,5,0,0,1,1] with 10 samples is shown in data manager.

Right Click on this matrix and choose Edit... 
Uncheck Read to end options for X/Ynumber of fames,
 and change X number of frame = 2 and Y number of frames =2

Now, in Data Manager, the sample number of the matrix is still 10, but it should be 4.

Select View Matrix Values... in Data menu, the matrix entries are not updated.

However, if you do another operation at this time, such as generating a new static vector from Data Manager. The matrix [MATRIX,5,0,0,1,1] will be updated in both Data Manager and View Matrix Value.
Comment 1 Yiwen Mao 2008-02-20 22:44:51 UTC
Created attachment 23642 [details]
the source file used to generate the matrix mentioned in the bug description
Comment 2 Andrew Walker 2008-02-21 17:39:05 UTC
A vector in a similar situation updates only because the ASCII data source calls KstDataSource::updateNumFramesScalar. As this value is marked as dirty as a result, the next update loop will update its provider (i.e. the vector). 

For the matrix case this call sends the already existing value to KstDataSource::updateNumFramesScalar, so the value is not marked as dirty and so the matrix is not updated on the next update loop.

NOTE: calling setDirty on the scalar is insufficient as this does not achieve the same result as the code in KstScalar::setValue, where the new value is not equal to the old value.
Comment 3 Andrew Walker 2008-02-21 20:03:11 UTC
No primitive object will update when it is not in use. This applies to vectors and matrices. This is a "feature" of kst, in that it removes the need to update objects that are not actually in use - saving processing time.