#include "background.h"
#include "acquire.h"
#include "datasources.h"
+#ifdef VIK_CONFIG_GOOGLE
#include "googlesearch.h"
+#endif
+#ifdef VIK_CONFIG_GEONAMES
+#include "geonamessearch.h"
+#endif
#include "dems.h"
+#include "mapcache.h"
#include "print.h"
#include "preferences.h"
#include "icons/icons.h"
+#include "vikexttools.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
gtk_toolbar_set_icon_size(GTK_TOOLBAR(gtk_ui_manager_get_widget (vw->uim, "/MainToolbar")), GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_toolbar_set_style (GTK_TOOLBAR(gtk_ui_manager_get_widget (vw->uim, "/MainToolbar")), GTK_TOOLBAR_ICONS);
+ vik_ext_tools_add_menu_items ( vw, vw->uim );
g_signal_connect (G_OBJECT (vw), "delete_event", G_CALLBACK (delete_event), NULL);
static void draw_scroll (VikWindow *vw, GdkEventScroll *event)
{
- if ( event->state == GDK_CONTROL_MASK ) {
+ guint modifiers = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK);
+ if ( modifiers == GDK_CONTROL_MASK ) {
/* control == pan up & down */
if ( event->direction == GDK_SCROLL_UP )
vik_viewport_set_center_screen ( vw->viking_vvp, vik_viewport_get_width(vw->viking_vvp)/2, vik_viewport_get_height(vw->viking_vvp)/3 );
else
vik_viewport_set_center_screen ( vw->viking_vvp, vik_viewport_get_width(vw->viking_vvp)/2, vik_viewport_get_height(vw->viking_vvp)*2/3 );
- } else if ( event->state == GDK_SHIFT_MASK ) {
- /* control-shift == pan left & right */
+ } else if ( modifiers == GDK_SHIFT_MASK ) {
+ /* shift == pan left & right */
if ( event->direction == GDK_SCROLL_UP )
vik_viewport_set_center_screen ( vw->viking_vvp, vik_viewport_get_width(vw->viking_vvp)/3, vik_viewport_get_height(vw->viking_vvp)/2 );
else
vik_viewport_set_center_screen ( vw->viking_vvp, vik_viewport_get_width(vw->viking_vvp)*2/3, vik_viewport_get_height(vw->viking_vvp)/2 );
- } else if ( event->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK) ) {
- if ( event->direction == GDK_SCROLL_UP ) {
- /* make sure mouse is still over the same point on the map when we zoom */
- VikCoord coord;
- gint x, y;
- gint center_x = vik_viewport_get_width ( vw->viking_vvp ) / 2;
- gint center_y = vik_viewport_get_height ( vw->viking_vvp ) / 2;
- vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
+ } else if ( modifiers == (GDK_CONTROL_MASK | GDK_SHIFT_MASK) ) {
+ /* control+shift == make sure mouse is still over the same point on the map when we zoom */
+ VikCoord coord;
+ gint x, y;
+ gint center_x = vik_viewport_get_width ( vw->viking_vvp ) / 2;
+ gint center_y = vik_viewport_get_height ( vw->viking_vvp ) / 2;
+ vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
+ if ( event->direction == GDK_SCROLL_UP )
vik_viewport_zoom_in (vw->viking_vvp);
- vik_viewport_coord_to_screen ( vw->viking_vvp, &coord, &x, &y );
- vik_viewport_set_center_screen ( vw->viking_vvp, center_x + (x - event->x),
- center_y + (y - event->y) );
- }
- else {
- VikCoord coord;
- gint x, y;
- gint center_x = vik_viewport_get_width ( vw->viking_vvp ) / 2;
- gint center_y = vik_viewport_get_height ( vw->viking_vvp ) / 2;
- vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
+ else
vik_viewport_zoom_out(vw->viking_vvp);
- vik_viewport_coord_to_screen ( vw->viking_vvp, &coord, &x, &y );
- vik_viewport_set_center_screen ( vw->viking_vvp, center_x + (x - event->x),
- center_y + (y - event->y) );
- }
+ vik_viewport_coord_to_screen ( vw->viking_vvp, &coord, &x, &y );
+ vik_viewport_set_center_screen ( vw->viking_vvp, center_x + (x - event->x),
+ center_y + (y - event->y) );
} else {
if ( event->direction == GDK_SCROLL_UP )
vik_viewport_zoom_in (vw->viking_vvp);
a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to show its properties.") );
}
+static void help_help_cb ( GtkAction *a, VikWindow *vw )
+{
+#if GTK_CHECK_VERSION (2, 14, 0)
+ gchar *uri;
+ uri = g_strdup_printf("ghelp:%s", PACKAGE);
+ gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, NULL);
+ g_free(uri);
+#endif
+}
+
static void help_about_cb ( GtkAction *a, VikWindow *vw )
{
a_dialog_about(GTK_WINDOW(vw));
switch ( mode ) {
#ifdef VIK_CONFIG_EXPEDIA
case VIK_VIEWPORT_DRAWMODE_EXPEDIA: buttonname = "/ui/MainMenu/View/ModeExpedia"; break;
-#endif
-#ifdef VIK_CONFIG_OLD_GOOGLE
- case VIK_VIEWPORT_DRAWMODE_GOOGLE: buttonname = "/ui/MainMenu/View/ModeGoogle"; break;
- case VIK_VIEWPORT_DRAWMODE_KH: buttonname = "/ui/MainMenu/View/ModeKH"; break;
#endif
case VIK_VIEWPORT_DRAWMODE_MERCATOR: buttonname = "/ui/MainMenu/View/ModeMercator"; break;
default: buttonname = "/ui/MainMenu/View/ModeUTM";
static void goto_address( GtkAction *a, VikWindow *vw)
{
+#if defined(VIK_CONFIG_GOOGLE) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GOOGLE
a_google_search(vw, vw->viking_vlp, vw->viking_vvp);
+#endif
+#if defined(VIK_CONFIG_GEONAMES) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GEONAMES
+ a_geonames_search(vw, vw->viking_vlp, vw->viking_vvp);
+#endif
+
+}
+
+static void mapcache_flush_cb ( GtkAction *a, VikWindow *vw )
+{
+ a_mapcache_flush();
}
static void preferences_cb ( GtkAction *a, VikWindow *vw )
else if (!strcmp(gtk_action_get_name(a), "ModeExpedia")) {
drawmode = VIK_VIEWPORT_DRAWMODE_EXPEDIA;
}
- else if (!strcmp(gtk_action_get_name(a), "ModeGoogle")) {
- drawmode = VIK_VIEWPORT_DRAWMODE_GOOGLE;
- }
- else if (!strcmp(gtk_action_get_name(a), "ModeKH")) {
- drawmode = VIK_VIEWPORT_DRAWMODE_KH;
- }
else if (!strcmp(gtk_action_get_name(a), "ModeMercator")) {
drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
}
{ "SetPan", NULL, N_("_Pan"), 0, 0, 0 },
{ "Layers", NULL, N_("_Layers"), 0, 0, 0 },
{ "Tools", NULL, N_("_Tools"), 0, 0, 0 },
+ { "Exttools", NULL, N_("_Webtools"), 0, 0, 0 },
{ "Help", NULL, N_("_Help"), 0, 0, 0 },
{ "New", GTK_STOCK_NEW, N_("_New"), "<control>N", N_("New file"), (GCallback)newwindow_cb },
{ "Exit", GTK_STOCK_QUIT, N_("E_xit"), "<control>W", N_("Exit the program"), (GCallback)window_close },
{ "SaveExit", GTK_STOCK_QUIT, N_("Save and Exit"), NULL, N_("Save and Exit the program"), (GCallback)save_file_and_exit },
- { "GoogleMapsSearch", GTK_STOCK_JUMP_TO, N_("Go To Google Maps location"), NULL, N_("Go to address/place using Google Maps search"), (GCallback)goto_address },
+ { "GotoSearch", GTK_STOCK_JUMP_TO, N_("Go To location"), NULL, N_("Go to address/place using text search"), (GCallback)goto_address },
{ "GotoLL", GTK_STOCK_QUIT, N_("_Go to Lat\\/Lon..."), NULL, N_("Go to arbitrary lat\\/lon coordinate"), (GCallback)draw_goto_cb },
{ "GotoUTM", GTK_STOCK_QUIT, N_("Go to UTM..."), NULL, N_("Go to arbitrary UTM coordinate"), (GCallback)draw_goto_cb },
{ "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Background Color..."), NULL, NULL, (GCallback)set_bg_color },
{ "Paste", GTK_STOCK_PASTE, N_("_Paste"), NULL, NULL, (GCallback)menu_paste_layer_cb },
{ "Delete", GTK_STOCK_DELETE, N_("_Delete"), NULL, NULL, (GCallback)menu_delete_layer_cb },
{ "DeleteAll", NULL, N_("Delete All"), NULL, NULL, (GCallback)clear_cb },
- { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences..."), NULL, NULL, (GCallback)preferences_cb },
+ { "MapCacheFlush",NULL, N_("Flush Map cache"), NULL, NULL, (GCallback)mapcache_flush_cb },
+ { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences..."), NULL, NULL, (GCallback)preferences_cb },
{ "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), NULL, NULL, (GCallback)menu_properties_cb },
+ { "HelpEntry", GTK_STOCK_HELP, N_("_Help"), "F1", NULL, (GCallback)help_help_cb },
{ "About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, (GCallback)help_about_cb },
};
static GtkRadioActionEntry mode_entries[] = {
{ "ModeUTM", NULL, N_("_UTM Mode"), "<control>u", NULL, 0 },
{ "ModeExpedia", NULL, N_("_Expedia Mode"), "<control>e", NULL, 1 },
- { "ModeGoogle", NULL, N_("_Old Google Mode"), "<control>o", NULL, 2 },
- { "ModeKH", NULL, N_("Old _KH Mode"), "<control>k", NULL, 3 },
- { "ModeMercator", NULL, N_("_Google Mode"), "<control>g", NULL, 4 }
+ { "ModeMercator", NULL, N_("_Mercator Mode"), "<control>g", NULL, 4 }
};
static GtkRadioActionEntry tool_entries[] = {