From efd4de62a156a5bf15cbf1004d2cee9b5d1abeae Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 28 Jul 2010 20:23:01 +0100 Subject: [PATCH] Fix Imperial Show By Distance on AllPlot The recent patch for allPlot zooming does not display the full plot properly when the user has selected imperial units and is displaying by distance (not time). This minor fix corrects this. --- src/AllPlot.cpp | 3 +++ src/AllPlotWindow.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index 68bd902bf..30b0e1f06 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -266,6 +266,9 @@ AllPlot::configChanged() double width = 1.0; + boost::shared_ptr settings = GetApplicationSettings(); + useMetricUnits = (settings->value(GC_UNIT).toString() == "Metric"); + // placeholder for setting antialiasing, will come // in with a future patch. For now antialiasing is // not enabled since it can slow down plotting on diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 63ffd34ba..df550165b 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -395,8 +395,9 @@ AllPlotWindow::redrawFullPlot() //fullPlot->setTitle(""); if (fullPlot->bydist) - fullPlot->setAxisScale(QwtPlot::xBottom, ride->ride()->dataPoints().first()->km, - ride->ride()->dataPoints().last()->km); + fullPlot->setAxisScale(QwtPlot::xBottom, + ride->ride()->dataPoints().first()->km * (fullPlot->useMetricUnits ? 1 : MILES_PER_KM), + ride->ride()->dataPoints().last()->km * (fullPlot->useMetricUnits ? 1 : MILES_PER_KM)); else fullPlot->setAxisScale(QwtPlot::xBottom, ride->ride()->dataPoints().first()->secs/60, ride->ride()->dataPoints().last()->secs/60);