Commit graph

10183 commits

Author SHA1 Message Date
Linus Torvalds
842b05415f Make all the normal widgets uneditable and non-focusing
We always keep the focus on the dive list, so that the random gtk focus
handling doesn't suddenly randomly make us edit the combo boxes when the
cursor up/down keys start changing them instead of the dive list.

This means that dive location, notes and buddy/divemaster aren't
editable at all any more, but I'll fix that by making a separate dive
edit popup window.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-18 11:13:02 -02:00
Linus Torvalds
9930e1ecad Merge branch 'sacplot' of git://github.com/dirkhh/subsurface
* 'sacplot' of git://github.com/dirkhh/subsurface:
  Color tank pressure plot based on relative sac
2011-11-18 10:14:37 -02:00
Dirk Hohndel
47a0e0e4be Color tank pressure plot based on relative sac
Linus suggested that instead of using absolute SAC values to base the
color on (which forced us to pre-define which SAC rates are green and
which are red) we should color the tank pressure plot relative to the avg
SAC rate of that dive - which I think makes the coloring much more useful
to spot when on your dive you were doing well and when you were not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-18 09:57:49 -02:00
Linus Torvalds
160745c545 Merge branch 'sacplot' of git://github.com/dirkhh/subsurface
* 'sacplot' of git://github.com/dirkhh/subsurface:
  Color pressure plot according to current SAC rate
  Fix minor coding standard issues introduced by my last commit
2011-11-17 18:38:46 -02:00
Dirk Hohndel
4cff1f5b90 Color pressure plot according to current SAC rate
Similar to color indicating vertical speed in the profile plot we now use
color in the tank pressure plot to indicate current SAC rate.

We use a 45 sec sliding window to make sure we cover at least two breaths
for each current SAC sample to avoid artificial oscillation based on
breathing rhythm for corputers with high sample resolution.

Not sure about the color coding that I'm using right now - it's green-ish
for SAC rates under 15l/min ~= .55cuft/min and turns yellow and red as you
go higher. That seems to work well for me, but for other divers this may
be way off (or at least not as useful). Maybe this should be configurable?
This is a lot more diver specific than the vertical velocity where there
are clear recommendations based on safety considerations on what is good
and bad.

As a side effect, this removes the color coding that showed you whether
you were looking at pressure data from samples (green) vs. interpolated
pressure data (yellow). Not sure if people really want to see that. We
might be able to indicate this differently (I am thinking different line
width or transparency or something along those line)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-17 18:13:10 -02:00
Linus Torvalds
c486a9ee81 Remove redundant duplicate pressure samples
At least the Suunto pressure transmitter seems to be pretty
"quantisized", and it will send identical samples for a while until the
pressure changes enough.  Then subsurface gives this silly flat line
with a sudden jump downwards, which *could* be you suddenly taking a
deep breath after holding it for a while, but almost certainly it's a
sensor issue.

So just remove successive identical pressure readings.  They aren't
interesting, and subsurface will actually do a good job of interpolating
it according to SAC rate instead.  And they just make the XML look
worse.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-17 12:03:11 -02:00
Linus Torvalds
1268e0d225 Show dives "latest-first" by default
You can still order them by date by just setting the sort order on the
date column, but normally you'd be more interested in the most recent
dives.

I tried to just scroll down to the last ones automatically instead, but
gtk makes that *really* hard to do.  If you do it in the natural place
for it, the scroll bar wll show up later and then cover up the last
entry anyway.  So you'd have to do some crazy expose event thing or
something.  Which may be the right thing to do eventually anyway, but
not worth the pain right now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-16 16:30:34 -02:00
Linus Torvalds
7930567c27 Show more of the dive location in the dive list
Randomly picked up to 60 characters.  But maybe we should just get rid
of the limit entirely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-16 16:29:38 -02:00
Dirk Hohndel
4891fa812f Fix minor coding standard issues introduced by my last commit
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-13 15:51:34 -02:00
Linus Torvalds
ede70c03b0 Merge branch 'forlinus' of git://github.com/dirkhh/subsurface
* 'forlinus' of git://github.com/dirkhh/subsurface:
  Make sure SAC and OTU get recalculated after cylinder info was changed
2011-11-13 15:41:05 -02:00
Dirk Hohndel
97a1dd6830 Make sure SAC and OTU get recalculated after cylinder info was changed
Also fixed minor coding style issues (prevent useless code from being
executed).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-13 15:29:07 -02:00
Linus Torvalds
f967d6fb26 Fix the stupid gtk combo box text reset issue for real
Lubomir's solution to fill them with a newline doesn't work.  Well, it
may work on some versions of gtk, but on mine it just results in an ugly
box for the control character '000a' that tries to show the newline.

So this is a third approach: if we reset the text to empty, first set it
to space (to clear it), and then set it to empty.  That seems to work on
at least one version of gtk, and doesn't have the problem with the space
*remaining* when you cut-and-paste something into the combo box.

Let's see if it breaks anything else, but at worst it should be no worse
than the old "set it to space" approach - iow the combo box might
remember the space, but at least not some random data from the previous
dive that it happened to show.

Lovely gtk bugs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13 15:17:38 -02:00
Lubomir I. Ivanov
f826470d32 gtk_combo_box_entries and empty text
Passing -1 to gtk_combo_box_set_active, seems not to work as the gtk
documentation explains; there might be a bug in the library or some
special case that is not explained.

could be related to:
  http://mail.gnome.org/archives/gtk-devel-list/2004-March/msg00170.html

passing \n seems to "trick" the cell renderer to clear the entry
completely.  This is a temporary solution.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13 15:10:14 -02:00
Linus Torvalds
5c2fca2620 Save cylinder O2/He content after the cylinder type description
This changes the save format xml to be a bit more readable: instead of
putting the gasmix first, put the cylinder type (size, workpressure and
description) first, then gasmix, then pressure details.

It makes no difference for machine parsing, but I think it's a lot more
logical for humans that actually look at the xml file.  And we really do
want to make the xml file readable by humans.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-10 21:42:37 -02:00
Linus Torvalds
b4938ec2de Make the sample-vs-cylinder pressure check more liberal
This makes it consider them to be identical if they are within half a
bar of each other.  If you edit the pressures by hand and set them to
the same bar pressure as the samples, they may not be identical to the
last milli-bar, but clearly the manually entered cylinder pressure isn't
significantly different from the sample data, so consider it redundant.

We do want manual overrides of cylinder pressures to take precedence
over sample data (as Dirk so eloquently puts it, some dive computers
really don't have very reliable sample data), but at the same time the
sample data is the one we are expecting to be fairly accurate.  The
starting and ending pressure overrides are for when there is no sample
data, or when the sample data is totally wrong for some reason.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-10 21:33:38 -02:00
Dirk Hohndel
2b0f30c3d4 This should fix the missing end pressure for broken dive computers
Some dive computers randomly drop samples. That was no problem unless it
was the LAST sample. We work around that now

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-09 20:15:48 -05:00
Linus Torvalds
c5073aa446 Remove unused 'minpressure/endpressure' fields from plot info
.. and fix the maxpressure to actually look at *all* the cylinders, so
that if you don't have sample data, but rely onmanually set cylinder
pressures, it now really is the max of all the cylinders.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 19:37:18 -05:00
Linus Torvalds
34d7950961 Merge branch 'bugfixes' of git://github.com/dirkhh/subsurface
* 'bugfixes' of git://github.com/dirkhh/subsurface:
  Fix breakage caused by Linus' changes to tank pressure handling
2011-11-09 19:23:59 -05:00
Dirk Hohndel
0d7ad02f87 Fix breakage caused by Linus' changes to tank pressure handling
We no longer look at the start and end pressure for a tank, if the tank
has valid pressure data in its samples (which makes sense). Sadly that
breaks the current pressure interpolation code. With this patch most of
those problems should be fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-09 19:15:28 -05:00
Linus Torvalds
d86623e6a1 Merge branch 'testdata' of git://github.com/dirkhh/subsurface
* 'testdata' of git://github.com/dirkhh/subsurface:
  Improve temperature text plotting in profile display
2011-11-09 18:24:09 -05:00
Dirk Hohndel
4317bfaa11 Improve temperature text plotting in profile display
- make the text a lighter color so it stands out more
- change the heuristic when we print text to include both relative change
  in temperature and time since the last text was printed
- print the first temperature we encounter
- allow an ending temperature to be printed if the last printed
  temperature was before the 75% mark of the dive

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-09 13:31:57 -08:00
Linus Torvalds
d03a92728f Merge branch 'testdata' of git://github.com/dirkhh/subsurface
* 'testdata' of git://github.com/dirkhh/subsurface:
  Correctly plot dives ending below the surface
2011-11-09 12:31:06 -06:00
Linus Torvalds
c51b105526 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:57:06 -08:00
Linus Torvalds
8e6bdc4f94 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:37:49 -08:00
Linus Torvalds
04b076cf40 equipment: clean up cylinder pressure spinbutton setup
This is just in case I end up doing the graying out of implicit pressure
information: I wanted to clean things up a bit first.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:33:13 -08:00
Linus Torvalds
049b895d9b 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:21:48 -08:00
Linus Torvalds
66c04f4f47 Fix up the statistics page use of pressure data
The statistics page calculates air use separately, and also needs to be
fixed up for the split of the pressures into sample-vs-start/end.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:18:00 -08:00
Linus Torvalds
c32cff2c6b 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:16:49 -08:00
Linus Torvalds
0089dd8819 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09 08:13:17 -08:00
Linus Torvalds
2b26b6433f If we don't have cylinder working pressure, we sill want to show the volume
.. 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-09 07:59:28 -08:00
Dirk Hohndel
e38eb77e30 Correctly plot dives ending below the surface
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-09 07:53:10 -08:00
Lubomir I. Ivanov
97f09f3ea8 don't use strftime() due to locale issues
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-07 08:50:06 -08:00
Linus Torvalds
6fa702bcbd 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-05 13:51:37 -07:00
Miika Turkia
350462949d 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.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-05 13:24:53 -07:00
Dirk Hohndel
4b735521e2 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).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 15:38:46 -07:00
Dirk Hohndel
93d07f631a Don't test for liquid Helium
Simply accept temperatures that are above absolute zero.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 15:09:56 -07:00
Dirk Hohndel
68bd80dff4 Update test dives
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-04 14:54:22 -07:00
Dirk Hohndel
c52b95d502 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?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 14:32:15 -07:00
Dirk Hohndel
edbba678b3 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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 14:25:20 -07:00
Dirk Hohndel
d906c82f31 Clear O2/H2 field if there is no tank information
Found using the new test dives

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 11:00:48 -07:00
Dirk Hohndel
0e64a22c14 Don't display a water temperature of absolute 0 in info/stats page
Found using the new test dives

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 10:57:26 -07:00
Dirk Hohndel
ef7771ebf2 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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 10:47:38 -07:00
Linus Torvalds
e810d211a6 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 22:11:31 -07:00
Linus Torvalds
38ccc15214 Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface:
  Exclude obviously bogus SAC values from statistics calculations
2011-11-02 16:49:33 -07:00
Dirk Hohndel
a416847d3b Exclude obviously bogus SAC values from statistics calculations
Random cutoff is 2.8l/min (or about 0.1cuft/min)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02 15:31:41 -07:00
Linus Torvalds
81f013f3f1 Merge branch 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface
* 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface:
  Fix drag and drop error
2011-11-02 14:43:07 -07:00
Dirk Hohndel
f89aec94e2 Fix drag and drop error
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-02 14:35:47 -07:00
Linus Torvalds
3c69c9b935 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
2011-11-02 14:20:28 -07:00
Dirk Hohndel
b9179aabd5 Fix typo that broke min SAC calculation
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-02 13:30:49 -07:00
Dirk Hohndel
ba6c570831 Surface interval is calculated from the END of previous dive
Silly mistake

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02 13:27:25 -07:00