]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
13 years agoSave default units using GConf
Linus Torvalds [Thu, 8 Sep 2011 18:23:11 +0000 (11:23 -0700)]
Save default units using GConf

That seems to be the gtk2 way.  Whatever.  diveclog ends up defaulting
to metric units, because we all know that's the right thing to do.
However, I learnt to dive in the US, so I'm used to seeing psi and feet.

So despite the sane defaults, I want diveclog to use the broken imperial
units for me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoShow the min/max data in funky purple shading
Linus Torvalds [Thu, 8 Sep 2011 16:32:08 +0000 (09:32 -0700)]
Show the min/max data in funky purple shading

Dirk likes purple. I mean - Dirk REALLY likes purple.

And what's better than "purple"? You got it: "funky purple".

So this shows the one- two- and three-minute min/max information in some
seriously funky purple fringing.  It's not really necessarily meant to
be serious, but it's a quick hack to visualize the data until we figure
out what to *really* do with it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart analyzing depth profile: smoothing and time-based min/max/avg
Linus Torvalds [Thu, 8 Sep 2011 15:33:02 +0000 (08:33 -0700)]
Start analyzing depth profile: smoothing and time-based min/max/avg

This turns the depth profile into a generic "plot_info" and calculates
minima, maxima and averages over 1-, 2- and 3-minute intervals for each
point.  It also creates a smoothed version.

We currently don't actually show the results, but that's the next step..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRemove unused variable
Dirk Hohndel [Thu, 8 Sep 2011 04:12:13 +0000 (21:12 -0700)]
Remove unused variable

This fixes a compile warning

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoShow the shallow points of the dive too
Linus Torvalds [Thu, 8 Sep 2011 03:55:22 +0000 (20:55 -0700)]
Show the shallow points of the dive too

.. unless they are so shallow that they are basically at the surface.

These show up automatically in out min/max logic, so just go ahead and
show them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMove text rendering function upwards
Linus Torvalds [Thu, 8 Sep 2011 01:57:04 +0000 (18:57 -0700)]
Move text rendering function upwards

No change in semantics, I'm just contemplating doing some text renderign
from within the "minmax" function itself.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd font size to the text_render_options structure
Linus Torvalds [Thu, 8 Sep 2011 01:33:14 +0000 (18:33 -0700)]
Add font size to the text_render_options structure

Ok, so it's really a 'double', but for now we're only using integer font
sizes, so let's see if we ever want to do anything but that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd vertical alignment setting to text output
Dirk Hohndel [Wed, 7 Sep 2011 23:52:55 +0000 (16:52 -0700)]
Add vertical alignment setting to text output

Add new valign enum to text_render_options_t and update all callers to
plot_text

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Fixed spelling, updated to newer base - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTurn tail recursion back into a loop
Linus Torvalds [Wed, 7 Sep 2011 23:38:22 +0000 (16:38 -0700)]
Turn tail recursion back into a loop

I still think there should be some way to partition the space
automatically, but the algorithm that worked best was the simple
tail-recursive one.

Which might as well be expressed as a loop.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoGet rid of timelimit code and corner cases
Linus Torvalds [Wed, 7 Sep 2011 23:21:35 +0000 (16:21 -0700)]
Get rid of timelimit code and corner cases

The recursive minmax is now robust without them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoClean up plot_text_samples() further
Linus Torvalds [Wed, 7 Sep 2011 23:03:16 +0000 (16:03 -0700)]
Clean up plot_text_samples() further

We don't actually use the 'dive' structure any more, since we now always
have the sample pointers directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSimplify/clean up depth min/max finder
Linus Torvalds [Wed, 7 Sep 2011 22:50:07 +0000 (15:50 -0700)]
Simplify/clean up depth min/max finder

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix up horribly broken cairo scaling
Linus Torvalds [Wed, 7 Sep 2011 21:37:47 +0000 (14:37 -0700)]
Fix up horribly broken cairo scaling

The way cairo does scaling is really really inconvenient, and one of the
things in cairo that is fundamentally mis-designed.

Cairo scaling always affects both coordinates and object sizes, and the
two can apparently never be split apart.  Which is very much not what we
want: we want just coordinate scaling.

So we cannot use 'cairo_scale()' to scale our canvas, because that
screws up lines and text size too.  And no, you cannot "fix" that by
de-scaling the line size etc - because line size is one-dimensional, so
you can't undo the (different) scaling in X/Y.

Sad.  I realize that often you do want to scale object size with
coordinate transformation, but quite often you *don't* want to.

Yeah, we could do random context save/restore in odd places etc, but
that's just a sign of the bad design of cairo scaling.

Work around it by introducing our own graphics context with scaling,
which does it right.  I don't like this, but it seems to be better than
the alternatives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse a recursive (instead of iterative) minmax depth finder
Linus Torvalds [Wed, 7 Sep 2011 20:51:35 +0000 (13:51 -0700)]
Use a recursive (instead of iterative) minmax depth finder

This is a bit more natural, and makes it much easier to do scale
independence.  In particular, I want to make it possible to grow and
shrink the graph, and this should make it particularly simple to react
by giving more or fewer minmax points.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTweak depth next_minmax() interface
Linus Torvalds [Wed, 7 Sep 2011 20:35:59 +0000 (13:35 -0700)]
Tweak depth next_minmax() interface

Use start/end sample pointers to make a recursive algorithm possible.

Also, clean up the end condition - we don't want to return an
uninteresting minmax result just because we ran out of samples.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUpdate the dive units without destroyng and rebuilding the dive list
Linus Torvalds [Wed, 7 Sep 2011 19:01:37 +0000 (12:01 -0700)]
Update the dive units without destroyng and rebuilding the dive list

Just iterate over the dive list entries, updating them one by one.

This avoids the "selection destroyed" when the dive units are changed.
And it's cleaner anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd Ok/Cancel buttons to unit dialog
Linus Torvalds [Wed, 7 Sep 2011 18:20:09 +0000 (11:20 -0700)]
Add Ok/Cancel buttons to unit dialog

.. instead of just having a live running dialog all the time.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo output unit conversion in the dive info window too
Linus Torvalds [Wed, 7 Sep 2011 16:35:45 +0000 (09:35 -0700)]
Do output unit conversion in the dive info window too

This should take care of it all, unless I missed some case.

Now we should just save the default units somewhere, and I should do the
divelist update much cleaner (instead of re-doing the divelist entirely,
it should just repaint it - now we lose the highlited dive etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoHonor depth unit settings when plotting the depth profile
Linus Torvalds [Wed, 7 Sep 2011 16:21:26 +0000 (09:21 -0700)]
Honor depth unit settings when plotting the depth profile

This shows the depth properly in meter or feet depending on unit
selection.

It also changes the horizontal depth rulers to be at 10m/30ft intervals
rather than the previous 15ft.  With the textual depth markers, the
horizontal lines aren't as important any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake divelist honor the length units
Linus Torvalds [Wed, 7 Sep 2011 15:56:47 +0000 (08:56 -0700)]
Make divelist honor the length units

Show dives in meter or feet depending on the output unit setting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd GtkTreeViewColumn information to 'struct DiveList'
Linus Torvalds [Wed, 7 Sep 2011 15:42:05 +0000 (08:42 -0700)]
Add GtkTreeViewColumn information to 'struct DiveList'

We will need the column information in order to update the naming when
the units change.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd radio buttons for temperature and volume
Linus Torvalds [Wed, 7 Sep 2011 15:35:35 +0000 (08:35 -0700)]
Add radio buttons for temperature and volume

.. and clean up some of the conversions.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake a 'units' dialog window
Linus Torvalds [Wed, 7 Sep 2011 04:19:04 +0000 (21:19 -0700)]
Make a 'units' dialog window

Set the output units to feet/meter or psi/bar.

Of course, we only actually react to the psi/bar one right now, but it's
all coming some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart doing gas management using output units
Linus Torvalds [Wed, 7 Sep 2011 02:28:31 +0000 (19:28 -0700)]
Start doing gas management using output units

Ok, it's an odd place to start, but this now shows the pressure curve
details and the air usage in the proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoClean up type handling of cylinder pressure plot
Linus Torvalds [Wed, 7 Sep 2011 02:14:56 +0000 (19:14 -0700)]
Clean up type handling of cylinder pressure plot

Soon we'll show things in psi or bar depending on user choice.  Let's
not get confused about units before we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart "output unit management" support
Linus Torvalds [Wed, 7 Sep 2011 02:07:17 +0000 (19:07 -0700)]
Start "output unit management" support

This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.

Of course, since the output doesn't currently care, the units you pick
are irrelevant.  But just wait..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix drawing artifacts with dives that have samples past the dive duration
Dirk Hohndel [Tue, 6 Sep 2011 23:44:20 +0000 (16:44 -0700)]
Fix drawing artifacts with dives that have samples past the dive duration

The UEMIS Zurich SDA keeps recording samples for quite a while after the
dive ended.  These provide no additional information, but confuse our
drawing algorithm as they can cause us to draw both the depth and tank
pressure plots beyond the right edge of our canvas.

Stop drawing if sample->time.seconds is larger than dive->duration.seconds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMinimally parse some UDDF format dives
Linus Torvalds [Wed, 7 Sep 2011 00:33:52 +0000 (17:33 -0700)]
Minimally parse some UDDF format dives

Dive dates (at least partial parsing), depths and times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd framework for UDDF importer
Linus Torvalds [Wed, 7 Sep 2011 00:01:28 +0000 (17:01 -0700)]
Add framework for UDDF importer

There are several sample UDDF files around on the net, so we might as
well start importing some of it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse 'cairo_translate()' instead of manual translation
Linus Torvalds [Tue, 6 Sep 2011 22:41:02 +0000 (15:41 -0700)]
Use 'cairo_translate()' instead of manual translation

I'd like to do 'cairo_scale()' too, but that messes up line sizes.  I'll
think about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'dirk'
Linus Torvalds [Tue, 6 Sep 2011 22:17:24 +0000 (15:17 -0700)]
Merge branch 'dirk'

* dirk:
  Print starting and ending pressures

Fix up conflicts in profile.c due to different ways to set the text
formatting.  Dirk's 'text_format_options' thing is prettier than mine.
Use it.

13 years agoPrint starting and ending pressures
Dirk Hohndel [Tue, 6 Sep 2011 22:00:56 +0000 (15:00 -0700)]
Print starting and ending pressures

This is very simplistic as far as placement of the text goes.
It makes the plot_text function somewhat more generic.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd some information about properly formatted commit messages
Linus Torvalds [Tue, 6 Sep 2011 21:58:05 +0000 (14:58 -0700)]
Add some information about properly formatted commit messages

It does seem like a lot of github users are not used to good commit
message rules, and may never have used git for a project that actually
cares about good logs and nice summary lines.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'patch-1' of git://github.com/schacon/diveclog
Linus Torvalds [Tue, 6 Sep 2011 21:54:06 +0000 (14:54 -0700)]
Merge branch 'patch-1' of git://github.com/schacon/diveclog

* 'patch-1' of git://github.com/schacon/diveclog:
  Add more explicit contributing explanation

13 years agoAdd some air usage statistics to the dive plot
Linus Torvalds [Tue, 6 Sep 2011 21:46:46 +0000 (14:46 -0700)]
Add some air usage statistics to the dive plot

Show "absolute volume" used, and SAC/m (surface-equivalent per minute).

I'm not going to guarantee the calculations.  And I show the result in
cubic feet.  Sue me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo cylinder pressure plot first, then depth, then text notes
Linus Torvalds [Tue, 6 Sep 2011 19:36:52 +0000 (12:36 -0700)]
Do cylinder pressure plot first, then depth, then text notes

Text notes need to be last, so that they don't get stepped on by the
other graph elements.

Also, separate the depth text plot out into a function of its own.
Tidier that way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd more explicit contributing explanation
Scott Chacon [Tue, 6 Sep 2011 19:32:51 +0000 (12:32 -0700)]
Add more explicit contributing explanation

Most developers on GitHub are not used to projects that use the Signed-off-by convention.
They do, however, tend to read the READMEs to see which conventions the author prefers
to follow.  If you are explicit about what you prefer in the README with easy to follow
instructions, it is more likely people will follow those conventions.

Signed-off-by: Scott Chacon <schacon@gmail.com>
13 years agoTweak the "show depth in text" heuristic a bit
Linus Torvalds [Tue, 6 Sep 2011 19:16:39 +0000 (12:16 -0700)]
Tweak the "show depth in text" heuristic a bit

Use a 10-minute window *or* when the depth has reversed sufficiently to
make the max we've found interesting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoPlot some numerical depth markers
Linus Torvalds [Tue, 6 Sep 2011 17:25:01 +0000 (10:25 -0700)]
Plot some numerical depth markers

Add some actual numbers to the depth plot too.  Do it by finding the
deepest points (within a five-minute rolling window), and show the
depths of those points.

Sure, we could have just labeled the depth markers, but this seems
nicer. But what do I know - I'm not exactly famous for my GUI design.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix drawing artifact with UEMIS xml data
Dirk Hohndel [Tue, 6 Sep 2011 14:30:48 +0000 (07:30 -0700)]
Fix drawing artifact with UEMIS xml data

Only draw the pressure line to the final data point
(duration / end.mbar) if we haven't already drawn samples
past that point (as the UEMIS records pressure data for a
number of additional samples after the actual dive has ended)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Changed to use 'last actual drawn sample time that had pressure
  data' instead of 'last sample time'  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRepaint the dives in dive_list_update_dives() instead of in callers
Linus Torvalds [Tue, 6 Sep 2011 03:50:52 +0000 (20:50 -0700)]
Repaint the dives in dive_list_update_dives() instead of in callers

Each caller ends up needing it, and I missed another one.  So rather
than update the other caller, just do it in dive_list_update_dives() and
we can stop worrying about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoupdate UEMIS date_time parsing
Dirk Hohndel [Tue, 6 Sep 2011 01:08:16 +0000 (18:08 -0700)]
update UEMIS date_time parsing

Looks like Linus misinterpreted the first UEMIS xml files I sent him.

The date_time appears to be in local time - so the time zone info can be
ignored (that seems strange, but it worked for the dives I tested it
with)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUpdate dive info and profile after loading files
Linus Torvalds [Tue, 6 Sep 2011 03:39:55 +0000 (20:39 -0700)]
Update dive info and profile after loading files

We did this when loading from the command line, but not when loading
through the file load menu item.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'open-files' of git://github.com/nathansamson/diveclog
Linus Torvalds [Mon, 5 Sep 2011 21:44:27 +0000 (14:44 -0700)]
Merge branch 'open-files' of git://github.com/nathansamson/diveclog

* 'open-files' of git://github.com/nathansamson/diveclog:
  Report errors when opening files
  Make it possible to load multiple files at once.
  Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.

13 years agoAdd support from importing from Diving Log xml files
Linus Torvalds [Mon, 5 Sep 2011 21:29:08 +0000 (14:29 -0700)]
Add support from importing from Diving Log xml files

This is just a very rough draft.  It imports all the main stuff I
noticed, but I'm sure it drops a ton of other stuff.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake the import source an enumeration
Linus Torvalds [Mon, 5 Sep 2011 20:45:14 +0000 (13:45 -0700)]
Make the import source an enumeration

Instead of having each import source recognition routine set a separate
flag for that import source, just enumerate them and set them in one
variable.

I'm adding yet another xml importer - divinglog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoReport errors when opening files
Nathan Samson [Mon, 5 Sep 2011 20:14:53 +0000 (22:14 +0200)]
Report errors when opening files

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoMake it possible to load multiple files at once.
Nathan Samson [Mon, 5 Sep 2011 19:23:38 +0000 (21:23 +0200)]
Make it possible to load multiple files at once.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoOpen File works. I refactored the code and introduced a new type. I never used it...
Nathan Samson [Mon, 5 Sep 2011 19:12:58 +0000 (21:12 +0200)]
Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoParse Uemis cylinder data correctly.
Linus Torvalds [Mon, 5 Sep 2011 17:53:00 +0000 (10:53 -0700)]
Parse Uemis cylinder data correctly.

There's a big comment there now about what is going on.  It took me a
while to understand how the crazy seven-tank uemis dive computer
information actually works.

So the Uemis computer has 4 different "tank profiles":
 - single tank air (0)
 - single tank nitrox (1)
 - two-tank nitrox (2)
 - three-tank nitrox (3)
and the computer always lists all seven tank cases (because that's how
you fill them in).

Depending on the "gas.template" you are supposed to then *use* just one
particular profile.  Why the computer doesn't just give you the tanks
for that one profile, who knows? It seems to be more of the same "Uemis
dive data isn't so much about the dive, it's about dive computer state"
mentality.

So we first get the profile information, and then based on that we need
to pick the right tanks from the set of seven that we're presented with.

All clear?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTurn dive depth, temperature and duration into xml attributes
Linus Torvalds [Mon, 5 Sep 2011 16:39:55 +0000 (09:39 -0700)]
Turn dive depth, temperature and duration into xml attributes

This makes the xml save-file look way nicer: it's both smaller and
better organized.  Using individual xml nodes for random small details
is silly.

The duration even parses exactly the same, because it still ends up
being '.depth.duration' (now it's the 'duration' attribute of the dive
node, it used to be the 'duration' child node of the dive node).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSanitize and fix cylinder pressure overview
Linus Torvalds [Mon, 5 Sep 2011 16:12:54 +0000 (09:12 -0700)]
Sanitize and fix cylinder pressure overview

Doing per-dive cylinder start/end pressures is insane, when we can have
up to eight cylinders.  The cylinder start/end pressure cannot be per
dive, it needs to be per cylinder.

This makes the save format cleaner too, we have all the cylinder data in
just one place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoComment typo fix
Nikola Kotur [Mon, 5 Sep 2011 13:34:22 +0000 (15:34 +0200)]
Comment typo fix

Signed-off-by: Nikola Kotur <kotnick@gmail.com>
13 years agoZebra-color the divelist
Linus Torvalds [Sun, 4 Sep 2011 22:18:58 +0000 (15:18 -0700)]
Zebra-color the divelist

..as suggested by Nathan:

  "I also wanted to "zebra" color the divelist by setting the rules-hint
   to TRUE.  but I noticed it was already set explicitly to FALSE (even
   if this is the default).

   If this is just an accidental copy paste from some tutorial you can
   experiment (set it to TRUE) and see what you like most."

It was indeed just copy-paste from some tutorial, and the zebra-coloring
does look nicer, doesn't it?

Suggested-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'more-divelist-goodness' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 22:15:46 +0000 (15:15 -0700)]
Merge branch 'more-divelist-goodness' of https://github.com/nathansamson/diveclog

* 'more-divelist-goodness' of https://github.com/nathansamson/diveclog:
  Right align the numbers

13 years agoSave milli-units with variable precision
Linus Torvalds [Sun, 4 Sep 2011 22:08:31 +0000 (15:08 -0700)]
Save milli-units with variable precision

Instead of always using three decimal digits, use 1-3 digits.  But do
use at least one, even for integer numbers, just because it makes it so
much clearer that we're dealing with potential fractional values.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse common helper for printing milli-units
Linus Torvalds [Sun, 4 Sep 2011 21:56:21 +0000 (14:56 -0700)]
Use common helper for printing milli-units

I don't necessarily want to show three decimal digits when one or two
would do. So prepare for that by using a helper. This doesn't actually
change the printout yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoProperly save/restore cylinder description string
Linus Torvalds [Sun, 4 Sep 2011 22:07:47 +0000 (15:07 -0700)]
Properly save/restore cylinder description string

We saved it under the wrong name, and didn't restore it at all. Fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoParse uemis cylinder data
Linus Torvalds [Sun, 4 Sep 2011 21:29:57 +0000 (14:29 -0700)]
Parse uemis cylinder data

This is some seriously crazy stuff.  Instead of making sense as a
divelog, the uemis xml makes more sense as a "dive computer settings
dump".

And I guess I can see why they'd do that.  But it makes parsing it just
incredibly annoying.  The thing is more of a "these are the
configurations I support as a dive computer thing" than a "this was the
tank you were diving with".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRight align the numbers
Nathan Samson [Sun, 4 Sep 2011 21:09:19 +0000 (23:09 +0200)]
Right align the numbers

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoMerge branch 'ui-tweaks' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 20:49:45 +0000 (13:49 -0700)]
Merge branch 'ui-tweaks' of https://github.com/nathansamson/diveclog

* 'ui-tweaks' of https://github.com/nathansamson/diveclog:
  Some UI beauty patches:

13 years agoMake a guess at the cylinder description from the size and pressure
Linus Torvalds [Sun, 4 Sep 2011 20:34:22 +0000 (13:34 -0700)]
Make a guess at the cylinder description from the size and pressure

I'll want to also add a way to override/set the cylinder type: both
manually by just setting a size in liters, and by picking from some list
of standard cylinder sizes.

For example, it looks like most of my dives are marked as having
12-liter cylinders.  That is probably some default from Suunto Dive
Manager, or from whatever Dirk did.  It's almost certainly not right for
any of them: as far as I know, the standard cylinders for Lahaina Divers
(which is likely most of the warm water dives) are AL72's for air, and
AL80's for Nitrox.

That would be a 10L and a 11.1L tank respectively, afaik.  I don't know
what a 12-liter tank would be or where that size comes from.

Anyway, the LP85+ tank designation for some of the dives looks more
likely: that's one of the common sizes I've used for local dives.  So
the size of that thing is much more probably correct.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to...
Nathan Samson [Sun, 4 Sep 2011 20:15:55 +0000 (22:15 +0200)]
Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to date with the master (and my own UI improvements)

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoClean up 'fixup_dive()' a bit
Linus Torvalds [Sun, 4 Sep 2011 20:06:47 +0000 (13:06 -0700)]
Clean up 'fixup_dive()' a bit

We don't want to override potentially more exact values for water
temperature etc either.  The sample save interval may be longer than
some internally kept state of key per-dive values like that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoGenerate date string for the dive list dynamically
Linus Torvalds [Sun, 4 Sep 2011 19:09:48 +0000 (12:09 -0700)]
Generate date string for the dive list dynamically

.. and sort based on the 'time_t' value itself.

This allows us to use a more compact date format that doesn't need to
sort alphabetically, because sorting by date is always based on the date
value.  So we can use just a two-digit year, and skip the seconds, to
keep the column narrow, while still sorting correctly.

Also, "Depth" is a nice header string, but it is wider than the column
itself, which makes the whole column wider than necessary.  So put the
units in the header instead of in the string, keeping things narrow.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'ui-improvements' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 18:49:49 +0000 (11:49 -0700)]
Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog

* 'ui-improvements' of https://github.com/nathansamson/diveclog:
  Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
  Remove the redundant frames in the notebook. Closes #9
  Use a pane so the dive list can be made wider or smaller to the users wishes

13 years agoMerge branch 'compiler-warning' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 18:46:39 +0000 (11:46 -0700)]
Merge branch 'compiler-warning' of https://github.com/nathansamson/diveclog

* 'compiler-warning' of https://github.com/nathansamson/diveclog:
  Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.

Fix up trivial conflict in dive.c due to the temperature simplification
(commit 9961c7f89ce6: "Remove redundant temperature readings").

13 years agoAdd placeholder for cylinder type description
Linus Torvalds [Sun, 4 Sep 2011 18:32:30 +0000 (11:32 -0700)]
Add placeholder for cylinder type description

So we don't want to save working pressure, but cylinder type knowledge
would be lovely and useful.  And we can probably make a good initial
guess, or at least let people fill it in later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDon't save cylinder working pressure
Linus Torvalds [Sun, 4 Sep 2011 18:23:41 +0000 (11:23 -0700)]
Don't save cylinder working pressure

It was a mistake to save it - and I did it just because other dive
managers did.  It's a totally nonsensical measure, and nobody cares.
The only thing that matters is the size of the cylinder, and the
*actual* pressures.  Those give actual air consumption numbers, and are
meaningful and unambiguous.

So the "working pressure" for a cylinder is pointless except for two
things:

 - if you don't know the actual physical size, you need the "working
   pressure" along with the air size (eg "85 cuft") in order to compute
   the physical size.  So we do use the working pressure on *input* from
   systems that report cylinder sizes that way.

 - People may well want to know what kind of cylinder they were diving,
   and again, you can make a good guess about this from the working
   pressure.  So saving information like "HP100+" for the cylinder would
   be a good thing.

But notice how in neither case do we actually want to save the working
pressure itself.  And in fact saving it actually makes the output format
ambiguous: if we give both size and working pressure, what does 'size'
mean? Is it physical size in liters, or air size in cu ft?

So saving working pressure is just wrong. Get rid of it.

I'm going to add some kind of "cylinder description" thing, which we can
save instead (and perhaps guess standard cylinders from input like the
working pressure from dive logs that don't do this sanely - which is all
of them, as far as I can tell).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRemove redundant temperature readings
Linus Torvalds [Sun, 4 Sep 2011 18:20:27 +0000 (11:20 -0700)]
Remove redundant temperature readings

I'm aiming to really differentiate in dive log software by making my XML
export files be *clean*, dammit.

That means that we don't have random names, we don't have crazy random
units, and we don't have redundant information.

So when the temperature doesn't change, just don't report it.  That's
already what "no sample" means, just clean things up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSplit the dive list in columns. Columns are sortable now (name = date, depth, duration)
Nathan Samson [Sun, 4 Sep 2011 18:14:33 +0000 (20:14 +0200)]
Split the dive list in columns. Columns are sortable now (name = date, depth, duration)

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoSome UI beauty patches:
Hylke Bons [Sun, 4 Sep 2011 15:08:40 +0000 (17:08 +0200)]
Some UI beauty patches:

Uppercase first letter for each label word
Tweak the paddings for easier reading
Rename File menu to Log menu
Add a separator before Quit in the Log menu
Remove frame in extended diving info and add 6px padding

Signed-off-by: Hylke Bons <hylkebons@gmail.com>
13 years agoMerge branch 'master' into ui-improvements
Nathan Samson [Sun, 4 Sep 2011 17:06:47 +0000 (19:06 +0200)]
Merge branch 'master' into ui-improvements

13 years agoFix typo in Makefile (LDLAGS -> LDFLAGS)
Linus Torvalds [Sun, 4 Sep 2011 17:01:37 +0000 (10:01 -0700)]
Fix typo in Makefile (LDLAGS -> LDFLAGS)

Reported-by: Konrad Delong <https://github.com/konryd>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRemove the redundant frames in the notebook. Closes #9
Nathan Samson [Sun, 4 Sep 2011 17:01:30 +0000 (19:01 +0200)]
Remove the redundant frames in the notebook. Closes #9

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoMerge branch 'fix-entries' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 16:58:34 +0000 (09:58 -0700)]
Merge branch 'fix-entries' of https://github.com/nathansamson/diveclog

* 'fix-entries' of https://github.com/nathansamson/diveclog:
  Word wrap the info textview. Also do not show the scrollbars if not necessary.
  Change location to a text entry instead of text view.

13 years agoUse a pane so the dive list can be made wider or smaller to the users wishes
Nathan Samson [Sun, 4 Sep 2011 16:54:12 +0000 (18:54 +0200)]
Use a pane so the dive list can be made wider or smaller to the users wishes

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoUpdate gitignore for the name-change of the executable
Linus Torvalds [Sun, 4 Sep 2011 16:52:40 +0000 (09:52 -0700)]
Update gitignore for the name-change of the executable

It's not called 'parse' any more.  And I think I should rename 'divelog'
too to something more unique.  Right now the working name for the
project is 'diveclog' (kind of like 'jdivelog') , but I'm not convinced
that the "C implementation" part is really important enough to make a
point of long-term.

"subsurface"? I don't know.  Maybe I should follow the "name all
projects after myself" mantra.  "divenut"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoOops. I forgot to 'fclose()' the file after saving the xml
Linus Torvalds [Sun, 4 Sep 2011 16:50:31 +0000 (09:50 -0700)]
Oops. I forgot to 'fclose()' the file after saving the xml

It never actually triggered anything for me, but any buffered data might
be lost, especially if you force-exit the application after saving a
dive log.

This probably explains a corrupted (truncated) dive file report from
Nathan Samson.

Reported-by: Nathan Samson <https://github.com/nathansamson>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRemoved the unused startemp and enttemp calculations. This fixes a compiler warning...
Nathan Samson [Sun, 4 Sep 2011 10:59:54 +0000 (12:59 +0200)]
Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoWord wrap the info textview. Also do not show the scrollbars if not necessary.
Nathan Samson [Sun, 4 Sep 2011 13:08:01 +0000 (15:08 +0200)]
Word wrap the info textview. Also do not show the scrollbars if not necessary.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoChange location to a text entry instead of text view.
Nathan Samson [Sun, 4 Sep 2011 12:38:01 +0000 (14:38 +0200)]
Change location to a text entry instead of text view.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
13 years agoAdd 'Quit' menu item, and fix invisible "File" on gtk2
Linus Torvalds [Sun, 4 Sep 2011 04:38:07 +0000 (21:38 -0700)]
Add 'Quit' menu item, and fix invisible "File" on gtk2

I didn't even notice that the "File" part of the file menu no longer
showed up, since the keyboard accelerator for ^S worked fine..  But
apparently there's no default label associated with GTK_STOCK_FILE in
gtk2, so the "File" text went away with the conversion to GtkUIManager
in commit 4d62478e14fe ("Use the newer GtkUIManager for menu creation.")

The addition of a Quit menu entry with the associated keyboard
accelerator also makes ^Q "just work".

Of course, if we actually tracked dirty state etc, we could perhaps ask
the user whether they wanted to save or something.  But I'm not exactly
famous for my GUI chops, so ..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge https://github.com/mrjbq7/diveclog
Linus Torvalds [Sun, 4 Sep 2011 03:55:02 +0000 (20:55 -0700)]
Merge https://github.com/mrjbq7/diveclog

* https://github.com/mrjbq7/diveclog:
  dive.c: Fix spelling.

13 years agoDon't bother saving n2 percentage
Linus Torvalds [Sun, 4 Sep 2011 03:50:11 +0000 (20:50 -0700)]
Don't bother saving n2 percentage

It's all calculated anyway, and for the same reason we don't bother even
parsing it at load time, we really shouldn't bother saving it either.

The only thing you can do with that value is "check if the percentages
add up to 100%", and so what?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoImprove the layout of the text entries in gtk3. For gtk2 this could also be useful
Nathan Samson [Sun, 4 Sep 2011 00:37:22 +0000 (02:37 +0200)]
Improve the layout of the text entries in gtk3. For gtk2 this could also be useful

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse the newer GtkUIManager for menu creation.
Nathan Samson [Sun, 4 Sep 2011 00:14:39 +0000 (02:14 +0200)]
Use the newer GtkUIManager for menu creation.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo better cylinder information management
Linus Torvalds [Sun, 4 Sep 2011 03:31:18 +0000 (20:31 -0700)]
Do better cylinder information management

Instead of just tracking gasmix, track the size and workng pressure of
the cylinder too.

And use "cylinder" instead of "tank" throughout.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodive.c: Fix spelling.
John Benediktsson [Sun, 4 Sep 2011 01:48:39 +0000 (18:48 -0700)]
dive.c: Fix spelling.

13 years agoAdd 'mean depth' marker on dive plot
Linus Torvalds [Sat, 3 Sep 2011 20:55:36 +0000 (13:55 -0700)]
Add 'mean depth' marker on dive plot

Just because I can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoOnly update mean/max depths with computed ones if they are way off
Linus Torvalds [Sat, 3 Sep 2011 20:36:25 +0000 (13:36 -0700)]
Only update mean/max depths with computed ones if they are way off

The computer may track "real" max depth more closely than it tracks
samples.  So we trust the non-computed mean/max depths more than the
computed ones.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd various dive fixups, and show pressure (if any) in the plot
Linus Torvalds [Sat, 3 Sep 2011 20:19:26 +0000 (13:19 -0700)]
Add various dive fixups, and show pressure (if any) in the plot

Now the dive profile plot *really* needs some units.  The pressure is
just a random line otherwise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUpdate README a bit
Linus Torvalds [Sat, 3 Sep 2011 15:53:05 +0000 (08:53 -0700)]
Update README a bit

..since this is now on github, might as well tell people what they need
to compile it, and warn them about the state of the project.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd location note to the top bar too.
Linus Torvalds [Sat, 3 Sep 2011 03:00:10 +0000 (20:00 -0700)]
Add location note to the top bar too.

I really don't understand the packing rules.  This does not look like
what I intended.

Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo a dive de-dup pass
Linus Torvalds [Fri, 2 Sep 2011 23:40:28 +0000 (16:40 -0700)]
Do a dive de-dup pass

If given multiple dives at the same time, just de-dup the dives.  This
happens when you've dumped the whole dive-computer several times, and
some dives show up in multiple dumps.

When de-duping, try to avoid dropping data.  So if one dive has notes
attached to it, and the other one does not, pick the notes from the dive
that does have them.  Obvious stuff like that.

The sample merge is also written so that it should be possible to merge
two dives. Which we don't actually do yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoImprove uemis xml parsing a bit
Linus Torvalds [Fri, 2 Sep 2011 22:01:53 +0000 (15:01 -0700)]
Improve uemis xml parsing a bit

It looks like the "units.pressure" setting is only about the units that
things are *shown* in on the wrist computer: the units in the file are
always in bar (or rather, centi-bar).

Which is definitely the right thing to do, and means that we shouldn't
care about parsing the units setting.  It's purely about how something
is shown, not about parsing.

That's probably true of the other units too, but let's see when I have
more data to go on.

Also, parse water temperatures and tank pressure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSilently ignore zero pressure
Linus Torvalds [Fri, 2 Sep 2011 21:06:26 +0000 (14:06 -0700)]
Silently ignore zero pressure

Don't complain about them, they're just missing values

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse 'units' value instead of guessing based on integer/FP
Linus Torvalds [Fri, 2 Sep 2011 20:59:39 +0000 (13:59 -0700)]
Use 'units' value instead of guessing based on integer/FP

We still end up guessing based on magnitude of the value, though: it
might be 'bar' or 'mbar', we end up picking one or the other based on
just how big the value is.

I should make it look at any possible explicit units too, since at least
with good xml, they exist.  Of course, the only good xml I've seen so
far is the one we generate ourselves ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoHack up some very rudimentary support for the Uemis xml format
Linus Torvalds [Fri, 2 Sep 2011 18:32:48 +0000 (11:32 -0700)]
Hack up some very rudimentary support for the Uemis xml format

I think I'll need to re-organize the handling of per-format code, but
for now we just mix it all up.

The uemis conversion is also questionable even for just the small parts
I do.  Does it really do "centiPSI"? That sounds crazy.  I'm waiting for
Dirk to send me some actual human-readable output from the dives, right
now some of it is just rough guesses.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoShow temperature in the info summary
Linus Torvalds [Fri, 2 Sep 2011 05:22:25 +0000 (22:22 -0700)]
Show temperature in the info summary

If it exists, it really does help identify the dive.  At least it does
for me: "local or Maui"?

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