summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
AgeCommit message (Collapse)Author
2012-12-11Merge branch 'cns' into cns-mergeGravatar Dirk Hohndel
I foolishly changed visible_columns in both the (ill-named) cns branch and master... Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: divelist.c gtk-gui.c profile.c
2012-12-10Display maximum CNS in the divelistGravatar Dirk Hohndel
We either pick the CNS reported by the dive computer at the end of the dive, or the maximum of that and the CNS values in the samples, if any. As usual, this column in the dive list defaults to off and it is controlled by a setting in the tec page of the preferences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-10Fix incorrect index for dive computer listGravatar Dirk Hohndel
I don't understand how this ever worked... Fixes ticket 32 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-10Don't draw tooltips if no profile is displayedGravatar Dirk Hohndel
This fixes ticket 33 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-10Apply preference changes right awayGravatar Dirk Hohndel
This allows you to open the preference dialog, play with settings and see their effect right away. Press OK and you keep them, press Cancel and you are back to the previous state. As it should be. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-10Move global variables covered by Preferences into one structureGravatar Dirk Hohndel
Now we can simply remember the state of all the preferences at the beginning of preferences_dialog() and restore them if the user presses 'Cancel'. Fixes #21 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-09Consistent Quit behavior on the MacGravatar Dirk Hohndel
We were responding to the wrong Quit signal on MacOS. The one we picked was the one that basically told us "it's too late to stop me, I'm quitting". I switched this to the one asking "should I prevent the app from quitting" and now we can indeed cancel the Quit, regardless which method was used to close the app. Also removes to unused variables. Fixes #22 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-08Make changes to some of the preference immediately visibleGravatar Dirk Hohndel
This is just a small part of the solution to the bigger problem with the preferences. See ticket 21 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-07Fix off by one errorGravatar Dirk Hohndel
We increment i twice - which causes us to access memory past the end of the allocated array. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-07Fix embarrassing cut and paste bugsGravatar Dirk Hohndel
The previous commit 871d7ae0cdf5 "Add option to make ceiling visually stand out more in the profile" contained not one but two stupid cut and paste bugs. I cannot begin to explain how this could have worked when I first tested it. Reported-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-07Add option to make ceiling visually stand out more in the profileGravatar Dirk Hohndel
While having the background "come down" seemed like a good visualization of the ceiling, some divers appear to prefer something more dramatic. This adds an option to the Tec Settings to have the ceiling shown in red instead of the default background color. Suggested-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-07Sort the divecomputers alphabetically and have fixed width dropdownGravatar Dirk Hohndel
Instead of just taking the vendors and products for the supported divecomputers in the order libdivecomputer provides them to us we sort them as we add them to our list of lists. While doing this we also track the longest product name and try to make sure that the combobox for the product is set to a fixed width that's wider then the longest product name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-05Prevent crash when no default device is setGravatar Dirk Hohndel
We were dereferencing the default device, even if not set. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-05Split dive computer selection into seperate vendor and product combo boxesGravatar Dirk Hohndel
The length of that combo box got increasingly insane as libdivecomputer supported more and more models. To make this more scalable we now have two combo boxes. One with just the vendors and a second one with the products depending on the vendor selected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-04Improve deco handling and add NDL supportGravatar Dirk Hohndel
This commit changes the code that was recently introduced to deal with deco ceilings. Instead of handling these through events we now store the ceiling (which in reality is the deepest deco stop with all known dive computers) and the stop time at that ceiling in the samples. This also adds support for NDL (non stop dive limit) which both dive computers that appear to give us ceiling / deco information appear to give us as well (when the diver isn't in deco). If the mouse hovers over the profile we now add support for displaying the NDL, the current deco obligation and (if we are able to tell from the data) whether we are at a safety stop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-30Remove the ability to import Uemis SDA filesGravatar Dirk Hohndel
The downloader has been integrated into Subsurface for a while and with the recent change to no longer have it create the old style SDA files as intermediary format there is no need anymore to support that format in the XML parser. This deletes almost 300 lines of code. Yay! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-26Clarify (and fix) dive trip auto-generationGravatar Linus Torvalds
This makes the dive trip auto-generation a separate pass from the showing of the dive trips, which makes things much more understandable. It simplifies the code a lot too, because it's much more natural to generate the automatic trip data by walking the dives from oldest to newest (while the tree model wants to walk the other way). It gets rid of the most annoying part of using the gtk tree model for dive trip management, but some still remains. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-21Fix "prefer download" behaviorGravatar Dirk Hohndel
When this was first implemented the assumption was that a downloaded dive that is to be merged with an existing dive would have the same time stamp. But as Linus pointed out even back then, this does fail if a dive has been merged with a download from a different dive computer before (think: download from computer a, then download same dive from b, then improve something in the parsing from computer a and try to redownload; the time stamp could have changed). This commit also fixes a silly omission in the merge_dives() function (which ended up ALWAYS prefering the downloaded dive) and finally implements the necessary changes to mark dives downloaded from a Uemis SDA as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-21Make sure there are no invisible selected dives after import / downloadGravatar Dirk Hohndel
Prior to this commit, gtk often decided to collapse the trip with the selected dive after the user imported or downloaded additional dives. Since Subsurface tracks dives as being selected even after gtk collapses a trip (which clears all selection state as far as gtk is concerned) this could lead to the strange situation that the user could click on a new dive to select it without unselecting the already selected dive - and suddenly edit or delete did things that were entirely unwanted. With this change we explicitly save and then restore the tree state around import and download operations. This ensures that the same dive(s) stay selected and trips stay expanded and therefore avoids the issues described here. 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-19Clear 'force' flag when retrying downloadGravatar Dirk Hohndel
This may seem like an esoteric corner case, but it will actually happen reliably when re-downloading dives from the Uemis SDA: If the user selects "Force downloada of all dives" in the "Download from divecomputer" dialog and if the SDA runs out of space and needs to be unmounted and remounted, then for the 'Retry' the 'force' flag should be cleared - or the user will once again start from the first dive which almost certainly is not what they expect. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19Tweaks to the Uemis debugging codeGravatar Dirk Hohndel
Make it less verbose to make it easier to follow the progress along. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19Mark divelist changed when downloading from Uemis SDAGravatar Dirk Hohndel
This mirrors commit 59929fdb5d2a "Mark divelist changed as we download dives from a dive computer" which only fixed things for the libdivecomputer case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12Add support for zooming using the scroll-wheelGravatar Linus Torvalds
This allows zooming in with the scroll-wheel if you have one (or the two-finger scrolling on a touchpad). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Make the "click-to-zoom" use a 2.5x zoom factorGravatar Linus Torvalds
I think I prefer the 2.5x zoom over the pure doubling. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Add more data to our tool-tip display in the profile windowGravatar Dirk Hohndel
This shows the values for all the graphs that are shown (depth, temperature, tank pressure, pO2, pN2m pHe), but also correctly doesn't display them when they are turned off or no data is available (prior to this commit, tank pressure was always shown, even if no pressure samples were available for the dive). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Zoom with left mouse buttonGravatar Dirk Hohndel
Linus convinced me that I was wrong to modify his commit 24690ce35f81 "Initial not-so-pretty profile zoom support" and so this changes it back to use the left mouse button for zooming. It turns out that on some touchpads there's a very nice way to hold down the click with one finger and then pan with another finger, but that does not work if you do a two finger click (and use one of those or a third to pan). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Create tool-tip with depth/pressure for the whole profile areaGravatar Linus Torvalds
This extends on our current tooltip logic (which shows events when you mouse over them) to show tooltips for the whole profile area. If you mouse over an event, that is still shown in the tooltip, but even in the absense of events, the tooltip will be active, and mousing over the profile area will show the time, depth and pressure. This can certainly be improved upon further, but even in this form it is useful. Fixes #9 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 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-11Initial not-so-pretty profile zoom supportGravatar Linus Torvalds
You can press the left mouse-button on the profile and drag the mouse around to zoom in on a specific area. Releasing the mouse button unzooms. Yeah, everybody wants rubber-banding, but I have reached the end of my willingness to fight gtk for more details. Some day. [Dirk Hohndel: changed this to use the right mouse button instead of the left which seemed just terribly unnatural] References ticket 9 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 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-10Fix default filename handling errorsGravatar Linus Torvalds
The default filename handling is broken in two different ways: (a) if we start subsurface with a non-existing file, we warn about the inability to read that file, and then we exit without setting the default filename. This is broken because it means that if the user (perhaps by mistake, by pressing ^S) now saves the file, he will overwrite the default filename, even though that was *not* the file we read, and *not* the file that subsurface was started with. So just set the default filename even for a failed file open. The exact same logic is true of a failed parse of an XML file that we successfully opened. We do *not* want to leave the old default filename in place just because the XML parsing failed, and possibly then overwriting some file that was never involved with that failure in the first place. So just get rid of all the logic to push the filename saving into the XML parsing layer, it has zero relevance at that point. (b) if we do replace the default filename with a NULL file, we need to set that even if we cannot do a strdup() on the NULL. This fixes both errors. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-10Improve logic handling eventsGravatar Dirk Hohndel
We now throw away redundant events, just as we throw away other redundant data coming from the dive computer. Events are considered redundant if they are less than 61 seconds apart and identical. This also improves the display of the remaining events in the profile as we now show the value of the event, if it is present (for example for a deco event we show the duration of the deepest stop). Finally, for events that define a range (so they set the beginning flag and assume and end flag some time later) we no loger show the triangle but assume that some other code handles visualizing them (as happens for the ceiling events). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-06Merge branch 'po2'Gravatar Dirk Hohndel
Plotting pO2 / pN2 / PHe
2012-11-05Fix incorrect variable reuse bug in preferences dialogGravatar Dirk Hohndel
This was introduced in commit ee803ef5d85b "Change preferences into a notebook and add second page for tec settings" In order to be able to get the new default XML file name back from the button, we need to keep that variable around and not overwrite it with more buttons for the tec preferences page. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-05Prevent UI errors while the the import thread is runningGravatar Lubomir I. Ivanov
While the import thread is running it is possible to: 1) click the [x] button of the "download dialog". To prevent that, we attach a "delete-event" signal to no-op function. 2) to interact with the main window, once the "accept" event is triggered. To prevent that, we make sure that the window is set back to "modal". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-05Trim the device name in the download dialog, if necessaryGravatar Lubomir I. Ivanov
On Windows, device names can end up being <drive-letter> (<drive-label>). In such a case we are only interested in the <drive-letter> part, when passing this value to libdivecomputer. This patch provides a method to trim all text in parentheses and also any leading and trailing whitespace. An important addition is enabling back the user to enter a device manually even it's absent in the combo box list. This device is then stored and retrieved as the default device, but not stored in the device list (dc_device_selector()). As a side effect this change prevents the download dialog closing, when a user-entered device is not one of the found devices via subsurface_fill_device_list(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> 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-10-31Merge branch 'dc-device-selector'Gravatar Dirk Hohndel
Bring the device selector (when downloading from a dive computer) into master.
2012-10-29Add depth scale to the dive profileGravatar Dirk Hohndel
This is intended to be unobtrusive, but add more information for people who aren't satisfied with the numeric value we put inside the plot to mark local peaks and troughs. See ticket #9 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-25Missing white-space in Select Events titleGravatar Stéphane Raimbault
Signed-off-by: Stéphane Raimbault <stephane.raimbault@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-21Hopefully the last update to the po files before the releaseGravatar Dirk Hohndel
This one breaks with my preference to separate generated changes from content changes - I wanted to get the new comment next to the translator-credits text that I added to every .po file. This way the people who worked on these translations at least get shown in the About box. But a simple grep on the diff will show you that this is indeed the only set of changes that I made. git diff HEAD^ | grep ^+ | grep -v -e^+# -e^+++ -ePOT-Creation Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-21Mark menu entries that open another dialog with "..."Gravatar Dirk Hohndel
This is a very common standard in desktop programs - if a menu entry immediately causes an action (like Close or New or Toggle Autogroup) then it doesn't have the "..."; others that open a secondary dialog (like Open or Import / Download) are marked with "...". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-20Improved About dialogGravatar Dirk Hohndel
Add a link to the GPL, a link to the homepage, an opportunity for the translator to be listed (this requires the translations to translate the phrase "translator-credits" with the names of the translators - kinda nifty). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-19Use subsurface_os_feature_available() to check for unicode stars supportGravatar Lubomir I. Ivanov
Mainly affecting older Windows (such as XP), which do not have a more fully featured unicode fonts installed, such as Arial Unicode MS. With this patch we do a runtime check of the OS version in a couple of places and if the OS is old, we use the asterix character and spaces instead of the unicode star characters. Linux and OSX should be unaffected by this change unless subsurface_os_feature_available() returns FALSE for UTF8_FONT_WITH_STARS at some point. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16Fix another bug where we make assumptions about the length of a stringGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11Make translations of menu entries explicitGravatar Dirk Hohndel
It appears that at least for Norwegian the translations of the stock menu entries was missing. This patch adds those as explicit strings and merges those new strings into the .po files. The translations need to be updated in separate commits. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>