diff options
author | Patrick Höhn <hoehnp@gmx.de> | 2018-10-04 21:41:30 +0200 |
---|---|---|
committer | Patrick Höhn <hoehnp@gmx.de> | 2018-10-04 21:41:30 +0200 |
commit | 6f9a700f99e5ed89399f82c8c99fedf1ec3e5fa7 (patch) | |
tree | 2b7045d1e337166d258de6460b8c4dc7c47b6e8a | |
parent | cd82dd36cfef4a3a9e45847acf2d405ed317ad1f (diff) | |
parent | 6389ce56cb6681695734d02b7223ad35b69241e2 (diff) | |
download | navit-replace_espeak_win32.tar.gz |
Merge branch 'trunk' of https://github.com/navit-gps/navit into replace_espeak_win32replace_espeak_win32
-rwxr-xr-x | contrib/sailfish/navit-sailfish.spec | 10 | ||||
-rw-r--r-- | navit/gui/gtk/CMakeLists.txt | 3 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk.h | 51 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_poi.c | 380 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_window.c | 9 | ||||
-rw-r--r-- | navit/gui/internal/CMakeLists.txt | 4 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal.c | 18 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal.h | 107 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_keyboard.h | 28 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_poi.h | 69 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_priv.h | 274 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_widget.h | 233 | ||||
-rw-r--r-- | navit/maps/CMakeLists.txt | 3 |
13 files changed, 610 insertions, 579 deletions
diff --git a/contrib/sailfish/navit-sailfish.spec b/contrib/sailfish/navit-sailfish.spec index 4f97499e4..11980a77c 100755 --- a/contrib/sailfish/navit-sailfish.spec +++ b/contrib/sailfish/navit-sailfish.spec @@ -10,7 +10,7 @@ Name: harbour-navit Summary: Open Source car navigation system #Version: %{navit_version}_%{git_version} Version: 0.5.3 -Release: 0 +Release: 1 License: GPL Group: Applications/Productivity URL: http://navit-project.org/ @@ -101,6 +101,11 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \ # -DMAN_DIR:PATH=share/harbour-navit/man1 +%pre +if [ -d %{_datadir}/harbour-navit/espeak-data ]; then + rm -rf %{_datadir}/harbour-navit/espeak-data +fi + %install %make_install #copy in sailfish config @@ -125,6 +130,9 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \ %changelog +*Mon Oct 01 2018 metalstrolch 0.5.3-1 +- fix rpm updating from 0.5.1 by adding %pre section + *Fri Aug 31 2018 metalstrolch 0.5.3-0 Release 0.5.2 was missing the version number update in the CMakefile. This release fixes this. diff --git a/navit/gui/gtk/CMakeLists.txt b/navit/gui/gtk/CMakeLists.txt index a1dfa173c..1a1ec2a7a 100644 --- a/navit/gui/gtk/CMakeLists.txt +++ b/navit/gui/gtk/CMakeLists.txt @@ -1,2 +1,3 @@ -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) +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/gui_gtk.h b/navit/gui/gtk/gui_gtk.h index 10051beaf..c8c3ca1ec 100644 --- a/navit/gui/gtk/gui_gtk.h +++ b/navit/gui/gtk/gui_gtk.h @@ -26,37 +26,38 @@ struct callback; struct statusbar_priv; struct gui_priv { - struct navit *nav; - GtkWidget *win; - GtkWidget *dialog_win; - GtkWidget *dialog_entry; - struct pcoord dialog_coord; - GtkWidget *vbox; - GtkWidget *menubar; - GtkActionGroup *base_group; - GtkActionGroup *debug_group; - GtkActionGroup *dyn_group; - GtkUIManager *ui_manager; - GSList *layout_group; - GSList *projection_group; - GSList *vehicle_group; - GList *dest_menuitems; - GList *bookmarks_menuitems; - GList *vehicle_menuitems; - GtkUIManager *menu_manager; // old - struct statusbar_priv *statusbar; - int menubar_enable; - int toolbar_enable; - int statusbar_enable; - int dyn_counter; - struct datawindow_priv *datawindow; + struct navit *nav; + GtkWidget *win; + GtkWidget *dialog_win; + GtkWidget *dialog_entry; + struct pcoord dialog_coord; + GtkWidget *vbox; + GtkWidget *menubar; + GtkActionGroup *base_group; + GtkActionGroup *debug_group; + GtkActionGroup *dyn_group; + GtkUIManager *ui_manager; + GSList *layout_group; + GSList *projection_group; + GSList *vehicle_group; + GList *dest_menuitems; + GList *bookmarks_menuitems; + GList *vehicle_menuitems; + GtkUIManager *menu_manager; // old + struct statusbar_priv *statusbar; + int menubar_enable; + int toolbar_enable; + int statusbar_enable; + int dyn_counter; + struct datawindow_priv *datawindow; }; void gui_gtk_ui_init(struct gui_priv *this); struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth); struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui); struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth); -struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth); +struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click, + struct callback *close, struct datawindow_methods *meth); void gui_gtk_datawindow_destroy(struct datawindow_priv *win); void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn); diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c index b157bf2df..503bc321f 100644 --- a/navit/gui/gtk/gui_gtk_poi.c +++ b/navit/gui/gtk/gui_gtk_poi.c @@ -37,18 +37,18 @@ #include "navigation.h" /* for FEET_PER_METER and other conversion factors. */ -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; +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; static GdkPixbuf *geticon(const char *name) { @@ -101,90 +101,88 @@ static GtkTreeModel *category_list_model(struct gtk_poi_search *search) { /** Construct 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 search_distance_meters; /* distance to search the POI database, in meters, from the center of the screen. */ - int idist; /* idist appears to be the distance in meters from the center of the screen to a POI. */ - struct map *m; - struct map_rect *mr; - struct item *item; - struct point cursor_position; - enum item_type selected; - - /* Respect the Imperial attribute as we enlighten the user. */ - struct attr attr; - int imperial = FALSE; /* default to using metric measures. */ - if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL)) - imperial=attr.u.num; - - if (imperial == FALSE) { - /* Input is in kilometers */ - search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance))); - gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in km")); - } else { - /* Input is in miles. */ - search_distance_meters=atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)))/METERS_TO_MILES; - gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in miles")); - } - - cursor_position.x=navit_get_width(search->nav)/2; - cursor_position.y=navit_get_height(search->nav)/2; - - transform_reverse(navit_get_trans(search->nav), &cursor_position, ¢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 ,search_distance_meters*transform_scale(abs(center.y)+search_distance_meters*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, projection_mg, map_projection(m)); - mr=map_rect_new(m, selm); - if (mr) { - while ((item=map_rect_get_item(mr))) { - struct attr label_attr; - item_attr_get(item,attr_label,&label_attr); - item_coord_get(item,&coord_item,1); - idist=transform_distance(1,¢er,&coord_item); - if (item->type==selected && idist<=search_distance_meters){ - char direction[5]; - gtk_list_store_append(search->store_poi, &iter); - get_compass_direction(direction,transform_get_angle_delta(¢er,&coord_item,0),1); - - /** - * If the user has selected imperial, translate idist from meters to - * feet. We convert to feet only, and not miles, because the code - * sorts on the numeric value of the distance, so it doesn't like two - * different units. Currently, the distance is an int. Can it be made - * a float? Possible future enhancement? - */ - if (imperial != FALSE) { - idist = idist * (FEET_PER_METER); /* convert meters to feet. */ - } - - gtk_list_store_set(search->store_poi, &iter, 0,direction, 1,idist, - 2,g_strdup(label_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); +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 search_distance_meters; /* distance to search the POI database, in meters, from the center of the screen. */ + int idist; /* idist appears to be the distance in meters from the center of the screen to a POI. */ + struct map *m; + struct map_rect *mr; + struct item *item; + struct point cursor_position; + enum item_type selected; + + /* Respect the Imperial attribute as we enlighten the user. */ + struct attr attr; + int imperial = FALSE; /* default to using metric measures. */ + if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL)) + imperial=attr.u.num; + + if (imperial == FALSE) { + /* Input is in kilometers */ + search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance))); + gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in km")); + } else { + /* Input is in miles. */ + search_distance_meters=atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)))/METERS_TO_MILES; + gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in miles")); + } + + cursor_position.x=navit_get_width(search->nav)/2; + cursor_position.y=navit_get_height(search->nav)/2; + + transform_reverse(navit_get_trans(search->nav), &cursor_position, ¢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,search_distance_meters*transform_scale(abs(center.y)+search_distance_meters*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, projection_mg, map_projection(m)); + mr=map_rect_new(m, selm); + if (mr) { + while ((item=map_rect_get_item(mr))) { + struct attr label_attr; + item_attr_get(item,attr_label,&label_attr); + item_coord_get(item,&coord_item,1); + idist=transform_distance(1,¢er,&coord_item); + if (item->type==selected && idist<=search_distance_meters) { + char direction[5]; + gtk_list_store_append(search->store_poi, &iter); + get_compass_direction(direction,transform_get_angle_delta(¢er,&coord_item,0),1); + + /** + * If the user has selected imperial, translate idist from meters to + * feet. We convert to feet only, and not miles, because the code + * sorts on the numeric value of the distance, so it doesn't like two + * different units. Currently, the distance is an int. Can it be made + * a float? Possible future enhancement? + */ + if (imperial != FALSE) { + idist = idist * (FEET_PER_METER); /* convert meters to feet. */ + } + + gtk_list_store_set(search->store_poi, &iter, 0,direction, 1,idist, + 2,g_strdup(label_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); } /** Enable button if there is a selected row. */ @@ -295,98 +293,102 @@ static void button_visit_clicked(GtkWidget *widget, struct gtk_poi_search *searc } /** Create UI and connect 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),_("POI search")); - 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")); - label_poi=gtk_label_new(_("Select a POI")); - - /* Respect the Imperial attribute as we enlighten the user. */ - struct attr attr; - int imperial = FALSE; /* default to using metric measures. */ - if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL)) - imperial=attr.u.num; - - if (imperial == FALSE) { - /* Input is in kilometers */ - search->label_distance = gtk_label_new(_("Select a search radius from screen center in km")); - } else { - /* Input is in miles. */ - search->label_distance = gtk_label_new(_("Select a search radius from screen center in miles")); - } - - 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), category_list_model(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, _("Direction"), renderer, "text",0,NULL); - renderer=gtk_cell_renderer_text_new(); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance"), 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=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); +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),_("POI search")); + 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")); + label_poi=gtk_label_new(_("Select a POI")); + + /* Respect the Imperial attribute as we enlighten the user. */ + struct attr attr; + int imperial = FALSE; /* default to using metric measures. */ + if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL)) + imperial=attr.u.num; + + if (imperial == FALSE) { + /* Input is in kilometers */ + search->label_distance = gtk_label_new(_("Select a search radius from screen center in km")); + } else { + /* Input is in miles. */ + search->label_distance = gtk_label_new(_("Select a search radius from screen center in miles")); + } + + 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), category_list_model(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, _("Direction"), renderer, "text", + 0,NULL); + renderer=gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance"), 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=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_window.c b/navit/gui/gtk/gui_gtk_window.c index fd2c092f5..782add46f 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -338,7 +338,8 @@ static void gui_gtk_del_menu(struct gui_priv *this, struct gui_menu_info *meninf gtk_ui_manager_remove_ui(this->ui_manager, meninfo->merge_id); } -static struct gui_menu_info gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu, struct action_cb_data *data) { +static struct gui_menu_info gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu, + struct action_cb_data *data) { struct gui_menu_info meninfo; GtkAction *action; guint merge_id; @@ -364,7 +365,8 @@ static void gui_gtk_action_toggled(GtkToggleAction *action, struct action_cb_dat navit_draw(data->gui->nav); } -static void gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, gboolean active) { +static void gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path, + struct action_cb_data *data, gboolean active) { GtkToggleAction *toggle_action; guint merge_id; @@ -382,7 +384,8 @@ static void gui_gtk_action_changed(GtkRadioAction *action, GtkRadioAction *curre } } -static struct gui_menu_info gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, GSList **g) { +static struct gui_menu_info gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path, + struct action_cb_data *data, GSList **g) { struct gui_menu_info meninfo; GtkRadioAction *radio_action; guint merge_id; diff --git a/navit/gui/internal/CMakeLists.txt b/navit/gui/internal/CMakeLists.txt index 230e315d6..b758ba7e6 100644 --- a/navit/gui/internal/CMakeLists.txt +++ b/navit/gui/internal/CMakeLists.txt @@ -1 +1,3 @@ -module_add_library(gui_internal gui_internal.c gui_internal_bookmark.c gui_internal_command.c gui_internal_gesture.c gui_internal_html.c gui_internal_menu.c gui_internal_poi.c gui_internal_search.c gui_internal_widget.c gui_internal_keyboard.c) +module_add_library(gui_internal gui_internal.c gui_internal_bookmark.c gui_internal_command.c gui_internal_gesture.c + gui_internal_html.c gui_internal_menu.c gui_internal_poi.c gui_internal_search.c gui_internal_widget.c + gui_internal_keyboard.c) diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index e8ccaab1c..39e0b6d18 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -236,7 +236,8 @@ static void gui_internal_button_attr_pressed(struct gui_priv *this, struct widge } struct widget * -gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on, struct attr *off) { +gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on, + struct attr *off) { struct graphics_image *image=NULL; struct widget *ret; if (!on && !off) @@ -258,7 +259,8 @@ gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum } struct widget * -gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt) { +gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map, + struct attr *on, struct attr *off, int deflt) { struct graphics_image *image=NULL; struct widget *ret; image=image_new_xs(this, "gui_inactive"); @@ -527,7 +529,8 @@ void gui_internal_apply_config(struct gui_priv *this) { this->spacing = current_config->spacing; } else { this->spacing = this->config.spacing; - dbg(lvl_info, "Overriding default spacing %d with value %d provided in config file", current_config->spacing, this->config.spacing); + dbg(lvl_info, "Overriding default spacing %d with value %d provided in config file", current_config->spacing, + this->config.spacing); } if (!this->fonts[0]) { int i,sizes[]= {100,66,50}; @@ -1183,7 +1186,8 @@ static void gui_internal_cmd_delete_waypoint(struct gui_priv *this, struct widge * 2048: "Show search results on the map" * TODO define constants for these values */ -void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, struct widget *wm, const char *name, int flags) { +void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, + struct widget *wm, const char *name, int flags) { struct widget *wb,*w,*wtable,*row,*wc,*wbc,*wclosest=NULL; struct coord_geo g; struct pcoord pc; @@ -2786,7 +2790,8 @@ static int gui_internal_keynav_find_prev(struct widget *wi, struct widget *curre return NO_RESULT_YET; } -static void gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int dy, int *distance, struct widget **result) { +static void gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int dy, int *distance, + struct widget **result) { GList *l=wi->children; // Skip hidden elements if (wi->p.x==0 && wi->p.y==0 && wi->w==0 && wi->h==0) @@ -3293,7 +3298,8 @@ void gui_internal_populate_route_table(struct gui_priv * this, struct navit * na //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui) { +static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, + struct gui *gui) { struct color color_white= {0xffff,0xffff,0xffff,0xffff}; struct color color_black= {0x0,0x0,0x0,0xffff}; struct color back2_color= {0x4141,0x4141,0x4141,0xffff}; diff --git a/navit/gui/internal/gui_internal.h b/navit/gui/internal/gui_internal.h index 1a5cd13d3..734d31d38 100644 --- a/navit/gui/internal/gui_internal.h +++ b/navit/gui/internal/gui_internal.h @@ -15,71 +15,72 @@ struct gui_priv; #define GESTURE_RINGSIZE 100 enum widget_type { - widget_box=1, - widget_button, - widget_label, - widget_image, - widget_table, - widget_table_row + widget_box=1, + widget_button, + widget_label, + widget_image, + widget_table, + widget_table_row }; enum flags { - gravity_none=0x00, - gravity_left=1, - gravity_xcenter=2, - gravity_right=4, - gravity_top=8, - gravity_ycenter=16, - gravity_bottom=32, - gravity_left_top=gravity_left|gravity_top, - gravity_top_center=gravity_xcenter|gravity_top, - gravity_right_top=gravity_right|gravity_top, - gravity_left_center=gravity_left|gravity_ycenter, - gravity_center=gravity_xcenter|gravity_ycenter, - gravity_right_center=gravity_right|gravity_ycenter, - gravity_left_bottom=gravity_left|gravity_bottom, - gravity_bottom_center=gravity_xcenter|gravity_bottom, - gravity_right_bottom=gravity_right|gravity_bottom, - flags_expand=0x100, - flags_fill=0x200, - flags_swap=0x400, - flags_scrollx=0x800, - flags_scrolly=0x1000, - orientation_horizontal=0x10000, - orientation_vertical=0x20000, - orientation_horizontal_vertical=0x40000, + gravity_none=0x00, + gravity_left=1, + gravity_xcenter=2, + gravity_right=4, + gravity_top=8, + gravity_ycenter=16, + gravity_bottom=32, + gravity_left_top=gravity_left|gravity_top, + gravity_top_center=gravity_xcenter|gravity_top, + gravity_right_top=gravity_right|gravity_top, + gravity_left_center=gravity_left|gravity_ycenter, + gravity_center=gravity_xcenter|gravity_ycenter, + gravity_right_center=gravity_right|gravity_ycenter, + gravity_left_bottom=gravity_left|gravity_bottom, + gravity_bottom_center=gravity_xcenter|gravity_bottom, + gravity_right_bottom=gravity_right|gravity_bottom, + flags_expand=0x100, + flags_fill=0x200, + flags_swap=0x400, + flags_scrollx=0x800, + flags_scrolly=0x1000, + orientation_horizontal=0x10000, + orientation_vertical=0x20000, + orientation_horizontal_vertical=0x40000, }; struct gui_internal_methods { - void (*add_callback)(struct gui_priv *priv, struct callback *cb); - void (*remove_callback)(struct gui_priv *priv, struct callback *cb); - void (*menu_render)(struct gui_priv *this); - struct graphics_image * (*image_new_xs)(struct gui_priv *this, const char *name); - struct graphics_image * (*image_new_l)(struct gui_priv *this, const char *name); + void (*add_callback)(struct gui_priv *priv, struct callback *cb); + void (*remove_callback)(struct gui_priv *priv, struct callback *cb); + void (*menu_render)(struct gui_priv *this); + struct graphics_image * (*image_new_xs)(struct gui_priv *this, const char *name); + struct graphics_image * (*image_new_l)(struct gui_priv *this, const char *name); }; struct gui_internal_widget_methods { - void (*append)(struct widget *parent, struct widget *child); - struct widget * (*button_new)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags); - struct widget * (*button_new_with_callback)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data); - struct widget * (*box_new)(struct gui_priv *this, enum flags flags); - struct widget * (*label_new)(struct gui_priv *this, const char *text); - struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image); - struct widget * (*keyboard)(struct gui_priv *this, int mode); - struct widget * (*menu)(struct gui_priv *this, const char *label); - enum flags (*get_flags)(struct widget *widget); - void (*set_flags)(struct widget *widget, enum flags flags); - int (*get_state)(struct widget *widget); - void (*set_state)(struct widget *widget, int state); - void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data)); - void (*set_data)(struct widget *widget, void *data); - void (*set_default_background)(struct gui_priv *this, struct widget *widget); + void (*append)(struct widget *parent, struct widget *child); + struct widget * (*button_new)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags); + struct widget * (*button_new_with_callback)(struct gui_priv *this, const char *text, struct graphics_image *image, + enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data); + struct widget * (*box_new)(struct gui_priv *this, enum flags flags); + struct widget * (*label_new)(struct gui_priv *this, const char *text); + struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image); + struct widget * (*keyboard)(struct gui_priv *this, int mode); + struct widget * (*menu)(struct gui_priv *this, const char *label); + enum flags (*get_flags)(struct widget *widget); + void (*set_flags)(struct widget *widget, enum flags flags); + int (*get_state)(struct widget *widget); + void (*set_state)(struct widget *widget, int state); + void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data)); + void (*set_data)(struct widget *widget, void *data); + void (*set_default_background)(struct gui_priv *this, struct widget *widget); }; struct gui_internal_data { - struct gui_priv *priv; - struct gui_internal_methods *gui; - struct gui_internal_widget_methods *widget; + struct gui_priv *priv; + struct gui_internal_methods *gui; + struct gui_internal_widget_methods *widget; }; diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h index 9b9039224..b9887c915 100644 --- a/navit/gui/internal/gui_internal_keyboard.h +++ b/navit/gui/internal/gui_internal_keyboard.h @@ -2,21 +2,21 @@ * Modes for the on-screen keyboard */ enum vkbd_mode { - /* layouts */ - VKBD_LATIN_UPPER = 0, /*!< Latin uppercase characters */ - VKBD_LATIN_LOWER = 8, /*!< Latin lowercase characters */ - VKBD_NUMERIC = 16, /*!< Numeric keyboard */ - VKBD_UMLAUT_UPPER = 24, /*!< Extended Latin uppercase characters */ - VKBD_UMLAUT_LOWER = 32, /*!< Extended Latin lowercase characters */ - VKBD_CYRILLIC_UPPER = 40, /*!< Cyrillic uppercase characters */ - VKBD_CYRILLIC_LOWER = 48, /*!< Cyrillic lowercase characters */ - VKBD_DEGREE = 56, /*!< Numeric keyboard with extra characters (NESW, degree, minute) for coordinate input */ + /* layouts */ + VKBD_LATIN_UPPER = 0, /*!< Latin uppercase characters */ + VKBD_LATIN_LOWER = 8, /*!< Latin lowercase characters */ + VKBD_NUMERIC = 16, /*!< Numeric keyboard */ + VKBD_UMLAUT_UPPER = 24, /*!< Extended Latin uppercase characters */ + VKBD_UMLAUT_LOWER = 32, /*!< Extended Latin lowercase characters */ + VKBD_CYRILLIC_UPPER = 40, /*!< Cyrillic uppercase characters */ + VKBD_CYRILLIC_LOWER = 48, /*!< Cyrillic lowercase characters */ + VKBD_DEGREE = 56, /*!< Numeric keyboard with extra characters (NESW, degree, minute) for coordinate input */ - /* modifiers and masks */ - VKBD_FLAG_2 = 2, /* FIXME seems to show alpha/num switch (VKBD_NUMERIC and VKBD_LATIN_* only) and switches to lowercase after first character */ - VKBD_MASK_7 = 7, /* FIXME modifiers for layout? */ - VKBD_FLAG_1024 = 1024, /* FIXME what is this for? Seems to have to do something with scroll box visibility */ - VKBD_LAYOUT_MASK = ~7, /* when XORed with the mode, preserves only the layout FIXME document properly */ + /* modifiers and masks */ + VKBD_FLAG_2 = 2, /* FIXME seems to show alpha/num switch (VKBD_NUMERIC and VKBD_LATIN_* only) and switches to lowercase after first character */ + VKBD_MASK_7 = 7, /* FIXME modifiers for layout? */ + VKBD_FLAG_1024 = 1024, /* FIXME what is this for? Seems to have to do something with scroll box visibility */ + VKBD_LAYOUT_MASK = ~7, /* when XORed with the mode, preserves only the layout FIXME document properly */ }; /* prototypes */ diff --git a/navit/gui/internal/gui_internal_poi.h b/navit/gui/internal/gui_internal_poi.h index 4e6bed74b..c2515a1c6 100644 --- a/navit/gui/internal/gui_internal_poi.h +++ b/navit/gui/internal/gui_internal_poi.h @@ -6,40 +6,40 @@ struct poi_param { - /** - * =1 if selnb is defined, 0 otherwize. - */ - unsigned char sel; + /** + * =1 if selnb is defined, 0 otherwize. + */ + unsigned char sel; - /** - * Index to struct selector selectors[], shows what type of POIs is defined. - */ - unsigned char selnb; - /** - * Page number to display. - */ - unsigned char pagenb; - /** - * Radius (number of 10-kilometer intervals) to search for POIs. - */ - unsigned char dist; - /** - * Should filter phrase be compared to postal address of the POI. - * =0 - name filter, =1 - address filter, =2 - address filter, including postal code - */ - unsigned char AddressFilterType; - /** - * Filter string, casefold()ed and divided into substrings at the spaces, which are replaced by ASCII 0*. - */ - char *filterstr; - /** - * list of pointers to individual substrings of filterstr. - */ - GList *filter; - /** - * Number of POIs in this list - */ - int count; + /** + * Index to struct selector selectors[], shows what type of POIs is defined. + */ + unsigned char selnb; + /** + * Page number to display. + */ + unsigned char pagenb; + /** + * Radius (number of 10-kilometer intervals) to search for POIs. + */ + unsigned char dist; + /** + * Should filter phrase be compared to postal address of the POI. + * =0 - name filter, =1 - address filter, =2 - address filter, including postal code + */ + unsigned char AddressFilterType; + /** + * Filter string, casefold()ed and divided into substrings at the spaces, which are replaced by ASCII 0*. + */ + char *filterstr; + /** + * list of pointers to individual substrings of filterstr. + */ + GList *filter; + /** + * Number of POIs in this list + */ + int count; }; /* prototypes */ @@ -50,7 +50,8 @@ struct poi_param; struct widget; void gui_internal_poi_param_free(void *p); void gui_internal_poi_param_set_filter(struct poi_param *param, char *text); -struct widget *gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, struct coord *c, struct route *route, int dist, char *name); +struct widget *gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, + struct coord *c, struct route *route, int dist, char *name); char *gui_internal_compose_item_address_string(struct item *item, int prependPostal); void gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *data); void gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data); diff --git a/navit/gui/internal/gui_internal_priv.h b/navit/gui/internal/gui_internal_priv.h index 66b3e41fe..d28cac649 100644 --- a/navit/gui/internal/gui_internal_priv.h +++ b/navit/gui/internal/gui_internal_priv.h @@ -6,33 +6,33 @@ */ struct gui_config_settings { - /** - * The base size (in fractions of a point) to use for text. - */ - int font_size; - /** - * The size (in pixels) that xs style icons should be scaled to. - * This icon size is typically used in various lists and should be set to value which allows a list row to be easily cliked or dragged. - */ - int icon_xs; - /** - * The size (in pixels) that s style icons (small) should be scaled to, used for the menu top row icons - */ - int icon_s; - /** - * The size (in pixels) that l style icons should be scaled to, used for icons defined in the menu html - */ - int icon_l; - /** - * The default amount of spacing (in pixels) to place between GUI elements. - */ - int spacing; + /** + * The base size (in fractions of a point) to use for text. + */ + int font_size; + /** + * The size (in pixels) that xs style icons should be scaled to. + * This icon size is typically used in various lists and should be set to value which allows a list row to be easily cliked or dragged. + */ + int icon_xs; + /** + * The size (in pixels) that s style icons (small) should be scaled to, used for the menu top row icons + */ + int icon_s; + /** + * The size (in pixels) that l style icons should be scaled to, used for icons defined in the menu html + */ + int icon_l; + /** + * The default amount of spacing (in pixels) to place between GUI elements. + */ + int spacing; }; struct route_data { - struct widget * route_table; - int route_showing; + struct widget * route_table; + int route_showing; }; /** @@ -41,136 +41,136 @@ struct route_data { * @author Martin Schaller (04/2008) */ struct gui_priv { - struct navit *nav; - struct attr self; - struct window *win; - struct graphics *gra; - struct graphics_gc *background; - struct graphics_gc *background2; - struct graphics_gc *highlight_background; - struct graphics_gc *foreground; - struct graphics_gc *text_foreground; - struct graphics_gc *text_background; - struct color background_color, background2_color, text_foreground_color, text_background_color; - int spacing; - int font_size; - char *font_name; - int fullscreen; - struct graphics_font *fonts[3]; - int icon_xs; /**< The size (in pixels) that xs style icons should be scaled to. + struct navit *nav; + struct attr self; + struct window *win; + struct graphics *gra; + struct graphics_gc *background; + struct graphics_gc *background2; + struct graphics_gc *highlight_background; + struct graphics_gc *foreground; + struct graphics_gc *text_foreground; + struct graphics_gc *text_background; + struct color background_color, background2_color, text_foreground_color, text_background_color; + int spacing; + int font_size; + char *font_name; + int fullscreen; + struct graphics_font *fonts[3]; + int icon_xs; /**< The size (in pixels) that xs style icons should be scaled to. * This icon size can be too small to click it on some devices. */ - int icon_s; /**< The size (in pixels) that s style icons (small) should be scaled to */ - int icon_l; /**< The size (in pixels) that l style icons should be scaled to */ - int pressed; - struct widget *widgets; - int widgets_count; - int redraw; - struct widget root; - struct widget *highlighted,*editable; - struct widget *highlighted_menu; - struct pcoord clickp, vehiclep; - struct attr *click_coord_geo, *position_coord_geo; - struct search_list *sl; - int ignore_button; - int menu_on_map_click; - char *on_map_click; - int signal_on_map_click; - char *country_iso2; - int speech; - int keyboard; /**< Whether the internal GUI keyboard is enabled */ - int keyboard_required; /**< Whether keyboard input is needed. This is only used by the + int icon_s; /**< The size (in pixels) that s style icons (small) should be scaled to */ + int icon_l; /**< The size (in pixels) that l style icons should be scaled to */ + int pressed; + struct widget *widgets; + int widgets_count; + int redraw; + struct widget root; + struct widget *highlighted,*editable; + struct widget *highlighted_menu; + struct pcoord clickp, vehiclep; + struct attr *click_coord_geo, *position_coord_geo; + struct search_list *sl; + int ignore_button; + int menu_on_map_click; + char *on_map_click; + int signal_on_map_click; + char *country_iso2; + int speech; + int keyboard; /**< Whether the internal GUI keyboard is enabled */ + int keyboard_required; /**< Whether keyboard input is needed. This is only used by the * HTML menu, text entry dialogs do not use this member. */ - struct gui_config_settings config; /**< The setting information read from the configuration file. + struct gui_config_settings config; /**< The setting information read from the configuration file. * values of -1 indicate no value was specified in the config file. */ - struct event_idle *idle; - struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback; - struct event_timeout *motion_timeout_event; - struct point current; + struct event_idle *idle; + struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback; + struct event_timeout *motion_timeout_event; + struct point current; - struct callback * vehicle_cb; - struct route_data route_data; /**< Stores information about the route. */ + struct callback * vehicle_cb; + struct route_data route_data; /**< Stores information about the route. */ - struct gui_internal_data data; - struct callback_list *cbl; - int flags; - int cols; - struct attr osd_configuration; /**< The OSD configuration, a set of flags controlling which OSD + struct gui_internal_data data; + struct callback_list *cbl; + int flags; + int cols; + struct attr osd_configuration; /**< The OSD configuration, a set of flags controlling which OSD * items will be visible. */ - int pitch; /**< The pitch for the 3D map view. */ - int flags_town,flags_street,flags_house_number; - int radius; - int mouse_button_clicked_on_map; -/* html */ - char *html_text; - int html_depth; - struct widget *html_container; - int html_skip; - char *html_anchor; - char *href; - int html_anchor_found; - struct form *form; - struct html { - int skip; - enum html_tag { - html_tag_none, - html_tag_a, - html_tag_h1, - html_tag_html, - html_tag_img, - html_tag_script, - html_tag_form, - html_tag_input, - html_tag_div, - } tag; - char *command; - char *name; - char *href; - char *refresh_cond; - char *class; - int font_size; - struct widget *w; - struct widget *container; - } html[10]; + int pitch; /**< The pitch for the 3D map view. */ + int flags_town,flags_street,flags_house_number; + int radius; + int mouse_button_clicked_on_map; + /* html */ + char *html_text; + int html_depth; + struct widget *html_container; + int html_skip; + char *html_anchor; + char *href; + int html_anchor_found; + struct form *form; + struct html { + int skip; + enum html_tag { + html_tag_none, + html_tag_a, + html_tag_h1, + html_tag_html, + html_tag_img, + html_tag_script, + html_tag_form, + html_tag_input, + html_tag_div, + } tag; + char *command; + char *name; + char *href; + char *refresh_cond; + char *class; + int font_size; + struct widget *w; + struct widget *container; + } html[10]; -/* gestures */ + /* gestures */ - struct gesture_elem { - long long msec; - struct point p; - } gesture_ring[GESTURE_RINGSIZE]; - int gesture_ring_last, gesture_ring_first; + struct gesture_elem { + long long msec; + struct point p; + } gesture_ring[GESTURE_RINGSIZE]; + int gesture_ring_last, gesture_ring_first; - int hide_keys; //Flag to set the keyboard mode 1: hide impossible keys on search; 0: highlight them. - int results_map_population; + int hide_keys; //Flag to set the keyboard mode 1: hide impossible keys on search; 0: highlight them. + int results_map_population; }; struct menu_data { - struct widget *search_list; - struct widget *keyboard; - struct widget *button_bar; - struct widget *menu; - int keyboard_mode; - void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data); - struct widget *redisplay_widget; - char *href; - struct attr refresh_callback_obj,refresh_callback; + struct widget *search_list; + struct widget *keyboard; + struct widget *button_bar; + struct widget *menu; + int keyboard_mode; + void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data); + struct widget *redisplay_widget; + char *href; + struct attr refresh_callback_obj,refresh_callback; }; struct heightline { - struct heightline *next; - int height; - struct coord_rect bbox; - int count; - struct coord c[0]; + struct heightline *next; + int height; + struct coord_rect bbox; + int count; + struct coord c[0]; }; struct diagram_point { - struct diagram_point *next; - struct coord c; + struct diagram_point *next; + struct coord c; }; /* prototypes */ enum flags; @@ -190,18 +190,22 @@ struct widget; struct graphics_image *image_new_xs(struct gui_priv *this, const char *name); struct graphics_image *image_new_s(struct gui_priv *this, const char *name); struct graphics_image *image_new_l(struct gui_priv *this, const char *name); -struct widget *gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on, struct attr *off); -struct widget *gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt); +struct widget *gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, + struct attr *on, struct attr *off); +struct widget *gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, + struct map *map, struct attr *on, struct attr *off, int deflt); void gui_internal_say(struct gui_priv *this, struct widget *w, int questionmark); void gui_internal_back(struct gui_priv *this, struct widget *w, void *data); void gui_internal_cmd_return(struct gui_priv *this, struct widget *wm, void *data); void gui_internal_cmd_main_menu(struct gui_priv *this, struct widget *wm, void *data); struct widget *gui_internal_time_help(struct gui_priv *this); void gui_internal_apply_config(struct gui_priv *this); -void gui_internal_select_waypoint(struct gui_priv *this, const char *title, const char *hint, struct widget *wm_, void (*cmd)(struct gui_priv *priv, struct widget *widget, void *data), void *data); +void gui_internal_select_waypoint(struct gui_priv *this, const char *title, const char *hint, struct widget *wm_, + void (*cmd)(struct gui_priv *priv, struct widget *widget, void *data), void *data); void gui_internal_call_linked_on_finish(struct gui_priv *this, struct widget *wm, void *data); char *removecase(char *s); -void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, struct widget *wm, const char *name, int flags); +void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, + struct widget *wm, const char *name, int flags); void gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data); void gui_internal_cmd_bookmarks(struct gui_priv *this, struct widget *wm, void *data); void gui_internal_keypress_do(struct gui_priv *this, char *key); diff --git a/navit/gui/internal/gui_internal_widget.h b/navit/gui/internal/gui_internal_widget.h index 33f03e478..c1cc030f8 100644 --- a/navit/gui/internal/gui_internal_widget.h +++ b/navit/gui/internal/gui_internal_widget.h @@ -1,7 +1,7 @@ enum gui_internal_reason { - gui_internal_reason_click=1, - gui_internal_reason_keypress, - gui_internal_reason_keypress_finish + gui_internal_reason_click=1, + gui_internal_reason_keypress, + gui_internal_reason_keypress_finish }; //############################################################################################################## @@ -10,96 +10,96 @@ enum gui_internal_reason { //# Authors: Martin Schaller (04/2008) //############################################################################################################## struct widget { - enum widget_type type; - struct graphics_gc *background,*text_background; - struct graphics_gc *foreground_frame; - struct graphics_gc *foreground; - char *text; - struct graphics_image *img; - /** - * A function to be invoked on actions. - * @li widget The widget that is receiving the button press. - * - */ - void (*func)(struct gui_priv *priv, struct widget *widget, void *data); - enum gui_internal_reason reason; - int datai; - void *data; - /** - * @brief A function to deallocate data - */ - void (*data_free)(void *data); + enum widget_type type; + struct graphics_gc *background,*text_background; + struct graphics_gc *foreground_frame; + struct graphics_gc *foreground; + char *text; + struct graphics_image *img; + /** + * A function to be invoked on actions. + * @li widget The widget that is receiving the button press. + * + */ + void (*func)(struct gui_priv *priv, struct widget *widget, void *data); + enum gui_internal_reason reason; + int datai; + void *data; + /** + * @brief A function to deallocate data + */ + void (*data_free)(void *data); - /** - * @brief a function that will be called as the widget is being destroyed. - * This function can act as a destructor for the widget. It allows for - * on deallocation actions to be specified on a per widget basis. - * This function will call g_free on the widget (if required). - */ - void (*wfree) (struct gui_priv *this_, struct widget * w); - char *prefix; - char *name; - char *speech; - char *command; - struct pcoord c; - struct item item; - int selection_id; - int state; - struct point p; - int wmin,hmin; - int w,h; - int textw,texth; - int font_idx; - int bl,br,bt,bb,spx,spy; - int border; - int packed; - /** - * The number of widgets to layout horizontally when doing - * a orientation_horizontal_vertical layout - */ - int cols; - enum flags flags; - int flags2; - void *instance; - int (*set_attr)(void *, struct attr *); - int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *); - void (*remove_cb)(void *, struct callback *cb); - struct callback *cb; - struct attr on; - struct attr off; - int deflt; - int is_on; - int redraw; - struct menu_data *menu_data; - struct form *form; - GList *children; - struct widget *parent; - struct scroll_buttons *scroll_buttons; + /** + * @brief a function that will be called as the widget is being destroyed. + * This function can act as a destructor for the widget. It allows for + * on deallocation actions to be specified on a per widget basis. + * This function will call g_free on the widget (if required). + */ + void (*wfree) (struct gui_priv *this_, struct widget * w); + char *prefix; + char *name; + char *speech; + char *command; + struct pcoord c; + struct item item; + int selection_id; + int state; + struct point p; + int wmin,hmin; + int w,h; + int textw,texth; + int font_idx; + int bl,br,bt,bb,spx,spy; + int border; + int packed; + /** + * The number of widgets to layout horizontally when doing + * a orientation_horizontal_vertical layout + */ + int cols; + enum flags flags; + int flags2; + void *instance; + int (*set_attr)(void *, struct attr *); + int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *); + void (*remove_cb)(void *, struct callback *cb); + struct callback *cb; + struct attr on; + struct attr off; + int deflt; + int is_on; + int redraw; + struct menu_data *menu_data; + struct form *form; + GList *children; + struct widget *parent; + struct scroll_buttons *scroll_buttons; }; struct scroll_buttons { - /** - * Button box should not be displayed if button_box_hide is not zero. - */ - int button_box_hide; - /** - * A container box that is the child of the table widget that contains+groups - * the next and previous button. - */ - struct widget * button_box; - /** - * A button widget to handle 'next page' requests - */ - struct widget * next_button; - /** - * A button widget to handle 'previous page' requests. - */ - struct widget * prev_button; - /** - * a pointer to the gui context. - * This is needed by the free function to destroy the buttons. - */ - struct gui_priv * this; + /** + * Button box should not be displayed if button_box_hide is not zero. + */ + int button_box_hide; + /** + * A container box that is the child of the table widget that contains+groups + * the next and previous button. + */ + struct widget * button_box; + /** + * A button widget to handle 'next page' requests + */ + struct widget * next_button; + /** + * A button widget to handle 'previous page' requests. + */ + struct widget * prev_button; + /** + * a pointer to the gui context. + * This is needed by the free function to destroy the buttons. + */ + struct gui_priv * this; }; /** @@ -111,20 +111,19 @@ struct scroll_buttons { * The table_data structure needs to be freed with data_free along with the widget. * */ -struct table_data -{ - /** - * A GList pointer into a widget->children list that indicates the row - * currently being rendered at the top of the table. - */ - GList * top_row; - /** - * A Glist pointer into a widget->children list that indicates the row - * currently being rendered at the bottom of the table. - */ - GList * bottom_row; +struct table_data { + /** + * A GList pointer into a widget->children list that indicates the row + * currently being rendered at the top of the table. + */ + GList * top_row; + /** + * A Glist pointer into a widget->children list that indicates the row + * currently being rendered at the bottom of the table. + */ + GList * bottom_row; - struct scroll_buttons scroll_buttons; + struct scroll_buttons scroll_buttons; }; @@ -133,18 +132,17 @@ struct table_data * * */ -struct table_column_desc -{ +struct table_column_desc { - /** - * The computed height of a cell in the table. - */ - int height; + /** + * The computed height of a cell in the table. + */ + int height; - /** - * The computed width of a cell in the table. - */ - int width; + /** + * The computed width of a cell in the table. + */ + int width; }; /* prototypes */ enum flags; @@ -159,9 +157,14 @@ struct widget *gui_internal_label_new_abbrev(struct gui_priv *this, const char * struct widget *gui_internal_image_new(struct gui_priv *this, struct graphics_image *image); struct widget *gui_internal_text_font_new(struct gui_priv *this, const char *text, int font, enum flags flags); struct widget *gui_internal_text_new(struct gui_priv *this, const char *text, enum flags flags); -struct widget *gui_internal_button_font_new_with_callback(struct gui_priv *this, const char *text, int font, struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data); -struct widget *gui_internal_button_new_with_callback(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data); -struct widget *gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags); +struct widget *gui_internal_button_font_new_with_callback(struct gui_priv *this, const char *text, int font, + struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), + void *data); +struct widget *gui_internal_button_new_with_callback(struct gui_priv *this, const char *text, + struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), + void *data); +struct widget *gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image, + enum flags flags); struct widget *gui_internal_find_widget(struct widget *wi, struct point *p, int flags); void gui_internal_highlight_do(struct gui_priv *this, struct widget *found); void gui_internal_highlight(struct gui_priv *this); diff --git a/navit/maps/CMakeLists.txt b/navit/maps/CMakeLists.txt index 3bd7a8f44..dbda66e2e 100644 --- a/navit/maps/CMakeLists.txt +++ b/navit/maps/CMakeLists.txt @@ -2,7 +2,6 @@ if(SAMPLE_MAP) set(SAMPLE_MAP_NAME osm_bbox_11.3,47.9,11.7,48.2) set(maptool_args "--attr-debug-level=5") - GET_TARGET_PROPERTY(MAPTOOL_PATH maptool LOCATION) add_custom_target(sample_map ALL DEPENDS ${SAMPLE_MAP_NAME}.xml) add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.xml @@ -25,7 +24,7 @@ if(SAMPLE_MAP) add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin COMMAND bzcat ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.osm.bz2 - | ${MAPTOOL_PATH} ${maptool_args} ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin + | $<TARGET_FILE:maptool> ${maptool_args} ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin VERBATIM DEPENDS maptool ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.osm.bz2 ) |