summaryrefslogtreecommitdiffstats
path: root/divelist.c
AgeCommit message (Collapse)Author
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>
2011-09-20Minor tweaks to column headersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-19Reinstate the main window titleGravatar Linus Torvalds
It got removed by some of my overly aggressive cleanup in commit fefcbf125e89 ("Remove dive info frame") because the dive info frame initialization also initialized the main window title.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Hacky hard-coded font for dive list entriesGravatar Linus Torvalds
This really is too wrong for words, but I do think the dive list may look better with a smaller font. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Make helper function for creating TreeView columns in the dive listGravatar Linus Torvalds
Let's not repeat the boiler-plate code more than necessary. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Add cylinder description to dive listGravatar Linus Torvalds
And I *really* would want to make the dive list be a ComboBox or something like that, rather than a ListView. I need to really understand those things, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Turn the rest of the duplicate string fields to use render functionsGravatar Linus Torvalds
So instead of having a depth field (in mm) for sorting, and the text field that contains the same thing in text, we now have all the fields we use in "native" format, and we just render them as text dynamically. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Use renderer function for divelist depth field tooGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Use a renderer function on the date fieldGravatar Linus Torvalds
Instead of creatign an extra column containing the date text, use a renderer function to create the text dynamically. Just the date right now, but we'll do them all this way. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Oops, fix typo. EAN, not EADGravatar Linus Torvalds
Typo turned EAN (Enriched Air Nitrox) to EAD. Which does mean something too, just to confuse people - but while it's still nitrox-related, it's entirely the wrong thing (Equivalent Air Depth). I don't think anybody would ever care to see *that*. With computers, why would you care? Anyway, Dirk noticed it, and suggested I just use O2% instead. It's not like EAN is all that readable either. Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Update the divelist when dive info changesGravatar Linus Torvalds
This flushes the dive changes to the dive list, the way the old dive info frame would update as you update dive fields. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Add air usage calculations to dive listGravatar Linus Torvalds
Hey, now you can sort your dives by how good your SAC is. Which sounds more useful than it probably actually is. But maybe you can see patterns in what makes your SAC suck.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Add location to divelist tooGravatar Linus Torvalds
Sure, it's visible elsewhere, but this way you can search and sort for it, and see several entries at once. So again, having it visible in the dive list is a good thing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Clean up divelist generation some moreGravatar Linus Torvalds
.. and make the date string much more readable, now that we aren't actually size-constrained any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Start filling in temperature and nitrox data in dive listGravatar Linus Torvalds
Still more to go, but it's slowly fleshing out.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Add temp/nitrox/sac entries to divelistGravatar Linus Torvalds
This doesn't really fill them, it just adds them to the possible entries. I'll get to it later. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Make the divelist column naming clearerGravatar Linus Torvalds
Currently we use random hard-coded integers, and it's not always clear what is going on. Make it much more explicit with an enumeration of the different divelist columns. And change the column order to make it more logical, and make sure we actually catch all uses while at it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Update the dive units without destroyng and rebuilding the dive listGravatar Linus Torvalds
Just iterate over the dive list entries, updating them one by one. This avoids the "selection destroyed" when the dive units are changed. And it's cleaner anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Make divelist honor the length unitsGravatar Linus Torvalds
Show dives in meter or feet depending on the output unit setting. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Add GtkTreeViewColumn information to 'struct DiveList'Gravatar Linus Torvalds
We will need the column information in order to update the naming when the units change. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05Repaint the dives in dive_list_update_dives() instead of in callersGravatar Linus Torvalds
Each caller ends up needing it, and I missed another one. So rather than update the other caller, just do it in dive_list_update_dives() and we can stop worrying about it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05Open File works. I refactored the code and introduced a new type. I never ↵Gravatar Nathan Samson
used it as a pointer (their was no real reason), but I'm not really satisfied. Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04Zebra-color the divelistGravatar Linus Torvalds
..as suggested by Nathan: "I also wanted to "zebra" color the divelist by setting the rules-hint to TRUE. but I noticed it was already set explicitly to FALSE (even if this is the default). If this is just an accidental copy paste from some tutorial you can experiment (set it to TRUE) and see what you like most." It was indeed just copy-paste from some tutorial, and the zebra-coloring does look nicer, doesn't it? Suggested-by: Nathan Samson <nathansamson@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Right align the numbersGravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04Generate date string for the dive list dynamicallyGravatar Linus Torvalds
.. and sort based on the 'time_t' value itself. This allows us to use a more compact date format that doesn't need to sort alphabetically, because sorting by date is always based on the date value. So we can use just a two-digit year, and skip the seconds, to keep the column narrow, while still sorting correctly. Also, "Depth" is a nice header string, but it is wider than the column itself, which makes the whole column wider than necessary. So put the units in the header instead of in the string, keeping things narrow. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Split the dive list in columns. Columns are sortable now (name = date, ↵Gravatar Nathan Samson
depth, duration) Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-08-31Use a gtk table instead of hboxGravatar Linus Torvalds
We'll want to add various dive statistics, so... Without them, it all looks pretty much the same, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Teach the thing to actually track the currently selected diveGravatar Linus Torvalds
.. and repaint the profile when the selection changes. Now, if it just wasn't so ugly, it might even be useful. Except it obviously needs to also show all the other dive information. And allow the user to fill in details. And save the end results. So no, it's not useful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Re-do the tree selection code with a selection callbackGravatar Linus Torvalds
Learnign gtk by looking at cairo examples? It's one way. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Split up divelist scroll window generation into its own fileGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>