From 1bdf00b2b472078a0b24f1c269782d822cb96e02 Mon Sep 17 00:00:00 2001 From: willemferguson Date: Tue, 30 Apr 2019 12:42:33 +0200 Subject: Convert the atmospheric pressure in the Information Tab to an editable field The Information tab shows the atmospheric pressure. Make this value editable and also ensure that changes to it are undo-able. Signed-off-by: willemferguson --- core/load-git.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core/load-git.c') diff --git a/core/load-git.c b/core/load-git.c index c6b3400a8..a0baedecd 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -76,6 +76,13 @@ static weight_t get_weight(const char *line) return w; } +static pressure_t get_airpressure(const char *line) +{ + pressure_t p; + p.mbar = lrint(ascii_strtod(line, NULL)); + return p; +} + static pressure_t get_pressure(const char *line) { pressure_t p; @@ -245,6 +252,9 @@ static void parse_dive_airtemp(char *line, struct membuffer *str, void *_dive) static void parse_dive_watertemp(char *line, struct membuffer *str, void *_dive) { UNUSED(str); struct dive *dive = _dive; dive->watertemp = get_temperature(line); } +static void parse_dive_airpressure(char *line, struct membuffer *str, void *_dive) +{ UNUSED(str); struct dive *dive = _dive; dive->surface_pressure = get_airpressure(line); } + static void parse_dive_duration(char *line, struct membuffer *str, void *_dive) { UNUSED(str); struct dive *dive = _dive; dive->duration = get_duration(line); } @@ -980,7 +990,7 @@ static void divecomputer_parser(char *line, struct membuffer *str, void *_dc) struct keyword_action dive_action[] = { #undef D #define D(x) { #x, parse_dive_ ## x } - D(airtemp), D(buddy), D(cylinder), D(divemaster), D(divesiteid), D(duration), + D(airpressure), D(airtemp), D(buddy), D(cylinder), D(divemaster), D(divesiteid), D(duration), D(gps), D(location), D(notes), D(notrip), D(rating), D(suit), D(tags), D(visibility), D(watertemp), D(weightsystem) }; -- cgit v1.2.3-70-g09d2