diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-08-11 21:24:46 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-08-11 21:24:46 +0000 |
commit | ecf73d91edee825e7a39a78b37865e61502d45b3 (patch) | |
tree | 0065996954e04cb9a2f10f672f043362e5809379 | |
parent | 121894f67221fe22df1d128285b6ad5362e5101b (diff) | |
download | navit-ecf73d91edee825e7a39a78b37865e61502d45b3.tar.gz |
Add:gui/gtk:New POI search dialog.|Patch from #1133, thanks!
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5859 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/gui/gtk/CMakeLists.txt | 2 | ||||
-rw-r--r-- | navit/gui/gtk/Makefile.am | 2 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_action.c | 11 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_poi.c | 406 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_poi.h | 28 | ||||
-rw-r--r-- | navit/popup.c | 2 | ||||
-rw-r--r-- | navit/popup.h | 3 | ||||
-rw-r--r-- | po/CMakeLists.txt | 1 | ||||
-rw-r--r-- | po/Makefile.am | 1 |
9 files changed, 452 insertions, 4 deletions
diff --git a/navit/gui/gtk/CMakeLists.txt b/navit/gui/gtk/CMakeLists.txt index 33b5d3cb1..a1dfa173c 100644 --- a/navit/gui/gtk/CMakeLists.txt +++ b/navit/gui/gtk/CMakeLists.txt @@ -1,2 +1,2 @@ -module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c) +module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk_poi.c) diff --git a/navit/gui/gtk/Makefile.am b/navit/gui/gtk/Makefile.am index 1588bfe8e..7d3586a7c 100644 --- a/navit/gui/gtk/Makefile.am +++ b/navit/gui/gtk/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.inc AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ @HILDON_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=gui_gtk modulegui_LTLIBRARIES = libgui_gtk.la -libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h +libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h gui_gtk_poi.h libgui_gtk_la_LIBADD = @GTK2_LIBS@ libgui_gtk_la_LDFLAGS = -module -avoid-version diff --git a/navit/gui/gtk/gui_gtk_action.c b/navit/gui/gtk/gui_gtk_action.c index 5f8b19427..dc513fe03 100644 --- a/navit/gui/gtk/gui_gtk_action.c +++ b/navit/gui/gtk/gui_gtk_action.c @@ -33,6 +33,7 @@ #include "debug.h" #include "destination.h" #include "navit_nls.h" +#include "gui_gtk_poi.h" struct menu_priv { char *path; @@ -180,6 +181,13 @@ route_clear_action(GtkWidget *w, struct gui_priv *gui, void *dummy) navit_set_destination(gui->nav, NULL, NULL, 0); } +/*Action that shows search poi window*/ +static void +poi_action(GtkWidget *w, struct gui_priv *gui, void *dummy) +{ + gtk_gui_poi(gui->nav); +} + static void destination_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { @@ -213,6 +221,7 @@ static GtkActionEntry entries[] = { "InfoAction", NULL, _n("_Info"), NULL, NULL, G_CALLBACK(info_action) }, #endif /*GTK_STOCK_INFO*/ { "DestinationAction", "flag_icon", _n("Set _destination"), "<control>D", _n("Opens address search dialog"), G_CALLBACK(destination_action) }, + { "POIAction", "flag_icon", _n("Set _POI"), "<control>P", _n("Opens POI search dialog"), G_CALLBACK(poi_action) }, { "RouteClearAction", NULL, _n("_Stop Navigation"), "<control>S", NULL, G_CALLBACK(route_clear_action) }, { "Test", NULL, _n("Test"), NULL, NULL, G_CALLBACK(destination_action) }, { "QuitAction", GTK_STOCK_QUIT, _n("_Quit"), "<control>Q",_n("Quit the application"), G_CALLBACK (quit_action) } @@ -388,6 +397,7 @@ static char layout[] = <menu name=\"Route\" action=\"RouteMenuAction\">\ <menuitem name=\"Refresh\" action=\"RefreshAction\" />\ <menuitem name=\"Destination\" action=\"DestinationAction\" />\ + <menuitem name=\"POI\" action=\"POIAction\" />\ <menuitem name=\"Clear\" action=\"RouteClearAction\" />\ <menu name=\"FormerDestinations\" action=\"FormerDestinationMenuAction\">\ <placeholder name=\"FormerDestinationMenuAdditions\" />\ @@ -419,6 +429,7 @@ static char layout[] = <!-- <toolitem name=\"Cursor\" action=\"CursorAction\"/> -->\ <toolitem name=\"Orientation\" action=\"OrientationAction\"/>\ <toolitem name=\"Destination\" action=\"DestinationAction\"/>\ + <toolitem name=\"POI\" action=\"POIAction\"/>\ <!-- <toolitem name=\"Info\" action=\"InfoAction\"/> -->\ <toolitem name=\"Roadbook\" action=\"RoadbookAction\"/>\ <toolitem name=\"Autozoom\" action=\"AutozoomAction\"/>\ diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c new file mode 100644 index 000000000..656dc40cc --- /dev/null +++ b/navit/gui/gtk/gui_gtk_poi.c @@ -0,0 +1,406 @@ +/** + * Navit, a modular navigation system. + * Copyright (C) 2005-2013 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <stdlib.h> +#include <gtk/gtk.h> +#include "gui_gtk_poi.h" +#include "popup.h" +#include "debug.h" +#include "navit_nls.h" +#include "coord.h" +#include "point.h" +#include "callback.h" +#include "graphics.h" +#include "navit.h" +#include "item.h" +#include "map.h" +#include "mapset.h" +#include "transform.h" +#include "attr.h" +#include "vehicle.h" + +static struct gtk_poi_search{ + GtkWidget *entry_distance; + GtkWidget *label_distance; + GtkWidget *treeview_cat; + GtkWidget *treeview_poi; + GtkWidget *button_visit, *button_destination, *button_map; + GtkListStore *store_poi; + GtkListStore *store_cat; + GtkTreeModel *store_poi_sorted; + GtkTreeModel *store_cat_sorted; + char *selected_cat; + struct navit *nav; +} gtk_poi_search; + + +/*Returns an icon with GdkPIxbuf*/ +static GdkPixbuf * +geticon(const char *name){ + GdkPixbuf *icon=NULL; + GError *error=NULL; + icon=gdk_pixbuf_new_from_file(graphics_icon_path(name),&error); + return icon; +} + +/*Builds the category list and adds icons to improve UI*/ +static GtkTreeModel * +model_cat (struct gtk_poi_search *search) +{ + GtkTreeIter iter; + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter, 0,geticon("pharmacy.png"), 1, _("Pharmacy"), 2, "poi_pharmacy", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter, 0, geticon("restaurant.png"), 1, _("Restaurant"), 2, "poi_restaurant", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("restaurant.png"), 1, _("Restaurant. Fast food"),2, "poi_fastfood", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("hotel.png"), 1, _("Hotel"),2, "poi_hotel", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("parking.png"), 1, _("Car parking"),2, "poi_car_parking", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("fuel.png"), 1, _("Fuel station"),2, "poi_fuel", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("bank.png"), 1, _("Bank"),2, "poi_bank", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("hospital.png"), 1, _("Hospital"),2, "poi_hospital", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("cinema.png"), 1, _("Cinema"),2, "poi_cinema", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("rail_station.png"), 1, _("Train station"),2, "poi_rail_station", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("school.png"), 1, _("School"),2, "poi_school", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("police.png"), 1, _("Police"),2, "poi_police", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("justice.png"), 1, _("Justice"),2, "poi_justice", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("taxi.png"), 1, _("Taxi"),2, "poi_taxi", -1); + gtk_list_store_append (search->store_cat, &iter); + gtk_list_store_set (search->store_cat, &iter,0, geticon("shopping.png"), 1, _("Shopping"),2, "poi_shopping", -1); + return GTK_TREE_MODEL (search->store_cat_sorted); +} + +/*Copied from gui_internal_poi.c. I didn't know how to reference it. Gets the cardinal direction from the angle*/ +static void +get_direction(char *buffer, int angle, int mode) +{ + angle=angle%360; + switch (mode) { + case 0: + sprintf(buffer,"%d",angle); + break; + case 1: + if (angle < 69 || angle > 291) + *buffer++='N'; + if (angle > 111 && angle < 249) + *buffer++='S'; + if (angle > 22 && angle < 158) + *buffer++='E'; + if (angle > 202 && angle < 338) + *buffer++='W'; + *buffer++='\0'; + break; + case 2: + angle=(angle+15)/30; + if (! angle) + angle=12; + sprintf(buffer,"%d H", angle); + break; + } +} + +/*Constructs model of pois from map information*/ +static GtkTreeModel * +model_poi (struct gtk_poi_search *search) +{ + GtkTreeIter iter; + struct map_selection *sel,*selm; + struct coord coord_item,center; + struct pcoord pc; + struct mapset_handle *h; + int dist,idist; + struct map *m; + struct map_rect *mr; + struct item *item; + struct point p;//Cursor position in screen + struct attr attr, vehicle_attr; + struct vehicle *v; + enum item_type selected; + + //distance in meters + dist=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance))); + + //Searches if vehicle has coord_geo to show distance from vehicle. + //If vehicle hasn't coord_geo show distance from center of screen + navit_get_attr(search->nav,attr_vehicle, &vehicle_attr,NULL); + v=vehicle_attr.u.vehicle; + + vehicle_get_attr(v,attr_position_coord_geo, &attr, NULL); + if (attr.u.coord_geo->lng==0.0f && attr.u.coord_geo->lat==0.0f){ + p.x=navit_get_width(search->nav)/2; + p.y=navit_get_height(search->nav)/2; + gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from center screen (Km)")); + }else{ + printf("%f\n",attr.u.coord_geo->lng); + + p.x=navit_get_width(search->nav)/2; + p.y=navit_get_height(search->nav)*4/5; + gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from vehicle cursor (Km)")); + } + + transform_reverse(navit_get_trans(search->nav), &p, ¢er); + pc.pro = transform_get_projection(navit_get_trans(search->nav)); + pc.x = center.x; + pc.y = center.y; + + //Search in the map, for pois + sel=map_selection_rect_new(&pc ,dist*transform_scale(abs(center.y)+dist*1.5),18); + gtk_list_store_clear(search->store_poi); + + h=mapset_open(navit_get_mapset(search->nav)); + + selected=item_from_name(search->selected_cat); + while ((m=mapset_next(h, 1))) { + selm=map_selection_dup_pro(sel, 1, map_projection(m));//pro vale 1 + mr=map_rect_new(m, selm); + if (mr) { + while ((item=map_rect_get_item(mr))) { + struct attr attr; + item_attr_get(item,attr_label,&attr); + item_coord_get(item,&coord_item,1); + idist=transform_distance(1,¢er,&coord_item); + if (item->type==selected && idist<=dist){ + gtk_list_store_append (search->store_poi, &iter); + char rumbo[5]; + get_direction(rumbo,transform_get_angle_delta(¢er,&coord_item,0),1); + gtk_list_store_set (search->store_poi, &iter, 0,rumbo, 1,idist, 2,g_strdup(attr.u.str), 3,coord_item.x, 4,coord_item.y ,-1); + } + } + map_rect_destroy(mr); + } + map_selection_destroy(selm); + } + map_selection_destroy(sel); + mapset_close(h); + + return GTK_TREE_MODEL (search->store_poi_sorted); +} + +/*Sets button enabled if there is a row selected*/ +static void +treeview_poi_changed(GtkWidget *widget, struct gtk_poi_search *search) +{ + GtkTreePath *path; + GtkTreeViewColumn *focus_column; + GtkTreeIter iter; + + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return; + + gtk_widget_set_sensitive(search->button_visit,TRUE); + gtk_widget_set_sensitive(search->button_map,TRUE); + gtk_widget_set_sensitive(search->button_destination,TRUE); +} + +/*Reloads the poi list, and sets buttons disabled*/ +static void +treeview_poi_reload(GtkWidget *widget, struct gtk_poi_search *search) +{ + GtkTreePath *path; + GtkTreeViewColumn *focus_column; + GtkTreeIter iter; + + gtk_widget_set_sensitive(search->button_visit,FALSE); + gtk_widget_set_sensitive(search->button_map,FALSE); + gtk_widget_set_sensitive(search->button_destination,FALSE); + + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return; + gtk_tree_model_get(GTK_TREE_MODEL(search->store_cat_sorted), &iter, 2, &search->selected_cat, -1); + gtk_tree_view_set_model(GTK_TREE_VIEW (search->treeview_poi), model_poi(search)); +} + +/*Function when button destination is clicked. It sets the selected poi position as destination*/ +static void +button_destination_clicked(GtkWidget *widget, struct gtk_poi_search *search) +{ + GtkTreePath *path; + GtkTreeViewColumn *focus_column; + GtkTreeIter iter; + long int lat, lon; + char *label; + char *category; + char buffer[2000]; + + //Get category + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return; + gtk_tree_model_get(GTK_TREE_MODEL(search->store_cat_sorted), &iter, 1, &category, -1); + + //Get label, lat, lon + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return; + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 2, &label, -1); + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1); + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1); + sprintf(buffer, _("POI %s. %s"), category, label); + + struct pcoord dest; + dest.x=lat; + dest.y=lon; + dest.pro=1; + navit_set_destination(search->nav, &dest, buffer, 1); + dbg(1,_("Set destination to %ld, %ld \n"),lat,lon); +} + +/*Function when button map is clicked. It shows the poi position in the map*/ +static void +button_map_clicked(GtkWidget *widget, struct gtk_poi_search *search) +{ + GtkTreePath *path; + GtkTreeViewColumn *focus_column; + GtkTreeIter iter; + long int lat,lon; + + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return; + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1); + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1); + + struct pcoord dest; + dest.x=lat; + dest.y=lon; + dest.pro=1; + navit_set_center(search->nav, &dest,1); + dbg(1,_("Set map to %ld, %ld \n"),lat,lon); +} + +/*Function when button visitbefore is clicked. It sets the first visit before of the waypoint when it's clicked*/ +static void +button_visit_clicked(GtkWidget *widget, struct gtk_poi_search *search) +{ + GtkTreePath *path; + GtkTreeViewColumn *focus_column; + GtkTreeIter iter; + long int lat,lon; + + gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column); + if(!path) return; + if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return; + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1); + gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1); + dbg(1,_("Set next visit to %ld, %ld \n"),lat,lon); + + struct pcoord dest; + dest.x=lat; + dest.y=lon; + dest.pro=1; + popup_set_visitbefore(search->nav,&dest,0); +} + +/*Create UI and connects objects to functions*/ +void gtk_gui_poi(struct navit *nav) +{ + GtkWidget *window2,*vbox, *keyboard, *table; + GtkWidget *label_category, *label_poi; + GtkWidget *listbox_cat, *listbox_poi; + GtkCellRenderer *renderer; + + struct gtk_poi_search *search=>k_poi_search; + search->nav=nav; + + window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window2),_("Search of POI's")); + gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit"); + gtk_window_set_default_size (GTK_WINDOW (window2),700,550); + vbox = gtk_vbox_new(FALSE, 0); + table = gtk_table_new(4, 4, FALSE); + + label_category = gtk_label_new(_("Select a category")); + search->label_distance = gtk_label_new(_("Select a distance to look for (Km)")); + label_poi=gtk_label_new(_("Select a POI")); + + search->entry_distance=gtk_entry_new_with_max_length(2); + gtk_entry_set_text(GTK_ENTRY(search->entry_distance),"10"); + + search->treeview_cat=gtk_tree_view_new(); + listbox_cat = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_cat), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_cat),search->treeview_cat); + search->store_cat = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + renderer=gtk_cell_renderer_pixbuf_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _(" "), renderer, "pixbuf", 0, NULL); + renderer=gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _("Category"), renderer, "text", 1, NULL); + search->store_cat_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_cat)); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_cat_sorted),1,GTK_SORT_ASCENDING); + gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview_cat), model_cat(search)); + + search->treeview_poi=gtk_tree_view_new(); + listbox_poi = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_poi), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_poi),search->treeview_poi); + search->store_poi = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG); + renderer=gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, " ", renderer, "text",0,NULL); + renderer=gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Meters"), renderer, "text", 1, NULL); + renderer=gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Name"), renderer, "text", 2, NULL); + search->store_poi_sorted=NULL; + search->store_poi_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_poi)); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_poi_sorted),1,GTK_SORT_ASCENDING); + + search->button_visit = gtk_button_new_with_label(_("Visit Before")); + search->button_destination = gtk_button_new_with_label(_("Destination")); + search->button_map = gtk_button_new_with_label(_("Map")); + gtk_widget_set_sensitive(search->button_visit,FALSE); + gtk_widget_set_sensitive(search->button_map,FALSE); + gtk_widget_set_sensitive(search->button_destination,FALSE); + + gtk_table_attach(GTK_TABLE(table), search->label_distance, 0, 1, 0, 1, 0, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), search->entry_distance, 1, 2, 0, 1, 0, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), label_category, 0, 1, 2, 3, 0, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), listbox_cat, 0, 1, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); + gtk_table_attach(GTK_TABLE(table), label_poi, 1, 4, 2, 3, 0, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), listbox_poi, 1, 4, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); + gtk_table_attach(GTK_TABLE(table), search->button_map, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), search->button_visit, 1, 2, 4, 5, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), search->button_destination, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 0, 0); + gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); + + g_signal_connect(G_OBJECT(search->entry_distance), "changed", G_CALLBACK(treeview_poi_reload), search); + g_signal_connect(G_OBJECT(search->button_visit), "clicked", G_CALLBACK(button_visit_clicked), search); + g_signal_connect(G_OBJECT(search->button_map), "clicked", G_CALLBACK(button_map_clicked), search); + g_signal_connect(G_OBJECT(search->button_destination), "clicked", G_CALLBACK(button_destination_clicked), search); + g_signal_connect(G_OBJECT(search->treeview_cat), "cursor_changed", G_CALLBACK(treeview_poi_reload), search); + g_signal_connect(G_OBJECT(search->treeview_poi), "cursor_changed", G_CALLBACK(treeview_poi_changed), search); + + keyboard=gtk_socket_new(); + gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0); + gtk_container_add(GTK_CONTAINER(window2), vbox); + gtk_widget_show_all(window2); +} + diff --git a/navit/gui/gtk/gui_gtk_poi.h b/navit/gui/gtk/gui_gtk_poi.h new file mode 100644 index 000000000..0f0087d49 --- /dev/null +++ b/navit/gui/gtk/gui_gtk_poi.h @@ -0,0 +1,28 @@ +/** + * Navit, a modular navigation system. + * Copyright (C) 2005-2013 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef NAVIT_GTK_POI_H +#define NAVIT_GTK_POI_H + +struct navit; +struct pcoord; +void gtk_gui_poi(struct navit *nav); + +#endif + diff --git a/navit/popup.c b/navit/popup.c index 9a12e6a50..10e7bc236 100644 --- a/navit/popup.c +++ b/navit/popup.c @@ -135,7 +135,7 @@ popup_set_destination(struct navit *nav, struct pcoord *pc) } -static void +void popup_set_visitbefore(struct navit *nav, struct pcoord *pc,int visitbefore) { struct pcoord *dst; diff --git a/navit/popup.h b/navit/popup.h index a4c17a68e..85e32f6e7 100644 --- a/navit/popup.h +++ b/navit/popup.h @@ -22,6 +22,7 @@ struct navit; struct point; +struct pcoord; void popup(struct navit *nav, int button, struct point *p); - +void popup_set_visitbefore(struct navit *nav, struct pcoord *pc, int visitbefore); #endif diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 7bab60b11..e2579d590 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -12,6 +12,7 @@ set(POTFILES ${PROJECT_SOURCE_DIR}/navit/bookmarks.c ${PROJECT_SOURCE_DIR}/navit/gui/gtk/destination.c ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_action.c + ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_poi.c ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_statusbar.c ${PROJECT_SOURCE_DIR}/navit/gui/internal/gui_internal.c ${PROJECT_SOURCE_DIR}/navit/gui/internal/gui_internal_bookmark.c diff --git a/po/Makefile.am b/po/Makefile.am index fc92c17cb..7da7f1135 100644 --- a/po/Makefile.am +++ b/po/Makefile.am @@ -21,6 +21,7 @@ POTFILES = \ $(top_srcdir)/navit/country.c \ $(top_srcdir)/navit/gui/gtk/destination.c \ $(top_srcdir)/navit/gui/gtk/gui_gtk_action.c \ + $(top_srcdir)/navit/gui/gtk/gui_gtk_poi.c \ $(top_srcdir)/navit/gui/gtk/gui_gtk_statusbar.c \ $(top_srcdir)/navit/gui/internal/gui_internal.c \ $(top_srcdir)/navit/gui/internal/gui_internal_bookmark.c \ |