Commit graph

591 commits

Author SHA1 Message Date
Linus Torvalds
f9bb3f7910 Clean up reference tank information table
This makes the reference tanks ("struct tank_info") use a saner format
which specifies explicitly whether the size is in ml or cubic feet, and
whether the pressure is in psi or bar.

So instead of having magic rules ("size is in cuft if < 1000, otherwise
mliter"), just set the size explicitly:

	{ "11.1 l", .ml = 11100 },
	{ "AL80",  .cuft =  80, .psi = 3000 },

and then the code can just convert to standard measurements without any
odd rules, and the initialization table becomes self-explanatory too.

This is in preparation for doing the metric tanks with pressure: Henrik
Aronsen sent a really ugly patch using the previous setup, I just
couldn't stand the additional hackery.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11 11:54:17 -08:00
Linus Torvalds
f078bc04e1 Make the cylinder table columns unsortable
They were never intended to be sortable, but using common code with the
dive list picked up that "sort by index" thing by mistake.

If we really want to be able to sort cylinders by O2 percentage (which
really doesn't seem to make much sense, considering that you usually
have just one or two cylinders) we will need to also handle the case of
editing the (differently sorted) cylinder table.  Which we don't do now.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11 11:40:17 -08:00
Linus Torvalds
50d026230f Allow editing of Helium values in cylinder info
Henrik Aronsen points out that we've not made it possible to edit the He
percentages for trimix diving.  It's easy enough to do, I just didn't
have any dives that needed it myself.  So here goes.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11 11:09:37 -08:00
Miika Turkia
6131dbc74c Round the maximum depth on dive list
Round maximum depth on dive list to get consistent data between the dive
list and dive info.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09 09:58:03 -08:00
Linus Torvalds
9b1ea2ae6d Use common helper function for the "no cylinder info" case
Miika fixed the statistics code that didn't properly check for the "no
cylinder info" case - this cleans it up and just uses the helper
function in equipment.c.

Rename the helper to be slightly better named while at it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09 09:52:59 -08:00
Miika Turkia
fe532a585c Show O2 per cent if given in cylinder info
O2 per cent from dive computer should be shown in Dive Info if one is
given even without pressure information for the cylinder.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09 09:49:04 -08:00
Linus Torvalds
c912e1fafb Subsurface 1.2
With the whole UI change (three-paned window and different look with new
colors), let's just make a new release, as Dirk points out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-08 12:20:05 -08:00
Linus Torvalds
95cc317b08 Merge branch 'stars' of git://git.hohndel.org/subsurface
* 'stars' of git://git.hohndel.org/subsurface:
  Fix some issues with star rating code
  Add typical 0 to 5 star rating for dives

Still not great editing, but other than that it looks good.
2011-12-08 12:14:27 -08:00
Dirk Hohndel
52748412ff Fix some issues with star rating code
To waste less space in the tree view heading we simply put a star in the
heading instead of "Rating".

We now treat "zero stars" to mean "not rated" and don't store that value
in the XML file.

Rating is no longer a top level tag in the dive entry but instead a
property of the dive tag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-07 20:49:22 -08:00
Dirk Hohndel
af290d5eb2 Add typical 0 to 5 star rating for dives
This works ok-ish, but doesn't allow us to click on the stars and edit
them in the divelist, which a user might expect to be able to do - in
most "star rating UIs" you simply click on the n-th star to set that
rating. Here you need to edit the dive and pick the rating from a drop
down menu.

Minor oddity: you can actually (if you force it) write anything you want
into the star rating. But anything that isn't one of the predefined
strings simply results in a zero star rating.

Overall the UI feels a bit... forced. But I think this is quite useful
anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-07 15:11:06 -08:00
Linus Torvalds
1cb9fc7fb4 Make view action shortcuts be ctrl-[1-4] instead of Fn keys
Suggested by Henrik Aronsen, and seems much more natural.  Especially
with lots of keyboards having function keys oddly mapped.

Suggested-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-07 08:08:29 -08:00
Linus Torvalds
7721036fab Add shorthand actions for showing just one of the panes
Currently just tied to F1-F4 (for divelist, profile, info, and "all
three" respectively), which is just crazy.  But using "ctrl-P" for
"Profile" isn't sane either, that's the standard printer keyboard
shortcut.  So what would be good keyboard shortcuts for these things?

I also wonder how I can get gtk to shut up about the fact that a pane
becomes too small for the contents of that pane? We very much want to do
that, and it's very intentional.  Gtk does the right thing apart from
the whining (and apart from the visually ugly part of a widget that
doesn't fit, but making it pretty doesn't really seem possible).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-06 13:00:01 -08:00
Linus Torvalds
ce6c3ee56d Merge branch 'grid-to-back' of git://github.com/henrik242/subsurface
* 'grid-to-back' of git://github.com/henrik242/subsurface:
  Move depth/time grid back
2011-12-06 10:58:06 -08:00
Henrik Brautaset Aronsen
34a0f5255a Move depth/time grid back
The temperature profile was behind the white depth/time grid.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-06 19:45:38 +01:00
Henrik Brautaset Aronsen
3f624a2eb3 Remove commented code
I left some printer-spesific commented code in there.  Away with it.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-01 12:28:38 +01:00
Henrik Brautaset Aronsen
b65f8230da Clean up color definitions
Fix ugly printout, give colors proper names, make grid lines and alert
marker easier to see, and specify printer colors independently.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-01 12:14:21 +01:00
Henrik Brautaset Aronsen
fc6fec59ba Define all colors in one place
The profile colors were defined all over the place, so I put them all in one spot.  I'm unsure if this is the best solution to that problem, but I guess it's a step in the right direction.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-11-28 18:19:50 +01:00
Henrik Brautaset Aronsen
36db51f2e7 Prettier profile colors
The profile colors aren't very pretty, and the grid lines are too thick.
This commit tries to improve that.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-11-28 13:58:18 +01:00
Martin Gysel
46e72b698a makefile: use dumpmachine instead of grep for Target
grep for Target doesn't work on non english platforms
-dumpmachine is (hopefully) supposed to always return
the target machine tuple

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-27 12:14:07 -08:00
Linus Torvalds
addfe79024 Merge git://github.com/JoachimSchipper/subsurface
* git://github.com/JoachimSchipper/subsurface:
  README spelling, capitalization
2011-11-27 12:12:13 -08:00
Linus Torvalds
ee68ada729 Merge branch 'windows-fixes' of git://git.hohndel.org/subsurface
* 'windows-fixes' of git://git.hohndel.org/subsurface:
  fix mingw-win32 specific warnings in libdivecomputer.c
  Fix mingw-make.sh to find correct xslt-config
2011-11-27 12:07:49 -08:00
Joachim Schipper
aeb367e0a7 README spelling, capitalization
Spelling: paragrahps -> paragraphs.

Update the README's example commit message to start with a capital
letter. Capitalize "Java".

Signed-off-by: Joachim Schipper <joachim@joachimschipper.nl>
2011-11-27 18:42:00 +01:00
Dirk Hohndel
ff0209a5b4 fix mingw-win32 specific warnings in libdivecomputer.c
1) since %lld is not defined in the MSVC runtime, use
the portable PRId64 macro from inttypes.h for 64bit integers

notice in inttypes.h from mingw-win32:
/* 7.8.1 Macros for format specifiers
 *
 * MS runtime does not yet understand C9x standard "ll"
 * length specifier. It appears to treat "ll" as "l".
 * The non-standard I64 length specifier causes warning in GCC,
 * but understood by MS runtime functions.
 */

2) include unistd.h to disable warning:
warning: implicit declaration of function 'usleep'

Lubomir's code then caused a warning building natively under Linux, which
I fixed as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2011-11-27 09:10:37 -08:00
Dirk Hohndel
9b9355c770 Fix mingw-make.sh to find correct xslt-config
I hadn't noticed that xslt was available as cross built library as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-27 09:08:55 -08:00
Linus Torvalds
19356de246 Merge branch 'windows-fixes' of git://git.hohndel.org/subsurface
* 'windows-fixes' of git://git.hohndel.org/subsurface:
  Add more typecasts for Windows`
  Fix the Windows preferences support
  Update the Windows installer creation script
2011-11-25 21:51:34 -08:00
Linus Torvalds
0d879f8fbe Remove stale notebook drag-and-drop support
It doesn't make sense with the new three-pane layout, and I don't think
we're reviving it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-25 21:50:38 -08:00
Dirk Hohndel
192713680e Add more typecasts for Windows`
This is based on an older patch by Lubomir I. Ivanov <neolit123@gmail.com>
which no longer applies due to the refactoring of the registry setting
code.

It takes care of all of the casts between actual C types and the Windows
specific types that the Windows API functions expect. It also adds some
comments to the overloading of "value" in our subsurface_set_conf function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-25 20:19:58 -08:00
Dirk Hohndel
d2654d4951 Fix the Windows preferences support
Now that I can test Windows binaries again, the bugs were rather easy to
spot. Because of the different flow of the opening, writing and closing of
the registry key my first attempt got things wrong - we simply always
create the key with all access rights; if it exists Windows will just open
it for us. The second bug was a cut'n'paste error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-25 19:48:53 -08:00
Dirk Hohndel
a9d1f318b5 Update the Windows installer creation script
This now works with a straight out of the box MinGW install on OpenSUSE.
A simple shell script that shows how to invoke the cross build is
included.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-25 19:48:09 -08:00
Dirk Hohndel
042c77c0fc Improve cross compile support and fix windows.c
This should make the Makefile much more robust when cross compiling.

The windows.c code is now compile tested but not functionally tested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-24 22:34:39 -08:00
Linus Torvalds
290ce56d01 Merge branch 'mac-fixes' of git://git.hohndel.org/subsurface
* 'mac-fixes' of git://git.hohndel.org/subsurface:
  Split reading/writing preferences into OS specific files
2011-11-24 10:42:37 -08:00
Dirk Hohndel
671f6544ac Split reading/writing preferences into OS specific files
This adds tested code for Linux and Mac OS, implementing the api that
Linus suggested.

The Windows code was moved into its own file, but hasn't even been compile
tested, yet.

In order to have just one interface to set or get a preference value we
encode TRUE as (void *) 1 and FALSE as NULL. This works consistently on
all platforms and regardless of whether we have 32 or 64 bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-24 10:12:40 -08:00
Linus Torvalds
cb2114f263 Merge branch 'mac-fixes' of git://git.hohndel.org/subsurface
* 'mac-fixes' of git://git.hohndel.org/subsurface:
  Preference handling on Mac
2011-11-22 15:57:08 -08:00
Dirk Hohndel
cf6e0e7ca1 Preference handling on Mac
This cleans up the platform conditional handling and gets rid of gconf on the Mac.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-22 12:20:36 -08:00
Dirk Hohndel
b577484998 Exclude surface intervals from sac rate calculation
We assume every sample with a depth of less than 10cm to be on the
surface.

This does not impact our interpolated pressures (one could assume that the
diver is not breathing from the regulator when on the surface - but
without air integration that's just an assumption).

It also doesn't change our tank pressure coloring by sac rate as that
always uses the momentary sac rate. Technically speaking this might impact
the actual colors printed (as those are relative to the total sac on the
dive which may go up due to this change).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-21 13:23:13 -08:00
Dirk Hohndel
0d1f8f9a5d Don't colorize the pressure plot when printing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-21 12:35:42 -08:00
Dirk Hohndel
0f13971869 Add debugging function to dump tank pressure tracking data
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-21 12:29:16 -08:00
Linus Torvalds
e5471e3fe8 Remove suunto parsing hacks from parse-xml.c
We can just depend on Miika's xslt transform instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-21 11:35:06 -08:00
Miika Turkia
61f3114fce XSLT to import SDM dive log
This is tested with Linus' sample data, all basic functionality seems to
be working properly. Gas changes are implemented but not tested as there
was no samples of those. Multiple cylinders are missing because there
was no samples available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-21 11:33:52 -08:00
Miika Turkia
5a046d94ea Support for importing multiple XSLT formats
Have information of multiple XSLT files on an array for importing
"alien" formatted XML dive log files. Adding support for new XSLT
requires updating the array and adding the XSLT file (provided the
format can be identified by root element of the XML).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-21 11:33:52 -08:00
Linus Torvalds
f09266897b Merge branch 'multi-pane'
* multi-pane:
  Experimental hard-coded three-pane layout

Ok, so it's not perfect, but I've been using a version of this for the
last week or so by now, and every time I go back to the old layout I
just cringe.

So the three-pane window approach requires much more display area, and
probably wouldn't work wonderfully on low-resolution devices (ie 720x480
or even 1024x600).  So for anybody doing a cellphone port, you may need
to play around with the interface.  But this should be usable even on a
netbook, although not as good as on a device with more pixels.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-20 10:35:27 -08:00
Linus Torvalds
a643e740dc Do proper rounding in interpolated pressure calculations
We do all the pressures in mbar, which has plenty of precision for
interpolated pressures - even when we then do our discrete integration
over many samples.

However, when we calculate those interpolated pressure points, we should
make sure that we round the result correctly, otherwise the consistent
rounding errors (from truncating the FP value into our integer mbar
values) will result in a final pressure that is noticeably off in ugly
ways (ie "end pressure set by hand to 750 mbar, but shown as 748").

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-20 10:27:33 -08:00
Linus Torvalds
bb421a416d Revert "Correctly plot the tank end pressure if it was set manually"
This reverts commit abdee5b1b8.

There's no point in doing random hacks.  Instead, do the intermediate
pressure calculations with proper rounding instead of always truncating
to mbar.  With the math done correctly we have enough precision that the
end result of the pressure interpolation doesn't have the kind of errors
that caused Dirk to try to fix things up later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-20 10:27:19 -08:00
Linus Torvalds
e8230c9d13 Merge branch 'sacplot' of git://git.hohndel.org/subsurface
* 'sacplot' of git://git.hohndel.org/subsurface:
  Fix error when gaschange event is one second before next sample
2011-11-19 13:22:21 -08:00
Dirk Hohndel
855df669d9 Fix error when gaschange event is one second before next sample
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-19 13:18:10 -08:00
Terrance Stanfield
c9df1f868c Fix the Makefile '-c' location, add XML2CFLAGS
I was getting the following error:

   dive.h:8:25: fatal error: libxml/tree.h: No such file or directory
   compilation terminated.

So I updated the Makefile to fix that error and follow the standard in
the file.

Signed-off-by: Terrance Stanfield <t@hollowcranium.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 13:11:22 -08:00
Linus Torvalds
2d26dbc9f7 Merge branch 'sacplot' of git://git.hohndel.org/subsurface
* 'sacplot' of git://git.hohndel.org/subsurface:
  Correctly plot the tank end pressure if it was set manually
2011-11-19 12:59:48 -08:00
Linus Torvalds
c36bf636bd Experimental hard-coded three-pane layout
I'm not happy with it, but it looks good and works better than the
alternatives I've looked at so far.

So why not happy? It's not configurable, and gtk really doesn't do a
great job with the case of notebook widgets that are shrunk to be
smaller than the contents (the cut-off gets ugly, and is outside the
notebook page!)

But committing as a way to keep track of this, and let Dirk use it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 12:54:58 -08:00
Dirk Hohndel
abdee5b1b8 Correctly plot the tank end pressure if it was set manually
While printing the last pressure in the calculated sequence may seem more
logical, given that the discrete series will create some amount of error
this simply looks wrong. Instead we pick the end pressure that was
manually set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-19 12:47:07 -08:00
Linus Torvalds
25e18211ec Merge branch 'sacplot' of git://git.hohndel.org/subsurface
* 'sacplot' of git://git.hohndel.org/subsurface:
  Make pressure plot shading by sac rate consistent
  Improve tank pressure sac coloring
  Be more consistent in our handling of rgb value tables
  Remove redundant linear sample tank pressure data
2011-11-19 12:25:35 -08:00