]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoMerge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface
Linus Torvalds [Tue, 27 Sep 2011 17:46:42 +0000 (10:46 -0700)]
Merge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface

* 'otu-tracking-v2' of git://github.com/dirkhh/subsurface:
  Make OTU column invisible by default
  Add OTU to divelist
  Calculate OTUs for every dive

Fix up trivial conflicts in dive.h (due to dive event handling also
adding a field to the dive structure)

12 years agoMake the dive list start as a plain notebook page
Linus Torvalds [Tue, 27 Sep 2011 17:38:07 +0000 (10:38 -0700)]
Make the dive list start as a plain notebook page

I've been wondering how to make 'subsurface' work better on a small
screen (I used to travel with a crappy netbook - I may have upgraded my
laptop since, but it is still a design goal of mine to make sure it all
works fine in that kind of environment).

And ever since the dive list was made much wider and moved below the
notebook, it's annoyed me how much room it all takes if I want to have
both a reasonable plot window and several dives visible at the same
time.

The solution seems to be to just make the dive list be a notebook page.
That makes the default layout very dense.

At the same time, when you have the pixels, it's horrible, because you
would want to see the dive list and move between dives while at the same
time also seeing the dive profile change.  But that is solvable by
simply making the dive list notebook page be detachable, so if you have
a nice big screen, just detach the dive list page and now you have
independent windows for the dive list and the dive info.

NOTE! I don't have any way to re-attach the dang thing.  I think I'd
need to learn about drag-and-drop targets etc.  So once you've detached
the dive list, it stays detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake OTU column invisible by default
Dirk Hohndel [Mon, 26 Sep 2011 23:05:24 +0000 (16:05 -0700)]
Make OTU column invisible by default

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoUpdate Mares IconHd parsing to current libdivecomputer interface
Linus Torvalds [Mon, 26 Sep 2011 20:14:41 +0000 (13:14 -0700)]
Update Mares IconHd parsing to current libdivecomputer interface

The libdivecomputer interfaces are pure crap.  There are no generic
"open the dive computer" or "create a parser for the dive computer"
interfaces, instead each dive computer you support has its own open and
parser generator interface.

And they change.  Happily fairly seldom, but they change.  And two days
ago, Jef changed the interface for the Mares Icon HD computer in order
to support the newer HD Net Ready variant.

I've asked Jef to make a sane interface for "open the dive computer" and
"just create the parser" for libdivecomputer, but he claims that he
cannot just track the device model details internally.  Which is
obviously a completely bogus claim, since the way *we* track the model
details is to just feed it back from the silly event.

libdivecomputer should just do that internally and not bother us with
its crazy internal model numbers.  But whatever.

In the meantime, work around this braindamage, and hope that
libdivecomputer comes to its senses some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStop libdivecomputer import when we start seeing old dives
Linus Torvalds [Mon, 26 Sep 2011 20:04:14 +0000 (13:04 -0700)]
Stop libdivecomputer import when we start seeing old dives

I don't know about other dive computers, but the Suunto Vyper Air is
slow as hell to import all the dives from.  And libdivecomputer seems to
be importing dives "most recent first", so this just makes it stop
importing dives when it finds a dive that we've already seen.

Caveat: libdivecomputer has this fancy notion of "dive fingerprints",
and claims that's the way to do things.  That seems to be overly
complicated, and not worth the bother.

If you worry about the import finishing early due to already having some
dives with the same date in your dive list, just import starting from an
empty state, and thus get a pure "dive computer only" state with no
early out.  Then you can just load the old dives afterwards, and depend
on subsurface merging any duplicates.

But for normal operation, when you just want to import a couple of new
dives from your dive computer, the "exit import early when you see a
duplicate" is the right thing to do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a copy of the GPL v2 to the project
Linus Torvalds [Mon, 26 Sep 2011 18:18:28 +0000 (11:18 -0700)]
Add a copy of the GPL v2 to the project

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd the version to the Makefile
Linus Torvalds [Mon, 26 Sep 2011 18:04:50 +0000 (11:04 -0700)]
Add the version to the Makefile

Not quite the same format as for the kernel, but I want to do the normal
"edit the makefile before making a release" model that I'm used to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate README to reflect the fact that /dev/ttyUSB0 is no longer hardcoded
Linus Torvalds [Mon, 26 Sep 2011 17:06:00 +0000 (10:06 -0700)]
Update README to reflect the fact that /dev/ttyUSB0 is no longer hardcoded

Yay.  It's not like we're all done, but the hardcoded dive computer
location was one of those "I don't want to release 1.0 with this".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a GtkEntry to allow editing of the device name
Linus Torvalds [Mon, 26 Sep 2011 16:44:27 +0000 (09:44 -0700)]
Add a GtkEntry to allow editing of the device name

Ok, so some file chooser widget with a popup dialog would have been more
professional, but I'm lazy.  Plus I suspect the popup would look
horrible when populated with /dev entries, and I don't think there is
any sane filter function.

So this works, and means that you don't *have* to recompile the whole
program just because you have your dive computer on something else than
a USB serial line.

I suspect I should save the default name as a config variable too.
Maybe a setting in the preferences dialog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a "Dive Computer" frame around the dive computer choice in import
Linus Torvalds [Mon, 26 Sep 2011 16:19:30 +0000 (09:19 -0700)]
Add a "Dive Computer" frame around the dive computer choice in import

I'll add a widget to allow the user to select the device too, so let's
name things to make them more obvious.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a xml file filter to the file open dialog
Linus Torvalds [Mon, 26 Sep 2011 16:18:23 +0000 (09:18 -0700)]
Add a xml file filter to the file open dialog

My home directory is a mess.  Don't show all the crap, just the stuff
that might be relevant.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd an 'About' dialog
Linus Torvalds [Sat, 24 Sep 2011 22:48:13 +0000 (15:48 -0700)]
Add an 'About' dialog

It's really just about the logo, but whatever.  Dirk tells me I need one
of these in order to call it 1.0.  And I'm not going to fall into the
trap of thinking that 1.0 needs to be something polished, it just needs
to be working well enough..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse 'gtk_dialog_get_content_area()' instead of accessing dialog directly
Linus Torvalds [Sat, 24 Sep 2011 22:26:37 +0000 (15:26 -0700)]
Use 'gtk_dialog_get_content_area()' instead of accessing dialog directly

I'm reading gtk docs, and trying to clean things up a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow events on the dive profile
Linus Torvalds [Fri, 23 Sep 2011 04:15:36 +0000 (21:15 -0700)]
Show events on the dive profile

This is *really* ugly.  We really should just create some kind of widget
that when moused over will show the event.  Or something.  Rather than
putting text on top of other text: the events - when they happen - are
usually bunched together (PO2 warnings, max depth, fast ascent leading
to mandatory safety stop, you name it).

But at least this way we see that the data is there, even if we see it
in ugly ways.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd cheesy "install" target
Linus Torvalds [Fri, 23 Sep 2011 03:59:10 +0000 (20:59 -0700)]
Add cheesy "install" target

It just puts the subsurface binary in $(HOME)/bin.

.. and then the binary won't find the icon file, so this is really not
enough of an install to get it really working, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDrop surface events when reading from an XML file too
Linus Torvalds [Fri, 23 Sep 2011 03:51:03 +0000 (20:51 -0700)]
Drop surface events when reading from an XML file too

Remember those useless surface events that we ignore when we import a
dive from a dive computer? Yeah, they exist in the libdivelog xml files
too.  So ignore them when we see them there too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge latitude and longitude data properly
Linus Torvalds [Fri, 23 Sep 2011 03:50:07 +0000 (20:50 -0700)]
Merge latitude and longitude data properly

When merging two identical dives and one of them has lat/long data, pick
it up correctly for the merged dive.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge dive events correctly too
Linus Torvalds [Fri, 23 Sep 2011 03:28:04 +0000 (20:28 -0700)]
Merge dive events correctly too

It's very similar to the sample merging.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart handling dive events
Linus Torvalds [Fri, 23 Sep 2011 01:02:54 +0000 (18:02 -0700)]
Start handling dive events

Parse them, save them, take them from libdivecomputer.

This doesn't merge them or show them in the profile yet, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoProperly merge dive buddies and divemaster information
Linus Torvalds [Fri, 23 Sep 2011 01:01:01 +0000 (18:01 -0700)]
Properly merge dive buddies and divemaster information

When we merge dives, we didn't merge these fields properly. Do it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoImprove libdivecomputer event printout
Linus Torvalds [Thu, 22 Sep 2011 23:55:55 +0000 (16:55 -0700)]
Improve libdivecomputer event printout

Ignore surface events - they are meaningless anyway and just add noise.

Print out other events properly, including correct time offset etc.

We still don't actually *save* the events, but now it might be worth
doign so.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 agoAdd OTU to divelist
Dirk Hohndel [Thu, 22 Sep 2011 21:02:26 +0000 (14:02 -0700)]
Add OTU to divelist

and change OTUs to be tracked as int, not double

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCalculate OTUs for every dive
Dirk Hohndel [Thu, 22 Sep 2011 20:45:53 +0000 (13:45 -0700)]
Calculate OTUs for every dive

The calculation assumes that the cylinderindex in each sample tells us
which PO2 the dive was breathing at that time. This needs to be verified
with dives where there is an actual gas switch.

No idea where to display them, yet. Far fewer people will care about this
than care about SAC - does this still rate a spot in the dive_list?
I guess I could make it part of the dive_info - but it's not editable.
It doesn't seem to fit with the equipment page (even though this is the
one editable field that is related - nitrox %)

Signed-off-by: Dirk Hohndel <dirk@hohndel.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>