aboutsummaryrefslogtreecommitdiffstats
path: root/dive.h
AgeCommit message (Collapse)Author
2012-10-09A file that we import should never become the default file we save toGravatar Dirk Hohndel
Only files that are opened should be considered r/w. Files that are imported should be treated as if they were r/o. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04Provide a method to use unicode command line arguments on WindowsGravatar Lubomir I. Ivanov
For unicode command line characters Windows uses UTF-16, while Glib and GTK use UTF-8. To solve that we retrieve the command line via __wgetmainargs() and use g_utf16_to_utf8() to convert each argument. The used method should support wildcards passed as arguments (e.g. *.xml). Two new, OS abstracted functions appear in linux.c (NOP), macos.c (NOP), windows.c: subsurface_command_line_init(...) subsurface_command_line_exit(...) which are being called in main() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-28Redo the delete dive codeGravatar Dirk Hohndel
The existing code (both my first single dive delete and then Lubomir's multi dive delete code) had way too many issues and was just painfully inefficient. This new code takes a radically different approach and mostly ignores the Gtk tree model (as that gets recreated after a delete, anyway) and instead is linear time on the number of dives in the list. It does do its best to maintain the existing selection and the expand state of tree model (the latter isn't possible if we have switched to the list model). Many thanks to "Lubomir I. Ivanov" <neolit123@gmail.com> for his work on this - this commit actually contains a few lines out of one of the patches that he wrote. Reported-by: "Lubomir I. Ivanov" <neolit123@gmail.com> Tested-by: "Lubomir I. Ivanov" <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-26Merge branch 'uemis-native'Gravatar Dirk Hohndel
This brings in the code to download dive information directly from a Uemis Zurich dive computer. The implementation contains a major hack that hooks the uemis code into the same data structures used to setup libdivecomputer. This gives the best result for the user, but is not something that I like as a long term solution as it relies on internal libdivecomputer data structures.
2012-09-26Add the ability to create a log file for debugging outputGravatar Dirk Hohndel
Especially when asking non-developers for help debugging a problem it can be extremely useful to have debugging output not go to the console but to a log file instead. This just adds the infrastructure to create (and close) such a file. No changes to the debug output are made. All this is of course #ifdef'ed out. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-24Update cylinder info properlyGravatar Linus Torvalds
The "cylinders_equal()/copy_cylinders()" functions were buggered, and only checked (and copied) the cylinder type. That was on purpose, since you do want to be able to change the type of a cylinder without changing the gasmix of the cylinder. HOWEVER, the reverse is also true: you may want to change the gasmix of a cylinder without changing the type. So it's not that the type of the cylinder is special - it's that the type and the gasmix should be considered separately. Do that properly for the equipment editing case. Reported-by: Ďoďo <dodo.sk@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-09-21Fix missing save of (almost empty) cylinder informationGravatar Linus Torvalds
If we have no explicit cylinder info at all (it's normal air, no size or working pressure information, and no beginning/end pressure information), we don't save the cylinders in question because that would be redundant. Such non-saved cylinders may still show up in the equipment list because there may be implicit mention of them elsewhere, notably due to sample data, so not saving them is the right thing to do - there is nothing to save. However, we missed one case: if there were other cylinders that *did* have explicit information in it following such an uninteresting cylinder, we do need to save the cylinder information for the useless case - if only in order to be able to save the non-useless information for subsequent cylinders. This patch does that. Now, if you had an air-filled cylinder with no information as your first cylinder, and a 51% nitrox as your second one, it will save that information as <cylinder /> <cylinder o2='51.0%' /> rather than dropping the cylinder information entirely. This bug has been there for a long time, and was hidden by the fact that normally you'd fill in cylinder descriptions etc after importing new dives. It also used to be that we saved the cylinder beginning/end pressure even if that was generated from the sample data, so if you imported from a air-integrated computer and had samples for that cylinder, we used to save it even though it was technically redundant. We stopped saving redundant air sample information in commit 0089dd8819b7 ("Don't save cylinder start/end pressures unless set by hand"). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Removed start and end in save_cylinder_info(). These two variables are no longer used. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-20Merge branch 'divetrip-rewrite' of git://github.com/torvalds/subsurfaceGravatar Linus Torvalds
Merge the dive trip rewrite by Dirk Hohndel. This just merges the dive trip changes with the timestamp handling changes. There were multiple small data conflicts, along with some newly added 'time_t' cases in the dive trip handling that needed to be converted to 'timestamp_t' along the way. * 'divetrip-rewrite' of git://github.com/torvalds/subsurface: Convert FIND_TRIP into function Partial rewrite of the dive trip code Check if trip is NULL before calling DIVE_TRIP
2012-09-20FIND_TRIP: don't cast a timestamp to a pointerGravatar Linus Torvalds
The pointer size may not be large enough to contain a timestamp, so make FIND_TRIP() just pass the pointer to the timestamp instead. And use an inline function instead of macros with casts. That gets us proper type safety while at it, so that we get a warning if somebody doesn't pass the expected "timestamp_t *". Plus the code actually looks simpler and way more straightforward. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-09-20Convert FIND_TRIP into functionGravatar Dirk Hohndel
This helps us deal with the issue that the g_list convenience functions don't allow us to easily compare 64bit values on 32bit architectures. And since these convenience functions are truly trivial in nature, it seemed easier to simply implement our own logic here. In the process I moved all the dive_trip_list helper functions into the same spot in divelist.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-19Partial rewrite of the dive trip codeGravatar Dirk Hohndel
This introduces a new data structure for dive trips - reuseing the struct dive just got way too messy. The dive_trip_t datastructure now allows the code to remember if the trip was auto generated or if its time stamp changed when dives where added to the trip during auto generation. The algorithm also distinguishes between dives that were intentionally added to a trip (either in an XML file or by adding them to trip in the UI) and dives that were added to trips via autogen. Saving dives that were added to trips via autogen makes that assignment "intentional". With this partial rewrite several of the oddities of the old code should be resolved - especially turning autogen on and off again should get the divelist back to the previous stage. Also, when dives are merged during file open or import we now try to pick the correct tripflag (instead of just ignoring the tripflag completely and resetting it to TF_NONE by mistake). Finally, the dive trip debugging code got more verbose and is trying harder to detect issues at the earliest time possible. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-19Use a 64-bit 'timestamp_t' for all timestamps, rather than 'time_t'Gravatar Linus Torvalds
This makes the time type unambiguous, and we can use G_TYPE_INT64 for it in the divelist too. It also implements a portable (and thread-safe) "utc_mkdate()" function that acts kind of like gmtime_r(), but using the 64-bit timestamp_t. It matches our original "utc_mktime()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-09-18Fix some of the problems reported by cppcheckGravatar Dirk Hohndel
Thanks to Christian for running the static code analysis tool against subsurface... There were some false positives, a few style issues that I'll ignore for now, and two actual potential bugs. First: Don't check unsigned variables for < 0 This has been around for a while and we are lucky that while technically a bug it still works as expected. Passing a negative idx simply turns it into a very large unsigned integer which then fails the > dive_table.nr test. So it still gets a NULL returned. A bug? Yes. Critical? No. Mismatched allocation and free This is an actual bug that potentially could cause issues. We allocate memory with malloc and free it with g_free. Not good. Reported-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-18Call xmlCleanupParser only once - when we are done with libxmlGravatar Lubomir I. Ivanov
Calling xmlCleanupParser in parse-xml.c:parse_xml_buffer() caused massive memory corruption mostly affecting gtk's FileChooser dialogs and the application menu. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-17Merge branch 'defaultfile'Gravatar Dirk Hohndel
By now the default file code seems quite matured, so in preparation for 2.0 we'll bring it back into master. I made a few small clean-ups during the merge, but the merge itself is very much straight forward. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-17Once again improve existing filename handlingGravatar Dirk Hohndel
Several potential problems. - we could end up dereferencing exiting_filename when it was NULL - we could free the default_filename by mistake - subsurface_default_filename always needs to return a copy of it - closing the existing file before opening a new one repopulated the existing_filename with the default filename - preventing the opened file to become the new existing filename Also, make existing filename a const char * and make file_open have the same sensible default folder behavior as the other file related functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-17Display current filename in windows titleGravatar Dirk Hohndel
This seems to make sense since we have a pretty strong concept of the "active file" that we are working on. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-11Fix a long standing bug when editing divesGravatar Dirk Hohndel
Calling edit from the context menu creates a combined editing widget that contains both dive info and equipment. When editing cylinders or weightsystems from that widget and confirming those edits with OK those changes were already committed to the current_dive - regardless on which dive the user clicked. Worse, even when the user clicked Cancel in the edit widget, any changes to the equipment stayed in effect. This had especially confusing consequences when editing multiple dives. As a workaround this commit adds a global edit_dive variable. This fake dive is edited by the secondary editing widgets and if the user accepts changes with OK then they are copied over to the current dive (or all selected dives in multi dive editing mode). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-11Use glibio functions for mkdirGravatar Dirk Hohndel
Suggested-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-11Display yearly/monthly statisticsGravatar Miika Turkia
Display yearly statistics in a statistics window with option to expand the viewing on monthly level. The amount of dives along with basic information like duration, depth, water temperature and air consumption is displayed in yearly and monthly level. Thus you are able to compare e.g. development of air consumption or diving activity from year to year. Using already existing macro for splitting seconds into minutes:seconds. Moving repetitive code to a function (couldn't think of the suggested clever macro, but this should pretty much do the trick). Now the statistics are updated every time the process_all_dives function is called. It might make sense to actually verify the structures need to be re-allocated, but such optimization is currently not implemented. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Combined two commits. Minor cleanups for white space and boolean values. Significant changes to use the correct units for volumes vs. depths and to avoid unneccesary lookups of the model storage based on the tree. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-10Implement Close menu option that allows closing the data fileGravatar Dirk Hohndel
This requires some helper routines that allow us to clear out all the widgets. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-10Change behavior for the existing filenameGravatar Dirk Hohndel
Previously we always picked the last file that was openend as the file name to save to. That seems counterintuitive when importing files or when opening multiple files. Especially if Subsurface was executed without a file on the command line and we are using the default file. Now we only remember a file name if it was the first one to ever be openend or if it was used in save-as. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-09First cut of adding a default file nameGravatar Dirk Hohndel
The default file name is OS specific and tries to follow the customs on each of the OSs. It can be configured through the preferences dialog. On MacOS we get a strange warning which appears to be a well documented Gtk bug on MacOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-07Handle new dives correctly if trips existGravatar Dirk Hohndel
There is an interesting issue when adding new dives into a dive list with existing trips. Since fill_dive_list walks the list backwards and trips are determined by the timestamp of the first dive in a trip, it is non-trivial to know when a dive is added if it should be part of an existing trip or not. Let's say when we see the dive we can also see a trip entry that starts four days earlier. Without looking forward in the list of dives we cannot tell if this is a multi-day trip that this dive would fit into, or if there is a break of more than tree days (our current trip threshold). Instead this commit adds a second scan of the dives in chronological order that does the right thing for new dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-05Avoid duplicate dive_trip entriesGravatar Dirk Hohndel
When inserting a trip into the dive_trip_list we already check for duplicate trips, but we still kept the additional dive_trip around. With this change we instead replace it with the existing one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-01Allow modification and edits of tripsGravatar Dirk Hohndel
Now that we can load and store trips we needed to add the capability to manipulate those trips as well. This commit allows us remove a dive from a trip via a right click operation on the dive list. The commit also adds code to split a trip into two, to merge two trips and to create a new trip out of a top level dive. To make all that useful this commit changes the right-click on the dive list to identify and act on the record we are actually on (instead of acting on the selection). The right-click menu ("context menu") changes depending which divelist entry the mouse pointer is on - so different operations are offered, depending on where you are. We also add simplistic editing of location and notes for a trip (but the notes are never displayed so far). To make our lives easier this commit adds a link from the dive to the dive trip it is part of. This allowed to hugely simplify the auto trip generation algorithm (among other things). The downside of this change is that there are now three different ways in which we express the relationship of dives and trips: in the dive_trip_list, in the tree_model, and with these pointers. Somehow this screams that I should rethink my data structures... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-01Clean up macros and auxiliary functionsGravatar Dirk Hohndel
In preparation for the next stage of the trips handling this commit makes the macros used to access trips (and some frequently used variables for the tree and list models) more consistent. This also changes the way we display un-grouped dives in the dive list, i.e. dives that are not part of a dive trip. Their dive number is now printed bold. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27Merge branch 'trips' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
Merge the initial 'track trips explicitly' code from Dirk Hohndel. Fix up trivial conflicts in save-xml.c due to the new 'is_attribute' flag. * 'trips' of git://git.hohndel.org/subsurface: Fix an issue with trips that have dives from multiple input files Some simple test dives for the trips code First cut of explicit trip tracking
2012-08-27Fix an issue with trips that have dives from multiple input filesGravatar Dirk Hohndel
The existing code didn't handle the case of different trips for the same date coming from different sources. It also got confused if the first dive processed (which is, chronologically, the last dive) happened to be a "NOTRIP" dive. This commit adds a bit of debugging infrastructure for the trip handling, too. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27First cut of explicit trip trackingGravatar Dirk Hohndel
This code establishes the explicit trip data structures and loads and saves them in the XML data. No attempts are made to edit / modify the trips, yet. Loading XML files without trip data creates the trips based on timing as before. Saving out the same, unmodified data will create 'trip' entries in the XML file with a 'number' that reflects the number of dives in that trip. The trip tag also stores the beginning time of the first dive in the trip and the location of the trip (which we display in the summary entries in the UI). The logic allows for dives that aren't part of a dive trip. All other dives simply belong to the "previous" dive trip - i.e. the dive trip with the latest start time that is earlier or equal to the start time of this dive. This logic significantly simplifies the tracking of trips compared to other approaches that I have tried. The automatic grouping into trips now is an option that defaults to off (as it makes changes to the XML file - and people who don't want this feature shouldn't have trips added to their XML files that they then need to manually remove). For now you have to select this option, then exit the program and start it again. Still to do is to trigger the trip generation at run time. We also need a way to mark dives as not part of trips and to allow options to combine trips, split trips, edit trip location data, etc. The code has only had some limited testing when opening multiple files. The code is known to fail if a location name contains unquoted special characters like an "'". This commit also fixes a visual inconsistency in the preferences dialog where the font selector button didn't have a frame around it that told you what this option was about. Inspired-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-26Ignore Nitrox/He seetings when editing cylinders for multiple divesGravatar Dirk Hohndel
When figuring out which cylinders to change in a multi-dive edit, we already ignored the beginning and end pressures. But it turns out to make more sense to also ignore the Nitrox / Helium settings. Imagine you do a number of dives - for some reason your dive computer records the wrong cylinder size in the downloaded logfile (like my uemis does all the time). Dives will likely have different Nitrox percentage, but you should still be able to simply fix the cylinder size for all dives at once. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-21Add helper 'for_each_dive()' dive iteratorGravatar Linus Torvalds
It's an easy thing to do, but the for-loop ends up being pretty ugly, so hide it behind the macro. It would be even prettier with one of the (few) useful C99 features: local for-loop variables. However, gcc needs special command line options, and other compilers may not do it at all. So instead of doing #define for_each_dive(_x) \ for (int _i = 0; ((_x) = get_dive(_i)) != NULL; _i++) we require that the user declare the index iterator too, and the use syntax becomes for_each_dive(idx, dive) { ... use idx/dive here ... } And hey, maybe somebody actually will want to use the index, so maybe that's not all bad. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-21Fix single-dive editing oddityGravatar Linus Torvalds
The multi-dive case does fine, but the single-dive case (used when adding a dive, for example) was somewhat confused between the dive index (which is the location in the dive array) and the dive number. Fix this by just passing the dive pointer instead (where NULL means to use the current dive selection). Reported-by: Jacco van Koll <jacco.van.koll@gmail.com> Root-caused-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-20Rework dive selection logicGravatar Linus Torvalds
This completely changes how we keep track of selected dives: instead of having an array listing the selection ("selectiontracker") or trusting the gtk selection information, just save the information about whether a dive is selected in the dive itself. That makes it trivial to keep track of the state of selection across group collapse/expand events, or when changing the tree view model. It also ends up simplifying the code and logic in other ways. HOWEVER, it does currently (re-)introduce an annoying oddity with gtk: if you collapse a dive trip that has individual selections, gtk will forget those selections ("out of sight, out of mind"), and when you do *new* selections, the old hidden ones remain. So there's some games required to make gtk do sane things. We may need to either explicitly drop selections when collapsing trips, or make sure the group entry gets selected when collapsing a group that has selections in it. Or something. There may be other issues introduced by this too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Correct multi-edit equipment update logicGravatar Dirk Hohndel
I lied in the commit message for commit 0468535524a3 ("When editing multiple files, don't override existing equipment entries"); the changes there did not parallel the logic for the string entries. Now I think it does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-16Fix right click edit in Dive Notes area for multiple divesGravatar Dirk Hohndel
This fixes the bug that triggered the SIGSEGV that Linus worked around earlier. I had forgotten to update this call path to the edit_multi_dive_info function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-16Merge branch 'tree2' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull dive-trip grouping from Dirk Hohndel: "This turned into an updated pull request for the tree2 branch where I implemented the date based grouping - but is actually a very different topic: this adds the ability to edit multiple dives (and fixes some issues with the dive editing overall). The reason for that is that it reuses some of the infrastructure that I implemented in the tree2 branch for tracking the selected dives. More details in the commit messages." * 'tree2' of git://git.hohndel.org/subsurface: Switch from date based to dive trip based grouping Redo dive editing Fix selecting and unselecting summary items Apply sort functions to the correct model, don't select summary entries Maintain selected rows when switching between list model and tree model Create duplicate list model so sorting by columns works again Improve tree model implementation Allow date based grouping
2012-08-15Redo dive editingGravatar Dirk Hohndel
This commit addresses two issues: We now can add / edit / delete equipment from the edit dive dialog We now can edit multiple dives at once The latter feature has some interesting design constraints: It picks the 'selected_dive' as the one to start the edit from - so if this dive already has some information filled in, that information needs to be overwritten before it is stored in all of the dives. Similarly, only changes to the cylinders or weightsystems are recorded. Also, the notes field is not editable in the multi dive edit mode (as that didn't seem useful). The workflow seems to work best if using the multi-edit right after importing new dives from a dive computer. The user then can select all the new dives and only needs to edit things like location, divemaster, buddy, weights, etc. once. This commit will create some obvious conflicts with the commit that adds exposure protection tracking. It was implemented on top of the tree_view changes as it reuses some of the infrastructure for tracking the selected dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Add exposure protection trackingGravatar Dirk Hohndel
For simplicity and shortness, throughout subsurface exposure protection is simply referred to as "suit". Add the fields to the data structures, add the column to the dive_list and the preferences dialog (once again with it being turned invisible by default). Support loading and saving of the suit information. Display the suit information in the Dive Info pane (this may be a bit controversial as people could argue this should be in the Equipment pane) and allow editing of the suit info, with our usual support for completion and drop down lists to pick from. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-07Add total weight column to divelistGravatar Dirk Hohndel
This adds the total weight carried on the dive in different weight systems to the divelist. The column is by default not shown, which can be changed in the preferences. The column is sortable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-06Fill the list of weightsystems from data in existing divesGravatar Dirk Hohndel
This was simply an omission in the current implementation. All the plumbing was there but never got hooked up with the fixup_dive function as intended. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-06-27Rough "Add new dive" infrastructure in the divelistGravatar Linus Torvalds
Do a right-click to get a menu with the "Add dive" entry. Should do delete too, but that's for later. What's also apparently for later is to make this *useful*. It's the butt-ugliest time entry field ever, and there's no way to set depth for the dive either. So this is more of a RFC than anything truly useful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-19Add a few more conversion helper functions to dive.hGravatar Linus Torvalds
Convert feet to mm, psi to mbar, and F to mkelvin. We do this elsewhere too, but I'm going to need it for the Cochran CSV files, so let's do the helpers now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Don't close config file when changing preferencesGravatar Linus Torvalds
On Linux and MacOS the subsurface_close_conf() doesn't really close the config file (it flushes writes on MacOS), but on Windows it does actually close the registry hkey. Which is bad, if you change the settings multiple times - we assume that the config file is open the whole time. So add a "subsurface_flush_conf()" function, and call *that* when changing configuration parameters. And call the close function only at the very end. Alternatively, maybe we should just open the config file separately every time. I don't much care, maybe somebody else does. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-02Add the ugliest 'delete dive' model everGravatar Linus Torvalds
This interface works the same way the "edit dive" menu item does: it's a text entry meny item on the dive text entries (ie buddy/divemaster/notes sections). Except you pick the "Delete" entry rather than the "Edit" entry. It kind of works, but it really is a pretty horrible interface. I'll need to add a top-level dive menu entry for just deleting all selected dives instead. And it would be good to be able to get a drop-down menu from the divelist instead of having to do it from the dive text entries, which is just insane. But that requires gtk work. I'm not quite ready to get back into that. Thus the "exact same insane interface as the explicit 'Edit' mode". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-23Merge branch 'weight' of git://subsurface.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull weight management from Dirk Hohndel: "This is the fifth or sixth version of this code, I'm begining to lose track. I still struggle with the balance between code duplication and unnecessary indirectness and complexity. Maybe I'm just not finding the right level of abstraction. Maybe I'm just trying too hard. The code here is reasonably well tested. Works for me :-) It can import DivingLog xml files with weight systems and correctly parses those. It obviously can read and write weight systems in its own file format. It adds a KG/lbs unit default (and correctly stores that). The thing I still worry about is the code in equipment.c. You'll see that I tried to abstract things in a way that weight systems and cylinders share quite a bit of code - but there's more very similar code that isn't shared as my attempts to do so turned into ugly and hard to read code. It always felt like trying to write C++ in C..." * 'weight' of git://subsurface.hohndel.org/subsurface: Add weight system tracking Fix up some trivial conflicts due to various renaming of globals and simplification in function interfaces.
2012-03-24Add weight system trackingGravatar Dirk Hohndel
- supports multiple weight systems per dive - supports multiple weight system types - supports import of weight as tracked by DivingLog Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-26Split up file reading from 'parse-xml.c' into 'file.c'Gravatar Linus Torvalds
We're going to eventually import non-xml files too, so let's begin splitting the logic up. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-05Oddly, finishing a sample doesn't require a sampleGravatar Dirk Hohndel
So let's not pass it around Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-31Define O2 permille for air in one spotGravatar Henrik Brautaset Aronsen
Having the O2 permille defined once is more readable. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>