aboutsummaryrefslogtreecommitdiffstats
path: root/info.c
AgeCommit message (Collapse)Author
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-07-31Changes to menu iconsGravatar Mikko Rasa
It's customary for menu bars to not have icons. Some items were lacking icons when there's perfectly good stock icons available. I was a bit torn between the "new" and "add" icons for the "add dive" item, since what it really does is create a new dive, but the "add" icon is an uninteresting sheet of paper in the default icon theme so I decided to use the "add" icon. Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-06-27Make the 'Add Dive' dialog at least slightly less butt-uglyGravatar Linus Torvalds
I still suspect that using spinbuttons for the time handling is the wrong way, and I'm a bit surprised the Calendar widget doesn't have a mode where you can see/set the time too. But this makes things at least minimally prettier, and initializes the time entries to the current time (which is obviously not what anybody really wants, but looks a lot better than defaulting to "midnight" or some other random time that *also* won't be what anybody actually wants). I think this might be something we can live with, although I hope somebody with good taste comes along and say "don't use spinbuttons, do this: xyzzy" and makes things look better yet. Also, I have this suspicion that I should put the time/depth/duration stuff to the right of the calendar. Most displays are wider than they are tall, so tall and skinny dialogs are bad especially if you have limited vertical pixels. I still have flashbacks to my netbook-using days, hating applictions that did that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-27Add depth entry to new dive edit dialogGravatar Linus Torvalds
Christ, if you look up "Ugly dialog" on Wikipedia, I think it has a picture of this "New dive" thing. Or it should have. But it kind of works. Although with only a "max depth" entry, you can't currently set average depths etc, so SAC-rates etc cannot be calculated for these kinds of dives. And the dive numbering is wrong. We do auto-number new dives that get added at the end, but we do it as we add them, so when you *edit* the dive information (before it has been added) the dive number shows up as "#0". So there's certainly room for improvement here. 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-04-24Make sure to update dive info when it is editedGravatar Linus Torvalds
We used to not properly update the dive info until we switched to another dive when we edited it. This should fix it. 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-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-14Return is not a functionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-12Pack the star rating on a line of its ownGravatar Linus Torvalds
Packing it next to the divemaster/buddy information may work great on a big screen with lots of pixes, but it makes the minimum window size way wide for a small screen. So don't do it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11Allow editing of Helium values in cylinder infoGravatar Linus Torvalds
Henrik Aronsen points out that we've not made it possible to edit the He percentages for trimix diving. It's easy enough to do, I just didn't have any dives that needed it myself. So here goes. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.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-19Add the cylinder list to the dive info edit dialogGravatar Linus Torvalds
This way, when you have a new dive that you just imported from your dive computer, you can just double-click on the dive and fill out all the relevant information: location, notes, buddies and cylinder info. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19Add dive number and date to the dive info edit dialogGravatar Linus Torvalds
It's pretty basic information, and might be hidden behind the dialog especially on a small screen. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19Add an 'edit' menu item to the dive info text fieldsGravatar Linus Torvalds
It just pops up the dive info edit box. This way you can be in the dive info tab, and not have to go to the dive list just to double-click on the dive. This thing still needs some polish, but it's now usable. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.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-18Make all the normal widgets uneditable and non-focusingGravatar Linus Torvalds
We always keep the focus on the dive list, so that the random gtk focus handling doesn't suddenly randomly make us edit the combo boxes when the cursor up/down keys start changing them instead of the dive list. This means that dive location, notes and buddy/divemaster aren't editable at all any more, but I'll fix that by making a separate dive edit popup window. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13Fix the stupid gtk combo box text reset issue for realGravatar Linus Torvalds
Lubomir's solution to fill them with a newline doesn't work. Well, it may work on some versions of gtk, but on mine it just results in an ugly box for the control character '000a' that tries to show the newline. So this is a third approach: if we reset the text to empty, first set it to space (to clear it), and then set it to empty. That seems to work on at least one version of gtk, and doesn't have the problem with the space *remaining* when you cut-and-paste something into the combo box. Let's see if it breaks anything else, but at worst it should be no worse than the old "set it to space" approach - iow the combo box might remember the space, but at least not some random data from the previous dive that it happened to show. Lovely gtk bugs. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13gtk_combo_box_entries and empty textGravatar Lubomir I. Ivanov
Passing -1 to gtk_combo_box_set_active, seems not to work as the gtk documentation explains; there might be a bug in the library or some special case that is not explained. could be related to: http://mail.gnome.org/archives/gtk-devel-list/2004-March/msg00170.html passing \n seems to "trick" the cell renderer to clear the entry completely. This is a temporary solution. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02Work around some gtk oddity with gtk_combo_box_entries and empty textGravatar Linus Torvalds
Setting the gtk_combo_box_entry test to th eempty string doesn't "take": the old text remains. Which does all kinds of funky things when you switch between dives, and the location (or buddy or divemaster) entry contains some random stale entry from another dive. This works around it by using a string with a single space in it instead, and then removing the space when reading. Not pretty, and certainly not correct, but it pinpoints the odd behavior. I'm sure somebody will figure out what the magic gtk incantation is for this. Also remove the never-used flags for whether the entries have changed. They were designed to be set by change callbacks, but we never bothered with it, and just always read the value of the entries instead. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-28Update the known locations / buddies / divemasters as user enters themGravatar Dirk Hohndel
The code that allowed a user to start typing the name of a location, buddy or divemaster and that would then offer completions has one flaw - it doesn't add any new names that you enter to its store of names until you save and restart the app. This patch fixes that. When reading the code I also noted that the location_changed, divemaster_changed, buddy_changed variables have become meaningless. They are set to 1 and tested, but never changed. I wasn't sure if I should remove the variables (as the code seems to work without them having any impact), or if we should go back to actually tracking these changes to prevent unnecessarily marking the divelist as changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Enable inline completion/selection for the location/buddy/dm fieldsGravatar Linus Torvalds
This makes Tab completion work, and seems a whole lot more natural. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23Keep the people/location lists sortedGravatar Linus Torvalds
This makes the combo box entry drop-down list be a whole lot more useful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23Make the divemaster/buddy/location text entries be combo box entriesGravatar Linus Torvalds
The text entries have completions, but if you want to see the full list of possibilities, I'm not seeing how to do that without turning the GtkEntry into a GtkComboBoxEntry. The list of people/locations are not sorted, though, which makes the full list less than readable. Will have to do that too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23Add completions to the dive location, buddy and divemaster entriesGravatar Linus Torvalds
This way you can just type the first few characters of a location you've been to before, and it will show you a list of possible completions. Same for buddies and divemasters (which take the completions from a list of people you've used before). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Don't do individual 'gtk_widget_show()' callsGravatar Linus Torvalds
This is left-overs from an earlier age when we did this. But we just do the "show_all" at the end. 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-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-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-19Remove dive info frameGravatar Linus Torvalds
It has always been problematic, and I've been moving things in and out of it. And it just isn't a very powerful widget. You can't *do* anything with it. The information it shows you may be useful, but the core stuff already shows up in the dive list. And the dive list is actually a much superior widget over that static dive info frame. The information that shows up in the dive list can be sorted by column, for example. So when we show temperatures or SAC numbers in the dive info frame, that's actually a very bad place to show them: we would be much better off showing it in the dive list, and then we could sort by SAC or by temperature. In other words: just remove the thing. Instead, plan to extend the dive list to contain all the information. That will probably mean that we need to change the current pane widget to be a vertical pane, rather than a horizontal one, but what's wrong with that? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16Stop plotting the gas / consumption information into the profileGravatar Dirk Hohndel
And move the code into info.c where it now belongs Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16Make handling of empty airconsumption string consistentGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16More fixes to positioning of gas / consumption information in info_frameGravatar Dirk Hohndel
This gives the airconsumption label a fixed size and changes its alignment so it is anchored to the right. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16Show tank / nitrox / air consumption information in the info_frameGravatar Dirk Hohndel
Even though we go down to an 8pt font the info_frame changes size when the air info is added. I don't like this but want to see how Linus would like this resolved before going overboard. Minor tweaks to the formating (we don't need two decimals when printing the liters of air consumed). This patch does NOT remove the plot of the air information in the profile graph. I think we want to remove that once we like the text where it is, but I wanted to do one thing at a time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16Dirk can't count to tenGravatar Linus Torvalds
That's ok, Dirk. I've got your back. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16Remove dive number from frame labelGravatar Dirk Hohndel
It's now in the window title - no point in having it twice. Also added a little "Dive #xx - " template. The old "##. " was a bit too minimalistic for my liking. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16Put the dive number and location in the window title barGravatar Linus Torvalds
I suspect the "info" area is better used for actual values, so move the dive location into the window title instead (using date if no location info), and title the info frame with date and time. This just means that the date/time gets removed from inside the frame: we may want to put air consumption info in there instead? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Add divemaster/buddy field and text entryGravatar Linus Torvalds
I have it in some of my notes, and Dirk seems to fill that in too, so let's just show it, save it, and allow editing of it.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11Clean up dive info box tooGravatar Linus Torvalds
Make it denser by putting the dive number/location in the frame label, and make it size up and down more naturally. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11Fix up dive number namingGravatar Linus Torvalds
Use "dive->number" instead of "dive->nr". And make the XML match too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11Show dive number (if it exists) in the location noteGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09Rename 'cylinder.c' as 'equipment.c'Gravatar Linus Torvalds
Make it about general equipment management, and start hooking up functions to show new equipment information when changing dives (and to flush changes to equipment information for the previously active dive). Nothing is hooked up yet, and it's now showing just one (really big) cylinder choice, so this is all broken. But it should make it possible to at least get somewhere some day. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Do output unit conversion in the dive info window tooGravatar Linus Torvalds
This should take care of it all, unless I missed some case. Now we should just save the default units somewhere, and I should do the divelist update much cleaner (instead of re-doing the divelist entirely, it should just repaint it - now we lose the highlited dive etc). 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-04Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it ↵Gravatar Nathan Samson
up to date with the master (and my own UI improvements) Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04Some UI beauty patches:Gravatar Hylke Bons
Uppercase first letter for each label word Tweak the paddings for easier reading Rename File menu to Log menu Add a separator before Quit in the Log menu Remove frame in extended diving info and add 6px padding Signed-off-by: Hylke Bons <hylkebons@gmail.com>
2011-09-04Merge branch 'master' into ui-improvementsGravatar Nathan Samson
2011-09-04Remove the redundant frames in the notebook. Closes #9Gravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>