summaryrefslogtreecommitdiffstats
path: root/gps.c
AgeCommit message (Collapse)Author
2013-01-28GPS location map inputGravatar Lubomir I. Ivanov
On 28 January 2013 23:26, Dirk Hohndel <dirk@hohndel.org> wrote: > > Just pushed out Linus' Gtk3 readiness changes plus my change that allows > the user to not only type in GPS coordinates but also use a map widget > to pick the dive site. > > There were a few very odd Gtk things going on - when I opened the map > widget from the dive info dialog (by clicking the button), the widget > would be completely unresponsive. No panning, no zooming, no > right-click, nothing. > > Opening an equipent widget and immideately closing it again suddenly > made the map widget responsive. WTF? > > I worked around this by doing an explicit grab in the map widget, but > that seems like a hack and just to work around the underlying issue. > > If anyone can figure this out, patches welcome. > > The other shortcomings (besides the uglyness of the UI) are that it may > be non-obvious to the user that it takes a right click to get a menu > item that allows you to "mark location here" - I'm sure there's a more > intuitive way to do this, but since left click is used for panning, this > was the best idea I could come up with... > > Please test - I wouldn't be surprised if there are a few bugs still > hidden in this code. > here an fix to make this work on win32 and also solve a potential issue of type: (subsurface.bin:19441): Gtk-CRITICAL **: IA__gtk_entry_set_text: assertion `GTK_IS_ENTRY (entry)' failed my commit message is explicit on the reasons: ------------------------ When called from the "dive edit" dialog the, map windows seems inactive on Windows. It cannot accept focus and is also behind all other application windows. There are a couple of important new calls in gps.c:show_map(): gtk_window_set_transient_for(GTK_WINDOW(*window), GTK_WINDOW(main_window)); (^ docs say gtk "may" call this one for us, on what condition - not specified) gtk_window_set_modal(GTK_WINDOW(*window), TRUE); (^ broken on ubuntu 12.04, but needed on Win32)) Making the window transient for the main window and also modal for the entire application's window stack (or at least try). Older versions of gtk+2 and also in the most recently tested libgtk2.0-0 2.24.10-0ubuntu6, seem not to recognize the significance of gtk_window_set_modal() and the call does not work as expected. This forces us to check if the dialog from which the call originated exists, since its possible to close it _while_ the map widget is active. More specifically, we check in info.c if the location_update.entry pointer was set to NULL before performing actions with in the update_gps_entry() callback. ------------------------ also removed the gtk_window_present() call as it seemed redundant post these changes (?). ------- on a side note: looks like i'm above 100 commits... cheers everyone <has a sip of some late beer> :0 ~ c|_| lubomir -- From fe9967c7ad2ec3b93ad336c2c6bed492a5ad0d8b Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" <neolit123@gmail.com> Date: Tue, 29 Jan 2013 00:24:21 +0200 Subject: [PATCH] Fix a "stacking" issue with the map-window on Windows When called from the "dive edit" dialog the, map windows seems inactive on Windows. It cannot accept focus and is also behind all other application windows. There are a couple of important new calls in gps.c:show_map(): gtk_window_set_transient_for(GTK_WINDOW(*window), GTK_WINDOW(main_window)); (^ docs say gtk "may" call this one for us, on what condition - not specified) gtk_window_set_modal(GTK_WINDOW(*window), TRUE); (^ broken on ubuntu 12.04, but needed on Win32)) Making the window transient for the main window and also modal for the entire application's window stack (or at least try). Older versions of gtk+2 and also in the most recently tested libgtk2.0-0 2.24.10-0ubuntu6, seem not to recognize the significance of gtk_window_set_modal() and the call does not work as expected. This forces us to check if the dialog from which the call originated exists, since its possible to close it _while_ the map widget is active. More specifically, we check in info.c if the location_update.entry pointer was set to NULL before performing actions with in the update_gps_entry() callback. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-28Merge branch 'gps-map-input'Gravatar Dirk Hohndel
Add ability to pick GPS coordinates of dive locations from a map widget.
2013-01-28Pick GPS coordinates of dive location via map widgetGravatar Dirk Hohndel
I have some concerns about the way this is implemented - especially the use of gtk_grab_add to make the map widget work has me worried. But it seems to work and survived some test cases that I threw at it. The GtkButton with the Pixmap looks a little off on my screen, but this way it was easy to implement. Feel free to come up with a better design. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-28Make subsurface compile with -DGSEAL_ENABLEGravatar Linus Torvalds
This forces us to use the proper gtk accessor functions. It may not be worth it if people actually do the Qt conversion, but if we want to try gtk3 at some point, this might help. This all came about because I was trying to explain on G+ what an immense pain this all was to even figure out, if you don't actually know gtk at all. Google and the gtk migration guide are almost useless, and the gtk2 documentation itself actually uses the fields directly without any accessor functions in several places. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-27Fix the zooming bug in the map windowGravatar Dirk Hohndel
There are more events than scroll_up and scroll_down - and because of this we could end up with target_lat and target_lon being uninitialized. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-27Modify map zoom to keep the point under the mouse cursor constantGravatar Robert C. Helling
The idea is that while zooming the map the point under the mouse would stay as close to constant as possible (given that we use integer coordinates). This version uses some algebra to figure out the correct new parameters for the mercator projection used in osm-gps-map. Occasionally (and we haven't figured out what triggers it) zooming out suddenly resets your position to 0,0. [Dirk Hohndel: switched this to using the correct interface to get the object properties and did some serious whitespace cleanup] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Use proper helper functions for dive location and for_each_diveGravatar Linus Torvalds
This makes the code use the "dive_has_location()" function rather than check the longitude and latitude directly. It also uses "for_each_dive()" rather than open-coding it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20White space and coding style adjustments for gps.cGravatar Dirk Hohndel
It's just nicer this way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Fix map scrollingGravatar Dirk Hohndel
The osm-gps-map default is to scroll-and-recenter around the mouse position. That is BAT SHIT CRAZY. So this implements our own scroll handling instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Reuse map windowsGravatar Dirk Hohndel
Instead of opening a new window / new map for every dive site we now have only two windows / maps. One for the overview of all the dive sites, the other one that is used to show the map for a specific dive site. This also switches the position preference from CENTER to MOUSE - this way it's less likely that the two map windows will be drawn exactly on top of each other. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Show single dives in map.Gravatar Henrik Brautaset Aronsen
This adds a "Show in map" entry in the dive list context menu. It will zoom to the dive location if it exists, otherwise the full map will be displayed. I've also switched map tiles from OpenStreetMap to Google Maps just to show off that we can. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-14Use the legacy GDK keyboard definitions in gps.cGravatar Lubomir I. Ivanov
display-gtk.h has a check if gdkkeysyms-compat.h or gdkkeysyms.h has to be used. In gps.c, from such as "GDK_Up" has to be used, so that this file compiles on older GTK. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Work on a dive localisation tool using GPS coordinatesGravatar Pierre-Yves Chibon
For each dive recorded, place their GPS coordinates onto a map using the OSM-GPS-MAP library. This map is accessible via the "log" menu or the shortcut ctrl+M (M as map). We check for the GPS coordinates "0, 0" which are the default when we do not have real GPS coordinates set. [Dirk Hohndel: fixed int/float math confusion, fixed some whitespace and coding style issues, cleaned up some comments, added a missing cast to prevent a compiler warning] Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>