summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
AgeCommit message (Collapse)Author
2013-05-03Remove the majority of the Gtk related codeGravatar Dirk Hohndel
- rip all Gtk code from qt-gui.cpp - don't compile Gtk specific files - don't link against Gtk libraries - don't compile modules we don't use at all (yet) - use #if USE_GTK_UI on the remaining files to disable Gtk related parts - disable the non-functional Cochran support while I'm at it Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-01Have some C++ file in the projectGravatar Alberto Mardegan
Rename gtk-gui.c to qt-gui.cpp, and make the necessary changes so that the project still builds. Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-03-26gtk-gui.c: Some small whitespace indentation fixesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Store the main window maximized state in the configurationGravatar Lubomir I. Ivanov
In save_window_geometry() use gdk_window_get_state() to retrieve the window maximized state and store it in the user configuration. Then in restore_window_geometry() restore the maximized state with gtk_window_maximize(), if needed. To achieve good results we also need to override "window-state-event" for the main window and define an extra couple of configuration parameters: "vpane_position_maximized" and "hpane_position_maximized". Then store two different pane states for maximized and restored window each time the user makes a switch. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-24Export dives to UDDF fileGravatar Miika Turkia
This patch implements exporting dives from Subsurface to UDDF format. Events and cylinder info are the most remarkable things still missing from the export. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19Make slider labels consistent in print dialogGravatar Dirk Hohndel
To make this easier I created a new helper function create_label that takes printf style arguments. I assumed this would be usable in many places but ended up finding just one other obvious use for it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Manually remove events in the profile context menuGravatar Dirk Hohndel
As logical extension of the ability to add bookmarks and gas changes this adds the ability to remove (any arbitrary) event that happens at the mouse position (specifically, that is within +/- six (scaled) pixels around the x-position (time) of the mouse). That's the same width that the triangle marker occupies which was moved to be centered around the event time in commit 5752e9742e86 ("Finetune event triangle position to have the top point at the event time"). Fixes #60 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Manually add bookmarks in the profile context menuGravatar Robert C. Helling
Use the infrastructure created for manually adding gas change events to also be able to add bookmarks. [Dirk Hohndel: This combines two commits for clarity. I also cleaned up the indentation and changed the code to no longer print the exact same text twice.] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17Manually add gas changes to a diveGravatar Dirk Hohndel
Create a little widget that lists all the gases / tanks we know about and allow the user to pick one of them. Turns out that add_event only added events at the end of the list - but we treat that list as chronologically sorted. So I fixed that little mis-feature as well. This does raise the question whether we need the inverse operation (removing a gas change). And if there are other things that we should be able to manually edit, now that we have the infrastructure for this neat little context menu... See #60 -- this doesn't address all of the issues mentioned there, but at least deals with the 'headline' of the feature request... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17First step towards a context menu in the profile viewGravatar Dirk Hohndel
This is completely bogus as all it does is print out the corresponding time for the spot we right-clicked on the profile. But that at least shows that the infrastructure is working as intended... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-09Bring back support for GTK versions pre 2.24Gravatar Lubomir I. Ivanov
The introduction of GtkComboBoxText usage for selecting a map provider, removed support for older versions of GTK on distros like Debian 6.0.4. Parent class (GtkComboBox) methods have to be used instead, around more pre-processor branching. This patch also fixes a small memory leak when retrieving text from said combo box. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08Reorganise view menus and file import.Gravatar Amit Chaudhuri
Move the view submenu to a top level location. Alter the wording of File|Import to drop XML qualifier; we import more formats than this. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-05Add .jlb and .udcf as supported file typesGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Limited support for Suunto DM4 importGravatar Miika Turkia
Basic functionality is implemented but at least support for multiple cylinders is missing. Event/alarm support is only partial. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Improve pane position saving codev3.0.2Gravatar Robert C. Helling
We should test for being in PANE_THREE mode in save_pane_position() and replace the if()'s testing against window geometry. This eliminates some code duplication and, more importantly, save_pane_position() is also called from save_window_geometry() whose calling pattern is not obvious. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Only store pane positions if we currently display "View Three"Gravatar Dirk Hohndel
We tried to detect this without needing a global variable but that clearly was too dependent on decorations that the window manager might add. This code works reliably. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Try to capture some more potential buffer overflows caused by localizationGravatar Dirk Hohndel
A couple of these could clearly cause a crash just like the one fixed by commit 00865f5a1e1a ("equipment.c: Fix potential buffer overflow in size_data_funct()"). One would append user input to fixed length buffer without checking. We were hardcoding the (correct) max path length in macos.c - replaced by the actual OS constant. But the vast majority are just extremely generous guesses how long localized strings could possibly be. Yes, this commit is likely leaning towards overkill. But we have now been bitten by buffer overflow crashes twice that were caused by localization, so I tried to go through all of the code and identify every possible buffer that could be affected by this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Fix pane position bugGravatar Robert C. Helling
Argh. Maxint is not at the bottom or at the right. We have to check against the size of the window to determine we are not saving a maximized position. Here is a fix. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03Fix ESC key handling in Save dialog.Gravatar Sergey Starosek
Closing unsaved dive raises Save dialog with Yes/No/Cancel buttons. Pressing ESC dismisses dialog without saving changes. This commit adds GTK_RESPONSE_DELETE_EVENT response code check in order to fix that behavior. Reported-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Save window pane positionsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Another unused variable warning when building without libosmgpsmap.Gravatar Cristian Ionescu-Idbohrn
gtk-gui.c: In function 'preferences_dialog': gtk-gui.c:670:30: warning: unused variable 'map_provider' [-Wunused-variable] Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-01Merge branch 'map-providers'Gravatar Dirk Hohndel
2013-03-01Make the map provider choice a preferenceGravatar Dirk Hohndel
Not all of the providers seem to work for me (Yahoo Satellite doesn't appear to give me any data), but for now I'll leave most of them in. We can later decide to offer only some of them. It might be more fun to be able to pick the provider directly from the map widget. But for now I kept this in the preferences which seemed to be a good place for it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-01Remember window pane positionsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-28Add MacOS support to window geometry save/restoreGravatar Henrik Brautaset Aronsen
Also make sure the config is flushed to disk. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-28Remember window sizeGravatar Amit Chaudhuri
This commit has gone through a few iterations and I trimmed it down to what I consider the "conservative minimum" - so this only stores window size, not window position. And in my mind that's the more relevant part, anyway. Have your window manager position the window at a "smart" spot on your screen... Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27Added back support for versions of GTK pre 2.24Gravatar Lubomir I. Ivanov
Some functions in combo_box_with_model_and_entry() are only available to GTK 2.24 and newer. This patch adds only one #if branch, but probably adds support to a number of outdated distributions, such as Debian 6.0.4 and Ubuntu 10.04. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27Add all dive computers to the device_info_listGravatar Dirk Hohndel
Calling set_dc_nickname() only added a new entry if there was a conflict with an existing one - which works fine if we are reading a file saved by Subsurface, as there the device_info_list is populated at parse time, but fails for data imported from other sources. Fixes #74 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26Generate/update a version.h header file.Gravatar Cristian Ionescu-Idbohrn
This is dedicated to Lubomir ;) Should work (tm). Not sure though if you want target 'gen_version_file' as a pre-requisite to $(NAME) or some other target. [Dirk Hohndel: minor adjustments to make it work with gtk-gui.c] Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-25Add link to user manual to Help menuGravatar Dirk Hohndel
Yes, we could try and bundle the user manual with the executables and open a local copy of it - but this seemed much easier and safer to do. It does, of course, add another string... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-25Show a "No Events" label when there are no events in the filter dialogGravatar Lubomir I. Ivanov
Uses profile.c:evn_foreach() to retrieve the number of events, which if zero, no table is added in the dialog and the label is added instead. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-25Don't use gtk_show_about_dialog() for the about dialogGravatar Lubomir I. Ivanov
There is a bug in GTK 2.2x where the links in the about dialog (and URI's in general) do not work on Windows. To solve that we add the OS specific method subsurface_launch_for_uri(). But to dispatch URI requests from the about dialog we need to set a hook either with gtk_about_dialog_set_url_hook() (which is deprecated from 2.24) or using signals like "activate-link". One problem with the "activate-link" signal thought is that we need to have a reference of an about dialog to pass to g_signal_connect(). So instead of using gtk_show_about_dialog() let's manage a dialog ourself with gtk_about_dialog_new(), gtk_dialog_run(), gtk_widget_destroy(). Other changes: - for GTK _bellow_ (but not including) 2.24 use gtk_about_dialog_set_url_hook() - use g_object_set() which is a convenient replacement for the varargs list in gtk_show_about_dialog() (also makes the diff smaller). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-25gtk-gui: Check if the GTK version is lower than 2.24 for the about dialogGravatar Lubomir I. Ivanov
The about dialog URI calls are broken on Windows, therefore we needed a way to override the default URI method. On versions bellow or equal to GTK 2.24 this is possible with gtk_about_dialog_set_url_hook(), which on the other hand is deprecated for newer GTK versions. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-23Remove substitute icons for Import and DownloadGravatar Dirk Hohndel
Apparently at least in Unity on Ubuntu 12.10 using those icons causes the default Menu text to be displayed (Back instead of Import). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-23Add uddf extension to file selector filterGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20info.c: add a method to clear all GtkListStore allocationsGravatar Lubomir I. Ivanov
Add a new method in info.c called info_widget_destroy(), which clears all GtkListStore instances. The method is exposed via display-gtk.h and called from gtk-gui.c:on_destroy(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20Change divelogs.de export file suffix from .ZIP to .DLDGravatar Henrik Brautaset Aronsen
As Rainer finished up the export function on divelogs.de, he used DLD as a suffix instead. Suggested-by: Rainer Mohr <mail@divelogs.de> Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20Add unzip support to divelogs.de exportsGravatar Henrik Brautaset Aronsen
Finalize divelog.de import, used with Miiko's divelog.de xslt transform Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-19Obviate the need for explicit 'remember_tree_state/restore_tree_state' callsGravatar Linus Torvalds
Instead, just keep track of the expanded state of trips as we get the gtk callbacks for the state changes (which we need to track anyway for the selection logic), and automatically restore the state whenever we re-create the divelist. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-19Remember pre-existing trip expansion state when autogroupingGravatar Linus Torvalds
This just adds the "remember_tree_state()" and "restore_tree_state()" calls around the divelist update when autogrouping is turned on: that way existing expanded groups aren't blindly collapsed. It makes it much easier to see what autogrouping does if it only groups a few dives, because the overall state of the divelist isn't radically changed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12Include SDE files on file selectorGravatar Miika Turkia
Include SDE files on the file selectors if zip support is enabled. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-07Use GDK methods to retrieve the actual screen DPIGravatar Lubomir I. Ivanov
gtk-gui.c: + added the method get_screen_dpi() that uses a simple formula to retrieve the actual screen DPI display.h: + use get_screen_dpi() in the SCALE_PRINT macro Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-02Move about icon to include fileGravatar Henrik Brautaset Aronsen
Getting the about icon to display in various scenarios on MacOSX was a pain. Moving the icon to an include file solved the problem. This commit also fixes the problem Dirk was having when converting satellite.svg to a png in commit cf3c0266c2. I couldn't quite get ImageMagick to preserve transparency and color when converting subsurface-icon.svg, though, so I used Gimp instead. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2013-02-01Clear yearly statistics when closing data fileGravatar Dirk Hohndel
Another oversight of what needed to be done when cleaning up the UI after closing the data file. Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01Clear the list of events when closing data fileGravatar Dirk Hohndel
When the data file is closed we should reset the events that we offer for filtering. Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01Turn off tooltips if no dives are selectedGravatar Dirk Hohndel
We already clear the widgets but forgot to turn off the tooltips as well. Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31Add tooltip that tells user how to edit dive informationGravatar Dirk Hohndel
This adds the tooltip just to the Dive Notes page of the notebook area - that's where people are tempted to try to do "edit in-place" which we currently don't support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30Properly destroy the cairo context when we're done with itGravatar Linus Torvalds
Henrik reports that on OSX, not destroying the cairo context results in a corrupted profile display. It seems to just leak memory on Linux. For gtk3, the cairo context is embedded in the GtkDrawable, for gtk2 we need to create and destroy it appropriately. Although maybe we could just make it static instead of creating/destroying it all the time. Anyway, this goes back to the old cairo destroy logic for gtk2. Reported-and-analyzed-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30Massive cleanupGravatar Dirk Hohndel
Mostly coding style and whitespace changes plus making lots of functions static that have no need to be extern. This also helped find a bit of code that is actually no longer used. This should have absolutely no functional impact - all changes should be purely cosmetic. But it removes a bunch of lines of code and makes the rest easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30Show Gradient Factors in plot when showing calculated ceilingsGravatar Dirk Hohndel
This adds the GFlow/high values used to calculate the ceiling (if any). Right now it shows those numbers even if at no point of the dive there was an actual ceiling (but only if showing the ceiling itself is enabled). This should make it easier to for the user to make sense of the calculated ceiling, especially if posting screen shots. As an aside - for some dive computers like the OSTC and the Shearwaters we should be able to also plot the GF used by its calculation which might be interesting for comparison purposes, as both of them also give us the ceiling (lowest deco stop) calculated during the dive.. See #13 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>