From b9174332d562b8b9c436a94880c51acf2c5ab761 Mon Sep 17 00:00:00 2001 From: Willem Ferguson Date: Sat, 7 Apr 2018 14:56:37 +0200 Subject: Read and write divemode changes (xml and git) This provides for reading of divemode change events from dive logs and for writing them to dive logs. This applies to xml and git divelogs. Divemode change events have the following structure: event->name = "modechange" event->value = integer corresponding to enum dive_comp_type (dive.c), reflecting the type of divemode change (OC, CCR, PSCR, etc). In the dive log file, the event value is written as a string that corresponds to each of the enum values, e.g. This xml is also read from the dive log file and translated to an appropriate value of event->value. The file diveeventitem.cpp was udated to reflect this new way of dealing with divemode change events. Signed-off-by: Willem Ferguson --- core/save-xml.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/save-xml.c') diff --git a/core/save-xml.c b/core/save-xml.c index adf9ec2f1..90587163d 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -301,7 +301,10 @@ static void save_one_event(struct membuffer *b, struct dive *dive, struct event put_format(b, " time.seconds, 60)); show_index(b, ev->type, "type='", "'"); show_index(b, ev->flags, "flags='", "'"); - show_index(b, ev->value, "value='", "'"); + if (!strcmp(ev->name,"modechange")) + show_utf8(b, divemode_text[ev->value], "divemode='", "'",1); + else + show_index(b, ev->value, "value='", "'"); show_utf8(b, ev->name, " name='", "'", 1); if (event_is_gaschange(ev)) { struct gasmix *mix = get_gasmix_from_event(dive, ev); -- cgit v1.2.3-70-g09d2