Commit graph

2135 commits

Author SHA1 Message Date
Dirk Hohndel
de0cdf28b2 Merge branch 'po-files'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	po/nb_NO.po
	po/ru_RU.po
2013-02-03 18:08:26 +11:00
Dirk Hohndel
547a3cf120 Update PO files again
Commit acd5a935850 ("Distinguish the two uses of "Gas Used" for
translation purposes") requires us to recreate the PO files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 18:04:16 +11:00
Dirk Hohndel
7f59026dbf Distinguish the two uses of "Gas Used" for translation purposes
One is about the amount, the other about the specific type of gar that was
used.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 18:03:10 +11:00
Dirk Hohndel
9edde5ff28 Correctly parse translated cardinal directions
We now compare to both the standard English characters ('N', 'E', etc) as
well as to the translated strings (_("N"), _("E")) when parsing GPS
strings.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 15:43:30 +11:00
Martin Gysel
6fa9e02723 Fix compiling, old api of parse_xml_buffer
Commit 8843ee61 changes the api of 'parse_xml_buffer'. Unfortunately one
occurrence has been left which fails if LIBZIP has been defined.

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 12:47:49 +11:00
Dirk Hohndel
59e92d7cfa Correctly reset stop depth if we receive NDL sample from libdivecomputer
The existing code forgot to reset the stopdepth to 0 which resulted in a
bogus safety stop being displayed on some divecomputers after the diver
finished their deco obligation.

Reported-by: Jan.Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 12:47:42 +11:00
Dirk Hohndel
4ddea283a5 Imitialize gc y range for GF factor print
It seemed so smart to just base the coordinates on what's already in the
graphics context. Except that we apparently got a 0 to 0 range for y
coordinates if there are no pressure samples for a dive.

This fixes the problem and GF values are shown even for dives without
pressure samples.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 12:47:32 +11:00
Dirk Hohndel
3e426283b4 Increase the buffer for the gas text in planner
Translations that use UTF-8 could easily create more characters than I had
initially specified.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 08:44:51 +11:00
Sergey Starosek
8edb28b69f Updated Russian translation in preparation for v3.0
Some strings are not translated yet due to minor bugs.
Needs to be discussed on the mailing list.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 07:54:52 +11:00
Dirk Hohndel
ec1998216f Merge branch 'subsurface-icon' of github.com:henrik242/subsurface 2013-02-03 07:49:45 +11:00
Henrik Brautaset Aronsen
ce87c26c00 Move about icon to include file
Getting the about icon to display in various scenarios on MacOSX
was a pain.  Moving the icon to an include file solved the problem.

This commit also fixes the problem Dirk was having when converting
satellite.svg to a png in commit cf3c0266c2.  I couldn't
quite get ImageMagick to preserve transparency and color when
converting subsurface-icon.svg, though, so I used Gimp instead.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2013-02-02 21:27:19 +01:00
Henrik Brautaset Aronsen
459130009b Rename subsurface.svg to subsurface-icon.svg
In preparation for a subsurface-icon.h, this should avoid confusion
about whether "subsurface.h" is a core header file.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2013-02-02 21:27:15 +01:00
Jan Schubert
99dbd667bf Fixing SP handling in planner, adding event
This moves some double/floating handling for po2 to plain integer. There
are still non int values around (also for phe and po2) in the plot area.

Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 07:07:12 +11:00
Jan Schubert
59cfa5c427 Fixing SP handling in planner, adding event
Fixing the SP change event and introducing a bailout scenario.

I decided not to use a event showing SP=0.0 nor using a gaschange event as
is in fact there is no gas change related to bailing out itself. If there
is also a gaschange for the event it will be displayed anyway.

Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 07:06:38 +11:00
Jan Schubert
057253c4eb Fixing SP handling in planner, adding event
Fixes bug in planner which prevents from bailing out (setpoint = 0).

Also introduces events for changing setpoints in planner.
It also makes the eventtype for gaschange slightly more consistent by
changing it from SAMPLE_EVENT_GASCHANGE (O2 only) to
SAMPLE_EVENT_GASCHANGE2 (O2/He). But Subsurface treats them both the same
(the distinction comes from libdivecomputer).

Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 07:05:16 +11:00
Salvador Cuñat
8a49278740 Fix print displacement on SAC, CNS and OTUs
Changes in print_weight had displaced the plot of next prints.
This fix the displacement using cairo_save/restore.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 06:56:45 +11:00
Pierre-Yves Chibon
20d3b5f714 Add 'Save As' entry to context menu shown when right clicking on a dive
Something which is nice especially when asked on the list to share an
interesting dive is the possibility to save just some dives into a file.

This commit adds to the context menu shown with right-click the 'Save As'
entry. This entry allows to save selected dives.

[Dirk Hohndel: clean up white space, commit message and remove unused
               variables]

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-02 00:10:14 +11:00
Lubomir I. Ivanov
60f9c338e9 planner.c: Use g_time_zone_find_interval()
current_time_notz():
Attempt to use g_time_zone_find_interval() to retrieve a
timezone interval, which is then passed to g_time_zone_get_offset()

Reported and tested-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-02 00:05:03 +11:00
Henrik Brautaset Aronsen
326707800d Updated Norwegian translations in preparation for v3.0
For all you Norwegians out there!

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-02 00:03:37 +11:00
Dirk Hohndel
b103ffa3d0 Quick attempt to complete the German translations
This will need careful review by German speakers who actually dive in
German speaking countries!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 19:10:30 +11:00
Dirk Hohndel
08d4b43243 Updated PO files in preparation of 3.0 release
Translators, please start your engines...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 18:08:13 +11:00
Dirk Hohndel
29e73be9f2 Fix the rules for creating the windows .nsi file
This was one of the reasons why I tagged version 2.9. I wanted to test all
the Makefile magic we added to get sane and automated versions on Windows
and Linux. And it turned out my sed script failed in rather obvious ways.

These changes appear to fix that - but of course you won't see that unless
you reset your git repository to the tag and manually apply this patch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 18:06:13 +11:00
Dirk Hohndel
5d9ed3f1b4 Bump version number to 2.9
This is intended as a visual sign that we are getting closer to 3.0.

We should consider this a "soft" code freeze / string freeze - I'm still
looking for a bunch of fixes, small additions and of course documentation,
but no new major features.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 17:48:55 +11:00
Dirk Hohndel
cf3c0266c2 Move flag icon to include file
Just like with the satellite icon we are creating a pixdata structure for
the flag.

The Makefile cleanup in commit df6a9ddd8a21 ("Auto-generate C file
dependencies, and make the build more quiet") removed the rules for
generating the .h file by mistake (I hope).

This adds a more generic rule back in and also makes sure that the data
structures get more useful names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 17:25:41 +11:00
Carl Worth
393c88f087 print: Use logical text extents to layout text in weight system box
The old code was computing locations based on relative portions of the
available height. The correct thing to do, (and done here in the
patch), is to advance by the logical height of rendered text each
time.

What's stll missing is anything to guarantee that the text drawn will
fit in the box. The correct answer here is along one of two lines:

  1. Use the logical text extents to decide what size to draw the box.

  2. Use a pre-computed box size and choose a font size that will fit

Either approach will involve a fairly substantial reworking of the
rendering code in print.c.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 16:13:05 +11:00
Carl Worth
a6fd407626 print: Use cairo_save/cairo_restore to manage temporary cairo changes
The print_weight_data function was making several cairo_translate
calls and then doing some final cairo_translate calls with the goal of
manually undoing any changes to cairo's state. Obviously, this is
fragile.

Cairo provides save/restore calls which solve this problem in a robust
way. Switch to using these instead.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 16:11:47 +11:00
Linus Torvalds
7e7cbb0dce When switching sort order, scroll the dive list to the current dive
Now that we actually seem to understand the whole notion of setting the
active dive, let's take that code a bit further, and always scroll to it
when we're introducing a new sort ordering.

Sure, there may be other selected dives, but we have one primary
(current) dive that we show the profile and dive data for, and when we
switch sort order we probably want to see that dive in the dive list.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 10:51:45 +11:00
Henrik Brautaset Aronsen
b03ae632d5 Recognize O2 percentage from MacDive import
MacDive use "o2percent" in its XML export

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 09:19:38 +11:00
Dirk Hohndel
b709dff23d Clear yearly statistics when closing data file
Another oversight of what needed to be done when cleaning up the UI after
closing the data file.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 00:19:03 +11:00
Dirk Hohndel
0f2fac265f Clear the list of events when closing data file
When the data file is closed we should reset the events that we offer for
filtering.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 00:07:04 +11:00
Dirk Hohndel
6f66781b1f Turn off tooltips if no dives are selected
We already clear the widgets but forgot to turn off the tooltips as well.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 00:00:29 +11:00
Dirk Hohndel
aa55bda944 Don't allow to plan dives out of order
The planned dive always has to be the last dive in the dive list. To make
sure of that we interpret the relative start time to be relative to either
the current time or the end of the last dive, whichever is later.

This fixes a bug where we would delete the wrong dive and get our data
structures confused by planning multiple dives out of order.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 23:50:35 +11:00
Dirk Hohndel
de7d5b2d5b Make sure that the planned dive is selected
With the changes to the selection logic the selected_dive variable didn't
get updated at the end of planning a dive. With an empty dive list that
could cause selected_dive to be -1 which would subsequently cause a
SIGSEGV when trying to edit the newly created dive.

With this commit we use the shared go_to_iter() function and also make
sure that selected_dive is set correctly.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 22:31:58 +11:00
Linus Torvalds
b93f2ec6c3 Make the dive selection logic also set the treeview cursor
This fixes "enter" after moving around with the cursor keys.

Hinted-at-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 17:31:36 +11:00
Dirk Hohndel
d37f8736db Place Info and Stats page at the top of notebook page
This seems to look better than the previous "centered" setup when
switching between notebook pages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 17:18:06 +11:00
Dirk Hohndel
5fd901591c Add tooltip that tells user how to edit dive information
This adds the tooltip just to the Dive Notes page of the notebook area -
that's where people are tempted to try to do "edit in-place" which we
currently don't support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 17:11:25 +11:00
Dirk Hohndel
b87a10a696 Minor fine tuning of window size and initial zoom factors for maps
This may be a matter of taste, but it seems that these values work better.
Most importantly, Hawaii is now visible by default...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 16:20:24 +11:00
Dirk Hohndel
c8f2622f2f Fix the tooltips
Commit a52b0aa5ea8d ("Show Gradient Factors in plot when showing
calculated ceilings") incorrectly modified the gc which caused the mouse
position no longer correctly being correlated to the time on the plot.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:55:37 +11:00
Dirk Hohndel
36b34bd5a5 Merge branch 'integrate-from-webservice'
Bring in the better implementation of merging gps locations from the
webservice
2013-01-31 14:44:14 +11:00
Dirk Hohndel
aef211030d Hide the error output from pkg_config if you don't have osm-gps-map
This became very obvious after commit df6a9ddd8a21 ("Auto-generate C file
dependencies, and make the build more quiet") went in; since not having
osm-gps-map is one of the few errors that aren't fatal for building it
seemed worth quieting this down.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:41:02 +11:00
Linus Torvalds
054abbaea2 Auto-generate C file dependencies, and make the build more quiet
This does some rough auto-generation of header file dependencies for all
the *.c files, rather than our file-by-file incomplete hardcoded ones.

It also stops showing the whole compile line, because it's ugly and
distracting.  Instead it just shows "CC file.c".  If you care about the
full thing, you still see them with "make -n".

Only tested on Linux.  It probably is missing some Windows or
OSX-specific header includes.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:35:41 +11:00
Carl Worth
b6c6586061 README: Update names of Debian packages for dependencies
Use libglib2.0-dev instead of glib-2.0 and add both libssl-dev and
libsoup2.4-dev.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:33:13 +11:00
Dirk Hohndel
635c28923d Better algorithm to merge gps locations & locations names from webservice
This no longer abuses the dive merging code (which would leave stray
"dives" behind if a gps fix couldn't be merged with any of the dives) and
instead parses the gps fixes into a second table and then walks that table
and tries to find matching dives.

The code tries to be reasonably smart about this. If we have
auto-generated GPS fixes at regular intervals, we look for a fix that is
during a dive (that's likely when the boat where the phone is staying dry
is more or less above the diver having fun). And if we have named entries
(so the user typed in a location name) we try to match them in order to
the dives that happened "that day" (where "that day" is about 6h before
and after the timestamp of the gps fix).

This commit also renames dive_has_location() to dive_has_gps_location() as
the difference between if(!dive->location) and if(dives_has_location) is a
bit too subtle...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:29:02 +11:00
Dirk Hohndel
8843ee6156 Allow using two different tables to hold dives and gps locations
This only changes the infrastructure and actually loses functionality as
it no longer does the simplistic "just treat the locations as dives and
merge them".

The new code that does something "smart" with the gps_location_table is
yet to be written. But now we can use the XML parser to put the gps
locations downloaded from the webservice into their own data structure.

In the process I noticed that we never used the two delete functions in
parse-xml.c and removed them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 12:01:03 +11:00
Linus Torvalds
1702eb3ab0 Add the begin/end markers to events with the proper flags
When we create the event names, the name itself does not include the
information about whether the event is the beginning or end of some
state, so we end up having things like events named "deco" and then in
the event flags it says whether this is the *beginning* of deco, or the
end.

And when we show the event, we only used to show the name.  This patch
makes us show whether it's the begin or end event for events that have
those flags.  So now you see "deco begin" and "deco end" instead of just
two events both called "deco".

It would perhaps be nice if we somehow showed the range between the
events too, and paired them up visually some way, but that's a separate
and much more difficult thing to do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 11:11:30 +11:00
Linus Torvalds
9099972c20 Make 'get_dive_by_diveid()' work even for non-primary dive computers
It's only used by the Uemis importer, and Dirk always seems to import
his Uemis data first, so it wasn't very noticeable.  But if the Uemis
data wasn't the first dive computer, it would not find the dive.

Side note: just comparing deviceid is not correct.  We should pass in
the device model too.  But again, that will realistically never really
matter, since non-Uemis importers will generate complex SHA1 hashes of
the dive data for the dive ID, so a collision with the Uemis numbers is
very unlikely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 14:38:07 +11:00
Linus Torvalds
7024930530 Properly destroy the cairo context when we're done with it
Henrik reports that on OSX, not destroying the cairo context results in
a corrupted profile display.  It seems to just leak memory on Linux.

For gtk3, the cairo context is embedded in the GtkDrawable, for gtk2 we
need to create and destroy it appropriately.  Although maybe we could
just make it static instead of creating/destroying it all the time.

Anyway, this goes back to the old cairo destroy logic for gtk2.

Reported-and-analyzed-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 12:07:13 +11:00
Pierre-Yves Chibon
410c439aef Enable to key 'Esc' to close the map view
This commit makes the behavior consistent between the map window and the yearly
statistics window. Both can now be closed by just pressing the 'Esc' key.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 12:07:13 +11:00
Henrik Brautaset Aronsen
0fb1fe8c6e Fix segfault pressing Menu key
Pierre wrote: "On my keyboard I have a key on the right side
of the space bar, between the alt+gr key and the right ctrl
which most of the time emulates the right mouse click.
If I press this button on subsurface, I end up with:

   Segmentation fault (core dumped)

This whatever the selection and nicely always reproducible."

This patch doesn't make the key work, but it fixes the segfault.

Reported-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Debugged-and-acked-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 12:07:13 +11:00
Henrik Brautaset Aronsen
9b47dc1f59 Make sure imported rating and visibility are within limits.
The "visibility" value in MacDive XML files could be a random
string, while it's a value of 0-5 in Subsurface.  Importing an
illegal value (such as "11m") resulted in a segfault from
libpangocairo and an "Invalid UTF-8 string passed to
pango_layout_set_text()".

[Dirk Hohndel: fixed int * vs. int issue]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 12:06:33 +11:00