First stab at plotting a pO2 graph

So far this is done unconditionally. This already starts some of the
infrastructure for other gases, but so far only O2 is handled.
We also need a pressure scale on the right to make this useful - or we
need to do peek / trough pressure prints like we do for temperature and
depth.

Finally, I think I want to move the plot further down, maybe make the
whole plot area taller if we are plotting partial gas pressures as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change preferences into a notebook and add second page for tec settings

Not sure this is the best naming scheme (General Settings / Tec Settings)
but it's a start.

The idea is to have the settings that a recreational diver might care
about on the first page, and all the other stuff on the second one. Let's
see how this works out long term. For now I moved OTU over and added
toggles for the different partial pressure graphs (only the pO2 one is
implemented so far).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add vertical space to depth plot if we are showing partial pressure graphs

Fairly simplistic change that modifies the way we calculate the "maxdepth"
for a particular dive as that is used to scale the plot vertically.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix the pO2 calculation when diving with air

So few of my dives are on air that at first I didn't notice - but for
those dives we set the o2 permille to 0 - which of course causes incorrect
(and extremely deadly) pO2 of 0...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add pHe and pN2 plotting

Adjust the color for pN2 to the standard for this gas (black). We keep pO2
green (even though the ISO 32 color for that would be white). pHe is
marked in brown (which is the matching standard color).

Calculate correct partial pressures for the synthetic plot info points at
the beginning and end of the dive.

Minor fine tuning to the positioning / scaling of the temperature plot
when partial pressures are plotted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Plot text values for partial pressure graphs

The algorithms attempt to identify "interesting" points where the user
might want to know the value of the graph.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix incorrect variable reuse bug in preferences dialog

This was introduced in commit ee803ef5d85b "Change preferences into a
notebook and add second page for tec settings"

In order to be able to get the new default XML file name back from the
button, we need to keep that variable around and not overwrite it with
more buttons for the tec preferences page.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fine tune the vertical spacing of the graphs

Whatever I pick here, there will be dives where the different graphs end
up interfering with each other. I don't think there isn't an easy, generic
solution for this (but I can envision awesome non-easy solutions - they
just don't seem to be worth the effort).

But for most dives that I played with this seems to work pretty well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Be smarter about printing gas partial pressure text

We always want to print absolute maxima and minima - but not when multiple
consecutive data points all have the same value (this happens, for
example, when printing a pHe plot on non-helium dives - or when the dive
profile includes a brief surface intervall which causes all the partial
pressures to be at their minimum).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't print mean depth across the whole profile area

I can't remember why we initially did this instead of ending the
horizontal red line whith the last data point of the pressure profile. But
especially nuw with more graphs shown the one line that extends past the
end of the dive looked really silly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove pN2 debug printout and add disabled code for partial pressure scale

The pN2 print shouldn't have been committed, but I don't want to try and
rewrite all the commit history. Oh well.

The pressure scale I am ambivalent about. It seems that it should be
useful - but that would require guide lines that coincide with the values
which would really throw off the visual for me. So I added the code, but
left it disabled.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Merge branch 'po2'

Plotting pO2 / pN2 / PHe