academic/scidavis: Add patches.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Fellype do Nascimento 2019-08-10 06:58:55 +07:00 committed by Willy Sudiarto Raharjo
parent e89c08f9da
commit 88571d5b1d
4 changed files with 195 additions and 1 deletions

View file

@ -0,0 +1,75 @@
diff --git a/libscidavis/src/ApplicationWindow.cpp b/libscidavis/src/ApplicationWindow.cpp
index 534c12ac..b203c705 100644
--- a/libscidavis/src/ApplicationWindow.cpp
+++ b/libscidavis/src/ApplicationWindow.cpp
@@ -9611,7 +9611,7 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
CurveLayout cl;
cl.connectType=curve[4].toInt();
- cl.lCol=curve[5].toUInt();
+ cl.lCol=COLORUINT(curve[5]);
if (d_file_version <= 89)
cl.lCol = convertOldToNewColorIndex(cl.lCol);
cl.lStyle=curve[6].toInt();
@@ -9622,7 +9622,7 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
else
cl.sType=curve[9].toInt();
- cl.symCol=curve[10].toUInt();
+ cl.symCol=COLORUINT(curve[10]);
if (d_file_version <= 89)
cl.symCol = convertOldToNewColorIndex(cl.symCol);
if (curve[11]=="-1")
@@ -9630,12 +9630,12 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
else
{
cl.symbolFill = true;
- cl.fillCol=curve[11].toUInt();
+ cl.fillCol=COLORUINT(curve[11]);
}
if (d_file_version <= 89)
cl.fillCol = convertOldToNewColorIndex(cl.fillCol);
cl.filledArea=curve[12].toInt();
- cl.aCol=curve[13].toUInt();
+ cl.aCol=COLORUINT(curve[13]);
if (d_file_version <= 89)
cl.aCol = convertOldToNewColorIndex(cl.aCol);
cl.aStyle=curve[14].toInt();
@@ -9755,21 +9755,21 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
QStringList curve = s.split("\t");
CurveLayout cl;
cl.connectType=curve[6].toInt();
- cl.lCol=curve[7].toUInt();
+ cl.lCol=COLORUINT(curve[7]);
cl.lStyle=curve[8].toInt();
cl.lWidth=curve[9].toInt();
cl.sSize=curve[10].toInt();
cl.sType=curve[11].toInt();
- cl.symCol=curve[12].toUInt();
+ cl.symCol=COLORUINT(curve[12]);
if (curve[13]=="-1")
cl.symbolFill = false;
else
{
cl.symbolFill = true;
- cl.fillCol=curve[13].toUInt();
+ cl.fillCol=COLORUINT(curve[13]);
}
cl.filledArea=curve[14].toInt();
- cl.aCol=curve[15].toUInt();
+ cl.aCol=COLORUINT(curve[15]);
cl.aStyle=curve[16].toInt();
int current_index = 17;
if(curve.count() < 16)
diff --git a/libscidavis/src/ColorButton.h b/libscidavis/src/ColorButton.h
index e826dff6..42351f99 100644
--- a/libscidavis/src/ColorButton.h
+++ b/libscidavis/src/ColorButton.h
@@ -42,6 +42,7 @@ static inline QString COLORVALUE( QString s ) { return s; }
static inline QString COLORNAME( QColor c ) { return ('#'+QString::number(c.rgba(),16)); }
static inline QString COLORVALUE( QString s ) { if ((s[0]=='#') && (s.size()==9)) return s.remove(1,2); else return s; }
#endif
+static inline uint COLORUINT( QString s ) { if (s[0]=='#') return s.remove(0,1).toUInt(nullptr,16); else return s.toUInt(); }
//! A button used for color selection
/**

View file

@ -0,0 +1,81 @@
diff --git a/libscidavis/src/ApplicationWindow.cpp b/libscidavis/src/ApplicationWindow.cpp
index a140d46..f13e8ff 100644
--- a/libscidavis/src/ApplicationWindow.cpp
+++ b/libscidavis/src/ApplicationWindow.cpp
@@ -9595,6 +9595,7 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
{
bool curve_loaded = false; // Graph::insertCurve may fail
QStringList curve = s.split("\t", QString::KeepEmptyParts);
+ int s_offset = 0;
if (curve.count()>14)
{
if (!app->renamedTables.isEmpty())
@@ -9647,19 +9648,23 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
cl.penWidth = curve[15].toInt();
else
cl.penWidth = cl.lWidth;
- // custom dash pattern
- cl.lCapStyle = curve[16].toInt();
- cl.lJoinStyle = curve[17].toInt();
- cl.lCustomDash = curve[18];
+ if (d_file_version >= 0x011800) // 1.24.0
+ {
+ // custom dash pattern
+ cl.lCapStyle = curve[15].toInt();
+ cl.lJoinStyle = curve[16].toInt();
+ cl.lCustomDash = curve[17];
+ s_offset += 3;
+ }
Table *w = app->table(curve[2]);
if (w)
{
int plotType = curve[3].toInt();
- if(curve.count()>21 && (plotType == Graph::VectXYXY || plotType == Graph::VectXYAM))
+ if(curve.count()>(21+s_offset) && (plotType == Graph::VectXYXY || plotType == Graph::VectXYAM))
{
QStringList colsList;
- colsList<<curve[2]; colsList<<curve[20]; colsList<<curve[21];
+ colsList<<curve[2]; colsList<<curve[20+s_offset]; colsList<<curve[21+s_offset];
if (d_file_version < 72)
colsList.prepend(w->colName(curve[1].toInt()));
else
@@ -9685,11 +9690,11 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
else
{
if(plotType == Graph::VectXYXY)
- ag->updateVectorsLayout(curveID, curve[15], curve[16].toInt(),
- curve[17].toInt(), curve[18].toInt(), curve[19].toInt(), 0);
- else if (curve.count()>22)
- ag->updateVectorsLayout(curveID, curve[15], curve[16].toInt(), curve[17].toInt(),
- curve[18].toInt(), curve[19].toInt(), curve[22].toInt());
+ ag->updateVectorsLayout(curveID, curve[15+s_offset], curve[16+s_offset].toInt(),
+ curve[17+s_offset].toInt(), curve[18+s_offset].toInt(), curve[19+s_offset].toInt(), 0);
+ else if (curve.count()>22+s_offset)
+ ag->updateVectorsLayout(curveID, curve[15+s_offset], curve[16+s_offset].toInt(), curve[17+s_offset].toInt(),
+ curve[18+s_offset].toInt(), curve[19+s_offset].toInt(), curve[22+s_offset].toInt());
}
}
else if(plotType == Graph::Box) {
@@ -9705,8 +9710,8 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
QwtHistogram *h = (QwtHistogram *)ag->curve(curveID);
if (d_file_version <= 76)
h->setBinning(curve[16].toInt(),curve[17].toDouble(),curve[18].toDouble(),curve[19].toDouble());
- else if (curve.count()>20)
- h->setBinning(curve[17].toInt(),curve[18].toDouble(),curve[19].toDouble(),curve[20].toDouble());
+ else if (curve.count()>20+s_offset)
+ h->setBinning(curve[17+s_offset].toInt(),curve[18+s_offset].toDouble(),curve[19+s_offset].toDouble(),curve[20+s_offset].toDouble());
h->loadData();
}
} else {
@@ -9727,8 +9732,8 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
{
if (d_file_version <= 76 && curve.count()>15)
ag->setBarsGap(curveID, curve[15].toInt(), 0);
- else if (curve.count()>16)
- ag->setBarsGap(curveID, curve[15].toInt(), curve[16].toInt());
+ else if (curve.count()>(16+s_offset))
+ ag->setBarsGap(curveID, curve[15+s_offset].toInt(), curve[16+s_offset].toInt());
}
if (curve_loaded)
ag->updateCurveLayout(curveID, &cl);

View file

@ -0,0 +1,29 @@
diff --git a/libscidavis/src/RangeSelectorTool.cpp b/libscidavis/src/RangeSelectorTool.cpp
index 26ce5fd..65bfa54 100644
--- a/libscidavis/src/RangeSelectorTool.cpp
+++ b/libscidavis/src/RangeSelectorTool.cpp
@@ -115,8 +115,8 @@ void RangeSelectorTool::pointSelected(const QPoint &pos)
setActivePoint(point);
else {
// try to be intelligent about selecting the inactive point
- double min_x = curve->minXValue();
- double max_x = curve->maxXValue();
+ double min_x = minXValue();
+ double max_x = maxXValue();
int n = curve->dataSize();
double second_x;
if (curve->x(point) == min_x)
@@ -129,11 +129,11 @@ void RangeSelectorTool::pointSelected(const QPoint &pos)
second_x = min_x;
if (second_x == max_x) { // start at selected point and try larger indices first
for (int i=0; i<n; ++i)
- if (curve->x((i + point) % n) == max_x)
+ if (qFuzzyCompare(curve->x((i + point) % n), max_x))
d_inactive_point = (i + point) % n;
} else { // start at selected point and try smaller indices first
for (int i=n-1; i>=0; --i)
- if (curve->x((i + point) % n) == max_x)
+ if (qFuzzyCompare(curve->x((i + point) % n),max_x))
d_inactive_point = (i + point) % n;
}
d_selected_curve = curve;

View file

@ -25,7 +25,7 @@
PRGNAM=scidavis
VERSION=${VERSION:-1.25}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -79,6 +79,15 @@ else
export PYTHON=python2
fi
# Fix for SF bug https://sourceforge.net/p/scidavis/scidavis-bugs/377/
patch -p1 < $CWD/fix-sf377-all-colors-turn-to-black-after-reload-of-project.patch libscidavis/src/ApplicationWindow.cpp
# Fix for SF bug https://sourceforge.net/p/scidavis/scidavis-bugs/383/
patch -p1 < $CWD/fix-sf383-offset-and-spacing-of-bar-graphs.patch libscidavis/src/ApplicationWindow.cpp
# Fix for SF bug https://sourceforge.net/p/scidavis/scidavis-bugs/385/
patch -p1 < $CWD/fix-sf385-crash-using-data-range-selector.patch libscidavis/src/RangeSelectorTool.cpp
## For some unknown reason, to build in Slackware we need to run qmake twice in order to get the app icons working properly
## See https://sourceforge.net/p/scidavis/scidavis-bugs/259/
qmake