aboutsummaryrefslogtreecommitdiffstats
path: root/equipment.c
AgeCommit message (Collapse)Author
2011-11-09equipment: clean up cylinder pressure spinbutton setupGravatar Linus Torvalds
This is just in case I end up doing the graying out of implicit pressure information: I wanted to clean things up a bit first. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09Show the newly split pressures correctly in the equipment page tooGravatar Linus Torvalds
NOTE! When *editing* the cylinder data, the only thing shown is the non-sample pressure. So the cylinder editing widget will show zero for start/end pressure for a dive that has pressure saples without any manually set pressure data. This is intentional, so that you can clearly see that this is not a set value. But it may be that we should gray out the spinputton and have an "edit value" checkbox or something to make it really obvious. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09If we don't have cylinder working pressure, we sill want to show the volumeGravatar Linus Torvalds
.. although in that case we can only ever show the volume in liters, and cannot do a conversion to cubic feet even if the user has set imperial units. 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-01Further cleanup of pressure and volume conversionsGravatar Dirk Hohndel
I'm amazed at how many spots we were doing conversions - some of them subtly different than others. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Add 'activate' callback for the cylinder completionGravatar Linus Torvalds
This makes us fill in the size/pressure data for a cylinder even if we just type the name (rather than pick an entry from the list) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22Add a completion for the cylinder type entry combo boxGravatar Linus Torvalds
This allows us to start typing the cylinder description and we'll get a matching list that we can select. This is similar to selecting one from the model, and works in addition to the explicit selection. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22Add cylinder data to cylinder model as we record each diveGravatar Linus Torvalds
This way the cylinder model list will contain all the different cylinders that we have ever seen, rather than only containing the models that we have *edited*. That makes it much more practical to add new dives with the same cylinders that we've used before, because now those cylinders will show up as cylinder models even if we haven't looked and edited the old dives first. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22Fix the reading of the cylinder start/end pressure from cylinder modelsGravatar Linus Torvalds
The cylinder model doesn't contain the start/end pressures, they just contain the cylinder type information. So trying to read the start and end pressure from the cylinder model change callback is totally bogus. We need to set the start/end pressures from the cylinder info when we create the cylinder widget, and not touch them when the type changes. So split up the "set_cylinder_spinbuttons()" function in two: one that sets the type information, and one that sets the start/end pressure. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-21Repaint dive after equipment change only after updating the cylinder infoGravatar Linus Torvalds
Repainting the dive will end up touching the cylinder list store, so we should finish setting the cylinder info before we repaint it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-21Repaint the dive after equipment changesGravatar Linus Torvalds
Those changes may have changed cylinder sizes and beginning/end pressures, so the dive profile and SAC rate may be different. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17Add start/end pressure to cylinder edit dialogGravatar Linus Torvalds
This finally allows you to set the start/end pressures by hand. HOWEVER! Right now, if we have samples with pressures, those samples will always end up overriding anything you set manually. Which can be very annoying if your wireless air integration fails halfway through. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Remove cylinder index from cylinder list modelGravatar Linus Torvalds
Instead of having to keep the index up-to-date as we edit entries around, just figure out the entry index from the model itself. Gtk seems to make it unnecessarily hard, but what else is new? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Make cylinders editable with a double-clickGravatar Linus Torvalds
You can still just select them and click the "Edit" button too, but now you can double-click them (or select them and press "enter") for editing too. It seems to be the natural interface. Also, remove the index column (that was there for debugging), and add grid lines. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Change calling convention of 'edit_cylinder_info'Gravatar Linus Torvalds
Instead of passing it the model and iterator (which requires that we create the new entry for an 'add' event even if we then cancel the operation), just make the caller do the final cylinder list update. This way we can make 'add' work more sanely: if you cancel the add, we now do not create an empty cylinder entry at the end. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Make the cylinder 'delete' action actually delete the cylinder infoGravatar Linus Torvalds
It used to just update the cylinder list widget data, not the actual dive information. It still needs an "accept or cancel" dialog, I suspect. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02First cut at working cylinder editing dialogGravatar Linus Torvalds
This currently only does the same old things we used to do (so still no start/end pressure or trimix support), but despite that this is already more flexible than the old model: - we can now add new cylinders, rather than just edit the information of the first two cylinders of the dive - because the cylinder editing is being done in a edit dialog, it is now much more reasonable to use multiple lines and expand all the things we can edit. But to actually make this fully fledged, we'll need to add all the other info to the cylinder edit dialog, and probably add a confirmation dialog for the "delete cylinder" case too. Oh, and right now deleting a cylinder doesn't mark the dive info changed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Start hooking up the cylinder editing widgetGravatar Linus Torvalds
We don't actually fill the widget info correctly yet, nor do we take the actual size from the changes, but this starts to hook things up. Soon. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Add the ability to add new cylindersGravatar Linus Torvalds
This is totally useless since you cannot actually *edit* the resulting new dive yet, but we'll get there. And this already conceptually shows a capability that we didn't use to have with the old interface. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02cylinder list: set edit/delete button sensitivityGravatar Linus Torvalds
They are only sensitive when there is a cylinder selected. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Start re-organizing the cylinder entry in equipment.cGravatar Linus Torvalds
This leaves the actual editing code unconnected, so now you can only see the cylinder information, not actually edit it. However, with the big re-organization I really do want to have this as a half-way point where I have created the new cylinder tree-view. I now need to connect the "add/edit" buttons to dialogs that then use the editing widgets - so I've left that widget code around, because I'll be able to reuse a lot of it. Not all, but the cylinder type model code in particular will be re-used pretty much as-is. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-29Allow larger tanks (change maximum from 200 to 300 cuft)Gravatar Dirk Hohndel
We don't handle doubles any different than single tanks - so while 200 cuft was a sane maximum size for a tank, once you dive with doubles this logic fails. We may or may not decide to implement special handling for doubles at some point, but for now simply allow for tanks all the way up to double-150. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21Tracking changes to tanks is trivialGravatar Dirk Hohndel
That's the one I should have started with. 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-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-20Add "Apply"/"Cancel" buttons to dive equipment pageGravatar Linus Torvalds
It's too damn easy to make mistakes and not even notice them (odd gtk widget selection and keyboard input), or just start editing a cylinder thing and realize it was wrong. So instead of always saving the equipment information implicitly, add explicit "Apply" and "Cancel" buttons that save the information (or re-load it from the dive data structure) So now you need to press an extra button for your changes to *really* take effect. It can be a bit annoying, but it's better than the silent accidental equipment change that could happen before. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Separate the notion of creating the cylinder widgets from showing themGravatar Linus Torvalds
Now we always create the MAX_CYLINDER sets of cylinder widgets. But we don't actually pack them into the frame - that's a separate phase. Right now we still do the stupid "always just pack two cylinders" thing, but the idea is that we can pack just as many as the dive needs on a per-dive basis. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Make multiple cylinders actually workGravatar Linus Torvalds
This just always shows two cylinders, which is obviously bogus, but it's a good test-case for the multi-cylinder case. I need to figure out how to dynamically show the right number of cylinders, but that also involves the notion of adding a cylinder in order to fill out information that didn't use to exist. That's lower priority - now the infrastructure seems to be there. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13More work on abstracting the gtk cylinder widget thingGravatar Linus Torvalds
Ok, now we have an array of them, and most of the time we pass the right pointer back and forth. There's still a couple of places that hardcode "gtk_cylinder[0]" as the data, but by now they are mostly things that should iterate over all the cylinders. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Start abstracting out the cylinder equipment widgetsGravatar Linus Torvalds
Create a "struct cylinder_widget" so that when we handle multiple cylinders, we can match them up with the actual cylinder data; Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Always pack the widgets into boxes, not framesGravatar Linus Torvalds
Let's try to be consistent about this. Make the parent of each widget be a box. Maybe the frames come with boxes, but since I have no clue about gtk, I'm going to just always create them by hand. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13Add a checkbox for nitrox settingsGravatar Linus Torvalds
Grey out the nitrox value unless the user explicitly checks the checkbox. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11Pack all the equipment widgets into boxesGravatar Linus Torvalds
We really do want to "pack" them, rather than use up the whole size. I think. I may end up playing around more with this. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-10Add more static cylinder types - and pick them up from the dive logGravatar Linus Torvalds
This adds a few more predefined cylinder types to the static list, but perhaps more importantly, if we try to show a cylinder description that we haven't seen before, we automatically add that description to the list as well. This way, if people have their own cylinder types, our cylinder management will automatically figure them out and make it easy to enter them. NOTE! It might be best to add the new cylinder description at dive log load time, rather than at 'show' time. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-10Add new cylinder models to the cylinder model storeGravatar Linus Torvalds
We also need to actually fill the model store with the cylinder models we have in our dive lists to begin with. This makes it all *trivial* to add a new cylinder model: just use a new description, fill in the size and working pressure, and you're done. The type automatically gets filled in, unless that description already existed (in which case we leave it alone). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-10Let people manage their cylinders in cuft and psiGravatar Linus Torvalds
If the output units are set to cuft and psi, then we should show the cylinder size and pressure properly. NOTE! In the absense of pressure data, we *always* show the cylinder volume in liter. There's no way to convert it to imperial units, since the imperial units are not in physical size, but in air volume normalized to surface pressure.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-10Actually connect the cylinder configuration with the diveGravatar Linus Torvalds
It seems to be sufficiently useful to be worth updating the dive information now. This still doesn't handle multiple cylinders in any way. I need to think about the interface for that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09Getting closer to a usable cylinder management interfaceGravatar Linus Torvalds
Not quite there yet, though. And never mind multiple cylinders.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09First (broken) try at actually tracking cylinder typesGravatar Linus Torvalds
This doesn't actually change the cylinder type info in the dive, because it's too broken for that. Instead it prints out what it would change things to. The gtk2 notion of text input focus is *really* odd. Why is the cylinder type sometimes selected, and sometimes not? 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>