mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 08:59:55 +00:00
Remove Globals from ErgFilePlot
The original ErgFilePlot code used local static variables to bridge between the selected ErgFile and the Qwt data handlers. This was not an issue when we only allowed one chart of this type to be available at once. But now, with a more configurable layout it is possible to have multiple. The currently selected ErgFile can now be referenced from MainWindow in the same manner as the current RideFile can. This patch introduces no functional change for users.
This commit is contained in:
@@ -361,12 +361,17 @@ ErgFile::calculateMetrics()
|
||||
XP = CP = AP = NP = IF = RI = TSS = BS = SVI = VI = 0;
|
||||
ELE = ELEDIST = GRADE = 0;
|
||||
|
||||
maxY = 0; // we need to reset it
|
||||
|
||||
if (format == CRS) {
|
||||
|
||||
ErgFilePoint last;
|
||||
bool first = true;
|
||||
foreach (ErgFilePoint p, Points) {
|
||||
|
||||
// set the maximum Y value
|
||||
if (p.y > maxY) maxY= p.y;
|
||||
|
||||
if (first == true) {
|
||||
first = false;
|
||||
} else if (p.y > last.y) {
|
||||
@@ -407,6 +412,9 @@ ErgFile::calculateMetrics()
|
||||
ErgFilePoint last;
|
||||
foreach (ErgFilePoint p, Points) {
|
||||
|
||||
// set the maximum Y value
|
||||
if (p.y > maxY) maxY= p.y;
|
||||
|
||||
while (nextSecs < p.x) {
|
||||
|
||||
// CALCULATE NP
|
||||
|
||||
Reference in New Issue
Block a user