Previously when only one dive was selected, the Stats notebook page would show
the statistics for all dive. That creates a very illogical behavior when
clicking on the different dive groups in the dive list. The stats page would
always show how many dives where in a group when the group was selected, except
when there was only one dive in the group, in which case the statistics for all
the dives were shown.
With this change we also show the statistics for the selected dives, even if it
is just one. If you want the statistics for all dives, simply select them all
(Ctrl-A or Command-A on a Mac).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We spend way too much effort trying to get gtk to manage the dives that
are selected. The straw that broke the camel's back is that gtk forces us
to expand any nodes that we want to select - so selecting a summary entry
for a dive trip forced us to expand all the dives in the dive trip. Which
as Linus pointed out really sucked from a user experience.
So instead we now completeley ignore gtk's weird idea of what is selected
and what isn't and simply track things ourselves. We still need to play
some games with gtk to make sure that the correct rows are SHOWN as
selected, but still, the overall code seems much cleaner.
This commit contains a bunch of debugging code that is ifdef'ed out -
this is extremely useful to make sure I didn't mess anything up, but
eventually I'll want to remove that again as it just looks ugly in the
code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dive list now seems to behave intuitively.
In order to do this we had to intercept the select function in addition to
having a selection-changed callback. That way we can simulate the
multi-level selection and unselection that was missing.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We keep track of the DIVE_INDEX of all selected dives and simply re-select
those dives after changing model (date based sort or sort by other
column).
There are a few TODOs left. We lose the sort direction (ascending /
descending) when switching models. We also don't correctly deal with the
user selecting summary rows in the tree model.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Several people reported the average time problem, but there's another
one lurking there too: if the dive duration is zero, you get bogus
average depth information too (but because that one was a floating point
divide, and by default they are unsignalling on x86, it didn't crash, it
just resulted in bogus results).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
old_sac_time was always 0 when calculating average air consumption.
Thus the results were incorrect. Move the counter to stats_t structure
as suggested by Linus.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
If at least 2 dives are selected, show statistics of these dives on
Overall Stats. Otherwise, show the statistics of all dives. Temperature
is also added to the shown statistics.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Minor change to avoid adding statistics.h (moved the global variable and
external function declaration to display-gtk.h).
Another minor change to the text displayed for the "Stats" notebook page.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't really like calling the shallowest dive "min depth", but all other
texts that I could come up with that were reasonably short weren't any
better...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now this just changes the infrastructure - nothing outside of
statistics.c is modified. This is simply in preparation to split out the
single dive info and the total dive statistics in the future (as we are
creating more info and more stats and they will overflow the screen area
available - so this will turn into two notebook tabs).
This commit does not change any functionality.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Miika fixed the statistics code that didn't properly check for the "no
cylinder info" case - this cleans it up and just uses the helper
function in equipment.c.
Rename the helper to be slightly better named while at it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
O2 per cent from dive computer should be shown in Dive Info if one is
given even without pressure information for the cylinder.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The statistics page calculates air use separately, and also needs to be
fixed up for the split of the pressures into sample-vs-start/end.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Make statistics.c use snprintf() with weekday(), monthname() instead of
strftime(). The mingw strftime() ends up having lots of problems at
least on Windows unless you set the locale just right, so just avoid the
problem by doing the simple function by hand. We already did that in
other places anyway.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This provides the relevant information for the currently selected dive
plus a bunch of statistics over all dives in the dive_table.
The visual design has lots of room for improvement
- right now the different fields change size
- it might be nice to have a more modern look for the entries
- the O2/He field is odd - for most divers the He value will
always be 0, so maybe we should only show He if there's at least one
dive that uses He? Also, we simply do a comma separated list of gases
for all the tanks used
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>