Added information about yearly statistics

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Screenshot for preferences

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't do "remove_trip()" by walking the gtk data structures

They are complicated and confusing.  Just use our own data structures
and re-generate the gtk ones from them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't do "remove_from_trip" by walking the gtk data structures

They are complicated and confusing.  Just use our own data structures
and re-generate the gtk ones from them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix find_trip_by_idx() over-zealous cleanup

Commit bcf1f8c4feb9 ("Don't do "remove_from_trip" by walking the gtk
data structures") made find_trip_by_idx() only work for negative indexes
(positive indexes are dives), but when it removed the unnecessary test
for negativity, the statement inside it should have been kept as
unconditional, rather than removed with the test.

Oops.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't do "insert_trip_before" using the gtk data structures

.. use our own data structures instead, and regenerate the gtk ones
after having successfully created the new trip.

This simplifies the code enormously, and also makes it much more
generic.  You can now create a new trip from any arbitrary set of
selected dives (it used to be that the "multiple selected dives" case
worked, but only for some very specific special cases of selected dives).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rewrite "merge_dive_into_trip_above()" using our own data structures

This does the moving of dives into the trip above without the complexity
of the gtk data structures, and instead just recreates the whole
divelist afterwards.  As usual, this simplifies things a lot, and the
less gtk-specific code we have, the better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Tiny update to Norwegian translation of dive context menu

It just sounds better this way

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remember non-expanded state in 'remember_tree_state()' too

The 'remember_tree_state()' thing is meant to remember if a dive trip is
expanded or not, but it missed the "or not" part.  IOW, it never cleared
the expanded flag, it only ever set it.

As a result, if you were doing multiple operations on the divelist tree
(testing all the recent gtk-model removal, for example) the dive trips
would end up expanding more and more, even if you collapsed things by
hand in between operations.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Documentation: updated section "Edit the Dive Info"

- Made tables of semi-formatted texts.
- Rewrote some of text because the screenshot and table are both
  about the same thing. The screenshot is more important now, the
  table is explanation of screenshot.

Signed-off-by: Reinout Hoornweg <reinout@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Documentation: update main windows image

Sent to the list by Miika for inclusion in the user manual...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remember pre-existing trip expansion state when autogrouping

This just adds the "remember_tree_state()" and "restore_tree_state()"
calls around the divelist update when autogrouping is turned on: that
way existing expanded groups aren't blindly collapsed.

It makes it much easier to see what autogrouping does if it only groups
a few dives, because the overall state of the divelist isn't radically
changed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Obviate the need for explicit 'remember_tree_state/restore_tree_state' calls

Instead, just keep track of the expanded state of trips as we get the
gtk callbacks for the state changes (which we need to track anyway for
the selection logic), and automatically restore the state whenever we
re-create the divelist.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: Start calculations with gas 0 instead of air

The planner had a fatal flaw in that it ALWAYS started with AIR, even when
clearly claiming to use the correct gas. We only picked up correct gases
from events, but not at the beginning of the dive (where there is no
event).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: fix incorrect gas change event

We stored the He permille instead of the He percentage. But for most
casual testing this was hidden by the previous bug.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Documentation: Updated "Edit Equipment Info"

- More lists converted into tables.
- Minor changes to text.

Signed-off-by: Reinout Hoornweg <reinout@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Makefile quorks :( Yes we want a 'doc' target for itself...

...to avoid generating the HTMLDOC target even if it needs not to.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Documentation: more tables in "View Info & Stats"

- Even more tables.
- Renamed the chapter to "View Dive Info & Stats" because one of the
  tabs being described is named "Dive Info" and not "Info".

Signed-off-by: Reinout Hoornweg <reinout@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix tracking of selected dives across sort column changes

With  commit 800b0482f39e ("When switching sort order, scroll the dive
list to the current dive") we introduced an unwanted new behavior. When
changing sort columns we could lose all selections except for the main
"selected_dive". This was caused by the call to gtk_tree_view_set_cursor
on the selected_dive which unselected all other dives.

As a side-effect this also fixed another bug that was introduced by the
same change: shift-cursor-up and -down now works again to select multiple
dives with the keyboard.

But fixing that bug unearthed a different issue. Our code that restored
the selection state of the tree model oddly decided to mark a divetrip as
selected if its first child was selected. The bug above masked that by
immediately unselecting the trip again, but now that this was fixed the
problem was immediately obvious: we would start with both the first trip
and the first dive in that trip selected (well, since we are in reverse
order it's actually the chronologically last trip and last dive...).

Instead we now use the remembered state of the trip to determine whether
it should be expanded or selected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Preserve keyboard focus when changing sorting order in the divelist

When the user changes the dive list sorting order via clicking
on different column titles, using gtk_widget_grab_focus() gives
keyboard focus back to the list itself (not staying on the column titles),
which gives a hint that the list itself has focus index of 0 and is
reset each time the widget receives this type of "initial" focus.

Acked-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>