summaryrefslogtreecommitdiffstats
path: root/divelist.c
AgeCommit message (Collapse)Author
2012-06-27Make it possible to do "Add Dive" from just the main dive menuGravatar Linus Torvalds
No need for right-clicks. It's inconvenient on lots of laptops etc, so allow just using the Dive menu as an alternative. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.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-03-16Show statistics of selected divesGravatar Miika Turkia
If at least 2 dives are selected, show statistics of these dives on Overall Stats. Otherwise, show the statistics of all dives. Temperature is also added to the shown statistics. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Minor change to avoid adding statistics.h (moved the global variable and external function declaration to display-gtk.h). Another minor change to the text displayed for the "Stats" notebook page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-05Avoiding some potentially confusing name space clashesGravatar Dirk Hohndel
We have local variables or function arguments with the same names as function static variables (or in one case, function arguments). While all the current code was correct, it could potentially cause confusion when chasing bugs or reviewing patches. This should make things clearer. 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>
2011-12-31Display OTU for dives using airGravatar Henrik Brautaset Aronsen
Zero o2 means 20.9% o2, which can be confusing... Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-18Use an ellipsis for Nitrox O2% rangesGravatar Linus Torvalds
The plain dash may look a bit too much like a trimix specification. Is the ellipsis better? Maybe. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-12divelist: show/sort nitrox dive oxygen percentage as a rangeGravatar Linus Torvalds
If you are diving multiple nitrox cylinders, we now show them as a range instead of just the max. We'll still sort by max O2 (and for the same max, by min O2). So now with trimix dives, we'll show the bottom gas (we assume that "highest He percentage" is that bottom gas), for nitrox dives we'll show the range of Oxygen percentage, and for all-air dives we'll show just "air". For simple nitrox dives (only a single mix), we'll obviously show just that single percentage. This should hopefully conclude the whole "show multiple cylinders in dive list" mess. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11Make the dive gas record the single highest mixGravatar Linus Torvalds
.. using the regular sorting rules: sort by Helium content first, Oxygen content second. Air always sorts last (even behind the theoretical hypoxic Nitrox that nobody sane would use). This is what Don Kinney implies would be the natural thing for a trimix diver. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11Add capability of custom sorts to divelist columnsGravatar Linus Torvalds
.. and use this for the nitrox column, which can now be more complex than just a single number. The rule for the "nitrox" column is now: - we look up the highest Oxygen and Helium mix for the dive (Note: we look them up independently, so if you have a EAN50 deco bottle, and a 20% Helium low-oxygen bottle for the deep portion, then we'll consider the dive to be a "50% Oxygen, 20% Helium" dive, even though you obviously never used that combination at the same time) - we sort by Helium first, Oxygen second. So a dive with a 10% Helium mix is considered to be "stronger" than a 50% Nitrox mix. - If Helium is non-zero, we show "O2/He", otherwise we show just "O2" (or "air"). So "21/20" means "21% oxygen, 20% Helium", while "40" means "Ean 40". - I got rid of the decimals. We save them, and you can see them in the dive equipment details, but for the dive list we just use rounded percentages. Let's see how many bugs I introduced. I don't actually have any trimix dives, but I edited a few for (very limited) testing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11Make sure to update divelist O2 information after editingGravatar Linus Torvalds
The divelist airmix display is kind of broken: it only looks at the first cylinder, and it only looks at Oxygen content, not Helium. But at least we can make sure to update it when somebody edits the cylinder information, instead of leaving it extra broken. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11Make the cylinder table columns unsortableGravatar Linus Torvalds
They were never intended to be sortable, but using common code with the dive list picked up that "sort by index" thing by mistake. If we really want to be able to sort cylinders by O2 percentage (which really doesn't seem to make much sense, considering that you usually have just one or two cylinders) we will need to also handle the case of editing the (differently sorted) cylinder table. Which we don't do now. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09Round the maximum depth on dive listGravatar Miika Turkia
Round maximum depth on dive list to get consistent data between the dive list and dive info. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-07Fix some issues with star rating codeGravatar Dirk Hohndel
To waste less space in the tree view heading we simply put a star in the heading instead of "Rating". We now treat "zero stars" to mean "not rated" and don't store that value in the XML file. Rating is no longer a top level tag in the dive entry but instead a property of the dive tag. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-07Add typical 0 to 5 star rating for divesGravatar Dirk Hohndel
This works ok-ish, but doesn't allow us to click on the stars and edit them in the divelist, which a user might expect to be able to do - in most "star rating UIs" you simply click on the n-th star to set that rating. Here you need to edit the dive and pick the rating from a drop down menu. Minor oddity: you can actually (if you force it) write anything you want into the star rating. But anything that isn't one of the predefined strings simply results in a zero star rating. Overall the UI feels a bit... forced. But I think this is quite useful anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-21Exclude surface intervals from sac rate calculationGravatar Dirk Hohndel
We assume every sample with a depth of less than 10cm to be on the surface. This does not impact our interpolated pressures (one could assume that the diver is not breathing from the regulator when on the surface - but without air integration that's just an assumption). It also doesn't change our tank pressure coloring by sac rate as that always uses the momentary sac rate. Technically speaking this might impact the actual colors printed (as those are relative to the total sac on the dive which may go up due to this change). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-19Make double-clicking on the dive list bring up the dive editorGravatar Linus Torvalds
Now that the dive info window is read-only, we need to edit the dives some other way. We bring up a dive info edit dialog when you double-click on the dive list entry for that dive. I do want to have an "edit" button or keyboard shortcut or something too, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-17Merge branch 'sacplot' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'sacplot' of git://github.com/dirkhh/subsurface: Color pressure plot according to current SAC rate Fix minor coding standard issues introduced by my last commit
2011-11-16Show dives "latest-first" by defaultGravatar Linus Torvalds
You can still order them by date by just setting the sort order on the date column, but normally you'd be more interested in the most recent dives. I tried to just scroll down to the last ones automatically instead, but gtk makes that *really* hard to do. If you do it in the natural place for it, the scroll bar wll show up later and then cover up the last entry anyway. So you'd have to do some crazy expose event thing or something. Which may be the right thing to do eventually anyway, but not worth the pain right now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-16Show more of the dive location in the dive listGravatar Linus Torvalds
Randomly picked up to 60 characters. But maybe we should just get rid of the limit entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13Fix minor coding standard issues introduced by my last commitGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-13Make sure SAC and OTU get recalculated after cylinder info was changedGravatar Dirk Hohndel
Also fixed minor coding style issues (prevent useless code from being executed). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-09Fix up air use calculations for new pressure handlingGravatar Linus Torvalds
Make sure that we calculate air use by using the proper start/end pressures, with the manually set ones being used preferentially over any possible sample data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-01Even more places with pressure and volume conversionsGravatar Dirk Hohndel
Amazing at how many spots we are re-implementing the wheel. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01Use unit functions to get column headers, add unit function for pressureGravatar Dirk Hohndel
Finally getting more consistent overall in how we convert between the different units and how we decide which units to display. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01More consistency improvementsGravatar Dirk Hohndel
Treat SAC and OTU consistently: - SAC is now a member of struct dive - it's calculated / populated at the same time with a helper function with consistent API Create get_volume_units function that returns volumes (e.g. used in SAC rates) based on preferred units - make sure we have these conversions just once in the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Disable sorting by dive numberGravatar Dirk Hohndel
This is based on Linus idea and code - just adding it to my UI branch in case he didn't actually add it to his code... It makes no sense to sort by dive number - every sane person will have dive numbers be chronological; so they can sort by date instead. But removing this option wastes less space and makes the dive list look much better Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Make columns for temperature, cylinder, and nitrox optionalGravatar Dirk Hohndel
Just like SAC and OTU these can now be turned on and off through the preferences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Show dive number in dive listGravatar Dirk Hohndel
Make sure that renumbering the divelist correctly shows up on the display. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-20Allow multiple selections in the dive listGravatar Dirk Hohndel
At this point we don't do anything with this - the commit just provides the infrastructure changes so that this becomes possible. Subsurface behaves the same if exactly one dive is selected and simply keeps the last selected dive if zero or more than one dives are selected. The goal is to be able to select multiple dives and then do actions on them. For example pick a tank used for all of them. Or edit the location or (yet to be implemented) other equipment data like weight carried. And also to be able to merge multiple dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02Split up generic code to generate a gtk tree view columnGravatar Linus Torvalds
We used to do this just for the dive list, but the new cylinder view will want to do a lot of the same boilerplate gtk stuff, so make it a bit more generic and move it to gtk-gui.c. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-27Add preference option to chose if SAC and/or OTU should be in divelistGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-26Make OTU column invisible by defaultGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22Add OTU to divelistGravatar Dirk Hohndel
and change OTUs to be tracked as int, not double Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22Calculate OTUs for every diveGravatar Dirk Hohndel
The calculation assumes that the cylinderindex in each sample tells us which PO2 the dive was breathing at that time. This needs to be verified with dives where there is an actual gas switch. No idea where to display them, yet. Far fewer people will care about this than care about SAC - does this still rate a spot in the dive_list? I guess I could make it part of the dive_info - but it's not editable. It doesn't seem to fit with the equipment page (even though this is the one editable field that is related - nitrox %) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22Minor change to the alignment of the divelist columnsGravatar Dirk Hohndel
Just seems to look nicer this way. And actually implements consistent alignment management for the columns to begin with. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22Put the location last in the dive listGravatar Linus Torvalds
The whole auto-expansion of an entry in the middle thing really doesn't work very well in gtk. Give up on it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Put the default focus on the dive list at startupGravatar Linus Torvalds
This is some crazy stuff. Apparently the only sane way to do this is by hooking into the "realize" callback for the dive list widget. Whatever. Dirk did the googling to figure this all out. Suggested-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Fix up some minor whitespace issuesGravatar Linus Torvalds
Dirk clearly isn't as anal as I am about pretty whitespace. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Select the first dive after filling the dive listGravatar Linus Torvalds
We should always strive to have a dive selected, so pick the first one (that was how the dive list logic worked anyway, it just wasn't truly selected at the tree-view level, so it wasn't *visibly* the selected dive). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Make the dive list searching act on the locationGravatar Linus Torvalds
It used to be "index 0" which originally was the date string, but not only has that changed (it's now just the dive index), it's kind of pointless to search for a date string. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22In divelist maxdepth column, only show depth unitGravatar Linus Torvalds
Show "m" or "ft" instead of "max/m" vs "max/ft". The column really doesn't want to be that wide. The column header is already the widest part of it even with this short name (due to the sort order arrow thing). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21Simplistic first attempt to get changes saved when quitting subsurfaceGravatar Dirk Hohndel
Track whether things changed in the global dive_list So far this actually works if changing dive info (but only if dive selected was changed after the dive info was changed). We are not tracking changes to the cylinder information, yet. also remove the duplicate static dive_list Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20Fix up printing some moreGravatar Linus Torvalds
Use the actual degree sign for temperatures (°F and °C), and make sure everything uses the proper "set_source_rgb[a]()" wrappers to set the colors. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20Fix divelist sortingGravatar Linus Torvalds
That was stupid. The divelist column generation cleanup (commit d3feb78df527: "Make helper function for creating TreeView columns in the dive list") had a but too much copy-paste going on, and didn't always have the right column indexes.. t still *looked* right, but sorting didn't work at all. Reported-by: Chris Lewis <chrislewis915@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20Separate out the UI from the program logicGravatar Dirk Hohndel
The following are UI toolkit specific: gtk-gui.c - overall layout, main window of the UI divelist.c - list of dives subsurface maintains equipment.c - equipment / tank information for each dive info.c - detailed dive info print.c - printing The rest is independent of the UI: main.c i - program frame dive.c i - creates and maintaines the internal dive list structure libdivecomputer.c uemis.c parse-xml.c save-xml.c - interface with dive computers and the XML files profile.c - creates the data for the profile and draws it using cairo This commit should contain NO functional changes, just moving code around and a couple of minor abstractions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20Make the divelist font configurableGravatar Linus Torvalds
Instead of the hardcoding to "Sans 8", allow people to set it in the preferences. Also, make the unit choice be a frame in the preferences dialog instead. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20Merge branch 'for-linus' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'for-linus' of git://github.com/dirkhh/subsurface: Attempt to get the location column to resize in a sensible way Minor tweaks to column headers [ Fixed up minor semantic merge conflict due to the change to make 'dive_list' internal to divelist.c ]
2011-09-20Make 'struct DiveList' entirely internal to divelist.cGravatar Linus Torvalds
Passing it around is just annoying, and we only ever have one. Let's not burden all the users with the silly thing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20Attempt to get the location column to resize in a sensible wayGravatar Dirk Hohndel
Previously the SAC column was the one that expanded which is silly We also used to cut the location off at 16 characters Now we try to make the location the one that expands and allow up to 40 characters, but there's something broken, still. If you manually shrink the location column to its minimum size then subsequently resizing the window gets the desired behavior. But if you don't manually resize the location column it doesn't shrink correctly for windows that are smaller than the space we need for all columns to fully display (instead we get a horizontal scrollbar) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>