libdivecomputer doesn't actually seem to support air temperature
reporting at all, but at least for Suunto dive computers the air
temperature is recorded as the temperature for the first sample.
So since we already have vendor-specific libdivecomputer hacks, let's
just add that one as a rule. It may be that other divecomputers do this
too, so this adds it as a generic concept - it's just that right now the
flag for "air temperature in first sample" is only set for Suunto dive
computers.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It used to be that when you checked the "Prefer downloaded" checkmark,
we'd throw away *any* old dive computer data. That was good, because it
allowed us to start from a clean slate when you had some old subsurface
data with questionable dive computer data.
However, it was a bit extreme, and it's really not what you want if you
already have (good) dive computer data from other dive computers.
So this modifies the logic a bit. Instead of throwing away all old dive
computer data, the "Prefer downloaded" checkmark now means:
- the newly downloaded data becomes the "primary" dive computer data
(ie the first in the list)
- if there was old dive computer data that *could* have been from this
new dive computer (ie it didn't have model information, or it had a
matching model but no device ID data), we throw that away
- but any existing dive computer data from other dive computers is left.
This seems to be much closer to what we really would want for a new
"preferred" download.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
libdivecomputer has started giving the Suunto serial numbers in a
different format, which means that we have the same device with two
different serial numbers, and then we need two different ways of turning
the numerical entity into a string.
Look at the number pattern to see figure out which version of the format
it is that libdivecomputer is reporting, and turn it back into the
original format so that we can reliably give the right string for it.
This also mean sthat the device ID stays the same regardless of
libdivecomputer version.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This replaces the really lame "italics text" from commit abe810ca1a29
("Mark locations that have GPS location data attached") with a marginally
less lame GPS icon.There's a reason why I am not making a living as
graphics artist. But I think this is a huge step forward from what we had
before...
The satellite.svg file is very loosely based on a different icon that I
found as public domain here http://www.clker.com/clipart-30400.html.
From that I created the PNG and then that was converted into the
GdkPixdata via gdk-pixbuf-csource; a rule for that was added to
the Makefile but commented out as I don't know if this tool will always be
available in the path. Having this icon included in the sources avoids
locating yet another icon file.
Better icons are certainly welcome!
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also force py27-pygtk to use the quartz variant, since MacPorts
doesn't have variant dependency resolutions.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The osm-gps-map default is to scroll-and-recenter around the mouse position.
That is BAT SHIT CRAZY. So this implements our own scroll handling instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is rather lame - we simply turn the location text into italics for those
dives where we have GPS location data. Underlining might be more natural, but
Gtk plays games with the underline attribute if the mouse hovers over text.
Ideally I would have prefered a little GPS logo next to the location text - but
I couldn't figure out how to do that without writing my own cell renderer which
seemed total overkill.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of opening a new window / new map for every dive site we now have only
two windows / maps. One for the overview of all the dive sites, the other one
that is used to show the map for a specific dive site.
This also switches the position preference from CENTER to MOUSE - this way it's
less likely that the two map windows will be drawn exactly on top of each
other.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should allow the user to build osm-gps-map with jhbuild (all other
required components are already build by the jhbuild default modules).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to work in the most expected ways for people who have used
a version of Subsurface that didn't store the deviceid in the divecomputer
we relax the testing for when a divecomputer entry is assumed to match the
current divecomputer.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1) download_dialog_status_text() had some statements with no effect
due to missing return keywords. This fixes incorrect error reporting.
2) Optimize the traversion of the response XML. Assuming that the
status tag should be always under the root tag. We check if the
root tag has children and enter a loop until we find a the
"download" or "error" node names. If there are no children
we return a parser error.
3) Clamp the number of input characters to 30 in the user id
GtkEntry field.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This allows users to edit one or more nick name entries in a single
session. Entries can also be removed individually.
Based on mock up by Lubomir Ivanov and various conversations from Dirk.
Thanks to both.
[Dirk Hohndel: quite a bit of editing for coding style and whitespace]
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A couple of new files webservice.c and webservice.h are added.
webservice.h exposes two methods at the moment:
- webservice_download_dialog():
this function creates the user interface for the download dialog
from the web service.
- webservice_request_user_xml()
this function is a direct call to retrieve XML for a specific
user identifier. the actual data, data length and error codes
are stored in passed pointers.
A menu entry is added in the Log menu:
"Download From Web Service"
The used backend for communication at the moment is provided
by libsoup.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While we are waiting for an autotools generated Makefile, this should allow
people to build that don't have osm-gps-map.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to be able to work with Gtk3 introspection all the APIs had to be
renamed. Instead of quartz_application... and gtk_osxapplication... all the API
functions are now name gtkosx_application...
This will break the build for people who haven't upgraded to the latest - but
supporting both would be unspeakably ugly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The planner interactively responds to changes to the GFlow and GFhigh in
the dialog and calculates an appropriate profile. If there is a previous
dive within the 48 hours prior to this dive then its saturation is
correctly taken into account if the gradient factors are changed - so if
they are aggressively lowered it is possible to start the dive with
already an existing ceiling (simply increase the surface interval to 'fix'
that).
Once the plan is accepted the GF values are reset to the current
preferences. This can cause the ceiling in the plot to change and the deco
stops to no longer match the ceiling - but that's a logical consequence of
the ability to change a temporary copy of GFlow/GFhigh during the planning
process and not the actual preferences (which would be counter intuitive,
I think).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 293126257b20 ("Mark divelist as changed if user accepts planned
dive") had the correct commit message but an incorrect implementation.
This moves the mark_divelist_changed() call into the GTK_RESPONSE_ACCEPT
clause where it belongs.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The previous flag didn't work on Windows somehow. I guess Photoshop
added some headers that GdkPixbuf didn't like. I've reconverted it
with ImageMagick, which made the file less than half the size. Bonus!
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds the "Show in map" menu entry to the divelist only if we
actually have a location to show.
Of course, having some way to visually see whether we have a GPS
location even before we show the menu would probably be good. Maybe a
marker in the "location" string or something. But in the meanwhile, at
least we don't have that menu entry if we have nothing to show.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a "Show in map" entry in the dive list context menu. It will
zoom to the dive location if it exists, otherwise the full map will be
displayed.
I've also switched map tiles from OpenStreetMap to Google Maps just to
show off that we can.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there's no weightsystem description, as in most imported
dives, print a literal "unknown" instead of null pointer
or blank.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the user clicks OK in the dive planner and the dive is added to the
divelist the divelist needs to be marked as changed so Subsurface prompts
the user to save the file before quitting.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This works on the assumption that the diver uses the deco SAC rate while
on a calculated deco stop and the bottom SAC rate during the rest of the
dive (including the time they move from deco stop to deco stop).
This is making the planning function mostly useful for open circuit
diving.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes it easy to print out a dive plan - it's simply stored in the
notes of the simulated dive we create.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just provides the infrastructure to enter the data, nothing is
calculated, yet.
This adds a new get_thousandths() helper function so we can enter
information of the 'mili-' type as decimal values. So things like
"14.5 l/min" or "0.75 cuft/min" are parsed correctly and converted
into a ml value.
In the process of implementing that I also fixed a bug introduced in
commit ab7aecf16e ("Simplify dive planning code") which broke the
get_tenth() function.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch removes the need for the "string" pressurebuf in planner.c.
It also adds a unit to the partial pressures displayed in the mouse
overlay which are always displayed in bar.
BTW: Has anyone seen a pO2 shown in PSI?
Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface follows the lead of most divecomputers to use times without
timezone - so all times are implicitly assumed to be local time of the
dive location; so in order to give the current time in that way we
actually need to add the timezone offset.
Instead of relying on OS specific members of struct tm we use the glib
timezone functions to get the timezone offset for us. Of course, the
function used to do this is only in glib 2.26 or newer, which once again
means that Debian stable won't be supported. But since that doesn't build
other parts of Subsurface, either, I think I'll live with that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The previous patch in this series adds the function
subsurface_launch_for_uri(), which has to be called from the about
dialog instead of the default function for the URI calls to work
on Windows - i.e. opening links from the dialog.
gtk_about_dialog_set_url_hook() is a deprecated method, but seems
to be the only reasonable way to make the override between GTK 2.20 -
2.24 possible. The "activate-link" signal is recomended instead,
but is not portable for GTK bellow 2.24.
An alternative would be to somehow hack into the GtkAboutDialog
and override the callback for each clickable link.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Opening URI addresses from Subsurface does not work on Windows using
the latest GTK bundle from the Gnome website. The reason lies in GIO
and GLib and how it obtains assigned applications for protocols and MIME
types.
While gtk_show_uri() should be viable for both linux.c and macos.c,
in windows.c ShellExecute() is used, which provides proper support
for the URI calls.
subsurface_launch_for_uri() returns TRUE on success.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
display-gtk.h has a check if gdkkeysyms-compat.h or gdkkeysyms.h
has to be used. In gps.c, from such as "GDK_Up" has to be used,
so that this file compiles on older GTK.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch centralizes the definition for surface pressure, oxygen in
air, (re)defines all such values as plain integers and adapts calculations.
It eliminates 11 (!) occurrences of definitions for surface pressure and
also a few for oxygen in air.
It also rewrites the calculation for EAD, END and EADD using the new
definitons, harmonizing it for OC and CC and fixes a bug for EADD OC
calculation.
And finally it removes the unneeded variable entry_ead in gtk-gui.c.
Jan
Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously we calculate the ceiling at every single second, using the
interpolated depth but then only *save* the ceiling at the points where we
have a profile event (the whole deco_allowed_depth() function doesn't
change any state, so we can just drop it entirely at points that we aren't
going to save)
Why is it incorrect? I'll try to walk through my understanding of it, by
switching things around a bit.
- the whole "minimum tissue tolerance" thing could equally well be
rewritten to be about "maximum ceiling". And that's easier to think
about (since it's what we actually show), so let's do that.
- so turning "min_pressure" into "max_ceiling", doing the whole
comparison inside the loop means is that we are calculating the
maximum ceiling value for the duration of the last sample. And then
instead of visualizing the ceiling AT THE TIME OF MAXIMUM CEILING, we
visualize that maximal ceiling value AT THE TIME OF THE SAMPLE.
End result: we visualize the ceiling at the wrong time. We visualize
what was *a* ceiling somewhere in between that sample and the previous
one, but we then assign that value to the time of the sample itself.
So it ends up having random odd effects.
And that also explains why you only see the effect during the ascent.
During the descent, the max ceiling will be at the end of our
linearization of the sampling, which is - surprise surprise - the position
of the sample itself. So we end up seeing the right ceiling at the right
time while descending. So the visualization matches the math.
But during desaturation, the maximum ceiling is not at the end of the
sample period, it's at the beginning. So the whole "max ceiling" thing has
basically turned what should be a smooth graph into something that
approaches being a step-wise graph at each sample. Ergo: a ripple.
And doing the "max_ceiling during the sample interval" thing may sound
like the safe thing to do, but the thing is, that really *is* a false
sense of safety. The ceiling value is *not* what we compute. The ceiling
value is just a visualization of what we computed. Playing games with it
can only make the visualization of the real data worse, not better.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously we would simply show the first dive in the divelist - which
worked fine in the default sort by trip setting and assuming that there
are no dives from the future in the divelist.
With this commit we actually find the correct dive in the divelist and
select it instead. If you sort by depth you will see the dive move around
in the divelist, but it will stay selected and visible in the profile.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The loop would actually get entered for dive 0 and try to compare things
with dive -1. Which of course fails.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously the code in init_decompression() would mindlessly walk back the
dive_table until it found a gap of at least 48h and take all those dives
into consideration when calculating tissue saturation. This goes horribly
wrong if you load dives from two divers into the same data file.
With this commit things will still turn out correctly, as long as the
dives are in separate trips in for each of the divers. So with this I can
load both Linus' and my divelog and things stay sane even on our shared
dive trips.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- MOD: Maximum Operation Depth based on a configurable limit
- EAD: Equivalent Air Depth considering N2 and (!) O2 narcotic
- END: Equivalent Nitrogen (Narcotic) Depth considering just N2 narcotic
(ignoring O2)
- EADD: Equivalent Air Density Depth
Please note that some people and even diving organisations have opposite
definitions for EAD and END. Considering A stands for Air, lets choose the
above. And considering N for Nitrogen it also fits in this scheme.
This patch moves N2_IN_AIR from deco.c to dive.h as this is already used
in several places and might be useful for future use also. It also
respecifies N2_IN_AIR to a more correct value of 78,084%, the former one
also included all other gases than oxygen appearing in air. If someone
needs to use the former value it would be more correct to use 1-O2_IN_AIR
instead.
Signed-off-by: Jan Schubert / Jan.Schubert@GMX.li
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The max Y value of the partial pressure graph grid tends to be way too
high when only pO2 or pHe is enabled.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With Pierre-Yves' commit with a map widget, here are a couple of example
GPS locations from my own dives.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For each dive recorded, place their GPS coordinates onto a map using the
OSM-GPS-MAP library.
This map is accessible via the "log" menu or the shortcut ctrl+M (M as map).
We check for the GPS coordinates "0, 0" which are the default when we do not
have real GPS coordinates set.
[Dirk Hohndel: fixed int/float math confusion, fixed some whitespace and
coding style issues, cleaned up some comments, added a
missing cast to prevent a compiler warning]
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
.. and add the usual logic to not save the default values.
This also simplifies the initial system-specific setup of both of these:
since we have defaults for all the preferences that get set up at
startup, we can just initialize those defaults to the system-specific
fonts then and there.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>