]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoFirst pass to parse uemis Zurich '.SDA' files
Dirk Hohndel [Thu, 15 Sep 2011 04:00:49 +0000 (21:00 -0700)]
First pass to parse uemis Zurich '.SDA' files

This is missing a ton of the information in the .SDA files It only
parses the divelog.SDA file, not the dive.SDA file It ignores the
information on the gas(es) used and all the data on the tanks.

It still draws some strange artefacts at the end of the dive

But it correctly hooks into the import dialogue, it gives you a file
select box (somewhere, I'm sure, a gtk developer cries quietly) and then
parses enough of this file to serve as a proof of concept.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFlush any pending changes at notebook 'switch-page' time
Linus Torvalds [Wed, 14 Sep 2011 23:05:37 +0000 (16:05 -0700)]
Flush any pending changes at notebook 'switch-page' time

Dirk points out that equipment changes (cylinder size etc) do not cause
a proper repaint of the dive profile with new SAC information.  The
reason? We haven't flushed the changes when the notebook changes from
the equipment page to the dive profile page.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoQuick fix to hardcode device name only once
Dirk Hohndel [Wed, 14 Sep 2011 18:25:15 +0000 (11:25 -0700)]
Quick fix to hardcode device name only once

Linus clearly wanted to make SURE that we use /dev/ttyUSB0

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoI'm trying to figure something out that prints reasonably..
Linus Torvalds [Wed, 14 Sep 2011 03:39:43 +0000 (20:39 -0700)]
I'm trying to figure something out that prints reasonably..

I'll get there.  Shrink it down a bit, start adding notes and location,
and maybe put three per page. That might work.

.. or maybe I should just take a look at how others have done this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the printout look different
Linus Torvalds [Wed, 14 Sep 2011 02:49:48 +0000 (19:49 -0700)]
Make the printout look different

Not *better* mint you. Just different.

I suck at graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd the capability to print a dive profile
Linus Torvalds [Tue, 13 Sep 2011 23:02:42 +0000 (16:02 -0700)]
Add the capability to print a dive profile

Ok, this is the ugliest f*&$ing printout I have ever seen in my life,
but think of it as a "the concept of printing works" commit, and you'll
be able to hold your lunch down and not gouge out your eyeballs with a
spoon.  Maybe.

I'm just doing the cairo display as-is for the printout, which is a
seriously bad idea.  I need to not try to do colors etc, and instead of
having white lines on a black background I just need to make thelines be
black on white paper.

But that would involve actually changing the current "plot()" routine,
which is against the point of the exercise right now.  This really is
just a demonstration of how to add printing capabilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd divemaster/buddy field and text entry
Linus Torvalds [Tue, 13 Sep 2011 21:58:06 +0000 (14:58 -0700)]
Add divemaster/buddy field and text entry

I have it in some of my notes, and Dirk seems to fill that in too, so
let's just show it, save it, and allow editing of it..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSeparate the notion of creating the cylinder widgets from showing them
Linus Torvalds [Tue, 13 Sep 2011 20:50:03 +0000 (13:50 -0700)]
Separate the notion of creating the cylinder widgets from showing them

Now we always create the MAX_CYLINDER sets of cylinder widgets.  But we
don't actually pack them into the frame - that's a separate phase.

Right now we still do the stupid "always just pack two cylinders" thing,
but the idea is that we can pack just as many as the dive needs on a
per-dive basis.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake multiple cylinders actually work
Linus Torvalds [Tue, 13 Sep 2011 20:25:06 +0000 (13:25 -0700)]
Make multiple cylinders actually work

This just always shows two cylinders, which is obviously bogus, but it's
a good test-case for the multi-cylinder case.

I need to figure out how to dynamically show the right number of
cylinders, but that also involves the notion of adding a cylinder in
order to fill out information that didn't use to exist.

That's lower priority - now the infrastructure seems to be there.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMore work on abstracting the gtk cylinder widget thing
Linus Torvalds [Tue, 13 Sep 2011 20:15:31 +0000 (13:15 -0700)]
More work on abstracting the gtk cylinder widget thing

Ok, now we have an array of them, and most of the time we pass the right
pointer back and forth.

There's still a couple of places that hardcode "gtk_cylinder[0]" as the
data, but by now they are mostly things that should iterate over all the
cylinders.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart abstracting out the cylinder equipment widgets
Linus Torvalds [Tue, 13 Sep 2011 19:58:53 +0000 (12:58 -0700)]
Start abstracting out the cylinder equipment widgets

Create a "struct cylinder_widget" so that when we handle multiple
cylinders, we can match them up with the actual cylinder data;

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAlways pack the widgets into boxes, not frames
Linus Torvalds [Tue, 13 Sep 2011 18:56:42 +0000 (11:56 -0700)]
Always pack the widgets into boxes, not frames

Let's try to be consistent about this.  Make the parent of each widget
be a box.  Maybe the frames come with boxes, but since I have no clue
about gtk, I'm going to just always create them by hand.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a checkbox for nitrox settings
Linus Torvalds [Tue, 13 Sep 2011 18:47:20 +0000 (11:47 -0700)]
Add a checkbox for nitrox settings

Grey out the nitrox value unless the user explicitly checks the checkbox.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse round line noins and caps
Linus Torvalds [Tue, 13 Sep 2011 15:25:54 +0000 (08:25 -0700)]
Use round line noins and caps

It doesn't really make much of a difference, but it can be visible
especially with lots of tight samples.  Miter joins really look horrible
for acute angles.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoLabel the temperature graph
Linus Torvalds [Tue, 13 Sep 2011 15:16:29 +0000 (08:16 -0700)]
Label the temperature graph

Oooh, pretty.

Or not.  The temperature graph is usually ugly as hell, but Dirk has the
cool dive computer with lots and lots of temperature readings.  Which
makes the graph a pretty graph, rather than a butt-ugly staircase like
mine.

Next time: get a dive computer with an OLED screen, and that can draw
pretty temperature graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPlot a sick kind of temperature curve
Linus Torvalds [Tue, 13 Sep 2011 03:37:32 +0000 (20:37 -0700)]
Plot a sick kind of temperature curve

.. without the actual text, because I'm a "random plots that cannot
actually be interpreted" kind of guy.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate the README about libdivecomputer
Linus Torvalds [Mon, 12 Sep 2011 21:05:44 +0000 (14:05 -0700)]
Update the README about libdivecomputer

The build instructions are in the git commit log too, but let's make
them a bit easier to find.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't save empty cylinder descriptions in the xml
Linus Torvalds [Mon, 12 Sep 2011 20:41:37 +0000 (13:41 -0700)]
Don't save empty cylinder descriptions in the xml

They get created when the equipment thing doesn't have a name for the
cylinder, but we don't want to save that lack of description.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo some basic sanity testing on the libdivecomputer gasmix data
Linus Torvalds [Mon, 12 Sep 2011 20:31:43 +0000 (13:31 -0700)]
Do some basic sanity testing on the libdivecomputer gasmix data

It's quite often obvious crap for the "doesn't exist" or "plain air" case.

So if it's reporting 100% O2, we just ignore it.  Sure, it could be
right, but for the dives I have I know it's just libdivecomputer being
wrong.

Same goes for obvious crap like 255% Helium.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoLibdivecomputer: start actually importing the dive data
Linus Torvalds [Mon, 12 Sep 2011 20:25:05 +0000 (13:25 -0700)]
Libdivecomputer: start actually importing the dive data

So this actually reports the dive data that libdivecomputer generates.
It doesn't import special events etc, but neither do we for the xml
importer.

It is also slow as heck, since it doesn't try to do the "hey, I already
have this dive" logic and always imports everything, but the basics are
definitely there.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAbstract out dive/sample allocation a bit
Linus Torvalds [Mon, 12 Sep 2011 19:56:34 +0000 (12:56 -0700)]
Abstract out dive/sample allocation a bit

We're going to start to want to allocate dives and samples for the
libdivecomputer import too, so let's clean things up a bit for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agolibdivecomputer integration: add a progress bar
Linus Torvalds [Mon, 12 Sep 2011 18:41:26 +0000 (11:41 -0700)]
libdivecomputer integration: add a progress bar

Instead of writing out the progress events, use them to update a real
progress bar.

Also, we need to handle gtk events while busy with the dive computer
reading.  That should *probably* be done with a threading model, because
libdivecomputer does seem to have some timing sensitivity - I'm getting
"failure to read memory block" if I make that loop do the standard

while (gtk_events_pending())
  gtk_main_iteration();

thing.  Besides, even if we did do that loop, it would still cause
problems when the libdivecomputer code is stuck reading a serial line
that doesn't respond or whatever.

But for now this ugly hack is "good enough" to get further.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoLibdivecomputer integration, part n+1
Linus Torvalds [Mon, 12 Sep 2011 18:05:32 +0000 (11:05 -0700)]
Libdivecomputer integration, part n+1

This actually gets me far enough that it prints out all the dives on my
dive computer.  It doesn't actually turn them into real dives yet,
though - only a series of ugly 'printf's so far.

And it hangs after printing the last dive. So I'm doing something wrong.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMore libdivecomputer boilerplate stuff
Linus Torvalds [Mon, 12 Sep 2011 17:37:54 +0000 (10:37 -0700)]
More libdivecomputer boilerplate stuff

.. fill in the event parsing.  This doesn't generate the fingerprint
like the example does, I just don't care about that yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFurther work on libdivecomputer integration
Linus Torvalds [Mon, 12 Sep 2011 17:27:35 +0000 (10:27 -0700)]
Further work on libdivecomputer integration

.. this now registers the dive parsing callback, and starts to parse the
data.  So I can see the last divetime on my Suunto Vyper Air now.

Still a lot more boilerplate stuff to go, though.  The libdivecomputer
interfaces really are pretty insane: why should the caller set up the
dive parsing for each computer type, when libdivecomputer knows what
types it has? IOW, much of that boilerplate should be hidden inside of
libdivecomputer, rather than exposed to the user.

But whatever.  I'm taking pieces from "examples/universal.c" as I go
along (it's under LGPL 2.1).  I want to do it in small chunks just to
feel that I understand what's going on, rather than just blindly copying
it all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFlesh out the libdivecomputer interfaces some more
Linus Torvalds [Mon, 12 Sep 2011 16:50:40 +0000 (09:50 -0700)]
Flesh out the libdivecomputer interfaces some more

.. start some error reporting, and register some early (empty)
callbacks.

This still doesn't actually do anything.  But commit early, commit
often: when I start seriously breaking things, I want to have a "hey,
this still at least compiled" state.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake 'report_error()' usable from outside of main.c
Linus Torvalds [Mon, 12 Sep 2011 16:49:54 +0000 (09:49 -0700)]
Make 'report_error()' usable from outside of main.c

The dive computer import code will want to show errors too..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAvoid using type 'gasmix_t': use 'struct gasmix' instead
Linus Torvalds [Mon, 12 Sep 2011 16:47:55 +0000 (09:47 -0700)]
Avoid using type 'gasmix_t': use 'struct gasmix' instead

libdivecomputer already uses 'gasmix_t' for its own gasmix thing.  I
don't like th eway we step on each others name spaces, but hey, might as
well just use 'struct gasmix' and avoid the typedef.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart some very initial libdivecomputer integration
Linus Torvalds [Mon, 12 Sep 2011 16:19:21 +0000 (09:19 -0700)]
Start some very initial libdivecomputer integration

Ok, so this is quite broken right now: it doesn't actually really *do*
anything, and it now requires that you have libdivecomputer all set up
and installed.

That is fairly easy:

mkdir ../src
cd ../src
git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer
cd libdivecomputer
autoreconf --install
./configure
make
sudo make install

but you may feel that this is not exactly useful considering that
nothing actually *works* yet.

Some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up dive info box too
Linus Torvalds [Sun, 11 Sep 2011 23:34:01 +0000 (16:34 -0700)]
Clean up dive info box too

Make it denser by putting the dive number/location in the frame label,
and make it size up and down more naturally.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAccept a smaller profile window
Linus Torvalds [Sun, 11 Sep 2011 23:21:21 +0000 (16:21 -0700)]
Accept a smaller profile window

I'm trying to make sure that we can shrink the main window and still get
a useful experience.  Sometimes you have small bad netbooks when diving..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a 'Renumber' menu choice
Linus Torvalds [Sun, 11 Sep 2011 22:39:46 +0000 (15:39 -0700)]
Add a 'Renumber' menu choice

If you want to re-number your dives - either because they didn't have
any numbering at all, or because you forgot about other dives - you now
can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPack all the equipment widgets into boxes
Linus Torvalds [Sun, 11 Sep 2011 22:37:56 +0000 (15:37 -0700)]
Pack all the equipment widgets into boxes

We really do want to "pack" them, rather than use up the whole size.  I
think.

I may end up playing around more with this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoOops. Fix 'buffered dive' information
Linus Torvalds [Sun, 11 Sep 2011 20:43:37 +0000 (13:43 -0700)]
Oops. Fix 'buffered dive' information

When fixing the unit changes, I broke the dive buffering logic entirely
for switching between dives. Duh.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoWork around more Diving Log bugs..
Linus Torvalds [Sun, 11 Sep 2011 20:16:23 +0000 (13:16 -0700)]
Work around more Diving Log bugs..

The Diving Log temperature reading is in Fahrenheit for the samples (for
the per-dive water/air temperature it's in Celsius).  But it seems to
have a bug where a lack of a sample has been turned into 32 Fahrenheit
(which is 0 celsius).  This is despite the dive itself having a water
temperature of 8 degF.

Just throw away those bogus freezing temperatures.  Sure, they can
happen, and ice divers are crazy - but in this case I know it's just an
error in the log, and it looks very much like a Diving Log bug.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoCall an LP85 an LP85 even when it's "10% extra".
Linus Torvalds [Sun, 11 Sep 2011 20:03:43 +0000 (13:03 -0700)]
Call an LP85 an LP85 even when it's "10% extra".

The LP85+ name is not something we'd normally want to recognize.  The LP
cylinder names all tend to be by the "+" pressure anyway, and that's
what we do in the equipment handling naming.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoBe more careful about unit changes
Linus Torvalds [Sun, 11 Sep 2011 19:53:59 +0000 (12:53 -0700)]
Be more careful about unit changes

When we change units, we need to flush any currently active dive
information in the old units, and then carefully reload it in the new
units.

Otherwise crazy stuff happens - like having current cylinder working
pressure values that are in PSI because that *used* to be the output
unit, but then interpreting those values as BAR, because we changed the
units.

Also, since we now properly import working pressure from Diving Log,
stop importing the (useless) cylinder description.  The Diving Log
cylinder descriptions are things like "Alu" or "Steel".  We're better
off just making up our own.

Finally, since Diving Log has cylinder size in metric, make sure that we
do the "match standard cylinder sizes" *after* we've done all the
cylinder size conversions to proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoParse 'Diving Log' cylinder working pressure
Linus Torvalds [Sun, 11 Sep 2011 19:24:57 +0000 (12:24 -0700)]
Parse 'Diving Log' cylinder working pressure

Oh Gods. Why are all other scuba programs so f*&% messed up?

The Diving Log cylinder working pressure is in bar - which is all good.
But their pressure *samples* are in PSI.  Why the h*ll do people mix up
units in the same damn file like that? I despair at the pure
incompetence sometimes.

I suspect the pressure samples aren't "really" in PSI: they are probably
in some user-specified units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up dive number naming
Linus Torvalds [Sun, 11 Sep 2011 18:36:33 +0000 (11:36 -0700)]
Fix up dive number naming

Use "dive->number" instead of "dive->nr". And make the XML match too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow dive number (if it exists) in the location note
Linus Torvalds [Sun, 11 Sep 2011 18:54:55 +0000 (11:54 -0700)]
Show dive number (if it exists) in the location note

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSave and restore a "dive number"
Linus Torvalds [Sun, 11 Sep 2011 18:36:33 +0000 (11:36 -0700)]
Save and restore a "dive number"

Some people want to know how many dives they have under their belt, so
let's save and restore the dive number if it exists.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd more static cylinder types - and pick them up from the dive log
Linus Torvalds [Sun, 11 Sep 2011 00:14:07 +0000 (17:14 -0700)]
Add more static cylinder types - and pick them up from the dive log

This adds a few more predefined cylinder types to the static list, but
perhaps more importantly, if we try to show a cylinder description that
we haven't seen before, we automatically add that description to the
list as well.

This way, if people have their own cylinder types, our cylinder
management will automatically figure them out and make it easy to enter
them.

NOTE! It might be best to add the new cylinder description at dive log
load time, rather than at 'show' time.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd new cylinder models to the cylinder model store
Linus Torvalds [Sat, 10 Sep 2011 23:27:19 +0000 (16:27 -0700)]
Add new cylinder models to the cylinder model store

We also need to actually fill the model store with the cylinder models
we have in our dive lists to begin with.

This makes it all *trivial* to add a new cylinder model: just use a new
description, fill in the size and working pressure, and you're done.
The type automatically gets filled in, unless that description already
existed (in which case we leave it alone).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoLet people manage their cylinders in cuft and psi
Linus Torvalds [Sat, 10 Sep 2011 22:27:23 +0000 (15:27 -0700)]
Let people manage their cylinders in cuft and psi

If the output units are set to cuft and psi, then we should show the
cylinder size and pressure properly.

NOTE! In the absense of pressure data, we *always* show the cylinder
volume in liter.  There's no way to convert it to imperial units, since
the imperial units are not in physical size, but in air volume
normalized to surface pressure..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDeclare 'update_dive()' properly
Linus Torvalds [Sat, 10 Sep 2011 22:26:51 +0000 (15:26 -0700)]
Declare 'update_dive()' properly

Avoid a compiler warning..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoNow that we don't mess up import, we can save the cylinder working pressure
Linus Torvalds [Sat, 10 Sep 2011 22:17:33 +0000 (15:17 -0700)]
Now that we don't mess up import, we can save the cylinder working pressure

We used to have the heuristic that if we saw a cylinder working
pressure, then the cylinder size would be in cuft.  Which meant that we
couldn't export our working pressures, because it would mess things up
on import.

But working pressure is actually nice to know, if you ever work with
cylinders in imperial units.  So now that the import is fixed, add the
working pressure to the export.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't guess input cylinder size as cubic feet
Linus Torvalds [Sat, 10 Sep 2011 22:15:40 +0000 (15:15 -0700)]
Don't guess input cylinder size as cubic feet

That just screws up the good xml files that have everything in
well-defined units and chose the sane metric units.

So do the cuft -> liter conversion only if the input units are
explicitly CUFT, or known ambiguous input (SUUNTO).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoActually connect the cylinder configuration with the dive
Linus Torvalds [Sat, 10 Sep 2011 18:09:39 +0000 (11:09 -0700)]
Actually connect the cylinder configuration with the dive

It seems to be sufficiently useful to be worth updating the dive
information now.

This still doesn't handle multiple cylinders in any way.  I need to
think about the interface for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGetting closer to a usable cylinder management interface
Linus Torvalds [Sat, 10 Sep 2011 04:39:54 +0000 (21:39 -0700)]
Getting closer to a usable cylinder management interface

Not quite there yet, though. And never mind multiple cylinders..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFirst (broken) try at actually tracking cylinder types
Linus Torvalds [Sat, 10 Sep 2011 02:46:53 +0000 (19:46 -0700)]
First (broken) try at actually tracking cylinder types

This doesn't actually change the cylinder type info in the dive, because
it's too broken for that.  Instead it prints out what it would change
things to.

The gtk2 notion of text input focus is *really* odd.  Why is the
cylinder type sometimes selected, and sometimes not?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRename 'cylinder.c' as 'equipment.c'
Linus Torvalds [Sat, 10 Sep 2011 00:10:17 +0000 (17:10 -0700)]
Rename 'cylinder.c' as 'equipment.c'

Make it about general equipment management, and start hooking up
functions to show new equipment information when changing dives (and to
flush changes to equipment information for the previously active dive).

Nothing is hooked up yet, and it's now showing just one (really big)
cylinder choice, so this is all broken.  But it should make it possible
to at least get somewhere some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow tank type and O2 mix for air usage
Linus Torvalds [Fri, 9 Sep 2011 18:09:34 +0000 (11:09 -0700)]
Show tank type and O2 mix for air usage

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a notebook for cylinder information
Linus Torvalds [Fri, 9 Sep 2011 15:38:48 +0000 (08:38 -0700)]
Add a notebook for cylinder information

Ok, so it's not connected to anything yet, and the tank choices (that
don't do anything) are some random hardcoded collection, but maybe it
will do something some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse the analyzed local minima/maxima for depth text plotting
Linus Torvalds [Thu, 8 Sep 2011 23:01:41 +0000 (16:01 -0700)]
Use the analyzed local minima/maxima for depth text plotting

Instead of relying on our ad-hoc minmax finder, just use the local
minima/maxima information directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse an indirect pointer to min/max entry rather than value
Linus Torvalds [Thu, 8 Sep 2011 22:59:04 +0000 (15:59 -0700)]
Use an indirect pointer to min/max entry rather than value

This way we can always find the actual min/max entry that generated the
local minima/maxima.  Which is useful for visualization.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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.

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

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

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