summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-01-23Ensure each dive has its own copy of the location text (UEMIS importer)Gravatar Dirk Hohndel
Since multiple dives can reference the same divesite we need to do the strdup when the value gets assigned, not when it gets passed into the helper function. This also validates the location string as on my divecomputer there is an invalid divespot 0 that has a corrupted UTF8 string as location name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23divelist.c:icon_click_cb(): check if a GtkTreePath is foundGravatar Lubomir I. Ivanov
In icon_click_cb() we need to check if a correct GtkTreePath is found (using gtk_tree_view_get_path_at_pos()) before requesting a GtkTreeIter for it. Without this patch a bug is reproducible, where the user may click outside of the GtkTreeView entries, but still in the GtkTreeView - e.g. when only one entry is available. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Fix crash when applying a non-edit of nicknamesGravatar Amit Chaudhuri
As reported by Henrik, there was a crash lurking in edit_dc_nickname code. Invoking the dialog and selecting apply without changes exposed it neatly. This is a one line fix. Signed off by Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Use proper helper functions for dive location and for_each_diveGravatar Linus Torvalds
This makes the code use the "dive_has_location()" function rather than check the longitude and latitude directly. It also uses "for_each_dive()" rather than open-coding it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Satellite icon dietGravatar Linus Torvalds
[Dirk Hohndel: converted to png and .h] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Fix crash when clicking on icon column in trip header entriesGravatar Dirk Hohndel
Silly oversight. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22libdivecomputer: add air temperature fixups for SuuntoGravatar Linus Torvalds
libdivecomputer doesn't actually seem to support air temperature reporting at all, but at least for Suunto dive computers the air temperature is recorded as the temperature for the first sample. So since we already have vendor-specific libdivecomputer hacks, let's just add that one as a rule. It may be that other divecomputers do this too, so this adds it as a generic concept - it's just that right now the flag for "air temperature in first sample" is only set for Suunto dive computers. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Improve on the "prefer downloaded" dive computer modelGravatar Linus Torvalds
It used to be that when you checked the "Prefer downloaded" checkmark, we'd throw away *any* old dive computer data. That was good, because it allowed us to start from a clean slate when you had some old subsurface data with questionable dive computer data. However, it was a bit extreme, and it's really not what you want if you already have (good) dive computer data from other dive computers. So this modifies the logic a bit. Instead of throwing away all old dive computer data, the "Prefer downloaded" checkmark now means: - the newly downloaded data becomes the "primary" dive computer data (ie the first in the list) - if there was old dive computer data that *could* have been from this new dive computer (ie it didn't have model information, or it had a matching model but no device ID data), we throw that away - but any existing dive computer data from other dive computers is left. This seems to be much closer to what we really would want for a new "preferred" download. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Fix suunto serial number confusion in libdivecomputerGravatar Linus Torvalds
libdivecomputer has started giving the Suunto serial numbers in a different format, which means that we have the same device with two different serial numbers, and then we need two different ways of turning the numerical entity into a string. Look at the number pattern to see figure out which version of the format it is that libdivecomputer is reporting, and turn it back into the original format so that we can reliably give the right string for it. This also mean sthat the device ID stays the same regardless of libdivecomputer version. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Add GPS icon to the location column for dive sites where we have GPS dataGravatar Dirk Hohndel
This replaces the really lame "italics text" from commit abe810ca1a29 ("Mark locations that have GPS location data attached") with a marginally less lame GPS icon.There's a reason why I am not making a living as graphics artist. But I think this is a huge step forward from what we had before... The satellite.svg file is very loosely based on a different icon that I found as public domain here http://www.clker.com/clipart-30400.html. From that I created the PNG and then that was converted into the GdkPixdata via gdk-pixbuf-csource; a rule for that was added to the Makefile but commented out as I don't know if this tool will always be available in the path. Having this icon included in the sources avoids locating yet another icon file. Better icons are certainly welcome! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-21Add libsoup and osm-gps-map to Mac build instructions.Gravatar Henrik Brautaset Aronsen
Also force py27-pygtk to use the quartz variant, since MacPorts doesn't have variant dependency resolutions. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20White space and coding style adjustments for gps.cGravatar Dirk Hohndel
It's just nicer this way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Fix map scrollingGravatar Dirk Hohndel
The osm-gps-map default is to scroll-and-recenter around the mouse position. That is BAT SHIT CRAZY. So this implements our own scroll handling instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Mark locations that have GPS location data attachedGravatar Dirk Hohndel
This is rather lame - we simply turn the location text into italics for those dives where we have GPS location data. Underlining might be more natural, but Gtk plays games with the underline attribute if the mouse hovers over text. Ideally I would have prefered a little GPS logo next to the location text - but I couldn't figure out how to do that without writing my own cell renderer which seemed total overkill. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Reuse map windowsGravatar Dirk Hohndel
Instead of opening a new window / new map for every dive site we now have only two windows / maps. One for the overview of all the dive sites, the other one that is used to show the map for a specific dive site. This also switches the position preference from CENTER to MOUSE - this way it's less likely that the two map windows will be drawn exactly on top of each other. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-19Add modules file for building prerequisites on MacOS XGravatar Dirk Hohndel
This should allow the user to build osm-gps-map with jhbuild (all other required components are already build by the jhbuild default modules). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-19Add CFLAGS to build rule for webservice.oGravatar Dirk Hohndel
Otherwise it won't compile on MacOS X Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Improve handling for old XML files in Uemis downloaderGravatar Dirk Hohndel
In order to work in the most expected ways for people who have used a version of Subsurface that didn't store the deviceid in the divecomputer we relax the testing for when a divecomputer entry is assumed to match the current divecomputer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Consistently use uint32_t for deviceidGravatar Dirk Hohndel
There were a handful of places that incorrectly used signed values for the deviceid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Fix potential crash with old XML filesGravatar Dirk Hohndel
A file with no divecomputer section in a dive can trigger a SEGV as cur_dc could be NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Add libsoup to Windows installerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Fixed some small issues in webservice.cGravatar Lubomir I. Ivanov
1) download_dialog_status_text() had some statements with no effect due to missing return keywords. This fixes incorrect error reporting. 2) Optimize the traversion of the response XML. Assuming that the status tag should be always under the root tag. We check if the root tag has children and enter a loop until we find a the "download" or "error" node names. If there are no children we return a parser error. 3) Clamp the number of input characters to 30 in the user id GtkEntry field. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Add facility to edit nicknames / remove nickname entryGravatar Amit Chaudhuri
This allows users to edit one or more nick name entries in a single session. Entries can also be removed individually. Based on mock up by Lubomir Ivanov and various conversations from Dirk. Thanks to both. [Dirk Hohndel: quite a bit of editing for coding style and whitespace] Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Updated the Makefile to support libsoup and include webservice.[c|h]Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Added client side communication to the Subsurface Web ServiceGravatar Lubomir I. Ivanov
A couple of new files webservice.c and webservice.h are added. webservice.h exposes two methods at the moment: - webservice_download_dialog(): this function creates the user interface for the download dialog from the web service. - webservice_request_user_xml() this function is a direct call to retrieve XML for a specific user identifier. the actual data, data length and error codes are stored in passed pointers. A menu entry is added in the Log menu: "Download From Web Service" The used backend for communication at the moment is provided by libsoup. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Hack Makefile, gtk-gui.c and divelist.c to allow building w/o osm-gps-mapGravatar Dirk Hohndel
While we are waiting for an autotools generated Makefile, this should allow people to build that don't have osm-gps-map. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Update gtk-osx-integration to version 2 of the APIGravatar Dirk Hohndel
In order to be able to work with Gtk3 introspection all the APIs had to be renamed. Instead of quartz_application... and gtk_osxapplication... all the API functions are now name gtkosx_application... This will break the build for people who haven't upgraded to the latest - but supporting both would be unspeakably ugly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Add GFlow/GFhigh settings in dive plannerGravatar Dirk Hohndel
The planner interactively responds to changes to the GFlow and GFhigh in the dialog and calculates an appropriate profile. If there is a previous dive within the 48 hours prior to this dive then its saturation is correctly taken into account if the gradient factors are changed - so if they are aggressively lowered it is possible to start the dive with already an existing ceiling (simply increase the surface interval to 'fix' that). Once the plan is accepted the GF values are reset to the current preferences. This can cause the ceiling in the plot to change and the deco stops to no longer match the ceiling - but that's a logical consequence of the ability to change a temporary copy of GFlow/GFhigh during the planning process and not the actual preferences (which would be counter intuitive, I think). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Correctly mark divelist changed after accepting dive planGravatar Dirk Hohndel
Commit 293126257b20 ("Mark divelist as changed if user accepts planned dive") had the correct commit message but an incorrect implementation. This moves the mark_divelist_changed() call into the GTK_RESPONSE_ACCEPT clause where it belongs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Update dive flag image.Gravatar Henrik Brautaset Aronsen
The previous flag didn't work on Windows somehow. I guess Photoshop added some headers that GdkPixbuf didn't like. I've reconverted it with ImageMagick, which made the file less than half the size. Bonus! Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Only offer to show dive on map if we have location informationGravatar Linus Torvalds
This adds the "Show in map" menu entry to the divelist only if we actually have a location to show. Of course, having some way to visually see whether we have a GPS location even before we show the menu would probably be good. Maybe a marker in the "location" string or something. But in the meanwhile, at least we don't have that menu entry if we have nothing to show. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Show single dives in map.Gravatar Henrik Brautaset Aronsen
This adds a "Show in map" entry in the dive list context menu. It will zoom to the dive location if it exists, otherwise the full map will be displayed. I've also switched map tiles from OpenStreetMap to Google Maps just to show off that we can. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Clean up null pointer printout in weightsystem descriptionGravatar Salvador Cuñat
If there's no weightsystem description, as in most imported dives, print a literal "unknown" instead of null pointer or blank. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Mark divelist as changed if user accepts planned diveGravatar Dirk Hohndel
When the user clicks OK in the dive planner and the dive is added to the divelist the divelist needs to be marked as changed so Subsurface prompts the user to save the file before quitting. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Calculate the gas used during the planned diveGravatar Dirk Hohndel
This works on the assumption that the diver uses the deco SAC rate while on a calculated deco stop and the bottom SAC rate during the rest of the dive (including the time they move from deco stop to deco stop). This is making the planning function mostly useful for open circuit diving. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Add diveplan to the dive notesGravatar Dirk Hohndel
This makes it easy to print out a dive plan - it's simply stored in the notes of the simulated dive we create. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Add code to enter SAC rates for dive planningGravatar Dirk Hohndel
This just provides the infrastructure to enter the data, nothing is calculated, yet. This adds a new get_thousandths() helper function so we can enter information of the 'mili-' type as decimal values. So things like "14.5 l/min" or "0.75 cuft/min" are parsed correctly and converted into a ml value. In the process of implementing that I also fixed a bug introduced in commit ab7aecf16e96 ("Simplify dive planning code") which broke the get_tenth() function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Add small helper function to make planner gui function easier to readGravatar Dirk Hohndel
This is just preparation for the next set of changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Trivial pressure related fixesGravatar Jan Schubert
This patch removes the need for the "string" pressurebuf in planner.c. It also adds a unit to the partial pressures displayed in the mouse overlay which are always displayed in bar. BTW: Has anyone seen a pO2 shown in PSI? Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Correct the start time of planned divesGravatar Dirk Hohndel
Subsurface follows the lead of most divecomputers to use times without timezone - so all times are implicitly assumed to be local time of the dive location; so in order to give the current time in that way we actually need to add the timezone offset. Instead of relying on OS specific members of struct tm we use the glib timezone functions to get the timezone offset for us. Of course, the function used to do this is only in glib 2.26 or newer, which once again means that Debian stable won't be supported. But since that doesn't build other parts of Subsurface, either, I think I'll live with that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Attempt to override the URI handler in the about dialogGravatar Lubomir I. Ivanov
The previous patch in this series adds the function subsurface_launch_for_uri(), which has to be called from the about dialog instead of the default function for the URI calls to work on Windows - i.e. opening links from the dialog. gtk_about_dialog_set_url_hook() is a deprecated method, but seems to be the only reasonable way to make the override between GTK 2.20 - 2.24 possible. The "activate-link" signal is recomended instead, but is not portable for GTK bellow 2.24. An alternative would be to somehow hack into the GtkAboutDialog and override the callback for each clickable link. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Added the OS dependent function subsurface_launch_for_uri()Gravatar Lubomir I. Ivanov
Opening URI addresses from Subsurface does not work on Windows using the latest GTK bundle from the Gnome website. The reason lies in GIO and GLib and how it obtains assigned applications for protocols and MIME types. While gtk_show_uri() should be viable for both linux.c and macos.c, in windows.c ShellExecute() is used, which provides proper support for the URI calls. subsurface_launch_for_uri() returns TRUE on success. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-14Use the legacy GDK keyboard definitions in gps.cGravatar Lubomir I. Ivanov
display-gtk.h has a check if gdkkeysyms-compat.h or gdkkeysyms.h has to be used. In gps.c, from such as "GDK_Up" has to be used, so that this file compiles on older GTK. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-14Centralising and redefining values as integersGravatar Jan Schubert
This patch centralizes the definition for surface pressure, oxygen in air, (re)defines all such values as plain integers and adapts calculations. It eliminates 11 (!) occurrences of definitions for surface pressure and also a few for oxygen in air. It also rewrites the calculation for EAD, END and EADD using the new definitons, harmonizing it for OC and CC and fixes a bug for EADD OC calculation. And finally it removes the unneeded variable entry_ead in gtk-gui.c. Jan Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-14Fix odd calculated deco "ripples"Gravatar Linus Torvalds
Previously we calculate the ceiling at every single second, using the interpolated depth but then only *save* the ceiling at the points where we have a profile event (the whole deco_allowed_depth() function doesn't change any state, so we can just drop it entirely at points that we aren't going to save) Why is it incorrect? I'll try to walk through my understanding of it, by switching things around a bit. - the whole "minimum tissue tolerance" thing could equally well be rewritten to be about "maximum ceiling". And that's easier to think about (since it's what we actually show), so let's do that. - so turning "min_pressure" into "max_ceiling", doing the whole comparison inside the loop means is that we are calculating the maximum ceiling value for the duration of the last sample. And then instead of visualizing the ceiling AT THE TIME OF MAXIMUM CEILING, we visualize that maximal ceiling value AT THE TIME OF THE SAMPLE. End result: we visualize the ceiling at the wrong time. We visualize what was *a* ceiling somewhere in between that sample and the previous one, but we then assign that value to the time of the sample itself. So it ends up having random odd effects. And that also explains why you only see the effect during the ascent. During the descent, the max ceiling will be at the end of our linearization of the sampling, which is - surprise surprise - the position of the sample itself. So we end up seeing the right ceiling at the right time while descending. So the visualization matches the math. But during desaturation, the maximum ceiling is not at the end of the sample period, it's at the beginning. So the whole "max ceiling" thing has basically turned what should be a smooth graph into something that approaches being a step-wise graph at each sample. Ergo: a ripple. And doing the "max_ceiling during the sample interval" thing may sound like the safe thing to do, but the thing is, that really *is* a false sense of safety. The ceiling value is *not* what we compute. The ceiling value is just a visualization of what we computed. Playing games with it can only make the visualization of the real data worse, not better. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Scroll the divelist to show the planned diveGravatar Dirk Hohndel
Just put the code to do so in a function and reuse that function elsewhere as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Correctly show the planned dive in the divelistGravatar Dirk Hohndel
Previously we would simply show the first dive in the divelist - which worked fine in the default sort by trip setting and assuming that there are no dives from the future in the divelist. With this commit we actually find the correct dive in the divelist and select it instead. If you sort by depth you will see the dive move around in the divelist, but it will stay selected and visible in the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Make sure init_decompression works for dive 0 as wellGravatar Dirk Hohndel
The loop would actually get entered for dive 0 and try to compare things with dive -1. Which of course fails. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13During multi-dive deco calculations don't look at dives from other tripsGravatar Dirk Hohndel
Previously the code in init_decompression() would mindlessly walk back the dive_table until it found a gap of at least 48h and take all those dives into consideration when calculating tissue saturation. This goes horribly wrong if you load dives from two divers into the same data file. With this commit things will still turn out correctly, as long as the dives are in separate trips in for each of the divers. So with this I can load both Linus' and my divelog and things stay sane even on our shared dive trips. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Add support for MOD, EAD, AND and EADD in the mouse over displayGravatar Dirk Hohndel
- MOD: Maximum Operation Depth based on a configurable limit - EAD: Equivalent Air Depth considering N2 and (!) O2 narcotic - END: Equivalent Nitrogen (Narcotic) Depth considering just N2 narcotic (ignoring O2) - EADD: Equivalent Air Density Depth Please note that some people and even diving organisations have opposite definitions for EAD and END. Considering A stands for Air, lets choose the above. And considering N for Nitrogen it also fits in this scheme. This patch moves N2_IN_AIR from deco.c to dive.h as this is already used in several places and might be useful for future use also. It also respecifies N2_IN_AIR to a more correct value of 78,084%, the former one also included all other gases than oxygen appearing in air. If someone needs to use the former value it would be more correct to use 1-O2_IN_AIR instead. Signed-off-by: Jan Schubert / Jan.Schubert@GMX.li Signed-off-by: Dirk Hohndel <dirk@hohndel.org>