summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-29 11:44:11 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-29 11:44:11 -0800
commit2581b3870f90f07cd4d6585c92b85405860209a7 (patch)
tree9b2bce9b0ab7940375b5c95a1326dc1548a0349e /profile.c
parent7aaa539afe56fb7de99408ba95b55e423cf6856a (diff)
downloadsubsurface-2581b3870f90f07cd4d6585c92b85405860209a7.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c23
1 files changed, 20 insertions, 3 deletions
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);
}