Commit graph

14469 commits

Author SHA1 Message Date
Linus Torvalds
41bce9e5f4 Show tank type and O2 mix for air usage
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09 11:09:34 -07:00
Linus Torvalds
9437a6512a 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>
2011-09-09 10:31:51 -07:00
Linus Torvalds
86e48bfe10 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>
2011-09-08 16:01:41 -07:00
Linus Torvalds
28cadad144 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>
2011-09-08 15:59:04 -07:00
Linus Torvalds
a13d3172fa 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>
2011-09-08 11:23:11 -07:00
Linus Torvalds
91439f3aff 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>
2011-09-08 09:32:08 -07:00
Linus Torvalds
2d9ac73e38 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>
2011-09-08 09:26:54 -07:00
Dirk Hohndel
30d228f104 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>
2011-09-07 21:36:52 -07:00
Linus Torvalds
bd315a4804 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>
2011-09-07 21:11:26 -07:00
Linus Torvalds
77b2df664d 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>
2011-09-07 18:57:04 -07:00
Linus Torvalds
75f7842675 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>
2011-09-07 18:33:14 -07:00
Dirk Hohndel
06399d7d2f 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>
2011-09-07 18:26:59 -07:00
Linus Torvalds
11641095ae 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>
2011-09-07 16:38:22 -07:00
Linus Torvalds
95a051e164 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>
2011-09-07 16:21:35 -07:00
Linus Torvalds
76af28fee6 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>
2011-09-07 16:03:16 -07:00
Linus Torvalds
cfcc811efe Simplify/clean up depth min/max finder
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 15:50:07 -07:00
Linus Torvalds
d4a1dfb3d9 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>
2011-09-07 14:37:47 -07:00
Linus Torvalds
96f5bea1ac 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>
2011-09-07 13:51:35 -07:00
Linus Torvalds
d1ce430878 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>
2011-09-07 13:35:59 -07:00
Linus Torvalds
7bbcf2fabd 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>
2011-09-07 12:05:44 -07:00
Linus Torvalds
19dd61b126 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>
2011-09-07 11:20:09 -07:00
Linus Torvalds
c4d5ebb069 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>
2011-09-07 09:35:45 -07:00
Linus Torvalds
fdbd80a3a2 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>
2011-09-07 09:21:26 -07:00
Linus Torvalds
b5d3fa6023 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>
2011-09-07 09:21:05 -07:00
Linus Torvalds
378ac0d44a 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>
2011-09-07 08:42:05 -07:00
Linus Torvalds
7bbdea19ed Add radio buttons for temperature and volume
.. and clean up some of the conversions.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 08:37:50 -07:00
Linus Torvalds
a6d510f5f1 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>
2011-09-06 21:19:04 -07:00
Linus Torvalds
a06d93217f 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>
2011-09-06 19:28:31 -07:00
Linus Torvalds
75cb94f067 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>
2011-09-06 19:14:56 -07:00
Linus Torvalds
05857e0a05 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>
2011-09-06 19:07:17 -07:00
Dirk Hohndel
a5a3cba574 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>
2011-09-06 18:37:57 -07:00
Linus Torvalds
d314b05301 Minimally parse some UDDF format dives
Dive dates (at least partial parsing), depths and times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 17:33:52 -07:00
Linus Torvalds
4d19f42a4e 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>
2011-09-06 17:01:28 -07:00
Linus Torvalds
0e3bbd4102 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>
2011-09-06 15:41:02 -07:00
Linus Torvalds
dbfce3035e 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.
2011-09-06 15:17:24 -07:00
Dirk Hohndel
dfe5133b57 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>
2011-09-06 15:13:00 -07:00
Linus Torvalds
b6590150d6 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>
2011-09-06 14:58:05 -07:00
Linus Torvalds
454a456172 Merge branch 'patch-1' of git://github.com/schacon/diveclog
* 'patch-1' of git://github.com/schacon/diveclog:
  Add more explicit contributing explanation
2011-09-06 14:54:06 -07:00
Linus Torvalds
93c21a4dbc 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>
2011-09-06 14:46:46 -07:00
Linus Torvalds
e88695ff72 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>
2011-09-06 12:36:52 -07:00
Scott Chacon
dfa6a6e1d1 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>
2011-09-06 12:33:52 -07:00
Linus Torvalds
c0a429457a 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>
2011-09-06 12:16:39 -07:00
Linus Torvalds
3b67a3ecb4 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>
2011-09-06 10:25:01 -07:00
Dirk Hohndel
d4db3e938b 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>
2011-09-06 07:30:48 -07:00
Linus Torvalds
f7a36cfefd 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>
2011-09-05 20:50:52 -07:00
Dirk Hohndel
98d556c6f6 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>
2011-09-05 20:41:59 -07:00
Linus Torvalds
3cb360b514 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>
2011-09-05 20:39:55 -07:00
Linus Torvalds
c24fd4b82c 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.
2011-09-05 14:44:27 -07:00
Linus Torvalds
8197d7f4d4 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>
2011-09-05 14:29:08 -07:00
Linus Torvalds
89593a542a 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>
2011-09-05 13:45:14 -07:00