Rewrite show_location to use membuffer primitives

This simplifies the logic and doesn't rely on show_utf8 to print empty
blocks.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: Change when we recalculate deco

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: Implement ascend rate according to GUE standard procedures

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: Add waipoints when changing ascend rate in planner

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: show gas for the NEXT segment

For deco stops show the gas of the next segment in the table. In
recalculation remove old deco stops earlier.

In struct diveplan, the items are "segments" with a beginning, a duration,
and a gas. In contrast, the UI of the planner uses "waypoints" which are
the boundaries between segments. It is conventional at least for deco
stops to display the gas of the _next_ segment in the runtime table (i.e.
the gas possibly to be switched to).

Furthermore, in addStop, the old deco stops have to be removed earlier as
otherwise a new waypoint later than a previous generated gas switch
inherits the gas of the old switch.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: Offer to discard the plan when Quit is triggered in planner.

Upon pressing Ctrl-Q or the window close button a modal dialog was shown
to remind the user that the planned dive is not saved.  This patch
triggers the "cancel plan" action before trying to quit.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix building with NO_MARBLE after prototype change

4243fcb915 ("Dont set coordinates when two or more dives are selected")
Changed how the prototypes in GlobeGPS looks. This aligns NO_MARBLE
version of GlobeGPS with that.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove unnecessary include from dive.c

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use enum name instead of its int value.

SAMPLE_EVENT_GASCHANGE2 is the libdivecomputer name of the event.
Compare with that instead of its int value.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use the used flag on cylinders in get_dive_gas

Now when we have a used flag on every cylinder that are set in
mark_used_tanks we can use it here.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When starting the planner, copy cylinders from currently selected dive.

This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner.

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