aboutsummaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-10-11 16:39:40 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-11 20:26:28 -0700
commit58b668c714223bf7ab1164f27353fb49a38ada40 (patch)
tree1323e0115a2805dba6da3147258965f7abf2f140 /dive.c
parentd031b54d16e74becd3a5b320c5cbed62a66c9d57 (diff)
downloadsubsurface-58b668c714223bf7ab1164f27353fb49a38ada40.tar.gz
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c7
1 files changed, 7 insertions, 0 deletions
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;