aboutsummaryrefslogtreecommitdiff
path: root/academic/scidavis/fix-sf383-offset-and-spacing-of-bar-graphs.patch
blob: bf8006654ac9149ea7a3d650801bb83789728120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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);