aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2011-11-09Fix up air use calculations for new pressure handlingGravatar Linus Torvalds
Make sure that we calculate air use by using the proper start/end pressures, with the manually set ones being used preferentially over any possible sample data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09Don't save cylinder start/end pressures unless set by handGravatar Linus Torvalds
Keep the sample pressure start/end data separate from the overall cylinder start/end data - and clean the overall cylinder start/end data if it matches the samples exactly to avoid the redundancy. This breaks all the SAC calculations etc, which expect the cylinder pressures to always be in the cylinder data. I'll fix that up separately. The reason for this is that we really want to keep the manually entered data separate: the pressure plotting doesn't need the confusion, and considers end-point data (with interpolation) very different from sample data. Also, we do not want to pollute the xml save-file with data that is computed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09If we don't have cylinder working pressure, we sill want to show the volumeGravatar Linus Torvalds
.. although in that case we can only ever show the volume in liters, and cannot do a conversion to cubic feet even if the user has set imperial units. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09Correctly plot dives ending below the surfaceGravatar Dirk Hohndel
I thought we had fixed this before - but I guess it got broken again somewhere. We now make sure that the plot_info ends on an entry with depth 0. Added test14 to verify the fix. Also fixed cut'n'paste errors in a few test dive files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-07don't use strftime() due to locale issuesGravatar Lubomir I. Ivanov
Make statistics.c use snprintf() with weekday(), monthname() instead of strftime(). The mingw strftime() ends up having lots of problems at least on Windows unless you set the locale just right, so just avoid the problem by doing the simple function by hand. We already did that in other places anyway. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-05Make the xslt style sheet finding search a set of possible pathsGravatar Linus Torvalds
This allows us to install the xslt files in multiple places. Right now the path defaults to the subsurface xslt install directory, the relative directory "xslt" and the current working directory. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-05Use XSLT file to open JDiveLog logsGravatar Miika Turkia
Open JDiveLog files by translating them to subsurface format using XSLT. These files are identified by the name of the first element (JDiveLog) and transform is applied to only these. The XSLT feature is compiled in only if libxslt is installed. The transformation files are installed globally in Linux under /usr/share/subsurface/xslt. Windows and OSX still need appropriate Makefile changes and testing. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-04Fix missing pressure plot at start of the dive in some situationsGravatar Dirk Hohndel
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>
2011-11-04Don't test for liquid HeliumGravatar Dirk Hohndel
Simply accept temperatures that are above absolute zero. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04Update test divesGravatar Dirk Hohndel
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>
2011-11-04Improve tank pressure plot for computers that create "gaschange" eventsGravatar Dirk Hohndel
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>
2011-11-04Don't repeat redundant minima or maxima in the profile plotGravatar Dirk Hohndel
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>
2011-11-04Clear O2/H2 field if there is no tank informationGravatar Dirk Hohndel
Found using the new test dives Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04Don't display a water temperature of absolute 0 in info/stats pageGravatar Dirk Hohndel
Found using the new test dives Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04Replace Linus' dives with useful test dives that help test the appGravatar Dirk Hohndel
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>
2011-11-02Work around some gtk oddity with gtk_combo_box_entries and empty textGravatar Linus Torvalds
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>
2011-11-02Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface: Exclude obviously bogus SAC values from statistics calculations
2011-11-02Exclude obviously bogus SAC values from statistics calculationsGravatar Dirk Hohndel
Random cutoff is 2.8l/min (or about 0.1cuft/min) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Merge branch 'drag-n-drop-fix' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface: Fix drag and drop error
2011-11-02Fix drag and drop errorGravatar Dirk Hohndel
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>
2011-11-02Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* '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
2011-11-02Fix typo that broke min SAC calculationGravatar Dirk Hohndel
Actually more of a cut'n'paste-o Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Surface interval is calculated from the END of previous diveGravatar Dirk Hohndel
Silly mistake Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* '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
2011-11-02Add Info & Stats page to the notebookGravatar Dirk Hohndel
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>
2011-11-01Even more places with pressure and volume conversionsGravatar Dirk Hohndel
Amazing at how many spots we are re-implementing the wheel. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01Further cleanup of pressure and volume conversionsGravatar Dirk Hohndel
I'm amazed at how many spots we were doing conversions - some of them subtly different than others. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01Use unit functions to get column headers, add unit function for pressureGravatar Dirk Hohndel
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>
2011-11-01More consistency improvementsGravatar Dirk Hohndel
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>
2011-11-01Add new helper function to get temperature and unitGravatar Dirk Hohndel
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>
2011-11-01Fix 'init_ui()' so that it can change argc/argvGravatar Linus Torvalds
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>
2011-10-31Using RegQueryValueEx instead of RegGetValueGravatar Lubomir I. Ivanov
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>
2011-10-31win32/nsi: added confirmation to store registry settingsGravatar Lubomir I. Ivanov
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>
2011-10-31Merge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurfaceGravatar Linus Torvalds
* '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
2011-10-31Add Debian packagingGravatar Roland Dreier
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>
2011-10-31Don't run gtk-update-icon-cache if DESTDIR is setGravatar Roland Dreier
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>
2011-10-31Use the new packaging directory for MacOSX specific files, and provide shell ↵Gravatar Henrik Brautaset Aronsen
script workaround to make the svg icon reachable. - 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>
2011-10-31Ignore process serial number argument when run as native MacOSX appGravatar Henrik Brautaset Aronsen
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>
2011-10-31Add basic MacOSX app bundle install targetGravatar Henrik Brautaset Aronsen
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>
2011-10-30XSLT to transform JDiveLog to Subsurface formatGravatar Miika Turkia
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>
2011-10-29Merge branch 'mingw-port-cleanup' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* '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
2011-10-29Fix up end conditions for divesGravatar Linus Torvalds
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>
2011-10-29Plot fake profile for non-sample divesGravatar Linus Torvalds
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>
2011-10-29Fix use of uninitialized variable if there are no samplesGravatar Linus Torvalds
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>
2011-10-29Fix Windows install destinationGravatar Dirk Hohndel
I used Desktop for trying things out and forgot to switch back to the more traditional "Program Files" Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29Get rid of the terminal window that is displayed under WindowsGravatar Dirk Hohndel
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>
2011-10-29Add first cut of the mingw cross build spec file + nsi fileGravatar Dirk Hohndel
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>
2011-10-29Get icons working correctly under WindowsGravatar Dirk Hohndel
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>
2011-10-29Merge branches 'mingw-port-cleanup' and 'combobox-text-entry-fix' of ↵Gravatar Linus Torvalds
git://github.com/dirkhh/subsurface * '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
2011-10-28Update the known locations / buddies / divemasters as user enters themGravatar Dirk Hohndel
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>