Showing with 853 additions and 254 deletions.
  1. +1 −1 cmake/modules/KstMacros.cmake
  2. +26 −0 devel-docs/BugsAndFeatures
  3. +82 −0 devel-docs/dirfile_strings_sindir.notes
  4. +3 −2 pyKst/pykst.py
  5. +2 −2 src/datasources/ascii/asciiconfigwidget.h
  6. +3 −3 src/datasources/bis/bisdatasource.h
  7. +44 −2 src/datasources/dirfilesource/dirfilesource.cpp
  8. +4 −0 src/datasources/dirfilesource/dirfilesource.h
  9. +3 −3 src/datasources/its/itsdatasource.h
  10. +2 −0 src/datasources/its/kstdata_itssource.desktop
  11. +2 −2 src/kst/main.cpp
  12. +2 −0 src/kst/x-kst.xml
  13. +2 −2 src/libkst/datamatrix.cpp
  14. +1 −1 src/libkst/datamatrix.h
  15. +6 −3 src/libkst/datasource.h
  16. +35 −5 src/libkst/datastring.cpp
  17. +15 −2 src/libkst/datastring.h
  18. +7 −1 src/libkst/objectstore.cpp
  19. +2 −2 src/libkst/stdinsource.h
  20. +3 −1 src/libkst/stringfactory.cpp
  21. +1 −1 src/libkst/stringscriptinterface.cpp
  22. +2 −4 src/libkst/vector.cpp
  23. +11 −1 src/libkst/vscalar.cpp
  24. +3 −0 src/libkst/vscalar.h
  25. +0 −1 src/libkstapp/commandlineparser.cpp
  26. +18 −0 src/libkstapp/curvedialog.cpp
  27. +3 −0 src/libkstapp/curvedialog.h
  28. +4 −1 src/libkstapp/dialoglaunchergui.cpp
  29. +1 −1 src/libkstapp/dialoglaunchergui.h
  30. +149 −5 src/libkstapp/mainwindow.cpp
  31. +4 −4 src/libkstapp/matrixdialog.cpp
  32. +16 −4 src/libkstapp/plotitem.cpp
  33. +2 −0 src/libkstapp/plotitem.h
  34. +208 −155 src/libkstapp/sharedaxisboxitem.cpp
  35. +44 −2 src/libkstapp/stringdialog.cpp
  36. +6 −0 src/libkstapp/stringdialog.h
  37. +59 −30 src/libkstapp/stringtab.ui
  38. +2 −0 src/libkstapp/stroketab.cpp
  39. +2 −0 src/libkstapp/stroketab.h
  40. +1 −1 src/libkstapp/view.cpp
  41. +1 −1 src/libkstapp/viewitem.cpp
  42. +6 −4 src/libkstapp/viewitemdialog.cpp
  43. +1 −0 src/libkstmath/curve.cpp
  44. +2 −1 src/libkstmath/dialoglauncher.cpp
  45. +1 −1 src/libkstmath/dialoglauncher.h
  46. +5 −0 src/plugins/dataobject/interpolations/interpolations.h
  47. +5 −0 src/plugins/filters/filters.h
  48. +1 −1 src/plugins/filters/flag/filterflag.cpp
  49. +5 −0 src/plugins/fits/common.h
  50. +4 −0 src/plugins/fits/linear.h
  51. +5 −0 src/plugins/fits/linear_weighted.h
  52. +5 −0 src/plugins/fits/non_linear.h
  53. +5 −0 src/plugins/fits/non_linear_weighted.h
  54. +1 −1 src/plugins/sampleplugin/sampleplugin.cpp
  55. +25 −3 tests/dirfile_maker/dirfile_maker.c
2 changes: 1 addition & 1 deletion cmake/modules/KstMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ endmacro()
macro(kst_link)
target_link_libraries(${kst_name} ${ARGV})
if(kst_qt5)
qt5_use_modules(${kst_name} Widgets Xml Network PrintSupport Svg)
target_link_libraries(${kst_name} Qt5::Widgets Qt5::Xml Qt5::Network Qt5::PrintSupport Qt5::Svg)
else()
target_link_libraries(${kst_name}
${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTSVG_LIBRARY} ${QT_QTNETWORK_LIBRARY})
Expand Down
26 changes: 26 additions & 0 deletions devel-docs/BugsAndFeatures
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
BUGS

Manuel
---------------

What I did:
- create three plots, and place two in a shared axis box
- tie x-zoom for all three plots (Ctrl-t)
- click on one plot in the shared axis box to select it, and press e-key
- in "edit plot item" dialog, goto "Range/Zoom" page, check "Y Zoom Mode" = fixed and change the range values, click ok

What I expected to happen:
- the y-axis range of the selected plot should change to the new values

What actually happened:
- the y-axis range of all three plots changed to the new values


The problem seems to dissapear if I remove following lines from method
void SharedAxisBoxItem::zoomYRange(const QRectF &projection, PlotItem* originPlotItem):
foreach(PlotItem* plotItem, plotTied) {
plotItem->zoomYRange(projection, true);
}

I would like to use the shared axis box for plotting 10 to 20 binary signals in one box, and have another plot on the tab showing signals with wider range, so the shared axis is really good to save a lot of space!

----------------

pykst: accept non-float64 numpy arrays.

dirfile reader should recognise "format" if it is valid.
Expand Down
82 changes: 82 additions & 0 deletions devel-docs/dirfile_strings_sindir.notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Before I forget about this, here's some notes on string vector fields in
GetData-0.10, in case you're still interested in adding support for them
into kst:


- A scalar string array (SARRAY) is declared like this:

sarray_field SARRAY string0 string1 string2 string3 ...



- A string vector field (SINDIR) is declared like this:

field SINDIR index_field sarray_field

Where "index_field" is interpreted as an integer. If
index_field[i] = n, then field[i] = sarray_field[n]. The SINDIR has
the same number of samples-per-frame as index_field. SARRAY indices
start from zero.



- The dirfile->VectorList() function doesn't include SINDIRs in the
list it returns (just numeric vector fields), which means no changes
should be needed in kst to use GetData-0.10 as-is.

Use _dirfile->FieldListByType(SindirEntryType) to get a list of
SINDIRs.



- In C++, to retrieve SINDIR data, there's an alternate function signature
for _dirfile->GetData lacking the DataType field:

size_t GetData(const char *field_code, gd_off64_t first_frame,
gd_off64_t first_sample, size_t num_frames, size_t
num_samples, const char** data_out) const;

It fills data_out[] with pointers to immutable C strings. The
pointers point directly into the SARRAY data store, so don't call
free() on them.



- Internally, GetData doesn't think of SINDIR data as strings, but as
integers of width sizeof(const char*). It treats the SARRAY field as
a non-interpolated lookup table to map values of the index field
into pointers values (=integers) which it returns.

As a result, if two samples of the index_field are equal, then the
pointers returned for those two samples are equal as well. (This is
stronger than just saying that the two string values on those samples
are the same.)



- On samples where the index_field is out of range of the SARRAY, NULL
is returned.



- Calling _dirfile->SamplesPerFrame() on a SINDIR works (you get the SPF
of the index field).



- Calling _dirfile->NativeType() on a SINDIR will return
GetData::String (which it also does for SARRAY and STRING fields).



- For backwards compatibility, you can use the GD_GETDATA_INT_VERSION CPP
macro, introduced in GetData-0.9, for conditional compilation of
GetData-0.10 features:

#if defined GD_GETDATA_INT_VERSION && GD_GETDATA_INT_VERSION >= 1000
...
#endif

-don


5 changes: 3 additions & 2 deletions pyKst/pykst.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,15 +1018,16 @@ def __init__(self, client, filename, field, name="", new=True):
else:
self.handle = name

def change(self, filename, field):
def change(self, filename, field, frame = 0):
""" Change a DataSource String.
Change the file and field of a DataSourceString in kst.
:param filename: The name of the file/data source to read the string from.
:param field: the name of the field in the data source.
:param frame: the frame number if the string is a function of frame number.
"""
self.client.send_si(self.handle, b2str("change("+b2str(filename)+","+b2str(field)+")"))
self.client.send_si(self.handle, b2str("change("+b2str(filename)+","+b2str(field)+","+b2str(frame)+")"))


class Scalar(Object):
Expand Down
4 changes: 2 additions & 2 deletions src/datasources/ascii/asciiconfigwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* *
***************************************************************************/

#ifndef ASCIICONFIGWINDGET_H
#define ASCIICONFIGWINDGET_H
#ifndef ASCIICONFIGWIDGET_H
#define ASCIICONFIGWIDGET_H

#include "asciisource.h"
#include "dataplugin.h"
Expand Down
6 changes: 3 additions & 3 deletions src/datasources/bis/bisdatasource.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
***************************************************************************/


#ifndef BISSOURCE_H
#define BISSOURCE_H
#ifndef BISDATASOURCE_H
#define BISDATASOURCE_H

#include <datasource.h>
#include <dataplugin.h>
Expand Down Expand Up @@ -45,7 +45,7 @@ class BISSource : public Kst::DataSource {

class Config;

virtual bool hasImageStream() { return true;}
virtual bool isImageStream(QString field) {Q_UNUSED(field) return true;}

private:
mutable Config *_config;
Expand Down
46 changes: 44 additions & 2 deletions src/datasources/dirfilesource/dirfilesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DataInterfaceDirFileString : public DataSource::DataInterface<DataString>
bool isValid(const QString& field) const { return dir._stringList.contains( field ); }

// T specific: not used for Strings
const DataString::DataInfo dataInfo(const QString&, int frame=0) const { Q_UNUSED(frame) return DataString::DataInfo(); }
virtual const DataString::DataInfo dataInfo(const QString&, int frame=0) const;
void setDataInfo(const QString&, const DataString::DataInfo&) {}

// meta data
Expand All @@ -109,7 +109,21 @@ class DataInterfaceDirFileString : public DataSource::DataInterface<DataString>

int DataInterfaceDirFileString::read(const QString& field, DataString::ReadInfo& p)
{
return dir.readString(*p.value, field);
if (dir.isStringStream(field)) {
return dir.readSindir(*p.value, field, p.frame);
} else {
return dir.readString(*p.value, field);
}
}

const DataString::DataInfo DataInterfaceDirFileString::dataInfo(const QString &, int frame) const
{
Q_UNUSED(frame)

DataString::DataInfo info;
info.frameCount = dir.frameCount();

return info;
}


Expand Down Expand Up @@ -248,6 +262,7 @@ bool DirFileSource::init() {
_fieldList.clear();
_scalarList.clear();
_stringList.clear();
_sindirList.clear();

_frameCount = 0;

Expand All @@ -272,6 +287,12 @@ bool DirFileSource::init() {
_stringList.append(QString::fromUtf8(tl[i]));
}

const char **nl = _dirfile->FieldListByType(SindirEntryType);
for (int i = 0; nl[i]!=NULL; i++) {
_sindirList.append(QString::fromUtf8(nl[i]));
_stringList.append(QString::fromUtf8(nl[i])); // _stringList contains both
}

_writable = true;
_frameCount = _dirfile->NFrames();
}
Expand Down Expand Up @@ -385,6 +406,18 @@ int DirFileSource::readString(QString &S, const QString& string) {
return 0;
}

int DirFileSource::readSindir(QString &S, const QString &field, int frame) {
const char *tmpstr[1];

_dirfile->GetData(field.toUtf8().constData(), frame, 0, 0, 1, tmpstr);
if (_dirfile->Error() == GD_E_OK) {
S = QString::fromUtf8(tmpstr[0]);
return 1;
}

return 0;
}

//QStringList fieldScalars(const QString& field);

QStringList DirFileSource::fieldScalars(const QString& field) {
Expand Down Expand Up @@ -477,6 +510,15 @@ const QString& DirFileSource::typeString() const {
return dirfileTypeString;
}

bool DirFileSource::isStringStream(QString field)
{
if (_sindirList.contains(field)) {
return true;
} else {
return false;
}
}



QStringList DirFilePlugin::scalarList(QSettings *cfg,
Expand Down
4 changes: 4 additions & 0 deletions src/datasources/dirfilesource/dirfilesource.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class DirFileSource : public Kst::DataSource {
int readScalar(double &S, const QString& scalar);

int readString(QString &S, const QString& string);
int readSindir(QString &S, const QString& string, int frame);

virtual QStringList fieldScalars(const QString& field);

Expand All @@ -75,6 +76,8 @@ class DirFileSource : public Kst::DataSource {
//static const QString staticTypeString;
//static const QString staticTypeTag;

/** return true if <field> is an indexable list of strings */
virtual bool isStringStream(QString field);


private:
Expand All @@ -83,6 +86,7 @@ class DirFileSource : public Kst::DataSource {

QStringList _scalarList;
QStringList _stringList;
QStringList _sindirList; // string stream
QStringList _fieldList;

int _frameCount;
Expand Down
6 changes: 3 additions & 3 deletions src/datasources/its/itsdatasource.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
***************************************************************************/


#ifndef ITSSOURCE_H
#define ITSSOURCE_H
#ifndef ITSDATASOURCE_H
#define ITSDATASOURCE_H

#include <datasource.h>
#include <dataplugin.h>
Expand Down Expand Up @@ -45,7 +45,7 @@ class ITSSource : public Kst::DataSource {

class Config;

virtual bool hasImageStream() { return true;}
virtual bool isImageStream(QString field) {Q_UNUSED(field) return true;}

private:
mutable Config *_config;
Expand Down
2 changes: 2 additions & 0 deletions src/datasources/its/kstdata_itssource.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Name=Indexed Thumbnail Stream Reader
Name[ca]=Lector de fluxos de miniatures indexades
Name[ca@valencia]=Lector de fluxos de miniatures indexades
Name[en_GB]=Indexed Thumbnail Stream Reader
Name[es]=Lector de flujos de miniaturas indexadas
Name[it]=Lettore di flusso di miniature indicizzate
Name[nl]=Streamleesprogramma van geïndexeerde miniaturen
Name[pt]=Leitor de Sequências de Miniaturas Indexadas
Name[sv]=Strömläsare av indexerade miniatyrbilder
Expand Down
4 changes: 2 additions & 2 deletions src/kst/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ int main(int argc, char *argv[]) {
QApplication::setGraphicsSystem("raster");
} else {
// this must be actually set, since raster is now the
// default under linux. Native is strongly prefered
// for remote X, and raster mildly prefered otherwise.
// default under linux. Native is strongly preferred
// for remote X, and raster mildly preferred otherwise.
// Note: for QT5, "native" is gone. Which is bad for
// remote X users. Sigh...
QApplication::setGraphicsSystem("native");
Expand Down
2 changes: 2 additions & 0 deletions src/kst/x-kst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<comment xml:lang="de">Kst-Sitzungsdatei</comment>
<comment xml:lang="en_GB">Kst Session File</comment>
<comment xml:lang="es">Archivo de sesión de Kst</comment>
<comment xml:lang="fi">Kst-istuntotiedosto</comment>
<comment xml:lang="fr">Fichier de session Kst</comment>
<comment xml:lang="it">File di sessione Kst</comment>
<comment xml:lang="nl">Sessiebestand in Kst</comment>
<comment xml:lang="pt">Ficheiro de Sessão do Kst</comment>
Expand Down
4 changes: 2 additions & 2 deletions src/libkst/datamatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ int DataMatrix::skip() const {
}


bool DataMatrix::hasStream() {
return dataSource()->hasImageStream();
bool DataMatrix::isStream() {
return dataSource()->isImageStream(_field);
}


Expand Down
2 changes: 1 addition & 1 deletion src/libkst/datamatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class KSTCORE_EXPORT DataMatrix : public Matrix, public DataPrimitive
// for image streams
int frame() const {return _frame;}
void setFrame(int f) {_frame = f;}
bool hasStream();
bool isStream();

// labels for this matrix
virtual QString label() const;
Expand Down
9 changes: 6 additions & 3 deletions src/libkst/datasource.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "datastring.h"
#include "datavector.h"
#include "datamatrix.h"
#include "vscalar.h"

#include <QRunnable>
#include <QDialog>
Expand Down Expand Up @@ -195,9 +196,11 @@ class KSTCORE_EXPORT DataSource : public Object

QMap<QString, QString> fileMetas() const;

/** return true if the data source contains an indexable list of
* matrices */
virtual bool hasImageStream() { return false;}
/** return true if <field> is an indexable list of matrices */
virtual bool isImageStream(QString field) {Q_UNUSED(field) return false;}

/** return true if <field> is an indexable list of strings */
virtual bool isStringStream(QString field) {Q_UNUSED(field) return false;}

/** Returns the file type or an error message in a static string
The string is stored in a separate static variable, so changes
Expand Down
Loading