summaryrefslogtreecommitdiffstats
path: root/display-gtk.h
AgeCommit message (Collapse)Author
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>