Remove Linus' plan input UI

This was added in commit 594da00612ab "Do a minimal hook-up of the dive
plan tree view to the actual planning" and has been replaced by a
different UI in subsequent commits. No point in keeping it around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Display dive profile of the dive we plan, as we plan it

As the user enters data into the entry fields, that data is validated and
as soon as there is enough data we start constructing a dive profile,
including the final ascent to the surface, including required deco stops,
etc.

This commit still has some serious issues.

- when data is input that doesn't validate, we just print a warning to
  stdout - instead we need to change the backgroundcolor of the input
  field or something.
- when we switch to the last dive in order to show the profile we don't
  actually search for the last dive - we just show the first one in the
  tree. This works for the default sort order but is of course wrong
  otherwise

I'm sure there are many other bugs, but I want to push it out where it is
right now for others to be able to take a look.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Split up and re-organize the plot entry calculations

This splits up the (very complex) function that calculates all the plot
info data, so that the gas pressure logic is in several helper
functions, and the deco and partial pressure calculations are in a
function of their own.

That makes the code almost readable.

This also changes the cylinder pressure calculations so that if you have
manually set the beginning and end pressures, those are the ones we will
show (by making them fake "sensor pressures").  We used to shopw some
random pressure that was related to the manually entered ones only
distantly (through various rounding phases and the SAC-rate calculations).

That does make the rounding errors more obvious in the graph, but we can
fix that separately.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix pressure_time calculation for SAC-rate

The code was using bar, not atm to calculate the pressure_time
multiplier.  But SAC-rate is relative to atm.

We could do the correction at the end (and keep the pressure_time in
"bar-seconds"), but let's just use the expected units during the
integration.  Especially since this also makes a helper function to do
the calculations (with variables to keep the units obvious) instead of
having multi-line expressions that have the wrong units.

This fixes what I thought were rounding errors for the pressure graphs.
They were just unit confusion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Split up helper functions for interpolating gas pressure

This splits up the function to create the estimated pressures for
missing tank pressure information.

The code now has a separate pass to create the beginning and ending
pressures for segments that lack them, and fill them in to match the
overall SAC-rate for that cylinder.

In the process, it also fixes the calculation of the interpolated gas
pressure: you can see this in test-dive 13, where we switch back to the
first tank at the end of the dive.  It used to be that the latter
segment of that cylinder showed in a different color from the first
segment, showing that we had a different SAC-rate.  But that makes no
sense, since our interpolation is supposed to use a constant SAC-rate
for each cylinder.

The bug was that the "magic" calculation (which is just the pressure
change rate over pressure-time) was incorrect, and used the current
cylinder pressure for start-pressure calculation.  But that's wrong,
since we update the current cylinder pressure as we go along, but we
didn't update the total pressure_time.

With the separate phase to calculate the segment beginning/ending
pressures, the code got simplified and the bug stood out more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>