Ticket #63 - divinglog 5.08 import issues
This patch will include the GPS coordinates from divinglog.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 0f31b71c3588 ("User documentation - describe the dive profile")
the description of the depth profile coloring was incorrect.
I also fixed some language issue and tried to better describe the zoom
options.
Finally I increased the revision number of the user manual.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 90d3c5614a ("Centralising and redefining values as integers")
broke SAC-rate calculations. In particular, it changed "to_ATM()": to
use the centralized SURFACE_PRESSURE helper define, but in the process
it changed a floating point calculation to an integer calculation, and
it threw away all the fractional details. Any user of "to_ATM()"
basically dropped to an accuracy of a single atmosphere.
The good news is that we didn't use to_ATM() for things like depth
calculations, but only for cylinder pressures. As a result, the error
ends up being relatively small, since the pressures involved are big,
and thus the error of rounding to whole atmospheres is usually in the
1% range. The cylinder sizing tends to be off by more than that
anyway. But it was wrong, and not intentional.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code was written to get the SAC rate correct, but we probably do
want to have the duration and mean depth of the dive always be shown for
the non-surface-time.
So move the code from the sac-rate calculation to the generic dive fixup
part. This makes the dive list and statistics all show the duration as
the under-water duration, which is not necessarily the same as
"difference between beginning and end of dive".
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We computed a made-up average depth based on the maximum depth, and used
that. That's questionable even if we didn't have any explicit average
depth to begin with, but it's particularly wrong if we did have an
explicit average depth to use.
Now, admittedly we have no way to actually create fake dives like this
with a particular average depth, so this really doesn't make any
difference in real life. But we should do this right.
Also, make the XML be in the format that subsurface actually saves
things in (mainly things like cylinder sizes having an extra decimal
place, but also ordering of XML elements).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This assumes that you are not breathing your cylinders while at the
surface, which may or may not be correct, but is usually the right
thing. Regardless, we're better off giving a conservative (higher) SAC
rate estimate for a diver that breathes his cylinder at the surface too
than giving an artificially low one because the diver ended up using his
snorkel and we didn't take that into account.
NOTE! This basically calculates a better duration and average depth than
the ones we end up showing in the dive list. Maybe we should actually
show this "no-surface-time" duration and average depth instead of the
ones we do show?
That's a separate question, though.
Added a test-case for the surface case to the sac-test.xml dives.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We even documented that we did SAC in bar*l/min, but the "S" in SAC
stands for "Surface". So we should normalize SAC rate to surface
pressure, not one bar.
It's a tiny 1% difference, and doesn't actually matter in practice, but
it's noticeable when you want to explicitly test for SAC-rate by
creating a test-dive that averages exactly 10m. Suddenly you don't get
the round numbers you expect.
[ Side note: 10m is not _exactly_ one extra atmosphere according to our
calculations, but it's darn close in sea water: the standard salinity
of 1.03 kg/l together with the standard acceleration of 9.81m/s^2
gives an additional pressure of 1.01 bar, which is within a fraction
of a percent of one ATM.
Of course, divers have likely chosen that value exactly for the math
to come out that way, since the true average salinity of seawater is
actually slightly lower ]
So here's a few test-dives, along with the SAC rate fixup to make them
look right.
(There's also a one-liner to dive.c that makes the duration come out
right if the last sample has a non-zero depth, and the previous sample
did not: one of my original test-dives did the "average 10m depth" by
starting at 0 and ending at 20m, and dive.c got a tiny bit confused
about that ;)
[ The rationale for me testing our SAC rate calculations in the first
place was that on snorkkeli.net user "Poltsi" reported that our SAC rate
calculations differ from the ones that Suunto DM4 reports. So I wanted
to verify that we did things right.
Note that Poltsi reported differences larger than the difference of
BAR/ATM, so this is not the cause. I'll continue to look at this. ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This XSLT imports the UDDF logs that I have received samples of. This
includes kenzooid and Heinrichs Weikamp's DR5.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the "Edit dive date/time" dialog, (time->tm_min / 5)*5)
with integers can lose precision due to truncation, showing for example
a value of 55, where 59 is the actual previsouly stored value.
Reported-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The quotes are not needed either (nothing to expand there).
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Someone who is better at shell script writing needs to review this.
Here's what it's supposed to do. Create version strings with three or four
values for darwin or win, respectively, that we can use as the versions of
the bundle or installer. The version that Subsurface reports isn't
affected by this. So in a way this is automating something that's mostly
cosmetic.
If we have a 2 digit version number (like 3.0), do the same the old script
did - add just zeroes if we are on a tag, otherwise add the number of
commits since the tag (and a last 0 if on win).
If we have a 3 digit version numner (like 3.0.1), leave it alone on mac
and add either the number of commits since the tag or a zero if we are on
the tag on win.
Now this can create the same version number for two different versions on
darwin: the first commit after 3.0 and the version tagged as 3.0.1 will
both get the same number. That's kinda silly but remember - the non-tagged
versions aren't supposed to be widely distributed (and the third digit in
them should be much larger than anything we'd ever release; we are
already on commit 16 since the last tag and hopefully will never release a
3.0.16 as tagged release). And of course the full version as displayed in
the About box is always able to tell things apart because of the SHA added
at the end if it's a non-tagged version.
So why all this magic? The reason we do this is so that during development
we are able to create Mac and Windows installers and they get reasonable
version numbers, based on the versioning that these vendors suppose. And
without manual intervention.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The problem is that when we reach the gas change depth and compute the
stop time, no gas change event is created yet but time_at_last_depth tries
to determine the gas for the stop from events.
So instead we pass o2 and he as parameters of that function and calculate
the wait time based on that information.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently at least in Unity on Ubuntu 12.10 using those icons causes the
default Menu text to be displayed (Back instead of Import).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
statistics.c required a small context (gender related) fix
for msgid "Shortest".
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may look as a simple formatting change and won't make much sense
to the C programmer. It is an actual bug fix in Subsurface for the
target compiler, since it introduces bogus instructions.
The "month" variable ends up being incremented up to 72 for a single
"month++" call (if inside offset brackets).
gcc -v
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
--disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
--disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)
OS: Windows 7 [6.1.7601] - x64
Better explained here:
http://lists.hohndel.org/pipermail/subsurface/2013-February/003967.html
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
"<unit>/min" should be OK for most Latin languages, but for Cyrillic
we have to translate "min" as well.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A "\n" was giving 2 lines height for the layout.
Wipping it out makes unnecesary the *2 divisor.
As there may be wrapped strings in tank we need to take
account of this height. There is no need, really, to get the
height of the gasmix or gas_consumed strings, as they are
"semi-fixed" size, but under some locales and imperial units they
could be wrapped too.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 28aba5a206 ("Flesh out the UDDF xml parsing a bit more")
improved on parsing UDDF files by teaching "percent()" to also handle
pure fractions like UDDF uses. So in a UDDF file, an o2 value of "1.0"
means "100%".
But it turns out that I have a few dives with "1% He", and the "Turn
fractions into percent" logic also turns that into 100%.
So this makes the 'percent()' function a bit smarter. If it actually
finds a percentage-sign after the number, it knows it is already
percent, not a fraction. That disambiguates the two cases: "1.0" is
100%, but "1.0%" (note the explicit percentage sign) is 1%.
So now our native format cannot get confused, because it generally
tries to avoid naked numbers. Good choice.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch will add ndl='0:00 min' attribute on all the samples that
have stoptime or stopdepth set when importing from JDiveLog. This hack
ensures that dive computer's deco ceiling is shown.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses the example UDDF file from Jan Schubert's Heinrichs Weikamp
DR5 dives, and now parses the dive dates, the cylinder mixes and the gas
switch events correctly (or at least partially).
It's not perfect: the gas mix has an "id" field that we ignore, and
instead we just depend on the cylinders being in order (which they seem
to be). And I have rather limited test-cases, so maybe something else
is messed up too. But for the six example dives I have, this gives
reasonable data.
Test-data-by: Jan Schubert <Jan.Schubert@gmx.li>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- on uninstall, delete all XSLT files and the "$instdir\xslt" folder itself
- manage a desktop icon (i believe we had that before?)
- ignore SVG files, as we are now embedding them as static resources
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
About 220 strings are missing from each of them - it's better to give
people a consistent English experience than a half-translated one.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most of the actual version numbers are derived from the git tag, but we do
have the fallback hard-coded in the Makefile (e.g. for people building
from a source tar-ball).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I like to mention the most important features first (thus the profile is
added to the introductory chapter).
Moving word 'also' to different place on the GPS paragraph to indicate
that map is not the only way of inserting GPS coordinates.
JDivelog import was in 2.1 release so removed from here (it is actually
written JDiveLog - with capital L - should probably be fixed in user
manual).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
GET_LOCAL_SAC did not check if the two entries had different time stamps
and could therefore cause a divide-by-zero. x86 doesn't fault on that -
it's still wrong. This now calls a function that does proper checking of
all the values involved in the calculation.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Display the filename in error message instead of just text 'ZIP file'
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This checks that weight and dive durantion are defined before importing.
(Empty value concatenated with unit gives an error on import.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
test_xslt_transforms():
xmlGetProp uses strdup(), so we have to clear the memory if a pointer
is returned.
xmlFree() doesn't seem very portable (strangly enought), so we
use free(..) directly.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
osm_gps_map_get_default_cache_directory() uses stdc:strdup to allocate
memory for the returned string. Lets try to free the memory
pointed by 'cachebasedir'.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a new method in info.c called info_widget_destroy(), which
clears all GtkListStore instances. The method is exposed via
display-gtk.h and called from gtk-gui.c:on_destroy().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Even if these exists for the heap lifespan, we can call:
g_object_unref(dive_list.treemodel);
g_object_unref(dive_list.listmodel);
in divelist.c:dive_list_destroy()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There were some small leaks before here, related to gtk_tree_iter_copy(),
but there is another one in select_next_dive():
nextiter = gtk_tree_iter_copy(iter);
This now requires a SJ near the epilog where we do the memory cleanup.
Lets call this similar label consistently "free_iter" between
select_prev_dive and select_next_dive.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>