From 58b668c714223bf7ab1164f27353fb49a38ada40 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 11 Oct 2013 16:39:40 -0700 Subject: Fix dive planner sidebar depth units The dive planner always showed the depth in our internal units, ie millimeter, in the sidebar that showed the plan points. That made little sense in metric mode, and none at all in imperial. The _graph_ showed things in meter and feet. So make the DivePlannerPointsModel always convert things to and from the user units. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- dive.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dive.c') diff --git a/dive.c b/dive.c index c03d124a4..a98b10412 100644 --- a/dive.c +++ b/dive.c @@ -101,6 +101,13 @@ double get_volume_units(unsigned int ml, int *frac, const char **units) return vol; } +unsigned int units_to_depth(double depth) +{ + if (get_units()->length == METERS) + return rint(depth * 1000); + return feet_to_mm(depth); +} + double get_depth_units(unsigned int mm, int *frac, const char **units) { int decimals; -- cgit v1.2.3-70-g09d2