From 2581b3870f90f07cd4d6585c92b85405860209a7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 29 Dec 2012 11:44:11 -0800 Subject: Make the tooltip text for gaschange events more informative We now print out "air", "nn% O2", or "(nn/xx)" for trimix. Signed-off-by: Dirk Hohndel --- profile.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'profile.c') diff --git a/profile.c b/profile.c index 525843969..bd78c85da 100644 --- a/profile.c +++ b/profile.c @@ -388,10 +388,27 @@ static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, st cairo_line_to(gc->cr, x-9, y+4); cairo_stroke(gc->cr); /* we display the event on screen - so translate */ - if (event->value) - snprintf(buffer, sizeof(buffer), "%s: %d", _(event->name), event->value); - else + if (event->value) { + if (event->name && !strcmp(event->name, "gaschange")) { + unsigned int he = event->value >> 16; + unsigned int o2 = event->value & 0xffff; + if (he) { + snprintf(buffer, sizeof(buffer), "%s: (%d/%d)", + _(event->name), o2, he); + } else { + if (o2 == 21) + snprintf(buffer, sizeof(buffer), "%s: %s", + _(event->name), _("air")); + else + snprintf(buffer, sizeof(buffer), "%s: %d%% %s", + _(event->name), o2, _("O" UTF8_SUBSCRIPT_2)); + } + } else { + snprintf(buffer, sizeof(buffer), "%s: %d", _(event->name), event->value); + } + } else { snprintf(buffer, sizeof(buffer), "%s", _(event->name)); + } attach_tooltip(x-15, y-6, 12, 12, buffer); } -- cgit v1.2.3-70-g09d2