summaryrefslogtreecommitdiffstats
path: root/display-gtk.h
AgeCommit message (Collapse)Author
2012-11-30Convert Uemis downloader to directly create divesGravatar Dirk Hohndel
The initial downloader reused the XML parsing of SDA files that was implemented early in order to support the information extracted from the SDA with the java applet. But creating this intermediary XML file and handing it off to the XML import function always seemed like an ugly way to do things. This became even more obvious when adding more features to the Uemis downloader. This commit completely changes the downloader to instead create dives and record them directly. This also adds support for divespots (which are stored in a seperate database that needs to be queried after the divelog and dive entries have been combined - the Uemis firmware clearly was written by monkeys on crack - oh wait: I'm trusting these same people to get the deco right?). This commit leaves the SDA import capability in the XML parser intact. I'll remove that later. Because of this it actually adds a few lines of code, but the overall change will be a substantial code deletion. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-28Track Uemis last dive downloaded on a per data-file basisGravatar Dirk Hohndel
Actually, it's even better than that. Thanks to the new divecomputer datastructure we can now simply look up in the dive_table which dives have been downloaded from this specific Uemis SDA. This patch removes the old gconf based code - which leads to one unfortunate problem: the first time a Uemis SDA owner runs this version of Subsurface against their data file ALL dives will be downloaded again (which may not be a bad thing as we have improved a few other details of Uemis support so now they get their deco information, surface pressure and other data that we have started to support since 2.1). Still, this is not ideal. But I didn't want to keep the legacy code around since this new solution is so much cleaner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-20Allow the user to cancel a dive computer downloadGravatar Dirk Hohndel
The code pretended to support this for libdivecomputer based downloads, but it had never been hooked up when the native Uemis downloader was implemented. When I finally decided to close that feature gap I realized that the original code was, shall we say, "aspirational" or "completely bogus" and therefore never worked. So instead of just hooking up the code for the Uemis downloader I instead implemented this correctly for the first time for both libdivecomputer and the native Uemis downloader. In order not to have to mess with multithreaded Gtk development I simply opted for a helper function that fires on a 100ms timeout and have it end the dialog without a response. This way we can run the dialog while waiting for the download to finish, still update the progress bar and respond in a useful manner to the user clicking cancel. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Add special download modes to force updates from the divecomputerGravatar Dirk Hohndel
This will hopefully not be something we need often, but if we improve support for a divecomputer (either in libdivecomputer or in our native Uemis code or even in the way we handle (and potentially discard) events), then it is extremely useful to be able to say "re-download things from the divecomputer and for things that were not edited in Subsurface, don't try to merge the data (which gives BAD results if for example you fixed a bug in the depth calculation in libdivecomputer) but instead simply take the samples, the events and some of the other unedited data straight from the download". This commit implements just that - a "force download" checkbox in the download dialog that makes us reimport all dives from the dive computer, even the ones we already have, and an "always prefer downloaded dive" checkbox that then tells Subsurface not to merge but simply to take the data from the downloaded dive - without overwriting the things we have already edited in Subsurface (like location, buddy, equipment, etc). This, as a precaution, refuses to merge dives that don't have identical start times. So if you have edited the date / time of a dive or if you have previously merged your dive with a different dive computer (and therefore modified samples and events) you are out of luck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-10Add threshold feature for partial pressure graphsGravatar Dirk Hohndel
The tec diving preference pane now allows us to set a partial pressure threshold for each of the three gases. When the partial pressure surpasses that value, the graph becomes red. Fixes #12 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-01Add vertical space to depth plot if we are showing partial pressure graphsGravatar Dirk Hohndel
Fairly simplistic change that modifies the way we calculate the "maxdepth" for a particular dive as that is used to scale the plot vertically. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-01Change preferences into a notebook and add second page for tec settingsGravatar Dirk Hohndel
Not sure this is the best naming scheme (General Settings / Tec Settings) but it's a start. The idea is to have the settings that a recreational diver might care about on the first page, and all the other stuff on the second one. Let's see how this works out long term. For now I moved OTU over and added toggles for the different partial pressure graphs (only the pO2 one is implemented so far). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-01First stab at plotting a pO2 graphGravatar Dirk Hohndel
So far this is done unconditionally. This already starts some of the infrastructure for other gases, but so far only O2 is handled. We also need a pressure scale on the right to make this useful - or we need to do peek / trough pressure prints like we do for temperature and depth. Finally, I think I want to move the plot further down, maybe make the whole plot area taller if we are plotting partial gas pressures as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-27Improve the dive computer device selectionGravatar Dirk Hohndel
We try to identify devices that are connected and their matching device names (and mount paths in the case of the Uemis Zurich). Those are presented as a drop down menu to choose from. The user can still override this by simply entering a different device / path name. On Windows this is not functional. How do I find out which drive letter corresponds to the USB device named "UEMISSDA"? Similarly we need code that finds serial ports that are present. For now we once again default to COM3 (so this isn't a step back, but of course it's far from what we want). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01Destroy the divelist (tree) before calling gtk_main_quit()Gravatar Lubomir I. Ivanov
Added new function dive_list_destroy() in divelist.c Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-26First implementation of native Uemis downloaderGravatar Dirk Hohndel
This includes one major hack that uses a private data structure from libdivecomputer to allow us to show the Uemis Zurich as one computer the user can import from. Once the user has chosen the Uemis we don't use libdivecomputer but our own downloader. Just like in the libdicecomputer case this runs in its own thread and updates the import dialog with progress information. The code also keeps track of the last dive that has been downloaded from a Uemis computer so we only import new dives on subsequent downloads. And since the Uemis Zurich gives us its device id, we make this a "per divecomputer" property for people who dive with multiple Uemis Zurich computers. This uses the debugfile infrastructure to allow easily collecting debugging output - especially on Windows where by default console output is lost. Known limitations: when the Uemis runs out of space (it uses its filesystem for communication with the host computer) we have no graceful way to reset things. This is why the code doesn't try to download ALL dives on the computer but instead download them in increments of ten dives. This clearly needs to be addressed once I understand how to reset the device. The Cancel button of the import dialog isn't correctly hooked up, yet. I still need to figure out how to gracefully shut down a download without potentially hanging the device. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-21Activate the new separate "Import XML File" functionalityGravatar Lubomir I. Ivanov
Renamed the function pick_import_files() to import_files() and added a declaration in "display-gtk.h". The declaration is "extern" for consistency with download_dialog(). Since the new dialog is a real child off "main_window", we no longer need some of the calls to gtk_widget_set_sensitive(), gtk_window_set_decorated() to disable the parent, which previously was the old "Import" combined dialog. Once the file list is retrieved, attempt to import each file and update the list via report_dives(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Minor changes to file select box title Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-21Remove the XML file selection from the DC download dialogGravatar Lubomir I. Ivanov
Renamed "import_dialog" to "download_dialog" and also focused the download dialog strictly on dive computer functionality. Removed the file button and "filenames" checks from "download_dialog". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2012-09-12Make sure Subsurface receives Quit / Command-Q callback on MacGravatar Dirk Hohndel
As usual, things work slightly different on Mac. Quartz delivers some (but not all) accelerator notifications differently. Command-Q and Subsurface->Quit now work on Mac as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-09First cut of adding a default file nameGravatar Dirk Hohndel
The default file name is OS specific and tries to follow the customs on each of the OSs. It can be configured through the preferences dialog. On MacOS we get a strange warning which appears to be a well documented Gtk bug on MacOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-28Work on the printing of the dives, first attempt to print as table.Gravatar Pierre-Yves Chibon
With this commit, the user can choose between two printing modes: - pretty print (with or without the dive profile) - table print (which is nothing less than a table formating containing the information) Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-27Start re-working the print UI to allow printing tables with no profiles.Gravatar Pierre-Yves Chibon
With this commit we add a checkbox in the "Dive details" tab of the print window. This checkbox allows to print the dives profile or not. If you don't print the dives profile, you get 15 dives on the page (instead of 6 with the profiles). Future work should include: - Ability to choose what is printed - Table layout vs the current one (if no dives profile) - Ability to choose the number of dives per page (play with the font size for this) Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-20Rework dive selection logicGravatar Linus Torvalds
This completely changes how we keep track of selected dives: instead of having an array listing the selection ("selectiontracker") or trusting the gtk selection information, just save the information about whether a dive is selected in the dive itself. That makes it trivial to keep track of the state of selection across group collapse/expand events, or when changing the tree view model. It also ends up simplifying the code and logic in other ways. HOWEVER, it does currently (re-)introduce an annoying oddity with gtk: if you collapse a dive trip that has individual selections, gtk will forget those selections ("out of sight, out of mind"), and when you do *new* selections, the old hidden ones remain. So there's some games required to make gtk do sane things. We may need to either explicitly drop selections when collapsing trips, or make sure the group entry gets selected when collapsing a group that has selections in it. Or something. There may be other issues introduced by this too. 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-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-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-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-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-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-05-02Show dive import text updates in the progress barGravatar Linus Torvalds
Instead of using printf() to print the string updates ("Parsing sample data" etc), introduce a function to show those strings in the graphical progress bar itself. Subsurface hasn't been a text-mode application in a long time ;) This partially fixes the second todo entry from commit b0ba22a06879 ("Show dive import error messages in the import dialog") and generally makes for a more helpful import - at least for the largely error-free cases. Sadly, the messages that really come from within libdivecomputer itself (like "suunto_vyper2.c:193: Failed to receive the answer.") when things go really wrong are not caught. libdivecomputer does have a notion of a logfile (set with "message_set_logfile()"), but that ends up being really inconvenient. Maybe we could use some pipe setup or something. Oh well. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Don't close config file when changing preferencesGravatar Linus Torvalds
On Linux and MacOS the subsurface_close_conf() doesn't really close the config file (it flushes writes on MacOS), but on Windows it does actually close the registry hkey. Which is bad, if you change the settings multiple times - we assume that the config file is open the whole time. So add a "subsurface_flush_conf()" function, and call *that* when changing configuration parameters. And call the close function only at the very end. Alternatively, maybe we should just open the config file separately every time. I don't much care, maybe somebody else does. 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-15Create separate single dive and total stats pagesGravatar Dirk Hohndel
No additional statistics added, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-03More Mac improvementsGravatar Henrik Brautaset Aronsen
The startup shell script workaround isn't needed anymore. The preferences hotkey didn't work. Remove left-over menu separators. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2012-01-03Even more Mac-i-nessGravatar Dirk Hohndel
Move the About and Preferences menu item to the App menu. Switch the accelerator key to be Meta (i.e., Command) instead of Control This required a bit of restructuring of the code, but it's all for a good cause. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-01Turn subsurface into a real Mac applicationGravatar Dirk Hohndel
To do this a few things needed to move into the os specific files, but the overall change is fairly small and the difference on the Mac is amazing. Subsurface now becomes a Mac app with Mac toolbar and useful default fonts. Changed the CFBundleIdentifier to be the reverse DNS of the subsurface site (sadly, 'torvalds' is not yet a TLD). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-28Make icon file name OS helper functionGravatar Dirk Hohndel
This way we can load the correct icon on the Mac without ugly hacks in the OS independent code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-13Add reasonable default device names for divecomputer importGravatar Dirk Hohndel
So far we hard coded /dev/ttyUSB0 - which is a good starting point in Linux but not so useful on Windows or MacOS. This was now moved into one of our OS helper functions with (somewhat) reasonable defaults. Signed-off-by: Dirk Hohndel <dirk@hohndel.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 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-11-24Split reading/writing preferences into OS specific filesGravatar Dirk Hohndel
This adds tested code for Linux and Mac OS, implementing the api that Linus suggested. The Windows code was moved into its own file, but hasn't even been compile tested, yet. In order to have just one interface to set or get a preference value we encode TRUE as (void *) 1 and FALSE as NULL. This works consistently on all platforms and regardless of whether we have 32 or 64 bit. 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-02Add Info & Stats page to the notebookGravatar Dirk Hohndel
This provides the relevant information for the currently selected dive plus a bunch of statistics over all dives in the dive_table. The visual design has lots of room for improvement - right now the different fields change size - it might be nice to have a more modern look for the entries - the O2/He field is odd - for most divers the He value will always be 0, so maybe we should only show He if there's at least one dive that uses He? Also, we simply do a comma separated list of gases for all the tanks used 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-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-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>