Improvement for various bits of the planner

Rewrite of the actual planner logic. Now ascend to the next potential stop
depth. There the state is cached and we try to ascend to the next stop
depth. If we hit the ceiling while doing that we go back to the cached
state and wait there for a minute. Then we try again. Then loop.

Converted all depth related variables from unsigned int to int. During
planning, in a time step the current depth can temporarily be negative and
comparisons of a negative int with an unsigned it have not the result I
expected ( (int) -2 < (unsigned int) 3 turns out to be false). And we
don’t really need the 32nd bit that unsigned buys us for depths.

Deco stops are now shown in the same table as manually entered stops in
boldface (I removed the second table to save screen estate).

The gas shown in the table is still misleading as it means the gas used on
the segment leading up to that event.

The update of the profile only works partially upon changes in the list of
available gases.

Treatment of various gases is basically there but needs some more love.

The ascent velocity is now provided by a function that takes the current
depth as argument. Currently it always returns 10m/min but that will later
be variable (and hopefully user configurable).

The profile is not redrawn while deco is computed (avoiding an infinite
recursion).

The table got a new column for the duration of a segment while the old
“duration” column was renamed “Runtime” to reflect what it actually shows.
Currently, only the run time but not the duration are editable.

All deco gases are used from the depth where their pO2 is 1.4bar. This
should become more flexible.

Calculation of the pressure drop in cylinders without configured volumes
is suppressed. This solves a problem with the planner crashing when saving
a dive where not all cylinders had been manually given a volume.

[Short rant break: Treating 0/0 as air bites back at so many places. E.g.
Cylinder data is initialized with memsetting the whole structures to 0.
Then later suddenly this totally unconfigured cylinder is being treated as
it would contain air. Maybe at some point this was a feature. But it lead
to a naughty bug which took me over an hour to resolve. We should
seriously reconsider this choice and better move to 209/0 being air if
changing this everywhere is not too much trouble]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Quick whitespace cleanup

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Mark a lot of TODO's where I think it should be moved to C code.

This marks a lot of todo's where I think there's core stuff being mangled
on the interface - we should remove this from the interface to make
testing and maintenability easier.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Removed the globals 'userid' and 'save_userid_local' variables

This is a preferences setting, it should belong to the preferences
structure.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Moved code around to make possible to compile the C part alone.

The C code should be compilable without the need to compile the Gui part,
too. This is expecially good for unit testing as we can test all the
algorithms without a window appearing out of nowhere.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Correctly edit air/water temp in dive struct

When changing the values of air/water temp after the first time and save,
it will be reset the intial value.
This is fixed by removing the "select_dc" (which makes the change to the
dive struct instead).

Fixes #457

Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fixed mismatched connections

Fixed connections to call drawProfile() in diveplanner whenever cylinder
table widget is edited.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Comments added to planner

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when manually adding a dive

When a manually added dive is saved we cancel the plan. In that process
we throw away the cylinders which triggers a redraw of the profile. Which
tries to access the diveplan and its data points that have already been
freed. BOOM.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update translations

I am not the author of all these changes, just pulling them from
Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove unused variables and fix signed/unsigned mismatch

The depth types are unsigned for dive plan datapoints.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
More translations

I am not the author, just pulling them from Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change the default font on Windows to Calibri

Changing the default font on Windows to Calibri instead of Sans to fix the
subscript issue.

Fixes #461

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
More translations

I am not the author of these changes, just pulling them from Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Out of tree cross build for Windows

This way I can have a different directory from where I build Windows
binary without interfering with my native build in the source directory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
User manual: Replace some graphics

1) Two of the major screen images were replaced to reflect the current
   screen layout with the new features of the profile toolbar.
2) The heart rate button is depicted and desribed.
3) Minute changes to the text of the manual to accompany the above changes.
4) The Uwatec Galileo image is re-inserted in the icons folder. Somewhere
   it got lost.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
More cross building stuff

This is all mostly to make my life easier.
I'm not thrilled with the marble changes - as Linus pointed out before the
way we do these "LIBxxxDEVEL" changes is broken as it will still first
link against any library installed in the system. But since I have removed
any globally installed copies of these libraries this actually works for
me and it does help when experimenting with different build options for
the main libraries that we depend on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Windows cross build: use the correct objdump

This one was silly but took me a while to track down.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Windows out of tree cross build: stage package in correct folder

When doing an out of tree build you don't want to stage the package with
the source but under your current directory. So let's make sure we
distinguish between source and target here... and instead of putting
things into packaging/windows they now end up in staging which is much
more consistent. And to make my life even easier, the installer .exe ends
up in the base dir in which you build the package.

Also, we link statically against libdivecomputer, so don't pack the dll.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix a minor bug in the tags widget.

Using the auto-completer while the tags widget is 'empty', always picked
the first choice.

Write some letters and remove them in an empty tags widget, the complete
list of tags will appear - now if you try to choose any tag with the
keyboard arrows it will choose the first one. also if you tried choosing
it by mouse it will be inserted twice.

This is fixed by removing the unneeded else part.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>