]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoDon't repeat redundant minima or maxima in the profile plot
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoClear O2/H2 field if there is no tank information
Dirk Hohndel [Fri, 4 Nov 2011 18:00:03 +0000 (11:00 -0700)]
Clear O2/H2 field if there is no tank information

Found using the new test dives

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDon't display a water temperature of absolute 0 in info/stats page
Dirk Hohndel [Fri, 4 Nov 2011 17:57:26 +0000 (10:57 -0700)]
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>
12 years agoReplace Linus' dives with useful test dives that help test the app
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoWork around some gtk oddity with gtk_combo_box_entries and empty text
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
Linus Torvalds [Wed, 2 Nov 2011 23:49:33 +0000 (16:49 -0700)]
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

12 years agoExclude obviously bogus SAC values from statistics calculations
Dirk Hohndel [Wed, 2 Nov 2011 22:31:41 +0000 (15:31 -0700)]
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>
12 years agoMerge branch 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface
Linus Torvalds [Wed, 2 Nov 2011 21:43:07 +0000 (14:43 -0700)]
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

12 years agoFix drag and drop error
Dirk Hohndel [Wed, 2 Nov 2011 21:35:47 +0000 (14:35 -0700)]
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>
12 years agoMerge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
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

12 years agoFix typo that broke min SAC calculation
Dirk Hohndel [Wed, 2 Nov 2011 20:30:49 +0000 (13:30 -0700)]
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>
12 years agoSurface interval is calculated from the END of previous dive
Dirk Hohndel [Wed, 2 Nov 2011 20:27:25 +0000 (13:27 -0700)]
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>
12 years agoMerge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
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

12 years agoAdd Info & Stats page to the notebook
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

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoEven more places with pressure and volume conversions
Dirk Hohndel [Wed, 2 Nov 2011 04:12:21 +0000 (21:12 -0700)]
Even more places with pressure and volume conversions

Amazing at how many spots we are re-implementing the wheel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFurther cleanup of pressure and volume conversions
Dirk Hohndel [Wed, 2 Nov 2011 04:00:46 +0000 (21:00 -0700)]
Further cleanup of pressure and volume conversions

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>
12 years agoUse unit functions to get column headers, add unit function for pressure
Dirk Hohndel [Wed, 2 Nov 2011 03:13:14 +0000 (20:13 -0700)]
Use unit functions to get column headers, add unit function for pressure

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>
12 years agoMore consistency improvements
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd new helper function to get temperature and unit
Dirk Hohndel [Tue, 1 Nov 2011 18:39:52 +0000 (11:39 -0700)]
Add new helper function to get temperature and unit

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>
12 years agoFix 'init_ui()' so that it can change argc/argv
Linus Torvalds [Wed, 2 Nov 2011 00:09:15 +0000 (17:09 -0700)]
Fix 'init_ui()' so that it can change argc/argv

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>
12 years agoUsing RegQueryValueEx instead of RegGetValue
Lubomir I. Ivanov [Mon, 31 Oct 2011 01:12:51 +0000 (03:12 +0200)]
Using RegQueryValueEx instead of RegGetValue

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>
12 years agowin32/nsi: added confirmation to store registry settings
Lubomir I. Ivanov [Mon, 31 Oct 2011 01:53:37 +0000 (03:53 +0200)]
win32/nsi: added confirmation to store registry settings

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>
12 years agoMerge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface
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

12 years agoAdd Debian packaging
Roland Dreier [Mon, 31 Oct 2011 20:05:56 +0000 (13:05 -0700)]
Add Debian packaging

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>
12 years agoDon't run gtk-update-icon-cache if DESTDIR is set
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>
12 years agoUse the new packaging directory for MacOSX specific files, and provide shell script...
Henrik Brautaset Aronsen [Sun, 30 Oct 2011 21:27:33 +0000 (22:27 +0100)]
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>
12 years agoIgnore process serial number argument when run as native MacOSX app
Henrik Brautaset Aronsen [Sun, 30 Oct 2011 19:56:28 +0000 (20:56 +0100)]
Ignore process serial number argument when run as native MacOSX app

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>
12 years agoAdd basic MacOSX app bundle install target
Henrik Brautaset Aronsen [Sun, 16 Oct 2011 21:16:36 +0000 (23:16 +0200)]
Add basic MacOSX app bundle install target

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>
12 years agoXSLT to transform JDiveLog to Subsurface format
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).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface
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

12 years agoFix up end conditions for dives
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPlot fake profile for non-sample dives
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix use of uninitialized variable if there are no samples
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.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix Windows install destination
Dirk Hohndel [Sat, 29 Oct 2011 19:04:52 +0000 (12:04 -0700)]
Fix Windows install destination

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>
12 years agoGet rid of the terminal window that is displayed under Windows
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd first cut of the mingw cross build spec file + nsi file
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...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoGet icons working correctly under Windows
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMerge branches 'mingw-port-cleanup' and 'combobox-text-entry-fix' of git://github...
Linus Torvalds [Sat, 29 Oct 2011 14:23:41 +0000 (07:23 -0700)]
Merge branches 'mingw-port-cleanup' and 'combobox-text-entry-fix' of 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

12 years agoUpdate the known locations / buddies / divemasters as user enters them
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoUse Registry on Windows to store preferences
Dirk Hohndel [Sat, 29 Oct 2011 01:46:53 +0000 (18:46 -0700)]
Use Registry on Windows to store preferences

No change at all to non-Windows builds.

Everything seems to work with preferences - but only tested on Win7

Remaining issue: displaying an icon (or the logo in the About dialog)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDon't use gconf on Windows
Dirk Hohndel [Fri, 28 Oct 2011 05:10:35 +0000 (22:10 -0700)]
Don't use gconf on Windows

So far this just removes the gconf code - so no preferences for Windows.

It also removes the unsused gconf references in main.c

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCleanup Makefile and make it work for cross compiling with MinGW
Dirk Hohndel [Thu, 27 Oct 2011 16:04:29 +0000 (09:04 -0700)]
Cleanup Makefile and make it work for cross compiling with MinGW

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoRearrange the event filter dialog
Dirk Hohndel [Tue, 25 Oct 2011 11:18:31 +0000 (04:18 -0700)]
Rearrange the event filter dialog

Create a table with four rows of toggle events and resize it as needed.
This may not create the most beautiful layout, but it works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd menu item and dialog to select which events to display
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDon't plot an event if an event is disabled in ev_namelist
Dirk Hohndel [Tue, 25 Oct 2011 08:25:12 +0000 (01:25 -0700)]
Don't plot an event if an event is disabled in ev_namelist

We don't have a way to actually configure this in the app, yet, but
toggling the bits in the debugger shows that this works, so commit this
code now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoRemember the event names as we encounter them
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAvoid using strptime
Dirk Hohndel [Mon, 24 Oct 2011 20:42:36 +0000 (13:42 -0700)]
Avoid using strptime

It's less portable (missing on Windows, for example) and it's kind of
overkill here - the same is easily done with a sscanf.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAnnotate Makefile with hints about building under Windows
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoStop including regex.h
Dirk Hohndel [Mon, 24 Oct 2011 19:17:07 +0000 (12:17 -0700)]
Stop including regex.h

I removed the regex code from the uemis parser a long time ago, but forgot
to remove the #include <regex.h>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMerge branch 'bugfixes' of git://github.com/dirkhh/subsurface
Linus Torvalds [Mon, 24 Oct 2011 11:53:19 +0000 (13:53 +0200)]
Merge branch 'bugfixes' of git://github.com/dirkhh/subsurface

* 'bugfixes' of git://github.com/dirkhh/subsurface:
  Updated changes file
  Create packaging directory and add spec and changes file
  Makefile fixes

12 years agoUpdated changes file
Dirk Hohndel [Mon, 24 Oct 2011 11:34:59 +0000 (04:34 -0700)]
Updated changes file

Turns out that I forgot the -a in the last commit. Sorry

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCreate packaging directory and add spec and changes file
Dirk Hohndel [Mon, 24 Oct 2011 11:26:17 +0000 (04:26 -0700)]
Create packaging directory and add spec and changes file

These work for me on OBS

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMakefile fixes
Dirk Hohndel [Mon, 24 Oct 2011 11:12:44 +0000 (04:12 -0700)]
Makefile fixes

The stupid lib vs lib64 problem. I'm sure there's a more portable way to
handle this, but this at least seems to work.

Also fix the install target. Seriously, you create a directory with mode
644 and claim that this ever worked?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoSubsurface 1.1
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'ui' of git://github.com/dirkhh/subsurface
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

12 years agoDisable sorting by dive number
Dirk Hohndel [Sun, 23 Oct 2011 21:38:33 +0000 (14:38 -0700)]
Disable sorting by dive number

This is based on Linus idea and code - just adding it to my UI branch in
case he didn't actually add it to his code...

It makes no sense to sort by dive number - every sane person will have
dive numbers be chronological; so they can sort by date instead.

But removing this option wastes less space and makes the dive list look
much better

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFix oversight in preference implementation
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%.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake columns for temperature, cylinder, and nitrox optional
Dirk Hohndel [Sun, 23 Oct 2011 20:36:37 +0000 (13:36 -0700)]
Make columns for temperature, cylinder, and nitrox optional

Just like SAC and OTU these can now be turned on and off through the
preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoShow dive number in dive list
Dirk Hohndel [Sun, 23 Oct 2011 15:50:14 +0000 (08:50 -0700)]
Show dive number in dive list

Make sure that renumbering the divelist correctly shows up on the display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoImprove time marker handling and add printing of some time labels
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoHandle 'gas change' events correctly
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSplit the cylinder pressure analysis into a second loop
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'plot-multitank' of git://github.com/dirkhh/subsurface
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

12 years agoPlot tank pressures for multiple tanks
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoEnable inline completion/selection for the location/buddy/dm fields
Linus Torvalds [Sun, 23 Oct 2011 08:00:48 +0000 (11:00 +0300)]
Enable inline completion/selection for the location/buddy/dm fields

This makes Tab completion work, and seems a whole lot more natural.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoKeep the people/location lists sorted
Linus Torvalds [Sun, 23 Oct 2011 07:20:35 +0000 (10:20 +0300)]
Keep the people/location lists sorted

This makes the combo box entry drop-down list be a whole lot more useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the divemaster/buddy/location text entries be combo box entries
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd completions to the dive location, buddy and divemaster entries
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).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd 'activate' callback for the cylinder completion
Linus Torvalds [Sun, 23 Oct 2011 06:45:35 +0000 (09:45 +0300)]
Add 'activate' callback for the cylinder completion

This makes us fill in the size/pressure data for a cylinder even if we
just type the name (rather than pick an entry from the list)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoChange plot_info to use depth (instead of val) for depth value
Dirk Hohndel [Sun, 23 Oct 2011 05:40:53 +0000 (22:40 -0700)]
Change plot_info to use depth (instead of val) for depth value

Also changed a couple of corresponding local variables

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd a completion for the cylinder type entry combo box
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd cylinder data to cylinder model as we record each dive
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix the reading of the cylinder start/end pressure from cylinder models
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'minor-fixes' of git://github.com/dirkhh/subsurface
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

12 years agoFix "Keep window size for new notebook pages" to not set minimum size
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoRepaint dive after equipment change only after updating the cylinder info
Linus Torvalds [Fri, 21 Oct 2011 13:14:45 +0000 (16:14 +0300)]
Repaint dive after equipment change only after updating the cylinder info

Repainting the dive will end up touching the cylinder list store, so we
should finish setting the cylinder info before we repaint it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the first filename on the command line the default filename
Dirk Hohndel [Fri, 21 Oct 2011 13:12:04 +0000 (06:12 -0700)]
Make the first filename on the command line the default filename

From a usecase point of view - if we call with multiple file names then
most likely it's

subsurface MyDives.xml new_dive1.xml new_dive2.xml

and therefore the existing "database" is the first filename, not the last
one (as the current implementation assumes).

Frankly, this is a bit arbitrary - but this one seems to make more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoRepaint the dive after equipment changes
Linus Torvalds [Fri, 21 Oct 2011 12:55:52 +0000 (15:55 +0300)]
Repaint the dive after equipment changes

Those changes may have changed cylinder sizes and beginning/end
pressures, so the dive profile and SAC rate may be different.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'multiple_selection' of git://github.com/dirkhh/subsurface
Linus Torvalds [Fri, 21 Oct 2011 04:50:23 +0000 (07:50 +0300)]
Merge branch 'multiple_selection' of git://github.com/dirkhh/subsurface

12 years agoAllow multiple selections in the dive list
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFixed off by one error in uemis importer
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMerge branch 'guifixes' of git://github.com/dirkhh/subsurface
Linus Torvalds [Thu, 20 Oct 2011 19:30:44 +0000 (22:30 +0300)]
Merge branch 'guifixes' of git://github.com/dirkhh/subsurface

12 years agoAdd quick hack for "no sample pressure but tank index changed" case
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up multi-cylinder code as per Dirk
Linus Torvalds [Thu, 20 Oct 2011 10:55:55 +0000 (13:55 +0300)]
Fix up multi-cylinder code as per Dirk

Too much cut-and-paste, as Dirk points out.  With multiple cylinders,
we're not necessarily going to start at time zero.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoKeep window size for new notebook pages
Dirk Hohndel [Thu, 20 Oct 2011 10:04:18 +0000 (03:04 -0700)]
Keep window size for new notebook pages

We used to set a fixed size instead of just copying the size that the
existing notebook has - which didn't really feel right when resizing and
then ripping of a page.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoParse the xml sample cylinder index properly
Linus Torvalds [Wed, 19 Oct 2011 17:06:11 +0000 (10:06 -0700)]
Parse the xml sample cylinder index properly

We would save it in the xml file, but then not actually read it back
properly.  Oops.  Not that we actually have any multi-tank dives yet, so
it doesn't matter.  Yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart some rough multi-cylinder pressure data plot infrastructure
Linus Torvalds [Wed, 19 Oct 2011 16:47:46 +0000 (09:47 -0700)]
Start some rough multi-cylinder pressure data plot infrastructure

It doesn't actually do multiple cylinders correctly yet, but it should
be a nice framework for it.  And accidentally (not) it also ends up
drawing the final line for the end pressure of a single-cylinder dive
that has been fixed up by hand too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't overwrite the end pressure with sample data if one already exists
Linus Torvalds [Wed, 19 Oct 2011 16:25:47 +0000 (09:25 -0700)]
Don't overwrite the end pressure with sample data if one already exists

If we have en explicit end pressure in the dive information, we should
not change it just because we also have some samples.  The sample data
may not be complete (read: "Linus wireless connection dropped during the
dive again, and he fixed up the end pressure manually afterwards").

The beginning pressure already works correctly, because it will only use
the sample data for the first sample if no pressure existed before.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd start/end pressure to cylinder edit dialog
Linus Torvalds [Mon, 17 Oct 2011 18:12:11 +0000 (11:12 -0700)]
Add start/end pressure to cylinder edit dialog

This finally allows you to set the start/end pressures by hand.

HOWEVER! Right now, if we have samples with pressures, those samples
will always end up overriding anything you set manually.  Which can be
very annoying if your wireless air integration fails halfway through.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodeclare a var for libdivecomputer's cflags
Martin Gysel [Mon, 17 Oct 2011 13:54:01 +0000 (15:54 +0200)]
declare a var for libdivecomputer's cflags

This allows us the specifiy libdivecomputer's cflags (and also the
library, static or dynamic) outside of the Makefile

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocreate man dir before installing files in it
Martin Gysel [Mon, 17 Oct 2011 13:54:00 +0000 (15:54 +0200)]
create man dir before installing files in it

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agouse DESTDIR according to my understanding of GNU standards
Martin Gysel [Mon, 17 Oct 2011 13:53:59 +0000 (15:53 +0200)]
use DESTDIR according to my understanding of GNU standards

make DESRDIR a prefix of everything according my understanding
of the GNU standards. This is also useful(/needed) for installing
in Gentoo. Declare BINDIR for bin/program directory.

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't use dynamic linking for libdivecomputer
Linus Torvalds [Fri, 14 Oct 2011 04:06:13 +0000 (16:06 +1200)]
Don't use dynamic linking for libdivecomputer

Commit bd8948386d55 ("Since we don't want configure, use gnumake to find
libdivecomputer") was totally broken.  Sure, using GNU make features is
fine.  But then hiding in that commit is the fact that it also changed
it to use "-ldivecomputer" instead of just linking with the static
libdivecomputer archive.

And that's just a really bad idea.  Dynamic linking is useful for things
like libc, where it allows sharing of the code pages across all the
programs using it.  For something like libdivecomputer it's just a *bad*
idea, and doesn't even work.  The libdivecomputer interfaces aren't
stable enough to make it a good idea even if it *did* work, and the
libdivecomputer "make install" phase doesn't do the proper ldconfig etc
setup anyway.

Static linking is just simpler and better.  It also means that the
binary will work even if you move it around to another machine - since
libdivecomputer isn't exactly a "standard library"..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoInstall manpage
Dirk Hohndel [Wed, 12 Oct 2011 20:30:08 +0000 (13:30 -0700)]
Install manpage

(and fix two white space issues)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd a simplistic man page
Dirk Hohndel [Wed, 12 Oct 2011 20:17:21 +0000 (13:17 -0700)]
Add a simplistic man page

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFix Makefile syntax error
Dirk Hohndel [Wed, 12 Oct 2011 04:09:46 +0000 (21:09 -0700)]
Fix Makefile syntax error

it looks prettier, but we can't have a tab in front of the $(error)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoHave "make install" act more as expected for a desktop application
Dirk Hohndel [Tue, 11 Oct 2011 22:58:38 +0000 (15:58 -0700)]
Have "make install" act more as expected for a desktop application

I'm trying to get subsurface to get closer to becoming a "regular desktop
application"; so far this is based on the recommendations and guidelines
on OpenSUSE and Fedora.

The icon is now named subsurface.svg and make install installs it in the
correct location. At runtime subsurface first checks if an icon is
installed and if it is it uses that - otherwise it falls back to the old
code that tries to read the svg file from the current directory.

We also install a subsurface.desktop file

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake should expand $(DESTDIR) on install
Dirk Hohndel [Tue, 11 Oct 2011 02:43:28 +0000 (19:43 -0700)]
Make should expand $(DESTDIR) on install

This clearly was intentionaly - I just have no idea why you would want to
do it?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoSince we don't want configure, use gnumake to find libdivecomputer
Dirk Hohndel [Tue, 11 Oct 2011 00:53:59 +0000 (17:53 -0700)]
Since we don't want configure, use gnumake to find libdivecomputer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDon't drop precision from floating point GP coordinates
Linus Torvalds [Sun, 9 Oct 2011 02:19:16 +0000 (14:19 +1200)]
Don't drop precision from floating point GP coordinates

Using '%f' limits the precision to 6 decimals, which may well be
perfectly ok.  But at least in theory you *could* have higher precision,
and gps units will report it, so don't mindlessly limit us to what %f
shows.

This arbitrarily uses '%.12g' instead.  %g will drop excess zeroes at
the end, so it actually results in the same (or shorter) ascii
representation unless you have the extra precision.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>