In some situations we could end up with no sample pressure and no
interpolated pressure at time = 0. This is now fixed.
Fix notes in test dive the exposed the issue.
Also change the code in create_plot_info to keep the number of samples and
the number of corresponding pi entries in separate variables. This avoids
future changes from breaking if they assume they can access
dive->sample[nr_samples - 1] (which is a reasonable assumption to make).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The notes now reflect things that were fixed in the last commits.
Also added more test dives to test other boundary cases.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was exposed by the test dives, but it shows up in small ways with
real dives from some dive computers like the Suunto Vyper Air.
We now insert synthetic plot_info entries that match the gas change event;
to make this look smoother we insert either two events (one for the old
tank, one a second later for the new tank) if there is no sample at the
time of the event, or one additional event (and move the real sample back
by one second) if there is a sample at the time of the event.
This does expose another issue with some dives from Linus' computer where
the pressure in the samples dips below the end pressure noted for the tank
- which creates an odd "yellow up-tick" at the end of using the first tank
in the plot. Maybe we should not insert a synthetic "last of old tank"
event if we have a sample with valid pressure in the last NN seconds
before the gas change?
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we have more than four identical depth readings, the old code would see
those as local maxima and minima and print spurious depth values in the
profile plot.
Yes, in real sample data identical readings won't happen - but in
synthetic data they can and there this looks really bogus.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As much as Linus' dives may be fun to look at, they don't help us test the
app. Writing these test dives I already found a couple of bugs - and I'm
just getting started.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Setting the gtk_combo_box_entry test to th eempty string doesn't "take":
the old text remains. Which does all kinds of funky things when you
switch between dives, and the location (or buddy or divemaster) entry
contains some random stale entry from another dive.
This works around it by using a string with a single space in it
instead, and then removing the space when reading. Not pretty, and
certainly not correct, but it pinpoints the odd behavior. I'm sure
somebody will figure out what the magic gtk incantation is for this.
Also remove the never-used flags for whether the entries have changed.
They were designed to be set by change callbacks, but we never bothered
with it, and just always read the value of the entries instead.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus noted an odd "CRITICAL" warning when ripping off a page of the
notebook and then dropping it within the same notebook.
Turns out we need to simply accept a drop on ourselves and gtk does the
rest correctly.
I also fixed the fact that we incorrectly declared the callback as 'void'.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface:
Fix typo that broke min SAC calculation
Surface interval is calculated from the END of previous dive
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface:
Add Info & Stats page to the notebook
Even more places with pressure and volume conversions
Further cleanup of pressure and volume conversions
Use unit functions to get column headers, add unit function for pressure
More consistency improvements
Add new helper function to get temperature and unit
This provides the relevant information for the currently selected dive
plus a bunch of statistics over all dives in the dive_table.
The visual design has lots of room for improvement
- right now the different fields change size
- it might be nice to have a more modern look for the entries
- the O2/He field is odd - for most divers the He value will
always be 0, so maybe we should only show He if there's at least one
dive that uses He? Also, we simply do a comma separated list of gases
for all the tanks used
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Finally getting more consistent overall in how we convert between the
different units and how we decide which units to display.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Treat SAC and OTU consistently:
- SAC is now a member of struct dive
- it's calculated / populated at the same time with a helper function with
consistent API
Create get_volume_units function that returns volumes (e.g. used in SAC
rates) based on preferred units - make sure we have these conversions just
once in the code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Designed along the lines of get_depth_units - except we don't define a
specific number of digits to show.
Use this in the one spot we need it right now in profile.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That's what gtk_init() does with gtk-specific arguments. IOW, if you do
things like
subsurface --g-fatal-warnings dives.xml
to get a real abort on gtk warnings, gtk_init needs to be able to
actually change argc/argv.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Provides compatibility with winxp-32bit in gtk-gui.c,
since RegGetValue is only available on the 64bit build of the OS.
Fixed whitespace issues, fixed obvious typo (this patch clearly wasn't
even compile tested)
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
a yes/no dialog to clear or store data in HKCU "SOFTWARE\subsurface"
"Do you wish to store subsurface's settings?"
fixed small whitespace issue
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface:
Use the new packaging directory for MacOSX specific files, and provide shell script workaround to make the svg icon reachable.
Ignore process serial number argument when run as native MacOSX app
Add basic MacOSX app bundle install target
Add support for building .deb packages; to use, one can do
$ cp -r packaging/debian debian
$ dpkg-buildpackage -b
This of course requires a libdivecomputer package as a build prerequisite.
Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
We don't want to run gtk-update-icon-cache during a package build, when
we're installing into a staging directory just to create a tree that will
be packaged up and really installed later. The standard heuristic seems
to be to skip gtk-update-icon-cache if DESTDIR is set (ie we're installing
to a different location than we're configured to run from).
Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Make use of the new packaging directory.
- Set a current directory for subsurface to find the svg icon. There might be a pretter solution to this.
- Somehow subsurface doesn't behave properly in the Dock. Running it in the background without Dock integration until we figure out why.
Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
The subsurface binary is invoked with a -psn_x_xxxxxx argument when started from
a native MacOSX app bundle.
Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Native MacOSX app bundles are installed in /Applications. We want a separate
install target for this, since some would probably prefer the regular unixy
way.
Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
XSLT file to transfer dive logs from JDiveLog format to Subsurface
format. It can be used on command line with the following syntax:
xsltproc <divelog.jlb> > <divelog.xml>
Basic functionality such as depth readings and dive information is
currently supported. However, this is only tested in metric units.
What is currently missing is at least tank changes and tank pressure (as
no sample data was available).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface:
Fix Windows install destination
Get rid of the terminal window that is displayed under Windows
Add first cut of the mingw cross build spec file + nsi file
Get icons working correctly under Windows
We used to have the dive plot have two "filler" entries at the beginning
and the end, and indeed that is how they are allocated. However, we fix
up "pi->nr" later to be "lastindex+1", where "lastindex" is the index of
the time we surface.
So when we loop over the plot entries, we actually need to loop all the
way to the end: use "i < pi->nr" instead of "i < pi->nr-2".
We still do have the two extra filler entries at the beginning, though.
So depending on the loop, we might want to start at entry 2.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Right now it just plots something ridiculous, the code is really just
meant to be an example. We migth be able to plot a traditional
staircase plot and make it look somewhat saner by taking mean depth into
account (if it exists).
Right now it just plots a (skewed) rectangular dive profile using the
max depth and total time. Which is obviously insane.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
When creating the plot_info, the 'entry' variable pointing to the last
plot_info data was not initialized (because there was no data to fill
in), and was then incorrectly used to fill in the last tank pressure.
We also used to look at 'dive->sample[0].cylinderindex' even if no
sample[0] necessarily existed.
Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Thanks to Michael Wiedmann I now know the magic incantation to get MinGW
to create a Windows executable that doesn't open two windows, a text
console and the actual gtk window.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These need more work but I'd rather have them here under version control.
The spec file appears to successfully build the Windows binaries, given
the right tar file to start with. Those binaries are then packed into an
rpm file (extermely useless to Windows users).
Once the rpm is unpacked one can then use the NSIS compiler and the .nsi
file to create a Windows installer. This all is still extremely fragile,
but it worked at least once...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this we are able to include both a separate .ico file that the
program can load at runtime and a .res file (that is created from the .rc
file, both in the packaging/windows directory) that is linked into the
executable and makes the Windows Explorer show the correct icon for
subsurface.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface:
Use Registry on Windows to store preferences
* 'combobox-text-entry-fix' of git://github.com/dirkhh/subsurface:
Update the known locations / buddies / divemasters as user enters them
The code that allowed a user to start typing the name of a location, buddy
or divemaster and that would then offer completions has one flaw - it
doesn't add any new names that you enter to its store of names until you
save and restart the app. This patch fixes that.
When reading the code I also noted that the location_changed,
divemaster_changed, buddy_changed variables have become meaningless. They
are set to 1 and tested, but never changed. I wasn't sure if I should
remove the variables (as the code seems to work without them having any
impact), or if we should go back to actually tracking these changes to
prevent unnecessarily marking the divelist as changed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No change at all to non-Windows builds.
Everything seems to work with preferences - but only tested on Win7
Remaining issue: displaying an icon (or the logo in the About dialog)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far this just removes the gconf code - so no preferences for Windows.
It also removes the unsused gconf references in main.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a table with four rows of toggle events and resize it as needed.
This may not create the most beautiful layout, but it works.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now they are displayed in one hbox which doesn't work if you have
many events - but the code itself works and correctly toggles the events
on and off.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't have a way to actually configure this in the app, yet, but
toggling the bits in the debugger shows that this works, so commit this
code now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First step to being able to filter the events that we display in the
profile. We could (in theory) walk all the dives in the divelist when we
need this data, but it seems much more convenient to have them in an array
in one place.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>