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>
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>
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>
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>
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>
.. 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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
.. 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>
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>
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>
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>
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>
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>