]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoClean up event handling from libdivecomputer
Linus Torvalds [Thu, 22 Sep 2011 23:45:28 +0000 (16:45 -0700)]
Clean up event handling from libdivecomputer

This just moves the event handling out into its own helper function.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix progress bar during libdivecomputer imports
Linus Torvalds [Thu, 22 Sep 2011 23:38:24 +0000 (16:38 -0700)]
Fix progress bar during libdivecomputer imports

As reported by Mauro Dreissig, the progress bar doesn't work and causes
a SIGSEGV due to a missing allocation.  The code broke when Dirk
separated out the GUI from the core code, and I hadn't tried
divecomputer downloads since.

Reported-by: Mauro Dreissig <mukadr@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate the README a bit
Linus Torvalds [Thu, 22 Sep 2011 22:20:26 +0000 (15:20 -0700)]
Update the README a bit

Update for the current library situation, and notes about
libdivecomputer installation location.

And remove the "we don't interface directly with libdivecomputer", since
that is obviously not true any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'alignment-change' of git://github.com/dirkhh/subsurface
Linus Torvalds [Thu, 22 Sep 2011 19:56:47 +0000 (12:56 -0700)]
Merge branch 'alignment-change' of git://github.com/dirkhh/subsurface

* 'alignment-change' of git://github.com/dirkhh/subsurface:
  Minor change to the alignment of the divelist columns

12 years agoMinor change to the alignment of the divelist columns
Dirk Hohndel [Thu, 22 Sep 2011 19:25:44 +0000 (12:25 -0700)]
Minor change to the alignment of the divelist columns

Just seems to look nicer this way. And actually implements consistent
alignment management for the columns to begin with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoClean up library handling
Linus Torvalds [Thu, 22 Sep 2011 19:21:20 +0000 (12:21 -0700)]
Clean up library handling

.. and pick up libusb-1.0 automatically if it's installed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPut the location last in the dive list
Linus Torvalds [Thu, 22 Sep 2011 18:02:28 +0000 (11:02 -0700)]
Put the location last in the dive list

The whole auto-expansion of an entry in the middle thing really doesn't
work very well in gtk. Give up on it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPut the default focus on the dive list at startup
Linus Torvalds [Thu, 22 Sep 2011 17:28:57 +0000 (10:28 -0700)]
Put the default focus on the dive list at startup

This is some crazy stuff.  Apparently the only sane way to do this is by
hooking into the "realize" callback for the dive list widget.

Whatever. Dirk did the googling to figure this all out.

Suggested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up some minor whitespace issues
Linus Torvalds [Thu, 22 Sep 2011 15:21:32 +0000 (08:21 -0700)]
Fix up some minor whitespace issues

Dirk clearly isn't as anal as I am about pretty whitespace.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSelect the first dive after filling the dive list
Linus Torvalds [Thu, 22 Sep 2011 15:19:34 +0000 (08:19 -0700)]
Select the first dive after filling the dive list

We should always strive to have a dive selected, so pick the first one
(that was how the dive list logic worked anyway, it just wasn't truly
selected at the tree-view level, so it wasn't *visibly* the selected
dive).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the dive list searching act on the location
Linus Torvalds [Thu, 22 Sep 2011 15:17:23 +0000 (08:17 -0700)]
Make the dive list searching act on the location

It used to be "index 0" which originally was the date string, but not
only has that changed (it's now just the dive index), it's kind of
pointless to search for a date string.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't do individual 'gtk_widget_show()' calls
Linus Torvalds [Thu, 22 Sep 2011 15:12:55 +0000 (08:12 -0700)]
Don't do individual 'gtk_widget_show()' calls

This is left-overs from an earlier age when we did this.  But we just do
the "show_all" at the end.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoIn divelist maxdepth column, only show depth unit
Linus Torvalds [Thu, 22 Sep 2011 15:11:12 +0000 (08:11 -0700)]
In divelist maxdepth column, only show depth unit

Show "m" or "ft" instead of "max/m" vs "max/ft".  The column really
doesn't want to be that wide.  The column header is already the widest
part of it even with this short name (due to the sort order arrow
thing).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoIn summary printout, show divemaster if there was no buddy
Linus Torvalds [Thu, 22 Sep 2011 15:09:21 +0000 (08:09 -0700)]
In summary printout, show divemaster if there was no buddy

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'quit-handling' of git://github.com/dirkhh/subsurface
Linus Torvalds [Wed, 21 Sep 2011 19:28:20 +0000 (12:28 -0700)]
Merge branch 'quit-handling' of git://github.com/dirkhh/subsurface

* 'quit-handling' of git://github.com/dirkhh/subsurface:
  Use the last (or only) filename on command line as default for saving
  Show the "save changes" dialog before the main window is destroyed
  Check for changes at regular 'quit' events as well
  Catch changes to the info of the current dive when quitting
  Tracking changes to tanks is trivial
  Simplistic first attempt to get changes saved when quitting subsurface

12 years agoSmall printing tweaks
Linus Torvalds [Wed, 21 Sep 2011 19:16:08 +0000 (12:16 -0700)]
Small printing tweaks

It's getting to the point where I'm happy with this.  This just makes
the spacing between the location and the notes a bit bigger to visually
separate them more, and adds units ("min") to the dive duration (and
removes the seconds, that really didn't make any sense at an overview
level).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd helper function for doing depth unit calculations
Linus Torvalds [Wed, 21 Sep 2011 19:12:54 +0000 (12:12 -0700)]
Add helper function for doing depth unit calculations

.. and use it for printing too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix dive location width problem
Linus Torvalds [Wed, 21 Sep 2011 18:54:18 +0000 (11:54 -0700)]
Fix dive location width problem

For really long dive locations, we now limit the width to the same size
as the date and time, and force it to a single line - with an ellipsis
if it ends up being too big.

Also, since we no longer use any markup anywhere, we migth as well show
the dive buddy information too, as we don't need no stinking quoting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse the last (or only) filename on command line as default for saving
Dirk Hohndel [Wed, 21 Sep 2011 04:50:26 +0000 (21:50 -0700)]
Use the last (or only) filename on command line as default for saving

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoShow the "save changes" dialog before the main window is destroyed
Dirk Hohndel [Wed, 21 Sep 2011 17:31:03 +0000 (10:31 -0700)]
Show the "save changes" dialog before the main window is destroyed

By using the delete-event callback instead of the destroy callback we are
able to display our dialog (and the file-save dialog) while the program
window is still being displayed. Much nicer this way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCheck for changes at regular 'quit' events as well
Dirk Hohndel [Wed, 21 Sep 2011 17:16:33 +0000 (10:16 -0700)]
Check for changes at regular 'quit' events as well

Also make the dialog box less offensively ugly

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCatch changes to the info of the current dive when quitting
Dirk Hohndel [Wed, 21 Sep 2011 14:34:00 +0000 (07:34 -0700)]
Catch changes to the info of the current dive when quitting

As the application shuts down we do one more check to see if the dive that
is currently being displayed has been modified (we previously just checked
as we switch dives)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoTracking changes to tanks is trivial
Dirk Hohndel [Wed, 21 Sep 2011 04:37:49 +0000 (21:37 -0700)]
Tracking changes to tanks is trivial

That's the one I should have started with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoSimplistic first attempt to get changes saved when quitting subsurface
Dirk Hohndel [Wed, 21 Sep 2011 04:29:09 +0000 (21:29 -0700)]
Simplistic first attempt to get changes saved when quitting subsurface

Track whether things changed in the global dive_list

So far this actually works if changing dive info (but only if dive
selected was changed after the dive info was changed).

We are not tracking changes to the cylinder information, yet.

also remove the duplicate static dive_list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDo the pango text layout in multiple chunks
Linus Torvalds [Wed, 21 Sep 2011 17:27:21 +0000 (10:27 -0700)]
Do the pango text layout in multiple chunks

This way we can avoid the need for quoting, since we can just use text
rendering instead of markup for the free-form fields.  And we will want
to make the pango layout width different for the date and location,
since we want to fit the depth/duration to the right of them.

I still haven't set the different width for the date/location, but this
at least is going in the rigth direction.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSue me: I'm not a fan of Serif
Linus Torvalds [Wed, 21 Sep 2011 17:07:35 +0000 (10:07 -0700)]
Sue me: I'm not a fan of Serif

The default cairo font seems to be sans, but the default pango font is
serif.  Maybe it has something to do with my system font settings, but I
doubt it: my desktop font settings are all sans-serif.  So I think pango
is just showing bad taste.

Anyway, this just hardcodes the font to "Sans".  Maybe somebody wants to
make this all part of preferences some day, or pick it from their
desktop font preferences.  In the meantime, just fix the pango brain-damage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix array underrun when calculating velocity
Linus Torvalds [Wed, 21 Sep 2011 15:29:08 +0000 (08:29 -0700)]
Fix array underrun when calculating velocity

That code is messy. And it was buggy. Noticed by valgrind.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up printing some more
Linus Torvalds [Wed, 21 Sep 2011 15:21:14 +0000 (08:21 -0700)]
Fix up printing some more

This makes things slightly prettier and adds back the depth and duration
details to the printout.

Still a few known problems: font choice, and the depth/duration thing
can end up overlapping with a long location name.  But it looks pretty
good on the whole.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSeptember comes before October
Tero Roponen [Wed, 21 Sep 2011 12:44:34 +0000 (15:44 +0300)]
September comes before October

This patch fixes the ordering of month names.

Signed-off-by: Tero Roponen <tero.roponen@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix 'struct plot_info' memory leak
Linus Torvalds [Wed, 21 Sep 2011 05:47:12 +0000 (22:47 -0700)]
Fix 'struct plot_info' memory leak

The plot_info was never freed, so every time you'd plot something, we'd
leak memory.

I'm running valgrind to see if there's anything bad going on.  So far it
all looks fairly benign.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPrinting: use pango markup for text generation
Linus Torvalds [Wed, 21 Sep 2011 05:09:38 +0000 (22:09 -0700)]
Printing: use pango markup for text generation

This gets us text wrapping etc.  I think I have some serious memory leak
somewhere, though, because if I print out all my dives it eventually
ends up with broken dives and doesn't complete.  But I am going to
commit this as a "it kind of works" point.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd completely BS dive text printing
Linus Torvalds [Wed, 21 Sep 2011 02:30:38 +0000 (19:30 -0700)]
Add completely BS dive text printing

The layout is crap, the handling of long lines in notes (or location) is
wrong, the dive number handling is wrong.

The thing is just a toy.

But it's a toy that kind of works, and gives a much better idea of what
a real dive log printout might look like.  With the right kind of dive
notes, it looks fine.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTry printing six dives per page
Linus Torvalds [Wed, 21 Sep 2011 01:13:11 +0000 (18:13 -0700)]
Try printing six dives per page

Ok, so this may be too much, but I'm just playing around with layout.
It could be a runtime choice too, of course.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up printing some more
Linus Torvalds [Wed, 21 Sep 2011 00:52:04 +0000 (17:52 -0700)]
Fix up printing some more

Use the actual degree sign for temperatures (°F and °C), and make sure
everything uses the proper "set_source_rgb[a]()" wrappers to set the
colors.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPrint out only simplified depth profile
Linus Torvalds [Wed, 21 Sep 2011 00:20:54 +0000 (17:20 -0700)]
Print out only simplified depth profile

None of the colors, nothing like that.  Just a gray fill and a plain
black depth line.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up and simplify depth plot
Linus Torvalds [Wed, 21 Sep 2011 00:17:30 +0000 (17:17 -0700)]
Clean up and simplify depth plot

Dirk wrote this before we have the 'plot_info' structure with the
cleaned-up dive info.  No need to maintain that separate array of depths
and seconds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart fleshing out the dive printing a bit more
Linus Torvalds [Tue, 20 Sep 2011 23:46:28 +0000 (16:46 -0700)]
Start fleshing out the dive printing a bit more

Four dives per page sounds good.  Maybe even six? But dangit, the
default font choice for cairo printing sucks.  And I need to learn about
pango for actually printing the dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org
12 years agoDon't show the smoothed dive profile or the min/max info
Linus Torvalds [Tue, 20 Sep 2011 23:45:33 +0000 (16:45 -0700)]
Don't show the smoothed dive profile or the min/max info

It was good for debugging, it's not something we really want to show people.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix divelist sorting
Linus Torvalds [Tue, 20 Sep 2011 21:10:28 +0000 (14:10 -0700)]
Fix divelist sorting

That was stupid.  The divelist column generation cleanup (commit
d3feb78df527: "Make helper function for creating TreeView columns in the
dive list") had a but too much copy-paste going on, and didn't always
have the right column indexes..  t still *looked* right, but sorting
didn't work at all.

Reported-by: Chris Lewis <chrislewis915@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix preferences dialog
Linus Torvalds [Tue, 20 Sep 2011 21:05:46 +0000 (14:05 -0700)]
Fix preferences dialog

Dirk took some old code when he did the merge of the newly split gui
code. Fix it up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSeparate out the UI from the program logic
Dirk Hohndel [Tue, 20 Sep 2011 19:40:34 +0000 (12:40 -0700)]
Separate out the UI from the program logic

The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake the divelist font configurable
Linus Torvalds [Tue, 20 Sep 2011 18:24:15 +0000 (11:24 -0700)]
Make the divelist font configurable

Instead of the hardcoding to "Sans 8", allow people to set it in the
preferences.

Also, make the unit choice be a frame in the preferences dialog instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge git://github.com/sirowain/subsurface
Linus Torvalds [Tue, 20 Sep 2011 17:12:24 +0000 (10:12 -0700)]
Merge git://github.com/sirowain/subsurface

* git://github.com/sirowain/subsurface:
  Fix Segmentation fault when trying to print an empty plot.
  Provide an icon for subsurface.
  Added a comment about libusb dependency in Makefile.

12 years agoMerge branch 'for-linus' of git://github.com/dirkhh/subsurface
Linus Torvalds [Tue, 20 Sep 2011 17:08:27 +0000 (10:08 -0700)]
Merge branch 'for-linus' of git://github.com/dirkhh/subsurface

* 'for-linus' of git://github.com/dirkhh/subsurface:
  Attempt to get the location column to resize in a sensible way
  Minor tweaks to column headers

[ Fixed up minor semantic merge conflict due to the change to make
  'dive_list' internal to divelist.c ]

12 years agoMake 'struct DiveList' entirely internal to divelist.c
Linus Torvalds [Tue, 20 Sep 2011 17:06:24 +0000 (10:06 -0700)]
Make 'struct DiveList' entirely internal to divelist.c

Passing it around is just annoying, and we only ever have one.  Let's
not burden all the users with the silly thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd "Apply"/"Cancel" buttons to dive equipment page
Linus Torvalds [Tue, 20 Sep 2011 16:53:45 +0000 (09:53 -0700)]
Add "Apply"/"Cancel" buttons to dive equipment page

It's too damn easy to make mistakes and not even notice them (odd gtk
widget selection and keyboard input), or just start editing a cylinder
thing and realize it was wrong.

So instead of always saving the equipment information implicitly, add
explicit "Apply" and "Cancel" buttons that save the information (or
re-load it from the dive data structure)

So now you need to press an extra button for your changes to *really*
take effect.  It can be a bit annoying, but it's better than the silent
accidental equipment change that could happen before.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAttempt to get the location column to resize in a sensible way
Dirk Hohndel [Tue, 20 Sep 2011 16:57:38 +0000 (09:57 -0700)]
Attempt to get the location column to resize in a sensible way

Previously the SAC column was the one that expanded which is silly

We also used to cut the location off at 16 characters

Now we try to make the location the one that expands and allow up to 40
characters, but there's something broken, still. If you manually shrink
the location column to its minimum size then subsequently resizing the
window gets the desired behavior. But if you don't manually resize the
location column it doesn't shrink correctly for windows that are smaller
than the space we need for all columns to fully display (instead we get a
horizontal scrollbar)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMinor tweaks to column headers
Dirk Hohndel [Tue, 20 Sep 2011 16:56:46 +0000 (09:56 -0700)]
Minor tweaks to column headers

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake a separate "Log" menu
Linus Torvalds [Tue, 20 Sep 2011 16:37:37 +0000 (09:37 -0700)]
Make a separate "Log" menu

Instead o fhaving everything in the "File" menu, make a separate menu
for things that are very much specific about divelogs, rather than
"generic" things like open/save/import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix Segmentation fault when trying to print an empty plot.
Riccardo Albertini [Tue, 20 Sep 2011 12:44:45 +0000 (14:44 +0200)]
Fix Segmentation fault when trying to print an empty plot.

When printing an empty plot, the function was missing nullability check for 'current_dive'. Now the print of an empty plot results with an empty blank page.
A better solution could be making unsensitive the Print entry in the menu, until a plot is loaded.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoProvide an icon for subsurface.
Riccardo Albertini [Tue, 20 Sep 2011 10:32:40 +0000 (12:32 +0200)]
Provide an icon for subsurface.

I designed a simple blue icon for subsurface with a diver in the middle.
As suggested by Dirk Hohndel, I added the surface line above diver's head,
so that now the icon reflects better the new application name.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoAdded a comment about libusb dependency in Makefile.
Riccardo Albertini [Tue, 20 Sep 2011 10:22:45 +0000 (12:22 +0200)]
Added a comment about libusb dependency in Makefile.

Due to libdivecomputer's dependency, can be necessary to add libusb to pkg-config in order to compile,
so I exported the pkg-config line in the subsurface target to LIBS variable, and added a comment about libusb.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoReinstate the main window title
Linus Torvalds [Tue, 20 Sep 2011 05:09:47 +0000 (22:09 -0700)]
Reinstate the main window title

It got removed by some of my overly aggressive cleanup in commit
fefcbf125e89 ("Remove dive info frame") because the dive info frame
initialization also initialized the main window title..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSwitch the dive list and dive profile panes around
Linus Torvalds [Tue, 20 Sep 2011 05:08:43 +0000 (22:08 -0700)]
Switch the dive list and dive profile panes around

It looks better this way, I think.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoHacky hard-coded font for dive list entries
Linus Torvalds [Tue, 20 Sep 2011 05:01:55 +0000 (22:01 -0700)]
Hacky hard-coded font for dive list entries

This really is too wrong for words, but I do think the dive list may
look better with a smaller font.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake helper function for creating TreeView columns in the dive list
Linus Torvalds [Tue, 20 Sep 2011 04:39:15 +0000 (21:39 -0700)]
Make helper function for creating TreeView columns in the dive list

Let's not repeat the boiler-plate code more than necessary.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd cylinder description to dive list
Linus Torvalds [Tue, 20 Sep 2011 03:06:54 +0000 (20:06 -0700)]
Add cylinder description to dive list

And I *really* would want to make the dive list be a ComboBox or
something like that, rather than a ListView.  I need to really
understand those things, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTurn the rest of the duplicate string fields to use render functions
Linus Torvalds [Tue, 20 Sep 2011 02:13:36 +0000 (19:13 -0700)]
Turn the rest of the duplicate string fields to use render functions

So instead of having a depth field (in mm) for sorting, and the text
field that contains the same thing in text, we now have all the fields
we use in "native" format, and we just render them as text dynamically.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse renderer function for divelist depth field too
Linus Torvalds [Tue, 20 Sep 2011 01:52:23 +0000 (18:52 -0700)]
Use renderer function for divelist depth field too

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse a renderer function on the date field
Linus Torvalds [Tue, 20 Sep 2011 01:44:47 +0000 (18:44 -0700)]
Use a renderer function on the date field

Instead of creatign an extra column containing the date text, use a
renderer function to create the text dynamically.

Just the date right now, but we'll do them all this way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoOops, fix typo. EAN, not EAD
Linus Torvalds [Mon, 19 Sep 2011 23:58:46 +0000 (16:58 -0700)]
Oops, fix typo. EAN, not EAD

Typo turned EAN (Enriched Air Nitrox) to EAD.  Which does mean something
too, just to confuse people - but while it's still nitrox-related, it's
entirely the wrong thing (Equivalent Air Depth).  I don't think anybody
would ever care to see *that*. With computers, why would you care?

Anyway, Dirk noticed it, and suggested I just use O2% instead.  It's not
like EAN is all that readable either.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate the divelist when dive info changes
Linus Torvalds [Mon, 19 Sep 2011 23:41:56 +0000 (16:41 -0700)]
Update the divelist when dive info changes

This flushes the dive changes to the dive list, the way the old dive
info frame would update as you update dive fields.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd air usage calculations to dive list
Linus Torvalds [Mon, 19 Sep 2011 23:11:38 +0000 (16:11 -0700)]
Add air usage calculations to dive list

Hey, now you can sort your dives by how good your SAC is.  Which sounds
more useful than it probably actually is.  But maybe you can see
patterns in what makes your SAC suck..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd location to divelist too
Linus Torvalds [Mon, 19 Sep 2011 22:52:42 +0000 (15:52 -0700)]
Add location to divelist too

Sure, it's visible elsewhere, but this way you can search and sort for
it, and see several entries at once.  So again, having it visible in the
dive list is a good thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up divelist generation some more
Linus Torvalds [Mon, 19 Sep 2011 22:39:29 +0000 (15:39 -0700)]
Clean up divelist generation some more

.. and make the date string much more readable, now that we aren't
actually size-constrained any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart filling in temperature and nitrox data in dive list
Linus Torvalds [Mon, 19 Sep 2011 20:32:10 +0000 (13:32 -0700)]
Start filling in temperature and nitrox data in dive list

Still more to go, but it's slowly fleshing out..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd temp/nitrox/sac entries to divelist
Linus Torvalds [Mon, 19 Sep 2011 19:56:37 +0000 (12:56 -0700)]
Add temp/nitrox/sac entries to divelist

This doesn't really fill them, it just adds them to the possible
entries.  I'll get to it later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the pane split be vertical rather than horizontal
Linus Torvalds [Mon, 19 Sep 2011 19:46:22 +0000 (12:46 -0700)]
Make the pane split be vertical rather than horizontal

Ok, this makes that dive list look empty and ugly, but as mentioned, we
really should start filling it with all the useful information that we
can sort by, like temperature and air use.

And even stuff that might not make sense to sort by (would you want to
sort by cylinder size or name? Or by nitrox percentage) could still be
*shown* in the list fairly naturally.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRemove dive info frame
Linus Torvalds [Mon, 19 Sep 2011 19:39:35 +0000 (12:39 -0700)]
Remove dive info frame

It has always been problematic, and I've been moving things in and out
of it.

And it just isn't a very powerful widget.  You can't *do* anything with
it.  The information it shows you may be useful, but the core stuff
already shows up in the dive list.

And the dive list is actually a much superior widget over that static
dive info frame.  The information that shows up in the dive list can be
sorted by column, for example.

So when we show temperatures or SAC numbers in the dive info frame,
that's actually a very bad place to show them: we would be much better
off showing it in the dive list, and then we could sort by SAC or by
temperature.

In other words: just remove the thing.  Instead, plan to extend the dive
list to contain all the information.  That will probably mean that we
need to change the current pane widget to be a vertical pane, rather
than a horizontal one, but what's wrong with that?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the divelist column naming clearer
Linus Torvalds [Mon, 19 Sep 2011 19:25:16 +0000 (12:25 -0700)]
Make the divelist column naming clearer

Currently we use random hard-coded integers, and it's not always clear
what is going on.  Make it much more explicit with an enumeration of the
different divelist columns.

And change the column order to make it more logical, and make sure we
actually catch all uses while at it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAttempt to smooth out the velocity readings
Dirk Hohndel [Sat, 17 Sep 2011 04:45:32 +0000 (21:45 -0700)]
Attempt to smooth out the velocity readings

If the velocity is slower than FAST then we look back up to 30 seconds and
calculate the velocity for the past 30 seconds instead.

For the first version I'm not doing the average of the changes but simply
the change from beginning to end.

The alternative would be to do another triangle smoothing or something
like that - but as we don't know how many samples we have in the 30 second
window, it's a little harder here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFlip tank pressure graph to show the RIGHT way
Dirk Hohndel [Sat, 17 Sep 2011 03:53:05 +0000 (20:53 -0700)]
Flip tank pressure graph to show the RIGHT way

This annoyed me from the first moment Linus added the tank pressure graph.
As the pressure goes down, the graph needs to go down. Seriously.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoStop plotting the gas / consumption information into the profile
Dirk Hohndel [Sat, 17 Sep 2011 03:44:40 +0000 (20:44 -0700)]
Stop plotting the gas / consumption information into the profile

And move the code into info.c where it now belongs

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake handling of empty airconsumption string consistent
Dirk Hohndel [Sat, 17 Sep 2011 03:20:28 +0000 (20:20 -0700)]
Make handling of empty airconsumption string consistent

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMore fixes to positioning of gas / consumption information in info_frame
Dirk Hohndel [Sat, 17 Sep 2011 03:13:57 +0000 (20:13 -0700)]
More fixes to positioning of gas / consumption information in info_frame

This gives the airconsumption label a fixed size and changes its alignment
so it is anchored to the right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoStop tank / gas / consumption info from changing info_frame size
Dirk Hohndel [Fri, 16 Sep 2011 23:29:43 +0000 (16:29 -0700)]
Stop tank / gas / consumption info from changing info_frame size

Simply set it to an empty string with TWO lines when there is nothing to
display

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoIndicate vertical velocity through color
Dirk Hohndel [Fri, 16 Sep 2011 23:22:00 +0000 (16:22 -0700)]
Indicate vertical velocity through color

So far Linus has hated all of my attempts to visualize vertical velocity
through color. This time I'm trying something dramatically new: there is
no PURPLE involved. Maybe that will convince him of the value.

We simply calculate the vertical velocity for the current plot segment
(last sample point to this sample point - in this version even without
divisions by zero) and assign a label based on the rate of change. These
labels are translated through a predefined table into colors:

Dark green is +/- 5ft/min (stable)
Light green is descents up to 30ft/min and ascents up to 15ft/min
Yellow is descents up to 60ft/min and ascents up to 30ft/min
Orange is descents up to 100ft/min and ascents up to 60ft/min
Red is outside of those ranges - you are most likely in danger

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoShow tank / nitrox / air consumption information in the info_frame
Dirk Hohndel [Fri, 16 Sep 2011 22:45:14 +0000 (15:45 -0700)]
Show tank / nitrox / air consumption information in the info_frame

Even though we go down to an 8pt font the info_frame changes size when the
air info is added. I don't like this but want to see how Linus would like
this resolved before going overboard.

Minor tweaks to the formating (we don't need two decimals when printing
the liters of air consumed).

This patch does NOT remove the plot of the air information in the profile
graph. I think we want to remove that once we like the text where it is,
but I wanted to do one thing at a time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDirk can't count to ten
Linus Torvalds [Fri, 16 Sep 2011 21:21:30 +0000 (14:21 -0700)]
Dirk can't count to ten

That's ok, Dirk. I've got your back.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRemove dive number from frame label
Dirk Hohndel [Fri, 16 Sep 2011 21:12:37 +0000 (14:12 -0700)]
Remove dive number from frame label

It's now in the window title - no point in having it twice.
Also added a little "Dive #xx - " template. The old "##. " was a bit too
minimalistic for my liking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoPut the dive number and location in the window title bar
Linus Torvalds [Fri, 16 Sep 2011 19:15:46 +0000 (12:15 -0700)]
Put the dive number and location in the window title bar

I suspect the "info" area is better used for actual values, so move the
dive location into the window title instead (using date if no location
info), and title the info frame with date and time.

This just means that the date/time gets removed from inside the frame:
we may want to put air consumption info in there instead?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTweak temperature plot to look better for small fluctuations
Dirk Hohndel [Fri, 16 Sep 2011 18:35:04 +0000 (11:35 -0700)]
Tweak temperature plot to look better for small fluctuations

If the temperature is in a very narrow range the existing code visually
exaggerated the fluctuations. This tries to dampen that effect a bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoTweak plot scaling a bit
Linus Torvalds [Fri, 16 Sep 2011 17:28:40 +0000 (10:28 -0700)]
Tweak plot scaling a bit

Change the duration max rounding as noted by Dirk, and move the air
consumption down further towards the bottom right corner.  In
particular, I make the text positions not scale with the window size,
purely by the size of the text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMinor corrections to printing of the last temperature
Dirk Hohndel [Fri, 16 Sep 2011 16:51:38 +0000 (09:51 -0700)]
Minor corrections to printing of the last temperature

 - the time stamp where we printed the last temp was wrong
 - we really shouldn't check mK for being identical - especially on dive
   computers that store a lot of samples

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse plot_info for final remaining temperature and pressure data plots too
Linus Torvalds [Fri, 16 Sep 2011 16:23:54 +0000 (09:23 -0700)]
Use plot_info for final remaining temperature and pressure data plots too

Ok, this is pretty much it now.  Instead of having various random checks
for "is the time of the sample past the end of the dive" hacks, we not
plot all graphs from the cleaned-up plot_info structure instead of the
raw samples.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPlot pressure data based on 'struct plot_info' rather than raw dive data
Linus Torvalds [Fri, 16 Sep 2011 16:10:13 +0000 (09:10 -0700)]
Plot pressure data based on 'struct plot_info' rather than raw dive data

Further movement to using the sanitized and cleaned-up plot info rather
than the raw data.

The raw dive data contains samples from the end of the dive that we
don't want to drop, but that we also don't want to actually use for
plotting the dive.  So the eventual end goal here is to not ever use the
raw dive samples directly for plotting, but use the diveplot data that
we have analyzed for min/max (properly ignoring final entries) etc.

There's still some data that we take from the samples when plotting, but
it's getting rarer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo min/max pressure and temperature based on the non-surface data
Linus Torvalds [Fri, 16 Sep 2011 15:47:13 +0000 (08:47 -0700)]
Do min/max pressure and temperature based on the non-surface data

Do the min/max calculations only *after* we have removed the extra
surface events at the end.

The Uemis data in particular has a lot of surface events after the dive,
and we don't really want to take them into account since we won't be
plotting them anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPlot temperature info using 'struct plot_info' rather than the raw dive samples
Linus Torvalds [Fri, 16 Sep 2011 15:42:27 +0000 (08:42 -0700)]
Plot temperature info using 'struct plot_info' rather than the raw dive samples

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart using 'plot_info' more for dive-time limits
Linus Torvalds [Fri, 16 Sep 2011 15:20:06 +0000 (08:20 -0700)]
Start using 'plot_info' more for dive-time limits

.. I'll want to move pressure limit calculations into the 'plot_info',
so that we can do several passes of analysis and change dive limits etc
without having to actually modify the dive data itself (or add new
fields to 'struct dive' just for plotting).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo libdivecomputer imports in a separate thread
Linus Torvalds [Fri, 16 Sep 2011 05:58:02 +0000 (22:58 -0700)]
Do libdivecomputer imports in a separate thread

This is the hackiest thing ever, unless you count the previous code that
was even hackier (and just called the gtk main routine at random
places).

The libdivecomputer library is not really set up to be part of the gtk
main loop, and cannot afford (for example) to have lots of mainloop
events while it's parsing.  Some dive computers are very timing
sensitive for the communication.

So just start a thread for doing the libdivecomputer stuff, and just
continually call the gtk main loop while that thread is running.  I'm
sure we could actually use some gtk signalling thing to make the thread
exit do the right thing, but instead we just poll the status every
100ms.

I did say it was hacky.  It does seem to work, though.  No more
temporary graying out of the windows when they don't react in a timely
manner because libdivecomputer does some blocking operation.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSupport gps coordinates for the location info
Linus Torvalds [Fri, 16 Sep 2011 01:16:07 +0000 (18:16 -0700)]
Support gps coordinates for the location info

Sadly, no way to show them yet.  But it would be nice to let people
enter them (and it would be doubly nice to have a dive computer that
does it at the surface), and then perhaps just do the "point browser at
google maps" thing.

Saving/parsing tested by hand-feeding the location of Enenui (Molokini
Crater) from google maps by hand into my divelog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRename the project 'subsurface'
Linus Torvalds [Thu, 15 Sep 2011 16:43:14 +0000 (09:43 -0700)]
Rename the project 'subsurface'

I never really liked 'diveclog' as a name - it's not like the C part is
all that important.  And while I could try to just make up another slang
word for despicable person (in the tradition of naming all my projects
after myself), I just can't see it.

So let's just call it "subsurface".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPrint the end temperature of the dive
Dirk Hohndel [Thu, 15 Sep 2011 16:10:08 +0000 (09:10 -0700)]
Print the end temperature of the dive

Currently we print the temperature every five minutes. Especially with
dive computers that keep rather frequent temperature samples that means
that we have one more interesting data point that we don't label: the
surface temperature at the end of the dive.

This patch adds some logic to try to print the last temperature sample
that was recorded before the dive ended - unless that same value has
already been printed (to avoid silly duplications on dive computers with
less frequent sampling)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't draw temperature plot past the end of the dive
Dirk Hohndel [Thu, 15 Sep 2011 16:09:25 +0000 (09:09 -0700)]
Don't draw temperature plot past the end of the dive

Just like we end depth and tank pressure plots once we are on the surface
(this is relevant for dive computers like the uemis Zurich that keep
recording samples after the end of the dive)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix uemis depth calculation in the uemis XML importer
Dirk Hohndel [Thu, 15 Sep 2011 15:15:25 +0000 (08:15 -0700)]
Fix uemis depth calculation in the uemis XML importer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix depth calculations in SDA import
Dirk Hohndel [Thu, 15 Sep 2011 15:12:51 +0000 (08:12 -0700)]
Fix depth calculations in SDA import

stole and fixed Linus' code in the uemis XML importer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix incorrect data dereference
Dirk Hohndel [Thu, 15 Sep 2011 14:08:57 +0000 (07:08 -0700)]
Fix incorrect data dereference

This caused incorrect "missing Dive100" messages when importing SDA file
from the uemis Zurich.

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