Linus Torvalds [Wed, 9 Nov 2011 16:51:20 +0000 (08:51 -0800)]
Add "enable" button for manual pressure setting
This grays out the pressure settings in the cylinder editing widget if
the pressure data has been taken from the samples. You can still
manually override the data, but you now need to enable that manual
override explicitly.
This makes the semantics of editing start/end pressures of dives with
pressure sample data a bit more intuitive, I think.
Linus Torvalds [Wed, 9 Nov 2011 16:37:49 +0000 (08:37 -0800)]
Keep the start/end spinbuttons as GtkWidget
For graying things out, we want a widget, not a spinbutton. Although
I'm sure we could just cast things back and forth. But let's be
consistent with what we do, and only ever cast from GtkWidget to
GtkSpinButton, and have the same logic as for the "o2" widget that also
needs to be explicitly enabled.
Linus Torvalds [Wed, 9 Nov 2011 16:21:48 +0000 (08:21 -0800)]
Show the newly split pressures correctly in the equipment page too
NOTE! When *editing* the cylinder data, the only thing shown is the
non-sample pressure. So the cylinder editing widget will show zero for
start/end pressure for a dive that has pressure saples without any
manually set pressure data.
This is intentional, so that you can clearly see that this is not a set
value. But it may be that we should gray out the spinputton and have an
"edit value" checkbox or something to make it really obvious.
Linus Torvalds [Wed, 9 Nov 2011 15:51:00 +0000 (07:51 -0800)]
Fix up air use calculations for new pressure handling
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.
Linus Torvalds [Wed, 9 Nov 2011 15:37:25 +0000 (07:37 -0800)]
Don't save cylinder start/end pressures unless set by hand
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.
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>
Linus Torvalds [Sat, 5 Nov 2011 20:51:37 +0000 (13:51 -0700)]
Make the xslt style sheet finding search a set of possible paths
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.
Miika Turkia [Sat, 5 Nov 2011 10:39:17 +0000 (12:39 +0200)]
Use XSLT file to open JDiveLog logs
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.
Dirk Hohndel [Fri, 4 Nov 2011 22:34:30 +0000 (15:34 -0700)]
Fix missing pressure plot at start of the dive in some situations
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).
Dirk Hohndel [Fri, 4 Nov 2011 21:32:15 +0000 (14:32 -0700)]
Improve tank pressure plot for computers that create "gaschange" events
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?
Dirk Hohndel [Fri, 4 Nov 2011 21:25:20 +0000 (14:25 -0700)]
Don't repeat redundant minima or maxima in the profile plot
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.
Dirk Hohndel [Fri, 4 Nov 2011 17:47:38 +0000 (10:47 -0700)]
Replace Linus' dives with useful test dives that help test the app
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.
Linus Torvalds [Thu, 3 Nov 2011 05:11:31 +0000 (22:11 -0700)]
Work around some gtk oddity with gtk_combo_box_entries and empty text
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.
Linus Torvalds [Wed, 2 Nov 2011 21:20:28 +0000 (14:20 -0700)]
Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
* '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
Linus Torvalds [Wed, 2 Nov 2011 19:39:55 +0000 (12:39 -0700)]
Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
* '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
Dirk Hohndel [Wed, 2 Nov 2011 16:10:57 +0000 (09:10 -0700)]
Add Info & Stats page to the notebook
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
Dirk Hohndel [Wed, 2 Nov 2011 02:56:14 +0000 (19:56 -0700)]
More consistency improvements
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.
Linus Torvalds [Tue, 1 Nov 2011 00:12:59 +0000 (17:12 -0700)]
Merge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface
* '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
Roland Dreier [Mon, 31 Oct 2011 20:05:55 +0000 (13:05 -0700)]
Don't run gtk-update-icon-cache if DESTDIR is set
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>
Use the new packaging directory for MacOSX specific files, and provide shell 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>
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>
Miika Turkia [Sun, 30 Oct 2011 17:47:29 +0000 (19:47 +0200)]
XSLT to transform JDiveLog to Subsurface format
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).
Linus Torvalds [Sat, 29 Oct 2011 23:11:59 +0000 (16:11 -0700)]
Merge branch 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface
* '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
Linus Torvalds [Sat, 29 Oct 2011 22:57:26 +0000 (15:57 -0700)]
Fix up end conditions for dives
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.
Linus Torvalds [Sat, 29 Oct 2011 21:09:27 +0000 (14:09 -0700)]
Plot fake profile for non-sample dives
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.
Linus Torvalds [Sat, 29 Oct 2011 20:24:56 +0000 (13:24 -0700)]
Fix use of uninitialized variable if there are no samples
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.
Dirk Hohndel [Sat, 29 Oct 2011 17:27:49 +0000 (10:27 -0700)]
Get rid of the terminal window that is displayed under Windows
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.
Dirk Hohndel [Sat, 29 Oct 2011 17:02:40 +0000 (10:02 -0700)]
Add first cut of the mingw cross build spec file + nsi file
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...
Dirk Hohndel [Sat, 29 Oct 2011 16:14:15 +0000 (09:14 -0700)]
Get icons working correctly under Windows
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.
Dirk Hohndel [Sat, 29 Oct 2011 05:51:15 +0000 (22:51 -0700)]
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.
Dirk Hohndel [Tue, 25 Oct 2011 09:51:16 +0000 (02:51 -0700)]
Add menu item and dialog to select which events to display
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.
Dirk Hohndel [Tue, 25 Oct 2011 07:29:19 +0000 (00:29 -0700)]
Remember the event names as we encounter them
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.
Dirk Hohndel [Mon, 24 Oct 2011 19:24:51 +0000 (12:24 -0700)]
Annotate Makefile with hints about building under Windows
You can build subsurface with MinGW. It requires installing lots of random
packages, plus some things still don't work. One is that xml2-config
appears to be missing. So this annotates the Makefile to tell a person
building under Windows how to work around this. But we can't make this
platform conditional as this workaround is hardcoding the install path.
Linus Torvalds [Mon, 24 Oct 2011 08:23:09 +0000 (10:23 +0200)]
Subsurface 1.1
We've added a fair amount of features since 1.0 (like multi-tank) and
we've made things a lot prettier and supports editing much more
information. So let's make a new release.
Linus Torvalds [Mon, 24 Oct 2011 05:03:22 +0000 (07:03 +0200)]
Merge branch 'ui' of git://github.com/dirkhh/subsurface
* 'ui' of git://github.com/dirkhh/subsurface:
Disable sorting by dive number
Fix oversight in preference implementation
Make columns for temperature, cylinder, and nitrox optional
Show dive number in dive list
Improve time marker handling and add printing of some time labels
Dirk Hohndel [Sun, 23 Oct 2011 21:23:58 +0000 (14:23 -0700)]
Fix oversight in preference implementation
Not being careful enough doing copy and paste and then making manual
changes... this inconsistency caused subsurface to always store the
opposite of what you wanted in the preferences for SAC and O2%.
Dirk Hohndel [Sun, 23 Oct 2011 15:04:54 +0000 (08:04 -0700)]
Improve time marker handling and add printing of some time labels
We now draw time markers at most every 5 min, but no more than 12 markers.
For convenience we do 5, 10, 15 or 30 min intervals.
This allows for 6h dives - enough (I hope) for even the craziest divers -
but just in case, for those 8h depth-record-breaking dives, we double the
interval if this still doesn't get us to 12 or fewer time markers.
We label the first and then every other time marker with the minute text.
Linus Torvalds [Sun, 23 Oct 2011 14:52:45 +0000 (17:52 +0300)]
Handle 'gas change' events correctly
Dirk wrote the multi-cylinder support assuming that the dive computer
always gives the selected cylinder index in the sample data - that's
what his Uemis does, and it makes sense for any dive computer that
supports multiple pressure transmitters.
However, the other case is a dive computer where the pressure samples
are all from cylinder 0, and any other cylinder will have the starting
and ending pressure set by hand. And the gas change events show when
the cylinder change happened.
So this creates a "turn gas change events into pressure sample fixups"
phase just before we actually analyze the pressures. That way the
pressure analysis can alway sdo the right thing, regardless of how the
data was originally stores in the dive.
Linus Torvalds [Sun, 23 Oct 2011 14:18:30 +0000 (17:18 +0300)]
Split the cylinder pressure analysis into a second loop
For the dive computers that give cylinder change events, we want to
re-write the cylinder index and pressure information with the event
information before we start analyzing the pressures. So instead of
filling the plot info and analyzing in one loop, split it up into two
phases. We'll do the "fix up cylinder pressure info based on events" in
between those phases.
Linus Torvalds [Sun, 23 Oct 2011 12:42:57 +0000 (15:42 +0300)]
Merge branch 'plot-multitank' of git://github.com/dirkhh/subsurface
* 'plot-multitank' of git://github.com/dirkhh/subsurface:
Plot tank pressures for multiple tanks
Change plot_info to use depth (instead of val) for depth value
Dirk Hohndel [Sat, 22 Oct 2011 02:04:44 +0000 (19:04 -0700)]
Plot tank pressures for multiple tanks
The code keeps track of the segments of time when a specific tank was used
and interpolates the pressure values for that tank based on a simulated
average SAC rate for the times in which no pressure readings are
available.
This changes the way we used to plot the pressure when only beginning and
end pressure of a tank are known; it used to be a straight line, now it is
a sloped line where the steepness of the slope is proportional to the
depth at that point - which is much more realistic.
We also plot the pressures in two colors now. The old green for pressure
data that came from the input file (that is not the same thing as saying
it came from the computer - divelog for example appear to create pressure
readings in the samples even if it only has beginning and end pressure).
Interpolated values are plotted in yellow. If you have a sub-standard dive
computer which has a frequently failing pressure sensor, you can now tell
the parts of the plot where data was missing and we are filling in.
The function that prints the pressure text labels had to be completely
redone as it previously assumed one tank for the whole dive and
simplisticly printed that tank's start and end pressure at the beginning
and end of the profile plot with the y-values being the maximum and
minimum pressure...
This commit introduces a custom simplistic single linked list data
structure to keep track of the pressure information per segment - Linus
hated the idea of using GList for this purpose, and I have to admit that
in the end this was very straight forward to implement and made the code
easier to read and debug.
Linus Torvalds [Sun, 23 Oct 2011 07:07:01 +0000 (10:07 +0300)]
Make the divemaster/buddy/location text entries be combo box entries
The text entries have completions, but if you want to see the full list
of possibilities, I'm not seeing how to do that without turning the
GtkEntry into a GtkComboBoxEntry.
The list of people/locations are not sorted, though, which makes the
full list less than readable. Will have to do that too.
Linus Torvalds [Sun, 23 Oct 2011 06:47:19 +0000 (09:47 +0300)]
Add completions to the dive location, buddy and divemaster entries
This way you can just type the first few characters of a location you've
been to before, and it will show you a list of possible completions.
Same for buddies and divemasters (which take the completions from a list
of people you've used before).
Linus Torvalds [Sat, 22 Oct 2011 16:39:03 +0000 (19:39 +0300)]
Add a completion for the cylinder type entry combo box
This allows us to start typing the cylinder description and we'll get a
matching list that we can select. This is similar to selecting one from
the model, and works in addition to the explicit selection.
Linus Torvalds [Sat, 22 Oct 2011 15:12:30 +0000 (18:12 +0300)]
Add cylinder data to cylinder model as we record each dive
This way the cylinder model list will contain all the different
cylinders that we have ever seen, rather than only containing the models
that we have *edited*.
That makes it much more practical to add new dives with the same
cylinders that we've used before, because now those cylinders will show
up as cylinder models even if we haven't looked and edited the old dives
first.
Linus Torvalds [Sat, 22 Oct 2011 14:18:58 +0000 (17:18 +0300)]
Fix the reading of the cylinder start/end pressure from cylinder models
The cylinder model doesn't contain the start/end pressures, they just
contain the cylinder type information. So trying to read the start and
end pressure from the cylinder model change callback is totally bogus.
We need to set the start/end pressures from the cylinder info when we
create the cylinder widget, and not touch them when the type changes.
So split up the "set_cylinder_spinbuttons()" function in two: one that
sets the type information, and one that sets the start/end pressure.
Linus Torvalds [Fri, 21 Oct 2011 14:30:36 +0000 (17:30 +0300)]
Merge branch 'minor-fixes' of git://github.com/dirkhh/subsurface
* 'minor-fixes' of git://github.com/dirkhh/subsurface:
Fix "Keep window size for new notebook pages" to not set minimum size
Make the first filename on the command line the default filename
Dirk Hohndel [Fri, 21 Oct 2011 14:13:59 +0000 (07:13 -0700)]
Fix "Keep window size for new notebook pages" to not set minimum size
Turns out I used the wrong function to keep the size of notebook pages
that were ripped off. Using gtk_widget_set_size_request on the new
notebook creates a hard minimum size for this window.
Instead we should use gtk_window_set_default_size on the new window that
is the parent of the notebook. This has the desired effect of creating the
new window with the same size as the one the page was ripped off from -
without making that the minimum size for this window.
Dirk Hohndel [Fri, 21 Oct 2011 03:59:13 +0000 (20:59 -0700)]
Allow multiple selections in the dive list
At this point we don't do anything with this - the commit just provides
the infrastructure changes so that this becomes possible. Subsurface
behaves the same if exactly one dive is selected and simply keeps the last
selected dive if zero or more than one dives are selected.
The goal is to be able to select multiple dives and then do actions on
them. For example pick a tank used for all of them. Or edit the location
or (yet to be implemented) other equipment data like weight carried.
And also to be able to merge multiple dives.
Dirk Hohndel [Thu, 20 Oct 2011 20:11:26 +0000 (13:11 -0700)]
Fixed off by one error in uemis importer
I clearly had never tried this with a dive that used the "just air"
setting the uemis. With this fix the cylinder data for that one tank is
read correctly.
Linus Torvalds [Thu, 20 Oct 2011 19:25:38 +0000 (22:25 +0300)]
Add quick hack for "no sample pressure but tank index changed" case
This isn't right if you switch back to the same cylinder multiple times,
but for the first time it kind of works - just take the beginning
cylinder pressure if we have one.