summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-03-13First simplistic implementation of a divelogs.de uploadGravatar Dirk Hohndel
This has no user interface and hardcodes a testing username / password. But it can successfully create a DLD file (thanks to Miika and Lubomir) and then uses libsoup to upload that to the server. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-13Hook up color printing with print dialog.Gravatar Amit Chaudhuri
- Add a button and callback to the print dialog to let the user select color printing. - Add a state variable to the options struct to track the users choice. - Use a darker color for the grid on dive plot; that way we can see it. - Default to use color printing. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-12DLD upload: Avoid using open_memstream() and non-portable functionsGravatar Lubomir I. Ivanov
patch contains: - replacement for open_memstream() - storage of the temporary zip file in the OS temporary directory - replacement usage of mktemp() with g_mkstemp() patch based on work by Miika Turkia. [Dirk Hohndel: as suggested by Miika I commented out the deletion of the DLD file] Acked-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-12Fix the build under Kfreebsd & HURD.Gravatar Sylvestre Ledru
Ensure that Kfreebsd and HURD are recognized as "like Linux" Signed-off-by: Sylvestre Ledru <sylvestre@debian.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Fix XSLT when no weight system is givenGravatar Miika Turkia
Summing up weights ended only when there was one parameter left. With no parameters we ended up in an infinite loop. Now we end also in case of no parameters. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10.DLD generation for uploading to divelogs.deGravatar Miika Turkia
This generates a .DLD file of selected dives to be uploaded to divelogs.de. The actual upload functionality along with sensible user interface is still to be implemented. However, the resulting file from this patch is tested to work (as far as I can tell) using upload API of divelogs.de. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Convert Subsurface XML to divelogs.de formatGravatar Miika Turkia
The resulting divelogs.de formatted XML is then to be zipped and uploaded to divelogs.de website. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Table print: Ignore a dive instead of breaking the dive loopGravatar Lubomir I. Ivanov
draw_table(): When get_dive_for_printing() returns NULL, instead of breaking, we should 'continue' trough the entire loop. Otherwise the paginate() handler will be called dive_table.nr times, until it returns TRUE. Fixes a bug where, for example one selected dive can end up allocating dive_table.nr pages for printing. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Table print: Add an extra line bellow the table headerGravatar Lubomir I. Ivanov
In 'table print' for some launguages the table header titles can span on two lines and the text on the second line ends up overlapping with the table border. With this patch two lines are reserved for the table header instead of one. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Table print: Only show a table header when not 'paginating'Gravatar Lubomir I. Ivanov
Strangely on Linux everything looks fine, but Windows shows the header two times on the first page, which is due to the pango_cairo_show_layout() function being called both for the 'paginating' and 'regular' stages in show_table_header(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10Info dialog: print coordinates using an ASCII 'dtoa' type of methodGravatar Lubomir I. Ivanov
dac29e7bc4 introduced changes to how the GPS coordinate string is parsed; we now prefer to parse decimal numbers using the '.' character. This patch makes modifications to info.c:print_gps_coordinates(), where we are still using a locale dependent method for converting a double to string - snprintf(). Instead, we attempt to use GLib's g_ascii_formatd(), and store the resulted strings into two buffers named 'dbuf_lat' and 'dbuf_lon'. We then pass the buffers to the final snprintf() formatting with '%s'. 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-03-09Bring back support for GTK versions pre 2.24Gravatar Lubomir I. Ivanov
The introduction of GtkComboBoxText usage for selecting a map provider, removed support for older versions of GTK on distros like Debian 6.0.4. Parent class (GtkComboBox) methods have to be used instead, around more pre-processor branching. This patch also fixes a small memory leak when retrieving text from said combo box. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Use information from proper table on DM4 importGravatar Miika Turkia
Seems that DM4 has useless cylinder size data on global level and real data on DiveMixture table. So using the correct data instead of the global un-used value. Similarly the DiveMixture table contains cylinder pressures. However, it appears this information is available on DiveMixture table only in some cases. So we use start and end pressures from DM table if available, otherwise we use the global pressures. (My guess is that the DM table has the pressure info only when the pressure has dropped from the initial pressure reading that is reported in Dive table before the dive is considered to have started.) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Sanity check on temperature valuesGravatar Dirk Hohndel
The range is still very wide (as we get both air and water temperatures), but it will at least eliminate some completely bogus outliers. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Identify converted files as importedGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Don't strdup(NULL)Gravatar Dirk Hohndel
merge_text() could call strdup(NULL) if one pointer was "" and the other NULL. This commit fixes that. Reported-by: fhuberts Analyzed-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Never use localized floating point numbersGravatar Dirk Hohndel
The GPS entry incorrectly used strtod Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Warn about commas in floating point valuesGravatar Linus Torvalds
Localization could be causing floating point numbers to have a comma instead of a decimal point (in a file format that is really stupid). If we detect this we replace the comma with a decimal point instead, and try to re-parse the number, and see if we get further. The downside of that is that we're changing the buffer we get passed in. Nobody cares, but still, it's kind of ugly. It's simple, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Reorganise view menus and file import.Gravatar Amit Chaudhuri
Move the view submenu to a top level location. Alter the wording of File|Import to drop XML qualifier; we import more formats than this. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07Fix potentially broken white space truncation on certain Windows versionsGravatar Lubomir I. Ivanov
Testing the Planner in Subsurface on a Windows XP SP3 installation, shows corrupted UTF-8 strings in the case of Cyrillic locales, but possibly others as well. Instead limited to the Planner, this affects the entire application. After some examination it appears that <ctype>'s isspace() in MSVC on the tested version of Windows is broken for some UTF-8 characters, after enabling the user locale using: setlocale(LC_ALL, ""); For example, characters such as the Cyrillic capital "BE" are defined as: 0xD091, where isspace() for the first byte returns 0x08, which is the bytemask for C1_SPACE and the character is treated as space. After a byte is treated as space, it is usually discarded from a UTF-8 character/string, where if only one byte left, corrupting the entire string. In Subsurface, usages of string trimming are present in multiple locations, so to make this work try to use GLib's g_ascii_isspace(), which is a locale agnostic version of isspace(). Affected versions of Windows could be everything up to XP SP3, but not apparently Vista. Reported-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-03-07Translate comma to colon on XML importGravatar Miika Turkia
Translate decimal commas on XML import to decimal points. (As detected from available sample files using Linus' debug printing.) Also check for empty values on MacDive temperature import. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07DM4 import user documentation updateGravatar Miika Turkia
Instructions how to find the effective database file from DM4, using this method there is no need to rename the backup as the original file works as is when found from a random directory structure. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07DM4 import pressure detection fixGravatar Miika Turkia
Seems that the database can contain either null or empty string when there is no pressure data available. Changing the pressureblob validation to reflect this new information. Since the temperature profile is binary data, we most likely should accept 0 as a valid value. My samples have null in this blob if there is no data so it seems to be different than the pressure blob. But of course there are no guarantees... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07Test if .bak file is supported database dive logGravatar Miika Turkia
Even though the documentation states to rename DM4 backup to .db file extension, accept the default .bak extension as well. This, however, does not enable the .bak extension in file selection dialog (so .bak files must be given as command line parameters). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07Fix import when locale set to decimal commaGravatar Miika Turkia
This should take care of locale caused problems when the input uses decimal point but locale uses decimal comma. Also the sample I have of Suunto DM3 format weight is represented with comma instead of dot so converting that as well. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07More events from Suunto DM4 addedGravatar Miika Turkia
I got a few more events from a new sample database. Bookmark heading is now shown if such information is stored. Also the unknown events display the event number for easier identification. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05windows.c: Use a zeroed buffer when retrieving the module pathGravatar Lubomir I. Ivanov
There is a small API note on GetModuleFileName(), which says: "Windows XP: The string is truncated to nSize characters and is not null-terminated." Which means that on XP it will be only safe if we pass a zeroed buffer to it, otherwise the next call to wcsrchr (which is a strchr for wchar_t) may not find a relative terminating \0 in the buffer, returning a wrong pointer and resulting in a corrupted string. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05Remove ancient (and unwanted) Debian packaging directoryGravatar Dirk Hohndel
The Debian maintainers prefer this to be separate from the upstream sources Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05windows.c: Change the current process path to the module pathGravatar Lubomir I. Ivanov
When an executable is started on Windows, it has a "Working directory". This directory for a program shortcut stored on the Desktop can be different than the actual executable directory. This also applies if a shell extension is registered to that executable (in the case of Subsurface that could be a .DLD file). When another process simply "executes" a file with a certain extension (e.g. when you double click on a .DLD file), a method ShellExecute is called, which without explicit parameters sets the "Working directory" to the .DLD file directory. This can be a bit of a trouble if the executed module depends on relative paths (e.g. ./xslt, ./share). To solve that we obtain our module full path and filename using GetModuleFileName(), strip the filename from it (e.g. subsurface.exe) and then pass the resulted string to SetCurrentDirectory(), which updates the "Working directory". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05Suunto DM4 sample diveGravatar Miika Turkia
Both in .db and exported XMK format. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05Add .jlb and .udcf as supported file typesGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05Trivial change to documentationGravatar Amit Chaudhuri
The user-manual.txt file limits its own scope to usage and points to a non-existant "build manual." Make clear that we really mean the README file. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Limited support for Suunto DM4 importGravatar Miika Turkia
Basic functionality is implemented but at least support for multiple cylinders is missing. Event/alarm support is only partial. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Some Small Documentation ChangesGravatar chrislewis915@gmail.com
- Made a few small changes to user-manual.txt to inprove readability in English - Made reference to Map Provider selection in 'Preferences' Signed-off-by: chris <chrislewis915@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Update Russian translationGravatar Sergey Starosek
Updated for version 3.0.2 (unfortunatelly not in time) Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Fix the permission of the ICONFILE and the locale filesGravatar Sylvestre Ledru
Lintian, the Debian package static analyzer, was complaining about the "wrong" permissions on these files. Signed-off-by: Sylvestre Ledru <sylvestre@debian.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Improve pane position saving codev3.0.2Gravatar Robert C. Helling
We should test for being in PANE_THREE mode in save_pane_position() and replace the if()'s testing against window geometry. This eliminates some code duplication and, more importantly, save_pane_position() is also called from save_window_geometry() whose calling pattern is not obvious. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Update README, ReleaseNotes and Makefile for 3.0.2Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Saving individual dives should not change the exiting filenameGravatar Dirk Hohndel
The current data file is not the same as the file to which individual dives were saved. Reported-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Fix scaling problem in scrolled edit dialogGravatar Dirk Hohndel
With this change resizing the dive edit dialog once again has its content resize as well. So now we have the best of both worlds: if the content grows we add scroll bars (so things stay usable on small screens), yet when we resize the window, the notes area gets nice and big (which is great on big screens). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Only store pane positions if we currently display "View Three"Gravatar Dirk Hohndel
We tried to detect this without needing a global variable but that clearly was too dependent on decorations that the window manager might add. This code works reliably. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Try to capture some more potential buffer overflows caused by localizationGravatar Dirk Hohndel
A couple of these could clearly cause a crash just like the one fixed by commit 00865f5a1e1a ("equipment.c: Fix potential buffer overflow in size_data_funct()"). One would append user input to fixed length buffer without checking. We were hardcoding the (correct) max path length in macos.c - replaced by the actual OS constant. But the vast majority are just extremely generous guesses how long localized strings could possibly be. Yes, this commit is likely leaning towards overkill. But we have now been bitten by buffer overflow crashes twice that were caused by localization, so I tried to go through all of the code and identify every possible buffer that could be affected by this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Extending user manualGravatar Jan Schubert
Adding UDDF support for DR5, kenozooid and in general, fixed some things, updated to 3.0.2 Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03equipment.c: Fix potential buffer overflow in size_data_funct()Gravatar Lubomir I. Ivanov
strcpy() with buffer[10], could overflow on most languages. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Fix pane position bugGravatar Robert C. Helling
Argh. Maxint is not at the bottom or at the right. We have to check against the size of the window to determine we are not saving a maximized position. Here is a fix. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Fix ESC key handling in Save dialog.Gravatar Sergey Starosek
Closing unsaved dive raises Save dialog with Yes/No/Cancel buttons. Pressing ESC dismisses dialog without saving changes. This commit adds GTK_RESPONSE_DELETE_EVENT response code check in order to fix that behavior. Reported-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Don't duplicate gpsfixes if downloading them multiple timesGravatar Dirk Hohndel
Simply clear out the table (and free the "dives" that were created). Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Recognize another name for auto created fixes from companion appGravatar Dirk Hohndel
We need to have this be one well defined string -> this requires a change to the companion app as well. This commit also hides the (untranslated) debug message if no dives in the dive table match a gpsfix downloaded from the webservice. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Webservice: only mark divelist changed if we actually modified itGravatar Dirk Hohndel
If no new gps fixes or new location names were obtained from the webservice there is no need to save the datafile on exit. Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Save window pane positionsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>