aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-04-08Separate Gtk related code from core logic: plannerGravatar Dirk Hohndel
Relatively straight forward, just a handful of places where we call show_error() (a UI function) from the logic code. In the process I noticed a few places where error returns weren't dealt with correctly. Added a new planner.h files for the necessary declarations. This should make no difference to functionality. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07Fix some of the gcc-4.8 warningsGravatar Dirk Hohndel
Most of the warnings are IMHO false positives: e.g.: an enum variable is initialized in a switch statement that has a case for each possible enum value - yet gcc 4.8 warns that it could be used uninitialized; or: two variables are initialized together in the code - second one of them is previously initialized to -1 at declaration time, both are initialized in an if (second one == -1) clause - so they are guaranteed to both be initialized... I did not "fix" those as the code is actually correct. But there are three spots where it catches things that could indeed go wrong (with odd input data in one of them). This commit also adds a check to only call g_type_init() for older versions of glib as in newer ones it is deprecated. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07Merge branch 'cleanup-from-Qt-branch' of github.com:henrik242/subsurfaceGravatar Dirk Hohndel
2013-04-07Continue to separate Gtk related code from core logic: divelistGravatar Dirk Hohndel
Move some more logic out of the divelist-gtk.c file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07Separate Gtk related code from core logic: divelistGravatar Dirk Hohndel
This is simplistic & brute force: any function that touches Gtk related data structures is moved to divelist-gtk.c, everything else stays in divelist.c. Header files have been adjusted so that this still compiles and appears to work. More thought is needed to truly abstract this out, but this seems to be a good point to commit this change. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07Move set_filename() calls outside of parse_file()Gravatar Alberto Mardegan
Remove the boolean parameter from parse_file; the code is more readable by having an explicit call to set_filename() where necessary, rather than a boolean parameter. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-04-03Windows installer needs libsqliteGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-02planning: Add option to have last stop at 6m/20ftGravatar Anton Lundin
When diving in areas where there are risk of boats passing above you, its common practise to do the last stop at 6m to better stay out of harms way. When doing o2-deco, it doesn't matter for the deco time if you are doing all the time at 6m, due to that you don't have any inert gas in your breathing gas. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28Fix cylinder pressure interpolationGravatar Linus Torvalds
The pressure interpolation code mostly worked for the simple cases, but got terminally confused for some more complex gas change situations, resulting in nonsensical interpolations. This simplifies and clarifies the code a bit, and in the process fixes a few special cases where the gas interpolation segments didn't end up having the end conditions set. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28Use the new get_o2()/get_he() helper functions more widelyGravatar Linus Torvalds
They do the "02=0 means air" thing autmatically, and make for less typing. So use them more widely in places that looked up the o2 and he permille values of a gasmix. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28Fix get_cylinder_index() gasmix comparisonsGravatar Linus Torvalds
get_cylinder_index() looks up which cylinder to use based on the gaschange event that describes the mix. However, it was both buggy and not very good. It was buggy because it didn't understand about our air rules, and it was not very good because it required an exact match (after rounding our permille-based numbers to percent). So fix it to use the right permille values, and look for a closest match (using the normal sum-of-squares distance function - although I wonder if we should consider helium percentages to be "more important" and give them a stronger weight). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28When merging dives, match up the cylinders to each other using gasmixGravatar Linus Torvalds
.. so that different computers that have different ordering of the same cylinders will see the end result the same way. This also fixes up the sample sensor index and generates special initial tank change events for the dive computers that had their cylinder indexes renamed on them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Make relative times default in planner 2Gravatar Robert C. Helling
In planning you usually plan lengths of segments rather than runtimes to leave a level. This patch superseeds a previous one with a similar name and (even more) broken spacing. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26gtk-gui.c: Some small whitespace indentation fixesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Store the main window maximized state in the configurationGravatar Lubomir I. Ivanov
In save_window_geometry() use gdk_window_get_state() to retrieve the window maximized state and store it in the user configuration. Then in restore_window_geometry() restore the maximized state with gtk_window_maximize(), if needed. To achieve good results we also need to override "window-state-event" for the main window and define an extra couple of configuration parameters: "vpane_position_maximized" and "hpane_position_maximized". Then store two different pane states for maximized and restored window each time the user makes a switch. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Check if DLD contains non-ascii charactersGravatar Miika Turkia
Valid divelogs.de export might contain non-ascii characters in CDATA fields as long as these characters are found in iso-8859-1. So we'll have to test to make sure the content is fully ascii before calling xmlStringLenDecodeEntities to decode possible character references. Acked-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26B/W Print: Make sure that all colors are monochromeGravatar Lubomir I. Ivanov
Some colors such as the ones for ceiling were still green on B/W print. This patch makes all colors in the second row of profile.c:profile_color monochrome. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Fix end pressure on DLD exportGravatar Miika Turkia
While working on UDDF export I noticed that the grabbing of last sample pressure was not working properly. This will fix it for DLD export. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Fix pressures on UDDF exportGravatar Miika Turkia
Examples on UDDF specification indicate that pressures are reported in Pascal. Also prefer the sample data from first dive computer for start and end tank pressures. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Gases and events support for UDDF exportGravatar Miika Turkia
This patch generates a gases section on UDDF export. The section consists of all the unique gas mixes sawn on the dive log. The latter part includes events to the export. Gas change and heading events are properly translated to respective UDDF naming. Other events are copied over as is. Some of the events are the same (ascent, deco, rbt, surface) in UDDF some are not available. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Print dialog: Fix inaccessible controls on WindowsGravatar Lubomir I. Ivanov
The window which holds the custom print options tab appears to have unchangeable dimensions on Windows OS (unless hacked in some way). This makes the sliders in the custom tab not accessible unless we add the entire dialog into a GtkScrolledWindow and return that for the "create-custom-widget" event. The patch also makes the contents of the "Layout Options" frame packed vertically (with a GtkVBox) instead of horizontally, so that the entire tab contents are "mostly" scrollable vertically instead of horizontally. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Color print: Show SAC lines in a color different from whiteGravatar Lubomir I. Ivanov
Also make the profile border color the same as the depth grid color. Fixes #97 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-25Add macros for text sizesGravatar Dirk Hohndel
This replaces the hardcoded sizes all over the sources. Make the size in the text_render_options_t a double - With this you can compile Subsurface with make CLCFLAGS=-DTEXT_SCALE=1.5 and the fonts in the profile are 50% bigger. Very nice on a high-pixel density display. Also remove the unused text_render_options for event text. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-24Export dives to UDDF fileGravatar Miika Turkia
This patch implements exporting dives from Subsurface to UDDF format. Events and cylinder info are the most remarkable things still missing from the export. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-20Print_c Make colorButton remember last state during sessionGravatar Salvador Cuñat
While colorButton defaults to "color" in first access to print menu, it seems preferable to keep the last state selected by the user. At least until exit session. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-20divelist.c: Fix an 'implicit declaration' warningGravatar Lubomir I. Ivanov
close() should be included from unistd.h, instead of fcntl.h for better portability. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Fix error while translating base of height calculation in print functionGravatar Salvador Cuñat
92.5 is wrong the correct divisor is its inverse number 108.1 Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Rescale print layout sizes to add to 100%Gravatar Dirk Hohndel
While it makes sense for the program to have a 7.5% fixed header, from a user perspectice this is just odd. So instead we now have the notes, profile and tank data sizes add up to 100% and scale the information when it is combined with the header. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Make slider labels consistent in print dialogGravatar Dirk Hohndel
To make this easier I created a new helper function create_label that takes printf style arguments. I assumed this would be usable in many places but ended up finding just one other obvious use for it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Added support for UDDf version 3.1Gravatar Miika Turkia
This adds support for UDDF version 3.1 as produced by at least DiversDiary. Basically we have to include the different name space into our selections. This patch also checks if the temperature is zero on all samples and skips temperature readings if it looks like the dive computer does not record them. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Add an insensitive scale for tracking the notes heightGravatar Salvador Cuñat
We can trim the printout with only profile and tanks sliders, so add an insensitive scale for notes which report the percentage that it's is getting while changing the others, for informative purposes. Initialize default values for print_options struct. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Fix warning on g_signal_connect() for radio4Gravatar Salvador Cuñat
Gtk complains if there is no GCallback to connect. Fixes too a bug with gtk_toggle_button_set_active for radio5. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Add user definible options to the print menu - slider versionGravatar Salvador Cuñat
Define a new frame wich will englobe the layout options. 1.- Move to this frame the color profile printing by Amit 2.- Add an option which switches the position of the profile and a predefined block comprensive of header, tanks data and notes. - Divide print() in two macros PROFILE_BLOCK and NOTES_BLOCK - Add a gboolean to print_options. If unselected (default) we get the actual disposition. If selected, switches blocks. 3.- Add two buttons with labels to set the height of the profile, and tanks. We select the percentage of layout occupied by each option, reserving 7% for the header (non adjustable), and assign the rest to notes. - Values in % have got hardcoded min/max (e.g. being the profile a major feature of subsurface, would be meaningless make it < 37%) - The values are initialised to the actual ones, so leaving them untouched defaults to the old printout. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Manually remove events in the profile context menuGravatar Dirk Hohndel
As logical extension of the ability to add bookmarks and gas changes this adds the ability to remove (any arbitrary) event that happens at the mouse position (specifically, that is within +/- six (scaled) pixels around the x-position (time) of the mouse). That's the same width that the triangle marker occupies which was moved to be centered around the event time in commit 5752e9742e86 ("Finetune event triangle position to have the top point at the event time"). Fixes #60 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Finetune event triangle position to have the top point at the event timeGravatar Dirk Hohndel
This should make it easier to then delete events from the context menu. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Manually add bookmarks in the profile context menuGravatar Robert C. Helling
Use the infrastructure created for manually adding gas change events to also be able to add bookmarks. [Dirk Hohndel: This combines two commits for clarity. I also cleaned up the indentation and changed the code to no longer print the exact same text twice.] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Generate heading event on DM4 importGravatar Miika Turkia
Previously the heading information was on bookmark event, but now we trigger a heading event when direction info is available. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Correctly handle first gas when deciding if gas is usedGravatar Robert C. Helling
Gas with index 0 is assumed to be the first gas only if there is no gaschage event in the first 30 seconds of the dive. [Dirk Hohndel: minor formatting change in a logical expression] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Take only used gases into account when showing gas in divelistGravatar Robert C. Helling
Here is a patch that restricts the gases listed in the divelist to those that are actually used. I seem to have the indentation now under control but I am not sure about the logic: 1) First gas (with index 0) is always used. 2) If there is a gas switch event, the new gas is also used (determined by walking the list of dive computers and then the list of events). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17Manually add gas changes to a diveGravatar Dirk Hohndel
Create a little widget that lists all the gases / tanks we know about and allow the user to pick one of them. Turns out that add_event only added events at the end of the list - but we treat that list as chronologically sorted. So I fixed that little mis-feature as well. This does raise the question whether we need the inverse operation (removing a gas change). And if there are other things that we should be able to manually edit, now that we have the infrastructure for this neat little context menu... See #60 -- this doesn't address all of the issues mentioned there, but at least deals with the 'headline' of the feature request... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17First step towards a context menu in the profile viewGravatar Dirk Hohndel
This is completely bogus as all it does is print out the corresponding time for the spot we right-clicked on the profile. But that at least shows that the infrastructure is working as intended... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17Terminate decode at end of string and fix mem leakGravatar Miika Turkia
Seems that we have to NULL terminate the buffer for xmlStringLenDecodeEntitites() as otherwise we might end up having extra data at the end of returned buffer. (Somehow the length parameter is not respected always, even if it is the proper size returned by the zip_fread() - header_skip). Also free the buffer returned by xmlStringLenDecodeEntitites(). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-16Only print separator when really needed on importGravatar Miika Turkia
The separator was printed if SITE had data, even if LOCATION was empty. Now print the separator only if both of these contain data. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-15Use a generic 64bit int typeGravatar Dirk Hohndel
The zip_int64_t type appears to be missing with mingw so it breaks my cross builds - and this is clearly equivalent. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-15Support divelogs.de exports that include Cyrillic charactersGravatar Miika Turkia
divelogs.de sends us XML files that explicitly state that they are in ISO-8859-1 encoding (which is true). These files contain the HTML encoded Cyrillic characters. Once we decode those characters the resulting file is actually UTF-8 encoded (which is a superset of ISO-8859-1). That seriously confuses libxml when it tries to parse things. So instead recognize divelogs.de files and skip the encoding declaration for them before decoding the HTML encoded non-ISO-8859-1 characters. This does show, however, that divelogs.de incorrectly truncates the encoded strings (at least in some sample data that I created the parsing throws errors because of that). Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Based-on-code-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14Correct ending pressure for .DLD exportGravatar Miika Turkia
We grab the pressure information from samples, if available. Otherwise, we use information from first cylinder. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14Fix bug in colour print initialisation.Gravatar Amit Chaudhuri
The callback function for switching colour printing on/off was registered after the initial activation of the button. This meant the first attempt to print was compromised. We move the registration so that printing works as the user specifies from the first attempt. Tested by printing both B/W and colour images to file with minimal mouse clicks. Spotted by Salva - thanks. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14Fix free form text fields on .DLD uploadGravatar Miika Turkia
We need to have CDATA around text fields to support e.g. Cyrillic alphabet. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14Revert "Only include .po files that has a companion .aliases file"Gravatar Henrik Brautaset Aronsen
Commit 6044c22741 wrongly assumed that a disabled .po file had a companion .disabled file instead of an .aliases file. Running make after "tx pull -af" generated errors which I tried to fix. I shouldn't have, because the Makefile did the right thing. It warned about a missing .aliases file for a brand new translation. So, I'm reverting the commit and use "tx pull -f" instead the next time I need to test existing translations. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-13Only include .po files that has a companion .aliases fileGravatar Henrik Brautaset Aronsen
Disabled translations have a .disabled file instead of an .aliases file. Without this patch I couldn't make subsurface after a tx pull (when testing translations). This patch makes the .aliases file an explicit requirement for a valid translation. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>