]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
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 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 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 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>
13 years agoGenerate 'watertemp' field from samples if required
Linus Torvalds [Fri, 2 Sep 2011 05:21:16 +0000 (22:21 -0700)]
Generate 'watertemp' field from samples if required

Sure, it's redundant, but it's convenient for the general dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix wrongly nested watertemp xml entry
Linus Torvalds [Fri, 2 Sep 2011 05:18:44 +0000 (22:18 -0700)]
Fix wrongly nested watertemp xml entry

Too much cut-and-paste: the ending tag said "airtemp".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoWe can't save escape characters.
Linus Torvalds [Fri, 2 Sep 2011 03:28:17 +0000 (20:28 -0700)]
We can't save escape characters.

I think it should be legal xml, but whatever.  libxml2 is very unhappy,
and complains when loading - even if I escape them.  So let's just
replace the low escape characters with '?'.

The only thing to ever care was my test-case, I suspect.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSave and parse notes and locations
Linus Torvalds [Fri, 2 Sep 2011 02:56:04 +0000 (19:56 -0700)]
Save and parse notes and locations

It's pretty rough, but it seems to work.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo gasmix as an empty element XML too
Linus Torvalds [Fri, 2 Sep 2011 00:44:13 +0000 (17:44 -0700)]
Do gasmix as an empty element XML too

Let's make it a goal that the XML we output is pretty.  That clearly was
never a goal for the Suunto XML, but we can be oh-so-much-better than that.

I still don't love XML, but let's try to make the best of a bad situation,
and take pride in what we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoClean up save-file output a bit
Linus Torvalds [Fri, 2 Sep 2011 00:37:41 +0000 (17:37 -0700)]
Clean up save-file output a bit

Use the "empty element" form for samples that don't have any events
associated with them (and none do, right now).  This avoids that
annoying "</sample>" crud.

And output the units in the output helpers, so that you can't forget
them even if you try.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAlways use proper units when saving.
Linus Torvalds [Fri, 2 Sep 2011 00:17:19 +0000 (17:17 -0700)]
Always use proper units when saving.

When we see a number like 23.145, we'd better always also see a unit.
It's just good practice.  So add 'min' to duration (and use only two
digits for number of seconds), and 'm' to depth.

And write the date in international standard format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTeach the date parser to also parse the international standard date format
Linus Torvalds [Fri, 2 Sep 2011 00:13:39 +0000 (17:13 -0700)]
Teach the date parser to also parse the international standard date format

The standard way to write a date is yyyy-mm-dd, which is unambiguous and
sorts correctly.

We parsed that right in the 'datetime' case, but not in the normal date
case.  And we do want to use that in our output format, exactly because
it's standard.

And also parse 'duration' for the dive duration.  It's what we use when
saving, it just so happened that we ended up not parsing it right, but
then picking it up from the samples instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSave everything in our current dives and samples into the xml file
Linus Torvalds [Thu, 1 Sep 2011 23:59:10 +0000 (16:59 -0700)]
Save everything in our current dives and samples into the xml file

Now, as we start parsing more, we just need to also add the code to save
it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix up small details in input/output
Linus Torvalds [Thu, 1 Sep 2011 23:41:10 +0000 (16:41 -0700)]
Fix up small details in input/output

Be more careful with FP conversions, and with the Kelvin<->C offset.
And make sure to use the same names when saving as when parsing.

Now when we save a set of dives, then re-load them, and save again, the
second save image is identical to the first one.

Of course, we don't actually save everything we load, so we still do
lose information when we load and then save the result.  But at least we
now don't lose the information that we *do* save.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd ability to 'save' dives
Linus Torvalds [Thu, 1 Sep 2011 23:27:52 +0000 (16:27 -0700)]
Add ability to 'save' dives

This just generates another xml file.  Don't get me wrong: I still don't
like xml, but this way we can save in the same format we load things
from.  Except the save-format is a *lot* cleaner than the abortion that
is Suunto or libdivecomputer xml.

Don't bother with some crazy xml library crap for saving. Just do it!

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agogasmix: stop tracking nitrogen percentages
Linus Torvalds [Thu, 1 Sep 2011 23:26:11 +0000 (16:26 -0700)]
gasmix: stop tracking nitrogen percentages

The only thing you can do with that thing is screw things up (like
libdivecomputer did).  There's no value in tracking the "filler" gas,
since you can always just calculate it from the gases that actually
matter.

So just track Oxygen and Helium - and make sure they have sane values.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agolibdivecomputer does crazy gas mixes too
Linus Torvalds [Thu, 1 Sep 2011 20:46:24 +0000 (13:46 -0700)]
libdivecomputer does crazy gas mixes too

Did I just say "In comparison, the libdivecomputer output is nice and
sane"?

It turns out that libdivecomputer has been doing some drugs too when it
comes to gas mixes.  Like showing O2 percentages as 255.0% and N2
percentages as -155.0%.

Clearly libdivecomputer uses a 'unsigned char' for oxygen percentage,
and makes "-1" be "undefined".  And then it prints that non-existing mix
out, and in the process does MATH on the damn thing ("100-O2") to
"calculate" the nitrogen percentage.

Christ.

Just make the parser silently ignore the craziness, because printing out
"Strange percentage reading -155.0" a few hundred times just doesn't
make anything any better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart parsing gas mixes
Linus Torvalds [Thu, 1 Sep 2011 20:32:52 +0000 (13:32 -0700)]
Start parsing gas mixes

The suunto xml is just completely crazy.  What's the helium percentage
companion to "o2pct"? Would it be "hepct"? No. It's "hepct_0".

Ok, so they didn't number the first o2pct, which could be seen as sane:
that's the only mix value that should always exist.  And they clearly
started their indexing with 0.  So with multiple mixes, you'd then
expect "o2pct_1" and "hepct_1", right?

Wrong! Because XML people are crazy, the second O2 mix percentage is
obviously "o2pct_2".  So the O2 percentages are one-based, with an
implicit one.  But the He percentages are zero-based with an explicit
zero.  So the second mix is "o2pct_2" and "hepct_1".

I'd like to ask what drugs Suunto people are on, but hey, it's a Finnish
company.  No need to ask.  Vodka explains everything.  LOTS AND LOTS OF
VODKA.

In comparison, the libdivecomputer output is nice and sane, and uses a
'gasmix' node.  Of course, now we have so many different XML nesting
nodes to check that I just made it an array of different noces.  That
also allows me to mark the suunto case, so that we only do the "check
for crazy alcoholic xml entries" when it's a suunto file.

The "type of file" thing is probably a good idea for deciding on default
units too. Some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoGet rid of our 'ignore' rules
Linus Torvalds [Thu, 1 Sep 2011 19:35:04 +0000 (12:35 -0700)]
Get rid of our 'ignore' rules

I'll start doing some kind of "save unparsed things as extended items"
thing, and the ignore rules were just there to get rid of some of the
noise from early parsing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoxml parsing: start traversing properties too
Linus Torvalds [Thu, 1 Sep 2011 18:22:05 +0000 (11:22 -0700)]
xml parsing: start traversing properties too

This requires us to change the way we match things up, because now we
can have things like

   dives.dive.sample.event.time

and

   dives.dive.sample.time

and they are different things (that "sample.event.time" is a 'time'
property of the 'event').

Now, this is always going to be ambiguous, since our linearized name of
the xml doesn't really care whether it's a xml node "child" or a
"property", but quite frankly, I don't care. XML just isn't worth the pain.

In fact, maybe this ambiguity can end up being a good thing.  We will
parse these two different lines of XML the same way:

  <dive><sample><time>50</time><depth>10.8</depth></sample></dive>

  <dive><sample time="50" depth="10.8"></sample></dive>

and the attribute approach seems to be the nicer one.  Maybe I'll use
that for the output format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRename some files to be more appropriate
Linus Torvalds [Thu, 1 Sep 2011 17:09:53 +0000 (10:09 -0700)]
Rename some files to be more appropriate

The executable is now called 'divelog'.  If this gets useful enough to
actually *use*, I guess I'll have to come up with a real name some day.

Add a silly README, rename 'parse' to 'parse-xml'.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd some extended dive info fields
Linus Torvalds [Thu, 1 Sep 2011 03:36:51 +0000 (20:36 -0700)]
Add some extended dive info fields

.. and tweak the basic info layout a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake the main display saner
Linus Torvalds [Thu, 1 Sep 2011 01:30:42 +0000 (18:30 -0700)]
Make the main display saner

This tweaks:
 - packing to be what you'd kind of expect
 - makes the "summary info" always visible
 - the "extended info" is now on a notebook page of its own
 - dive profile the first notebook page, since the summary
   information is visible regardless.
which all just seems a lot more logical.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoBoiler-plate code for opening/saving a file
Linus Torvalds [Thu, 1 Sep 2011 01:04:25 +0000 (18:04 -0700)]
Boiler-plate code for opening/saving a file

All just copied from the gtk docs.  No actual loading or saving is
taking place, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd a top 'File' menu
Linus Torvalds [Wed, 31 Aug 2011 23:54:13 +0000 (16:54 -0700)]
Add a top 'File' menu

It doesn't actually *do* anything, but what else is new?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDo something half-way sane (no SIGSEGV) when there are no dives
Linus Torvalds [Wed, 31 Aug 2011 23:40:22 +0000 (16:40 -0700)]
Do something half-way sane (no SIGSEGV) when there are no dives

It just leaves ugly blank areas, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart cleaning up dive accessors
Linus Torvalds [Wed, 31 Aug 2011 23:33:20 +0000 (16:33 -0700)]
Start cleaning up dive accessors

I'm going to add a menu to import (and eventually export) dives, and so
we'd like to be able to start out with no dives at all.  Right now we
croak if that happens - it's not like the code has been written with
actual end users in mind.

So start cleaning things up.  First make the 'current_dive' macro work
right even for invalid dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse a 'notebook' for Info vs Profile
Linus Torvalds [Wed, 31 Aug 2011 23:10:11 +0000 (16:10 -0700)]
Use a 'notebook' for Info vs Profile

I dunno.  This seems a better interface at least if we get more info for
the dive, but I suspect I'll want to the add basic info to the profile
page too.

This makes the 'table' approach to layout be kind of pointless again,
and the table has become a fancy vbox.  Maybe I'll put the core info
back, and use the notebook 'Info' page for extended information.

I should just bite the bullet and start saving the dive data, and adding
editing functions for adding information.  But instead I'm playing
around with random gtk widgets.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd some more dive info - and actually update it
Linus Torvalds [Wed, 31 Aug 2011 22:35:28 +0000 (15:35 -0700)]
Add some more dive info - and actually update it

It's still the ugliest application ever, but now it at least gives you
some basic dive info.

I'd love to add a way to edit the dives to add new data (name, buddies,
location etc), but that would also require the ability to save the end
result.  Maybe some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodive parsing: enforce maxdepth and dive duration
Linus Torvalds [Wed, 31 Aug 2011 21:36:53 +0000 (14:36 -0700)]
dive parsing: enforce maxdepth and dive duration

If we see samples from past the dive duration, update the dive duration.
Likewise with maxdepth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodive profile plot: use saner minimum limits
Linus Torvalds [Wed, 31 Aug 2011 21:35:31 +0000 (14:35 -0700)]
dive profile plot: use saner minimum limits

The time minimum was in seconds, not minutes, and we really do want to
show at least to 90ft to make shallow dives look shallow rather than
scaled to some full depth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoplot a fancier 'filled' depth profile
Linus Torvalds [Wed, 31 Aug 2011 21:23:35 +0000 (14:23 -0700)]
plot a fancier 'filled' depth profile

Now I'm just dicking around with cairo.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoPlot dive profile slightly more intelligently.
Linus Torvalds [Wed, 31 Aug 2011 21:15:50 +0000 (14:15 -0700)]
Plot dive profile slightly more intelligently.

This actually creates a bounding box and some scale markers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd fake 'info' frame contents
Linus Torvalds [Wed, 31 Aug 2011 19:09:19 +0000 (12:09 -0700)]
Add fake 'info' frame contents

It should have depth, time, place etc information, but right now it only
has a fake depth that doesn't even get updated.  Just to show the idea
of the table usage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUse a gtk table instead of hbox
Linus Torvalds [Wed, 31 Aug 2011 18:52:16 +0000 (11:52 -0700)]
Use a gtk table instead of hbox

We'll want to add various dive statistics, so...  Without them, it all
looks pretty much the same, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd 'repaint_dive()' prototype, and fix dependencies
Linus Torvalds [Wed, 31 Aug 2011 18:10:17 +0000 (11:10 -0700)]
Add 'repaint_dive()' prototype, and fix dependencies

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTeach the thing to actually track the currently selected dive
Linus Torvalds [Wed, 31 Aug 2011 18:07:31 +0000 (11:07 -0700)]
Teach the thing to actually track the currently selected dive

.. and repaint the profile when the selection changes.

Now, if it just wasn't so ugly, it might even be useful.  Except it
obviously needs to also show all the other dive information.  And allow
the user to fill in details.  And save the end results.

So no, it's not useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRe-do the tree selection code with a selection callback
Linus Torvalds [Wed, 31 Aug 2011 17:46:28 +0000 (10:46 -0700)]
Re-do the tree selection code with a selection callback

Learnign gtk by looking at cairo examples? It's one way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDon't newline-terminate the dive name
Linus Torvalds [Wed, 31 Aug 2011 17:45:29 +0000 (10:45 -0700)]
Don't newline-terminate the dive name

That resulted in ugly lists, and it was wrong to begin with.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSplit up divelist scroll window generation into its own file
Linus Torvalds [Wed, 31 Aug 2011 17:27:58 +0000 (10:27 -0700)]
Split up divelist scroll window generation into its own file

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoGet rid of now unused 'show_dive()' function
Linus Torvalds [Wed, 31 Aug 2011 17:22:08 +0000 (10:22 -0700)]
Get rid of now unused 'show_dive()' function

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSplit up profile frame generation into its own file.
Linus Torvalds [Wed, 31 Aug 2011 17:20:46 +0000 (10:20 -0700)]
Split up profile frame generation into its own file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDraw some kind of profile for the (first) dive
Linus Torvalds [Wed, 31 Aug 2011 15:47:13 +0000 (08:47 -0700)]
Draw some kind of profile for the (first) dive

This is all kinds of broken: it doesn't actually follow the selected
dive, and the profile isn't scaled properly etc.  But it shows something
new, and not just text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix depth parsing
Linus Torvalds [Wed, 31 Aug 2011 15:45:43 +0000 (08:45 -0700)]
Fix depth parsing

The "decimal: it's meters, integer: it's feet" logic doesn't work.  It's
just always meters, because the xml ends up sometimes having whole meters.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake the dive list scrollable (and put it in a vbox)
Linus Torvalds [Wed, 31 Aug 2011 04:18:47 +0000 (21:18 -0700)]
Make the dive list scrollable (and put it in a vbox)

This means you can actually see them all, and walk through them.

It doesn't make any of this *useful*, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoShow the dives as a gtk list/tree widget
Linus Torvalds [Wed, 31 Aug 2011 03:56:01 +0000 (20:56 -0700)]
Show the dives as a gtk list/tree widget

Ok, so I'm not very good at this.  I'll need to enclose the dang thing
in a scrollable window, and then make that scrollable thing just part of
the whole window.

But hey, it's pixels on the screen.  Pixels that show the names of the
dives we've parsed.  At least as many as will fit on screen at one time ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoGenerate a default name for a dive, if it doesn't have one already
Linus Torvalds [Wed, 31 Aug 2011 03:54:43 +0000 (20:54 -0700)]
Generate a default name for a dive, if it doesn't have one already

The name is a string containint date, time, depth and length.  So it's
useful even with nothing else going on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoCreate a gtk window
Linus Torvalds [Wed, 31 Aug 2011 02:48:00 +0000 (19:48 -0700)]
Create a gtk window

It doesn't *do* anything, but some day it will.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd .gitignore file for current state
Linus Torvalds [Wed, 31 Aug 2011 01:42:57 +0000 (18:42 -0700)]
Add .gitignore file for current state

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart moving some of the non-parsing stuff out of 'parse.c'
Linus Torvalds [Wed, 31 Aug 2011 01:40:25 +0000 (18:40 -0700)]
Start moving some of the non-parsing stuff out of 'parse.c'

Create a 'main.c' with the main routine and argument "parsing" etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoSplit up dive data structure declarations into 'dive.h'
Linus Torvalds [Wed, 31 Aug 2011 01:23:59 +0000 (18:23 -0700)]
Split up dive data structure declarations into 'dive.h'

The dive parser should eventually be just a part of the program, not the
whole thing. So start preparing for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoClean up dive reporting
Linus Torvalds [Wed, 31 Aug 2011 00:51:35 +0000 (17:51 -0700)]
Clean up dive reporting

Show date, max depth, and time by default.  The stuff that matters and
should always exist.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd some more parsing functions
Linus Torvalds [Wed, 31 Aug 2011 00:45:03 +0000 (17:45 -0700)]
Add some more parsing functions

.. and fix the 'duration' parsing: it can be either in seconds, or in
mm:ss format.  Floating point doesn't make any sense.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoDon't report dives as they are parsed: sort them at the end and report them then
Linus Torvalds [Wed, 31 Aug 2011 00:18:33 +0000 (17:18 -0700)]
Don't report dives as they are parsed: sort them at the end and report them then

This makes it much easier to see the duplicates, but more importantly,
we do need to actually save the dives off to do any real work with them.

Also, require a verbosity level of 1 (-v) to show all the samples.
While (-vv) shows unparsed entries.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd 'datetime' parsing for libdivecomputer xml files
Linus Torvalds [Tue, 30 Aug 2011 23:59:03 +0000 (16:59 -0700)]
Add 'datetime' parsing for libdivecomputer xml files

I think this gets me dates on all my dives.  So now I could start
sorting them and removing duplicates.

But before I try to remove dups, I guess I should compare the
libdivecomputer ones against the suunto ones.  Because I bet they have
various "interesting" issues like using Bar vs Atm etc.

"But XML is portable". Crazy people.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix up temperature conversion
Linus Torvalds [Tue, 30 Aug 2011 23:58:07 +0000 (16:58 -0700)]
Fix up temperature conversion

Oops. No, the water temperature wasn't really 500 degC.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart actually reporting the numbers we parsed
Linus Torvalds [Tue, 30 Aug 2011 23:42:05 +0000 (16:42 -0700)]
Start actually reporting the numbers we parsed

.. which also showed that the sampletime thing had gotten a bit too much
copy-paste from the temperature parsing ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd 'verbose' flag
Linus Torvalds [Tue, 30 Aug 2011 23:28:59 +0000 (16:28 -0700)]
Add 'verbose' flag

Now that we actually parse some of the dives, don't spam stdout with the
list of stuff we can't parse by default.

Add a 'verbose' flag, which enables that output when set.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart parsing numeric fields
Linus Torvalds [Tue, 30 Aug 2011 23:23:47 +0000 (16:23 -0700)]
Start parsing numeric fields

Depth, pressure, and sample times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart parsing dive dates
Linus Torvalds [Tue, 30 Aug 2011 22:22:48 +0000 (15:22 -0700)]
Start parsing dive dates

.. only the suunto XML format, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMove the "text" nodename hackery out of 'nodename()'
Linus Torvalds [Tue, 30 Aug 2011 21:38:39 +0000 (14:38 -0700)]
Move the "text" nodename hackery out of 'nodename()'

It's better to do it in the caller.  Debug users may well want the full
node name.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFix stupid mis-initialization of current sample
Linus Torvalds [Tue, 30 Aug 2011 21:36:34 +0000 (14:36 -0700)]
Fix stupid mis-initialization of current sample

.. nice compiler warning hidden by the crazy gcc pointer sign warnings
that nobody wants to see (yes, we really do want to do 'strlen()' even
on unsigned strings, don't complain, crazy bitch compiler).

So this also makes our CFLAGS set -Wno-pointer-sign.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart showing unparsed entries
Linus Torvalds [Tue, 30 Aug 2011 20:58:19 +0000 (13:58 -0700)]
Start showing unparsed entries

(ie all of them)

This also shows the type of entry, which makes it clear that I've
screwed up the sample matching.  Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoFill in dummy parse target code
Linus Torvalds [Tue, 30 Aug 2011 20:48:05 +0000 (13:48 -0700)]
Fill in dummy parse target code

.. but don't actually parse anything yet.  But hey - now it tells you
how many samples it (hasn't) parsed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMove the parser closer to being usable
Linus Torvalds [Tue, 30 Aug 2011 04:32:27 +0000 (21:32 -0700)]
Move the parser closer to being usable

Ok, so we have the dive split and the sample splits, so now we could
really just start filling in data.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoTurn the XML into something almost parseable.
Linus Torvalds [Tue, 30 Aug 2011 00:51:54 +0000 (17:51 -0700)]
Turn the XML into something almost parseable.

Of course, now the problem is that the different XML files have
different node names, but at least we've turned it into a half-way sane
format, and have a nice callback place per value.

Soon we could use that to actually fill in useful information.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake the multi-dive files valid XML
Linus Torvalds [Mon, 29 Aug 2011 00:24:53 +0000 (17:24 -0700)]
Make the multi-dive files valid XML

They had multiple "root" entries (all called 'dive'), which makes baby
Jesus cry.

So just enclose them all in one root entry (called 'dives') that
magically turns it all into parseable xml.

Yeah, that really helps make the world a better place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd crazy (bad) xml parser thing
Linus Torvalds [Sun, 28 Aug 2011 23:58:26 +0000 (16:58 -0700)]
Add crazy (bad) xml parser thing

It only works for the Suunto "one xml file per dive" format, not for the
libdivecomputer one that just puts many dives in one file.

Maybe there is some way for libxml2 to handle concatenated xml files
(start again on errors), but I don't know it yet.

I need to get stinking drunk before I look at more xml mess.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoStart archiving the stupid XML files
Linus Torvalds [Sun, 28 Aug 2011 23:18:53 +0000 (16:18 -0700)]
Start archiving the stupid XML files

(and add a reminder of how they came to be)

Gaah.  XML is *stupid*.  It's not easy to parse for humans or for
computers, and some of these XML files are just disgusting.  But maybe
they can be turned into something usable with libxml.

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