Manually add gas changes to a dive

Create a little widget that lists all the gases / tanks we know about and
allow the user to pick one of them.

Turns out that add_event only added events at the end of the list - but we
treat that list as chronologically sorted. So I fixed that little
mis-feature as well.

This does raise the question whether we need the inverse operation
(removing a gas change). And if there are other things that we should be
able to manually edit, now that we have the infrastructure for this neat
little context menu...

See #60 -- this doesn't address all of the issues mentioned there, but at
least deals with the 'headline' of the feature request...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-03-17 18:07:59 -07:00
parent bfa37c3cac
commit 8a5792d473
6 changed files with 91 additions and 5 deletions

6
dive.c
View file

@ -21,11 +21,13 @@ void add_event(struct divecomputer *dc, int time, int type, int flags, int value
ev->type = type;
ev->flags = flags;
ev->value = value;
ev->next = NULL;
p = &dc->events;
while (*p)
/* insert in the sorted list of events */
while (*p && (*p)->time.seconds < time)
p = &(*p)->next;
ev->next = *p;
*p = ev;
remember_event(name);
}