summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2012-08-20Remove separator line in MacOSX File menuGravatar Henrik Brautaset Aronsen
This separator line doesn't make sense in the File menu on MacOSX. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2012-08-18divelist: add 'Expand all' and 'Collapse all' menu itemsGravatar Linus Torvalds
This adds the ability to expand/collapse all the dive groupings in the divelist from the divelist right-click context menu. Should we perhaps add it to the top 'Dive' menu too? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Change default behavior for Stats to show selected divesGravatar Dirk Hohndel
Previously when only one dive was selected, the Stats notebook page would show the statistics for all dive. That creates a very illogical behavior when clicking on the different dive groups in the dive list. The stats page would always show how many dives where in a group when the group was selected, except when there was only one dive in the group, in which case the statistics for all the dives were shown. With this change we also show the statistics for the selected dives, even if it is just one. If you want the statistics for all dives, simply select them all (Ctrl-A or Command-A on a Mac). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18Fix default size for scrollable notebookGravatar Dirk Hohndel
Linus change in commit bcb9f67819bc ("Make the notebook portion (dive notes/equipment/info) a scrollable window") created a really ugly default where the notebook Dive Notes always ended up with a vertical scrollbar. This picks a much saner default layout for the panes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18Make the notebook portion (dive notes/equipment/info) a scrollable windowGravatar Linus Torvalds
This makes things start up with the wrong size, which is somewhat annoying, but by doing so avoids a bigger annoyance, namely that the three panes move around when moving between dives. In particular, if the initial dive didn't have much of an equipment list, the initial size allocated for the notebook is fairly small and determined mainly by the size of the the Dive Notes page. However, when you then scroll around in the dive list, you might hit a dive with lots of equipment, and suddenly the panes dividing the different parts of the subsurface application window will jump around to make room. That's horribly annoying, and actually makes things like double-clicking dives in the dive list not work right, because the first click will select it, and cause the dive to move around (so the second click will hit a totally different dive). Now, making the notebook be in a scrollable window means that if the size of the notebook changes, it might get a scrollbar, but the panes themselves do not move around. The initial sizing of that thing being wrong is annoying, though. We need to figure out a separate solution to that. [ Side note: currently it uses GTK_POLICY_NEVER for the horizontal scroll-bar, just to avoid the horizontal size also starting out wrong, which is *really* nasty. If we can solve the initial size issue, we should make the horizontal scroll-bar be GTK_POLICY_AUTOMATIC too. ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Select better (?) default date for adding new diveGravatar Linus Torvalds
We now pick one hour after the end of the currently selected dive as the default starting time for the new dive to be added. If multiple dives (or no dives) are selected, we default to current time as before. The "one hour after the end" is just a random (but not unreasonable) assumption for the surface time if you add multiple dives. Suggested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Improve divelist group header informationGravatar Linus Torvalds
This shows the number of dives in the grup in the divelist header field, and also picks the location from the first dive that *had* a location, so that if any dive in the group has a valid location, the group will have a location. It also makes double-clicking a dive group expand/collapse that group. Requested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Add weight and suit support for JDiveLog importGravatar Miika Turkia
Use the suit and weightsystem support of Subsurface when importing divelogs from JDiveLog. (They were previously included in the notes field as support for these fields was missing from Subsurface.) After import the weightsystem is undefined and weight unit is the default of Subsurface. Unfortunately the weight field in JDiveLog is text field and might contain pounds and kilograms mixed in seemingly random order. Thus 2 pounds of weight might be transformed to 2 kg. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Fix uninitialized pointer crash for "Save As"Gravatar Linus Torvalds
The "filename" variable was only initialized when the user accepted the name, so cancelling the file save would randomly use an uninitialized pointer. Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Make fill_missing_tank_pressures robust against missing cylinder infoGravatar Linus Torvalds
The code iterates over a list that can be NULL, but happily dereferenced it anyway. Oops. This function really should be split up and commented more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18Make fixup_divep robust against insane dive timesGravatar Linus Torvalds
This fixes the case of the dive duration being zero, or being shorter than the assumed ascent/descent time. Reported-by: Lutz Vieweg <lvml@5t9.de> 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-18Fix crash when editing weight system infoGravatar Dirk Hohndel
I missed one instance where a callback function needed to be passed the widget index w_idx in the signal_connect function. It got passed a pointer to the model instead which of course blew up when trying to dereference the array with that "index". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17Import Divesuit information from DivingLog XML fileGravatar Dirk Hohndel
Trivial two-liner patch Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17Minor Macos menu entry modification fixGravatar Dirk Hohndel
We have removed a menu separator from the gtk gui and that was still referenced in the Macos code. And just in case, we are now testing for the widget for the other separator to be non-NULL before destroying it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17When editing multiple files, don't override existing equipment entriesGravatar Dirk Hohndel
This parallels the logic used for all the string entries. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17Merge branch 'fixes' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull dive selection fixes from Dirk Hohndel. This hopefully fixes the common cases. Dirk is cursing gtk. We may need some gtk selection guru to explain things. * 'fixes' of git://git.hohndel.org/subsurface: Another selection fix More fiddling with the selection
2012-08-17Another selection fixGravatar Dirk Hohndel
The corner cases are getting more and more artificial. Without this patch, the following can happen: Select one or more dives in an (expanded) dive trip. Now collapse that trip with the little triangle. Select a different trip. The previously selected dive(s) are still part of the selection (as you can see, for example, in the statistics tab). With this patch the scenario above works as intended (all the dives in the new trip are selected), but we have another corner case: Just as before, select one or more dives in an expanded dive trip. Collapse that trip and ctrl-click on another trip. Now you lose the originally selected dives. Frankly, if you ctrl-click to add more dives to your selection - just don't collapse the trips the dives are in? As this new corner case seems even more artificial than the previous one, I consider this patch an improvement. But fundamentally I am just battling all the ways in which gtk's selection handling is messed up. When I get the selection call back I cannot tell if this is a new selection or an incremental selection (i.e., a shift-click or ctrl-click). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17More fiddling with the selectionGravatar Dirk Hohndel
As expected, this is pretty subtle to get right. But with this change the code becomes simpler and more straight forward, I think. If the dives in a group are collapsed, we don't even try to make gtk keep track of their selection status - we explicitly do so ourselves. This avoids the artificial expand / collapse around our attempt to force gtk to allow us to select children that are hidden. But if a dive is expanded, then we trust gtk to get things right. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17Merge branch 'misc-fixes' of git://github.com/DataBeaver/subsurfaceGravatar Linus Torvalds
Pull miscellaneous fixes, mostly UI stuff from Mikko Rasa. Both this and the pull from Pierre-Yves Chibon created a "Save As" menu entry and logic. As a result, there were a fair number of conflicts, but I tried to make the end result somewhat reasonable. I might have missed some semantic conflict, though. Series-acked-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> * 'misc-fixes' of git://github.com/DataBeaver/subsurface: Add a separate "Save as" entry to the menu Changes to menu icons Improved depth info for dives without samples Divide the panes evenly in view_three
2012-08-17Merge branch 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurfaceGravatar Linus Torvalds
Pull patches to change behavior on exit from Pierre-Yves Chibon. Pierry-Yves explains: "When someone opens a file, change something in it and try to quit, the program asked whether the data should be saved. If 'Ok' then it shows the save-window and the user can choose to save the file or rename it. My habits in such case would be that since I opened a specific file, I want to save to that specific file, therefore, when I press 'Ok', I want it to save automatically to the file I opened. So I have been working on changes that do: - When a file has been opened by the user, save to this same file if the user is 'Ok' while closing. - Add a 'Cancel' option to the pop-up window that offers to save the file while closing. - Add a 'Save As' entry in the file menu." * 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurface: Add a 'Save As' entry in the menu. Allow to cancel while trying to quit and the data was changed. When the file has been opened rely on it to save.
2012-08-17Fix string handling in get_combo_box_entry_textGravatar Dirk Hohndel
Linus' code dropped the const qualifier from the start rating. While fixing this I stared some more at get_combo_box_entry_text and realized that the existing code could potentially change the "old" pointer and then pass it to free(). Tsk-tsk-tsk. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17multi-dive editing: don't change fields that weren't changed for the master diveGravatar Linus Torvalds
Commit 2f773b97e042 ("multi-dive editing: don't change already set data for other dives") didn't get the multi-dive editing quite right: even if one of the dives in the list of changed dives has an empty field, we should *not* fill it with the edit data unless that edit data was actually changed. So compare the new data with the original master data, and if they match, do nothing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-17Add a 'Save As' entry in the menu.Gravatar Pierre-Yves Chibon
Add a "Save As" entry in the "File" menu allowing the user to specify the file in which to save the data. This is useful as we no longer offer this option through the "Save" entry while the data had been opened from an existing file. Signed-off-by: Pierre-Yves Chibon
2012-08-17Allow to cancel while trying to quit and the data was changed.Gravatar Pierre-Yves Chibon
So far, when trying to quit while the data was changed the offer was "Save" or "Don't save". Now, you can also "Cancel" which will bring you back to the main window. This allows you to re-save the data in another file. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-17When the file has been opened rely on it to save.Gravatar Pierre-Yves Chibon
When a file is opened, we keep it in memory and when you try to quit while the data has been changed, propose to save back to this same file. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-17Remove repetitions of "Show" in Preferences dialogGravatar Henrik Brautaset Aronsen
Instead of having "Show Temp", "Show Cyl", etc in the Preferences dialog, rename the group as "Show Columns" and remove "Show " from all the checkboxes. The dialog is tighter/nicer this way. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2012-08-16Merge branch 'tree2' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull selection tracking fixes from Dirk Hohndel: "I just gave up on gtk tracking our selection. Way too much pain. The implementation below has seen some testing with the debugging code enabled and seems to work - but it needs more banging onto it, I'm sure. Ideally I'd like to leave the debug code in, ask people on the mailing list to play with it and report any inconsistencies. After that I'll be happy to remove it again." * 'tree2' of git://git.hohndel.org/subsurface: Stop relying on gtk to track which dives are selected
2012-08-16multi-dive editing: don't change already set data for other divesGravatar Linus Torvalds
When editing multiple dives at the same time, don't change fields that have already been set for a dive, unless the old field contents match the currently selected ("master") dive. So when you edit multiple dives, you can set the dive master or buddy (or suit etc) for all of them in one go, but if one of them already has that field set, it won't be modified just because you set the other ones. Acked-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-16Stop relying on gtk to track which dives are selectedGravatar Dirk Hohndel
We spend way too much effort trying to get gtk to manage the dives that are selected. The straw that broke the camel's back is that gtk forces us to expand any nodes that we want to select - so selecting a summary entry for a dive trip forced us to expand all the dives in the dive trip. Which as Linus pointed out really sucked from a user experience. So instead we now completeley ignore gtk's weird idea of what is selected and what isn't and simply track things ourselves. We still need to play some games with gtk to make sure that the correct rows are SHOWN as selected, but still, the overall code seems much cleaner. This commit contains a bunch of debugging code that is ifdef'ed out - this is extremely useful to make sure I didn't mess anything up, but eventually I'll want to remove that again as it just looks ugly in the code. 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-16Avoid SIGSEGV when editing multiple divesGravatar Linus Torvalds
The multi-dive editing is broken if you right-click on the dive text-fields (instead of the divelist). This just avoids the SIGSEGV, it doesn't really fix the editing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.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-16Merge branch 'suit' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull exposure suit tracking from Dirk Hohndel. * 'suit' of git://git.hohndel.org/subsurface: Add exposure protection tracking
2012-08-16Switch from date based to dive trip based groupingGravatar Dirk Hohndel
Linus HATED the date based grouping - too much wasted space visually ("three levels of grouping are way too much") and asked for dive trip based grouping instead. This is a quick change to do just that, with an assumption that no dive in 3 days means it's a new trip. This also changes the summary entry to display a location for the trip, for now we pick the location of the (chronologically) first dive of the trip. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-14Fixed another memory leakGravatar Dirk Hohndel
We need to free the string that gtk_tree_mode_get returns to us. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Fixed a small memory leak in divelist.cGravatar Lubomir I. Ivanov
In fill_one_dive(), cylinder and location strings are obtained via get_string(), which needs to allocated a litte bit of memory. After passing the two pointers ('cylinder' and 'location') as arguments to gtk_list_store_set() it is safe to release them. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2012-08-14Fix selecting and unselecting summary itemsGravatar Dirk Hohndel
The dive list now seems to behave intuitively. In order to do this we had to intercept the select function in addition to having a selection-changed callback. That way we can simulate the multi-level selection and unselection that was missing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Apply sort functions to the correct model, don't select summary entriesGravatar Dirk Hohndel
We only set up the column specific sort functions for the default (tree) model, which caused us to not sort correctly in the list model. This commit also somewhat cleans up the handling of selecting summary lines in the tree model, which includes the very first selection made at program start (which happens to be the very last dive). But it still doesn't work the way I expect it to work (i.e., the correct row is not highlighted). Fundamentally I would prefer clicks on the summary lines to instead select (or as ctrl-click, possibly deselect) all the dives under that summary entry. Still TODO. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Maintain selected rows when switching between list model and tree modelGravatar Dirk Hohndel
We keep track of the DIVE_INDEX of all selected dives and simply re-select those dives after changing model (date based sort or sort by other column). There are a few TODOs left. We lose the sort direction (ascending / descending) when switching models. We also don't correctly deal with the user selecting summary rows in the tree model. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Create duplicate list model so sorting by columns works againGravatar Dirk Hohndel
One major downside of the switch to a tree model is that sorting by columns other than date was broken - it would sort the entries within each date which is not all that useful. After playing with some Gtk trickery that would allow us to filter out those rows it quickly became clear that the much easier solution is to simply maintain TWO models (and therefore two storages). This causes some overhead and requires some careful tracking of all changes, but it turned out to be rather straight forward to do. dive_list now has three model related members: model - current model displayed (which is one of the following two) treemodel - the tree model listmodel - the list model One side effect is that the callbacks no longer can pass the model around (as this could have changed since the callback was registered), but that seems only a minor drawback and was easily addressed. The implementation in this commit still has a couple of obvious flaws: when switching back from the list model to the tree model all the expansion state of the rows is lost and we end up with just a list of the different years visible. Also, selections aren't maintained when switching models. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14Improve tree model implementationGravatar Dirk Hohndel
We now support three hierarchy levels: day, month, and year. Each indicated by a negative DIVE_INDEX for -1 to -3. This allows a nice compact overview when doing date based sorting (the default). As indicated in the previous commit, things still go wrong with sorting by other columns as the entries are only sorted within each day, not globally across the whole dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-13Allow date based groupingGravatar Dirk Hohndel
This is the very first rough cut. It switches things over to a tree model so we can have date based summary nodes. It uses a DIVE_INDEX of -1 for summary nodes to easily tell them apart from actual dives. All the data functions are changed so the summary nodes only show the date they cover. The commit also adds a couple of debug functions to be able to easily peek into the model from the debugger. Lots of things left to do. There is no longer a first dive selected when starting subsurface. Sorting by columns other than date is messed up. We almost certainly want month and year summary entries as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-10Don't print a total weight of 0 in the weight columnGravatar Dirk Hohndel
For consistency with the rest of the dive_list we should interpret "no weight systems recorded" as "no information" and therefore print nothing instead of printing a total weight of "0" for these dives. 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-08-06Remove weightsystem entry with no descriptionGravatar Dirk Hohndel
This existed in the initial implementation to deal with an implementation problem that was long since resolved. So now it just created just an ugly empty line in the drop down menu for weightsystems. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-06Remember the last weight used per weightsystemGravatar Dirk Hohndel
With this change, if the user adds a new weightsystem to a dive, on subsequent edits the weight amount for this weightsystem no longer defaults to 0 but to the last weight that was used with this weightsystem. So when the program imports a set of dives from the divecomputer and the user starts editing them, once they enter the weight for the "integrated" weightsystem the first time, for each of the consecutive dives that same weight is the default once "integrated" is selected - which usually will be the correct amount. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>