summaryrefslogtreecommitdiff
path: root/navit/gui
diff options
context:
space:
mode:
Diffstat (limited to 'navit/gui')
-rw-r--r--navit/gui/gtk/CMakeLists.txt2
-rw-r--r--navit/gui/gtk/datawindow.c214
-rw-r--r--navit/gui/gtk/destination.c582
-rw-r--r--navit/gui/gtk/gui_gtk.h62
-rw-r--r--navit/gui/gtk/gui_gtk_action.c640
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c362
-rw-r--r--navit/gui/gtk/gui_gtk_poi.h28
-rw-r--r--navit/gui/gtk/gui_gtk_statusbar.c178
-rw-r--r--navit/gui/gtk/gui_gtk_window.c812
-rw-r--r--navit/gui/internal/CMakeLists.txt1
-rw-r--r--navit/gui/internal/gui_internal.c3471
-rw-r--r--navit/gui/internal/gui_internal.h85
-rw-r--r--navit/gui/internal/gui_internal_bookmark.c313
-rw-r--r--navit/gui/internal/gui_internal_bookmark.h13
-rw-r--r--navit/gui/internal/gui_internal_command.c1352
-rw-r--r--navit/gui/internal/gui_internal_command.h8
-rw-r--r--navit/gui/internal/gui_internal_gesture.c145
-rw-r--r--navit/gui/internal/gui_internal_gesture.h8
-rw-r--r--navit/gui/internal/gui_internal_html.c504
-rw-r--r--navit/gui/internal/gui_internal_html.h5
-rw-r--r--navit/gui/internal/gui_internal_keyboard.c560
-rw-r--r--navit/gui/internal/gui_internal_keyboard.h31
-rw-r--r--navit/gui/internal/gui_internal_menu.c373
-rw-r--r--navit/gui/internal/gui_internal_menu.h12
-rw-r--r--navit/gui/internal/gui_internal_poi.c792
-rw-r--r--navit/gui/internal/gui_internal_poi.h57
-rw-r--r--navit/gui/internal/gui_internal_priv.h228
-rw-r--r--navit/gui/internal/gui_internal_search.c635
-rw-r--r--navit/gui/internal/gui_internal_search.h10
-rw-r--r--navit/gui/internal/gui_internal_widget.c1497
-rw-r--r--navit/gui/internal/gui_internal_widget.h193
-rw-r--r--navit/gui/qml/CMakeLists.txt23
-rw-r--r--navit/gui/qml/bookmarksProxy.h171
-rw-r--r--navit/gui/qml/guiProxy.h152
-rw-r--r--navit/gui/qml/gui_qml.cpp477
-rw-r--r--navit/gui/qml/navitProxy.h150
-rw-r--r--navit/gui/qml/ngqpoint.h382
-rw-r--r--navit/gui/qml/proxy.h109
-rw-r--r--navit/gui/qml/routeProxy.h72
-rw-r--r--navit/gui/qml/searchProxy.h229
-rw-r--r--navit/gui/qml/skins/navit/ButtonIcon.qml40
-rw-r--r--navit/gui/qml/skins/navit/Cellar.qml38
-rw-r--r--navit/gui/qml/skins/navit/CommonHighlight.qml9
-rw-r--r--navit/gui/qml/skins/navit/ListSelector.qml49
-rw-r--r--navit/gui/qml/skins/navit/PageAbout.qml28
-rw-r--r--navit/gui/qml/skins/navit/PageBookmarks.qml144
-rw-r--r--navit/gui/qml/skins/navit/PageBookmarksAdd.qml70
-rw-r--r--navit/gui/qml/skins/navit/PageMain.qml29
-rw-r--r--navit/gui/qml/skins/navit/PageNavigate.qml88
-rw-r--r--navit/gui/qml/skins/navit/PagePoi.qml150
-rw-r--r--navit/gui/qml/skins/navit/PagePointInfo.qml79
-rw-r--r--navit/gui/qml/skins/navit/PageRoute.qml94
-rw-r--r--navit/gui/qml/skins/navit/PageSearch.qml92
-rw-r--r--navit/gui/qml/skins/navit/PageSearchSelector.qml108
-rw-r--r--navit/gui/qml/skins/navit/PageSettings.qml54
-rw-r--r--navit/gui/qml/skins/navit/PageSettingsDisplay.qml91
-rw-r--r--navit/gui/qml/skins/navit/PageSettingsLocale.qml33
-rw-r--r--navit/gui/qml/skins/navit/PageSettingsRules.qml38
-rw-r--r--navit/gui/qml/skins/navit/PageSettingsTools.qml32
-rw-r--r--navit/gui/qml/skins/navit/PageSettingsVehicle.qml61
-rw-r--r--navit/gui/qml/skins/navit/Slider.qml74
-rw-r--r--navit/gui/qml/skins/navit/ToggleButton.qml66
-rw-r--r--navit/gui/qml/skins/navit/ToggleSwitch.qml72
-rw-r--r--navit/gui/qml/skins/navit/background.svg23
-rw-r--r--navit/gui/qml/skins/navit/command.js20
-rw-r--r--navit/gui/qml/skins/navit/knob.svg867
-rw-r--r--navit/gui/qml/skins/navit/main.qml31
-rw-r--r--navit/gui/qml/skins/navit/pagenavigation.js15
-rw-r--r--navit/gui/qml/vehicleProxy.h24
-rw-r--r--navit/gui/qt5_qml/CMakeLists.txt9
-rw-r--r--navit/gui/qt5_qml/backend.cpp603
-rw-r--r--navit/gui/qt5_qml/backend.h115
-rw-r--r--navit/gui/qt5_qml/editor/.gitignore73
-rw-r--r--navit/gui/qt5_qml/editor/editor.pro29
-rw-r--r--navit/gui/qt5_qml/editor/gui_qt5_qml.qml59
-rw-r--r--navit/gui/qt5_qml/editor/main.cpp13
-rw-r--r--navit/gui/qt5_qml/editor/main.qml59
-rw-r--r--navit/gui/qt5_qml/editor/map.pngbin604456 -> 0 bytes
-rw-r--r--navit/gui/qt5_qml/editor/qml.qrc42
l---------navit/gui/qt5_qml/editor/skins1
-rw-r--r--navit/gui/qt5_qml/gui_qt5_qml.cpp322
-rw-r--r--navit/gui/qt5_qml/gui_qt5_qml.qrc42
-rw-r--r--navit/gui/qt5_qml/map.pngbin604456 -> 0 bytes
-rw-r--r--navit/gui/qt5_qml/proxy.c70
-rw-r--r--navit/gui/qt5_qml/proxy.h1
-rw-r--r--navit/gui/qt5_qml/qml_bookmark.cpp32
-rw-r--r--navit/gui/qt5_qml/qml_bookmark.h31
-rw-r--r--navit/gui/qt5_qml/qml_map.cpp38
-rw-r--r--navit/gui/qt5_qml/qml_map.h32
-rw-r--r--navit/gui/qt5_qml/qml_poi.cpp74
-rw-r--r--navit/gui/qt5_qml/qml_poi.h51
-rw-r--r--navit/gui/qt5_qml/qml_search.cpp42
-rw-r--r--navit/gui/qt5_qml/qml_search.h34
-rw-r--r--navit/gui/qt5_qml/qml_vehicle.cpp52
-rw-r--r--navit/gui/qt5_qml/qml_vehicle.h40
-rw-r--r--navit/gui/qt5_qml/skins/MainButton.qml71
-rw-r--r--navit/gui/qt5_qml/skins/MainMenu.qml55
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.chevron.down.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.chevron.up.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.cog.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.cogs.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.fullscreen.box.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.home.variant.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.information.circle.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.layer.delete.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.layer.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.location.checkin.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.map.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.power.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.rocket.svg5
-rw-r--r--navit/gui/qt5_qml/skins/icons/appbar.transit.car.svg5
-rw-r--r--navit/gui/qt5_qml/skins/maps.qml36
-rw-r--r--navit/gui/qt5_qml/skins/menu.qml51
-rw-r--r--navit/gui/qt5_qml/skins/modern/MainButton.qml72
-rw-r--r--navit/gui/qt5_qml/skins/modern/MainMenu.qml64
-rw-r--r--navit/gui/qt5_qml/skins/modern/bookmark.qml104
-rw-r--r--navit/gui/qt5_qml/skins/modern/bookmarks.qml108
-rw-r--r--navit/gui/qt5_qml/skins/modern/destination.qml45
-rw-r--r--navit/gui/qt5_qml/skins/modern/destination_address.qml45
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.book.list.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.down.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.up.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.city.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.cog.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.cogs.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.fullscreen.box.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.home.variant.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.information.circle.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.layer.delete.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.layer.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.location.checkin.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.location.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.map.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.power.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.rocket.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.timer.rewind.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/appbar.transit.car.svg5
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/bigcity.pngbin958 -> 0 bytes
-rw-r--r--navit/gui/qt5_qml/skins/modern/icons/smallcity.pngbin897 -> 0 bytes
-rw-r--r--navit/gui/qt5_qml/skins/modern/main.qml80
-rw-r--r--navit/gui/qt5_qml/skins/modern/maps.qml45
-rw-r--r--navit/gui/qt5_qml/skins/modern/menu.qml61
-rw-r--r--navit/gui/qt5_qml/skins/modern/navit.svg393
-rw-r--r--navit/gui/qt5_qml/skins/modern/poi.qml104
-rw-r--r--navit/gui/qt5_qml/skins/modern/pois.qml128
-rw-r--r--navit/gui/qt5_qml/skins/modern/search.qml132
-rw-r--r--navit/gui/qt5_qml/skins/modern/search_result_item.qml43
-rw-r--r--navit/gui/qt5_qml/skins/modern/settings.qml44
-rw-r--r--navit/gui/qt5_qml/skins/modern/vehicle.qml11
-rw-r--r--navit/gui/qt5_qml/skins/modern/vehicles.qml46
-rw-r--r--navit/gui/qt5_qml/skins/navit.svg393
-rw-r--r--navit/gui/qt5_qml/skins/pois.qml119
-rw-r--r--navit/gui/qt5_qml/skins/settings.qml41
-rw-r--r--navit/gui/win32/CMakeLists.txt2
-rw-r--r--navit/gui/win32/ceglue.c77
-rw-r--r--navit/gui/win32/ceglue.h16
-rw-r--r--navit/gui/win32/gui_win32.c643
-rw-r--r--navit/gui/win32/resources/navit.icobin10134 -> 0 bytes
-rw-r--r--navit/gui/win32/resources/resource.h4
-rw-r--r--navit/gui/win32/resources/resource.rc16
-rw-r--r--navit/gui/win32/resources/toolbar.bmpbin1398 -> 0 bytes
-rw-r--r--navit/gui/win32/win32_gui_destination.c412
-rw-r--r--navit/gui/win32/win32_gui_notify.c132
-rw-r--r--navit/gui/win32/win32_gui_notify.h18
164 files changed, 0 insertions, 23092 deletions
diff --git a/navit/gui/gtk/CMakeLists.txt b/navit/gui/gtk/CMakeLists.txt
deleted file mode 100644
index a1dfa173c..000000000
--- a/navit/gui/gtk/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-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/datawindow.c b/navit/gui/gtk/datawindow.c
deleted file mode 100644
index dd71ce999..000000000
--- a/navit/gui/gtk/datawindow.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 <stdio.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include "debug.h"
-#include "callback.h"
-#include "param.h"
-#include "data_window.h"
-#include "gui_gtk.h"
-
-struct datawindow_priv {
- GtkWidget *window;
- GtkWidget *scrolled_window;
- GtkWidget *treeview;
- GtkWidget *button;
- GtkListStore *liststore;
- GtkTreeModel *sortmodel;
- struct callback *click, *close;
- struct gui_priv *gui;
-};
-
-static GValue value;
-static void
-select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, struct datawindow_priv *win)
-{
- char *cols[20];
- GtkTreeIter iter;
- GtkTreeModel *model;
- int i;
-
- dbg(lvl_debug,"win=%p\n", win);
-
- model=gtk_tree_view_get_model(tree);
- gtk_tree_model_get_iter(model, &iter, path);
-
- for (i=0;i<gtk_tree_model_get_n_columns(model);i++) {
- gtk_tree_model_get_value(model, &iter, i, &value);
- cols[i]=g_strdup_value_contents(&value)+1;
- cols[i][strlen(cols[i])-1]='\0';
- g_value_unset(&value);
- }
- callback_call_1(win->click, cols);
-}
-
-static void
-gui_gtk_datawindow_add(struct datawindow_priv *win, struct param_list *param, int count)
-{
- int i;
- GtkCellRenderer *cell;
- GtkTreeIter iter;
- GType types[count];
-
- if (! win->treeview) {
- win->treeview=gtk_tree_view_new();
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
- gtk_container_add(GTK_CONTAINER(win->scrolled_window), win->treeview);
- gtk_widget_show_all(GTK_WIDGET(win->window));
- gtk_widget_grab_focus(GTK_WIDGET(win->treeview));
-
- /* add column names to treeview */
- for(i=0;i<count;i++) {
- if (param[i].name) {
- cell=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (win->treeview),-1,param[i].name,
- cell,"text",i, NULL);
- }
- }
-#if 0
- g_signal_connect(G_OBJECT(win->treeview), "click-column", G_CALLBACK(click_column), NULL);
-#endif
- g_signal_connect(G_OBJECT(win->treeview), "row-activated", G_CALLBACK(select_row), win);
- }
-
- /* find data storage and create a new one if none is there */
- if (gtk_tree_view_get_model(GTK_TREE_VIEW (win->treeview)) == NULL) {
- for(i=0;i<count;i++) {
- if (param[i].name && !strcmp(param[i].name, "Distance"))
- types[i]=G_TYPE_INT;
- else
- types[i]=G_TYPE_STRING;
- }
- win->liststore=gtk_list_store_newv(count,types);
- if (! strcmp(param[0].name, "Distance")) {
- win->sortmodel=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(win->liststore));
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (win->sortmodel), 0, GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->sortmodel));
- } else
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->liststore));
- }
-
- gtk_list_store_append(win->liststore,&iter);
-
- /* add data to data storage */
- for(i=0;i<count;i++) {
- if (param[i].name && !strcmp(param[i].name, "Distance")) {
- gtk_list_store_set(win->liststore,&iter,i,atoi(param[i].value),-1);
- } else {
- gtk_list_store_set(win->liststore,&iter,i,param[i].value,-1);
- }
- }
-}
-
-static void
-gui_gtk_datawindow_mode(struct datawindow_priv *win, int start)
-{
- if (start) {
- if (win && win->treeview) {
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
- }
- }
-}
-
-static gboolean
-gui_gtk_datawindow_delete(GtkWidget *widget, GdkEvent *event, struct datawindow_priv *win)
-{
- callback_call_0(win->close);
-
- if (win->button) {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(win->button), FALSE);
- }
-
- return FALSE;
-}
-
-void
-gui_gtk_datawindow_destroy(struct datawindow_priv *win)
-{
- if ((!win->gui) || (!win->gui->datawindow)) {
- return;
- }
-
- gui_gtk_datawindow_delete(NULL, NULL, win);
- gtk_widget_destroy(win->window);
- win->gui->datawindow = NULL;
-
- return;
-}
-
-void
-gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn)
-{
- this_->button = btn;
-}
-
-static gboolean
-keypress(GtkWidget *widget, GdkEventKey *event, struct datawindow_priv *win)
-{
- if (event->type != GDK_KEY_PRESS)
- return FALSE;
- if (event->keyval == GDK_Cancel) {
- gui_gtk_datawindow_delete(widget, (GdkEvent *)event, win);
- gtk_widget_destroy(win->window);
- }
- return FALSE;
-}
-
-
-static struct datawindow_methods gui_gtk_datawindow_meth = {
- gui_gtk_datawindow_destroy,
- gui_gtk_datawindow_add,
- gui_gtk_datawindow_mode,
-};
-
-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 *win;
-
- if (!gui)
- return NULL;
- *meth=gui_gtk_datawindow_meth;
- win=g_new0(struct datawindow_priv, 1);
- win->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size(GTK_WINDOW(win->window), 320, 200);
- gtk_window_set_title(GTK_WINDOW(win->window), name);
- gtk_window_set_wmclass (GTK_WINDOW (win->window), "navit", "Navit");
-
- win->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (win->scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add(GTK_CONTAINER(win->window), win->scrolled_window);
- g_signal_connect(G_OBJECT(win->window), "key-press-event", G_CALLBACK(keypress), win);
- win->treeview=NULL;
- win->click=click;
- win->close=close;
- gtk_window_set_transient_for(GTK_WINDOW((GtkWidget *)(win->window)), GTK_WINDOW(gui->win));
- g_signal_connect(G_OBJECT(win->window), "delete-event", G_CALLBACK(gui_gtk_datawindow_delete), win);
- gtk_widget_show_all(win->window);
-
- win->gui = gui;
- gui->datawindow = win;
- return win;
-}
-
diff --git a/navit/gui/gtk/destination.c b/navit/gui/gtk/destination.c
deleted file mode 100644
index 18fc58b75..000000000
--- a/navit/gui/gtk/destination.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <gtk/gtk.h>
-#include "debug.h"
-#include "destination.h"
-#include "navit.h"
-#include "item.h"
-#include "coord.h"
-#include "track.h"
-#include "country.h"
-#include "search.h"
-#include "projection.h"
-#include "navit_nls.h"
-#include "bookmarks.h"
-
-#define COL_COUNT 8
-
-static struct search_param {
- struct navit *nav;
- struct mapset *ms;
- struct search_list *sl;
- struct attr attr;
- int partial;
- GtkWidget *entry_country, *entry_postal, *entry_city, *entry_district;
- GtkWidget *entry_street, *entry_number;
- GtkWidget *listbox;
- GtkWidget *treeview;
- GtkListStore *liststore;
- GtkTreeModel *liststore2;
-} search_param;
-
-static void button_map(GtkWidget *widget, struct search_param *search)
-{
- GtkTreePath *path;
- GtkTreeViewColumn *focus_column;
- struct pcoord *c=NULL;
- GtkTreeIter iter;
-
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
- if(!path)
- return;
- if(!gtk_tree_model_get_iter(search->liststore2, &iter, path))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- navit_set_center(search->nav, c, 1);
- }
-}
-
-static char *description(struct search_param *search, GtkTreeIter *iter)
-{
- char *desc,*car,*postal,*town,*street;
- char empty='\0';
-
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 0, &car, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 1, &postal, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 2, &town, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 4, &street, -1);
-
- /* protect against nulls */
- if (car==0) car=&empty;
- if (postal==0) postal=&empty;
- if (town==0) town=&empty;
- if (street==0) street=&empty;
-
- if (search->attr.type == attr_town_name)
- desc=g_strdup_printf("%s-%s %s", car, postal, town);
- else
- desc=g_strdup_printf("%s-%s %s, %s", car, postal, town, street);
- return desc;
-}
-
-static void button_destination(GtkWidget *widget, struct search_param *search)
-{
- struct pcoord *c=NULL;
- GtkTreeIter iter;
- char *desc;
-
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- desc=description(search, &iter);
- navit_set_destination(search->nav, c, desc, 1);
- g_free(desc);
- }
-}
-
-static void button_bookmark(GtkWidget *widget, struct search_param *search)
-{
- struct pcoord *c=NULL;
- GtkTreeIter iter;
- char *desc;
- struct attr attr;
-
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- navit_get_attr(search->nav, attr_bookmarks, &attr, NULL);
- desc=description(search, &iter);
- bookmarks_add_bookmark(attr.u.bookmarks, c, desc);
- g_free(desc);
- }
-}
-
-
-char **columns_text[] = {
- (char *[]){_n("Car"),_n("Iso2"),_n("Iso3"),_n("Country"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),_n("Number"),NULL},
-};
-
-static void set_columns(struct search_param *param, int mode)
-{
- GList *columns_list,*columns;
- char **column_text=columns_text[mode];
- int i=0;
-
- columns_list=gtk_tree_view_get_columns(GTK_TREE_VIEW(param->treeview));
- columns=columns_list;
- while (columns) {
- gtk_tree_view_remove_column(GTK_TREE_VIEW(param->treeview), columns->data);
- columns=g_list_next(columns);
- }
- g_list_free(columns_list);
- while (*column_text) {
- GtkCellRenderer *cell=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (param->treeview),-1, navit_nls_gettext(*column_text), cell, "text", i, NULL);
- i++;
- column_text++;
- }
-
-}
-
-static void row_activated(GtkWidget *widget, GtkTreePath *p1, GtkTreeViewColumn *c, struct search_param *search)
-{
- GtkTreePath *path;
- GtkTreeViewColumn *focus_column;
- GtkTreeIter iter;
- GtkWidget *entry_widget;
- char *str;
- int column;
-
- dbg(lvl_debug,"enter\n");
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
- if(!path)
- return;
- if(!gtk_tree_model_get_iter(search->liststore2, &iter, path))
- return;
- switch(search->attr.type) {
- case attr_country_all:
- entry_widget=search->entry_country;
- column=3;
- break;
- case attr_town_name:
- entry_widget=search->entry_city;
- column=2;
- break;
- case attr_street_name:
- entry_widget=search->entry_street;
- column=4;
- break;
- default:
- dbg(lvl_debug,"Unknown mode\n");
- return;
- }
- gtk_tree_model_get(search->liststore2, &iter, column, &str, -1);
- dbg(lvl_debug,"str=%s\n", str);
- search->partial=0;
- gtk_entry_set_text(GTK_ENTRY(entry_widget), str);
-}
-
-static void tree_view_button_release(GtkWidget *widget, GdkEventButton *event, struct search_param *search)
-{
- GtkTreePath *path;
- GtkTreeViewColumn *column;
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &column);
- gtk_tree_view_row_activated(GTK_TREE_VIEW(search->treeview), path, column);
-
-}
-static void
-next_focus(struct search_param *search, GtkWidget *widget)
-{
- if (widget == search->entry_country)
- gtk_widget_grab_focus(search->entry_city);
- if (widget == search->entry_city)
- gtk_widget_grab_focus(search->entry_street);
- if (widget == search->entry_street)
- gtk_widget_grab_focus(search->entry_number);
-
-}
-
-static void changed(GtkWidget *widget, struct search_param *search)
-{
- struct search_list_result *res;
- GtkTreeIter iter;
-
- search->attr.u.str=(char *)gtk_entry_get_text(GTK_ENTRY(widget));
- printf("changed %s partial %d\n", search->attr.u.str, search->partial);
- if (widget == search->entry_country) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
- dbg(lvl_debug,"country\n");
- search->attr.type=attr_country_all;
- set_columns(search, 0);
- }
- if (widget == search->entry_postal) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 1, GTK_SORT_ASCENDING);
- dbg(lvl_debug,"postal\n");
- search->attr.type=attr_town_postal;
- if (strlen(search->attr.u.str) < 2)
- return;
- set_columns(search, 1);
- }
- if (widget == search->entry_city) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 2, GTK_SORT_ASCENDING);
- dbg(lvl_debug,"town\n");
- search->attr.type=attr_town_name;
- if (strlen(search->attr.u.str) < 3)
- return;
- set_columns(search, 1);
- }
- if (widget == search->entry_street) {
- dbg(lvl_debug,"street\n");
- search->attr.type=attr_street_name;
- // Searching for a street by just its first letter generates too many hits to be useful,
- // plus it causes the GUI to become unresponsive because the search is single-threaded.
- // So we only start searching once we have two letters.
- if (strlen(search->attr.u.str) < 2)
- return;
- set_columns(search, 2);
- }
-
- search_list_search(search->sl, &search->attr, search->partial);
- gtk_list_store_clear(search->liststore);
- while((res=search_list_get_result(search->sl))) {
- gtk_list_store_append(search->liststore,&iter);
- gtk_list_store_set(search->liststore,&iter,COL_COUNT,res->c,-1);
- if (widget == search->entry_country) {
- if (res->country) {
- gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
- gtk_list_store_set(search->liststore,&iter,1,res->country->iso3,-1);
- gtk_list_store_set(search->liststore,&iter,2,res->country->iso2,-1);
- gtk_list_store_set(search->liststore,&iter,3,res->country->name,-1);
- }
- } else {
- if (res->country)
- gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
- else
- gtk_list_store_set(search->liststore,&iter,0,"",-1);
- if (res->town) {
- gtk_list_store_set(search->liststore,&iter,1,res->town->common.postal,-1);
- gtk_list_store_set(search->liststore,&iter,2,res->town->common.town_name,-1);
- gtk_list_store_set(search->liststore,&iter,3,res->town->common.district_name,-1);
- } else {
- gtk_list_store_set(search->liststore,&iter,1,"",-1);
- gtk_list_store_set(search->liststore,&iter,2,"",-1);
- gtk_list_store_set(search->liststore,&iter,3,"",-1);
- }
- if (res->street)
- gtk_list_store_set(search->liststore,&iter,4,res->street->name,-1);
- else
- gtk_list_store_set(search->liststore,&iter,4,"",-1);
-
- }
- }
-
- if(! search->partial)
- {
- if( widget == search->entry_country )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_city), TRUE);
- }
- if( widget == search->entry_city )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_city), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_street), TRUE);
- }
- if( widget == search->entry_street )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_city), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_street), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_number), TRUE);
- }
- } else {
- if( widget == search->entry_country )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_city), FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_street), FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_number), FALSE);
- }
- if( widget == search->entry_city )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_street), FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_number), FALSE);
- }
- if( widget == search->entry_street )
- {
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_number), FALSE);
- }
- }
- if (! search->partial)
- next_focus(search, widget);
- search->partial=1;
-}
-
-/* borrowed from gpe-login */
-
-
-#define MAX_ARGS 8
-
-static void
-parse_xkbd_args (const char *cmd, char **argv)
-{
- const char *p = cmd;
- char buf[strlen (cmd) + 1], *bufp = buf;
- int nargs = 0;
- int escape = 0, squote = 0, dquote = 0;
-
- while (*p)
- {
- if (escape)
- {
- *bufp++ = *p;
- escape = 0;
- }
- else
- {
- switch (*p)
- {
- case '\\':
- escape = 1;
- break;
- case '"':
- if (squote)
- *bufp++ = *p;
- else
- dquote = !dquote;
- break;
- case '\'':
- if (dquote)
- *bufp++ = *p;
- else
- squote = !squote;
- break;
- case ' ':
- if (!squote && !dquote)
- {
- *bufp = 0;
- if (nargs < MAX_ARGS)
- argv[nargs++] = strdup (buf);
- bufp = buf;
- break;
- }
- default:
- *bufp++ = *p;
- break;
- }
- }
- p++;
- }
-
- if (bufp != buf)
- {
- *bufp = 0;
- if (nargs < MAX_ARGS)
- argv[nargs++] = strdup (buf);
- }
- argv[nargs] = NULL;
-}
-
-int kbd_pid;
-
-static int
-spawn_xkbd (char *xkbd_path, char *xkbd_str)
-{
-#ifdef _WIN32 // AF FIXME for WIN32
- #ifndef F_SETFD
- #define F_SETFD 2
- #endif
-#else
- char *xkbd_args[MAX_ARGS + 1];
- int fd[2];
- char buf[256];
- char c;
- int a = 0;
- size_t n;
-
- pipe (fd);
- kbd_pid = fork ();
- if (kbd_pid == 0)
- {
- close (fd[0]);
- if (dup2 (fd[1], 1) < 0)
- perror ("dup2");
- close (fd[1]);
- if (fcntl (1, F_SETFD, 0))
- perror ("fcntl");
- xkbd_args[0] = (char *)xkbd_path;
- xkbd_args[1] = "-xid";
- if (xkbd_str)
- parse_xkbd_args (xkbd_str, xkbd_args + 2);
- else
- xkbd_args[2] = NULL;
- execvp (xkbd_path, xkbd_args);
- perror (xkbd_path);
- _exit (1);
- }
- close (fd[1]);
- do {
- n = read (fd[0], &c, 1);
- if (n)
- {
- buf[a++] = c;
- }
- } while (n && (c != 10) && (a < (sizeof (buf) - 1)));
-
- if (a)
- {
- buf[a] = 0;
- return atoi (buf);
- }
-#endif
- return 0;
-}
-
-int destination_address(struct navit *nav)
-{
-
- GtkWidget *window2, *keyboard, *vbox, *table;
- GtkWidget *label_country;
- GtkWidget *label_postal, *label_city, *label_district;
- GtkWidget *label_street, *label_number;
- GtkWidget *button1,*button2,*button3;
- int i;
- struct search_param *search=&search_param;
- struct attr search_attr, country_name, *country_attr;
- struct tracking *tracking;
- struct country_search *cs;
- struct item *item;
-
-
- search->nav=nav;
- search->ms=navit_get_mapset(nav);
- search->sl=search_list_new(search->ms);
-
- window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window2),_("Enter Destination"));
- gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
- gtk_window_set_default_size (GTK_WINDOW (window2),0,300);
- vbox = gtk_vbox_new(FALSE, 0);
- table = gtk_table_new(3, 8, FALSE);
-
- search->entry_country = gtk_entry_new();
- label_country = gtk_label_new(_("Country"));
- search->entry_postal = gtk_entry_new();
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_postal), FALSE);
- label_postal = gtk_label_new(_("Zip Code"));
- search->entry_city = gtk_entry_new();
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_city), FALSE);
- label_city = gtk_label_new(_("City"));
- search->entry_district = gtk_entry_new();
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_district), FALSE);
- label_district = gtk_label_new(_("District/Township"));
- search->entry_street = gtk_entry_new();
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_street), FALSE);
- label_street = gtk_label_new(_("Street"));
- search->entry_number = gtk_entry_new();
- gtk_widget_set_sensitive(GTK_WIDGET(search->entry_number), FALSE);
- label_number = gtk_label_new(_("Number"));
- search->treeview=gtk_tree_view_new();
- search->listbox = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (search->listbox),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), NULL);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(search->listbox),search->treeview);
- {
- GType types[COL_COUNT+1];
- for(i=0;i<COL_COUNT;i++)
- types[i]=G_TYPE_STRING;
- types[i]=G_TYPE_POINTER;
- search->liststore=gtk_list_store_newv(COL_COUNT+1,types);
- search->liststore2=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->liststore));
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), GTK_TREE_MODEL(search->liststore2));
- }
-
-
-
-
- button1 = gtk_button_new_with_label(_("Map"));
- button2 = gtk_button_new_with_label(_("Bookmark"));
- button3 = gtk_button_new_with_label(_("Destination"));
-
- gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_city, 2, 3, 0, 1, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->entry_country, 0, 1, 1, 2, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_postal, 1, 2, 1, 2, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_city, 2, 3, 1, 2, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), label_district, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_street, 1, 2, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_number, 2, 3, 2, 3, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->entry_district, 0, 1, 3, 4, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_street, 1, 2, 3, 4, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_number, 2, 3, 3, 4, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->listbox, 0, 3, 4, 5, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), button1, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), button2, 1, 2, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), button3, 2, 3, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
-
- g_signal_connect(G_OBJECT(search->entry_country), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_postal), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_city), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_district), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_street), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_number), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button_map), search);
- g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button_bookmark), search);
- g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(button_destination), search);
- g_signal_connect(G_OBJECT(search->treeview), "button-release-event", G_CALLBACK(tree_view_button_release), search);
- g_signal_connect(G_OBJECT(search->treeview), "row_activated", G_CALLBACK(row_activated), search);
-
- gtk_widget_grab_focus(search->entry_city);
-
- gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
- keyboard=gtk_socket_new();
- gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window2), vbox);
-#if 0
- g_signal_connect(G_OBJECT(listbox), "select-row", G_CALLBACK(select_row), NULL);
-#endif
- gtk_widget_show_all(window2);
-
-#ifndef _WIN32
- gtk_socket_steal(GTK_SOCKET(keyboard), spawn_xkbd("xkbd","-geometry 200x100"));
-#endif
-
- country_attr=country_default();
- tracking=navit_get_tracking(nav);
- if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
- country_attr=&search_attr;
- if (country_attr) {
- cs=country_search_new(country_attr, 0);
- item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name))
- gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
- country_search_destroy(cs);
- } else {
- dbg(lvl_error,"warning: no default country found\n");
- }
- search->partial=1;
- return 0;
-}
diff --git a/navit/gui/gtk/gui_gtk.h b/navit/gui/gtk/gui_gtk.h
deleted file mode 100644
index 10051beaf..000000000
--- a/navit/gui/gtk/gui_gtk.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 "coord.h"
-
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-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;
-};
-
-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);
-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_action.c b/navit/gui/gtk/gui_gtk_action.c
deleted file mode 100644
index 951f1138a..000000000
--- a/navit/gui/gtk/gui_gtk_action.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 <string.h>
-#include <gtk/gtk.h>
-#include "navit.h"
-#include "gui_gtk.h"
-#ifdef __APPLE__
-#include "navit/menu.h"
-#else
-#include "menu.h"
-#endif
-#include "coord.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include "debug.h"
-#include "destination.h"
-#include "navit_nls.h"
-#include "gui_gtk_poi.h"
-
-struct menu_priv {
- char *path;
- GtkAction *action;
- struct gui_priv *gui;
- enum menu_type type;
- struct callback *cb;
- struct menu_priv *child;
- struct menu_priv *sibling;
- gulong handler_id;
- guint merge_id;
- GtkWidget *widget;
-};
-
-/* Create callbacks that implement our Actions */
-
-static void
-zoom_in_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_zoom_in(gui->nav, 2, NULL);
-}
-
-static void
-zoom_out_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_zoom_out(gui->nav, 2, NULL);
-}
-
-static void
-refresh_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_draw(gui->nav);
-}
-
-// Forward declarations, these should not be visible outside the GUI, so
-// they are not in the header files, but here
-void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
-void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
-
-static void
-roadbook_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
-
- if (! gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) {
- gui_gtk_datawindow_destroy(gui->datawindow);
- } else {
- navit_window_roadbook_new(gui->nav);
- if (gui->datawindow) {
- gui_gtk_datawindow_set_button(gui->datawindow, w);
- }
- }
-}
-
-static void
-autozoom_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr autozoom_attr;
-
- autozoom_attr.type = attr_autozoom_active;
- if (! gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) {
- autozoom_attr.u.num = 0;
- } else {
- autozoom_attr.u.num = 1;
- }
-
- navit_set_attr(gui->nav, &autozoom_attr);
-}
-
-static void
-cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_cursor;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(lvl_error, "Failed to set attr_cursor\n");
- }
-}
-
-static void
-tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_tracking;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(lvl_error, "Failed to set attr_tracking\n");
- }
-}
-
-static void
-orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_orientation;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)) ? 0:-1;
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(lvl_error, "Failed to set attr_orientation\n");
- }
-}
-
-static void
-window_fullscreen_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- if(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)))
- gtk_window_fullscreen(GTK_WINDOW(gui->win));
- else
- gtk_window_unfullscreen(GTK_WINDOW(gui->win));
-}
-
-#include <stdlib.h>
-#include "point.h"
-#include "transform.h"
-
-static void
-info_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- char buffer[512];
- int mw,mh;
- struct coord lt, rb;
- struct point p;
- struct transformation *t;
-
- t=navit_get_trans(gui->nav);
- transform_get_size(t, &mw, &mh);
- p.x=0;
- p.y=0;
- transform_reverse(t, &p, &lt);
- p.x=mw;
- p.y=mh;
- transform_reverse(t, &p, &rb);
-
- sprintf(buffer,"./info.sh %d,%d 0x%x,0x%x 0x%x,0x%x", mw, mh, lt.x, lt.y, rb.x, rb.y);
- system(buffer);
-
-}
-
-
-static void
-route_clear_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_set_destination(gui->nav, NULL, NULL, 0);
-}
-
-static void
-poi_search_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)
-{
- destination_address(gui->nav);
-}
-
-static void
-quit_action (GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_destroy(gui->nav);
- exit(0);
-}
-
-static GtkActionEntry entries[] =
-{
- /* TRANSLATORS: These texts are for menu items in GTK GUI. The _ indicates the mnemonic key (=underlined character) for this menu item. Please place the _ before a suitable character in the translation (or omit it if no mnemonic key is desired). */
- { "DisplayMenuAction", NULL, _n("_Display") },
- { "RouteMenuAction", NULL, _n("_Route") },
- { "FormerDestinationMenuAction", NULL, _n("_Former Destinations") },
- { "BookmarkMenuAction", NULL, _n("_Bookmarks") },
- { "MapMenuAction", NULL, _n("_Map") },
- { "LayoutMenuAction", NULL, _n("_Layout") },
- { "ProjectionMenuAction", NULL, _n("_Projection") },
- { "VehicleMenuAction", NULL, _n("_Vehicle") },
- { "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("Zoom_Out"), "<control>minus", _n("Decrease zoom level"), G_CALLBACK(zoom_out_action) },
- { "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("Zoom_In"), "<control>plus", _n("Increase zoom level"), G_CALLBACK(zoom_in_action) },
- { "RefreshAction", GTK_STOCK_REFRESH, _n("_Recalculate"), "<control>R", _n("Redraw map"), G_CALLBACK(refresh_action) },
-#ifdef GTK_STOCK_INFO
- { "InfoAction", GTK_STOCK_INFO, _n("_Info"), NULL, NULL, G_CALLBACK(info_action) },
-#else
- { "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("_POI search"), "<control>P", _n("Opens POI search dialog"), G_CALLBACK(poi_search_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) }
-};
-
-static guint n_entries = G_N_ELEMENTS (entries);
-
-static GtkToggleActionEntry toggleentries[] =
-{
- { "CursorAction", "cursor_icon",_n("Show position _cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE },
- { "TrackingAction", NULL ,_n("_Lock on Road"), NULL, NULL, G_CALLBACK(tracking_action),TRUE },
- { "OrientationAction", "orientation_icon", _n("_Keep orientation to the North"), NULL, _n("Switches map orientation to the north or the vehicle"), G_CALLBACK(orient_north_action),FALSE },
- { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("_Roadbook"), "<control>B", _n("Show/hide route description"), G_CALLBACK(roadbook_action), FALSE },
- { "AutozoomAction", GTK_STOCK_ZOOM_FIT, _n("_Autozoom"), "<control>A", _n("Enable/disable automatic zoom level changing"), G_CALLBACK(autozoom_action), FALSE },
-#ifdef GTK_STOCK_FULLSCREEN
- { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("_Fullscreen"), "<control>F", NULL, G_CALLBACK(window_fullscreen_action), FALSE }
-#else
- { "FullscreenAction", NULL, _n("_Fullscreen"), "<control>F", NULL, G_CALLBACK(window_fullscreen_action), FALSE }
-#endif /*GTK_STOCK_FULLSCREEN*/
-};
-
-static guint n_toggleentries = G_N_ELEMENTS (toggleentries);
-
-static GtkActionEntry debug_entries[] =
-{
- { "DataMenuAction", NULL, _n("Data") },
-};
-
-static guint n_debug_entries = G_N_ELEMENTS (debug_entries);
-
-
-static const char * cursor_xpm[] = {
-"22 22 2 1",
-" c None",
-". c #0000FF",
-" ",
-" ",
-" ",
-" .. ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . . ",
-" . ... . ",
-" . ... . . ",
-" . ... . . ",
-" . .. . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" .. .. ",
-" .. .. ",
-" .. ",
-" ",
-" ",
-" "};
-
-
-static const char * north_xpm[] = {
-"22 22 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" . ",
-" ... ",
-" . . . ",
-" . . . ",
-" . ",
-" .... . .... ",
-" .... . .... ",
-" .... . .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. . .... ",
-" .... . .... ",
-" .... . .... ",
-" . ",
-" . ",
-" . ",
-" ",
-" "};
-
-
-static const char * flag_xpm[] = {
-"22 22 2 1",
-" c None",
-"+ c #000000",
-"+++++++ ",
-"+ +++++++++ ",
-"+ +++ +++++++++ ",
-"+ +++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ + ",
-"+ ++++++ +++ + ",
-"+ +++ ++++++ + ",
-"+ +++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ ",
-"++++++++++ +++ + ",
-"+ +++++++++ + ",
-"+ ++++++ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ "};
-
-
-
-static struct {
- gchar *stockid;
- const char **icon_xpm;
-} stock_icons[] = {
- {"cursor_icon", cursor_xpm },
- {"orientation_icon", north_xpm },
- {"flag_icon", flag_xpm }
-};
-
-
-static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
-
-
-static void
-register_my_stock_icons (void)
-{
- GtkIconFactory *icon_factory;
- GtkIconSet *icon_set;
- GdkPixbuf *pixbuf;
- gint i;
-
- icon_factory = gtk_icon_factory_new ();
-
- for (i = 0; i < n_stock_icons; i++)
- {
- pixbuf = gdk_pixbuf_new_from_xpm_data(stock_icons[i].icon_xpm);
- icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
- g_object_unref(pixbuf);
- gtk_icon_factory_add (icon_factory, stock_icons[i].stockid, icon_set);
- gtk_icon_set_unref (icon_set);
- }
-
- gtk_icon_factory_add_default(icon_factory);
-
- g_object_unref(icon_factory);
-}
-
-
-static char layout[] =
- "<ui>\
- <menubar name=\"MenuBar\">\
- <menu name=\"Display\" action=\"DisplayMenuAction\">\
- <menuitem name=\"Zoom in\" action=\"ZoomInAction\" />\
- <menuitem name=\"Zoom out\" action=\"ZoomOutAction\" />\
- <menuitem name=\"Cursor\" action=\"CursorAction\"/>\
- <menuitem name=\"Tracking\" action=\"TrackingAction\"/>\
- <menuitem name=\"Orientation\" action=\"OrientationAction\"/>\
- <menuitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
- <menuitem name=\"Autozoom\" action=\"AutozoomAction\"/>\
- <menuitem name=\"Fullscreen\" action=\"FullscreenAction\"/>\
- <menuitem name=\"Quit\" action=\"QuitAction\" />\
- <placeholder name=\"RouteMenuAdditions\" />\
- </menu>\
- <menu name=\"Data\" action=\"DataMenuAction\">\
- <placeholder name=\"DataMenuAdditions\" />\
- </menu>\
- <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\" />\
- </menu>\
- <menu name=\"Bookmarks\" action=\"BookmarkMenuAction\">\
- <placeholder name=\"BookmarkMenuAdditions\" />\
- </menu>\
- <placeholder name=\"RouteMenuAdditions\" />\
- </menu>\
- <menu name=\"Map\" action=\"MapMenuAction\">\
- <menu name=\"Layout\" action=\"LayoutMenuAction\">\
- <placeholder name=\"LayoutMenuAdditions\" />\
- </menu>\
- <menu name=\"Projection\" action=\"ProjectionMenuAction\">\
- <placeholder name=\"ProjectionMenuAdditions\" />\
- </menu>\
- <menu name=\"Vehicle\" action=\"VehicleMenuAction\">\
- <placeholder name=\"VehicleMenuAdditions\" />\
- </menu>\
- <placeholder name=\"MapMenuAdditions\" />\
- </menu>\
- </menubar>\
- <toolbar name=\"ToolBar\" action=\"BaseToolbar\" action=\"BaseToolbarAction\">\
- <placeholder name=\"ToolItems\">\
- <separator/>\
- <toolitem name=\"Zoom in\" action=\"ZoomInAction\"/>\
- <toolitem name=\"Zoom out\" action=\"ZoomOutAction\"/>\
- <toolitem name=\"Refresh\" action=\"RefreshAction\"/>\
- <!-- <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\"/>\
- <toolitem name=\"Quit\" action=\"QuitAction\"/>\
- <separator/>\
- </placeholder>\
- </toolbar>\
- <popup name=\"PopUp\">\
- </popup>\
- </ui>";
-
-
-static void
-activate(void *dummy, struct menu_priv *menu)
-{
- if (menu->cb)
- callback_call_0(menu->cb);
-}
-
-static struct menu_methods menu_methods;
-
-static struct menu_priv *
-add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb)
-{
- struct menu_priv *ret;
- char *dynname;
-
- ret=g_new0(struct menu_priv, 1);
- *meth=menu_methods;
- if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Route")) {
- dynname=g_strdup("Route");
- } else if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Data")) {
- dynname=g_strdup("Data");
- } else {
- dynname=g_strdup_printf("%d", menu->gui->dyn_counter++);
- if (type == menu_type_toggle)
- ret->action=GTK_ACTION(gtk_toggle_action_new(dynname, name, NULL, NULL));
- else
- ret->action=gtk_action_new(dynname, name, NULL, NULL);
- if (cb)
- ret->handler_id=g_signal_connect(ret->action, "activate", G_CALLBACK(activate), ret);
- gtk_action_group_add_action(menu->gui->dyn_group, ret->action);
- ret->merge_id=gtk_ui_manager_new_merge_id(menu->gui->ui_manager);
- gtk_ui_manager_add_ui( menu->gui->ui_manager, ret->merge_id, menu->path, dynname, dynname, type == menu_type_submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
- }
- ret->gui=menu->gui;
- ret->path=g_strdup_printf("%s/%s", menu->path, dynname);
- ret->type=type;
- ret->cb=cb;
- ret->sibling=menu->child;
- menu->child=ret;
- g_free(dynname);
- return ret;
-
-}
-
-static void
-remove_menu(struct menu_priv *item, int recursive)
-{
-
- if (recursive) {
- struct menu_priv *next,*child=item->child;
- while (child) {
- next=child->sibling;
- remove_menu(child, recursive);
- child=next;
- }
- }
- if (item->action) {
- gtk_ui_manager_remove_ui(item->gui->ui_manager, item->merge_id);
- gtk_action_group_remove_action(item->gui->dyn_group, item->action);
-#if 0
- if (item->callback)
- g_signal_handler_disconnect(item->action, item->handler_id);
-#endif
- g_object_unref(item->action);
- }
- g_free(item->path);
- g_free(item);
-}
-
-static void
-set_toggle(struct menu_priv *menu, int active)
-{
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int
-get_toggle(struct menu_priv *menu)
-{
- return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
-}
-
-static struct menu_methods menu_methods = {
-#if 1
- add_menu,
- set_toggle,
- get_toggle,
-#else
- NULL,
- NULL,
- NULL
-#endif
-};
-
-
-static void
-popup_deactivate(GtkWidget *widget, struct menu_priv *menu)
-{
- g_signal_handler_disconnect(widget, menu->handler_id);
- remove_menu(menu, 1);
-}
-
-static void
-popup_activate(struct menu_priv *menu)
-{
-#ifdef _WIN32
- menu->widget=gtk_ui_manager_get_widget(menu->gui->ui_manager, menu->path );
-#endif
- gtk_menu_popup(GTK_MENU(menu->widget), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
- menu->handler_id=g_signal_connect(menu->widget, "selection-done", G_CALLBACK(popup_deactivate), menu);
-}
-
-void
-gui_gtk_ui_init(struct gui_priv *this)
-{
- GError *error = NULL;
- struct attr attr;
- GtkToggleAction *toggle_action;
-
- this->base_group = gtk_action_group_new ("BaseActions");
- this->debug_group = gtk_action_group_new ("DebugActions");
- this->dyn_group = gtk_action_group_new ("DynamicActions");
- register_my_stock_icons();
- this->ui_manager = gtk_ui_manager_new ();
- gtk_action_group_set_translation_domain(this->base_group,"navit");
- gtk_action_group_set_translation_domain(this->debug_group,"navit");
- gtk_action_group_set_translation_domain(this->dyn_group,"navit");
- gtk_action_group_add_actions (this->base_group, entries, n_entries, this);
- gtk_action_group_add_toggle_actions (this->base_group, toggleentries, n_toggleentries, this);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->base_group, 0);
- gtk_action_group_add_actions (this->debug_group, debug_entries, n_debug_entries, this);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->debug_group, 0);
- gtk_ui_manager_add_ui_from_string (this->ui_manager, layout, strlen(layout), &error);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->dyn_group, 0);
- if (error) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
- if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num != -1);
- }
- if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "RoadbookAction"));
- gtk_toggle_action_set_active(toggle_action, 0);
-
- if (navit_get_attr(this->nav, attr_autozoom_active, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "AutozoomAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
-
-}
-
-static struct menu_priv *
-gui_gtk_ui_new (struct gui_priv *this, struct menu_methods *meth, char *path, int popup, GtkWidget **widget_ret)
-{
- struct menu_priv *ret;
- GtkWidget *widget;
-
- *meth=menu_methods;
- ret=g_new0(struct menu_priv, 1);
- ret->path=g_strdup(path);
- ret->gui=this;
-
- widget=gtk_ui_manager_get_widget(this->ui_manager, path);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- if (widget_ret)
- *widget_ret=widget;
- if (! popup) {
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- } else {
- ret->widget=widget;
- meth->popup=popup_activate;
- }
- return ret;
-}
-
-#if 0
-struct menu_priv *
-gui_gtk_menubar_new(struct gui_priv *this, struct menu_methods *meth)
-{
- return gui_gtk_ui_new(this, meth, "/ui/MenuBar", 0, &this->menubar);
-}
-#endif
-
-struct menu_priv *
-gui_gtk_popup_new(struct gui_priv *this, struct menu_methods *meth)
-{
- return gui_gtk_ui_new(this, meth, "/ui/PopUp", 1, NULL);
-}
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
deleted file mode 100644
index a3578243b..000000000
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/**
- * 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 "util.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;
-
-static GdkPixbuf *
-geticon(const char *name){
- GdkPixbuf *icon=NULL;
- GError *error=NULL;
- icon=gdk_pixbuf_new_from_file(graphics_icon_path(name),&error);
- if (error) {
- dbg(lvl_error, "failed to load icon '%s': %s\n", name, error->message);
- }
- return icon;
-}
-
-/** Build the category list model with icons. */
-static GtkTreeModel *
-category_list_model(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);
-}
-
-
-/** 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,idist;
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct point cursor_position;
- enum item_type selected;
-
- search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
-
- cursor_position.x=navit_get_width(search->nav)/2;
- cursor_position.y=navit_get_height(search->nav)/2;
- gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from screen center (km)"));
-
- transform_reverse(navit_get_trans(search->nav), &cursor_position, &center);
- 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,&center,&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(&center,&coord_item,0),1);
- 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. */
-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);
-}
-
-/** Reload the POI list and disable buttons. */
-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));
-}
-
-/** Set the selected POI 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(lvl_debug,_("Set destination to %ld, %ld \n"),lat,lon);
-}
-
-/* Show the POI's 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(lvl_debug,_("Set map to %ld, %ld \n"),lat,lon);
-}
-
-/** Set POI as the first "visit before". */
-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(lvl_debug,_("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 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=&gtk_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"));
- 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), 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(m)"), 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_poi.h b/navit/gui/gtk/gui_gtk_poi.h
deleted file mode 100644
index 0f0087d49..000000000
--- a/navit/gui/gtk/gui_gtk_poi.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c
deleted file mode 100644
index 0f0dcc0e8..000000000
--- a/navit/gui/gtk/gui_gtk_statusbar.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <math.h>
-#include <gtk/gtk.h>
-#include "item.h"
-#include "coord.h"
-#include "debug.h"
-#include "vehicle.h"
-#include "callback.h"
-#include "route.h"
-#include "transform.h"
-#include "navit.h"
-#include "map.h"
-#include "navigation.h"
-#include "gui_gtk.h"
-#include "navit_nls.h"
-
-struct statusbar_priv {
- struct gui_priv *gui;
- GtkWidget *hbox;
- char gps_text[128];
- GtkWidget *gps;
- char route_text[128];
- GtkWidget *route;
- struct callback *vehicle_cb;
-};
-
-#if 0
-static void
-statusbar_destroy(struct statusbar_priv *this)
-{
- g_free(this);
-}
-
-static void
-statusbar_gps_update(struct statusbar_priv *this, int sats, int qual, double lng, double lat, double height, double direction, double speed)
-{
- char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
- char *dir;
- int dir_idx;
- char pos_text[36];
-
- coord_format(lat,lng,DEGREES_MINUTES_SECONDS,pos_text,sizeof(pos_text));
- dir=dirs[dir_idx];
- sprintf(this->gps_text, "GPS %02d/%02d %s %4.0fm %3.0f°%-2s %3.0fkm/h", sats, qual, pos_text, height, direction, dir, speed);
- gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
-
-}
-#endif
-
-static const char *status_fix2str(int type)
-{
- switch(type) {
- case 0: return _("No");
- case 1: return _("2D");
- case 3: return _("3D");
- default:
- return _("OT");
- }
-}
-
-static void
-statusbar_route_update(struct statusbar_priv *this, struct navit *navit, struct vehicle *v)
-{
- struct navigation *nav=NULL;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
- struct attr attr;
- double route_len=0;
- time_t eta;
- struct tm *eta_tm=NULL;
- char buffer[128];
- double lng, lat, direction=0, height=0, speed=0, hdop=0;
- int sats=0, qual=0;
- int status=0;
- const char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
- const char *dir;
- int dir_idx;
-
- if (navit)
- nav=navit_get_navigation(navit);
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- if (mr)
- item=map_rect_get_item(mr);
- if (item) {
- if (item_attr_get(item, attr_destination_length, &attr))
- route_len=attr.u.num;
- if (item_attr_get(item, attr_destination_time, &attr)) {
- eta=time(NULL)+attr.u.num/10;
- eta_tm=localtime(&eta);
- }
- }
- if (mr)
- map_rect_destroy(mr);
- sprintf(buffer,_("Route %4.0fkm %02d:%02d ETA" ),route_len/1000, eta_tm ? eta_tm->tm_hour : 0 , eta_tm ? eta_tm->tm_min : 0);
- if (strcmp(buffer, this->route_text)) {
- strcpy(this->route_text, buffer);
- gtk_label_set_text(GTK_LABEL(this->route), this->route_text);
- }
- if (!vehicle_get_attr(v, attr_position_coord_geo, &attr, NULL))
- return;
- lng=attr.u.coord_geo->lng;
- lat=attr.u.coord_geo->lat;
- if (vehicle_get_attr(v, attr_position_fix_type, &attr, NULL))
- status=attr.u.num;
- if (vehicle_get_attr(v, attr_position_direction, &attr, NULL))
- direction=*(attr.u.numd);
- direction=fmod(direction,360);
- if (direction < 0)
- direction+=360;
- dir_idx=(direction+22.5)/45;
- dir=dirs[dir_idx];
- if (vehicle_get_attr(v, attr_position_height, &attr, NULL))
- height=*(attr.u.numd);
- if (vehicle_get_attr(v, attr_position_hdop, &attr, NULL))
- hdop=*(attr.u.numd);
- if (vehicle_get_attr(v, attr_position_speed, &attr, NULL))
- speed=*(attr.u.numd);
- if (vehicle_get_attr(v, attr_position_sats_used, &attr, NULL))
- sats=attr.u.num;
- if (vehicle_get_attr(v, attr_position_qual, &attr, NULL))
- qual=attr.u.num;
- coord_format(lat,lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
- sprintf(this->gps_text,"GPS:%s %02d/%02d HD:%02.2f %s %4.0fm %3.0f°%-2s %3.0fkm/h",
- status_fix2str(status),
- sats, qual, hdop, buffer, height,
- direction, dir, speed);
- gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
-}
-
-struct statusbar_priv *
-gui_gtk_statusbar_new(struct gui_priv *gui)
-{
- struct statusbar_priv *this=g_new0(struct statusbar_priv, 1);
-
- this->gui=gui;
- this->hbox=gtk_hbox_new(FALSE, 1);
- this->gps=gtk_label_new( "GPS 00/0 0000.0000N 00000.0000E 0000m 000°NO 000km/h" );
- gtk_label_set_justify(GTK_LABEL(this->gps), GTK_JUSTIFY_LEFT);
- this->route=gtk_label_new( _( "Route 0000km 0+00:00 ETA" ) );
- gtk_label_set_justify(GTK_LABEL(this->route), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start(GTK_BOX(this->hbox), this->gps, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(this->hbox), gtk_vseparator_new(), TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(this->hbox), this->route, TRUE, TRUE, 2);
- GTK_WIDGET_UNSET_FLAGS (this->hbox, GTK_CAN_FOCUS);
-
- gtk_box_pack_end(GTK_BOX(gui->vbox), this->hbox, FALSE, FALSE, 0);
- gtk_widget_show_all(this->hbox);
- /* add a callback for position updates */
- this->vehicle_cb=callback_new_attr_1(callback_cast(statusbar_route_update), attr_position_coord_geo, this);
- navit_add_callback(gui->nav, this->vehicle_cb);
- return this;
-}
-
diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c
deleted file mode 100644
index 1741a54a0..000000000
--- a/navit/gui/gtk/gui_gtk_window.c
+++ /dev/null
@@ -1,812 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-#include <locale.h>
-#include <gdk/gdkkeysyms.h>
-#if !defined(GDK_Book) || !defined(GDK_Calendar)
-#include <X11/XF86keysym.h>
-#endif
-#include <gtk/gtk.h>
-#include "config.h"
-#include "item.h"
-#include "xmlconfig.h"
-#include "navit.h"
-#include "debug.h"
-#include "gui.h"
-#include "coord.h"
-#include "point.h"
-#include "plugin.h"
-#include "graphics.h"
-#include "gui_gtk.h"
-#include "transform.h"
-#include "config.h"
-#include "callback.h"
-#include "layout.h"
-#include "vehicle.h"
-#include "map.h"
-#include "coord.h"
-#include "event.h"
-#include "bookmarks.h"
-#include "route.h"
-#include "navit_nls.h"
-
-#ifdef USE_HILDON
-#include "hildon/hildon-defines.h"
-#define KEY_ZOOM_IN HILDON_HARDKEY_INCREASE
-#define KEY_ZOOM_OUT HILDON_HARDKEY_DECREASE
-#define KEY_UP HILDON_HARDKEY_UP
-#define KEY_DOWN HILDON_HARDKEY_DOWN
-#define KEY_LEFT HILDON_HARDKEY_LEFT
-#define KEY_RIGHT HILDON_HARDKEY_RIGHT
-#else
-#ifndef GDK_Book
-#define GDK_Book XF86XK_Book
-#endif
-#ifndef GDK_Calendar
-#define GDK_Calendar XF86XK_Calendar
-#endif
-#define KEY_ZOOM_IN GDK_Book
-#define KEY_ZOOM_OUT GDK_Calendar
-#define KEY_UP GDK_Up
-#define KEY_DOWN GDK_Down
-#define KEY_LEFT GDK_Left
-#define KEY_RIGHT GDK_Right
-#endif
-
-static gboolean
-keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this)
-{
- int w,h;
- struct transformation *t;
- #ifdef USE_HILDON
- GtkToggleAction *action;
- gboolean *fullscreen;
- #endif /*HILDON*/
- struct point p;
- if (event->type != GDK_KEY_PRESS)
- return FALSE;
- dbg(lvl_debug,"keypress 0x%x\n", event->keyval);
- transform_get_size(navit_get_trans(this->nav), &w, &h);
- switch (event->keyval) {
- case GDK_KP_Enter:
- gtk_menu_shell_select_first(GTK_MENU_SHELL(this->menubar), TRUE);
- break;
- case KEY_UP:
- p.x=w/2;
- p.y=0;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case KEY_DOWN:
- p.x=w/2;
- p.y=h;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case KEY_LEFT:
- p.x=0;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case KEY_RIGHT:
- p.x=w;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case KEY_ZOOM_IN:
- navit_zoom_in(this->nav, 2, NULL);
- break;
- case KEY_ZOOM_OUT:
- navit_zoom_out(this->nav, 2, NULL);
- break;
- case 'a':
- t=navit_get_trans(this->nav);
- transform_set_yaw(t, (transform_get_yaw(t)+15)%360);
- navit_draw(this->nav);
- break;
- case 'd':
- t=navit_get_trans(this->nav);
- transform_set_yaw(t, (transform_get_yaw(t)-15)%360);
- navit_draw(this->nav);
- break;
- case 'w':
- t=navit_get_trans(this->nav);
- transform_set_pitch(t, (transform_get_pitch(t)+5)%360);
- navit_draw(this->nav);
- break;
- case 'x':
- t=navit_get_trans(this->nav);
- transform_set_pitch(t, (transform_get_pitch(t)-5)%360);
- navit_draw(this->nav);
- break;
- case 'r':
- t=navit_get_trans(this->nav);
- transform_set_distance(t, (transform_get_distance(t)-5));
- navit_draw(this->nav);
- break;
- case 'f':
- t=navit_get_trans(this->nav);
- transform_set_distance(t, (transform_get_distance(t)+5));
- navit_draw(this->nav);
- break;
- case 'z':
- t=navit_get_trans(this->nav);
- transform_set_hog(t, (transform_get_hog(t)+1));
- navit_draw(this->nav);
- break;
- case 'h':
- t=navit_get_trans(this->nav);
- transform_set_hog(t, (transform_get_hog(t)-1));
- navit_draw(this->nav);
- break;
- case 't':
- {
- struct coord *p;
- struct pcoord pc;
- t=navit_get_trans(this->nav);
- p=transform_center(t);
- pc.pro=projection_mg;
- p->y+=50*cos(transform_get_yaw(t)*M_PI/180);
- p->x+=50*sin(transform_get_yaw(t)*M_PI/180);
- pc.x=p->x;
- pc.y=p->y;
- navit_set_center(this->nav, &pc, 1);
- }
- break;
- case 'g':
- {
- struct coord *p;
- struct pcoord pc;
- t=navit_get_trans(this->nav);
- p=transform_center(t);
- pc.pro=projection_mg;
- p->y-=50*cos(transform_get_yaw(t)*M_PI/180);
- p->x-=50*sin(transform_get_yaw(t)*M_PI/180);
- pc.x=p->x;
- pc.y=p->y;
- navit_set_center(this->nav, &pc, 1);
- }
- break;
- #ifdef USE_HILDON
- case HILDON_HARDKEY_FULLSCREEN:
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (this->base_group, "FullscreenAction"));
-
- if ( gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
- {
- fullscreen = 0;
- } else {
- fullscreen = 1;
- }
- gtk_toggle_action_set_active (action, fullscreen);
- break;
- #endif /*HILDON*/
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static int
-gui_gtk_set_graphics(struct gui_priv *this, struct graphics *gra)
-{
- GtkWidget *graphics;
-
- graphics=graphics_get_data(gra, "gtk_widget");
- if (! graphics)
- return 1;
- GTK_WIDGET_SET_FLAGS (graphics, GTK_CAN_FOCUS);
- gtk_widget_set_sensitive(graphics, TRUE);
- g_signal_connect(G_OBJECT(graphics), "key-press-event", G_CALLBACK(keypress), this);
- gtk_box_pack_end(GTK_BOX(this->vbox), graphics, TRUE, TRUE, 0);
- gtk_widget_show_all(graphics);
- gtk_widget_grab_focus(graphics);
-
- return 0;
-}
-
-static void
-gui_gtk_route_callback(struct gui_priv *gui) {
- struct attr route_attr;
- GtkAction *roadbookAction=gtk_ui_manager_get_action (gui->ui_manager,"/ui/ToolBar/ToolItems/Roadbook");
- if (roadbookAction) {
- if (navit_get_attr(gui->nav,attr_route,&route_attr,NULL)) {
- struct attr route_status_attr;
- if (route_get_attr(route_attr.u.route, attr_route_status,&route_status_attr,NULL) ) {
- if (route_status_attr.u.num>2) {
- gtk_action_set_sensitive(roadbookAction,1);
- } else {
- gtk_action_set_sensitive(roadbookAction,0);
- }
- }
- }
- }
-}
-
-static void
-gui_gtk_add_bookmark_do(struct gui_priv *gui)
-{
- struct attr attr;
- navit_get_attr(gui->nav, attr_bookmarks, &attr, NULL);
- bookmarks_add_bookmark(attr.u.bookmarks, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
- gtk_widget_destroy(gui->dialog_win);
-}
-
-static int
-gui_gtk_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- GtkWidget *button_ok,*button_cancel,*label,*vbox,*hbox;
-
- gui->dialog_coord=*c;
- gui->dialog_win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- vbox=gtk_vbox_new(FALSE, 0);
- gtk_container_add (GTK_CONTAINER (gui->dialog_win), vbox);
- gtk_window_set_title(GTK_WINDOW(gui->dialog_win),_("Add Bookmark"));
- gtk_window_set_wmclass (GTK_WINDOW (gui->dialog_win), "navit", "Navit");
- gtk_window_set_transient_for(GTK_WINDOW(gui->dialog_win), GTK_WINDOW(gui->win));
- gtk_window_set_modal(GTK_WINDOW(gui->dialog_win), TRUE);
- label=gtk_label_new(_("Name"));
- gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gui->dialog_entry=gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(gui->dialog_entry), description);
- gtk_box_pack_start(GTK_BOX(vbox), gui->dialog_entry, TRUE, TRUE, 0);
- hbox=gtk_hbox_new(FALSE, 0);
- button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
- gtk_box_pack_start(GTK_BOX(hbox), button_ok, TRUE, TRUE, 10);
- button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_box_pack_start(GTK_BOX(hbox), button_cancel, TRUE, TRUE, 10);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 10);
- gtk_widget_show_all(gui->dialog_win);
- GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button_ok);
- g_signal_connect_swapped (G_OBJECT (button_cancel), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (gui->dialog_win));
- g_signal_connect_swapped (G_OBJECT (gui->dialog_entry), "activate", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
-
- g_signal_connect_swapped(G_OBJECT (button_ok), "clicked", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
-
- return 1;
-}
-
-struct gui_methods gui_gtk_methods = {
- NULL,
- gui_gtk_popup_new,
- gui_gtk_set_graphics,
- NULL,
- gui_gtk_datawindow_new,
- gui_gtk_add_bookmark,
-};
-
-static gboolean
-gui_gtk_delete(GtkWidget *widget, GdkEvent *event, struct navit *nav)
-{
- /* FIXME remove attr_navit callback */
- navit_destroy(nav);
- exit(0);
-
- return TRUE;
-}
-
-static void
-gui_gtk_toggle_init(struct gui_priv *this)
-{
- struct attr attr;
- GtkToggleAction *toggle_action;
-
- if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- } else {
- dbg(lvl_warning, "Unable to locate CursorAction\n");
- }
- if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num != -1);
- } else {
- dbg(lvl_error, "Unable to locate OrientationAction\n");
- }
- if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- } else {
- dbg(lvl_error, "Unable to locate TrackingAction\n");
- }
-}
-
-struct action_cb_data {
- struct gui_priv *gui;
- struct attr attr;
-};
-
-static void
-gui_gtk_action_activate(GtkAction *action, struct action_cb_data *data)
-{
- if(data->attr.type == attr_destination) {
- char * label;
- g_object_get(G_OBJECT(action), "label", &label,NULL);
- navit_set_destination(data->gui->nav, data->attr.u.pcoord, label, 1);
- g_free(label);
- }
-}
-
-struct gui_menu_info {
- guint merge_id;
- GtkAction *action;
-};
-
-static void
-gui_gtk_del_menu(struct gui_priv *this, struct gui_menu_info *meninfo)
-{
- gtk_action_group_remove_action(this->dyn_group, meninfo->action);
- 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)
-{
- struct gui_menu_info meninfo;
- GtkAction *action;
- guint merge_id;
-
- action=gtk_action_new(name, label, NULL, NULL);
- meninfo.action = action;
- if (data)
- g_signal_connect(action, "activate", G_CALLBACK(gui_gtk_action_activate), data);
- gtk_action_group_add_action(this->dyn_group, action);
- merge_id =gtk_ui_manager_new_merge_id(this->ui_manager);
- meninfo.merge_id = merge_id;
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
-
- return meninfo;
-}
-
-static void
-gui_gtk_action_toggled(GtkToggleAction *action, struct action_cb_data *data)
-{
- struct attr active;
- active.type=attr_active;
- active.u.num=gtk_toggle_action_get_active(action);
- map_set_attr(data->attr.u.map, &active);
- 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)
-{
- GtkToggleAction *toggle_action;
- guint merge_id;
-
- toggle_action=gtk_toggle_action_new(name, label, NULL, NULL);
- gtk_toggle_action_set_active(toggle_action, active);
- g_signal_connect(GTK_ACTION(toggle_action), "toggled", G_CALLBACK(gui_gtk_action_toggled), data);
- gtk_action_group_add_action(this->dyn_group, GTK_ACTION(toggle_action));
- merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
-}
-
-static void
-gui_gtk_action_changed(GtkRadioAction *action, GtkRadioAction *current, struct action_cb_data *data)
-{
- if (action == current) {
- navit_set_attr(data->gui->nav, &data->attr);
- }
-}
-
-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;
-
- radio_action=gtk_radio_action_new(name, label, NULL, NULL, 0);
- meninfo.action = (GtkAction *)radio_action;
- gtk_radio_action_set_group(radio_action, *g);
- *g=gtk_radio_action_get_group(radio_action);
- g_signal_connect(GTK_ACTION(radio_action), "changed", G_CALLBACK(gui_gtk_action_changed), data);
- gtk_action_group_add_action(this->dyn_group, GTK_ACTION(radio_action));
- merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
- meninfo.merge_id = merge_id;
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
-
- return meninfo;
-}
-
-static void
-gui_gtk_layouts_init(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr;
- struct action_cb_data *data;
- int count=0;
- char *name;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_layout, &attr, iter)) {
- name=g_strdup_printf("Layout %d", count++);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_layout;
- data->attr.u.layout=attr.u.layout;
- gui_gtk_add_radio_menu(this, name, attr.u.layout->name, "/ui/MenuBar/Map/Layout/LayoutMenuAdditions", data, &this->layout_group);
- g_free(name);
- }
- navit_attr_iter_destroy(iter);
-}
-
-static void
-gui_gtk_projections_init(struct gui_priv *this)
-{
- struct action_cb_data *data;
-
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_projection;
- data->attr.u.projection=projection_mg;
- gui_gtk_add_radio_menu(this, "Projection mg", "Map & Guide", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
-
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_projection;
- data->attr.u.projection=projection_garmin;
- gui_gtk_add_radio_menu(this, "Projection garmin", "Garmin", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
-}
-
-static void
-gui_gtk_vehicles_update(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr,vattr;
- struct action_cb_data *data;
- int count=0;
- char *name;
- GList *curr;
- struct gui_menu_info *meninfo;
- dbg(lvl_debug,"enter\n");
-
- curr = g_list_first(this->vehicle_menuitems);
-
- while (curr) {
- gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
- g_free((struct gui_menu_info *)curr->data);
- curr = g_list_next(curr);
- };
-
- g_list_free(this->vehicle_menuitems);
- this->vehicle_menuitems = NULL;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
- name=g_strdup_printf("Vehicle %d", count++);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_vehicle;
- data->attr.u.vehicle=attr.u.vehicle;
- meninfo = g_new(struct gui_menu_info, 1);
- *meninfo = gui_gtk_add_radio_menu(this, name, vattr.u.str, "/ui/MenuBar/Map/Vehicle/VehicleMenuAdditions", data, &this->vehicle_group);
- this->vehicle_menuitems = g_list_prepend(this->vehicle_menuitems, meninfo);
- g_free(name);
- }
- navit_attr_iter_destroy(iter);
-}
-
-static void
-gui_gtk_vehicles_init(struct gui_priv *this)
-{
- navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_vehicles_update), attr_vehicle, this));
- gui_gtk_vehicles_update(this);
-}
-
-static void
-gui_gtk_maps_init(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr,active,type,data;
- struct action_cb_data *cb_data;
- int count=0;
- char *name, *label;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_map, &attr, iter)) {
- name=g_strdup_printf("Map %d", count++);
- if (! map_get_attr(attr.u.map, attr_type, &type, NULL))
- type.u.str="";
- if (! map_get_attr(attr.u.map, attr_data, &data, NULL))
- data.u.str="";
- label=g_strdup_printf("%s:%s", type.u.str, data.u.str);
- cb_data=g_new(struct action_cb_data, 1);
- cb_data->gui=this;
- cb_data->attr.type=attr_map;
- cb_data->attr.u.map=attr.u.map;
- if (! map_get_attr(attr.u.map, attr_active, &active, NULL))
- active.u.num=1;
- gui_gtk_add_toggle_menu(this, name, label, "/ui/MenuBar/Map/MapMenuAdditions", cb_data, active.u.num);
- g_free(name);
- g_free(label);
- }
- navit_attr_iter_destroy(iter);
-
-}
-
-static void
-gui_gtk_destinations_update(struct gui_priv *this)
-{
- GList *curr;
- struct attr attr;
- struct action_cb_data *data;
- struct map_rect *mr=NULL;
- struct item *item;
- struct gui_menu_info *meninfo;
- struct coord c;
- int count=0;
- char *name, *label;
-
- curr = g_list_first(this->dest_menuitems);
-
- while (curr) {
- gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
- g_free((struct gui_menu_info *)curr->data);
- curr = g_list_next(curr);
- };
-
- g_list_free(this->dest_menuitems);
- this->dest_menuitems = NULL;
-
- if(navit_get_attr(this->nav, attr_former_destination_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
- while ((item=map_rect_get_item(mr))) {
- if (item->type != type_former_destination) continue;
- name=g_strdup_printf("Destination %d", count++);
- item_attr_get(item, attr_label, &attr);
- label=attr.u.str;
- item_coord_get(item, &c, 1);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_destination;
- data->attr.u.pcoord=g_new(struct pcoord, 1);
- data->attr.u.pcoord->pro=projection_mg;
- data->attr.u.pcoord->x=c.x;
- data->attr.u.pcoord->y=c.y;
-
- meninfo = g_new(struct gui_menu_info, 1);
- *meninfo = gui_gtk_add_menu(this, name, label, "/ui/MenuBar/Route/FormerDestinations/FormerDestinationMenuAdditions",0,data);
- this->dest_menuitems = g_list_prepend(this->dest_menuitems, meninfo);
- g_free(name);
- }
- map_rect_destroy(mr);
- }
-}
-
-static void
-gui_gtk_destinations_init(struct gui_priv *this)
-{
- navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_destinations_update), attr_destination, this));
- gui_gtk_destinations_update(this);
-}
-
-static void
-gui_gtk_bookmarks_update(struct gui_priv *this)
-{
- GList *curr;
- struct attr attr;
- struct action_cb_data *data;
- struct map_rect *mr=NULL;
- struct gui_menu_info *meninfo;
- struct item *item;
- struct coord c;
- int count=0;
- char *parent, *name, *label, *label_full, *menu_label, *tmp_parent, *s;
- GHashTable *hash;
-
- curr = g_list_first(this->bookmarks_menuitems);
-
- while (curr) {
- gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
- g_free((struct gui_menu_info *)curr->data);
- curr = g_list_next(curr);
- };
-
- g_list_free(this->bookmarks_menuitems);
- this->bookmarks_menuitems = NULL;
-
- if(navit_get_attr(this->nav, attr_bookmark_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
- hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
- while ((item=map_rect_get_item(mr))) {
- if (item->type != type_bookmark) continue;
- item_attr_get(item, attr_label, &attr);
- label_full=attr.u.str;
- item_coord_get(item, &c, 1);
- menu_label=g_malloc(strlen(label_full)+1);
- label=label_full;
- parent=g_strdup("/ui/MenuBar/Route/Bookmarks/BookmarkMenuAdditions");
- while ((s=strchr(label, '/'))) {
- strcpy(menu_label, label_full);
- menu_label[s-label_full]='\0';
- if ((tmp_parent=g_hash_table_lookup(hash, menu_label))) {
- tmp_parent=g_strdup(tmp_parent);
- } else {
- name=g_strdup_printf("Bookmark %d", count++);
- meninfo = g_new(struct gui_menu_info, 1);
- *meninfo = gui_gtk_add_menu(this, name, menu_label+(label-label_full),parent,1,NULL);
- this->bookmarks_menuitems = g_list_prepend(this->bookmarks_menuitems, meninfo);
- tmp_parent=g_strdup_printf("%s/%s", parent, name);
- g_hash_table_insert(hash, g_strdup(menu_label), g_strdup(tmp_parent));
- g_free(name);
- }
- g_free(parent);
- parent=tmp_parent;
- label=s+1;
- }
- g_free(menu_label);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_destination;
- data->attr.u.pcoord=g_new(struct pcoord, 1);
- data->attr.u.pcoord->pro=projection_mg;
- data->attr.u.pcoord->x=c.x;
- data->attr.u.pcoord->y=c.y;
- name=g_strdup_printf("Bookmark %d", count++);
- meninfo = g_new(struct gui_menu_info, 1);
- *meninfo = gui_gtk_add_menu(this, name, label, parent,0,data);
- this->bookmarks_menuitems = g_list_prepend(this->bookmarks_menuitems, meninfo);
- g_free(name);
- g_free(parent);
- }
- g_hash_table_destroy(hash);
- }
-}
-
-static void
-gui_gtk_bookmarks_init(struct gui_priv *this)
-{
- struct attr attr;
- navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
- bookmarks_add_callback(attr.u.bookmarks, callback_new_attr_1(callback_cast(gui_gtk_bookmarks_update), attr_bookmark_map, this));
- gui_gtk_bookmarks_update(this);
-}
-
-static void
-gui_gtk_init(struct gui_priv *this, struct navit *nav)
-{
-
- struct attr route_attr;
-
- gui_gtk_toggle_init(this);
- gui_gtk_layouts_init(this);
- gui_gtk_projections_init(this);
- gui_gtk_vehicles_init(this);
- gui_gtk_maps_init(this);
- gui_gtk_destinations_init(this);
- gui_gtk_bookmarks_init(this);
-
- if (navit_get_attr(nav,attr_route,&route_attr,NULL)) {
- struct attr callback;
- callback.type=attr_callback;
- callback.u.callback=callback_new_attr_1(callback_cast(gui_gtk_route_callback), attr_route_status, this);
- route_add_attr(route_attr.u.route, &callback);
- }
- gui_gtk_route_callback(this); //Set initial state
-}
-
-static struct gui_priv *
-gui_gtk_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)
-{
- struct gui_priv *this;
- int w=792, h=547;
- char *cp = getenv("NAVIT_XID");
- unsigned xid = 0;
- struct attr *attr;
- GtkWidget *widget;
- int fullscreen = 0;
-
- if (! event_request_system("glib","gui_gtk_new"))
- return NULL;
-
- if (cp) {
- xid = strtol(cp, NULL, 0);
- }
-
- this=g_new0(struct gui_priv, 1);
- this->nav=nav;
-
- attr = attr_search(attrs, NULL, attr_menubar);
- if (attr) {
- this->menubar_enable=attr->u.num;
- } else {
- this->menubar_enable=1;
- }
- attr=attr_search(attrs, NULL, attr_toolbar);
- if (attr) {
- this->toolbar_enable=attr->u.num;
- } else {
- this->toolbar_enable=1;
- }
- attr=attr_search(attrs, NULL, attr_statusbar);
- if (attr) {
- this->statusbar_enable=attr->u.num;
- } else {
- this->statusbar_enable=1;
- }
-
- *meth=gui_gtk_methods;
-
- if (!xid)
- this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- else
- this->win = gtk_plug_new(xid);
-
-
- g_signal_connect(G_OBJECT(this->win), "delete-event", G_CALLBACK(gui_gtk_delete), nav);
- this->vbox = gtk_vbox_new(FALSE, 0);
- gtk_window_set_default_size(GTK_WINDOW(this->win), w, h);
- gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
- gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", "Navit");
- gtk_widget_realize(this->win);
- gui_gtk_ui_init(this);
- if (this->menubar_enable) {
- widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/MenuBar");
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- this->menubar=widget;
- }
- if (this->toolbar_enable) {
- widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/ToolBar");
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- }
- if (this->statusbar_enable) {
- this->statusbar=gui_gtk_statusbar_new(this);
- }
- gtk_window_add_accel_group (GTK_WINDOW (this->win),
- gtk_ui_manager_get_accel_group(this->ui_manager));
- gtk_container_add(GTK_CONTAINER(this->win), this->vbox);
- gtk_widget_show_all(this->win);
-
-
- navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this));
-
- if ((attr=attr_search(attrs, NULL, attr_fullscreen)))
- fullscreen=attr->u.num;
-
- if (fullscreen) {
- GtkToggleAction *action;
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (this->base_group, "FullscreenAction"));
- gtk_toggle_action_set_active (action, fullscreen);
- }
-
- return this;
-}
-
-static int gtk_argc;
-static char **gtk_argv={NULL};
-
-void
-plugin_init(void)
-{
- gtk_init(&gtk_argc, &gtk_argv);
- gtk_set_locale();
-#ifdef HAVE_API_WIN32
- setlocale(LC_NUMERIC,"C");
-#endif
-
-
- plugin_register_category_gui("gtk", gui_gtk_new);
-}
diff --git a/navit/gui/internal/CMakeLists.txt b/navit/gui/internal/CMakeLists.txt
deleted file mode 100644
index 230e315d6..000000000
--- a/navit/gui/internal/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 0a62ae010..000000000
--- a/navit/gui/internal/gui_internal.c
+++ /dev/null
@@ -1,3471 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2010 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.
- */
-
-//##############################################################################################################
-//#
-//# File: gui_internal.c
-//# Description: New "internal" GUI for use with any graphics library
-//# Comment: Trying to make a touchscreen friendly GUI
-//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
-//#
-//##############################################################################################################
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-#include <glib.h>
-#include <time.h>
-#include "config.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_API_WIN32_BASE
-#include <windows.h>
-#endif
-#ifndef _MSC_VER
-#include <sys/time.h>
-#endif /* _MSC_VER */
-#include "item.h"
-#include "xmlconfig.h"
-#include "file.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "gui.h"
-#include "coord.h"
-#include "point.h"
-#include "plugin.h"
-#include "graphics.h"
-#include "transform.h"
-#include "color.h"
-#include "map.h"
-#include "callback.h"
-#include "vehicle.h"
-#include "vehicleprofile.h"
-#include "window.h"
-#include "config_.h"
-#include "keys.h"
-#include "mapset.h"
-#include "route.h"
-#include "navit/search.h"
-#include "track.h"
-#include "country.h"
-#include "config.h"
-#include "event.h"
-#include "navit_nls.h"
-#include "navigation.h"
-#include "gui_internal.h"
-#include "command.h"
-#include "util.h"
-#include "bookmarks.h"
-#include "linguistics.h"
-#include "debug.h"
-#include "fib.h"
-#include "types.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_bookmark.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_search.h"
-#include "gui_internal_gesture.h"
-#include "gui_internal_poi.h"
-#include "gui_internal_command.h"
-#include "gui_internal_keyboard.h"
-
-
-/**
- * Indexes into the config_profiles array.
- */
-const int LARGE_PROFILE=0;
-const int MEDIUM_PROFILE=1;
-const int SMALL_PROFILE=2;
-
-/**
- * The default config profiles.
- *
- * [0] => LARGE_PROFILE (screens 640 in one dimension)
- * [1] => MEDIUM PROFILE (screens larger than 320 in one dimension
- * [2] => Small profile (default)
- */
-static struct gui_config_settings config_profiles[]={
- {545,32,48,96,10}
- , {300,32,48,64,3}
- ,{200,16,32,48,2}
-};
-
-static void gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm, void *data);
-
-static int gui_internal_is_active_vehicle(struct gui_priv *this, struct vehicle *vehicle);
-
-/**
- * @brief Displays an image scaled to a specific size
- *
- * Searches for scaleable and pre-scaled image
- *
- * @param this Our gui context
- * @param name image name
- * @param w desired width of image
- * @param h desired height of image
- *
- * @return image_struct Ptr to scaled image struct or NULL if not scaled or found
- */
-static struct graphics_image *
-image_new_scaled(struct gui_priv *this, const char *name, int w, int h)
-{
- struct graphics_image *ret=NULL;
- char *full_path=NULL;
- full_path=graphics_icon_path(name);
- ret=graphics_image_new_scaled(this->gra, full_path, w, h);
- dbg(lvl_debug,"Trying to load image '%s' (w=%d, h=%d): %s\n", name, w, h, ret ? "OK" : "NOT FOUND");
- g_free(full_path);
- if (!ret) {
- dbg(lvl_error,"Failed to load image for '%s' (w=%d, h=%d)\n", name, w, h);
- full_path=graphics_icon_path("unknown");
- ret=graphics_image_new_scaled(this->gra, full_path, w, h);
- g_free(full_path);
- }
- return ret;
-}
-
-#if 0
-static struct graphics_image *
-image_new_o(struct gui_priv *this, char *name)
-{
- return image_new_scaled(this, name, -1, -1);
-}
-#endif
-
-/**
- * @brief Displays an image scaled to xs (extra small) size
- *
- * This image size can be too small to click it on some devices.
- *
- * @param this Our gui context
- * @param name image name
- *
- * @return image_struct Ptr to scaled image struct or NULL if not scaled or found
- */
-struct graphics_image *
-image_new_xs(struct gui_priv *this, const char *name)
-{
- return image_new_scaled(this, name, this->icon_xs, this->icon_xs);
-}
-
-/**
- * @brief Displays an image scaled to s (small) size
- *
- * @param this Our gui context
- * @param name image name
- *
- * @return image_struct Ptr to scaled image struct or NULL if not scaled or found
- */
-struct graphics_image *
-image_new_s(struct gui_priv *this, const char *name)
-{
- return image_new_scaled(this, name, this->icon_s, this->icon_s);
-}
-
-/**
- * @brief Displays an image scaled to l (large) size
- * @param this Our gui context
- * @param name image name
- *
- * @return image_struct Ptr to scaled image struct or NULL if not scaled or found
- */
-struct graphics_image *
-image_new_l(struct gui_priv *this, const char *name)
-{
- return image_new_scaled(this, name, this->icon_l, this->icon_l);
-}
-
-
-
-static int
-gui_internal_button_attr_update(struct gui_priv *this, struct widget *w)
-{
- struct widget *wi;
- int is_on=0;
- struct attr curr;
- GList *l;
-
- if (w->get_attr(w->instance, w->on.type, &curr, NULL))
- is_on=curr.u.data == w->on.u.data;
- else
- is_on=w->deflt;
- if (is_on != w->is_on) {
- if (w->redraw)
- this->redraw=1;
- w->is_on=is_on;
- l=g_list_first(w->children);
- if (l) {
- wi=l->data;
- if (wi->img)
- graphics_image_free(this->gra, wi->img);
- wi->img=image_new_xs(this, is_on ? "gui_active" : "gui_inactive");
- }
- if (w->is_on && w->off.type == attr_none)
- w->state &= ~STATE_SENSITIVE;
- else
- w->state |= STATE_SENSITIVE;
- return 1;
- }
- return 0;
-}
-
-static void
-gui_internal_button_attr_callback(struct gui_priv *this, struct widget *w)
-{
- if (gui_internal_button_attr_update(this, w))
- gui_internal_widget_render(this, w);
-}
-static void
-gui_internal_button_attr_pressed(struct gui_priv *this, struct widget *w, void *data)
-{
- if (w->is_on)
- w->set_attr(w->instance, &w->off);
- else
- w->set_attr(w->instance, &w->on);
- gui_internal_button_attr_update(this, w);
-
-}
-
-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 graphics_image *image=NULL;
- struct widget *ret;
- if (!on && !off)
- return NULL;
- image=image_new_xs(this, "gui_inactive");
- ret=gui_internal_button_new_with_callback(this, text, image, flags, gui_internal_button_attr_pressed, NULL);
- if (on)
- ret->on=*on;
- if (off)
- ret->off=*off;
- ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))navit_get_attr;
- ret->set_attr=(int (*)(void *, struct attr *))navit_set_attr;
- ret->remove_cb=(void (*)(void *, struct callback *))navit_remove_callback;
- ret->instance=this->nav;
- ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on?on->type:off->type, this, ret);
- navit_add_callback(this->nav, ret->cb);
- gui_internal_button_attr_update(this, ret);
- return ret;
-}
-
-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 graphics_image *image=NULL;
- struct widget *ret;
- image=image_new_xs(this, "gui_inactive");
- if (!on && !off)
- return NULL;
- ret=gui_internal_button_new_with_callback(this, text, image, flags, gui_internal_button_attr_pressed, NULL);
- if (on)
- ret->on=*on;
- if (off)
- ret->off=*off;
- ret->deflt=deflt;
- ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))map_get_attr;
- ret->set_attr=(int (*)(void *, struct attr *))map_set_attr;
- ret->remove_cb=(void (*)(void *, struct callback *))map_remove_callback;
- ret->instance=map;
- ret->redraw=1;
- ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on?on->type:off->type, this, ret);
- map_add_callback(map, ret->cb);
- gui_internal_button_attr_update(this, ret);
- return ret;
-}
-
-
-
-
-
-
-/*
- * @brief Calculate movement vector and timing of the gesture.
- * @param in this gui context
- * @param in msec time in milliseconds to find gesture within
- * @param out p0 pointer to the point object, where gesture starting point coordinates should be placed. Can be NULL.
- * @param out dx pointer to variable to store horizontal movement of the gesture.
- * @param out dy pointer to variable to store vertical movement of the gesture.
- * @return amount of time the actual movement took.
- */
-/* FIXME where is the implementation? */
-
-
-static void gui_internal_motion_cb(struct gui_priv *this)
-{
- this->motion_timeout_event=NULL;
- gui_internal_gesture_ring_add(this, &(this->current));
-
- /* Check for scrollable table below the highligted item if there's a movement with the button pressed */
- if (this->pressed && this->highlighted) {
- struct widget *wt=NULL;
- struct widget *wr=NULL;
- int dx,dy;
-
- /* Guard against accidental scrolling when user is likely going to swipe */
- gui_internal_gesture_get_vector(this, 1000, NULL, &dx, &dy);
- if(abs(dx)>abs(dy) || abs(dy)<this->icon_s)
- return;
-
- if(this->highlighted)
- for(wr=this->highlighted;wr && wr->type!=widget_table_row;wr=wr->parent);
- if(wr)
- wt=wr->parent;
-
- if(wt && wt->type==widget_table && (wt->state & STATE_SCROLLABLE)) {
- struct table_data *td=wt->data;
- GList *top=NULL;
- GList *btm=NULL;
- GList *ttop, *tbtm;
-
-
-
- if(!wr || !wr->h)
- return;
-
- if(this->current.y < wr->p.y && wr!=td->top_row->data ) {
- int n=(wr->p.y-this->current.y)/wr->h+1;
-
- btm=td->bottom_row;
- top=td->top_row;
-
- while(n-->0 && (tbtm=gui_internal_widget_table_next_row(btm))!=NULL && (ttop=gui_internal_widget_table_next_row(top))!=NULL) {
- top=ttop;
- btm=tbtm;
- if(top->data==wr)
- break;
- }
- this->pressed=2;
- } else if (this->current.y > wr->p.y + wr->h ) {
- int y=wt->p.y+wt->h-wr->h;
- int n;
-
- if(td->scroll_buttons.button_box && td->scroll_buttons.button_box->p.y!=0)
- y=td->scroll_buttons.button_box->p.y - td->scroll_buttons.button_box->h;
-
- if(y>this->current.y)
- y=this->current.y;
-
- n=(y - wr->p.y )/wr->h;
-
- btm=td->bottom_row;
- top=td->top_row;
-
- while(n-->0 && (ttop=gui_internal_widget_table_prev_row(top))!=NULL && (tbtm=gui_internal_widget_table_prev_row(btm))!=NULL) {
- btm=tbtm;
- top=ttop;
- if(btm->data==wr)
- break;
- }
- this->pressed=2;
- }
- if( top && btm && (td->top_row!=top || td->bottom_row!=btm) ) {
- gui_internal_table_hide_rows(wt->data);
- td->top_row=top;
- td->bottom_row=btm;
- graphics_draw_mode(this->gra, draw_mode_begin);
- gui_internal_widget_render(this,wt);
- graphics_draw_mode(this->gra, draw_mode_end);
- }
-
- return;
- }
- }
-
- /* Else, just move highlight after pointer if there's nothing to scroll */
- gui_internal_highlight(this);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_call_highlighted(struct gui_priv *this)
-{
- if (! this->highlighted || ! this->highlighted->func)
- return;
- this->highlighted->reason=gui_internal_reason_click;
- this->highlighted->func(this, this->highlighted, this->highlighted->data);
-}
-
-void
-gui_internal_say(struct gui_priv *this, struct widget *w, int questionmark)
-{
- char *text=w->speech;
- if (! this->speech)
- return;
- if (!text)
- text=w->text;
- if (!text)
- text=w->name;
- if (text) {
- text=g_strdup_printf("%s%c", text, questionmark ? '?':'\0');
- navit_say(this->nav, text);
- g_free(text);
- }
-}
-
-
-
-
-
-void
-gui_internal_back(struct gui_priv *this, struct widget *w, void *data)
-{
- gui_internal_prune_menu_count(this, 1, 1);
-}
-
-void
-gui_internal_cmd_return(struct gui_priv *this, struct widget *wm, void *data)
-{
- gui_internal_prune_menu(this, wm->data);
-}
-
-
-
-void
-gui_internal_cmd_main_menu(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w=this->root.children->data;
- if (w && w->menu_data && w->menu_data->href && !strcmp(w->menu_data->href,"#Main Menu"))
- gui_internal_prune_menu(this, w);
- else
- gui_internal_html_main_menu(this);
-}
-
-
-struct widget *
-gui_internal_time_help(struct gui_priv *this)
-{
- struct widget *w,*wc,*wcn;
- char timestr[64];
- struct tm *tm;
- time_t timep;
-
- w=gui_internal_box_new(this, gravity_right_center|orientation_horizontal|flags_fill);
- w->bl=this->spacing;
- w->spx=this->spacing;
- w->spx=10;
- w->bl=10;
- w->br=10;
- w->bt=6;
- w->bb=6;
- if (this->flags & 64) {
- wc=gui_internal_box_new(this, gravity_right_top|orientation_vertical|flags_fill);
- wc->bl=10;
- wc->br=20;
- wc->bt=6;
- wc->bb=6;
- timep=time(NULL);
- tm=localtime(&timep);
- strftime(timestr, 64, "%H:%M %d.%m.%Y", tm);
- wcn=gui_internal_label_new(this, timestr);
- gui_internal_widget_append(wc, wcn);
- gui_internal_widget_append(w, wc);
- }
- if (this->flags & 128) {
- wcn=gui_internal_button_new_with_callback(this, _("Help"), image_new_l(this, "gui_help"), gravity_center|orientation_vertical|flags_fill, NULL, NULL);
- gui_internal_widget_append(w, wcn);
- }
- return w;
-}
-
-
-/**
- * Applies the configuration values to this based on the settings
- * specified in the configuration file (this->config) and
- * the most approriate default profile based on screen resolution.
- *
- * This function should be run after this->root is setup and could
- * be rerun after the window is resized.
- *
- * @author Steve Singer <ssinger_pg@sympatico.ca> (09/2008)
- */
-void
-gui_internal_apply_config(struct gui_priv *this)
-{
- struct gui_config_settings * current_config=0;
-
- dbg(lvl_debug,"w=%d h=%d\n", this->root.w, this->root.h);
- /*
- * Select default values from profile based on the screen.
- */
- if((this->root.w > 320 || this->root.h > 320) && this->root.w > 240 && this->root.h > 240)
- {
- if((this->root.w > 640 || this->root.h > 640) && this->root.w > 480 && this->root.h > 480 )
- {
- current_config = &config_profiles[LARGE_PROFILE];
- }
- else
- {
- current_config = &config_profiles[MEDIUM_PROFILE];
- }
- }
- else
- {
- current_config = &config_profiles[SMALL_PROFILE];
- }
-
- /*
- * Apply override values from config file
- */
- if(this->config.font_size == -1 )
- {
- this->font_size = current_config->font_size;
- }
- else
- {
- this->font_size = this->config.font_size;
- }
-
- if(this->config.icon_xs == -1 )
- {
- this->icon_xs = current_config->icon_xs;
- }
- else
- {
- this->icon_xs = this->config.icon_xs;
- }
-
- if(this->config.icon_s == -1 )
- {
- this->icon_s = current_config->icon_s;
- }
- else
- {
- this->icon_s = this->config.icon_s;
- }
- if(this->config.icon_l == -1 )
- {
- this->icon_l = current_config->icon_l;
- }
- else
- {
- this->icon_l = this->config.icon_l;
- }
- if(this->config.spacing == -1 )
- {
- this->spacing = current_config->spacing;
- }
- else
- {
- this->spacing = current_config->spacing;
- }
- if (!this->fonts[0]) {
- int i,sizes[]={100,66,50};
- for (i = 0 ; i < 3 ; i++) {
- if (this->font_name)
- this->fonts[i]=graphics_named_font_new(this->gra,this->font_name,this->font_size*sizes[i]/100,1);
- else
- this->fonts[i]=graphics_font_new(this->gra,this->font_size*sizes[i]/100,1);
- }
- }
-
-}
-
-
-
-
-
-static void
-gui_internal_cmd_set_destination(struct gui_priv *this, struct widget *wm, void *data)
-{
- char *name=data;
- dbg(lvl_info,"c=%d:0x%x,0x%x\n", wm->c.pro, wm->c.x, wm->c.y);
- navit_set_destination(this->nav, &wm->c, name, 1);
- if (this->flags & 512) {
- struct attr follow;
- follow.type=attr_follow;
- follow.u.num=180;
- navit_set_attr(this->nav, &this->osd_configuration);
- navit_set_attr(this->nav, &follow);
- navit_zoom_to_route(this->nav, 0);
- }
- gui_internal_prune_menu(this, NULL);
-}
-
-static void
-gui_internal_cmd_insert_destination_do(struct gui_priv *this, struct widget *wm, void *data) {
- char *name=data;
- int dstcount=navit_get_destination_count(this->nav)+1;
- int pos,i;
- struct pcoord *dst=g_alloca(dstcount*sizeof(struct pcoord));
- dstcount=navit_get_destinations(this->nav,dst,dstcount);
-
- pos=dstcount-wm->datai;
- if(pos<0)
- pos=0;
-
- for(i=dstcount;i>pos;i--)
- dst[i]=dst[i-1];
-
- dst[pos]=wm->c;
- navit_add_destination_description(this->nav,&wm->c,(char*)data);
- navit_set_destinations(this->nav,dst,dstcount+1,name,1);
- gui_internal_prune_menu(this, NULL);
-}
-
-/*
- * @brief Displays a waypoint list to the user.
- *
- * This display a waypoint list to the user. When the user chooses an item from the list, the callback
- * function passed as {@code cmd} will be called.
- *
- * Widget passed as wm parameter of the called cmd function will have item set to user chosen waypoint item. Its data will be set
- * to zero-based choosen waypoint number, counting from the route end. Coordinates to wm->c will be copied from wm_->c if wm_ is not null. Otherwise,
- * waypoint coordinates will be copied to wm->c.
- *
- * @param this gui context
- * @param title Menu title
- * @param hint Text to display above the waypoint list describing the action to be performed, can be NULL
- * @param wm_ The called widget pointer. Can be NULL.
- * @param cmd Callback function which will be called on item selection
- * @param data data argument to be passed to the callback function
- */
-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)
-{
- struct widget *wb,*w,*wtable,*row,*wc;
- struct map *map;
- struct map_rect *mr;
- struct item *item;
- char *text;
- int i;
- int dstcount=navit_get_destination_count(this->nav)+1;
-
- map=route_get_map(navit_get_route(this->nav));
- if(!map)
- return;
- mr = map_rect_new(map, NULL);
- if(!mr)
- return;
-
- wb=gui_internal_menu(this, title);
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- if(hint)
- gui_internal_widget_append(w, gui_internal_label_new(this, hint));
- wtable = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
- gui_internal_widget_append(w,wtable);
-
- i=0;
- while((item = map_rect_get_item(mr))!=NULL) {
- struct attr attr;
- if(item->type!=type_waypoint && item->type!=type_route_end)
- continue;
- if (item_attr_get(item, attr_label, &attr)) {
- text=g_strdup_printf(_("Waypoint %s"), map_convert_string_tmp(item->map, attr.u.str));
- } else
- continue;
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row, wc=gui_internal_button_new_with_callback(this, text,
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- cmd, data));
- wc->item=*item;
- if(wm_)
- wc->c=wm_->c;
- else {
- struct coord c;
- item_coord_get(item,&c,1);
- wc->c.x=c.x;
- wc->c.y=c.y;
- wc->c.pro=map_projection(item->map);
- }
- i++;
- wc->datai=dstcount-i;
- g_free(text);
- }
- map_rect_destroy(mr);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd_insert_destination(struct gui_priv *this, struct widget *wm, void *data)
-{
- gui_internal_select_waypoint(this, data, _("Select waypoint to insert the new one before"), wm, gui_internal_cmd_insert_destination_do, data);
-}
-
-
-
-static void
-gui_internal_cmd_set_position(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr v;
- if(data) {
- v.type=attr_vehicle;
- v.u.vehicle=NULL;
- navit_set_attr(this->nav, &v);
- }
- navit_set_position(this->nav, &wm->c);
- gui_internal_prune_menu(this, NULL);
-}
-
-
-
-
-
-
-/**
- * @brief Generic notification function for Editable widgets to call Another widget notification function when Enter is pressed in editable field.
- * The Editable widget should have data member pointing to the Another widget.
- */
-void
-gui_internal_call_linked_on_finish(struct gui_priv *this, struct widget *wm, void *data)
-{
- if (wm->reason==gui_internal_reason_keypress_finish && data) {
- struct widget *w=data;
- if(w->func)
- w->func(this, w, w->data);
- }
-}
-
-struct widget * gui_internal_keyboard(struct gui_priv *this, int mode);
-
-
-struct widget * gui_internal_keyboard_show_native(struct gui_priv *this, struct widget *w, int mode, char *lang);
-
-
-static void
-gui_internal_cmd_delete_bookmark(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
- GList *l;
- navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_delete_bookmark(mattr.u.bookmarks,wm->text);
- l=g_list_previous(g_list_previous(g_list_last(this->root.children)));
- gui_internal_prune_menu(this, l->data);
-}
-
-
-
-
-/**
- * Get a utf-8 string, return the same prepared for case insensitive search. Result should be g_free()d after use.
- */
-char *
-removecase(char *s)
-{
- char *r;
- r=linguistics_casefold(s);
- return r;
-}
-
-static void
-gui_internal_cmd_view_on_map(struct gui_priv *this, struct widget *wm, void *data)
-{
- if (wm->item.type != type_none) {
- enum item_type type;
- if (wm->item.type < type_line)
- type=type_selected_point;
- else if (wm->item.type < type_area)
- type=type_selected_point;
- else
- type=type_selected_area;
- graphics_clear_selection(this->gra, NULL);
- graphics_add_selection(this->gra, &wm->item, type, NULL);
- }
- navit_set_center(this->nav, &wm->c, 1);
- gui_internal_prune_menu(this, NULL);
-}
-
-
-static void
-gui_internal_cmd_view_attribute_details(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb;
- struct map_rect *mr;
- struct item *item;
- struct attr attr;
- char *text,*url;
- int i;
-
- text=g_strdup_printf("Attribute %s",wm->name);
- wb=gui_internal_menu(this, text);
- g_free(text);
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- mr=map_rect_new(wm->item.map, NULL);
- item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- for (i = 0 ; i < wm->datai ; i++) {
- item_attr_get(item, attr_any, &attr);
- }
- if (item_attr_get(item, attr_any, &attr)) {
- url=NULL;
- switch (attr.type) {
- case attr_osm_nodeid:
- url=g_strdup_printf("http://www.openstreetmap.org/browse/node/"LONGLONG_FMT"\n",*attr.u.num64);
- break;
- case attr_osm_wayid:
- url=g_strdup_printf("http://www.openstreetmap.org/browse/way/"LONGLONG_FMT"\n",*attr.u.num64);
- break;
- case attr_osm_relationid:
- url=g_strdup_printf("http://www.openstreetmap.org/browse/relation/"LONGLONG_FMT"\n",*attr.u.num64);
- break;
- default:
- break;
- }
- if (url) {
- gui_internal_widget_append(w,
- wb=gui_internal_button_new_with_callback(this, _("View in Browser"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_view_in_browser, NULL));
- wb->name=url;
- }
- }
- map_rect_destroy(mr);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd_view_attributes(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb;
- struct map_rect *mr;
- struct item *item;
- struct attr attr;
- char *text;
- int count=0;
-
- dbg(lvl_info,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
- wb=gui_internal_menu(this, "Attributes");
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- mr=map_rect_new(wm->item.map, NULL);
- item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- dbg(lvl_info,"item=%p\n", item);
- if (item) {
- text=g_strdup_printf("%s:%s", _("Item type"), item_to_name(item->type));
- gui_internal_widget_append(w,
- wb=gui_internal_button_new(this, text,
- NULL, gravity_left_center|orientation_horizontal|flags_fill));
- wb->name=g_strdup(text);
- wb->item=wm->item;
- g_free(text);
- while(item_attr_get(item, attr_any, &attr)) {
- char *attrtxt;
- text=g_strdup_printf("%s:%s", attr_to_name(attr.type), attrtxt=attr_to_text(&attr, wm->item.map, 1));
- g_free(attrtxt);
- gui_internal_widget_append(w,
- wb=gui_internal_button_new_with_callback(this, text,
- NULL, gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_view_attribute_details, NULL));
- wb->name=g_strdup(text);
- wb->item=wm->item;
- wb->datai=count++;
- g_free(text);
- }
- text=g_strdup_printf("%s:0x%x,0x%x", "ID", item->id_hi, item->id_lo);
- gui_internal_widget_append(w,
- wb=gui_internal_button_new(this, text,
- NULL, gravity_left_center|orientation_horizontal|flags_fill));
- wb->name=text;
- wb->item=wm->item;
- }
- map_rect_destroy(mr);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct map_rect *mr;
- struct item *item;
- struct attr attr;
- char *cmd=NULL;
-
- if (!wm->name) {
- dbg(lvl_info,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
- mr=map_rect_new(wm->item.map, NULL);
- item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- dbg(lvl_info,"item=%p\n", item);
- if (item) {
- while(item_attr_get(item, attr_url_local, &attr)) {
- if (! cmd)
- cmd=g_strdup_printf("navit-browser.sh '%s' &",map_convert_string_tmp(item->map,attr.u.str));
- }
- }
- map_rect_destroy(mr);
- } else {
- cmd=g_strdup_printf("navit-browser.sh '%s' &",wm->name);
- }
- if (cmd) {
-#ifdef HAVE_SYSTEM
- system(cmd);
-#else
- dbg(lvl_error,"Error: External commands were disabled during compilation, cannot call '%s'.\n",cmd);
-#endif
- g_free(cmd);
- }
-}
-
-
-/*
- * @brief Transfers search results to a map.
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data (pointer to the table widget containing results, or NULL to clean the result map without adding any new data).
- */
-static void
-gui_internal_cmd_results_to_map(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w;
- struct mapset *ms;
- struct map *map;
- struct map_rect *mr;
- struct item *item;
- GList *l;
- struct coord_rect r;
- struct attr a;
- int count;
-
- ms=navit_get_mapset(this->nav);
-
- if(!ms)
- return;
-
- map=mapset_get_map_by_name(ms, "search_results");
- if(!map) {
- struct attr *attrs[10], attrmap;
- enum attr_type types[]={attr_position_longitude,attr_position_latitude,attr_label,attr_none};
- int i;
-
- attrs[0]=g_new0(struct attr,1);
- attrs[0]->type=attr_type;
- attrs[0]->u.str="csv";
-
- attrs[1]=g_new0(struct attr,1);
- attrs[1]->type=attr_name;
- attrs[1]->u.str="search_results";
-
- attrs[2]=g_new0(struct attr,1);
- attrs[2]->type=attr_charset;
- attrs[2]->u.str="utf-8";
-
- attrs[3]=g_new0(struct attr,1);
- attrs[3]->type=attr_item_type;
- attrs[3]->u.num=type_found_item;
-
- attrs[4]=g_new0(struct attr,1);
- attrs[4]->type=attr_attr_types;
- attrs[4]->u.attr_types=types;
- attrs[5]=NULL;
-
- attrmap.type=attr_map;
- map=attrmap.u.map=map_new(NULL,attrs);
- if(map)
- mapset_add_attr(ms,&attrmap);
-
- for(i=0;attrs[i];i++)
- g_free(attrs[i]);
-
- }
-
- if(!map)
- return;
-
-
- mr = map_rect_new(map, NULL);
-
- if(!mr)
- return;
-
- /* Clean the map */
- while((item = map_rect_get_item(mr))!=NULL) {
- item_type_set(item,type_none);
- }
-
- this->results_map_population=0;
-
- /* Find the table to pupulate the map */
- for(w=data; w && w->type!=widget_table;w=w->parent);
-
- if(!w) {
- map_rect_destroy(mr);
- dbg(lvl_warning,"Can't find the results table - only map clean up is done.\n");
- return;
- }
-
- /* Populate the map with search results*/
- for(l=w->children, count=0;l;l=g_list_next(l)) {
- struct widget *wr=l->data;
- if(wr->type==widget_table_row) {
- struct widget *wi=wr->children->data;
- struct item* it;
- if(wi->name==NULL)
- continue;
- dbg(lvl_info,"%s\n",wi->name);
- it=map_rect_create_item(mr,type_found_item);
- if(it) {
- struct coord c;
- struct attr a;
- c.x=wi->c.x;
- c.y=wi->c.y;
- item_coord_set(it, &c, 1, change_mode_modify);
- a.type=attr_label;
- a.u.str=wi->name;
- item_attr_set(it, &a, change_mode_modify);
- if(!count++)
- r.lu=r.rl=c;
- else
- coord_rect_extend(&r,&c);
- }
- }
- }
- map_rect_destroy(mr);
- if(!count)
- return;
- a.type=attr_orientation;
- a.u.num=0;
- navit_set_attr(this->nav,&a);
- navit_zoom_to_rect(this->nav,&r);
- gui_internal_prune_menu(this, NULL);
- this->results_map_population=count;
-}
-
-/*
- * @brief Removes search results from a map.
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data
- */
-static void
-gui_internal_cmd_results_map_clean(struct gui_priv *this, struct widget *wm, void *data)
-{
- gui_internal_cmd_results_to_map(this,wm,NULL);
- gui_internal_prune_menu(this, NULL);
- navit_draw(this->nav);
-}
-
-static void
-gui_internal_cmd_delete_waypoint(struct gui_priv *this, struct widget *wm, void *data)
-{
- int dstcount=navit_get_destination_count(this->nav);
- int i;
- struct map_rect *mr;
- struct item *item;
- struct pcoord *dst=g_alloca(dstcount*sizeof(struct pcoord));
- dstcount=navit_get_destinations(this->nav,dst,dstcount);
- mr=map_rect_new(wm->item.map, NULL);
- i=0;
- while((item=map_rect_get_item(mr))!=NULL) {
- struct coord c;
- if(item->type!=type_waypoint && item->type!=type_route_end)
- continue;
- if(item_is_equal_id(*item,wm->item))
- continue;
- item_coord_get_pro(item,&c,1,projection_mg);
- dst[i].x=c.x;
- dst[i].y=c.y;
- dst[i].pro=projection_mg;
- i++;
- }
- map_rect_destroy(mr);
- navit_set_destinations(this->nav,dst,i,NULL,1);
- gui_internal_prune_menu(this, NULL);
-}
-
-
-/**
- * @brief Displays the commands available for a location.
- *
- * This displays the available commands for the given location in a dialog from which the user can
- * choose an action. The location can be supplied either in projected coordinates via the {@code pc_in}
- * argument or in WGS84 coordinates (i.e. latitude and longitude in degrees) via the {@code g_in}
- * argument. One of these must be supplied, the other should be {@code NULL}.
- *
- * @param this The internal GUI instance
- * @param pc_in Projected coordinates of the position
- * @param g_in WGS84 coordinates of the position
- * @param wm
- * @param name The display name for the position
- * @param flags Flags specifying the operations available from the GUI
- */
-/* meaning of the bits in "flags":
- * 1: "Streets"
- * 2: "House numbers"
- * 4: "View in Browser", "View Attributes"
- * 8: "Set as dest."
- * 16: "Set as pos."
- * 32: "Add as bookm."
- * 64: "POIs"
- * 128: "View on Map"
- * 256: POIs around this point, "Drop search results from the map"
- * 512: "Cut/Copy... bookmark"
- * 1024: "Jump to attributes of top item within this->radius pixels of this point (implies flags|=256)"
- * 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)
-{
- struct widget *wb,*w,*wtable,*row,*wc,*wbc,*wclosest=NULL;
- struct coord_geo g;
- struct pcoord pc;
- struct coord c;
- char *coord;
-
- if (pc_in) {
- pc=*pc_in;
- c.x=pc.x;
- c.y=pc.y;
- dbg(lvl_info,"x=0x%x y=0x%x\n", c.x, c.y);
- transform_to_geo(pc.pro, &c, &g);
- } else if (g_in) {
- struct attr attr;
- if (!navit_get_attr(this->nav, attr_projection, &attr, NULL))
- return;
- g=*g_in;
- pc.pro=attr.u.projection;
- transform_from_geo(pc.pro, &g, &c);
- pc.x=c.x;
- pc.y=c.y;
- } else
- return;
-
- wb=gui_internal_menu(this, name);
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- coord=gui_internal_coordinates(&pc, ' ');
- gui_internal_widget_append(w, gui_internal_label_new(this, coord));
- g_free(coord);
- wtable = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
- gui_internal_widget_append(w,wtable);
-
- if ((flags & 1) && wm) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wc=gui_internal_button_new_with_callback(this, _("Streets"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_search_street_in_town, wm));
- wc->item=wm->item;
- wc->selection_id=wm->selection_id;
- }
- if ((flags & 2) && wm) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wc=gui_internal_button_new_with_callback(this, _("House numbers"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_search_house_number_in_street, wm));
- wc->item=wm->item;
- wc->selection_id=wm->selection_id;
- }
- if ((flags & 4) && wm) {
- struct map_rect *mr;
- struct item *item;
- struct attr attr;
- mr=map_rect_new(wm->item.map, NULL);
- item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- if (item) {
- if (item_attr_get(item, attr_description, &attr))
- gui_internal_widget_append(w, gui_internal_label_new(this, map_convert_string_tmp(item->map,attr.u.str)));
- if (item_attr_get(item, attr_url_local, &attr)) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wb=gui_internal_button_new_with_callback(this, _("View in Browser"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_view_in_browser, NULL));
- wb->item=wm->item;
- }
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wb=gui_internal_button_new_with_callback(this, _("View Attributes"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_view_attributes, NULL));
- wb->item=wm->item;
- }
- map_rect_destroy(mr);
- }
- if (flags & 8) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Set as destination"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_set_destination, g_strdup(name)));
- wbc->data_free=g_free_func;
- wbc->c=pc;
- if(navit_get_destination_count(this->nav)>=1) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Visit before..."),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_insert_destination, g_strdup(name)));
- wbc->data_free=g_free_func;
- wbc->c=pc;
- }
- }
- if (flags & 16) {
- const char *text;
- struct attr vehicle, source;
- int deactivate=0;
- if (navit_get_attr(this->nav, attr_vehicle, &vehicle, NULL) && vehicle.u.vehicle &&
- !(vehicle_get_attr(vehicle.u.vehicle, attr_source, &source, NULL) && source.u.str && !strcmp("demo://",source.u.str)))
- deactivate=1;
-
- text=deactivate? _("Set as position (and deactivate vehicle)") : _("Set as position");
-
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, text,
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_set_position, (void*)(long)deactivate));
- wbc->c=pc;
- }
- if (flags & 32) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Add as bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_add_bookmark2, g_strdup(name)));
- wbc->data_free=g_free_func;
- wbc->c=pc;
- }
-#ifndef _MSC_VER
-//POIs are not operational under MSVC yet
- if (flags & 64) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("POIs"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_pois, NULL));
- wbc->c=pc;
- }
-#endif /* _MSC_VER */
-#if 0
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- gui_internal_button_new(this, "Add to tour",
- image_new_o(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
-#endif
- if (flags & 128) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("View on map"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_view_on_map, NULL));
- wbc->c=pc;
- if ((flags & 4) && wm)
- wbc->item=wm->item;
- else
- wbc->item.type=type_none;
- }
- if(flags & 256 && this->results_map_population) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Remove search results from the map"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_results_map_clean, NULL));
- wbc->data=wm;
- }
- if(flags & 2048) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Show results on the map"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_results_to_map, NULL));
- wbc->data=wm;
- }
- if ((flags & 256) || (flags & 1024)) {
- struct displaylist_handle *dlh;
- struct displaylist *display;
- struct attr attr;
- struct point p;
- struct transformation *trans;
-
- char *text;
- struct map_selection *sel;
- GList *l, *ll;
-
- c.x=pc.x;
- c.y=pc.y;
-
- trans=navit_get_trans(this->nav);
- transform(trans,pc.pro,&c,&p,1,0,0,0);
- display=navit_get_displaylist(this->nav);
- dlh=graphics_displaylist_open(display);
- sel=displaylist_get_selection(display);
- l=displaylist_get_clicked_list(display, &p, this->radius);
- for(ll=l;ll;ll=g_list_next(ll)) {
- struct displayitem *di;
- struct item *item;
- struct map_rect *mr;
- struct item *itemo;
-
- di=(struct displayitem*)ll->data;
- item=graphics_displayitem_get_item(di);
-
- mr=map_rect_new(item->map, sel);
- itemo=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if(!itemo) {
- map_rect_destroy(mr);
- continue;
- }
- if (item_attr_get(itemo, attr_label, &attr)) {
- text=g_strdup(map_convert_string_tmp(itemo->map, attr.u.str));
- } else
- text=g_strdup(item_to_name(item->type));
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row, wc=gui_internal_cmd_pois_item(this, NULL, itemo, NULL, NULL, -1, text));
- wc->c=pc;
- g_free(wc->name);
- wc->name=g_strdup(text);
- wc->item=*itemo;
- g_free(text);
- map_rect_destroy(mr);
- if(!wclosest)
- wclosest=wc;
-
- }
- g_list_free(l);
- map_selection_destroy(sel);
- graphics_displaylist_close(dlh);
- }
- if (flags & 512) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Cut Bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_cut_bookmark, NULL));
- wbc->text=g_strdup(wm->text);
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Copy Bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_copy_bookmark, NULL));
- wbc->text=g_strdup(wm->text);
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Rename Bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_rename_bookmark, NULL));
- wbc->text=g_strdup(wm->text);
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Paste Bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_paste_bookmark, NULL));
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Delete Bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_delete_bookmark, NULL));
- wbc->text=g_strdup(wm->text);
- }
-
- if (wm && (wm->item.type==type_waypoint || wm->item.type==type_route_end)) {
- gui_internal_widget_append(wtable,row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- wbc=gui_internal_button_new_with_callback(this, _("Delete waypoint"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_delete_waypoint, NULL));
- wbc->item=wm->item;
- }
-
- gui_internal_menu_render(this);
-
- if((flags & 1024) && wclosest)
- gui_internal_cmd_view_attributes(this,wclosest,wclosest->data);
-}
-
-
-/* wm->data: 0 Nothing special
- 1 Map Point
- 2 Item
- 3 Town
- 4 County
- 5 Street
- 6 House number
- 7 Bookmark
- 8 Former destination
- 9 Item from the POI list
-*/
-
-void
-gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data)
-{
- int flags;
-
- if(!data)
- data=wm->data;
-
- switch ((long) data) {
- case 0:
- flags=8|16|32|64|128|256;
- break;
- case 1:
- flags=8|16|32|64|256;
- break;
- case 2:
- flags=4|8|16|32|64|128;
- break;
- case 3:
- flags=1|4|8|16|32|64|128|2048;
- flags &= this->flags_town;
- break;
- case 4:
- gui_internal_search_town_in_country(this, wm);
- return;
- case 5:
- flags=2|8|16|32|64|128|2048;
- flags &= this->flags_street;
- break;
- case 6:
- flags=8|16|32|64|128|2048;
- flags &= this->flags_house_number;
- break;
- case 7:
- flags=8|16|64|128|512;
- break;
- case 8:
- flags=8|16|32|64|128;
- break;
- case 9:
- flags=4|8|16|32|64|128|2048;
- break;
- default:
- return;
- }
- switch (flags) {
- case 2:
- gui_internal_search_house_number_in_street(this, wm, NULL);
- return;
- case 8:
- gui_internal_cmd_set_destination(this, wm, NULL);
- return;
- }
- gui_internal_cmd_position_do(this, &wm->c, NULL, wm, wm->name ? wm->name : wm->text, flags);
-}
-
-
-
-
-
-/**
- * The "Bookmarks" section of the OSD
- *
- */
-void
-gui_internal_cmd_bookmarks(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr attr,mattr;
- struct item *item;
- char *label_full,*prefix=0;
- int plen=0,hassub,found=0;
- struct widget *wb,*w,*wbm;
- struct coord c;
- struct widget *tbl, *row;
-
- if (data)
- prefix=g_strdup(data);
- else {
- if (wm && wm->prefix)
- prefix=g_strdup(wm->prefix);
- }
- if ( prefix )
- plen=strlen(prefix);
-
- gui_internal_prune_menu_count(this, 1, 0);
- wb=gui_internal_menu(this, _("Bookmarks"));
- wb->background=this->background;
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- //w->spy=this->spacing*3;
- gui_internal_widget_append(wb, w);
-
- if(navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL) ) {
- if (!plen) {
- bookmarks_move_root(mattr.u.bookmarks);
- } else {
- if (!strcmp(prefix,"..")) {
- bookmarks_move_up(mattr.u.bookmarks);
- g_free(prefix);
- prefix=g_strdup(bookmarks_item_cwd(mattr.u.bookmarks));
- if (prefix) {
- plen=strlen(prefix);
- } else {
- plen=0;
- }
- } else {
- bookmarks_move_down(mattr.u.bookmarks,prefix);
- }
-
- // "Back" button, when inside a bookmark folder
-
- if (plen) {
- wbm=gui_internal_button_new_with_callback(this, "..",
- image_new_xs(this, "gui_inactive"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_bookmarks, NULL);
- wbm->prefix=g_strdup("..");
- gui_internal_widget_append(w, wbm);
-
- // load bookmark folder as Waypoints, if any
- if (bookmarks_get_bookmark_count(mattr.u.bookmarks) > 0){
- wbm=gui_internal_button_new_with_callback(this, _("Bookmarks as waypoints"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_load_bookmarks_as_waypoints, NULL);
- wbm->prefix=g_strdup(prefix);
- gui_internal_widget_append(w, wbm);
- }
-
- // save Waypoints in bookmark folder, if route exists
- if (navit_get_destination_count(this->nav) > 0){
- if (bookmarks_get_bookmark_count(mattr.u.bookmarks)==0){
- wbm=gui_internal_button_new_with_callback(this, _("Save waypoints"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_replace_bookmarks_from_waypoints, NULL);
- }else{
- wbm=gui_internal_button_new_with_callback(this, _("Replace with waypoints"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_replace_bookmarks_from_waypoints, NULL);
- }
- wbm->prefix=g_strdup(prefix);
- gui_internal_widget_append(w, wbm);
- }
-
- // delete empty folder
- if (bookmarks_get_bookmark_count(mattr.u.bookmarks)==0){
- gui_internal_widget_append(w,
- wbm=gui_internal_button_new_with_callback(this, _("Delete Folder"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_delete_bookmark_folder, NULL));
- wbm->prefix=g_strdup(prefix);
- }
-
- }
- }
-
- // Adds the Bookmark folders
- wbm=gui_internal_button_new_with_callback(this, _("Add Bookmark folder"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_add_bookmark_folder2, NULL);
- gui_internal_widget_append(w, wbm);
-
- // Pastes the Bookmark
- wbm=gui_internal_button_new_with_callback(this, _("Paste bookmark"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_paste_bookmark, NULL);
- gui_internal_widget_append(w, wbm);
-
- bookmarks_item_rewind(mattr.u.bookmarks);
-
- tbl=gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
- gui_internal_widget_append(w,tbl);
-
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
- if (!item_attr_get(item, attr_label, &attr)) continue;
- label_full=map_convert_string_tmp(item->map,attr.u.str);
- dbg(lvl_info,"full_labled: %s\n",label_full);
-
- // hassub == 1 if the item type is a sub-folder
- if (item->type == type_bookmark_folder) {
- hassub=1;
- } else {
- hassub=0;
- }
-
- row=gui_internal_widget_table_row_new(this,gravity_left| flags_fill| orientation_horizontal);
- gui_internal_widget_append(tbl, row);
- wbm=gui_internal_button_new_with_callback(this, label_full,
- image_new_xs(this, hassub ? "gui_inactive" : "gui_active" ), gravity_left_center|orientation_horizontal|flags_fill,
- hassub ? gui_internal_cmd_bookmarks : gui_internal_cmd_position, NULL);
-
- gui_internal_widget_append(row,wbm);
- if (item_coord_get(item, &c, 1)) {
- wbm->c.x=c.x;
- wbm->c.y=c.y;
- wbm->c.pro=bookmarks_get_projection(mattr.u.bookmarks);
- wbm->name=g_strdup_printf(_("Bookmark %s"),label_full);
- wbm->text=g_strdup(label_full);
- if (!hassub) {
- wbm->data=(void*)7;//Mark us as a bookmark
- }
- wbm->prefix=g_strdup(label_full);
- } else {
- gui_internal_widget_destroy(this, row);
- }
- }
- }
-
- g_free(prefix);
-
- if (found)
- gui_internal_check_exit(this);
- else
- gui_internal_menu_render(this);
-}
-
-
-
-
-static void
-gui_internal_keynav_highlight_next(struct gui_priv *this, int dx, int dy, int rotary);
-
-static int
-gui_internal_keynav_find_next(struct widget *wi, struct widget *current_highlight, struct widget **result);
-
-static int
-gui_internal_keynav_find_prev(struct widget *wi, struct widget *current_highlight, struct widget **result);
-
-static struct widget*
-gui_internal_keynav_find_next_sensitive_child(struct widget *wi);
-
-void
-gui_internal_keypress_do(struct gui_priv *this, char *key)
-{
- struct widget *wi,*menu,*search_list;
- int len=0;
- char *text=NULL;
-
- menu=g_list_last(this->root.children)->data;
- wi=gui_internal_find_widget(menu, NULL, STATE_EDIT);
- if (wi) {
- /* select first item of the searchlist */
- if (*key == NAVIT_KEY_RETURN) {
- search_list=gui_internal_menu_data(this)->search_list;
- if(search_list) {
- GList *l=gui_internal_widget_table_top_row(this, search_list);
- if (l && l->data) {
- struct widget *w=l->data;
- this->current.x=w->p.x+w->w/2;
- this->current.y=w->p.y+w->h/2;
- gui_internal_highlight(this);
- }
- } else {
- wi->reason=gui_internal_reason_keypress_finish;
- wi->func(this, wi, wi->data);
- }
- return;
- } else if (*key == NAVIT_KEY_BACKSPACE) {
- dbg(lvl_debug,"backspace\n");
- if (wi->text && wi->text[0]) {
- len=g_utf8_prev_char(wi->text+strlen(wi->text))-wi->text;
- wi->text[len]='\0';
- text=g_strdup(wi->text);
- }
- } else {
- if (wi->state & STATE_CLEAR) {
- dbg(lvl_info,"wi->state=0x%x\n", wi->state);
- g_free(wi->text);
- wi->text=NULL;
- wi->state &= ~STATE_CLEAR;
- dbg(lvl_info,"wi->state=0x%x\n", wi->state);
- }
- text=g_strdup_printf("%s%s", wi->text ? wi->text : "", key);
-
- gui_internal_keyboard_to_lower_case(this);
- }
- g_free(wi->text);
- wi->text=text;
-
- if(!wi->text || !*wi->text)
- gui_internal_keyboard_to_upper_case(this);
-
- if (wi->func) {
- wi->reason=gui_internal_reason_keypress;
- wi->func(this, wi, wi->data);
- }
- gui_internal_widget_render(this, wi);
- }
-}
-
-
-
-
-char *
-gui_internal_cmd_match_expand(char *pattern, struct attr **in)
-{
- char p,*ret=g_strdup(pattern),*r=ret,*a;
- int len;
- while ((p=*pattern++)) {
- switch (p) {
- case '*':
- *r='\0';
- a=attr_to_text(*in++,NULL,0);
- len=strlen(ret)+strlen(a)+strlen(pattern)+1;
- r=g_malloc(len);
- strcpy(r, ret);
- strcat(r, a);
- g_free(ret);
- g_free(a);
- ret=r;
- r=ret+strlen(ret);
- break;
- case '\\':
- p=*pattern++;
- default:
- *r++=p;
- }
- }
- *r++='\0';
- return ret;
-}
-
-static int
-gui_internal_match(const char *pattern, const char *string)
-{
- char p,s;
- while ((p=*pattern++)) {
- switch (p) {
- case '*':
- while ((s=*string)) {
- if (gui_internal_match(pattern,string))
- return 1;
- string++;
- }
- break;
- case '\\':
- p=*pattern++;
- default:
- if (*string++ != p)
- return 0;
- }
- }
- return 1;
-}
-
-int
-gui_internal_set(char *remove, char *add)
-{
- char *gui_file=g_strjoin(NULL, navit_get_user_data_directory(TRUE), "/gui_internal.txt", NULL);
- char *gui_file_new=g_strjoin(NULL, navit_get_user_data_directory(TRUE), "/gui_internal_new.txt", NULL);
- FILE *fo=fopen(gui_file_new,"w");
- FILE *fi=fopen(gui_file,"r");
- char *line=NULL;
- int ret;
- size_t size=0;
- if (fi != NULL){
- while (getline(&line,&size,fi) > 0) {
- int len=strlen(line);
- if (len > 0 && line[len-1] == '\n')
- line[len-1]='\0';
- dbg(lvl_debug,"line=%s\n",line);
- if (!gui_internal_match(remove, line))
- fprintf(fo,"%s\n",line);
- }
- if (line)
- free(line);
- fclose(fi);
- }
- if (add)
- fprintf(fo,"%s;\n",add);
- fclose(fo);
- unlink(gui_file);
- ret=(rename(gui_file_new, gui_file)==0);
- g_free(gui_file_new);
- g_free(gui_file);
-
- return ret;
-}
-
-
-
-static void
-gui_internal_window_closed(struct gui_priv *this)
-{
- gui_internal_cmd2_quit(this, NULL, NULL, NULL, NULL);
-}
-
-
-static void
-gui_internal_cmd_map_download_do(struct gui_priv *this, struct widget *wm, void *data)
-{
- char *text=g_strdup_printf(_("Download %s"),wm->name);
- struct widget *w, *wb;
- struct map *map=data;
- double bllon,bllat,trlon,trlat;
-
- wb=gui_internal_menu(this, text);
- g_free(text);
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- w->spy=this->spacing*3;
- gui_internal_widget_append(wb, w);
- if (sscanf(wm->prefix,"%lf,%lf,%lf,%lf",&bllon,&bllat,&trlon,&trlat) == 4) {
- struct coord_geo g;
- struct map_selection sel;
- struct map_rect *mr;
- struct item *item;
-
- sel.next=NULL;
- sel.order=255;
- g.lng=bllon;
- g.lat=trlat;
- transform_from_geo(projection_mg, &g, &sel.u.c_rect.lu);
- g.lng=trlon;
- g.lat=bllat;
- transform_from_geo(projection_mg, &g, &sel.u.c_rect.rl);
- sel.range.min=type_none;
- sel.range.max=type_last;
- mr=map_rect_new(map, &sel);
- while ((item=map_rect_get_item(mr))) {
- dbg(lvl_info,"item\n");
- }
- map_rect_destroy(mr);
- }
-
- dbg(lvl_info,"bbox=%s\n",wm->prefix);
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_cmd_map_download(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr on, off, download_enabled, download_disabled;
- struct widget *w,*wb,*wma;
- struct map *map=data;
- FILE *f;
- char *search,buffer[256];
- int found,sp_match=0;
-
- dbg(lvl_debug,"wm=%p prefix=%s\n",wm,wm->prefix);
-
- search=wm->prefix;
- if (search) {
- found=0;
- while(search[sp_match] == ' ')
- sp_match++;
- sp_match++;
- } else {
- found=1;
- }
- on.type=off.type=attr_active;
- on.u.num=1;
- off.u.num=0;
- wb=gui_internal_menu(this, wm->name?wm->name:_("Map Download"));
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- w->spy=this->spacing*3;
- gui_internal_widget_append(wb, w);
- if (!search) {
- wma=gui_internal_button_map_attr_new(this, _("Active"), gravity_left_center|orientation_horizontal|flags_fill, map, &on, &off, 1);
- gui_internal_widget_append(w, wma);
- }
-
- download_enabled.type=download_disabled.type=attr_update;
- download_enabled.u.num=1;
- download_disabled.u.num=0;
- wma=gui_internal_button_map_attr_new(this
- , _("Download Enabled")
- , gravity_left_center|orientation_horizontal|flags_fill
- , map
- , &download_enabled
- , &download_disabled
- , 0);
- gui_internal_widget_append(w, wma);
-
-
- f=fopen("maps/areas.tsv","r");
- while (f && fgets(buffer, sizeof(buffer), f)) {
- char *nl,*description,*description_size,*bbox,*size=NULL;
- int sp=0;
- if ((nl=strchr(buffer,'\n')))
- *nl='\0';
- if ((nl=strchr(buffer,'\r')))
- *nl='\0';
- while(buffer[sp] == ' ')
- sp++;
- if ((bbox=strchr(buffer,'\t')))
- *bbox++='\0';
- if (bbox && (size=strchr(bbox,'\t')))
- *size++='\0';
- if (search && !strcmp(buffer, search)) {
- wma=gui_internal_button_new_with_callback(this, _("Download completely"), NULL,
- gravity_left_center|orientation_horizontal|flags_fill, gui_internal_cmd_map_download_do, map);
- wma->name=g_strdup(buffer+sp);
- wma->prefix=g_strdup(bbox);
- gui_internal_widget_append(w, wma);
- found=1;
- } else if (sp < sp_match)
- found=0;
- if (sp == sp_match && found && buffer[sp]) {
- description=g_strdup(buffer+sp);
- if (size)
- description_size=g_strdup_printf("%s (%s)",description,size);
- else
- description_size=g_strdup(description);
- wma=gui_internal_button_new_with_callback(this, description_size, NULL,
- gravity_left_center|orientation_horizontal|flags_fill, gui_internal_cmd_map_download, map);
- g_free(description_size);
- wma->prefix=g_strdup(buffer);
- wma->name=description;
- gui_internal_widget_append(w, wma);
- }
- }
-
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd_set_active_vehicle(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr vehicle = {attr_vehicle,{wm->data}};
- navit_set_attr(this->nav, &vehicle);
-}
-
-static void
-gui_internal_cmd_show_satellite_status(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb,*row;
- struct attr attr,sat_attr;
- struct vehicle *v=wm->data;
- char *str;
- int i;
- enum attr_type types[]={attr_sat_prn, attr_sat_elevation, attr_sat_azimuth, attr_sat_snr};
-
- wb=gui_internal_menu(this, _("Show Satellite Status"));
- gui_internal_menu_data(this)->redisplay=gui_internal_cmd_show_satellite_status;
- gui_internal_menu_data(this)->redisplay_widget=wm;
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- w = gui_internal_widget_table_new(this,gravity_center | orientation_vertical | flags_expand | flags_fill, 0);
- row = gui_internal_widget_table_row_new(this,gravity_left_top);
- gui_internal_widget_append(row, gui_internal_label_new(this, " PRN "));
- gui_internal_widget_append(row, gui_internal_label_new(this, _(" Elevation ")));
- gui_internal_widget_append(row, gui_internal_label_new(this, _(" Azimuth ")));
- gui_internal_widget_append(row, gui_internal_label_new(this, " SNR "));
- gui_internal_widget_append(w,row);
- while (vehicle_get_attr(v, attr_position_sat_item, &attr, NULL)) {
- row = gui_internal_widget_table_row_new(this,gravity_left_top);
- for (i = 0 ; i < sizeof(types)/sizeof(enum attr_type) ; i++) {
- if (item_attr_get(attr.u.item, types[i], &sat_attr))
- str=g_strdup_printf("%ld", sat_attr.u.num);
- else
- str=g_strdup("");
- gui_internal_widget_append(row, gui_internal_label_new(this, str));
- g_free(str);
- }
- gui_internal_widget_append(w,row);
- }
- gui_internal_widget_append(wb, w);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd_show_nmea_data(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb;
- struct attr attr;
- struct vehicle *v=wm->data;
- wb=gui_internal_menu(this, _("Show NMEA Data"));
- gui_internal_menu_data(this)->redisplay=gui_internal_cmd_show_nmea_data;
- gui_internal_menu_data(this)->redisplay_widget=wm;
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- if (vehicle_get_attr(v, attr_position_nmea, &attr, NULL))
- gui_internal_widget_append(w, gui_internal_text_new(this, attr.u.str, gravity_left_center|orientation_vertical));
- gui_internal_menu_render(this);
-}
-
-/**
- * A container to hold the selected vehicle and the desired profile in
- * one data item.
- */
-struct vehicle_and_profilename {
- struct vehicle *vehicle;
- char *profilename;
-};
-
-/**
- * Figures out whether the given vehicle is the active vehicle.
- *
- * @return true if the vehicle is active, false otherwise.
- */
-static int
-gui_internal_is_active_vehicle(struct gui_priv *this, struct vehicle
- *vehicle)
-{
- struct attr active_vehicle;
-
- if (!navit_get_attr(this->nav, attr_vehicle, &active_vehicle, NULL))
- active_vehicle.u.vehicle=NULL;
-
- return active_vehicle.u.vehicle == vehicle;
-}
-
-static void
-save_vehicle_xml(struct vehicle *v)
-{
- struct attr attr;
- struct attr_iter *iter=vehicle_attr_iter_new();
- int childs=0;
- printf("<vehicle");
- while (vehicle_get_attr(v, attr_any_xml, &attr, iter)) {
- if (ATTR_IS_OBJECT(attr.type))
- childs=1;
- else {
- char *attrtxt;
- printf(" %s=\"%s\"",attr_to_name(attr.type),attrtxt=attr_to_text(&attr, NULL, 1));
- g_free(attrtxt);
- }
- }
- if (childs) {
- printf(">\n");
- printf("</vehicle>\n");
- } else
- printf(" />\n");
- vehicle_attr_iter_destroy(iter);
-}
-
-
-/**
- * Reacts to a button press that changes a vehicle's active profile.
- *
- * @see gui_internal_add_vehicle_profile
- */
-static void
-gui_internal_cmd_set_active_profile(struct gui_priv *this, struct
- widget *wm, void *data)
-{
- struct vehicle_and_profilename *vapn = data;
- struct vehicle *v = vapn->vehicle;
- char *profilename = vapn->profilename;
- struct attr vehicle_name_attr;
- char *vehicle_name = NULL;
- struct attr profilename_attr;
- struct attr vehicle;
-
- // Get the vehicle name
- vehicle_get_attr(v, attr_name, &vehicle_name_attr, NULL);
- vehicle_name = vehicle_name_attr.u.str;
-
- dbg(lvl_debug, "Changing vehicle %s to profile %s\n", vehicle_name,
- profilename);
-
- // Change the profile name
- profilename_attr.type = attr_profilename;
- profilename_attr.u.str = profilename;
- if(!vehicle_set_attr(v, &profilename_attr)) {
- dbg(lvl_error, "Unable to set the vehicle's profile name\n");
- }
-
- navit_set_vehicleprofile_name(this->nav,profilename);
-
- save_vehicle_xml(v);
-
- // Notify Navit that the routing should be re-done if this is the
- // active vehicle.
- if (gui_internal_is_active_vehicle(this, v)) {
- vehicle.u.vehicle=v;
- }
- else {
-
- vehicle.u.vehicle=NULL;
- }
-
- vehicle.type=attr_vehicle;
- navit_set_attr(this->nav, &vehicle);
-
-
- gui_internal_prune_menu_count(this, 1, 0);
- gui_internal_menu_vehicle_settings(this, v, vehicle_name);
-}
-
-/**
- * Adds the vehicle profile to the GUI, allowing the user to pick a
- * profile for the currently selected vehicle.
- */
-static void
-gui_internal_add_vehicle_profile(struct gui_priv *this, struct widget
- *parent, struct vehicle *v, struct vehicleprofile *profile)
-{
- // Just here to show up in the translation file, nice and close to
- // where the translations are actually used.
- struct attr profile_attr;
- struct attr *attr = NULL;
- char *name = NULL;
- char *active_profile = NULL;
- char *label = NULL;
- int active;
- struct vehicle_and_profilename *context = NULL;
-
-#ifdef ONLY_FOR_TRANSLATION
- char *translations[] = {_n("car"), _n("bike"), _n("pedestrian")};
-#endif
-
- // Figure out the profile name
- attr = attr_search(profile->attrs, NULL, attr_name);
- if (!attr) {
- dbg(lvl_error, "Adding vehicle profile failed. attr==NULL");
- return;
- }
- name = attr->u.str;
-
- // Determine whether the profile is the active one
- if (vehicle_get_attr(v, attr_profilename, &profile_attr, NULL))
- active_profile = profile_attr.u.str;
- active = active_profile != NULL && !strcmp(name, active_profile);
-
- dbg(lvl_debug, "Adding vehicle profile %s, active=%s/%i\n", name,
- active_profile, active);
-
- // Build a translatable label.
- if(active) {
- label = g_strdup_printf(_("Current profile: %s"), _(name));
- } else {
- label = g_strdup_printf(_("Change profile to: %s"), _(name));
- }
-
- // Create the context object (the vehicle and the desired profile)
- context = g_new0(struct vehicle_and_profilename, 1);
- context->vehicle = v;
- context->profilename = name;
-
- // Add the button
- gui_internal_widget_append(parent,
- gui_internal_button_new_with_callback(
- this, label,
- image_new_xs(this, active ? "gui_active" : "gui_inactive"),
- gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_set_active_profile, context));
-
- free(label);
-}
-
-void
-gui_internal_menu_vehicle_settings(struct gui_priv *this, struct vehicle *v, char *name)
-{
- struct widget *w,*wb,*row;
- struct attr attr;
- struct vehicleprofile *profile = NULL;
- GList *profiles;
-
- wb=gui_internal_menu(this, name);
- w=gui_internal_widget_table_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill,1);
- gui_internal_widget_append(wb, w);
-
- // Add the "Set as active" button if this isn't the active
- // vehicle.
- if (!gui_internal_is_active_vehicle(this, v)) {
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- gui_internal_button_new_with_callback(this, _("Set as active"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_set_active_vehicle, v));
- }
-
- if (vehicle_get_attr(v, attr_position_sat_item, &attr, NULL)) {
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- gui_internal_button_new_with_callback(this, _("Show Satellite status"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_show_satellite_status, v));
- }
- if (vehicle_get_attr(v, attr_position_nmea, &attr, NULL)) {
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row,
- gui_internal_button_new_with_callback(this, _("Show NMEA data"),
- image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_show_nmea_data, v));
- }
-
- // Add all the possible vehicle profiles to the menu
- profiles = navit_get_vehicleprofiles(this->nav);
- while(profiles) {
- profile = (struct vehicleprofile *)profiles->data;
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_add_vehicle_profile(this, row, v, profile);
- profiles = g_list_next(profiles);
- }
-
- callback_list_call_attr_2(this->cbl, attr_vehicle, w, v);
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_cmd_vehicle_settings(struct gui_priv *this, struct widget *wm, void *data)
-{
- gui_internal_menu_vehicle_settings(this, wm->data, wm->text);
-}
-
-
-
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_motion(void *data, struct point *p)
-{
-
- struct gui_priv *this=data;
- if (!this->root.children) {
- navit_handle_motion(this->nav, p);
- return;
- }
- if (!this->pressed)
- return;
- this->current=*p;
- if(!this->motion_timeout_callback)
- this->motion_timeout_callback=callback_new_1(callback_cast(gui_internal_motion_cb), this);
- if(!this->motion_timeout_event)
- this->motion_timeout_event=event_add_timeout(30,0, this->motion_timeout_callback);
-}
-
-void
-gui_internal_evaluate(struct gui_priv *this, const char *command)
-{
- if (command)
- command_evaluate(&this->self, command);
-}
-
-
-void
-gui_internal_enter(struct gui_priv *this, int ignore)
-{
- struct graphics *gra=this->gra;
- if (ignore != -1)
- this->ignore_button=ignore;
-
- navit_block(this->nav, 1);
- graphics_overlay_disable(gra, 1);
- this->root.p.x=0;
- this->root.p.y=0;
- this->root.background=this->background;
-}
-
-void
-gui_internal_leave(struct gui_priv *this)
-{
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-
-void
-gui_internal_set_click_coord(struct gui_priv *this, struct point *p)
-{
- struct coord c;
- struct coord_geo g;
- struct attr attr;
- struct transformation *trans;
- attr_free(this->click_coord_geo);
- this->click_coord_geo=NULL;
- if (p) {
- trans=navit_get_trans(this->nav);
- transform_reverse(trans, p, &c);
- dbg(lvl_debug,"x=0x%x y=0x%x\n", c.x, c.y);
- this->clickp.pro=transform_get_projection(trans);
- this->clickp.x=c.x;
- this->clickp.y=c.y;
- transform_to_geo(this->clickp.pro, &c, &g);
- attr.u.coord_geo=&g;
- attr.type=attr_click_coord_geo;
- this->click_coord_geo=attr_dup(&attr);
- }
-}
-
-static void
-gui_internal_set_position_coord(struct gui_priv *this)
-{
- struct transformation *trans;
- struct attr attr,attrp;
- struct coord c;
-
- attr_free(this->position_coord_geo);
- this->position_coord_geo=NULL;
- if (navit_get_attr(this->nav, attr_vehicle, &attr, NULL) && attr.u.vehicle
- && vehicle_get_attr(attr.u.vehicle, attr_position_coord_geo, &attrp, NULL)) {
- trans=navit_get_trans(this->nav);
- this->position_coord_geo=attr_dup(&attrp);
- this->vehiclep.pro=transform_get_projection(trans);
- transform_from_geo(this->vehiclep.pro, attrp.u.coord_geo, &c);
- this->vehiclep.x=c.x;
- this->vehiclep.y=c.y;
- }
-}
-
-void
-gui_internal_enter_setup(struct gui_priv *this)
-{
- if (!this->mouse_button_clicked_on_map)
- gui_internal_set_position_coord(this);
-}
-
-void
-gui_internal_cmd_menu(struct gui_priv *this, int ignore, char *href)
-{
- dbg(lvl_debug,"enter\n");
- gui_internal_enter(this, ignore);
- gui_internal_enter_setup(this);
- // draw menu
- if (href)
- gui_internal_html_load_href(this, href, 0);
- else
- gui_internal_html_main_menu(this);
-}
-
-
-
-static void
-gui_internal_cmd_log_do(struct gui_priv *this, struct widget *widget)
-{
- if (widget->text && strlen(widget->text)) {
- if (this->position_coord_geo)
- navit_textfile_debug_log_at(this->nav, &this->vehiclep, "type=log_entry label=\"%s\"",widget->text);
- else
- navit_textfile_debug_log(this->nav, "type=log_entry label=\"%s\"",widget->text);
- }
- g_free(widget->text);
- widget->text=NULL;
- gui_internal_prune_menu(this, NULL);
- gui_internal_check_exit(this);
-}
-
-void
-gui_internal_cmd_log_clicked(struct gui_priv *this, struct widget *widget, void *data)
-{
- gui_internal_cmd_log_do(this, widget->data);
-}
-
-
-void
-gui_internal_check_exit(struct gui_priv *this)
-{
- struct graphics *gra=this->gra;
- if (! this->root.children) {
- gui_internal_search_idle_end(this);
- gui_internal_search_list_destroy(this);
- graphics_overlay_disable(gra, 0);
- if (!navit_block(this->nav, 0)) {
- if (this->redraw)
- navit_draw(this->nav);
- else
- navit_draw_displaylist(this->nav);
- }
- }
-}
-
-static int
-gui_internal_get_attr(struct gui_priv *this, enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_active:
- attr->u.num=this->root.children != NULL;
- break;
- case attr_click_coord_geo:
- if (!this->click_coord_geo)
- return 0;
- *attr=*this->click_coord_geo;
- break;
- case attr_position_coord_geo:
- if (!this->position_coord_geo)
- return 0;
- *attr=*this->position_coord_geo;
- break;
- case attr_pitch:
- attr->u.num=this->pitch;
- break;
- case attr_button:
- attr->u.num=this->mouse_button_clicked_on_map;
- break;
- case attr_navit:
- attr->u.navit=this->nav;
- break;
- case attr_fullscreen:
- attr->u.num=(this->fullscreen > 0);
- break;
- default:
- return 0;
- }
- attr->type=type;
- return 1;
-}
-
-static int
-gui_internal_add_attr(struct gui_priv *this, struct attr *attr)
-{
- switch (attr->type) {
- case attr_xml_text:
- g_free(this->html_text);
- this->html_text=g_strdup(attr->u.str);
- return 1;
- default:
- return 0;
- }
-}
-
-static int
-gui_internal_set_attr(struct gui_priv *this, struct attr *attr)
-{
- switch (attr->type) {
- case attr_fullscreen:
- if ((this->fullscreen > 0) != (attr->u.num > 0)) {
- graphics_draw_mode(this->gra, draw_mode_end);
- this->win->fullscreen(this->win, attr->u.num > 0);
- graphics_draw_mode(this->gra, draw_mode_begin);
- }
- this->fullscreen=attr->u.num;
- return 1;
- case attr_menu_on_map_click:
- this->menu_on_map_click=attr->u.num;
- return 1;
- case attr_on_map_click:
- g_free(this->on_map_click);
- this->on_map_click=g_strdup(attr->u.str);
- return 1;
- default:
- dbg(lvl_error,"Unknown attribute: %s\n",attr_to_name(attr->type));
- return 1;
- }
-}
-
-static void gui_internal_dbus_signal(struct gui_priv *this, struct point *p)
-{
- struct displaylist_handle *dlh;
- struct displaylist *display;
- struct displayitem *di;
- struct attr cb,**attr_list=NULL;
- int valid=0;
-
- display=navit_get_displaylist(this->nav);
- dlh=graphics_displaylist_open(display);
- while ((di=graphics_displaylist_next(dlh))) {
- struct item *item=graphics_displayitem_get_item(di);
- if (item_is_point(*item) && graphics_displayitem_get_displayed(di) &&
- graphics_displayitem_within_dist(display, di, p, this->radius)) {
- struct map_rect *mr=map_rect_new(item->map, NULL);
- struct item *itemo=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- struct attr attr;
- if (itemo && item_attr_get(itemo, attr_data, &attr))
- attr_list=attr_generic_add_attr(attr_list, &attr);
- map_rect_destroy(mr);
- }
- }
- graphics_displaylist_close(dlh);
- if (attr_list && navit_get_attr(this->nav, attr_callback_list, &cb, NULL))
- callback_list_call_attr_4(cb.u.callback_list, attr_command, "dbus_send_signal", attr_list, NULL, &valid);
- attr_list_free(attr_list);
-}
-
-/**
- * @brief Converts one geo coordinate in human readable form to double value.
- *
- * @author Martin Bruns (05/2012), mdankov
- */
-static int
-gui_internal_coordinate_parse(char *s, char plus, char minus, double *x)
-{
- int sign=0;
- char *degree, *minute, *second;
- double tmp;
-
- if(!s)
- return 0;
-
- if (strchr(s, minus)!=NULL)
- sign=-1;
- else if (strchr(s, plus)!=NULL)
- sign=1;
-
- if(!sign)
- return 0;
-
-
- /* Can't just use strtok here because ° is multibyte sequence in utf8 */
- degree=s;
- minute=strstr(s,"°");
- if(minute) {
- *minute=0;
- minute+=strlen("°");
- }
-
- sscanf(degree, "%lf", x);
-
- if(strchr(degree, plus) || strchr(degree, minus)) {
- dbg(lvl_debug,"degree %c/%c found\n",plus,minus);
- } else {/* DEGREES_MINUTES */
- if(!minute)
- return 0;
- minute = strtok(minute,"'");
- sscanf(minute, "%lf", &tmp);
- *x+=tmp/60;
- if(strchr(minute, plus) || strchr(minute, minus)) {
- dbg(lvl_debug,"minute %c/%c found\n",plus,minus);
- } else { /* DEGREES_MINUTES_SECONDS */
- second=strtok(NULL,"");
- if(!second)
- return 0;
- sscanf(second, "%lf", &tmp);
- *x+=tmp/3600;
- }
- }
- *x *= sign;
- return 1;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Bruns (05/2012)
-//##############################################################################################################
-static void
-gui_internal_cmd_enter_coord_do(struct gui_priv *this, struct widget *widget)
-{
- char *lat, *lng;
- char *widgettext;
- double latitude, longitude;
- dbg(lvl_debug,"text entered:%s\n", widget->text);
-
- /* possible entry can be identical to coord_format output but only space between lat and lng is allowed */
- widgettext=g_ascii_strup(widget->text,-1);
-
- lat=strtok(widgettext," ");
- lng=strtok(NULL,"");
-
- if(!lat || !lng){
- g_free(widgettext);
- return;
- }
- if( gui_internal_coordinate_parse(lat, 'N', 'S', &latitude) && gui_internal_coordinate_parse(lng, 'E', 'W', &longitude) ) {
- g_free(widgettext);
- widgettext=g_strdup_printf("%lf %lf", longitude, latitude);
- pcoord_parse(widgettext, projection_mg, &widget->c );
- } else if(!pcoord_parse(widget->text, projection_mg, &widget->c )) {
- g_free(widgettext);
- return;
- }
- g_free(widgettext);
-
- gui_internal_cmd_position(this, widget, (void*)8);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Bruns (05/2012)
-//##############################################################################################################
-void
-gui_internal_cmd_enter_coord_clicked(struct gui_priv *this, struct widget *widget, void *data)
-{
- dbg(lvl_debug,"entered\n");
- gui_internal_cmd_enter_coord_do(this, widget->data);
-}
-
-/**
- * @brief Handles mouse clicks and scroll wheel movement
- *
- * @author Martin Schaller (04/2008), Stefan Klumpp (04/2008)
- */
-static void gui_internal_button(void *data, int pressed, int button, struct point *p)
-{
- struct gui_priv *this=data;
- struct graphics *gra=this->gra;
-
- dbg(lvl_debug,"enter %d %d\n", pressed, button);
- // if still on the map (not in the menu, yet):
- dbg(lvl_debug,"children=%p ignore_button=%d\n",this->root.children,this->ignore_button);
- if (!this->root.children || this->ignore_button) {
-
- this->ignore_button=0;
- // check whether the position of the mouse changed during press/release OR if it is the scrollwheel
- if (!navit_handle_button(this->nav, pressed, button, p, NULL)) {
- dbg(lvl_debug,"navit has handled button\n");
- return;
- }
- dbg(lvl_debug,"menu_on_map_click=%d\n",this->menu_on_map_click);
- if (button != 1)
- return;
- if (this->on_map_click || this->menu_on_map_click) {
- this->mouse_button_clicked_on_map=1;
- gui_internal_set_click_coord(this, p);
- gui_internal_set_position_coord(this);
- if (this->on_map_click)
- command_evaluate(&this->self, this->on_map_click);
- else
- gui_internal_cmd_menu(this, 0, NULL);
- this->mouse_button_clicked_on_map=0;
- } else if (this->signal_on_map_click) {
- gui_internal_dbus_signal(this, p);
- return;
- }
- return;
- }
-
-
- /*
- * If already in the menu:
- */
-
- if (pressed) {
- this->pressed=1;
- this->current=*p;
- gui_internal_gesture_ring_clear(this);
- gui_internal_gesture_ring_add(this, p);
- gui_internal_highlight(this);
- } else {
- int dx,dy;
- gui_internal_gesture_ring_add(this, p);
- gui_internal_gesture_get_vector(this, 300, NULL, &dx, &dy);
- this->current.x=-1;
- this->current.y=-1;
- graphics_draw_mode(gra, draw_mode_begin);
- if(!gui_internal_gesture_do(this) && this->pressed!=2 && abs(dx)<this->icon_s && abs(dy)<this->icon_s)
- gui_internal_call_highlighted(this);
- this->pressed=0;
- if (!event_main_loop_has_quit()) {
- gui_internal_highlight(this);
- graphics_draw_mode(gra, draw_mode_end);
- gui_internal_check_exit(this);
- }
- }
-}
-
-static void
-gui_internal_setup(struct gui_priv *this)
-{
- struct color cbh={0x9fff,0x9fff,0x9fff,0xffff};
- struct color cf={0xbfff,0xbfff,0xbfff,0xffff};
- struct graphics *gra=this->gra;
- unsigned char *buffer;
- char *gui_file;
- int size;
-
- if (this->background)
- return;
- this->background=graphics_gc_new(gra);
- this->background2=graphics_gc_new(gra);
- this->highlight_background=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->highlight_background, &cbh);
- this->foreground=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->foreground, &cf);
- this->text_background=graphics_gc_new(gra);
- this->text_foreground=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->background, &this->background_color);
- graphics_gc_set_foreground(this->background2, &this->background2_color);
- graphics_gc_set_foreground(this->text_background, &this->text_background_color);
- graphics_gc_set_foreground(this->text_foreground, &this->text_foreground_color);
- gui_file=g_strjoin(NULL, navit_get_user_data_directory(TRUE), "/gui_internal.txt", NULL);
- if (file_get_contents(gui_file,&buffer,&size)) {
- char *command=g_malloc(size+1);
- strncpy(command,(const char *)buffer,size);
- command[size]=0;
- command_evaluate(&this->self, command);
- g_free(command);
- g_free(buffer);
- }
- g_free(gui_file);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_resize(void *data, int w, int h)
-{
- struct gui_priv *this=data;
- int changed=0;
-
- gui_internal_setup(this);
-
- if (this->root.w != w || this->root.h != h) {
- this->root.w=w;
- this->root.h=h;
- changed=1;
- }
- /*
- * If we're drawing behind system bars on Android, watching for actual size changes will not catch
- * fullscreen toggle events. As a workaround, always assume a size change if padding is supplied.
- */
- if (!changed && this->gra && graphics_get_data(this->gra, "padding"))
- changed = 1;
- dbg(lvl_debug,"w=%d h=%d children=%p\n", w, h, this->root.children);
- navit_handle_resize(this->nav, w, h);
- if (this->root.children) {
- if (changed) {
- gui_internal_html_main_menu(this);
- } else {
- gui_internal_menu_render(this);
- }
- }
-}
-
-static void
-gui_internal_keynav_point(struct widget *w, int dx, int dy, struct point *p)
-{
- p->x=w->p.x+w->w/2;
- p->y=w->p.y+w->h/2;
- if (dx < 0)
- p->x=w->p.x;
- if (dx > 0)
- p->x=w->p.x+w->w;
- if (dy < 0)
- p->y=w->p.y;
- if (dy > 0)
- p->y=w->p.y+w->h;
-}
-
-static struct widget*
-gui_internal_keynav_find_next_sensitive_child(struct widget *wi) {
- GList *l=wi->children;
- if (wi->state & STATE_OFFSCREEN)
- return NULL;
- if (wi->state & STATE_SENSITIVE)
- return wi;
- while (l) {
- struct widget* tmp = gui_internal_keynav_find_next_sensitive_child(l->data);
- if (tmp)
- return tmp;
- l=g_list_next(l);
- }
- return NULL;
-}
-
-static int
-gui_internal_keynav_find_next(struct widget *wi, struct widget *current_highlight, struct widget **result) {
- GList *l=wi->children;
- if (wi == current_highlight)
- return 1;
- while (l) {
- struct widget *child=l->data;
- l=g_list_next(l);
- if (gui_internal_keynav_find_next(child, current_highlight, result)) {
- while (l) {
- struct widget *new = gui_internal_keynav_find_next_sensitive_child(l->data);
- if (new) {
- *result = new;
- /* Found one! */
- return 0;
- }
- l=g_list_next(l);
- }
- /* Try parent */
- return 1;
- }
- }
- return 0;
-}
-
-#define RESULT_FOUND 1
-#define NO_RESULT_YET 0
-
-static int
-gui_internal_keynav_find_prev(struct widget *wi, struct widget *current_highlight, struct widget **result) {
- if (wi == current_highlight && *result) {
- // Reached current widget; last widget found is the result.
- return RESULT_FOUND;
- }
- // If widget is off-screen, do not recurse into it.
- if (wi->state & STATE_OFFSCREEN)
- return NO_RESULT_YET;
- if (wi->state & STATE_SENSITIVE)
- *result= wi;
- GList *l=wi->children;
- while (l) {
- struct widget *child=l->data;
- if (gui_internal_keynav_find_prev(child, current_highlight, result) == RESULT_FOUND) {
- return RESULT_FOUND;
- }
- l=g_list_next(l);
- }
- // If no sensitive widget is found before "current_highlight", return the last sensitive widget when
- // recursion terminates.
- 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)
-{
- GList *l=wi->children;
- // Skip hidden elements
- if (wi->p.x==0 && wi->p.y==0 && wi->w==0 && wi->h==0)
- return;
- if ((wi->state & STATE_SENSITIVE) ) {
- int dist1,dist2;
- struct point wp;
- gui_internal_keynav_point(wi, -dx, -dy, &wp);
- if (dx) {
- dist1=(wp.x-p->x)*dx;
- dist2=wp.y-p->y;
- } else if (dy) {
- dist1=(wp.y-p->y)*dy;
- dist2=wp.x-p->x;
- } else {
- dist2=wp.x-p->x;
- dist1=wp.y-p->y;
- if (dist1 < 0)
- dist1=-dist1;
- }
- dbg(lvl_debug,"checking %d,%d %d %d against %d,%d-%d,%d result %d,%d\n", p->x, p->y, dx, dy, wi->p.x, wi->p.y, wi->p.x+wi->w, wi->p.y+wi->h, dist1, dist2);
- if (dist1 >= 0) {
- if (dist2 < 0)
- dist1-=dist2;
- else
- dist1+=dist2;
- if (dist1 < *distance) {
- *result=wi;
- *distance=dist1;
- }
- }
- }
- while (l) {
- struct widget *child=l->data;
- gui_internal_keynav_find_closest(child, p, dx, dy, distance, result);
- l=g_list_next(l);
- }
-}
-
-/**
- * @brief Move keyboard focus to the next widget.
- *
- * Move keyboard focus to the appropriate next widget, depending on the direction of focus
- * movement.
- *
- * @param this GUI context
- * @param this dx horizontal movement (-1=left, +1=right), unless rotary==1
- * @param this dy vertical movement (+1=up, -1=down)
- * @param rotary (0/1) input from rotary encoder - dx indicates forwards/backwards movement
- * through all widgets
- */
-static void
-gui_internal_keynav_highlight_next(struct gui_priv *this, int dx, int dy, int rotary)
-{
- struct widget *result,*menu=g_list_last(this->root.children)->data;
- struct widget *current_highlight = NULL;
- struct point p;
- int distance;
- if (this->highlighted && this->highlighted_menu == menu) {
- gui_internal_keynav_point(this->highlighted, dx, dy, &p);
- current_highlight = this->highlighted;
- }
- else {
- p.x=0;
- p.y=0;
- distance=INT_MAX;
- result=NULL;
- gui_internal_keynav_find_closest(menu, &p, 0, 0, &distance, &result);
- if (result) {
- gui_internal_keynav_point(result, dx, dy, &p);
- dbg(lvl_debug,"result origin=%p p=%d,%d\n", result, p.x, p.y);
- current_highlight = result;
- }
- }
- result=NULL;
- distance=INT_MAX;
- if (rotary && dx > 0)
- gui_internal_keynav_find_next(menu, current_highlight, &result);
- else if (rotary && dx < 0)
- gui_internal_keynav_find_prev(menu, current_highlight, &result);
- else
- gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
- dbg(lvl_debug,"result=%p\n", result);
- if (! result) {
- if (dx < 0) {
- p.x=this->root.w;
- if (rotary) p.y = this->root.h;
- }
- if (dx > 0) {
- p.x=0;
- if (rotary) p.y = 0;
- }
- if (dy < 0)
- p.y=this->root.h;
- if (dy > 0)
- p.y=0;
- result=NULL;
- distance=INT_MAX;
- gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
- dbg(lvl_debug,"wraparound result=%p\n", result);
- }
- gui_internal_highlight_do(this, result);
- if (result)
- gui_internal_say(this, result, 1);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_keypress(void *data, char *key)
-{
- struct gui_priv *this=data;
- int w,h;
- struct point p;
- if (!this->root.children) {
- transform_get_size(navit_get_trans(this->nav), &w, &h);
- switch (*key) {
- case NAVIT_KEY_UP:
- p.x=w/2;
- p.y=0;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case NAVIT_KEY_DOWN:
- p.x=w/2;
- p.y=h;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case NAVIT_KEY_LEFT:
- p.x=0;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case NAVIT_KEY_RIGHT:
- p.x=w;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p, 1);
- break;
- case NAVIT_KEY_ZOOM_IN:
- navit_zoom_in(this->nav, 2, NULL);
- break;
- case NAVIT_KEY_ZOOM_OUT:
- navit_zoom_out(this->nav, 2, NULL);
- break;
- case NAVIT_KEY_RETURN:
- case NAVIT_KEY_MENU:
- gui_internal_set_click_coord(this, NULL);
- gui_internal_cmd_menu(this, 0, NULL);
- break;
- }
- return;
- }
- graphics_draw_mode(this->gra, draw_mode_begin);
- switch (*key) {
- case NAVIT_KEY_PAGE_DOWN:
- gui_internal_keynav_highlight_next(this,1,0,1);
- break;
- case NAVIT_KEY_PAGE_UP:
- gui_internal_keynav_highlight_next(this,-1,0,1);
- break;
- case NAVIT_KEY_LEFT:
- gui_internal_keynav_highlight_next(this,-1,0,0);
- break;
- case NAVIT_KEY_RIGHT:
- gui_internal_keynav_highlight_next(this,1,0,0);
- break;
- case NAVIT_KEY_UP:
- gui_internal_keynav_highlight_next(this,0,-1,0);
- break;
- case NAVIT_KEY_DOWN:
- gui_internal_keynav_highlight_next(this,0,1,0);
- break;
- case NAVIT_KEY_BACK:
- if (g_list_length(this->root.children) > 1)
- gui_internal_back(this, NULL, NULL);
- else
- gui_internal_prune_menu(this, NULL);
- break;
- case NAVIT_KEY_RETURN:
- if (this->highlighted && this->highlighted_menu == g_list_last(this->root.children)->data)
- gui_internal_call_highlighted(this);
- else
- gui_internal_keypress_do(this, key);
- break;
- default:
- gui_internal_keypress_do(this, key);
- }
- if (!event_main_loop_has_quit()) {
- graphics_draw_mode(this->gra, draw_mode_end);
- gui_internal_check_exit(this);
- }
-}
-
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra)
-{
- struct window *win;
- struct transformation *trans=navit_get_trans(this->nav);
-
- win=graphics_get_data(gra, "window");
- if (! win) {
- dbg(lvl_error, "failed to obtain window from graphics plugin, cannot set graphics\n");
- return 1;
- }
- navit_ignore_graphics_events(this->nav, 1);
- this->gra=gra;
- this->win=win;
- navit_ignore_graphics_events(this->nav, 1);
- transform_get_size(trans, &this->root.w, &this->root.h);
- this->resize_cb=callback_new_attr_1(callback_cast(gui_internal_resize), attr_resize, this);
- graphics_add_callback(gra, this->resize_cb);
- this->button_cb=callback_new_attr_1(callback_cast(gui_internal_button), attr_button, this);
- graphics_add_callback(gra, this->button_cb);
- this->motion_cb=callback_new_attr_1(callback_cast(gui_internal_motion), attr_motion, this);
- graphics_add_callback(gra, this->motion_cb);
- this->keypress_cb=callback_new_attr_1(callback_cast(gui_internal_keypress), attr_keypress, this);
- graphics_add_callback(gra, this->keypress_cb);
- this->window_closed_cb=callback_new_attr_1(callback_cast(gui_internal_window_closed), attr_window_closed, this);
- graphics_add_callback(gra, this->window_closed_cb);
-
- // set fullscreen if needed
- if (this->fullscreen)
- this->win->fullscreen(this->win, this->fullscreen != 0);
- /* Was resize callback already issued? */
- if (navit_get_ready(this->nav) & 2)
- gui_internal_setup(this);
- return 0;
-}
-
-static void gui_internal_disable_suspend(struct gui_priv *this)
-{
- if (this->win->disable_suspend)
- this->win->disable_suspend(this->win);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct gui_methods gui_internal_methods = {
- NULL,
- NULL,
- gui_internal_set_graphics,
- NULL,
- NULL,
- NULL,
- gui_internal_disable_suspend,
- gui_internal_get_attr,
- gui_internal_add_attr,
- gui_internal_set_attr,
-};
-
-
-static void
-gui_internal_add_callback(struct gui_priv *priv, struct callback *cb)
-{
- callback_list_add(priv->cbl, cb);
-}
-
-static void
-gui_internal_remove_callback(struct gui_priv *priv, struct callback *cb)
-{
- callback_list_remove(priv->cbl, cb);
-}
-
-
-static struct gui_internal_methods gui_internal_methods_ext = {
- gui_internal_add_callback,
- gui_internal_remove_callback,
- gui_internal_menu_render,
- image_new_xs,
- image_new_l,
-};
-
-
-static enum flags
-gui_internal_get_flags(struct widget *widget)
-{
- return widget->flags;
-}
-
-static void
-gui_internal_set_flags(struct widget *widget, enum flags flags)
-{
- widget->flags=flags;
-}
-
-static int
-gui_internal_get_state(struct widget *widget)
-{
- return widget->state;
-}
-
-static void
-gui_internal_set_state(struct widget *widget, int state)
-{
- widget->state=state;
-}
-
-static void
-gui_internal_set_func(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data))
-{
- widget->func=func;
-}
-
-static void
-gui_internal_set_data(struct widget *widget, void *data)
-{
- widget->data=data;
-}
-
-static void
-gui_internal_set_default_background(struct gui_priv *this, struct widget *widget)
-{
- widget->background=this->background;
-}
-
-static struct gui_internal_widget_methods gui_internal_widget_methods = {
- gui_internal_widget_append,
- gui_internal_button_new,
- gui_internal_button_new_with_callback,
- gui_internal_box_new,
- gui_internal_label_new,
- gui_internal_image_new,
- gui_internal_keyboard,
- gui_internal_menu,
- gui_internal_get_flags,
- gui_internal_set_flags,
- gui_internal_get_state,
- gui_internal_set_state,
- gui_internal_set_func,
- gui_internal_set_data,
- gui_internal_set_default_background,
-};
-
-/**
- * @brief finds the intersection point of 2 lines
- *
- * @param coord a1, a2, b1, b2 : coords of the start and
- * end of the first and the second line
- * @param coord res, will become the coords of the intersection if found
- * @return : TRUE if intersection found, otherwise FALSE
- */
-int
-line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct coord *b2, struct coord *res)
-{
- int n, a, b;
- int adx=a2->x-a1->x;
- int ady=a2->y-a1->y;
- int bdx=b2->x-b1->x;
- int bdy=b2->y-b1->y;
- n = bdy * adx - bdx * ady;
- a = bdx * (a1->y - b1->y) - bdy * (a1->x - b1->x);
- b = adx * (a1->y - b1->y) - ady * (a1->x - b1->x);
- if (n < 0) {
- n = -n;
- a = -a;
- b = -b;
- }
- if (a < 0 || b < 0)
- return FALSE;
- if (a > n || b > n)
- return FALSE;
- if (n == 0) {
- dbg(lvl_info,"a=%d b=%d n=%d\n", a, b, n);
- dbg(lvl_info,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady);
- dbg(lvl_info,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy);
- dbg(lvl_info,"No intersection found, lines assumed parallel ?\n");
- return FALSE;
- }
- res->x = a1->x + a * adx / n;
- res->y = a1->y + a * ady / n;
- return TRUE;
-}
-
-struct heightline *
-item_get_heightline(struct item *item)
-{
- struct heightline *ret=NULL;
- struct street_data *sd;
- struct attr attr;
- int i,height;
-
- if (item_attr_get(item, attr_label, &attr)) {
- height=atoi(attr.u.str);
- sd=street_get_data(item);
- if (sd && sd->count > 1) {
- ret=g_malloc(sizeof(struct heightline)+sd->count*sizeof(struct coord));
- ret->bbox.lu=sd->c[0];
- ret->bbox.rl=sd->c[0];
- ret->count=sd->count;
- ret->height=height;
- for (i = 0 ; i < sd->count ; i++) {
- ret->c[i]=sd->c[i];
- coord_rect_extend(&ret->bbox, sd->c+i);
- }
- }
- street_data_free(sd);
- }
- return ret;
-}
-
-/**
- * @brief Called when the route is updated.
- */
-void
-gui_internal_route_update(struct gui_priv * this, struct navit * navit, struct vehicle *v)
-{
-
- if(this->route_data.route_showing) {
- gui_internal_populate_route_table(this,navit);
- graphics_draw_mode(this->gra, draw_mode_begin);
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
- }
-
-
-}
-
-
-/**
- * @brief Called when the route screen is closed (deallocated).
- *
- * The main purpose of this function is to remove the widgets from
- * references route_data because those widgets are about to be freed.
- */
-void
-gui_internal_route_screen_free(struct gui_priv * this_,struct widget * w)
-{
- if(this_) {
- this_->route_data.route_showing=0;
- this_->route_data.route_table=NULL;
- g_free(w);
- }
-
-}
-
-/**
- * @brief Populates the route table with route information
- *
- * @param this The gui context
- * @param navit The navit object
- */
-void
-gui_internal_populate_route_table(struct gui_priv * this, struct navit * navit)
-{
- struct map * map=NULL;
- struct map_rect * mr=NULL;
- struct navigation * nav = NULL;
- struct item * item =NULL;
- struct attr attr,route;
- struct widget * label = NULL;
- struct widget * row = NULL;
- struct coord c;
- nav = navit_get_navigation(navit);
- if(!nav) {
- return;
- }
- map = navigation_get_map(nav);
- if(map)
- mr = map_rect_new(map,NULL);
- if(mr) {
- GList *toprow;
- struct item topitem={0};
- toprow=gui_internal_widget_table_top_row(this, this->route_data.route_table);
- if(toprow && toprow->data)
- topitem=((struct widget*)toprow->data)->item;
- gui_internal_widget_table_clear(this,this->route_data.route_table);
- if (navit_get_attr(navit, attr_route, &route, NULL)) {
- struct attr destination_length, destination_time;
- char *length=NULL,*time=NULL,*length_time;
- if (route_get_attr(route.u.route, attr_destination_length, &destination_length, NULL))
- length=attr_to_text_ext(&destination_length, NULL, attr_format_with_units, attr_format_default, NULL);
- if (route_get_attr(route.u.route, attr_destination_time, &destination_time, NULL))
- time=attr_to_text_ext(&destination_time, NULL, attr_format_with_units, attr_format_default, NULL);
- row = gui_internal_widget_table_row_new(this,
- gravity_left
- | flags_fill
- | orientation_horizontal);
- gui_internal_widget_append(this->route_data.route_table,row);
- length_time=g_strdup_printf("%s %s",length,time);
- label = gui_internal_label_new(this,length_time);
- g_free(length_time);
- g_free(length);
- g_free(time);
- gui_internal_widget_append(row,label);
- }
- while((item = map_rect_get_item(mr))) {
- if(item_attr_get(item,attr_navigation_long,&attr)) {
- row = gui_internal_widget_table_row_new(this,
- gravity_left
- | flags_fill
- | orientation_horizontal);
- gui_internal_widget_append(this->route_data.route_table,row);
-
- label = gui_internal_label_new(this,map_convert_string_tmp(item->map,attr.u.str));
- gui_internal_widget_append(row,label);
-
- label->item=*item;
- row->item=*item;
- item_coord_get(item, &c, 1);
- label->c.x=c.x;
- label->c.y=c.y;
- label->c.pro=map_projection(map);
- label->func=gui_internal_cmd_position;
- label->state|=STATE_SENSITIVE;
- label->data=(void*)2;
- if(toprow && item->id_hi==topitem.id_hi && item->id_lo==topitem.id_lo && item->map==topitem.map)
- gui_internal_widget_table_set_top_row(this, this->route_data.route_table, row);
- }
-
- }
- map_rect_destroy(mr);
- }
-}
-
-/*
- * Command interface wrapper for commands which can be used both from gui html and to enter internal gui (for example, from osd or dbus).
- * Set first command argument to integer 1, if this command was called by mouse click from oustside of gui (default). Set it to 0
- * if command is called by some other means (dbus signal, for example). If first argument is non integer, it's passed on
- * to actual handler.
- *
- */
-
-
-//##############################################################################################################
-//# Description:
-//# 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)
-{
- struct color color_white={0xffff,0xffff,0xffff,0xffff};
- struct color color_black={0x0,0x0,0x0,0xffff};
- struct color back2_color={0x4141,0x4141,0x4141,0xffff};
-
- struct gui_priv *this;
- struct attr *attr;
- *meth=gui_internal_methods;
- this=g_new0(struct gui_priv, 1);
- this->nav=nav;
-
- this->self.type=attr_gui;
- this->self.u.gui=gui;
-
- if ((attr=attr_search(attrs, NULL, attr_menu_on_map_click)))
- this->menu_on_map_click=attr->u.num;
- else
- this->menu_on_map_click=1;
-
- if ((attr=attr_search(attrs, NULL, attr_on_map_click)))
- this->on_map_click=g_strdup(attr->u.str);
-
- if ((attr=attr_search(attrs, NULL, attr_signal_on_map_click)))
- this->signal_on_map_click=attr->u.num;
- gui_internal_command_init(this, attrs);
-
- if( (attr=attr_search(attrs,NULL,attr_font_size)))
- {
- this->config.font_size=attr->u.num;
- }
- else
- {
- this->config.font_size=-1;
- }
- if( (attr=attr_search(attrs,NULL,attr_icon_xs)))
- {
- this->config.icon_xs=attr->u.num;
- }
- else
- {
- this->config.icon_xs=-1;
- }
- if( (attr=attr_search(attrs,NULL,attr_icon_l)))
- {
- this->config.icon_l=attr->u.num;
- }
- else
- {
- this->config.icon_l=-1;
- }
- if( (attr=attr_search(attrs,NULL,attr_icon_s)))
- {
- this->config.icon_s=attr->u.num;
- }
- else
- {
- this->config.icon_s=-1;
- }
- if( (attr=attr_search(attrs,NULL,attr_spacing)))
- {
- this->config.spacing=attr->u.num;
- }
- else
- {
- this->config.spacing=-1;
- }
- if( (attr=attr_search(attrs,NULL,attr_gui_speech)))
- {
- this->speech=attr->u.num;
- }
- if( (attr=attr_search(attrs,NULL,attr_keyboard)))
- this->keyboard=attr->u.num;
- else
- this->keyboard=1;
-
- if( (attr=attr_search(attrs,NULL,attr_fullscreen)))
- this->fullscreen=attr->u.num;
-
- if( (attr=attr_search(attrs,NULL,attr_flags)))
- this->flags=attr->u.num;
- if( (attr=attr_search(attrs,NULL,attr_background_color)))
- this->background_color=*attr->u.color;
- else
- this->background_color=color_black;
- if( (attr=attr_search(attrs,NULL,attr_background_color2)))
- this->background2_color=*attr->u.color;
- else
- this->background2_color=back2_color;
- if( (attr=attr_search(attrs,NULL,attr_text_color)))
- this->text_foreground_color=*attr->u.color;
- else
- this->text_foreground_color=color_white;
- if( (attr=attr_search(attrs,NULL,attr_text_background)))
- this->text_background_color=*attr->u.color;
- else
- this->text_background_color=color_black;
- if( (attr=attr_search(attrs,NULL,attr_columns)))
- this->cols=attr->u.num;
- if( (attr=attr_search(attrs,NULL,attr_osd_configuration)))
- this->osd_configuration=*attr;
-
- if( (attr=attr_search(attrs,NULL,attr_pitch)))
- this->pitch=attr->u.num;
- else
- this->pitch=20;
- if( (attr=attr_search(attrs,NULL,attr_flags_town)))
- this->flags_town=attr->u.num;
- else
- this->flags_town=-1;
- if( (attr=attr_search(attrs,NULL,attr_flags_street)))
- this->flags_street=attr->u.num;
- else
- this->flags_street=-1;
- if( (attr=attr_search(attrs,NULL,attr_flags_house_number)))
- this->flags_house_number=attr->u.num;
- else
- this->flags_house_number=-1;
- if( (attr=attr_search(attrs,NULL,attr_radius)))
- this->radius=attr->u.num;
- else
- this->radius=10;
- if( (attr=attr_search(attrs,NULL,attr_font)))
- this->font_name=g_strdup(attr->u.str);
-
- if((attr=attr_search(attrs, NULL, attr_hide_impossible_next_keys)))
- this->hide_keys = attr->u.num;
- else
- this->hide_keys = 0;
-
- this->data.priv=this;
- this->data.gui=&gui_internal_methods_ext;
- this->data.widget=&gui_internal_widget_methods;
- this->cbl=callback_list_new();
-
- return this;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void plugin_init(void)
-{
- plugin_register_category_gui("internal", gui_internal_new);
-}
diff --git a/navit/gui/internal/gui_internal.h b/navit/gui/internal/gui_internal.h
deleted file mode 100644
index 1a5cd13d3..000000000
--- a/navit/gui/internal/gui_internal.h
+++ /dev/null
@@ -1,85 +0,0 @@
-struct widget;
-struct graphics_image;
-struct gui_priv;
-
-#define STATE_INVISIBLE 1
-#define STATE_SELECTED 2
-#define STATE_HIGHLIGHTED 4
-#define STATE_SENSITIVE 8
-#define STATE_EDIT 16
-#define STATE_CLEAR 32
-#define STATE_EDITABLE 64
-#define STATE_SCROLLABLE 128
-#define STATE_OFFSCREEN 256
-
-#define GESTURE_RINGSIZE 100
-
-enum widget_type {
- 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,
-};
-
-
-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);
-};
-
-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);
-
-};
-
-struct gui_internal_data {
- struct gui_priv *priv;
- struct gui_internal_methods *gui;
- struct gui_internal_widget_methods *widget;
-};
diff --git a/navit/gui/internal/gui_internal_bookmark.c b/navit/gui/internal/gui_internal_bookmark.c
deleted file mode 100644
index eed0de123..000000000
--- a/navit/gui/internal/gui_internal_bookmark.c
+++ /dev/null
@@ -1,313 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "bookmarks.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_keyboard.h"
-#include "gui_internal_bookmark.h"
-
-static void
-gui_internal_cmd_add_bookmark_do(struct gui_priv *this, struct widget *widget)
-{
- GList *l;
- struct attr attr;
- dbg(lvl_debug,"text='%s'\n", widget->text);
- if (widget->text && strlen(widget->text)){
- navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
- bookmarks_add_bookmark(attr.u.bookmarks, &widget->c, widget->text);
- }
- g_free(widget->text);
- widget->text=NULL;
- l=g_list_previous(g_list_last(this->root.children));
- gui_internal_prune_menu(this, l->data);
-}
-
-static void
-gui_internal_cmd_add_bookmark_folder_do(struct gui_priv *this, struct widget *widget)
-{
- GList *l;
- struct attr attr;
- dbg(lvl_debug,"text='%s'\n", widget->text);
- if (widget->text && strlen(widget->text)){
- navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
- bookmarks_add_bookmark(attr.u.bookmarks, NULL, widget->text);
- }
- g_free(widget->text);
- widget->text=NULL;
- l=g_list_previous(g_list_previous(g_list_last(this->root.children)));
- gui_internal_prune_menu(this, l->data);
-}
-
-static void
-gui_internal_cmd_add_bookmark_clicked(struct gui_priv *this, struct widget *widget, void *data)
-{
- gui_internal_cmd_add_bookmark_do(this, widget->data);
-}
-
-static void
-gui_internal_cmd_add_bookmark_folder_clicked(struct gui_priv *this, struct widget *widget, void *data)
-{
- gui_internal_cmd_add_bookmark_folder_do(this, widget->data);
-}
-
-static void
-gui_internal_cmd_rename_bookmark_clicked(struct gui_priv *this, struct widget *widget,void *data)
-{
- struct widget *w=(struct widget*)widget->data;
- GList *l;
- struct attr attr;
- dbg(lvl_debug,"text='%s'\n", w->text);
- if (w->text && strlen(w->text)){
- navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
- bookmarks_rename_bookmark(attr.u.bookmarks, w->name, w->text);
- }
- g_free(w->text);
- g_free(w->name);
- w->text=NULL;
- w->name=NULL;
- l=g_list_previous(g_list_previous(g_list_previous(g_list_last(this->root.children))));
- gui_internal_prune_menu(this, l->data);
-}
-
-void
-gui_internal_cmd_add_bookmark2(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb,*wk,*wl,*we,*wnext;
- char *name=data;
- wb=gui_internal_menu(this,_("Add Bookmark"));
- w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, we);
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, name));
- wk->state |= STATE_EDIT|STATE_EDITABLE|STATE_CLEAR;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_call_linked_on_finish;
- wk->c=wm->c;
- gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wnext->state |= STATE_SENSITIVE;
- wnext->func = gui_internal_cmd_add_bookmark_clicked;
- wnext->data=wk;
- wk->data=wnext;
- wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wl);
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"))));
- else
- gui_internal_keyboard_show_native(this, w, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")), getenv("LANG"));
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_cmd_add_bookmark_folder2(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb,*wk,*wl,*we,*wnext;
- char *name=data;
- wb=gui_internal_menu(this,_("Add Bookmark folder"));
- w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, we);
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, name));
- wk->state |= STATE_EDIT|STATE_EDITABLE|STATE_CLEAR;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_call_linked_on_finish;
- wk->c=wm->c;
- gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wnext->state |= STATE_SENSITIVE;
- wnext->func = gui_internal_cmd_add_bookmark_folder_clicked;
- wnext->data=wk;
- wk->data=wnext;
- wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wl);
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"))));
- else
- gui_internal_keyboard_show_native(this, w, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")), getenv("LANG"));
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_cmd_rename_bookmark(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w,*wb,*wk,*wl,*we,*wnext;
- char *name=wm->text;
- wb=gui_internal_menu(this,_("Rename"));
- w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, we);
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, name));
- wk->state |= STATE_EDIT|STATE_EDITABLE|STATE_CLEAR;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_call_linked_on_finish;
- wk->c=wm->c;
- wk->name=g_strdup(name);
- gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wnext->state |= STATE_SENSITIVE;
- wnext->func = gui_internal_cmd_rename_bookmark_clicked;
- wnext->data=wk;
- wk->data=wnext;
- wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wl);
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"))));
- else
- gui_internal_keyboard_show_native(this, w, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")), getenv("LANG"));
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_cmd_cut_bookmark(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
- GList *l;
- navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_cut_bookmark(mattr.u.bookmarks,wm->text);
- l=g_list_previous(g_list_previous(g_list_last(this->root.children)));
- gui_internal_prune_menu(this, l->data);
-}
-
-void
-gui_internal_cmd_copy_bookmark(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
- GList *l;
- navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_copy_bookmark(mattr.u.bookmarks,wm->text);
- l=g_list_previous(g_list_previous(g_list_last(this->root.children)));
- gui_internal_prune_menu(this, l->data);
-}
-
-void
-gui_internal_cmd_paste_bookmark(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
- GList *l;
- navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_paste_bookmark(mattr.u.bookmarks);
- l=g_list_previous(g_list_last(this->root.children));
- if(l)
- gui_internal_prune_menu(this, l->data);
-}
-
-void
-gui_internal_cmd_delete_bookmark_folder(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
- GList *l;
- navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_move_up(mattr.u.bookmarks);
- bookmarks_delete_bookmark(mattr.u.bookmarks,wm->prefix);
- l=g_list_first(this->root.children);
- gui_internal_prune_menu(this, l->data);
-}
-
-void
-gui_internal_cmd_load_bookmarks_as_waypoints(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
-
- if(navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL) ) {
- struct attr attr;
- struct item *item;
- struct coord c;
- struct pcoord *pc;
- enum projection pro=bookmarks_get_projection(mattr.u.bookmarks);
- int i, bm_count;
-
- navit_set_destination(this->nav, NULL, NULL, 0);
-
- bm_count=bookmarks_get_bookmark_count(mattr.u.bookmarks);
- pc=g_alloca(bm_count*sizeof(struct pcoord));
- bookmarks_item_rewind(mattr.u.bookmarks);
- i=0;
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
- if (!item_attr_get(item, attr_label, &attr))
- continue;
- if (item->type == type_bookmark) {
- if (item_coord_get(item, &c, 1)) {
- pc[i].x=c.x;
- pc[i].y=c.y;
- pc[i].pro=pro;
- navit_add_destination_description(this->nav,&pc[i],attr.u.str);
- i++;
- }
- }
- }
- bm_count=i;
-
- if (bm_count>0){
- navit_set_destinations(this->nav, pc, bm_count, wm->prefix, 1);
- if (this->flags & 512) {
- struct attr follow;
- follow.type=attr_follow;
- follow.u.num=180;
- navit_set_attr(this->nav, &this->osd_configuration);
- navit_set_attr(this->nav, &follow);
- navit_zoom_to_route(this->nav, 0);
- }
- }
- }
-
- gui_internal_prune_menu(this, NULL);
-}
-
-void
-gui_internal_cmd_replace_bookmarks_from_waypoints(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct attr mattr;
-
- if(navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL) ) {
- struct attr attr;
- char *desc=NULL;
- struct pcoord *pc;
- int i, bm_count;
-
- if (bookmarks_get_bookmark_count(mattr.u.bookmarks)>0){
- struct item *item;
- bookmarks_item_rewind(mattr.u.bookmarks);
-
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
-
- if (!item_attr_get(item, attr_label, &attr))
- continue;
-
- if (item->type == type_bookmark)
- bookmarks_delete_bookmark(mattr.u.bookmarks, attr.u.str);
-
- bookmarks_move_down(mattr.u.bookmarks,wm->prefix);
- }
- }
- bookmarks_item_rewind(mattr.u.bookmarks);
-
- bm_count=navit_get_destination_count(this->nav);
- pc=g_alloca(bm_count*sizeof(struct pcoord));
- navit_get_destinations(this->nav, pc, bm_count);
-
- for (i=0; i<bm_count; i++){
- char *tmp=navit_get_destination_description(this->nav, i);
- desc=g_strdup_printf("%s WP%d", tmp, i+1);
- g_free(tmp);
- navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
- bookmarks_add_bookmark(attr.u.bookmarks, &pc[i], desc);
- bookmarks_move_down(mattr.u.bookmarks,wm->prefix);
- g_free(desc);
- }
- }
-
- gui_internal_prune_menu(this, NULL);
-}
diff --git a/navit/gui/internal/gui_internal_bookmark.h b/navit/gui/internal/gui_internal_bookmark.h
deleted file mode 100644
index c1d42e7d1..000000000
--- a/navit/gui/internal/gui_internal_bookmark.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* prototypes */
-struct gui_priv;
-struct widget;
-void gui_internal_cmd_add_bookmark2(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_add_bookmark_folder2(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_rename_bookmark(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_cut_bookmark(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_copy_bookmark(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_paste_bookmark(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_delete_bookmark_folder(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_load_bookmarks_as_waypoints(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_cmd_replace_bookmarks_from_waypoints(struct gui_priv *this, struct widget *wm, void *data);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c
deleted file mode 100644
index a91f69f5f..000000000
--- a/navit/gui/internal/gui_internal_command.c
+++ /dev/null
@@ -1,1352 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include <math.h>
-#include "config.h"
-#ifdef HAVE_API_WIN32_BASE
-#include <windows.h>
-#endif
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "command.h"
-#include "attr.h"
-#include "xmlconfig.h"
-#include "event.h"
-#include "config_.h"
-#include "map.h"
-#include "mapset.h"
-#include "transform.h"
-#include "search.h"
-#include "route.h"
-#include "vehicle.h"
-#include "vehicleprofile.h"
-#include "layout.h"
-#include "util.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_keyboard.h"
-#include "gui_internal_search.h"
-#include "gui_internal_poi.h"
-#include "gui_internal_command.h"
-#if HAS_IFADDRS
-#include <ifaddrs.h>
-#include <arpa/inet.h>
-#endif
-
-extern char *version;
-
-/**
- * @brief Converts a WGS84 coordinate pair to its string representation.
- *
- * This function takes a coordinate pair with latitude and longitude in degrees and converts them to a
- * string of the form {@code 45°28'0" N 9°11'26" E}.
- *
- * @param gc A WGS84 coordinate pair
- * @param sep The separator character to insert between latitude and longitude
- *
- * @return The coordinates as a formatted string
- */
-static char *
-coordinates_geo(const struct coord_geo *gc, char sep)
-{
- char latc='N',lngc='E';
- int lat_deg,lat_min,lat_sec;
- int lng_deg,lng_min,lng_sec;
- struct coord_geo g=*gc;
-
- if (g.lat < 0) {
- g.lat=-g.lat;
- latc='S';
- }
- if (g.lng < 0) {
- g.lng=-g.lng;
- lngc='W';
- }
- lat_sec=fmod(g.lat*3600+0.5,60);
- lat_min=fmod(g.lat*60-lat_sec/60.0+0.5,60);
- lat_deg=g.lat-lat_min/60.0-lat_sec/3600.0+0.5;
- lng_sec=fmod(g.lng*3600+0.5,60);
- lng_min=fmod(g.lng*60-lng_sec/60.0+0.5,60);
- lng_deg=g.lng-lng_min/60.0-lng_sec/3600.0+0.5;;
-
- return g_strdup_printf("%d°%d'%d\" %c%c%d°%d'%d\" %c",lat_deg,lat_min,lat_sec,latc,sep,lng_deg,lng_min,lng_sec,lngc);
-}
-
-/**
- * @brief Converts a coordinate pair to its WGS84 string representation.
- *
- * This function takes a coordinate pair, transforms it to WGS84 and converts it to a string of the form
- * {@code 45°28'0" N 9°11'26" E}.
- *
- * @param gc A coordinate pair
- * @param sep The separator character to insert between latitude and longitude
- *
- * @return The coordinates as a formatted string
- */
-char *
-gui_internal_coordinates(struct pcoord *pc, char sep)
-{
- struct coord_geo g;
- struct coord c;
- c.x=pc->x;
- c.y=pc->y;
- transform_to_geo(pc->pro, &c, &g);
- return coordinates_geo(&g, sep);
-
-}
-
-enum escape_mode {
- escape_mode_none=0,
- escape_mode_string=1,
- escape_mode_quote=2,
- escape_mode_html=4,
- escape_mode_html_quote=8,
- escape_mode_html_apos=16,
-};
-
-/* todo &=&amp;, < = &lt; */
-
-static char *
-gui_internal_escape(enum escape_mode mode, char *in)
-{
- int len=mode & escape_mode_string ? 3:1;
- char *dst,*out,*src=in;
- char *quot="&quot;";
- char *apos="&apos;";
- while (*src) {
- if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote)))
- len++;
- if (*src == '"' && mode == escape_mode_html_quote)
- len+=strlen(quot);
- else if (*src == '\'' && mode == escape_mode_html_apos)
- len+=strlen(apos);
- else
- len++;
- src++;
- }
- src=in;
- out=dst=g_malloc(len);
- if (mode & escape_mode_string)
- *dst++='"';
- while (*src) {
- if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote)))
- *dst++='\\';
- if (*src == '"' && mode == escape_mode_html_quote) {
- strcpy(dst,quot);
- src++;
- dst+=strlen(quot);
- } else if (*src == '\'' && mode == escape_mode_html_apos) {
- strcpy(dst,apos);
- src++;
- dst+=strlen(apos);
- } else
- *dst++=*src++;
- }
- if (mode & escape_mode_string)
- *dst++='"';
- *dst++='\0';
- return out;
-}
-
-static void
-gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr escaped;
- if (!in || !in[0]) {
- dbg(lvl_error,"first parameter missing or wrong type\n");
- return;
- }
- if (!out) {
- dbg(lvl_error,"output missing\n");
- return;
- }
- if (ATTR_IS_STRING(in[0]->type)) {
- escaped.type=in[0]->type;
- escaped.u.str=gui_internal_escape(escape_mode_string,in[0]->u.str);
- } else if (ATTR_IS_INT(in[0]->type)) {
- escaped.type=attr_type_string_begin;
- escaped.u.str=g_strdup_printf("%ld",in[0]->u.num);
- } else {
- dbg(lvl_error,"first parameter wrong type\n");
- return;
- }
- dbg(lvl_debug,"in %s result %s\n",in[0]->u.str,escaped.u.str);
- *out=attr_generic_add_attr(*out, attr_dup(&escaped));
- g_free(escaped.u.str);
-}
-
-static void
-gui_internal_cmd2_about(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *menu,*wb,*w;
- char *text;
-
- graphics_draw_mode(this->gra, draw_mode_begin);
- menu=gui_internal_menu(this, _("About Navit"));
- menu->spx=this->spacing*10;
- wb=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand);
- gui_internal_widget_append(menu, wb);
-
- //Icon
- gui_internal_widget_append(wb, w=gui_internal_image_new(this, image_new_xs(this, "navit")));
- w->flags=gravity_top_center|orientation_horizontal|flags_fill;
-
- //app name
- text=g_strdup_printf("%s",PACKAGE_NAME);
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_top_center|orientation_horizontal|flags_expand;
- g_free(text);
-
- //Version
- text=g_strdup_printf("%s",version);
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_top_center|orientation_horizontal|flags_expand;
- g_free(text);
-
- //Site
- text=g_strdup_printf("http://www.navit-project.org/");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_top_center|orientation_horizontal|flags_expand;
- g_free(text);
-
- //Authors
- text=g_strdup_printf("%s:",_("By"));
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- text=g_strdup_printf("Martin Schaller");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- text=g_strdup_printf("Michael Farmbauer");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- text=g_strdup_printf("Alexander Atanasov");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- text=g_strdup_printf("Pierre Grandin");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
-
- //Contributors
- text=g_strdup_printf("%s",_("And all the Navit Team"));
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- text=g_strdup_printf("%s",_("members and contributors."));
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
-
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-
-static void
-gui_internal_cmd2_waypoints(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- gui_internal_select_waypoint(this, _("Waypoints"), NULL, NULL, gui_internal_cmd_position, (void*)2);
-}
-
-static void
-gui_internal_cmd_enter_coord(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *w, *wb, *wk, *wr, *we, *wnext, *row;
- wb=gui_internal_menu(this, _("Enter Coordinates"));
- w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- wr=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wr);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(wr, we);
-
-/*
- w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
-
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, we);*/
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, _("Latitude Longitude")));
- wk->state |= STATE_EDIT|STATE_EDITABLE|STATE_CLEAR;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_call_linked_on_finish;
- gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wnext->state |= STATE_SENSITIVE;
- wnext->func = gui_internal_cmd_enter_coord_clicked;
- wnext->data=wk;
- wk->data=wnext;
- row=gui_internal_text_new(this, _("Enter coordinates, for example:"), gravity_top_center|flags_fill|orientation_vertical);
- gui_internal_widget_append(wr,row);
- row=gui_internal_text_new(this, "52.5219N 19.4127E", gravity_top_center|flags_fill|orientation_vertical);
- gui_internal_widget_append(wr,row);
- row=gui_internal_text_new(this, "52°31.3167N 19°24.7667E", gravity_top_center|flags_fill|orientation_vertical);
- gui_internal_widget_append(wr,row);
- row=gui_internal_text_new(this, "52°31'19N 19°24'46E", gravity_top_center|flags_fill|orientation_vertical);
- gui_internal_widget_append(wr,row);
-
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_DEGREE));
- else
- gui_internal_keyboard_show_native(this, w, VKBD_DEGREE, NULL);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd2_town(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- if (this->sl)
- search_list_select(this->sl, attr_country_all, 0, 0);
- gui_internal_search(this,_("Town"),"Town",1);
-}
-
-static void
-gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr attr,attr2,vattr;
- struct widget *w,*wb,*wl;
- struct attr_iter *iter;
- struct attr active_vehicle;
-
- iter=navit_attr_iter_new();
- if (navit_get_attr(this->nav, attr_vehicle, &attr, iter) && !navit_get_attr(this->nav, attr_vehicle, &attr2, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
- navit_attr_iter_destroy(iter);
- gui_internal_menu_vehicle_settings(this, attr.u.vehicle, vattr.u.str);
- return;
- }
- navit_attr_iter_destroy(iter);
-
- wb=gui_internal_menu(this, _("Vehicle"));
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- w->spy=this->spacing*3;
- gui_internal_widget_append(wb, w);
- if (!navit_get_attr(this->nav, attr_vehicle, &active_vehicle, NULL))
- active_vehicle.u.vehicle=NULL;
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
- wl=gui_internal_button_new_with_callback(this, vattr.u.str,
- image_new_xs(this, attr.u.vehicle == active_vehicle.u.vehicle ? "gui_active" : "gui_inactive"), gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_vehicle_settings, attr.u.vehicle);
- wl->text=g_strdup(vattr.u.str);
- gui_internal_widget_append(w, wl);
- }
- navit_attr_iter_destroy(iter);
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd2_setting_rules(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *wb,*w;
- struct attr on,off;
- wb=gui_internal_menu(this, _("Rules"));
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- w->spy=this->spacing*3;
- gui_internal_widget_append(wb, w);
- on.u.num=1;
- off.u.num=0;
- on.type=off.type=attr_tracking;
- gui_internal_widget_append(w,
- gui_internal_button_navit_attr_new(this, _("Lock on road"), gravity_left_center|orientation_horizontal|flags_fill,
- &on, &off));
- on.u.num=0;
- off.u.num=-1;
- on.type=off.type=attr_orientation;
- gui_internal_widget_append(w,
- gui_internal_button_navit_attr_new(this, _("Northing"), gravity_left_center|orientation_horizontal|flags_fill,
- &on, &off));
- on.u.num=1;
- off.u.num=0;
- on.type=off.type=attr_follow_cursor;
- gui_internal_widget_append(w,
- gui_internal_button_navit_attr_new(this, _("Map follows Vehicle"), gravity_left_center|orientation_horizontal|flags_fill,
- &on, &off));
- on.u.num=1;
- off.u.num=0;
- on.type=off.type=attr_waypoints_flag;
- gui_internal_widget_append(w,
- gui_internal_button_navit_attr_new(this, _("Plan with Waypoints"), gravity_left_center|orientation_horizontal|flags_fill,
- &on, &off));
- gui_internal_menu_render(this);
-}
-
-static void
-gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr attr, on, off, description, type, data, url, active;
- struct widget *w,*wb,*row,*wma;
- char *label;
- struct attr_iter *iter;
-
- wb=gui_internal_menu(this, _("Maps"));
- //w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- //w->spy=this->spacing*3;
- w = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
- gui_internal_widget_append(wb, w);
- iter=navit_attr_iter_new();
- on.type=off.type=attr_active;
- on.u.num=1;
- off.u.num=0;
- while(navit_get_attr(this->nav, attr_map, &attr, iter)) {
- if (map_get_attr(attr.u.map, attr_description, &description, NULL)) {
- label=g_strdup(description.u.str);
- } else {
- if (!map_get_attr(attr.u.map, attr_type, &type, NULL))
- type.u.str="";
- if (!map_get_attr(attr.u.map, attr_data, &data, NULL))
- data.u.str="";
- label=g_strdup_printf("%s:%s", type.u.str, data.u.str);
- }
- if (map_get_attr(attr.u.map, attr_url, &url, NULL)) {
- if (!map_get_attr(attr.u.map, attr_active, &active, NULL))
- active.u.num=1;
- wma=gui_internal_button_new_with_callback(this, label, image_new_xs(this, active.u.num ? "gui_active" : "gui_inactive"),
- gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_map_download, attr.u.map);
- } else {
- wma=gui_internal_button_map_attr_new(this, label, gravity_left_center|orientation_horizontal|flags_fill,
- attr.u.map, &on, &off, 1);
- }
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- gui_internal_widget_append(row, wma);
- g_free(label);
- }
- navit_attr_iter_destroy(iter);
- gui_internal_menu_render(this);
-
-}
-
-static void
-gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr attr;
- struct widget *w,*wb,*wl,*row;
- struct attr_iter *iter;
-
-
- wb=gui_internal_menu(this, _("Layout"));
- w=gui_internal_widget_table_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill,1);
- gui_internal_widget_append(wb, w);
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_layout, &attr, iter)) {
- gui_internal_widget_append(w, row=gui_internal_widget_table_row_new(this,gravity_left|orientation_horizontal|flags_fill));
- wl=gui_internal_button_navit_attr_new(this, attr.u.layout->name, gravity_left_center|orientation_horizontal|flags_fill,
- &attr, NULL);
- gui_internal_widget_append(row, wl);
- }
- navit_attr_iter_destroy(iter);
- gui_internal_menu_render(this);
-}
-
-/*
- * @brief Displays Route Height Profile
- *
- * displays a heightprofile if a route is active and
- * some heightinfo is provided by means of a map
- *
- * the name of the file providing the heightlines must
- * comply with *.heightlines.bin
- *
- */
-static void
-gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget * menu, *box;
- struct map * map=NULL;
- struct map_rect * mr=NULL;
- struct route * route;
- struct item * item =NULL;
- struct mapset *ms;
- struct mapset_handle *msh;
- int x,i,first=1,dist=0;
- int diagram_points_count = 0;
- struct coord c,last,res;
- struct coord_rect rbbox,dbbox;
- struct map_selection sel;
- struct heightline *heightline,*heightlines=NULL;
- struct diagram_point *min,*diagram_point,*diagram_points=NULL;
- struct point p[2];
- sel.next=NULL;
- sel.order=18;
- sel.range.min=type_height_line_1;
- sel.range.max=type_height_line_3;
-
- menu=gui_internal_menu(this,_("Height Profile"));
- box = gui_internal_box_new(this, gravity_left_top| orientation_vertical | flags_fill | flags_expand);
- gui_internal_widget_append(menu, box);
- route = navit_get_route(this->nav);
- if (route)
- map = route_get_map(route);
- if(map)
- mr = map_rect_new(map,NULL);
- if(mr) {
- while((item = map_rect_get_item(mr))) {
- while (item_coord_get(item, &c, 1)) {
- if (first) {
- first=0;
- sel.u.c_rect.lu=c;
- sel.u.c_rect.rl=c;
- } else
- coord_rect_extend(&sel.u.c_rect, &c);
- }
- }
- map_rect_destroy(mr);
- mr = NULL;
- ms=navit_get_mapset(this->nav);
- if (!first && ms) {
- int heightmap_installed = FALSE;
- msh=mapset_open(ms);
- while ((map=mapset_next(msh, 1))) {
- struct attr data_attr;
- if (map_get_attr(map, attr_data, &data_attr, NULL)){
- dbg(lvl_debug,"map name = %s\n",data_attr.u.str);
- if (strstr(data_attr.u.str,".heightlines.bin")){
- dbg(lvl_info,"reading heightlines from map %s\n",data_attr.u.str);
- mr=map_rect_new(map, &sel);
- heightmap_installed = TRUE;
- }
- else {
- dbg(lvl_debug,"ignoring map %s\n",data_attr.u.str);
- }
- }
- if (mr) {
- while((item = map_rect_get_item(mr))) {
- if (item->type >= sel.range.min && item->type <= sel.range.max) {
- heightline=item_get_heightline(item);
- if (heightline) {
- heightline->next=heightlines;
- heightlines=heightline;
- }
- }
- }
- map_rect_destroy(mr);
- mr = NULL;
- }
- }
- mapset_close(msh);
- if (!heightmap_installed){
- char *text;
- struct widget *w;
- text=g_strdup_printf("%s",_("please install a map *.heightlines.bin to provide elevationdata"));
- gui_internal_widget_append(box, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- gui_internal_menu_render(this);
- return;
- }
- }
- }
- map=NULL;
- mr=NULL;
- if (route)
- map = route_get_map(route);
- if(map)
- mr = map_rect_new(map,NULL);
- if(mr && heightlines) {
- while((item = map_rect_get_item(mr))) {
- first=1;
- while (item_coord_get(item, &c, 1)) {
- if (first)
- first=0;
- else {
- heightline=heightlines;
- rbbox.lu=last;
- rbbox.rl=last;
- coord_rect_extend(&rbbox, &c);
- while (heightline) {
- if (coord_rect_overlap(&rbbox, &heightline->bbox)) {
- for (i = 0 ; i < heightline->count - 1; i++) {
- if (heightline->c[i].x != heightline->c[i+1].x || heightline->c[i].y != heightline->c[i+1].y) {
- if (line_intersection(heightline->c+i, heightline->c+i+1, &last, &c, &res)) {
- diagram_point=g_new(struct diagram_point, 1);
- diagram_point->c.x=dist+transform_distance(projection_mg, &last, &res);
- diagram_point->c.y=heightline->height;
- diagram_point->next=diagram_points;
- diagram_points=diagram_point;
- diagram_points_count ++;
- dbg(lvl_debug,"%d %d\n", diagram_point->c.x, diagram_point->c.y);
- }
- }
- }
- }
- heightline=heightline->next;
- }
- dist+=transform_distance(projection_mg, &last, &c);
- }
- last=c;
- }
- }
- }
- while (heightlines){
- heightline=heightlines;
- heightlines=heightlines->next;
- g_free(heightline);
- }
- if(mr)
- map_rect_destroy(mr);
-
- if(diagram_points_count < 2){
- char *text;
- struct widget *w;
- text=g_strdup_printf("%s",_("The route must cross at least 2 heightlines"));
- gui_internal_widget_append(box, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- gui_internal_menu_render(this);
- if(diagram_points)
- g_free(diagram_points);
- return;
- }
-
- gui_internal_menu_render(this);
- first=1;
- diagram_point=diagram_points;
- while (diagram_point) {
- if (first) {
- dbbox.lu=diagram_point->c;
- dbbox.rl=diagram_point->c;
- first=0;
- } else
- coord_rect_extend(&dbbox, &diagram_point->c);
- diagram_point=diagram_point->next;
- }
- dbg(lvl_debug,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y);
- if (dbbox.rl.x > dbbox.lu.x && dbbox.lu.x*100/(dbbox.rl.x-dbbox.lu.x) <= 25)
- dbbox.lu.x=0;
- if (dbbox.lu.y > dbbox.rl.y && dbbox.rl.y*100/(dbbox.lu.y-dbbox.rl.y) <= 25)
- dbbox.rl.y=0;
- dbg(lvl_debug,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h);
- x=dbbox.lu.x;
- first=1;
- if (diagram_points_count > 1 && dbbox.rl.x != dbbox.lu.x && dbbox.lu.y != dbbox.rl.y){
- for (;;) {
- min=NULL;
- diagram_point=diagram_points;
- while (diagram_point) {
- if (diagram_point->c.x >= x && (!min || min->c.x > diagram_point->c.x))
- min=diagram_point;
- diagram_point=diagram_point->next;
- }
- if (! min)
- break;
- p[1].x=(min->c.x-dbbox.lu.x)*(box->w-10)/(dbbox.rl.x-dbbox.lu.x)+box->p.x+5;
- p[1].y=(box->h)-5-(min->c.y-dbbox.rl.y)*(box->h-10)/(dbbox.lu.y-dbbox.rl.y)+box->p.y;
- dbg(lvl_debug,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y);
- graphics_draw_circle(this->gra, this->foreground, &p[1], 2);
- if (first)
- first=0;
- else
- graphics_draw_lines(this->gra, this->foreground, p, 2);
- p[0]=p[1];
- x=min->c.x+1;
- }
- }
- while (diagram_points){
- diagram_point=diagram_points;
- diagram_points=diagram_points->next;
- g_free(diagram_point);
- }
-}
-
-static void
-gui_internal_cmd2_route_description(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
-
-
- struct widget * menu;
- struct widget * box;
-
-
- if(! this->vehicle_cb)
- {
- /**
- * Register the callback on vehicle updates.
- */
- this->vehicle_cb = callback_new_attr_1(callback_cast(gui_internal_route_update),
- attr_position_coord_geo,this);
- navit_add_callback(this->nav,this->vehicle_cb);
- }
-
- this->route_data.route_table = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
-
- menu=gui_internal_menu(this,_("Route Description"));
-
- menu->wfree=gui_internal_route_screen_free;
- this->route_data.route_showing=1;
- this->route_data.route_table->spx = this->spacing;
-
-
- box = gui_internal_box_new(this, gravity_left_top| orientation_vertical | flags_fill | flags_expand);
-
- gui_internal_widget_append(box,this->route_data.route_table);
- box->w=menu->w;
- box->spx = this->spacing;
- this->route_data.route_table->w=box->w;
- gui_internal_widget_append(menu,box);
- gui_internal_populate_route_table(this,this->nav);
- gui_internal_menu_render(this);
-
-}
-
-static void
-gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *w;
- struct poi_param *param;
- struct attr pro;
- struct coord c;
-
- dbg(lvl_debug,"enter\n");
- if (!in || !in[0])
- return;
- if (!ATTR_IS_COORD_GEO(in[0]->type))
- return;
- if (!navit_get_attr(this->nav, attr_projection, &pro, NULL))
- return;
- w=g_new0(struct widget,1);
- param=g_new0(struct poi_param,1);
- if (in[1] && ATTR_IS_STRING(in[1]->type)) {
- gui_internal_poi_param_set_filter(param, in[1]->u.str);
- if (in[2] && ATTR_IS_INT(in[2]->type))
- param->AddressFilterType=in[2]->u.num;
- }
-
- transform_from_geo(pro.u.projection,in[0]->u.coord_geo,&c);
- w->c.x=c.x;
- w->c.y=c.y;
- w->c.pro=pro.u.projection;
- gui_internal_cmd_pois(this, w, param);
- g_free(w);
- gui_internal_poi_param_free(param);
-}
-
-static void
-gui_internal_cmd2_locale(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *menu,*wb,*w;
- char *text;
-
- graphics_draw_mode(this->gra, draw_mode_begin);
- menu=gui_internal_menu(this, _("Show Locale"));
- menu->spx=this->spacing*10;
- wb=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(menu, wb);
- text=g_strdup_printf("LANG=%1$s (1=%3$s 2=%2$s)",getenv("LANG"),"2","1");
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_left_center|orientation_horizontal|flags_fill;
- g_free(text);
-#ifdef HAVE_API_WIN32_BASE
- {
- char country[32],lang[32];
-#ifdef HAVE_API_WIN32_CE
- wchar_t wcountry[32],wlang[32];
-
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, wlang, sizeof(wlang));
- WideCharToMultiByte(CP_ACP,0,wlang,-1,lang,sizeof(lang),NULL,NULL);
-#else
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, lang, sizeof(lang));
-#endif
- text=g_strdup_printf("LOCALE_SABBREVLANGNAME=%s",lang);
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_left_center|orientation_horizontal|flags_fill;
- g_free(text);
-#ifdef HAVE_API_WIN32_CE
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, wcountry, sizeof(wcountry));
- WideCharToMultiByte(CP_ACP,0,wcountry,-1,country,sizeof(country),NULL,NULL);
-#else
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, country, sizeof(country));
-#endif
- text=g_strdup_printf("LOCALE_SABBREVCTRYNAME=%s",country);
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_left_center|orientation_horizontal|flags_fill;
- g_free(text);
- }
-#endif
-
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-
-/**
- * @brief display basic networking information
- *
- * @return nothing
- *
- * This function displays basic networking information, currently
- * only the interface name and the associated IP address(es).
- * Currently only works on non Windows systems.
- *
- */
-static void
-gui_internal_cmd2_network_info(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
-#if HAS_IFADDRS
- struct widget *menu,*wb,*w;
- char *text;
-
- graphics_draw_mode(this->gra, draw_mode_begin);
- menu=gui_internal_menu(this, _("Network info"));
- menu->spx=this->spacing*10;
- wb=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(menu, wb);
-
- struct ifaddrs *addrs, *tmp;
- getifaddrs(&addrs);
- tmp = addrs;
-
- while (tmp)
- {
- if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_INET)
- {
- struct sockaddr_in *pAddr = (struct sockaddr_in *)tmp->ifa_addr;
- if(g_ascii_strncasecmp(tmp->ifa_name,"lo",2 ) ) {
- text=g_strdup_printf("%s: %s", tmp->ifa_name, inet_ntoa(pAddr->sin_addr));
- gui_internal_widget_append(wb, w=gui_internal_label_new(this, text));
- w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
- g_free(text);
- }
- }
- tmp = tmp->ifa_next;
- }
- freeifaddrs(addrs);
-
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
-#else
- dbg(lvl_error, "Cannot show network info: ifaddr.h not found\n");
-#endif
-}
-
-static void
-gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct widget *wb,*w,*wbm,*tbl=NULL;
- struct map *formerdests;
- struct map_rect *mr_formerdests;
- struct item *item;
- struct attr attr;
- char *label_full;
- enum projection projection;
-
- if(!navit_get_attr(this->nav, attr_former_destination_map, &attr, NULL))
- return;
-
- formerdests=attr.u.map;
- if(!formerdests)
- return;
-
- mr_formerdests=map_rect_new(formerdests, NULL);
- if(!mr_formerdests)
- return;
-
- projection = map_projection(formerdests);
-
- gui_internal_prune_menu_count(this, 1, 0);
- wb=gui_internal_menu(this, _("Former Destinations"));
- wb->background=this->background;
-
- w=gui_internal_box_new(this,
- gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- w->spy=this->spacing*2;
- gui_internal_widget_append(wb, w);
- while ((item=map_rect_get_item(mr_formerdests))) {
- struct coord c;
- struct widget *row;
- if (item->type!=type_former_destination) continue;
- if (!item_attr_get(item, attr_label, &attr)) continue;
- if(!tbl) {
- tbl=gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand | orientation_vertical,1);
- gui_internal_widget_append(w,tbl);
- }
- row=gui_internal_widget_table_row_new(this,gravity_left| flags_fill| orientation_vertical);
- gui_internal_widget_prepend(tbl, row);
- label_full=attr.u.str;
- wbm=gui_internal_button_new_with_callback(this, label_full,
- image_new_xs(this, "gui_active"),
- gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_position, NULL);
- gui_internal_widget_append(row,wbm);
- if (item_coord_get(item, &c, 1)) {
- wbm->c.x=c.x;
- wbm->c.y=c.y;
- wbm->c.pro=projection;
- wbm->name=g_strdup(label_full);
- wbm->text=g_strdup(label_full);
- wbm->data=(void*)8; //Mark us as a former destination
- wbm->prefix=g_strdup(label_full);
- }
- }
- if (!tbl){
- wbm=gui_internal_text_new(this, _("- No former destinations available -"),
- gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, wbm);
- }
- gui_internal_menu_render(this);
- map_rect_destroy(mr_formerdests);
-}
-
-static void
-gui_internal_cmd2_bookmarks(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *str=NULL;
- if (in && in[0] && ATTR_IS_STRING(in[0]->type)) {
- str=in[0]->u.str;
- }
-
- gui_internal_cmd_bookmarks(this, NULL, str);
-}
-
-static void
-gui_internal_cmd2_abort_navigation(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- navit_set_destination(this->nav, NULL, NULL, 0);
-}
-
-static void
-gui_internal_cmd2_back(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- graphics_draw_mode(this->gra, draw_mode_begin);
- gui_internal_back(this, NULL, NULL);
- graphics_draw_mode(this->gra, draw_mode_end);
- gui_internal_check_exit(this);
-}
-
-static void
-gui_internal_cmd2_back_to_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- gui_internal_prune_menu(this, NULL);
- gui_internal_check_exit(this);
-}
-
-
-static void
-gui_internal_get_data(struct gui_priv *priv, char *command, struct attr **in, struct attr ***out)
-{
- struct attr private_data = { attr_private_data, {(void *)&priv->data}};
- if (out)
- *out=attr_generic_add_attr(*out, &private_data);
-}
-
-static void
-gui_internal_cmd_log(struct gui_priv *this)
-{
- struct widget *w,*wb,*wk,*wl,*we,*wnext;
- gui_internal_enter(this, 1);
- gui_internal_set_click_coord(this, NULL);
- gui_internal_enter_setup(this);
- wb=gui_internal_menu(this, "Log Message");
- w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(w, we);
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, _("Message")));
- wk->state |= STATE_EDIT|STATE_EDITABLE|STATE_CLEAR;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_call_linked_on_finish;
- gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wnext->state |= STATE_SENSITIVE;
- wnext->func = gui_internal_cmd_log_clicked;
- wnext->data=wk;
- wk->data=wnext;
- wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wl);
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"))));
- else
- gui_internal_keyboard_show_native(this, w, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")), getenv("LANG"));
- gui_internal_menu_render(this);
- gui_internal_leave(this);
-}
-
-static void
-gui_internal_cmd_menu2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *href=NULL;
- int i=0, ignore=0, replace=0;
-
- if (in && in[i] && ATTR_IS_INT(in[i]->type))
- ignore=in[i++]->u.num;
-
- if (in && in[i] && ATTR_IS_STRING(in[i]->type)) {
- href=in[i++]->u.str;
- if (in[i] && ATTR_IS_INT(in[i]->type))
- replace=in[i++]->u.num;
- }
-
- if (this->root.children) {
- if (!href)
- return;
- gui_internal_html_load_href(this, href, replace);
- return;
- }
- gui_internal_cmd_menu(this, ignore, href);
-}
-
-static void
-gui_internal_cmd2_position(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- const char *name=_("Position");
- int flags=-1;
-
- dbg(lvl_debug,"enter\n");
- if (!in || !in[0])
- return;
- if (!ATTR_IS_COORD_GEO(in[0]->type))
- return;
- if (in[1] && ATTR_IS_STRING(in[1]->type)) {
- name=in[1]->u.str;
- if (in[2] && ATTR_IS_INT(in[2]->type))
- flags=in[2]->u.num;
- }
- dbg(lvl_debug,"flags=0x%x\n",flags);
- gui_internal_cmd_position_do(this, NULL, in[0]->u.coord_geo, NULL, name, flags);
-}
-
-static void
-gui_internal_cmd_redraw_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- this->redraw=1;
-}
-
-static void
-gui_internal_cmd2_refresh(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *href=g_strdup(this->href);
- gui_internal_html_load_href(this, href, 1);
- g_free(href);
-}
-
-static void
-gui_internal_cmd2_set(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *pattern,*command=NULL;
- if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type)) {
- dbg(lvl_error,"first parameter missing or wrong type\n");
- return;
- }
- pattern=in[0]->u.str;
- dbg(lvl_debug,"pattern %s\n",pattern);
- if (in[1]) {
- command=gui_internal_cmd_match_expand(pattern, in+1);
- dbg(lvl_debug,"expand %s\n",command);
- gui_internal_set(pattern, command);
- command_evaluate(&this->self, command);
- g_free(command);
- } else {
- gui_internal_set(pattern, NULL);
- }
-
-}
-
-void
-gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- struct attr navit;
- gui_internal_prune_menu(this, NULL);
- navit.type=attr_navit;
- navit.u.navit=this->nav;
- config_remove_attr(config, &navit);
- event_main_loop_quit();
-}
-
-static char *
-gui_internal_append_attr(char *str, enum escape_mode mode, char *pre, struct attr *attr, char *post)
-{
- char *astr=NULL;
- if (ATTR_IS_STRING(attr->type))
- astr=gui_internal_escape(mode, attr->u.str);
- else if (ATTR_IS_COORD_GEO(attr->type)) {
- char *str2=coordinates_geo(attr->u.coord_geo, '\n');
- astr=gui_internal_escape(mode, str2);
- g_free(str2);
- } else if (ATTR_IS_INT(attr->type))
- astr=g_strdup_printf("%ld",attr->u.num);
- else
- astr=g_strdup_printf("Unsupported type %s",attr_to_name(attr->type));
- str=g_strconcat_printf(str,"%s%s%s",pre,astr,post);
- g_free(astr);
- return str;
-}
-
-static void
-gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *str=NULL;
- dbg(lvl_debug,"enter %s %p %p %p\n",function,in,out,valid);
- if (!in)
- return;
- while (*in) {
- str=gui_internal_append_attr(str, escape_mode_none, "", *in, "");
- in++;
- }
- if (str) {
- str=g_strdup_printf("<html>%s</html>\n",str);
-#if 0
- dbg(lvl_debug,"%s\n",str);
-#endif
- gui_internal_html_parse_text(this, str);
- }
- g_free(str);
-}
-
-static void
-gui_internal_onclick(struct attr ***in, char **onclick, char *set)
-{
- struct attr **i=*in;
- char *c,*str=NULL,*args=NULL,*sep="";
-
- if (!*i || !ATTR_IS_STRING((*i)->type) || !(*i)->u.str)
- goto error;
- str=g_strdup((*i)->u.str);
- i++;
- c=str;
- while (*c) {
- if (c[0] == '%' && c[1] == '{') {
- char format[4],*end=strchr(c+2,'}'),*replacement=NULL,*new_str;
- int is_arg;
- if (!end) {
- dbg(lvl_error,"Missing closing brace in format string %s\n",c);
- goto error;
- }
- if (end-c > sizeof(format)) {
- dbg(lvl_error,"Invalid format string %s\n",c);
- goto error;
- }
- strncpy(format, c+2, end-c-2);
- format[end-c-2]='\0';
- is_arg=end[1] == '*';
- c[0]='\0';
- if (!strcmp(format,"d")) {
- replacement=gui_internal_append_attr(NULL, escape_mode_string, "", *i++, "");
- if (is_arg) {
- args=g_strconcat_printf(args, "%s%s", args ? "," : "", replacement);
- g_free(replacement);
- replacement=g_strdup("");
- }
-
- }
- if (!strcmp(format,"se")) {
- replacement=gui_internal_append_attr(NULL, escape_mode_string, "", *i++, "");
- if (is_arg) {
- char *arg=gui_internal_escape(escape_mode_string, replacement);
- args=g_strconcat_printf(args, "%s%s", args ? "," : "", arg);
- g_free(replacement);
- g_free(arg);
- replacement=g_strdup("");
- }
- }
- if (!replacement) {
- dbg(lvl_error,"Unsupported format string %s\n",format);
- goto error;
- }
- new_str=g_strconcat(str, replacement, end+1, NULL);
- c=new_str+strlen(str)+strlen(replacement);
- g_free(str);
- g_free(replacement);
- str=new_str;
- }
- c++;
- }
- *in=i;
- if (*onclick && strlen(*onclick))
- sep=";";
- if (str && strlen(str)) {
- char *old=*onclick;
- if (set) {
- char *setstr=gui_internal_escape(escape_mode_string,str);
- char *argssep="";
- if (args && strlen(args))
- argssep=",";
- *onclick=g_strconcat(old,sep,set,"(",setstr,argssep,args,")",NULL);
- } else {
- *onclick=g_strconcat(old,sep,str,NULL);
- }
- g_free(old);
- }
-error:
- g_free(str);
- g_free(args);
- return;
-}
-
-static void
-gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *str=g_strdup("<img"),*suffix=NULL,*onclick=g_strdup(""),*html;
-
- if (ATTR_IS_STRING((*in)->type)) {
- if ((*in)->u.str && strlen((*in)->u.str))
- str=gui_internal_append_attr(str, escape_mode_string|escape_mode_html, " class=", *in, "");
- in++;
- } else {
- dbg(lvl_error,"argument error: class argument not string\n");
- goto error;
- }
- if (ATTR_IS_STRING((*in)->type) && (*in)->u.str) {
- if ((*in)->u.str && strlen((*in)->u.str)) {
- str=gui_internal_append_attr(str, escape_mode_string|escape_mode_html, " src=", *in, "");
- }
- in++;
- } else {
- dbg(lvl_error,"argument error: image argument not string\n");
- goto error;
- }
- if (ATTR_IS_STRING((*in)->type) && (*in)->u.str) {
- if ((*in)->u.str && strlen((*in)->u.str)) {
- suffix=gui_internal_append_attr(NULL, escape_mode_html, ">", *in, "</img>");
- } else {
- suffix=g_strdup("/>");
- }
- in++;
- } else {
- dbg(lvl_error,"argument error: text argument not string\n");
- goto error;
- }
- gui_internal_onclick(&in,&onclick,NULL);
- gui_internal_onclick(&in,&onclick,"set");
- gui_internal_onclick(&in,&onclick,NULL);
- if (strlen(onclick)) {
- char *tmp=gui_internal_escape(escape_mode_html_apos, onclick);
- str=g_strconcat_printf(str," onclick='%s'",tmp);
- g_free(tmp);
- }
- g_free(onclick);
- html=g_strdup_printf("<html>%s%s</html>\n",str,suffix);
- dbg(lvl_debug,"return %s",html);
- gui_internal_html_parse_text(this, html);
- g_free(html);
-error:
- g_free(suffix);
- g_free(str);
- return;
-}
-
-static void
-gui_internal_cmd_debug(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- char *str;
- dbg(lvl_debug,"begin\n");
- if (in) {
- while (*in) {
- str=attr_to_text(*in, NULL, 0);
- dbg(lvl_debug,"%s:%s\n",attr_to_name((*in)->type),str);
- in++;
- g_free(str);
- }
- }
- dbg(lvl_debug,"done\n");
-}
-
-static void
-gui_internal_cmd2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
-{
- int entering=0;
- int ignore=1;
- if (in && in[0] && ATTR_IS_INT(in[0]->type)) {
- ignore=in[0]->u.num;
- in++;
- }
-
- if(!this->root.children) {
- entering=1;
- gui_internal_apply_config(this);
- gui_internal_enter(this, ignore);
- gui_internal_enter_setup(this);
- }
-
- if(!strcmp(function, "bookmarks"))
- gui_internal_cmd2_bookmarks(this, function, in, out, valid);
- else if(!strcmp(function, "formerdests"))
- gui_internal_cmd_formerdests(this, function, in, out, valid);
- else if(!strcmp(function, "locale"))
- gui_internal_cmd2_locale(this, function, in, out, valid);
- else if(!strcmp(function, "network_info"))
- gui_internal_cmd2_network_info(this, function, in, out, valid);
- else if(!strcmp(function, "position"))
- gui_internal_cmd2_position(this, function, in, out, valid);
- else if(!strcmp(function, "pois"))
- gui_internal_cmd2_pois(this, function, in, out, valid);
- else if(!strcmp(function, "route_description"))
- gui_internal_cmd2_route_description(this, function, in, out, valid);
- else if(!strcmp(function, "route_height_profile"))
- gui_internal_cmd2_route_height_profile(this, function, in, out, valid);
- else if(!strcmp(function, "setting_layout"))
- gui_internal_cmd2_setting_layout(this, function, in, out, valid);
- else if(!strcmp(function, "setting_maps"))
- gui_internal_cmd2_setting_maps(this, function, in, out, valid);
- else if(!strcmp(function, "setting_rules"))
- gui_internal_cmd2_setting_rules(this, function, in, out, valid);
- else if(!strcmp(function, "setting_vehicle"))
- gui_internal_cmd2_setting_vehicle(this, function, in, out, valid);
- else if(!strcmp(function, "town"))
- gui_internal_cmd2_town(this, function, in, out, valid);
- else if(!strcmp(function, "enter_coord"))
- gui_internal_cmd_enter_coord(this, function, in, out, valid);
- else if(!strcmp(function, "waypoints"))
- gui_internal_cmd2_waypoints(this, function, in, out, valid);
- else if(!strcmp(function, "about"))
- gui_internal_cmd2_about(this, function, in, out, valid);
-
- if(entering)
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-
-static struct command_table commands[] = {
- {"E",command_cast(gui_internal_cmd_escape)},
- {"abort_navigation",command_cast(gui_internal_cmd2_abort_navigation)},
- {"back",command_cast(gui_internal_cmd2_back)},
- {"back_to_map",command_cast(gui_internal_cmd2_back_to_map)},
- {"bookmarks",command_cast(gui_internal_cmd2)},
- {"debug",command_cast(gui_internal_cmd_debug)},
- {"formerdests",command_cast(gui_internal_cmd2)},
- {"get_data",command_cast(gui_internal_get_data)},
- {"img",command_cast(gui_internal_cmd_img)},
- {"locale",command_cast(gui_internal_cmd2)},
- {"log",command_cast(gui_internal_cmd_log)},
- {"menu",command_cast(gui_internal_cmd_menu2)},
- {"position",command_cast(gui_internal_cmd2_position)},
- {"pois",command_cast(gui_internal_cmd2)},
- {"redraw_map",command_cast(gui_internal_cmd_redraw_map)},
- {"refresh",command_cast(gui_internal_cmd2_refresh)},
- {"route_description",command_cast(gui_internal_cmd2)},
- {"route_height_profile",command_cast(gui_internal_cmd2)},
- {"set",command_cast(gui_internal_cmd2_set)},
- {"setting_layout",command_cast(gui_internal_cmd2)},
- {"setting_maps",command_cast(gui_internal_cmd2)},
- {"setting_rules",command_cast(gui_internal_cmd2)},
- {"setting_vehicle",command_cast(gui_internal_cmd2)},
- {"town",command_cast(gui_internal_cmd2)},
- {"enter_coord",command_cast(gui_internal_cmd2)},
- {"quit",command_cast(gui_internal_cmd2_quit)},
- {"waypoints",command_cast(gui_internal_cmd2)},
- {"write",command_cast(gui_internal_cmd_write)},
- {"about",command_cast(gui_internal_cmd2)},
-#if HAS_IFADDRS
- {"network_info",command_cast(gui_internal_cmd2)},
-#endif
-};
-
-void
-gui_internal_command_init(struct gui_priv *this, struct attr **attrs)
-{
- struct attr *attr;
- if ((attr=attr_search(attrs, NULL, attr_callback_list))) {
- command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this);
- }
-}
-
-
diff --git a/navit/gui/internal/gui_internal_command.h b/navit/gui/internal/gui_internal_command.h
deleted file mode 100644
index ff8a70f9c..000000000
--- a/navit/gui/internal/gui_internal_command.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* prototypes */
-struct attr;
-struct gui_priv;
-struct pcoord;
-char *gui_internal_coordinates(struct pcoord *pc, char sep);
-void gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid);
-void gui_internal_command_init(struct gui_priv *this, struct attr **attrs);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_gesture.c b/navit/gui/internal/gui_internal_gesture.c
deleted file mode 100644
index d01a80f1d..000000000
--- a/navit/gui/internal/gui_internal_gesture.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include "config.h"
-#ifdef HAVE_API_WIN32_BASE
-#include <windows.h>
-#endif
-#ifndef _MSC_VER
-#include <sys/time.h>
-#endif /* _MSC_VER */
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "types.h"
-#include "navit_nls.h"
-#include "event.h"
-#include "search.h"
-#include "country.h"
-#include "track.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_gesture.h"
-
-void
-gui_internal_gesture_ring_clear(struct gui_priv *this)
-{
- this->gesture_ring_last=this->gesture_ring_first=0;
-};
-
-static struct gesture_elem *
-gui_internal_gesture_ring_get(struct gui_priv *this, int i)
-{
- int n=(this->gesture_ring_last-i+GESTURE_RINGSIZE)%GESTURE_RINGSIZE;
- if(n==this->gesture_ring_first)
- return NULL;
- return this->gesture_ring+n;
-};
-
-void
-gui_internal_gesture_ring_add(struct gui_priv *this, struct point *p)
-{
- long long msec;
-#ifndef HAVE_API_WIN32_CE
- struct timeval tv;
- gettimeofday(&tv,NULL);
- msec=((long long)tv.tv_sec)*1000+tv.tv_usec/1000;
-#else
- msec=GetTickCount();
-#endif
- this->gesture_ring_last++;
- this->gesture_ring_last%=GESTURE_RINGSIZE;
- if(this->gesture_ring_last==this->gesture_ring_first) {
- this->gesture_ring_first++;
- this->gesture_ring_first%=GESTURE_RINGSIZE;
- }
- this->gesture_ring[this->gesture_ring_last].p=*p;
- this->gesture_ring[this->gesture_ring_last].msec=msec;
- dbg(lvl_info,"msec="LONGLONG_FMT" x=%d y=%d\n",msec,p->x,p->y);
-};
-
-int
-gui_internal_gesture_get_vector(struct gui_priv *this, long long msec, struct point *p0, int *dx, int *dy)
-{
- struct gesture_elem *g;
- int x,y,dt;
- int i;
-
- dt=0;
-
- if(dx) *dx=0;
- if(dy) *dy=0;
- if(p0) {
- p0->x=-1;
- p0->y=-1;
- }
-
- g=gui_internal_gesture_ring_get(this,0);
- if(!g)
- return 0;
- x=g->p.x;
- y=g->p.y;
- if(p0) {
- *p0=g->p;
- }
- msec=g->msec;
- dbg(lvl_info,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
- for(i=1;(g=gui_internal_gesture_ring_get(this,i))!=NULL;i++) {
- if( msec-g->msec > 1000 )
- break;
- dt=msec-g->msec;
- if(dx) *dx=x-g->p.x;
- if(dy) *dy=y-g->p.y;
- if(p0) {
- *p0=g->p;
- }
- dbg(lvl_info,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
- }
- return dt;
-}
-
-int
-gui_internal_gesture_do(struct gui_priv *this)
-{
- int dt;
- int dx,dy;
-
- dt=gui_internal_gesture_get_vector(this, 1000, NULL, &dx, &dy);
-
- if( abs(dx) > this->icon_s*3 && abs(dy) < this->icon_s ) {
- struct widget *wt;
- dbg(lvl_debug,"horizontal dx=%d dy=%d\n",dx,dy);
-
- /* Prevent swiping if widget was scrolled beforehand */
- if(this->pressed==2)
- return 0;
-
- for(wt=this->highlighted;wt && wt->type!=widget_table;wt=wt->parent);
- if(!wt || wt->type!=widget_table || !wt->data)
- return 0;
- if(this->highlighted) {
- this->highlighted->state &= ~STATE_HIGHLIGHTED;
- this->highlighted=NULL;
- }
- if(dx<0)
- gui_internal_table_button_next(this,NULL,wt);
- else
- gui_internal_table_button_prev(this,NULL,wt);
- return 1;
- } else if( abs(dy) > this->icon_s*3 && abs(dx) < this->icon_s ) {
- dbg(lvl_debug,"vertical dx=%d dy=%d\n",dx,dy);
- } else if (dt>300 && abs(dx) <this->icon_s && abs(dy) <this->icon_s ) {
- dbg(lvl_debug,"longtap dx=%d dy=%d\n",dx,dy);
- } else {
- dbg(lvl_debug,"none dx=%d dy=%d\n",dx,dy);
- }
-
- return 0;
-
-};
diff --git a/navit/gui/internal/gui_internal_gesture.h b/navit/gui/internal/gui_internal_gesture.h
deleted file mode 100644
index f28c85d06..000000000
--- a/navit/gui/internal/gui_internal_gesture.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* prototypes */
-struct gui_priv;
-struct point;
-void gui_internal_gesture_ring_clear(struct gui_priv *this);
-void gui_internal_gesture_ring_add(struct gui_priv *this, struct point *p);
-int gui_internal_gesture_get_vector(struct gui_priv *this, long long msec, struct point *p0, int *dx, int *dy);
-int gui_internal_gesture_do(struct gui_priv *this);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_html.c b/navit/gui/internal/gui_internal_html.c
deleted file mode 100644
index 9b42fbdec..000000000
--- a/navit/gui/internal/gui_internal_html.c
+++ /dev/null
@@ -1,504 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "callback.h"
-#include "debug.h"
-#include "coord.h"
-#include "point.h"
-#include "color.h"
-#include "graphics.h"
-#include "xmlconfig.h"
-#include "navit_nls.h"
-#include "gui.h"
-#include "command.h"
-struct gui_priv;
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_keyboard.h"
-#include "gui_internal_menu.h"
-
-
-
-struct form {
- char *onsubmit;
-};
-
-struct html_tag_map {
- char *tag_name;
- enum html_tag tag;
-} html_tag_map[] = {
- {"a",html_tag_a},
- {"h1",html_tag_h1},
- {"html",html_tag_html},
- {"img",html_tag_img},
- {"script",html_tag_script},
- {"form",html_tag_form},
- {"input",html_tag_input},
- {"div",html_tag_div},
-};
-
-
-static const char *
-find_attr(const char **names, const char **values, const char *name)
-{
- while (*names) {
- if (!g_ascii_strcasecmp(*names, name))
- return *values;
- names+=XML_ATTR_DISTANCE;
- values+=XML_ATTR_DISTANCE;
- }
- return NULL;
-}
-
-static char *
-find_attr_dup(const char **names, const char **values, const char *name)
-{
- return g_strdup(find_attr(names, values, name));
-}
-
-void
-gui_internal_html_main_menu(struct gui_priv *this)
-{
- gui_internal_prune_menu(this, NULL);
- gui_internal_html_load_href(this, "#Main Menu", 0);
-}
-
-static void
-gui_internal_html_command(struct gui_priv *this, struct widget *w, void *data)
-{
- gui_internal_evaluate(this,w->command);
-}
-
-static void
-gui_internal_html_submit_set(struct gui_priv *this, struct widget *w, struct form *form)
-{
- GList *l;
- if (w->form == form && w->name) {
- struct attr *attr=attr_new_from_text(w->name, w->text?w->text:"");
- if (attr)
- gui_set_attr(this->self.u.gui, attr);
- attr_free(attr);
- }
- l=w->children;
- while (l) {
- w=l->data;
- gui_internal_html_submit_set(this, w, form);
- l=g_list_next(l);
- }
-
-}
-
-static void
-gui_internal_html_submit(struct gui_priv *this, struct widget *w, void *data)
-{
- struct widget *menu;
- GList *l;
-
- dbg(lvl_debug,"enter form %p %s\n",w->form,w->form->onsubmit);
- l=g_list_last(this->root.children);
- menu=l->data;
- graphics_draw_mode(this->gra, draw_mode_begin);
- gui_internal_highlight_do(this, NULL);
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
- gui_internal_html_submit_set(this, menu, w->form);
- gui_internal_evaluate(this,w->form->onsubmit);
-}
-
-void
-gui_internal_html_load_href(struct gui_priv *this, char *href, int replace)
-{
- if (replace)
- gui_internal_prune_menu_count(this, 1, 0);
- if (href && href[0] == '#') {
- dbg(lvl_debug,"href=%s\n",href);
- g_free(this->href);
- this->href=g_strdup(href);
- gui_internal_html_menu(this, this->html_text, href+1);
- }
-}
-
-void
-gui_internal_html_href(struct gui_priv *this, struct widget *w, void *data)
-{
- gui_internal_html_load_href(this, w->command, 0);
-}
-
-struct div_flags_map {
- char *attr;
- char *val;
- enum flags flags;
-} div_flags_map[] = {
- {"gravity","none",gravity_none},
- {"gravity","left",gravity_left},
- {"gravity","xcenter",gravity_xcenter},
- {"gravity","right",gravity_right},
- {"gravity","top",gravity_top},
- {"gravity","ycenter",gravity_ycenter},
- {"gravity","bottom",gravity_bottom},
- {"gravity","left_top",gravity_left_top},
- {"gravity","top_center",gravity_top_center},
- {"gravity","right_top",gravity_right_top},
- {"gravity","left_center",gravity_left_center},
- {"gravity","center",gravity_center},
- {"gravity","right_center",gravity_right_center},
- {"gravity","left_bottom",gravity_left_bottom},
- {"gravity","bottom_center",gravity_bottom_center},
- {"gravity","right_bottom",gravity_right_bottom},
- {"expand","1",flags_expand},
- {"fill","1",flags_fill},
- {"orientation","horizontal",orientation_horizontal},
- {"orientation","vertical",orientation_vertical},
- {"orientation","horizontal_vertical",orientation_horizontal_vertical},
-};
-
-static enum flags
-div_flag(const char **names, const char **values, char *name)
-{
- int i;
- enum flags ret=0;
- const char *value=find_attr(names, values, name);
- if (!value)
- return ret;
- for (i = 0 ; i < sizeof(div_flags_map)/sizeof(struct div_flags_map); i++) {
- if (!strcmp(div_flags_map[i].attr,name) && !strcmp(div_flags_map[i].val,value))
- ret|=div_flags_map[i].flags;
- }
- return ret;
-}
-
-static enum flags
-div_flags(const char **names, const char **values)
-{
- enum flags flags;
- flags = div_flag(names, values, "gravity");
- flags |= div_flag(names, values, "orientation");
- flags |= div_flag(names, values, "expand");
- flags |= div_flag(names, values, "fill");
- return flags;
-}
-
-static struct widget *
-html_image(struct gui_priv *this, const char **names, const char **values)
-{
- const char *src, *size;
- struct graphics_image *img=NULL;
-
- src=find_attr(names, values, "src");
- if (!src)
- return NULL;
- size=find_attr(names, values, "size");
- if (!size) {
- const char *class=find_attr(names, values, "class");
- if (class && !strcasecmp(class,"centry"))
- size="xs";
- else
- size="l";
- }
- if (!strcmp(size,"l"))
- img=image_new_l(this, src);
- else if (!strcmp(size,"s"))
- img=image_new_s(this, src);
- else if (!strcmp(size,"xs"))
- img=image_new_xs(this, src);
- if (!img)
- return NULL;
- return gui_internal_image_new(this, img);
-}
-
-static void
-gui_internal_html_start(xml_context *dummy, const char *tag_name, const char **names, const char **values, void *data, GError **error)
-{
- struct gui_priv *this=data;
- int i;
- enum html_tag tag=html_tag_none;
- struct html *html=&this->html[this->html_depth];
- const char *cond, *type, *font_size;
-
- if (!g_ascii_strcasecmp(tag_name,"text") || !g_ascii_strcasecmp(tag_name,"p"))
- return;
- html->skip=0;
- html->command=NULL;
- html->name=NULL;
- html->href=NULL;
- html->refresh_cond=NULL;
- html->w=NULL;
- html->container=NULL;
- html->font_size=0;
- cond=find_attr(names, values, "cond");
-
- if (cond && !this->html_skip) {
- if (!command_evaluate_to_boolean(&this->self, cond, NULL))
- html->skip=1;
- }
-
- for (i=0 ; i < sizeof(html_tag_map)/sizeof(struct html_tag_map); i++) {
- if (!g_ascii_strcasecmp(html_tag_map[i].tag_name, tag_name)) {
- tag=html_tag_map[i].tag;
- break;
- }
- }
- html->tag=tag;
- html->class=find_attr_dup(names, values, "class");
- if (!this->html_skip && !html->skip) {
- switch (tag) {
- case html_tag_a:
- html->name=find_attr_dup(names, values, "name");
- if (html->name) {
- html->skip=this->html_anchor ? strcmp(html->name,this->html_anchor) : 0;
- if (!html->skip)
- this->html_anchor_found=1;
- }
- html->command=find_attr_dup(names, values, "onclick");
- html->href=find_attr_dup(names, values, "href");
- html->refresh_cond=find_attr_dup(names, values, "refresh_cond");
- break;
- case html_tag_img:
- html->command=find_attr_dup(names, values, "onclick");
- html->w=html_image(this, names, values);
- break;
- case html_tag_form:
- this->form=g_new0(struct form, 1);
- this->form->onsubmit=find_attr_dup(names, values, "onsubmit");
- break;
- case html_tag_input:
- type=find_attr_dup(names, values, "type");
- if (!type)
- break;
- if (!strcmp(type,"image")) {
- html->w=html_image(this, names, values);
- if (html->w) {
- html->w->state|=STATE_SENSITIVE;
- html->w->func=gui_internal_html_submit;
- }
- }
- if (!strcmp(type,"text") || !strcmp(type,"password")) {
- const char *value=find_attr(names, values, "value");
- html->w=gui_internal_label_new(this, value);
- html->w->background=this->background;
- html->w->flags |= div_flags(names, values);
- html->w->state|=STATE_EDITABLE;
- if (!this->editable) {
- this->editable=html->w;
- html->w->state|=STATE_EDIT;
- }
- this->keyboard_required=1;
- if (!strcmp(type,"password"))
- html->w->flags2 |= 1;
- }
- if (html->w) {
- html->w->form=this->form;
- html->w->name=find_attr_dup(names, values, "name");
- }
- break;
- case html_tag_div:
- html->w=gui_internal_box_new(this, div_flags(names, values));
- font_size=find_attr(names, values, "font");
- if (font_size)
- html->font_size=atoi(font_size);
- html->container=this->html_container;
- this->html_container=html->w;
- break;
- default:
- break;
- }
- }
- this->html_skip+=html->skip;
- this->html_depth++;
-}
-
-static void
-gui_internal_html_end(xml_context *dummy, const char *tag_name, void *data, GError **error)
-{
- struct gui_priv *this=data;
- struct html *html;
- struct html *parent=NULL;
-
- if (!g_ascii_strcasecmp(tag_name,"text") || !g_ascii_strcasecmp(tag_name,"p"))
- return;
- this->html_depth--;
- html=&this->html[this->html_depth];
- if (this->html_depth > 0)
- parent=&this->html[this->html_depth-1];
-
-
- if (!this->html_skip) {
- if (html->command && html->w) {
- html->w->state |= STATE_SENSITIVE;
- html->w->command=html->command;
- html->w->func=gui_internal_html_command;
- html->command=NULL;
- }
- if (parent && (parent->href || parent->command) && html->w) {
- html->w->state |= STATE_SENSITIVE;
- if (parent->command) {
- html->w->command=g_strdup(parent->command);
- html->w->func=gui_internal_html_command;
- } else {
- html->w->command=g_strdup(parent->href);
- html->w->func=gui_internal_html_href;
- }
- }
- switch (html->tag) {
- case html_tag_div:
- this->html_container=html->container;
- case html_tag_img:
- case html_tag_input:
- gui_internal_widget_append(this->html_container, html->w);
- break;
- case html_tag_form:
- this->form=NULL;
- break;
- default:
- break;
- }
- }
- this->html_skip-=html->skip;
- g_free(html->command);
- g_free(html->name);
- g_free(html->href);
- g_free(html->class);
- g_free(html->refresh_cond);
-}
-
-static void
-gui_internal_refresh_callback_called(struct gui_priv *this, struct menu_data *menu_data)
-{
- if (gui_internal_menu_data(this) == menu_data) {
- char *href=g_strdup(menu_data->href);
- gui_internal_html_load_href(this, href, 1);
- g_free(href);
- }
-}
-
-static void
-gui_internal_set_refresh_callback(struct gui_priv *this, char *cond)
-{
- dbg(lvl_info,"cond=%s\n",cond);
- if (cond) {
- enum attr_type type;
- struct object_func *func;
- struct menu_data *menu_data=gui_internal_menu_data(this);
- dbg(lvl_info,"navit=%p\n",this->nav);
- type=command_evaluate_to_attr(&this->self, cond, NULL, &menu_data->refresh_callback_obj);
- if (type == attr_none) {
- dbg(lvl_error,"can't get type of '%s'\n",cond);
- return;
- }
- func=object_func_lookup(menu_data->refresh_callback_obj.type);
- if (!func)
- dbg(lvl_error,"'%s' has no functions\n",cond);
- if (func && !func->add_attr)
- dbg(lvl_error,"'%s' has no add_attr function\n",cond);
- if (!func || !func->add_attr)
- return;
- menu_data->refresh_callback.type=attr_callback;
- menu_data->refresh_callback.u.callback=callback_new_attr_2(callback_cast(gui_internal_refresh_callback_called),type,this,menu_data);
- func->add_attr(menu_data->refresh_callback_obj.u.data, &menu_data->refresh_callback);
- }
-}
-
-static void
-gui_internal_html_text(xml_context *dummy, const char *text, gsize len, void *data, GError **error)
-{
- struct gui_priv *this=data;
- struct widget *w;
- int depth=this->html_depth-1;
- struct html *html=&this->html[depth];
- gchar *text_stripped;
-
- if (this->html_skip)
- return;
- while (isspace(text[0])) {
- text++;
- len--;
- }
- while (len > 0 && isspace(text[len-1]))
- len--;
-
- text_stripped = g_strndup(text, len);
- if (html->tag == html_tag_html && depth > 2) {
- if (this->html[depth-1].tag == html_tag_script) {
- html=&this->html[depth-2];
- }
- }
- switch (html->tag) {
- case html_tag_a:
- if (html->name && len) {
- if (html->class && !strcasecmp(html->class,"clist"))
- this->html_container=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill /* |flags_scrolly */);
- else
- this->html_container=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(gui_internal_menu(this, _(text_stripped)), this->html_container);
- gui_internal_menu_data(this)->href=g_strdup(this->href);
- gui_internal_set_refresh_callback(this, html->refresh_cond);
- this->html_container->spx=this->spacing*10;
- }
- break;
- case html_tag_h1:
- if (!this->html_container) {
- this->html_container=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(gui_internal_menu(this, _(text_stripped)), this->html_container);
- this->html_container->spx=this->spacing*10;
- }
- break;
- case html_tag_img:
- if (len) {
- if (html->class && !strcasecmp(html->class, "centry"))
- w=gui_internal_box_new(this, gravity_left_top|orientation_horizontal|flags_fill);
- else
- w=gui_internal_box_new(this, gravity_center|orientation_vertical);
- gui_internal_widget_append(w, html->w);
- gui_internal_widget_append(w, gui_internal_text_new(this, _(text_stripped), gravity_left_top|orientation_vertical|flags_fill));
- html->w=w;
- }
- break;
- case html_tag_div:
- if (len) {
- gui_internal_widget_append(html->w, gui_internal_text_font_new(this, _(text_stripped), html->font_size, gravity_center|orientation_vertical));
- }
- break;
- case html_tag_script:
- dbg(lvl_debug,"execute %s\n",text_stripped);
- gui_internal_evaluate(this,text_stripped);
- break;
- default:
- break;
- }
- g_free(text_stripped);
-}
-
-void
-gui_internal_html_parse_text(struct gui_priv *this, char *doc)
-{
- xml_parse_text(doc, this, gui_internal_html_start, gui_internal_html_end, gui_internal_html_text);
-}
-
-void
-gui_internal_html_menu(struct gui_priv *this, const char *document, char *anchor)
-{
- char *doc=g_strdup(document);
- graphics_draw_mode(this->gra, draw_mode_begin);
- this->html_container=NULL;
- this->html_depth=0;
- this->html_anchor=anchor;
- this->html_anchor_found=0;
- this->form=NULL;
- this->keyboard_required=0;
- this->editable=NULL;
- callback_list_call_attr_2(this->cbl,attr_gui,anchor,&doc);
- gui_internal_html_parse_text(this, doc);
- g_free(doc);
- if (this->keyboard_required) {
- this->html_container->flags=gravity_center|orientation_vertical|flags_expand|flags_fill;
- if (this->keyboard)
- gui_internal_widget_append(this->html_container, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"))));
- else
- gui_internal_keyboard_show_native(this, this->html_container, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")), getenv("LANG"));
- }
- gui_internal_menu_render(this);
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-
diff --git a/navit/gui/internal/gui_internal_html.h b/navit/gui/internal/gui_internal_html.h
deleted file mode 100644
index 2333162a9..000000000
--- a/navit/gui/internal/gui_internal_html.h
+++ /dev/null
@@ -1,5 +0,0 @@
-void gui_internal_html_main_menu(struct gui_priv *this);
-void gui_internal_html_load_href(struct gui_priv *this, char *href, int replace);
-void gui_internal_html_href(struct gui_priv *this, struct widget *w, void *data);
-void gui_internal_html_parse_text(struct gui_priv *this, char *doc);
-void gui_internal_html_menu(struct gui_priv *this, const char *document, char *anchor);
diff --git a/navit/gui/internal/gui_internal_keyboard.c b/navit/gui/internal/gui_internal_keyboard.c
deleted file mode 100644
index 7ef1c3d36..000000000
--- a/navit/gui/internal/gui_internal_keyboard.c
+++ /dev/null
@@ -1,560 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_keyboard.h"
-
-/**
- * @brief Switch keyboard mode to uppercase if it's in lowercase mode and {@code VKBD_MODE_2} is set.
- *
- * Called when there's no input left in the input field.
- *
- * @param this The internal GUI instance
- */
-void
-gui_internal_keyboard_to_upper_case(struct gui_priv *this)
-{
- struct menu_data *md;
-
- if (!this->keyboard)
- return;
-
- md=gui_internal_menu_data(this);
-
- if (md->keyboard_mode == (VKBD_LATIN_LOWER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_LATIN_UPPER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_UMLAUT_LOWER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_UMLAUT_UPPER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_CYRILLIC_LOWER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_CYRILLIC_UPPER | VKBD_FLAG_2);
-}
-
-/**
- * @brief Switch keyboard mode to lowercase if it's in uppercase mode and {@code VKBD_MODE_2} is set.
- *
- * Called on each alphanumeric input.
- *
- * @param this The internal GUI instance
- */
-void
-gui_internal_keyboard_to_lower_case(struct gui_priv *this)
-{
- struct menu_data *md;
-
- if (!this->keyboard)
- return;
-
- md=gui_internal_menu_data(this);
-
- if (md->keyboard_mode == (VKBD_LATIN_UPPER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_LATIN_LOWER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_UMLAUT_UPPER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_UMLAUT_LOWER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_CYRILLIC_UPPER | VKBD_FLAG_2))
- gui_internal_keyboard_do(this, md->keyboard, VKBD_CYRILLIC_LOWER | VKBD_FLAG_2);
-}
-
-/**
- * @brief Processes a key press on the internal GUI keyboard
- *
- * If the keyboard is currently in uppercase mode and {@code VKBD_MODE_2} is set, it is tswitched to
- * the corresponding lowercase mode in {@code gui_internal_keypress_do}.
- *
- * @param this The internal GUI instance
- * @param wm
- * @param data Not used
- */
-static void
-gui_internal_cmd_keypress(struct gui_priv *this, struct widget *wm, void *data)
-{
- gui_internal_keypress_do(this, (char *) wm->data);
-}
-
-static struct widget *
-gui_internal_keyboard_key_data(struct gui_priv *this, struct widget *wkbd, char *text, int font, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data, void (*data_free)(void *data), int w, int h)
-{
- struct widget *wk;
- gui_internal_widget_append(wkbd, wk=gui_internal_button_font_new_with_callback(this, text, font,
- NULL, gravity_center|orientation_vertical, func, data));
- wk->data_free=data_free;
- wk->background=this->background;
- wk->bl=0;
- wk->br=0;
- wk->bt=0;
- wk->bb=0;
- wk->w=w;
- wk->h=h;
- return wk;
-}
-
-static struct widget *
-gui_internal_keyboard_key(struct gui_priv *this, struct widget *wkbd, char *text, char *key, int w, int h)
-{
- return gui_internal_keyboard_key_data(this, wkbd, text, 0, gui_internal_cmd_keypress, g_strdup(key), g_free_func,w,h);
-}
-
-static void gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *data);
-
-
-/**
- * @struct gui_internal_keyb_mode
- * @brief Describes a keyboard mode
- */
-/**
- * @var gui_internal_keyb_modes
- * @brief A list of all available keyboard modes
- */
-struct gui_internal_keyb_mode {
- char title[16]; /**< Label to be displayed on keys that switch to it */
- int font; /**< Font size of label */
- int case_mode; /**< Mode to switch to when case CHANGE() key is pressed. */
- int umlaut_mode; /**< Mode to switch to when UMLAUT() key is pressed. */
-} gui_internal_keyb_modes[]= {
- /* 0: VKBD_LATIN_UPPER */ {"ABC", 2, VKBD_LATIN_LOWER, VKBD_UMLAUT_UPPER},
- /* 8: VKBD_LATIN_LOWER */ {"abc", 2, VKBD_LATIN_UPPER, VKBD_UMLAUT_LOWER},
- /*16: VKBD_NUMERIC */ {"123", 2, VKBD_LATIN_UPPER, VKBD_UMLAUT_UPPER},
- /*24: VKBD_UMLAUT_UPPER */ {"ÄÖÜ", 2, VKBD_UMLAUT_LOWER, VKBD_LATIN_UPPER},
- /*32: VKBD_UMLAUT_LOWER */ {"äöü", 2, VKBD_UMLAUT_UPPER, VKBD_LATIN_LOWER},
- /*40: VKBD_CYRILLIC_UPPER*/ {"АБВ", 2, VKBD_CYRILLIC_LOWER, VKBD_LATIN_UPPER},
- /*48: VKBD_CYRILLIC_LOWER*/ {"абв", 2, VKBD_CYRILLIC_UPPER, VKBD_LATIN_LOWER},
- /*56: VKBD_DEGREE */ {"DEG", 2, VKBD_FLAG_2, VKBD_FLAG_2}
-};
-
-
-// Some macros that make the keyboard layout easier to visualise in
-// the source code. The macros are #undef'd after this function.
-#define KEY(x) gui_internal_keyboard_key(this, wkbd, (x), (x), max_w, max_h)
-#define SPACER() gui_internal_keyboard_key_data(this, wkbd, "", 0, NULL, NULL, NULL,max_w,max_h)
-#define MODE(x) gui_internal_keyboard_key_data(this, wkbd, \
- gui_internal_keyb_modes[(x)/8].title, \
- gui_internal_keyb_modes[(x)/8].font, \
- gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h) \
- -> datai = (mode & VKBD_MASK_7) | ((x) & VKBD_LAYOUT_MASK)
-#define SWCASE() MODE(gui_internal_keyb_modes[mode/8].case_mode)
-#define UMLAUT() MODE(gui_internal_keyb_modes[mode/8].umlaut_mode)
-/**
- * @brief Creates a new keyboard widget or switches the layout of an existing widget
- *
- * This is an internal helper function that is not normally called directly. To create a new keyboard
- * widget, GUI widgets should call {@link gui_internal_keyboard(struct gui_priv *, struct widget *, int)}.
- *
- * @param this The internal GUI instance
- * @param wkbdb The existing keyboard widget whose layout is to be switched, or {@code NULL} to create a
- * new keyboard widget
- * @param mode The new keyboard mode, see {@link gui_internal_keyboard(struct gui_priv *, struct widget *, int)}
- * for a description of possible values
- *
- * @return {@code wkbdb} if a non-NULL value was passed, else a new keyboard widget will be returned.
- */
-struct widget *
-gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode)
-{
- struct widget *wkbd,*wk;
- struct menu_data *md=gui_internal_menu_data(this);
- int i, max_w=this->root.w, max_h=this->root.h;
- int render=0;
- char *space="_";
- char *backspace="←";
- char *hide="▼";
- char *unhide="▲";
-
- if (wkbdb) {
- this->current.x=-1;
- this->current.y=-1;
- gui_internal_highlight(this);
- if (md->keyboard_mode & VKBD_FLAG_1024)
- render=2;
- else
- render=1;
- gui_internal_widget_children_destroy(this, wkbdb);
- } else
- wkbdb=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_fill);
- md->keyboard=wkbdb;
- md->keyboard_mode=mode;
- wkbd=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_fill);
- wkbd->background=this->background;
- wkbd->cols=8;
- wkbd->spx=0;
- wkbd->spy=0;
- max_w=max_w/8;
- max_h=max_h/8; // Allows 3 results in the list when searching for Towns
- wkbd->p.y=max_h*2;
- if (((mode & VKBD_LAYOUT_MASK) == VKBD_CYRILLIC_UPPER) || ((mode & VKBD_LAYOUT_MASK) == VKBD_CYRILLIC_LOWER)) { // Russian/Ukrainian/Belarussian layout needs more space...
- max_h=max_h*4/5;
- max_w=max_w*8/9;
- wkbd->cols=9;
- }
-
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_LATIN_UPPER) {
- for (i = 0 ; i < 26 ; i++) {
- char text[]={'A'+i,'\0'};
- KEY(text);
- }
- gui_internal_keyboard_key(this, wkbd, space," ",max_w,max_h);
- if (!(mode & VKBD_MASK_7)) {
- KEY("-");
- KEY("'");
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- } else {
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- SWCASE();
- MODE(VKBD_NUMERIC);
-
- }
- UMLAUT();
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_LATIN_LOWER) {
- for (i = 0 ; i < 26 ; i++) {
- char text[]={'a'+i,'\0'};
- KEY(text);
- }
- gui_internal_keyboard_key(this, wkbd, space," ",max_w,max_h);
- if (!(mode & VKBD_MASK_7)) {
- KEY("-");
- KEY("'");
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- } else {
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- SWCASE();
-
- MODE(VKBD_NUMERIC);
- }
- UMLAUT();
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_NUMERIC) {
- for (i = 0 ; i < 10 ; i++) {
- char text[]={'0'+i,'\0'};
- KEY(text);
- }
- /* ("8") ("9")*/KEY("."); KEY("°"); KEY("'"); KEY("\"");KEY("-"); KEY("+");
- KEY("*"); KEY("/"); KEY("("); KEY(")"); KEY("="); KEY("?"); KEY(":"); SPACER();
-
-
-
- if (!(mode & VKBD_MASK_7)) {
- SPACER();
- KEY("-");
- KEY("'");
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- SPACER();
- SPACER();
- } else {
- SPACER();
- MODE(VKBD_CYRILLIC_UPPER);
- MODE(VKBD_CYRILLIC_LOWER);
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
- MODE(VKBD_LATIN_UPPER);
- MODE(VKBD_LATIN_LOWER);
- }
- UMLAUT();
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_UMLAUT_UPPER) {
- KEY("Ä"); KEY("Ë"); KEY("Ï"); KEY("Ö"); KEY("Ü"); KEY("Æ"); KEY("Ø"); KEY("Å");
- KEY("Á"); KEY("É"); KEY("Í"); KEY("Ó"); KEY("Ú"); KEY("Š"); KEY("Č"); KEY("Ž");
- KEY("À"); KEY("È"); KEY("Ì"); KEY("Ò"); KEY("Ù"); KEY("Ś"); KEY("Ć"); KEY("Ź");
- KEY("Â"); KEY("Ê"); KEY("Î"); KEY("Ô"); KEY("Û"); SPACER();
-
- UMLAUT();
-
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_UMLAUT_LOWER) {
- KEY("ä"); KEY("ë"); KEY("ï"); KEY("ö"); KEY("ü"); KEY("æ"); KEY("ø"); KEY("å");
- KEY("á"); KEY("é"); KEY("í"); KEY("ó"); KEY("ú"); KEY("š"); KEY("č"); KEY("ž");
- KEY("à"); KEY("è"); KEY("ì"); KEY("ò"); KEY("ù"); KEY("ś"); KEY("ć"); KEY("ź");
- KEY("â"); KEY("ê"); KEY("î"); KEY("ô"); KEY("û"); KEY("ß");
-
- UMLAUT();
-
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_CYRILLIC_UPPER) {
- KEY("А"); KEY("Б"); KEY("В"); KEY("Г"); KEY("Д"); KEY("Е"); KEY("Ж"); KEY("З"); KEY("И");
- KEY("Й"); KEY("К"); KEY("Л"); KEY("М"); KEY("Н"); KEY("О"); KEY("П"); KEY("Р"); KEY("С");
- KEY("Т"); KEY("У"); KEY("Ф"); KEY("Х"); KEY("Ц"); KEY("Ч"); KEY("Ш"); KEY("Щ"); KEY("Ъ");
- KEY("Ы"); KEY("Ь"); KEY("Э"); KEY("Ю"); KEY("Я"); KEY("Ё"); KEY("І"); KEY("Ї"); KEY("Ў");
- SPACER(); SPACER(); SPACER();
- gui_internal_keyboard_key(this, wkbd, space," ",max_w,max_h);
-
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
-
- SWCASE();
-
- MODE(VKBD_NUMERIC);
-
- SPACER();
-
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_CYRILLIC_LOWER) {
- KEY("а"); KEY("б"); KEY("в"); KEY("г"); KEY("д"); KEY("е"); KEY("ж"); KEY("з"); KEY("и");
- KEY("й"); KEY("к"); KEY("л"); KEY("м"); KEY("н"); KEY("о"); KEY("п"); KEY("р"); KEY("с");
- KEY("т"); KEY("у"); KEY("ф"); KEY("х"); KEY("ц"); KEY("ч"); KEY("ш"); KEY("щ"); KEY("ъ");
- KEY("ы"); KEY("ь"); KEY("э"); KEY("ю"); KEY("я"); KEY("ё"); KEY("і"); KEY("ї"); KEY("ў");
- SPACER(); SPACER(); SPACER();
- gui_internal_keyboard_key(this, wkbd, space," ",max_w,max_h);
-
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
-
- SWCASE();
-
- MODE(VKBD_NUMERIC);
-
- SPACER();
-
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
-
-
- if(md->search_list && md->search_list->type==widget_table) {
- struct table_data *td=(struct table_data*)(md->search_list->data);
- td->scroll_buttons.button_box_hide = !(mode & VKBD_FLAG_1024);
- }
-
- if ((mode & VKBD_LAYOUT_MASK) == VKBD_DEGREE) { /* special case for coordinates input screen (enter_coord) */
- KEY("0"); KEY("1"); KEY("2"); KEY("3"); KEY("4"); SPACER(); KEY("N"); KEY("S");
- KEY("5"); KEY("6"); KEY("7"); KEY("8"); KEY("9"); SPACER(); KEY("E"); KEY("W");
- KEY("°"); KEY("."); KEY("'");
- gui_internal_keyboard_key(this, wkbd, space," ",max_w,max_h);
- SPACER();
-
- wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h);
- wk->datai = mode | VKBD_FLAG_1024;
-
- SPACER();
- gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h);
- }
-
- if (mode & VKBD_FLAG_1024) {
- char *text=NULL;
- int font=0;
- struct widget *wkl;
- mode &= ~VKBD_FLAG_1024;
- text=gui_internal_keyb_modes[mode/8].title;
- font=gui_internal_keyb_modes[mode/8].font;
- wk=gui_internal_box_new(this, gravity_center|orientation_horizontal|flags_fill);
- wk->func=gui_internal_keyboard_change;
- wk->data=wkbdb;
- wk->background=this->background;
- wk->bl=0;
- wk->br=0;
- wk->bt=0;
- wk->bb=0;
- wk->w=max_w;
- wk->h=max_h;
- wk->datai=mode;
- wk->state |= STATE_SENSITIVE;
- gui_internal_widget_append(wk, wkl=gui_internal_label_new(this, unhide));
- wkl->background=NULL;
- gui_internal_widget_append(wk, wkl=gui_internal_label_font_new(this, text, font));
- wkl->background=NULL;
- gui_internal_widget_append(wkbd, wk);
- if (render)
- render=2;
- }
- gui_internal_widget_append(wkbdb, wkbd);
- if (render == 1) {
- gui_internal_widget_pack(this, wkbdb);
- gui_internal_widget_render(this, wkbdb);
- } else if (render == 2) {
- gui_internal_menu_reset_pack(this);
- gui_internal_menu_render(this);
- }
- return wkbdb;
-}
-#undef KEY
-#undef SPACER
-#undef SWCASE
-#undef UMLAUT
-#undef MODE
-
-/**
- * @brief Creates a keyboard widget.
- *
- * This function creates a widget to display the internal GUI keyboard.
- *
- * The {@code mode} argument specifies the type of keyboard which should initially be displayed. Refer
- * to {@link enum vkbd_mode} for a list of possible modes and their meaning.
- *
- * @param this The internal GUI instance
- * @param mode The mode for the keyboard
- *
- * @return A new keyboard widget
- */
-struct widget *
-gui_internal_keyboard(struct gui_priv *this, int mode)
-{
- if (! this->keyboard)
- return NULL;
- return gui_internal_keyboard_do(this, NULL, mode);
-}
-
-static void
-gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *data)
-{
- gui_internal_keyboard_do(this, key->data, key->datai);
-}
-
-/**
- * @brief Returns the default keyboard mode for a country.
- *
- * The return value can be passed to {@link gui_internal_keyboard(struct gui_priv *, int)} and related
- * functions.
- *
- * @param lang The two-letter country code
- *
- * @return {@code VKBD_CYRILLIC_UPPER} for countries using the Cyrillic alphabet,
- * {@code VKBD_LATIN_UPPER} otherwise
- */
-int
-gui_internal_keyboard_init_mode(char *lang)
-{
- int ret=0;
- /* do not crash if lang is NULL, which may be returned by getenv*/
- if(lang == NULL)
- return VKBD_LATIN_UPPER;
-
- /* Converting to upper case here is required for Android */
- lang=g_ascii_strup(lang,-1);
- /*
- * Set cyrillic keyboard for countries using Cyrillic alphabet
- */
- if (strstr(lang,"RU"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"UA"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"BY"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"RS"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"BG"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"MK"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"KZ"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"KG"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"TJ"))
- ret = VKBD_CYRILLIC_UPPER;
- else if (strstr(lang,"MN"))
- ret = VKBD_CYRILLIC_UPPER;
- g_free(lang);
- return ret;
-}
-
-
-/**
- * @brief Hides the platform's native on-screen keyboard or other input method
- *
- * This function is called as the {@code wfree} method of the placeholder widget for the platform's
- * native on-screen keyboard. It is a wrapper around the corresponding method of the graphics plugin,
- * which takes care of all platform-specific actions to hide the on-screen input method it previously
- * displayed.
- *
- * A call to this function indicates that Navit no longer needs the input method and is about to destroy
- * its placeholder widget. Navit will subsequently reclaim any screen real estate it may have previously
- * reserved for the input method.
- *
- * This function will free the {@code struct graphics_keyboard} pointed to by {@code w->data}
- *
- * @param this The internal GUI instance
- * @param w The placeholder widget
- */
-static void gui_internal_keyboard_hide_native(struct gui_priv *this_, struct widget *w) {
- struct graphics_keyboard *kbd = (struct graphics_keyboard *) w->data;
-
- if (kbd) {
- graphics_hide_native_keyboard(this_->gra, kbd);
- g_free(kbd->lang);
- g_free(kbd->gui_priv);
- } else
- dbg(lvl_warning, "no graphics_keyboard found, cleanup failed\n");
- g_free(w);
-}
-
-
-/**
- * @brief Shows the platform's native on-screen keyboard or other input method
- *
- * This method is a wrapper around the corresponding method of the graphics plugin, which takes care of
- * all platform-specific details. In particular, it is up to the graphics plugin to determine how to
- * handle the request: it may show its on-screen keyboard or another input method (such as stroke
- * recognition). It may choose to simply ignore the request, which will typically occur when a hardware
- * keyboard (or other hardware input) is available.
- *
- * The platform's native input method may obstruct parts of Navit's UI. To prevent parts of the UI from
- * becoming unreachable, this method will insert an empty box widget in the appropriate size at the
- * appropriate position, provided the graphics plugin reports the correct values. Otherwise a zero-size
- * widget is inserted. If the graphics driver decides not to display an on-screen input method, no
- * widget will be created and the return value will be {@code NULL}.
- *
- * The widget's {@code wfree} function, to be called when the widget is destroyed, will be used to hide
- * the platform keyboard when it is no longer needed.
- *
- * @param this The internal GUI instance
- * @param w The parent of the widget requiring text input
- * @param mode The requested keyboard mode
- * @param lang The language for text input, used to select a keyboard layout
- *
- * @return The placeholder widget for the on-screen keyboard, may be {@code NULL}
- */
-struct widget * gui_internal_keyboard_show_native(struct gui_priv *this, struct widget *w, int mode, char *lang) {
- struct widget *ret = NULL;
- struct menu_data *md = gui_internal_menu_data(this);
- struct graphics_keyboard *kbd = g_new0(struct graphics_keyboard, 1);
- int res;
-
- kbd->mode = mode;
- if (lang)
- kbd->lang = g_strdup(lang);
- res = graphics_show_native_keyboard(this->gra, kbd);
-
- switch(res) {
- case -1:
- dbg(lvl_error, "graphics has no show_native_keyboard method, cannot display keyboard\n");
- /* no break */
- case 0:
- g_free(kbd);
- return NULL;
- }
-
- ret = gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_fill);
- md->keyboard = ret;
- md->keyboard_mode=mode;
- ret->wfree = gui_internal_keyboard_hide_native;
- if (kbd->h < 0) {
- ret->h = w->h;
- ret->hmin = w->hmin;
- } else
- ret->h = kbd->h;
- if (kbd->w < 0) {
- ret->w = w->w;
- ret->wmin = w->wmin;
- } else
- ret->w = kbd->w;
- dbg(lvl_error, "ret->w=%d, ret->h=%d\n", ret->w, ret->h);
- ret->data = (void *) kbd;
- gui_internal_widget_append(w, ret);
- dbg(lvl_error, "return\n");
- return ret;
-}
diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h
deleted file mode 100644
index 9b9039224..000000000
--- a/navit/gui/internal/gui_internal_keyboard.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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 */
-
- /* 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 */
-struct gui_priv;
-struct widget;
-struct widget *gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode);
-struct widget *gui_internal_keyboard(struct gui_priv *this, int mode);
-struct widget *gui_internal_keyboard_show_native(struct gui_priv *this, struct widget *w, int mode, char *lang);
-int gui_internal_keyboard_init_mode(char *lang);
-void gui_internal_keyboard_to_upper_case(struct gui_priv *this);
-void gui_internal_keyboard_to_lower_case(struct gui_priv *this);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_menu.c b/navit/gui/internal/gui_internal_menu.c
deleted file mode 100644
index 33def9983..000000000
--- a/navit/gui/internal/gui_internal_menu.c
+++ /dev/null
@@ -1,373 +0,0 @@
-#include <glib.h>
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "xmlconfig.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_search.h"
-#include "gui_internal_menu.h"
-
-extern char *version;
-
-static void
-gui_internal_menu_destroy(struct gui_priv *this, struct widget *w)
-{
- struct menu_data *menu_data=w->menu_data;
- if (menu_data) {
- if (menu_data->refresh_callback_obj.type) {
- struct object_func *func;
- func=object_func_lookup(menu_data->refresh_callback_obj.type);
- if (func && func->remove_attr)
- func->remove_attr(menu_data->refresh_callback_obj.u.data, &menu_data->refresh_callback);
- }
- if (menu_data->refresh_callback.u.callback)
- callback_destroy(menu_data->refresh_callback.u.callback);
-
- g_free(menu_data->href);
- g_free(menu_data);
- }
- gui_internal_widget_destroy(this, w);
- this->root.children=g_list_remove(this->root.children, w);
-}
-
-static void
-gui_internal_prune_menu_do(struct gui_priv *this, struct widget *w, int render)
-{
- GList *l;
- struct widget *wr,*wd;
- gui_internal_search_idle_end(this);
- while ((l = g_list_last(this->root.children))) {
- wd=l->data;
- if (wd == w) {
- void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
- if (!render)
- return;
- gui_internal_say(this, w, 0);
- redisplay=w->menu_data->redisplay;
- wr=w->menu_data->redisplay_widget;
- if (!w->menu_data->redisplay && !w->menu_data->href) {
- gui_internal_widget_render(this, w);
- return;
- }
- if (redisplay) {
- gui_internal_menu_destroy(this, w);
- redisplay(this, wr, wr->data);
- } else {
- char *href=g_strdup(w->menu_data->href);
- gui_internal_menu_destroy(this, w);
- gui_internal_html_load_href(this, href, 0);
- g_free(href);
- }
- return;
- }
- gui_internal_menu_destroy(this, wd);
- }
-}
-
-void
-gui_internal_prune_menu(struct gui_priv *this, struct widget *w)
-{
- gui_internal_prune_menu_do(this, w, 1);
-}
-
-void
-gui_internal_prune_menu_count(struct gui_priv *this, int count, int render)
-{
- GList *l=g_list_last(this->root.children);
- struct widget *w=NULL;
- while (l && count-- > 0)
- l=g_list_previous(l);
- if (l) {
- w=l->data;
- gui_internal_prune_menu_do(this, w, render);
- }
-}
-
-
-/**
- * @brief Initializes a GUI screen
- *
- * This method initializes the internal GUI's screen on which all other elements (such as HTML menus,
- * dialogs or others) are displayed.
- *
- * It sets up a view hierarchy, which includes a title bar and a client area to hold widgets defined by
- * the caller.
- *
- * @param this The GUI instance
- * @param label The label to display in the top bar
- *
- * @return The container for caller-defined widgets
- */
-struct widget *
-gui_internal_menu(struct gui_priv *this, const char *label)
-{
- struct widget *menu,*w,*w1,*topbox;
- struct padding *padding = NULL;
-
- if (this->gra) {
- padding = graphics_get_data(this->gra, "padding");
- } else
- dbg(lvl_warning, "cannot get padding: this->gra is NULL\n");
-
- gui_internal_search_idle_end(this);
- topbox=gui_internal_box_new_with_label(this, 0, label);
- topbox->w=this->root.w;
- topbox->h=this->root.h;
- gui_internal_widget_append(&this->root, topbox);
- menu=gui_internal_box_new(this, gravity_left_center|orientation_vertical);
-
- if (padding) {
- menu->p.x = padding->left;
- menu->p.y = padding->top;
- menu->w = topbox->w - padding->left - padding->right;
- menu->h = topbox->h - padding->top - padding->bottom;
- } else {
- menu->p.x = 0;
- menu->p.y = 0;
- menu->w = topbox->w;
- menu->h = topbox->h;
- }
- menu->background=this->background;
- gui_internal_apply_config(this);
- topbox->menu_data=g_new0(struct menu_data, 1);
- gui_internal_widget_append(topbox, menu);
- w=gui_internal_top_bar(this);
- gui_internal_widget_append(menu, w);
- w=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
- w->spx=4*this->spacing;
- w->w=menu->w;
- gui_internal_widget_append(menu, w);
- if (this->flags & 16 && !(this->flags & 1024)) {
- struct widget *wlb,*wb,*wm=w;
- wm->flags=gravity_center|orientation_vertical|flags_expand|flags_fill;
- w=gui_internal_box_new(this, gravity_center|orientation_horizontal|flags_expand|flags_fill);
- dbg(lvl_info,"topbox->menu_data=%p\n", topbox->menu_data);
- gui_internal_widget_append(wm, w);
- wb=gui_internal_box_new(this, gravity_right_center|orientation_horizontal|flags_fill);
- wb->bl=6;
- wb->br=6;
- wb->bb=6;
- wb->bt=6;
- wb->spx=6;
- topbox->menu_data->button_bar=wb;
- gui_internal_widget_append(wm, wb);
- wlb=gui_internal_button_label(this,_("Back"),1);
- wlb->func=gui_internal_back;
- wlb->state |= STATE_SENSITIVE;
- }
- if (this->flags & 192) {
- menu=gui_internal_box_new(this, gravity_left_center|orientation_vertical);
- if (padding) {
- menu->p.x = padding->left;
- menu->p.y = padding->top;
- menu->w = topbox->w - padding->left - padding->right;
- menu->h = topbox->h - padding->top - padding->bottom;
- } else {
- menu->p.x = 0;
- menu->p.y = 0;
- menu->w = topbox->w;
- menu->h = topbox->h;
- }
- w1=gui_internal_time_help(this);
- gui_internal_widget_append(menu, w1);
- w1=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(menu, w1);
- gui_internal_widget_append(topbox, menu);
- menu->background=NULL;
- }
- gui_internal_widget_pack(this, topbox);
- gui_internal_widget_reset_pack(this, topbox);
- topbox->w=this->root.w;
- topbox->h=this->root.h;
- if (padding) {
- menu->p.x = padding->left;
- menu->p.y = padding->top;
- menu->w = topbox->w - padding->left - padding->right;
- menu->h = topbox->h - padding->top - padding->bottom;
- } else {
- menu->p.x = 0;
- menu->p.y = 0;
- menu->w = topbox->w;
- menu->h = topbox->h;
- }
- return w;
-}
-
-struct menu_data *
-gui_internal_menu_data(struct gui_priv *this)
-{
- GList *l;
- struct widget *menu;
-
- l=g_list_last(this->root.children);
- menu=l->data;
- return menu->menu_data;
-}
-
-void
-gui_internal_menu_reset_pack(struct gui_priv *this)
-{
- GList *l;
- struct widget *top_box;
-
- l=g_list_last(this->root.children);
- top_box=l->data;
- gui_internal_widget_reset_pack(this, top_box);
-}
-
-void
-gui_internal_menu_render(struct gui_priv *this)
-{
- GList *l;
- struct widget *menu;
-
- l=g_list_last(this->root.children);
- menu=l->data;
- gui_internal_say(this, menu, 0);
- gui_internal_widget_pack(this, menu);
- gui_internal_widget_render(this, menu);
-}
-
-struct widget *
-gui_internal_top_bar(struct gui_priv *this)
-{
- struct widget *w,*wm,*wh,*wc,*wcn;
- int dots_len, sep_len;
- GList *res=NULL,*l;
- int width,width_used=0,use_sep=0,incomplete=0;
- struct graphics_gc *foreground=(this->flags & 256 ? this->background : this->text_foreground);
-/* flags
- 1:Don't expand bar to screen width
- 2:Don't show Map Icon
- 4:Don't show Home Icon
- 8:Show only current menu
- 16:Don't use menu titles as button
- 32:Show navit version
- 64:Show time
- 128:Show help
- 256:Use background for menu headline
- 512:Set osd_configuration and zoom to route when setting position
- 1024:Don't show back button
- 2048:No highlighting of keyboard
- 4096:Center menu title
-*/
-
- w=gui_internal_box_new(this, (this->flags & 4096 ? gravity_center : gravity_left_center)|orientation_horizontal|(this->flags & 1 ? 0:flags_fill));
- w->bl=this->spacing;
- w->spx=this->spacing;
- w->background=this->background2;
- if ((this->flags & 6) == 6) {
- w->bl=10;
- w->br=10;
- w->bt=6;
- w->bb=6;
- }
- width=this->root.w-w->bl;
- if (! (this->flags & 2)) {
- wm=gui_internal_button_new_with_callback(this, NULL,
- image_new_s(this, "gui_map"), gravity_center|orientation_vertical,
- gui_internal_cmd_return, NULL);
- wm->speech=g_strdup(_("Back to map"));
- gui_internal_widget_pack(this, wm);
- gui_internal_widget_append(w, wm);
- width-=wm->w;
- }
- if (! (this->flags & 4)) {
- wh=gui_internal_button_new_with_callback(this, NULL,
- image_new_s(this, "gui_home"), gravity_center|orientation_vertical,
- gui_internal_cmd_main_menu, NULL);
- wh->speech=g_strdup(_("Main Menu"));
- gui_internal_widget_pack(this, wh);
- gui_internal_widget_append(w, wh);
- width-=wh->w;
- }
- if (!(this->flags & 6))
- width-=w->spx;
- l=g_list_last(this->root.children);
- wcn=gui_internal_label_new(this,".. »");
- wcn->foreground=foreground;
- dots_len=wcn->w;
- gui_internal_widget_destroy(this, wcn);
- wcn=gui_internal_label_new(this,"»");
- wcn->foreground=foreground;
- sep_len=wcn->w;
- gui_internal_widget_destroy(this, wcn);
- while (l) {
- if (g_list_previous(l) || !g_list_next(l)) {
- wc=l->data;
- wcn=gui_internal_label_new(this, wc->text);
- wcn->foreground=foreground;
- if (g_list_next(l))
- use_sep=1;
- else
- use_sep=0;
- dbg(lvl_debug,"%d (%s) + %d + %d + %d > %d\n", wcn->w, wc->text, width_used, w->spx, use_sep ? sep_len : 0, width);
- if (wcn->w + width_used + w->spx + (use_sep ? sep_len : 0) + (g_list_previous(l) ? dots_len : 0) > width) {
- incomplete=1;
- gui_internal_widget_destroy(this, wcn);
- break;
- }
- if (use_sep) {
- struct widget *wct=gui_internal_label_new(this, "»");
- wct->foreground=foreground;
- res=g_list_prepend(res, wct);
- width_used+=sep_len+w->spx;
- }
- width_used+=wcn->w;
- if (!(this->flags & 16)) {
- wcn->func=gui_internal_cmd_return;
- wcn->data=wc;
- wcn->state |= STATE_SENSITIVE;
- }
- res=g_list_prepend(res, wcn);
- if (this->flags & 8)
- break;
- }
- l=g_list_previous(l);
- }
- if (incomplete) {
- if (! res) {
- wcn=gui_internal_label_new_abbrev(this, wc->text, width-width_used-w->spx-dots_len);
- wcn->foreground=foreground;
- wcn->func=gui_internal_cmd_return;
- wcn->data=wc;
- wcn->state |= STATE_SENSITIVE;
- res=g_list_prepend(res, wcn);
- l=g_list_previous(l);
- wc=l?l->data:NULL;
- }
- if(wc) {
- wcn=gui_internal_label_new(this, ".. »");
- wcn->foreground=foreground;
- wcn->func=gui_internal_cmd_return;
- wcn->data=wc;
- wcn->state |= STATE_SENSITIVE;
- res=g_list_prepend(res, wcn);
- }
- }
- l=res;
- while (l) {
- gui_internal_widget_append(w, l->data);
- l=g_list_next(l);
- }
- if (this->flags & 32) {
- char *version_text=g_strdup_printf("Navit %s",version);
- wcn=gui_internal_label_new(this, version_text);
- g_free(version_text);
- wcn->flags=gravity_right_center|flags_expand;
- gui_internal_widget_append(w, wcn);
- }
-#if 0
- if (dots)
- gui_internal_widget_destroy(this, dots);
-#endif
- return w;
-}
diff --git a/navit/gui/internal/gui_internal_menu.h b/navit/gui/internal/gui_internal_menu.h
deleted file mode 100644
index 57e37d91c..000000000
--- a/navit/gui/internal/gui_internal_menu.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* prototypes */
-struct gui_priv;
-struct menu_data;
-struct widget;
-void gui_internal_prune_menu(struct gui_priv *this, struct widget *w);
-void gui_internal_prune_menu_count(struct gui_priv *this, int count, int render);
-struct widget *gui_internal_menu(struct gui_priv *this, const char *label);
-struct menu_data *gui_internal_menu_data(struct gui_priv *this);
-void gui_internal_menu_reset_pack(struct gui_priv *this);
-void gui_internal_menu_render(struct gui_priv *this);
-struct widget *gui_internal_top_bar(struct gui_priv *this);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_poi.c b/navit/gui/internal/gui_internal_poi.c
deleted file mode 100644
index cb31ecc95..000000000
--- a/navit/gui/internal/gui_internal_poi.c
+++ /dev/null
@@ -1,792 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "item.h"
-#include "xmlconfig.h"
-#include "map.h"
-#include "mapset.h"
-#include "layout.h"
-#include "route.h"
-#include "transform.h"
-#include "linguistics.h"
-#include "fib.h"
-#include "util.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_keyboard.h"
-#include "gui_internal_poi.h"
-
-
-struct item_data {
- int dist;
- char *label;
- struct item item;
- struct coord c;
-};
-
-struct selector {
- char *icon;
- char *name;
- enum item_type *types;
-};
-static enum item_type selectors_BankTypes[]={type_poi_bank,type_poi_bank, type_poi_atm,type_poi_atm, type_none};
-static enum item_type selectors_FuelTypes[]={type_poi_fuel,type_poi_fuel,type_none};
-static enum item_type selectors_BusTrainTypes[]={type_poi_rail_station,type_poi_rail_station,
- type_poi_rail_halt,type_poi_rail_tram_stop,type_poi_bus_station,type_poi_bus_stop,type_none};
-static enum item_type selectors_HotelTypes[]={type_poi_hotel,type_poi_camp_rv,type_poi_camping,type_poi_camping,
- type_poi_resort,type_poi_resort,type_poi_motel,type_poi_hostel,type_none};
-static enum item_type selectors_RestaurantTypes[]={type_poi_bar,type_poi_picnic,type_poi_burgerking,type_poi_fastfood,
- type_poi_restaurant,type_poi_restaurant,type_poi_cafe,type_poi_cafe,type_poi_pub,type_poi_pub,type_none};
-static enum item_type selectors_ShoppingTypes[]={type_poi_mall,type_poi_mall,type_poi_shop_grocery,type_poi_shop_grocery,
- type_poi_shopping,type_poi_shopping,type_poi_shop_butcher,type_poi_shop_baker,type_poi_shop_fruit,
- type_poi_shop_fruit,type_poi_shop_beverages,type_poi_shop_beverages,type_none};
-static enum item_type selectors_ServiceTypes[]={type_poi_marina,type_poi_marina,type_poi_hospital,type_poi_hospital,
- type_poi_public_utilities,type_poi_public_utilities,type_poi_police,type_poi_autoservice,type_poi_information,
- type_poi_information,type_poi_pharmacy,type_poi_pharmacy,type_poi_personal_service,type_poi_repair_service,
- type_poi_restroom,type_poi_restroom,type_none};
-static enum item_type selectors_ParkingTypes[]={type_poi_car_parking,type_poi_car_parking,type_none};
-static enum item_type selectors_LandFeaturesTypes[]={type_poi_land_feature,type_poi_rock,type_poi_dam,type_poi_dam,
- type_poi_peak,type_poi_peak,type_none};
-static enum item_type selectors_OtherTypes[]={type_point_unspecified,type_poi_land_feature-1,type_poi_rock+1,type_poi_fuel-1,
- type_poi_marina+1,type_poi_shopping-1,type_poi_shopping+1,type_poi_car_parking-1,type_poi_car_parking+1,
- type_poi_bar-1,type_poi_bank+1,type_poi_dam-1,type_poi_dam+1,type_poi_information-1,type_poi_information+1,
- type_poi_mall-1,type_poi_mall+1,type_poi_personal_service-1,type_poi_pharmacy+1,type_poi_repair_service-1,
- type_poi_repair_service+1,type_poi_restaurant-1,type_poi_restaurant+1,type_poi_restroom-1,type_poi_restroom+1,
- type_poi_shop_grocery-1,type_poi_shop_grocery+1,type_poi_peak-1,type_poi_peak+1,type_poi_motel-1,type_poi_hostel+1,
- type_poi_shop_butcher-1,type_poi_shop_baker+1,type_poi_shop_fruit-1,type_poi_shop_fruit+1,type_poi_shop_beverages-1,
- type_poi_shop_beverages+1,type_poi_pub-1,type_poi_atm+1,type_line-1,type_none};
-/*static enum item_type selectors_UnknownTypes[]={type_point_unkn,type_point_unkn,type_none};*/
-struct selector selectors[]={
- {"bank","Bank",selectors_BankTypes},
- {"fuel","Fuel",selectors_FuelTypes},
- {"bus_stop","Bus&Train",selectors_BusTrainTypes},
- {"hotel","Hotel",selectors_HotelTypes},
- {"restaurant","Restaurant",selectors_RestaurantTypes},
- {"shopping","Shopping",selectors_ShoppingTypes},
- {"hospital","Service",selectors_ServiceTypes},
- {"parking","Parking",selectors_ParkingTypes},
- {"peak","Land Features",selectors_LandFeaturesTypes},
- {"unknown","Other",selectors_OtherTypes},
-/* {"unknown","Unknown",selectors_UnknownTypes},*/
-};
-/**
- * @brief Get icon for given POI type.
- *
- * @param this pointer to gui context
- * @param type POI type
- * @return Pointer to graphics_image object, or NULL if no picture available.
- */
-
-static struct graphics_image *
-gui_internal_poi_icon(struct gui_priv *this, struct item *item)
-{
- struct attr layout;
- struct attr icon_src;
- GList *layer;
- navit_get_attr(this->nav, attr_layout, &layout, NULL);
- layer=layout.u.layout->layers;
- while(layer) {
- GList *itemgra=((struct layer *)layer->data)->itemgras;
- while(itemgra) {
- GList *types=((struct itemgra *)itemgra->data)->type;
- while(types) {
- if((long)types->data==item->type) {
- GList *element=((struct itemgra *)itemgra->data)->elements;
- while(element) {
- struct element * el=element->data;
- if(el->type==element_icon) {
- char *src;
- char *icon;
- struct graphics_image *img;
- if(item_is_custom_poi(*item)) {
- struct map_rect *mr=map_rect_new(item->map, NULL);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if(item_attr_get(item, attr_icon_src, &icon_src)) {
- src=el->u.icon.src;
- if(!src || !src[0])
- src="%s";
- icon=g_strdup_printf(src,map_convert_string_tmp(item->map,icon_src.u.str));
- }
- else {
- icon=g_strdup(el->u.icon.src);
- }
- }
- else {
- icon=g_strdup(el->u.icon.src);
- }
- char *dot=g_strrstr(icon,".");
- dbg(lvl_debug,"%s %s\n", item_to_name(item->type),icon);
- if(dot)
- *dot=0;
- img=image_new_xs(this,icon);
- g_free(icon);
- if(img)
- return img;
- }
- element=g_list_next(element);
- }
- }
- types=g_list_next(types);
- }
- itemgra=g_list_next(itemgra);
- }
- layer=g_list_next(layer);
- }
- return NULL;
-}
-
-/**
- * @brief Free poi_param structure.
- *
- * @param p reference to the object to be freed.
- */
-
-void
-gui_internal_poi_param_free(void *p)
-{
- if(((struct poi_param *)p)->filterstr)
- g_free(((struct poi_param *)p)->filterstr);
- if(((struct poi_param *)p)->filter)
- g_list_free(((struct poi_param *)p)->filter);
- g_free(p);
-};
-
-/**
- * @brief Clone poi_param structure.
- *
- * @param p reference to the object to be cloned.
- * @return Cloned object reference.
- */
-
-static struct poi_param *
-gui_internal_poi_param_clone(struct poi_param *p)
-{
- struct poi_param *r=g_new(struct poi_param,1);
- GList *l=p->filter;
- memcpy(r,p,sizeof(struct poi_param));
- r->filter=NULL;
- r->filterstr=NULL;
- if(p->filterstr) {
- char *last=g_list_last(l)->data;
- int len=(last - p->filterstr) + strlen(last)+1;
- r->filterstr=g_memdup(p->filterstr,len);
- }
- while(l) {
- r->filter=g_list_append(r->filter, r->filterstr + ((char*)(l->data) - p->filterstr) );
- l=g_list_next(l);
- }
- return r;
-};
-
-/**
- * @brief Set POIs filter data in poi_param structure.
- * @param param poi_param structure with unset filter data.
- * @param text filter text.
- */
-
-void
-gui_internal_poi_param_set_filter(struct poi_param *param, char *text)
-{
- char *s1, *s2;
-
- param->filterstr=removecase(text);
- s1=param->filterstr;
- do {
- s2=g_utf8_strchr(s1,-1,' ');
- if(s2)
- *s2++=0;
- param->filter=g_list_append(param->filter,s1);
- if(s2) {
- while(*s2==' ')
- s2++;
- }
- s1=s2;
- } while(s2 && *s2);
-}
-
-static struct widget *
-gui_internal_cmd_pois_selector(struct gui_priv *this, struct pcoord *c, int pagenb)
-{
- struct widget *wl,*wb;
- int nitems,nrows;
- int i;
- //wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal_vertical|flags_fill);
- wl->background=this->background;
- wl->w=this->root.w;
- wl->cols=this->root.w/this->icon_s;
- nitems=sizeof(selectors)/sizeof(struct selector);
- nrows=nitems/wl->cols + (nitems%wl->cols>0);
- wl->h=this->icon_l*nrows;
- for (i = 0 ; i < nitems ; i++) {
- struct poi_param *p=g_new0(struct poi_param,1);
- p->sel = 1;
- p->selnb = i;
- p->pagenb = pagenb;
- p->dist = 0;
- p->filter=NULL;
- p->filterstr=NULL;
- gui_internal_widget_append(wl, wb=gui_internal_button_new_with_callback(this, NULL,
- image_new_s(this, selectors[i].icon), gravity_left_center|orientation_vertical,
- gui_internal_cmd_pois, p));
- wb->c=*c;
- wb->data_free=gui_internal_poi_param_free;
- wb->bt=10;
- }
-
- gui_internal_widget_append(wl, wb=gui_internal_button_new_with_callback(this, NULL,
- image_new_s(this, "gui_search"), gravity_left_center|orientation_vertical,
- gui_internal_cmd_pois_filter, NULL));
- wb->c=*c;
- wb->bt=10;
-
- gui_internal_widget_pack(this,wl);
- return wl;
-}
-
-/**
- * @brief Widget to display POI item.
- *
- * @param this pointer to gui context
- * @param center reference to the standing point where angle to be counted from
- * @param item POI item reference
- * @param c POI coordinates
- * @param dist precomputed distance to POI (or -1 if it's not to be displayed)
- * @param name POI name
- * @return Pointer to new widget.
- */
-
-static void
-format_dist(int dist, char *distbuf)
-{
- if (dist > 10000)
- sprintf(distbuf,"%d ", dist/1000);
- else if (dist>0)
- sprintf(distbuf,"%d.%d ", dist/1000, (dist%1000)/100);
-}
-
-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 distbuf[32]="";
- char dirbuf[32]="";
- char routedistbuf[32]="";
- char *type;
- struct widget *wl;
- char *text;
- struct graphics_image *icon;
-
- format_dist(dist,distbuf);
- if(c) {
- int len;
- get_compass_direction(dirbuf, transform_get_angle_delta(center, c, 0), 1);
- len=strlen(dirbuf);
- dirbuf[len]=' ';
- dirbuf[len+1]=0;
- if (route) {
- route_get_distances(route, c, 1, &dist);
- if (dist != INT_MAX)
- format_dist(dist, routedistbuf);
- }
- }
-
-
- type=item_to_name(item->type);
-
- icon=gui_internal_poi_icon(this,item);
- if(!icon && item->type==type_house_number)
- icon=image_new_xs(this,"post");
- if(!icon) {
- icon=image_new_xs(this,"gui_inactive");
- text=g_strdup_printf("%s%s%s%s %s", distbuf, dirbuf, routedistbuf, type, name);
- } else if(strlen(name)>0)
- text=g_strdup_printf("%s%s%s%s", distbuf, dirbuf, routedistbuf, name);
- else
- text=g_strdup_printf("%s%s%s%s", distbuf, dirbuf, routedistbuf, type);
-
- wl=gui_internal_button_new_with_callback(this, text, icon, gravity_left_center|orientation_horizontal|flags_fill, NULL, NULL);
- wl->datai=dist;
- g_free(text);
- if (name[0]) {
- wl->name=g_strdup_printf("%s %s",type,name);
- } else {
- wl->name=g_strdup(type);
- }
- wl->func=gui_internal_cmd_position;
- wl->data=(void *)9;
- wl->item=*item;
- wl->state|= STATE_SENSITIVE;
- return wl;
-}
-
-/**
- * @brief Get string representation of item address suitable for doing search and for display in POI list.
- *
- * @param item reference to item.
- * @return Pointer to string representation of address. To be g_free()d after use.
- */
-
-char *
-gui_internal_compose_item_address_string(struct item *item, int prependPostal)
-{
- char *s=g_strdup("");
- struct attr attr;
- if(prependPostal && item_attr_get(item, attr_postal, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_house_number, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_street_name, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_street_name_systematic, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_district_name, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_town_name, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_county_name, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
- if(item_attr_get(item, attr_country_name, &attr))
- s=g_strjoin(" ",s,map_convert_string_tmp(item->map,attr.u.str),NULL);
-
- if(item_attr_get(item, attr_address, &attr))
- s=g_strjoin(" ",s,"|",map_convert_string_tmp(item->map,attr.u.str),NULL);
- return s;
-}
-
-static int
-gui_internal_cmd_pois_item_selected(struct poi_param *param, struct item *item)
-{
- enum item_type *types;
- struct selector *sel = param->sel? &selectors[param->selnb]: NULL;
- enum item_type type=item->type;
- struct attr attr;
- int match=0;
- if (type >= type_line && param->filter==NULL)
- return 0;
- if (! sel || !sel->types) {
- match=1;
- } else {
- types=sel->types;
- while (*types != type_none) {
- if (item->type >= types[0] && item->type <= types[1]) {
- return 1;
- }
- types+=2;
- }
- }
- if(type == type_house_number && !param->filter)
- return 0;
- if (param->filter) {
- char *long_name, *s;
- GList *f;
- int i;
- if (param->AddressFilterType>0) {
- s=gui_internal_compose_item_address_string(item,param->AddressFilterType==2?1:0);
- } else if (item_attr_get(item, attr_label, &attr)) {
- s=g_strdup_printf("%s %s", item_to_name(item->type), map_convert_string_tmp(item->map,attr.u.str));
- } else {
- s=g_strdup(item_to_name(item->type));
- }
- long_name=removecase(s);
- g_free(s);
-
- match=0;
- for(i=0;i<3 && !match;i++) {
- char *long_name_exp=linguistics_expand_special(long_name, i);
- for(s=long_name_exp,f=param->filter;f && s;f=g_list_next(f)) {
- s=strstr(s,f->data);
- if(!s) {
- break;
- }
- s=g_utf8_strchr(s,-1,' ');
- }
- g_free(long_name_exp);
- if(!f)
- match=1;
- }
- g_free(long_name);
- }
- return match;
-}
-
-/**
- * @brief Event handler for POIs list "more" element.
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data.
- */
-static void
-gui_internal_cmd_pois_more(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w=g_new0(struct widget,1);
- w->data=wm->data;
- w->c=wm->c;
- w->w=wm->w;
- wm->data_free=NULL;
- gui_internal_back(this, NULL, NULL);
- gui_internal_cmd_pois(this, w, w->data);
- free(w);
-}
-
-
-/**
- * @brief Event to apply POIs text filter.
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data (pointer to editor widget containg filter text).
- */
-static void
-gui_internal_cmd_pois_filter_do(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *w=data;
- struct poi_param *param;
-
- if(!w->text)
- return;
-
- if(w->data) {
- param=gui_internal_poi_param_clone(w->data);
- param->pagenb=0;
- } else {
- param=g_new0(struct poi_param,1);
- }
- if(!strcmp(wm->name,"AddressFilter"))
- param->AddressFilterType=1;
- else if(!strcmp(wm->name,"AddressFilterZip"))
- param->AddressFilterType=2;
- else
- param->AddressFilterType=0;
-
- gui_internal_poi_param_set_filter(param, w->text);
-
- gui_internal_cmd_pois(this,w,param);
- gui_internal_poi_param_free(param);
-}
-
-/**
- * @brief POIs filter dialog.
- * Event to handle '\r' '\n' keys pressed.
- *
- */
-
-static void
-gui_internal_cmd_pois_filter_changed(struct gui_priv *this, struct widget *wm, void *data)
-{
- if (wm->text && wm->reason==gui_internal_reason_keypress_finish) {
- gui_internal_cmd_pois_filter_do(this, wm, wm);
- }
-}
-
-
-/**
- * @brief POIs filter dialog.
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data.
- */
-void
-gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct widget *wb, *w, *wr, *wk, *we;
- int keyboard_mode;
- keyboard_mode = VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG"));
- wb=gui_internal_menu(this,"Filter");
- w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- wr=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wr);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(wr, we);
-
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, NULL));
- wk->state |= STATE_EDIT|STATE_EDITABLE;
- wk->func=gui_internal_cmd_pois_filter_changed;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->name=g_strdup("POIsFilter");
- wk->c=wm->c;
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
- wb->state |= STATE_SENSITIVE;
- wb->func = gui_internal_cmd_pois_filter_do;
- wb->name=g_strdup("NameFilter");
- wb->data=wk;
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "post")));
- wb->state |= STATE_SENSITIVE;
- wb->name=g_strdup("AddressFilter");
- wb->func = gui_internal_cmd_pois_filter_do;
- wb->data=wk;
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "zipcode")));
- wb->state |= STATE_SENSITIVE;
- wb->name=g_strdup("AddressFilterZip");
- wb->func = gui_internal_cmd_pois_filter_do;
- wb->data=wk;
-
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, keyboard_mode));
- else
- gui_internal_keyboard_show_native(this, w, keyboard_mode, getenv("LANG"));
- gui_internal_menu_render(this);
-
-
-}
-
-/**
- * @brief Do POI search specified by poi_param and display POIs found
- *
- * @param this The graphics context.
- * @param wm called widget.
- * @param data event data, reference to poi_param or NULL.
- */
-void
-gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data)
-{
- struct map_selection *sel,*selm;
- struct coord c,center;
- struct mapset_handle *h;
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct widget *wi,*w,*w2,*wb, *wtable, *row;
- enum projection pro=wm->c.pro;
- struct poi_param *param;
- int param_free=0;
- int idist,dist;
- struct selector *isel;
- int pagenb;
- int prevdist;
- // Starting value and increment of count of items to be extracted
- const int pagesize = 50;
- int maxitem, it = 0, i;
- struct item_data *items;
- struct fibheap* fh = fh_makekeyheap();
- int cnt = 0;
- struct table_data *td;
- struct widget *wl,*wt;
- char buffer[32];
- struct poi_param *paramnew;
- struct attr route;
-dbg(lvl_debug,"POIs...");
- if(data) {
- param = data;
- } else {
- param = g_new0(struct poi_param,1);
- param_free=1;
- }
- if (navit_get_attr(this->nav, attr_route, &route, NULL)) {
- struct attr route_status;
- if (!route_get_attr(route.u.route, attr_route_status, &route_status, NULL) ||
- (route_status.u.num != route_status_path_done_new &&
- route_status.u.num != route_status_path_done_incremental))
- route.u.route=NULL;
- } else
- route.u.route=NULL;
- dist=10000*(param->dist+1);
- isel = param->sel? &selectors[param->selnb]: NULL;
- pagenb = param->pagenb;
- prevdist=param->dist*10000;
- maxitem = pagesize*(pagenb+1);
- items= g_new0( struct item_data, maxitem);
-
-
- dbg(lvl_debug, "Params: sel = %i, selnb = %i, pagenb = %i, dist = %i, filterstr = %s, AddressFilterType= %d\n",
- param->sel, param->selnb, param->pagenb, param->dist, param->filterstr, param->AddressFilterType);
-
- wb=gui_internal_menu(this, isel ? isel->name : _("POIs"));
- w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- if (!isel && !param->filter)
- gui_internal_widget_append(w, gui_internal_cmd_pois_selector(this,&wm->c,pagenb));
- w2=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, w2);
-
- sel=map_selection_rect_new(&wm->c,dist*transform_scale(abs(wm->c.y)+dist*1.5),18);
- center.x=wm->c.x;
- center.y=wm->c.y;
- h=mapset_open(navit_get_mapset(this->nav));
- while ((m=mapset_next(h, 1))) {
- selm=map_selection_dup_pro(sel, pro, map_projection(m));
- mr=map_rect_new(m, selm);
- dbg(lvl_debug,"mr=%p\n", mr);
- if (mr) {
- while ((item=map_rect_get_item(mr))) {
- if (gui_internal_cmd_pois_item_selected(param, item) &&
- item_coord_get_pro(item, &c, 1, pro) &&
- coord_rect_contains(&sel->u.c_rect, &c) &&
- (idist=transform_distance(pro, &center, &c)) < dist) {
- struct item_data *data;
- struct attr attr;
- char *label;
- item_attr_rewind(item);
- if (item->type==type_house_number) {
- label=gui_internal_compose_item_address_string(item,1);
- } else if (item_attr_get(item, attr_label, &attr)) {
- label=map_convert_string(item->map,attr.u.str);
- // Buildings which label is equal to addr:housenumber value
- // are duplicated by item_house_number. Don't include such
- // buildings into the list. This is true for OSM maps created with
- // maptool patched with #859 latest patch.
- // FIXME: For non-OSM maps, we probably would better don't skip these items.
- if(item->type==type_poly_building && item_attr_get(item, attr_house_number, &attr) ) {
- if(strcmp(label,map_convert_string_tmp(item->map,attr.u.str))==0) {
- g_free(label);
- continue;
- }
- }
-
- } else {
- label=g_strdup("");
- }
-
- if(it>=maxitem) {
- data = fh_extractmin(fh);
- g_free(data->label);
- data->label=NULL;
- } else {
- data = &items[it++];
- }
- data->label=label;
- data->item = *item;
- data->c = c;
- data->dist = idist;
- // Key expression is a workaround to fight
- // probable heap collisions when two objects
- // are at the same distance. But it destroys
- // right order of POIs 2048 km away from cener
- // and if table grows more than 1024 rows.
- fh_insertkey(fh, -((idist<<10) + cnt++), data);
- if (it == maxitem)
- dist = (-fh_minkey(fh))>>10;
- }
- }
- map_rect_destroy(mr);
- }
- map_selection_destroy(selm);
- }
- map_selection_destroy(sel);
- mapset_close(h);
-
- wtable = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
- td=wtable->data;
-
- gui_internal_widget_append(w2,wtable);
-
- // Move items from heap to the table
- for(i=0;;i++)
- {
- int key = fh_minkey(fh);
- struct item_data *data = fh_extractmin(fh);
- if (data == NULL)
- {
- dbg(lvl_debug, "Empty heap: maxitem = %i, it = %i, dist = %i\n", maxitem, it, dist);
- break;
- }
- dbg(lvl_debug, "dist1: %i, dist2: %i\n", data->dist, (-key)>>10);
- if(i==(it-pagesize*pagenb) && data->dist>prevdist)
- prevdist=data->dist;
- wi=gui_internal_cmd_pois_item(this, &center, &data->item, &data->c, route.u.route, data->dist, data->label);
- wi->c.x=data->c.x;
- wi->c.y=data->c.y;
- wi->c.pro=pro;
- wi->background=this->background;
- row = gui_internal_widget_table_row_new(this,
- gravity_left
- | flags_fill
- | orientation_horizontal);
- gui_internal_widget_append(row,wi);
- row->datai=data->dist;
- gui_internal_widget_prepend(wtable,row);
- g_free(data->label);
- }
-
- fh_deleteheap(fh);
- free(items);
-
- // Add an entry for more POI
- row = gui_internal_widget_table_row_new(this,
- gravity_left
- | flags_fill
- | orientation_horizontal);
- row->datai=100000000; // Really far away for Earth, but won't work for bigger planets.
- gui_internal_widget_append(wtable,row);
- wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(row,wl);
- if (it == maxitem) {
- paramnew=gui_internal_poi_param_clone(param);
- paramnew->pagenb++;
- paramnew->count=it;
- snprintf(buffer, sizeof(buffer), "Get more (up to %d items)...", (paramnew->pagenb+1)*pagesize);
- wt=gui_internal_label_new(this, buffer);
- gui_internal_widget_append(wl, wt);
- wt->func=gui_internal_cmd_pois_more;
- wt->data=paramnew;
- wt->data_free=gui_internal_poi_param_free;
- wt->state |= STATE_SENSITIVE;
- wt->c = wm->c;
- } else {
- static int dist[]={1,5,10,0};
- wt=gui_internal_label_new(this, "Set distance to");
- gui_internal_widget_append(wl, wt);
- for(i=0;dist[i];i++) {
- paramnew=gui_internal_poi_param_clone(param);
- paramnew->dist+=dist[i];
- paramnew->count=it;
- snprintf(buffer, sizeof(buffer), " %i ", 10*(paramnew->dist+1));
- wt=gui_internal_label_new(this, buffer);
- gui_internal_widget_append(wl, wt);
- wt->func=gui_internal_cmd_pois_more;
- wt->data=paramnew;
- wt->data_free=gui_internal_poi_param_free;
- wt->state |= STATE_SENSITIVE;
- wt->c = wm->c;
- }
- wt=gui_internal_label_new(this, "km.");
- gui_internal_widget_append(wl, wt);
-
- }
- // Rendering now is needed to have table_data->bottomrow filled in.
- gui_internal_menu_render(this);
- td=wtable->data;
- if(td->bottom_row!=NULL)
- {
-#if 0
- while(((struct widget*)td->bottom_row->data)->datai<=prevdist
- && (td->next_button->state & STATE_SENSITIVE))
- {
- gui_internal_table_button_next(this, td->next_button, NULL);
- }
-#else
- int firstrow=g_list_index(wtable->children, td->top_row->data);
- while(firstrow>=0) {
- int currow=g_list_index(wtable->children, td->bottom_row->data) - firstrow;
- if(currow<0) {
- dbg(lvl_debug,"Can't find bottom row in children list. Stop paging.\n");
- break;
- }
- if(currow>=param->count)
- break;
- if(!(td->scroll_buttons.next_button->state & STATE_SENSITIVE)) {
- dbg(lvl_debug,"Reached last page but item %i not found. Stop paging.\n",param->count);
- break;
- }
- gui_internal_table_button_next(this, td->scroll_buttons.next_button, NULL);
- }
-#endif
- }
- gui_internal_menu_render(this);
- if(param_free)
- g_free(param);
-}
-
diff --git a/navit/gui/internal/gui_internal_poi.h b/navit/gui/internal/gui_internal_poi.h
deleted file mode 100644
index 665f44a70..000000000
--- a/navit/gui/internal/gui_internal_poi.h
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/**
- * POI search/filtering parameters.
- *
- */
-
-struct poi_param {
-
- /**
- * =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;
-};
-
-/* prototypes */
-struct coord;
-struct gui_priv;
-struct item;
-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);
-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);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_priv.h b/navit/gui/internal/gui_internal_priv.h
deleted file mode 100644
index 37b09d62a..000000000
--- a/navit/gui/internal/gui_internal_priv.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/**
- * @brief A structure to store configuration values.
- *
- * This structure stores configuration values for how gui elements in the internal GUI
- * should be drawn.
- */
-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;
-
-};
-
-struct route_data {
- struct widget * route_table;
- int route_showing;
-};
-
-/**
- * Private data for the internal GUI.
- *
- * @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.
- * 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
- * HTML menu, text entry dialogs do not use this member.
- */
- 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 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
- * 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];
-
-/* gestures */
-
- 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;
-};
-
-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 heightline {
- 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;
-};
-/* prototypes */
-enum flags;
-struct attr;
-struct coord;
-struct coord_geo;
-struct graphics_image;
-struct gui_priv;
-struct heightline;
-struct item;
-struct map;
-struct navit;
-struct pcoord;
-struct point;
-struct vehicle;
-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);
-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_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(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);
-char *gui_internal_cmd_match_expand(char *pattern, struct attr **in);
-int gui_internal_set(char *remove, char *add);
-void gui_internal_cmd_map_download(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_menu_vehicle_settings(struct gui_priv *this, struct vehicle *v, char *name);
-void gui_internal_cmd_vehicle_settings(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_evaluate(struct gui_priv *this, const char *command);
-void gui_internal_enter(struct gui_priv *this, int ignore);
-void gui_internal_leave(struct gui_priv *this);
-void gui_internal_set_click_coord(struct gui_priv *this, struct point *p);
-void gui_internal_enter_setup(struct gui_priv *this);
-void gui_internal_cmd_menu(struct gui_priv *this, int ignore, char *href);
-void gui_internal_cmd_log_clicked(struct gui_priv *this, struct widget *widget, void *data);
-void gui_internal_check_exit(struct gui_priv *this);
-void gui_internal_cmd_enter_coord_clicked(struct gui_priv *this, struct widget *widget, void *data);
-int line_intersection(struct coord *a1, struct coord *a2, struct coord *b1, struct coord *b2, struct coord *res);
-struct heightline *item_get_heightline(struct item *item);
-void gui_internal_route_update(struct gui_priv *this, struct navit *navit, struct vehicle *v);
-void gui_internal_route_screen_free(struct gui_priv *this_, struct widget *w);
-void gui_internal_populate_route_table(struct gui_priv *this, struct navit *navit);
-void plugin_init(void);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c
deleted file mode 100644
index ceeeb7438..000000000
--- a/navit/gui/internal/gui_internal_search.c
+++ /dev/null
@@ -1,635 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include "config.h"
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit.h"
-#include "navit_nls.h"
-#include "event.h"
-#include "search.h"
-#include "country.h"
-#include "track.h"
-#include "linguistics.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_html.h"
-#include "gui_internal_menu.h"
-#include "gui_internal_keyboard.h"
-#include "gui_internal_search.h"
-
-static void
-gui_internal_search_country(struct gui_priv *this, struct widget *widget, void *data)
-{
- gui_internal_prune_menu_count(this, 1, 0);
- gui_internal_search(this,_("Country"),"Country",0);
-}
-
-static void
-gui_internal_search_town(struct gui_priv *this, struct widget *wm, void *data)
-{
- if (this->sl)
- search_list_select(this->sl, attr_country_all, 0, 0);
- g_free(this->country_iso2);
- this->country_iso2=NULL;
- gui_internal_search(this,_("Town"),"Town",0);
-}
-
-static void
-gui_internal_search_street(struct gui_priv *this, struct widget *widget, void *data)
-{
- search_list_select(this->sl, attr_town_or_district_name, 0, 0);
- gui_internal_search(this,_("Street"),"Street",0);
-}
-
-static void
-gui_internal_search_house_number(struct gui_priv *this, struct widget *widget, void *data)
-{
- search_list_select(this->sl, attr_street_name, 0, 0);
- gui_internal_search(this,_("House number"),"House number",0);
-}
-
-void
-gui_internal_search_idle_end(struct gui_priv *this)
-{
- if (this->idle) {
- event_remove_idle(this->idle);
- this->idle=NULL;
- }
- if (this->idle_cb) {
- callback_destroy(this->idle_cb);
- this->idle_cb=NULL;
- }
-}
-
-static int
-gui_internal_search_cmp(gconstpointer _a, gconstpointer _b)
-{
- struct widget *a=(struct widget *)_a, *b=(struct widget *)_b;
- char *sa,*sb;
- int r;
- if(!b)
- if((!a || a->type!=widget_table_row || !a->text) && (!b || b->type!=widget_table_row || !b->text))
- return 0;
- if(!a || a->type!=widget_table_row || !a->text)
- return -1;
- if(!b || b->type!=widget_table_row || !b->text)
- return 1;
- r=a->datai-b->datai;
- if(r<0)
- return -1;
- if(r>0)
- return 1;
- sa=removecase(a->text);
- sb=removecase(b->text);
- r=strcmp(sa,sb);
- dbg(lvl_debug,"%s %s %d\n",sa,sb,r);
- g_free(sa);
- g_free(sb);
- return r;
-}
-
-static char *
-postal_str(struct search_list_result *res, int level)
-{
- char *ret=NULL;
- if (res->town->common.postal)
- ret=res->town->common.postal;
- if (res->town->common.postal_mask)
- ret=res->town->common.postal_mask;
- if (level == 1)
- return ret;
- if (res->street->common.postal)
- ret=res->street->common.postal;
- if (res->street->common.postal_mask)
- ret=res->street->common.postal_mask;
- if (level == 2)
- return ret;
- if (res->house_number->common.postal)
- ret=res->house_number->common.postal;
- if (res->house_number->common.postal_mask)
- ret=res->house_number->common.postal_mask;
- return ret;
-}
-
-static char *
-get_string_from_attr_list(struct attr **attrs, enum attr_type type, char *dflt)
-{
- struct attr attr;
- if(attr_generic_get_attr(attrs,NULL,type,&attr,NULL))
- return attr.u.str;
- else
- return dflt;
-}
-
-static char *
-district_str(struct search_list_result *res, int level, enum attr_type district, char *dflt)
-{
- char *ret=dflt;
-
- ret=get_string_from_attr_list(res->town->common.attrs, district, ret);
- if (level == 1)
- return ret;
-
- ret=get_string_from_attr_list(res->street->common.attrs, district, ret);
-
- if (level == 2)
- return ret;
-
- ret=get_string_from_attr_list(res->house_number->common.attrs, district, ret);
-
- return ret;
-}
-
-static char *
-town_display_label(struct search_list_result *res, int level, int flags)
-{
- char *town=district_str(res, level,attr_town_name,"");
- char *district=district_str(res, level,attr_district_name,NULL);
- char *postal=postal_str(res, level);
- char *postal_sep=" ";
- char *district_begin=" (";
- char *district_end=")";
- char *county_sep = ", ";
- char *county = res->town->common.county_name;
-
- if (!postal)
- postal_sep=postal="";
- if (!district || (flags & 1))
- district_begin=district_end=district="";
- if (!county || !strcmp(county, town))
- county_sep=county="";
-
- if(level==1 ) {
- if(flags & 2) {
- int n=0;
- char *s[10]={NULL};
-
- s[n]=district_str(res, level, attr_state_name, NULL);
- if(s[n])
- n++;
- s[n]=district_str(res, level, attr_county_name, NULL);
- if(s[n])
- n++;
- s[n]=district_str(res, level, attr_municipality_name, NULL);
- if(s[n])
- n++;
-
- return g_strjoinv(", ",s);
- }
- county=county_sep="";
- }
-
- return g_strdup_printf("%s%s%s%s%s%s%s%s", postal, postal_sep, town, district_begin, district, district_end, county_sep, county);
-}
-
-static void
-gui_internal_find_next_possible_key(char *search_text, char *wm_name, char *possible_keys, char *item_name)
-{
- gchar* trunk_name;
- if (item_name) {
-
- trunk_name = linguistics_expand_special(item_name,1);
- if(!trunk_name){
- trunk_name = g_strrstr(item_name, search_text);
- }
-
- if (trunk_name) {
- int next_char_pos = strlen(search_text);
- char next_char = trunk_name[next_char_pos];
- int i;
- int len = strlen(possible_keys);
-
- for(i = 0; (i<len) && (possible_keys[i] != next_char) ;i++) ;
-
- if ((i==len || !len) && !strncmp(trunk_name, search_text, next_char_pos)) {
- possible_keys[len]=trunk_name[next_char_pos];
- possible_keys[len+1]='\0';
- }
- dbg(lvl_info,"searching for %s, found: %s, currently possible_keys: %s \n", search_text, item_name, possible_keys);
- }
- }
-}
-
-static void
-gui_internal_highlight_possible_keys(struct gui_priv *this, char *possible_keys)
-{
- struct menu_data *md;
- int first_available_key_found = 0;
-
- if (!this->keyboard)
- return;
-
- md=gui_internal_menu_data(this);
- if (md && md->keyboard && !(this->flags & 2048)) {
- GList *lk=md->keyboard->children;
- graphics_draw_mode(this->gra, draw_mode_begin);
- while (lk) {
- struct widget *child=lk->data;
- GList *lk2=child->children;
- while (lk2) {
- struct widget *child_=lk2->data;
- lk2=g_list_next(lk2);
- // The data_free part is an evil hack based on the observation that
- // regular keys have set it to non-NULL whereas special keys appear
- // to have it set to NULL.
- if (child_->data && strcmp("\b", child_->data) && child_->data_free) {
- if ( (strlen(possible_keys) == 0) ||
- (g_strrstr(possible_keys, child_->data)!=NULL ) ) {
- if(this->hide_keys){
- child_->state|= STATE_SENSITIVE|STATE_CLEAR ;
- child_->state&= ~(STATE_INVISIBLE);
- }else{
- child_->state|= STATE_SENSITIVE|STATE_CLEAR|STATE_HIGHLIGHTED ;
- }
- // Select and highlight the first possible button.
- if (!first_available_key_found) {
- gui_internal_highlight_do(this, child_);
- first_available_key_found=1;
- }
- } else {
- if(this->hide_keys){
- child_->state&= ~(STATE_SELECTED|STATE_SENSITIVE) ;
- child_->state|= STATE_INVISIBLE;
- }else{
- child_->state&= ~(STATE_HIGHLIGHTED);
- }
- }
- gui_internal_widget_render(this,child_);
- }
- }
- lk=g_list_next(lk);
- }
- gui_internal_widget_render(this,md->keyboard);
- graphics_draw_mode(this->gra, draw_mode_end);
- }
-
-}
-
-static int
-gui_internal_get_match_quality(char *item_name, char* search_text, int is_house_number_without_street)
-{
- enum match_quality {
- full_string_match, word_match, substring_match, housenum_but_no_street_match }
- match_quality;
- if (is_house_number_without_street) {
- match_quality=housenum_but_no_street_match;
- } else if(item_name) {
- int i;
- char *folded_name=linguistics_casefold(item_name);
- char *folded_query=linguistics_casefold(search_text);
- match_quality=substring_match;
-
- for(i=0; i<3 ;i++) {
- char *exp=linguistics_expand_special(folded_name,i);
- char *p;
- if(!exp)
- continue;
- if(!strcmp(exp,folded_query)) {
- dbg(lvl_debug,"exact match for the whole string %s\n", exp);
- match_quality=full_string_match;
- g_free(exp);
- break;
- }
- if((p=strstr(exp,folded_query))!=NULL) {
- p+=strlen(folded_query);
- if(!*p||strchr(LINGUISTICS_WORD_SEPARATORS_ASCII,*p)) {
- dbg(lvl_debug,"exact matching word found inside string %s\n",exp);
- match_quality=word_match;
- }
- }
- g_free(exp);
- }
- g_free(folded_name);
- g_free(folded_query);
- }
- return match_quality;
-}
-
-static struct widget*
-gui_internal_create_resultlist_entry(struct gui_priv *this, struct search_list_result *res, char *result_main_label, char *result_sublabel, void *param, char *widget_name, struct item *item)
-{
- struct widget *resultlist_entry;
- if(result_sublabel) {
- struct widget *entry_sublabel;
- resultlist_entry=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(resultlist_entry,
- gui_internal_image_new(this, image_new_xs(this, res->country->flag)));
- entry_sublabel=gui_internal_box_new(this, gravity_left_center|orientation_vertical|flags_fill);
- gui_internal_widget_append(resultlist_entry, entry_sublabel);
- gui_internal_widget_append(entry_sublabel, gui_internal_label_new(this, result_main_label));
- gui_internal_widget_append(entry_sublabel, gui_internal_label_font_new(this, result_sublabel, 1));
- resultlist_entry->func=gui_internal_cmd_position;
- resultlist_entry->data=param;
- resultlist_entry->state |= STATE_SENSITIVE;
- resultlist_entry->speech=g_strdup(result_main_label);
- } else {
- resultlist_entry=gui_internal_button_new_with_callback(this, result_main_label,
- image_new_xs(this, res->country->flag),
- gravity_left_center|orientation_horizontal|flags_fill,
- gui_internal_cmd_position, param);
- }
- resultlist_entry->name=widget_name;
- if (res->c)
- resultlist_entry->c=*res->c;
- resultlist_entry->selection_id=res->id;
- if (item)
- resultlist_entry->item=*item;
-
- return resultlist_entry;
-}
-
-/**
- * @brief List of possible next keys/characters given the current result list of the incremental search.
- */
-char possible_keys_incremental_search[256]="";
-
-static void
-gui_internal_search_idle(struct gui_priv *this, char *wm_name, struct widget *search_list, void *param)
-{
- char *result_main_label=NULL,*result_sublabel=NULL,*item_name=NULL, *widget_name=NULL, *search_text;
- struct search_list_result *res;
- struct item *item=NULL;
- struct widget *search_input=NULL;
- struct widget *menu, *resultlist_row, *resultlist_entry;
-
- res=search_list_get_result(this->sl);
- if (!res) {
- gui_internal_search_idle_end(this);
- gui_internal_highlight_possible_keys(this, possible_keys_incremental_search);
- return;
- }
-
- if (! strcmp(wm_name,"Country")) {
- item_name=res->country->name;
- item=&res->country->common.item;
- result_main_label=g_strdup_printf("%s", res->country->name);
- } else if (! strcmp(wm_name,"Town")) {
- item=&res->town->common.item;
- item_name=res->town->common.town_name;
- result_main_label=town_display_label(res, 1, 0);
- result_sublabel=town_display_label(res, 1, 2);
- } else if (! strcmp(wm_name,"Street")) {
- item_name=res->street->name;
- item=&res->street->common.item;
- result_main_label=g_strdup(res->street->name);
- result_sublabel=town_display_label(res, 2, 1);
- } else if (! strcmp(wm_name,"House number")) {
- item_name=res->house_number->house_number;
- result_main_label=g_strdup_printf("%s, %s", item_name, res->street->name);
- result_sublabel=town_display_label(res, 3, 0);
- widget_name=g_strdup(result_main_label);
- }
- if(!item_name) {
- dbg(lvl_error, "Skipping nameless item in search (search type: %s). Please report this as a bug.\n", wm_name);
- return;
- }
-
- if(!widget_name)
- widget_name=g_strdup(item_name);
-
- menu=g_list_last(this->root.children)->data;
- search_input=gui_internal_find_widget(menu, NULL, STATE_EDIT);
- dbg_assert(search_input);
- search_text=search_input->text;
-
- gui_internal_find_next_possible_key(search_text, wm_name, possible_keys_incremental_search, item_name);
-
- resultlist_row=gui_internal_widget_table_row_new(this, gravity_left|orientation_horizontal|flags_fill);
- if (!result_sublabel)
- resultlist_row->text=g_strdup(result_main_label);
- else
- resultlist_row->text=g_strdup_printf("%s %s",item_name,result_sublabel);
- int is_house_number_without_street=!strcmp(wm_name,"House number") && !res->street->name;
- resultlist_row->datai=gui_internal_get_match_quality(item_name, search_text, is_house_number_without_street);
- gui_internal_widget_insert_sorted(search_list, resultlist_row, gui_internal_search_cmp);
-
- resultlist_entry=gui_internal_create_resultlist_entry(
- this, res, result_main_label, result_sublabel, param, widget_name, item);
- gui_internal_widget_append(resultlist_row, resultlist_entry);
- gui_internal_widget_pack(this, search_list);
- graphics_draw_mode(this->gra, draw_mode_begin);
- gui_internal_widget_render(this, menu);
- graphics_draw_mode(this->gra, draw_mode_end);
-
- g_free(result_main_label);
- g_free(result_sublabel);
-}
-
-static void
-gui_internal_search_idle_start(struct gui_priv *this, char *wm_name, struct widget *search_list, void *param)
-{
- this->idle_cb=callback_new_4(callback_cast(gui_internal_search_idle), this, wm_name, search_list, param);
- this->idle=event_add_idle(50,this->idle_cb);
- callback_call_0(this->idle_cb);
-}
-
-static void
-gui_internal_search_changed(struct gui_priv *this, struct widget *wm, void *data)
-{
- GList *l;
- struct widget *search_list=gui_internal_menu_data(this)->search_list;
- void *param=(void *)3;
-
- gui_internal_widget_table_clear(this, search_list);
- possible_keys_incremental_search[0]='\0';
-
- if (! strcmp(wm->name,"Country"))
- param=(void *)4;
- if (! strcmp(wm->name,"Street"))
- param=(void *)5;
- if (! strcmp(wm->name,"House number"))
- param=(void *)6;
- dbg(lvl_debug,"%s now '%s'\n", wm->name, wm->text);
-
- gui_internal_search_idle_end(this);
- if (wm->text && g_utf8_strlen(wm->text, -1) > 0) {
- struct attr search_attr;
-
- dbg(lvl_debug,"process\n");
- if (! strcmp(wm->name,"Country"))
- search_attr.type=attr_country_all;
- if (! strcmp(wm->name,"Town"))
- search_attr.type=attr_town_or_district_name;
- if (! strcmp(wm->name,"Street"))
- search_attr.type=attr_street_name;
- if (! strcmp(wm->name,"House number"))
- search_attr.type=attr_house_number;
- search_attr.u.str=wm->text;
- search_list_search(this->sl, &search_attr, 1);
- gui_internal_search_idle_start(this, wm->name, search_list, param);
- } else {
- // If not enough content is entered, we highlight all keys.
- gui_internal_highlight_possible_keys(this, "");
- }
- l=g_list_last(this->root.children);
- gui_internal_widget_render(this, l->data);
-}
-
-static void
-gui_internal_search_list_set_default_country(struct gui_priv *this)
-{
- struct attr search_attr, country_name, country_iso2, *country_attr;
- struct item *item;
- struct country_search *cs;
- struct tracking *tracking;
- struct search_list_result *res;
-
- country_attr=country_default();
- tracking=navit_get_tracking(this->nav);
- if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
- country_attr=&search_attr;
- if (country_attr) {
- cs=country_search_new(country_attr, 0);
- item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name)) {
- search_attr.type=attr_country_all;
- dbg(lvl_debug,"country %s\n", country_name.u.str);
- search_attr.u.str=country_name.u.str;
- search_list_search(this->sl, &search_attr, 0);
- while((res=search_list_get_result(this->sl)));
- if(this->country_iso2) {
- g_free(this->country_iso2);
- this->country_iso2=NULL;
- }
- if (item_attr_get(item, attr_country_iso2, &country_iso2))
- this->country_iso2=g_strdup(country_iso2.u.str);
- }
- country_search_destroy(cs);
- } else {
- dbg(lvl_error,"warning: no default country found\n");
- if (this->country_iso2) {
- dbg(lvl_debug,"attempting to use country '%s'\n",this->country_iso2);
- search_attr.type=attr_country_iso2;
- search_attr.u.str=this->country_iso2;
- search_list_search(this->sl, &search_attr, 0);
- while((res=search_list_get_result(this->sl)));
- }
- }
-}
-
-static void
-gui_internal_search_list_new(struct gui_priv *this)
-{
- struct mapset *ms=navit_get_mapset(this->nav);
- if (! this->sl) {
- this->sl=search_list_new(ms);
- gui_internal_search_list_set_default_country(this);
- }
-}
-
-void
-gui_internal_search_list_destroy(struct gui_priv *this)
-{
- if (this->sl) {
- search_list_destroy(this->sl);
- this->sl=NULL;
- }
-}
-
-void
-gui_internal_search(struct gui_priv *this, const char *what, const char *type, int flags)
-{
- struct widget *wb,*wk,*w,*wr,*we,*wl,*wnext=NULL;
- char *country;
- int keyboard_mode;
- gui_internal_search_list_new(this);
- keyboard_mode = VKBD_FLAG_2 | gui_internal_keyboard_init_mode(this->country_iso2 ? this->country_iso2 : getenv("LANG"));
- wb=gui_internal_menu(this, what);
- w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wb, w);
- wr=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(w, wr);
- we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
- gui_internal_widget_append(wr, we);
- if (!strcmp(type,"Country")) {
- wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_town"));
- wnext->func=gui_internal_search_town;
- } else if (!strcmp(type,"Town")) {
- if (this->country_iso2) {
-#ifdef HAVE_API_ANDROID
- char country_iso2[strlen(this->country_iso2)+1];
- strtolower(country_iso2, this->country_iso2);
- country=g_strdup_printf("country_%s", country_iso2);
-#else
- country=g_strdup_printf("country_%s", this->country_iso2);
-#endif
- } else
- country=g_strdup("gui_select_country");
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, country)));
- wb->state |= STATE_SENSITIVE;
- if (flags)
- wb->func = gui_internal_search_country;
- else
- wb->func = gui_internal_back;
- wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_street"));
- wnext->func=gui_internal_search_street;
- g_free(country);
- } else if (!strcmp(type,"Street")) {
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_select_town")));
- wb->state |= STATE_SENSITIVE;
- wb->func = gui_internal_back;
- wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_house_number"));
- wnext->func=gui_internal_search_house_number;
- } else if (!strcmp(type,"House number")) {
- gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_select_street")));
- wb->state |= STATE_SENSITIVE;
- wb->func = gui_internal_back;
- keyboard_mode = VKBD_NUMERIC | VKBD_FLAG_2;
- }
- gui_internal_widget_append(we, wk=gui_internal_label_new(this, NULL));
- if (wnext) {
- gui_internal_widget_append(we, wnext);
- wnext->state |= STATE_SENSITIVE;
- }
- wl=gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);//gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
- gui_internal_widget_append(wr, wl);
- gui_internal_menu_data(this)->search_list=wl;
- wk->state |= STATE_EDIT|STATE_EDITABLE;
- wk->background=this->background;
- wk->flags |= flags_expand|flags_fill;
- wk->func = gui_internal_search_changed;
- wk->name=g_strdup(type);
- if (this->keyboard)
- gui_internal_widget_append(w, gui_internal_keyboard(this, keyboard_mode));
- else
- gui_internal_keyboard_show_native(this, w, keyboard_mode, getenv("LANG"));
- gui_internal_menu_render(this);
-}
-
-void
-gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget *widget, void *data)
-{
- dbg(lvl_info,"id %d\n", widget->selection_id);
- search_list_select(this->sl, attr_street_name, 0, 0);
- search_list_select(this->sl, attr_street_name, widget->selection_id, 1);
- gui_internal_search(this,_("House number"),"House number",0);
-}
-
-void
-gui_internal_search_street_in_town(struct gui_priv *this, struct widget *widget, void *data)
-{
- dbg(lvl_info,"id %d\n", widget->selection_id);
- search_list_select(this->sl, attr_town_or_district_name, 0, 0);
- search_list_select(this->sl, attr_town_or_district_name, widget->selection_id, 1);
- gui_internal_search(this,_("Street"),"Street",0);
-}
-
-void
-gui_internal_search_town_in_country(struct gui_priv *this, struct widget *widget)
-{
- struct search_list_common *slc;
- dbg(lvl_info,"id %d\n", widget->selection_id);
- search_list_select(this->sl, attr_country_all, 0, 0);
- slc=search_list_select(this->sl, attr_country_all, widget->selection_id, 1);
- if (slc) {
- g_free(this->country_iso2);
- this->country_iso2=g_strdup(((struct search_list_country *)slc)->iso2);
- }
- gui_internal_search(this,widget->name,"Town",0);
-}
-
diff --git a/navit/gui/internal/gui_internal_search.h b/navit/gui/internal/gui_internal_search.h
deleted file mode 100644
index 6add28327..000000000
--- a/navit/gui/internal/gui_internal_search.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* prototypes */
-struct gui_priv;
-struct widget;
-void gui_internal_search_idle_end(struct gui_priv *this);
-void gui_internal_search_list_destroy(struct gui_priv *this);
-void gui_internal_search(struct gui_priv *this, const char *what, const char *type, int flags);
-void gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget *widget, void *data);
-void gui_internal_search_street_in_town(struct gui_priv *this, struct widget *widget, void *data);
-void gui_internal_search_town_in_country(struct gui_priv *this, struct widget *widget);
-/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_widget.c b/navit/gui/internal/gui_internal_widget.c
deleted file mode 100644
index 3e1993025..000000000
--- a/navit/gui/internal/gui_internal_widget.c
+++ /dev/null
@@ -1,1497 +0,0 @@
-#include <glib.h>
-#include "color.h"
-#include "coord.h"
-#include "point.h"
-#include "callback.h"
-#include "graphics.h"
-#include "debug.h"
-#include "navit_nls.h"
-#include "gui_internal.h"
-#include "gui_internal_widget.h"
-#include "gui_internal_priv.h"
-#include "gui_internal_menu.h"
-
-static void gui_internal_scroll_buttons_init(struct gui_priv *this, struct widget *widget, struct scroll_buttons *sb);
-
-static void
-gui_internal_background_render(struct gui_priv *this, struct widget *w)
-{
- struct point pnt=w->p;
- if (w->state & STATE_HIGHLIGHTED)
- graphics_draw_rectangle(this->gra, this->highlight_background, &pnt, w->w, w->h);
- else {
- if (w->background)
- graphics_draw_rectangle(this->gra, w->background, &pnt, w->w, w->h);
- }
-}
-
-struct widget *
-gui_internal_label_font_new(struct gui_priv *this, const char *text, int font)
-{
- struct point p[4];
- int w=0;
- int h=0;
-
- struct widget *widget=g_new0(struct widget, 1);
- widget->type=widget_label;
- widget->font_idx=font;
- if (text) {
- widget->text=g_strdup(text);
- graphics_get_text_bbox(this->gra, this->fonts[font], widget->text, 0x10000, 0x0, p, 0);
- w=p[2].x-p[0].x;
- h=p[0].y-p[2].y;
- }
- widget->h=h+this->spacing;
- widget->texth=h;
- widget->w=w+this->spacing;
- widget->textw=w;
- widget->flags=gravity_center;
- widget->foreground=this->text_foreground;
- widget->text_background=this->text_background;
-
- return widget;
-}
-
-struct widget *
-gui_internal_label_new(struct gui_priv *this, const char *text)
-{
- return gui_internal_label_font_new(this, text, 0);
-}
-
-struct widget *
-gui_internal_label_new_abbrev(struct gui_priv *this, const char *text, int maxwidth)
-{
- struct widget *ret=NULL;
- char *tmp=g_malloc(strlen(text)+3);
- const char *p;
- p=text+strlen(text);
- while ((p=g_utf8_find_prev_char(text, p)) >= text) {
- int i=p-text;
- strcpy(tmp, text);
- strcpy(tmp+i,"..");
- ret=gui_internal_label_new(this, tmp);
- if (ret->w < maxwidth)
- break;
- gui_internal_widget_destroy(this, ret);
- ret=NULL;
- }
- if(!ret)
- ret=gui_internal_label_new(this, "");
- g_free(tmp);
- return ret;
-}
-
-struct widget *
-gui_internal_image_new(struct gui_priv *this, struct graphics_image *image)
-{
- struct widget *widget=g_new0(struct widget, 1);
- widget->type=widget_image;
- widget->img=image;
- if (image) {
- widget->w=image->width;
- widget->h=image->height;
- }
- return widget;
-}
-
-static void
-gui_internal_image_render(struct gui_priv *this, struct widget *w)
-{
- struct point pnt;
-
- gui_internal_background_render(this, w);
- if (w->img) {
- pnt=w->p;
- pnt.x+=w->w/2-w->img->hot.x;
- pnt.y+=w->h/2-w->img->hot.y;
- graphics_draw_image(this->gra, this->foreground, &pnt, w->img);
- }
-}
-
-/**
- * @brief Renders a label.
- *
- * @param this The internal GUI instance
- * @param w The widget to render
- */
-static void
-gui_internal_label_render(struct gui_priv *this, struct widget *w)
-{
- struct point pnt=w->p;
- gui_internal_background_render(this, w);
- if (w->state & STATE_EDIT)
- graphics_draw_rectangle(this->gra, this->highlight_background, &pnt, w->w, w->h);
- if (w->text) {
- char *text;
- char *startext=(char*)g_alloca(strlen(w->text)+1);
- text=w->text;
- if (w->flags2 & 1) {
- int i;
- for (i = 0 ; i < strlen(text); i++)
- startext[i]='*';
- startext[i]='\0';
- text=startext;
- }
- if (w->flags & gravity_right) {
- pnt.y+=w->h-this->spacing;
- pnt.x+=w->w-w->textw-this->spacing;
- graphics_draw_text(this->gra, w->foreground, w->text_background, this->fonts[w->font_idx], text, &pnt, 0x10000, 0x0);
- } else {
- pnt.y+=w->h-this->spacing;
- graphics_draw_text(this->gra, w->foreground, w->text_background, this->fonts[w->font_idx], text, &pnt, 0x10000, 0x0);
- }
- }
-}
-
-/**
- * @brief Creates a text box.
- *
- * A text box is a widget that renders a text string containing newlines.
- * The string will be broken up into label widgets at each newline with a vertical layout.
- *
- * @param this The internal GUI instance
- * @param text The text to be displayed in the text box
- * @param font The font to use for the text
- * @param flags
- */
-struct widget *
-gui_internal_text_font_new(struct gui_priv *this, const char *text, int font, enum flags flags)
-{
- char *s=g_strdup(text),*s2,*tok;
- struct widget *ret=gui_internal_box_new(this, flags);
- s2=s;
- while ((tok=strtok(s2,"\n"))) {
- gui_internal_widget_append(ret, gui_internal_label_font_new(this, tok, font));
- s2=NULL;
- }
- gui_internal_widget_pack(this,ret);
- g_free(s);
- return ret;
-}
-
-struct widget *
-gui_internal_text_new(struct gui_priv *this, const char *text, enum flags flags)
-{
- return gui_internal_text_font_new(this, text, 0, 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 *ret=NULL;
- ret=gui_internal_box_new(this, flags);
- if (ret) {
- if (image && !(flags & flags_swap))
- gui_internal_widget_append(ret, gui_internal_image_new(this, image));
- if (text)
- gui_internal_widget_append(ret, gui_internal_text_font_new(this, text, font, gravity_center|orientation_vertical));
- if (image && (flags & flags_swap))
- gui_internal_widget_append(ret, gui_internal_image_new(this, image));
- ret->func=func;
- ret->data=data;
- if (func) {
- ret->state |= STATE_SENSITIVE;
- ret->speech=g_strdup(text);
- }
- }
- return ret;
-
-}
-
-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)
-{
- return gui_internal_button_font_new_with_callback(this, text, 0, image, flags, func, data);
-}
-
-struct widget *
-gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags)
-{
- return gui_internal_button_new_with_callback(this, text, image, flags, NULL, NULL);
-}
-
-struct widget *
-gui_internal_find_widget(struct widget *wi, struct point *p, int flags)
-{
- struct widget *ret,*child;
- GList *l=wi->children;
-
- if (p) {
- if (wi->p.x > p->x )
- return NULL;
- if (wi->p.y > p->y )
- return NULL;
- if ( wi->p.x + wi->w < p->x)
- return NULL;
- if ( wi->p.y + wi->h < p->y)
- return NULL;
- }
- if (wi->state & flags)
- return wi;
- while (l) {
- child=l->data;
- ret=gui_internal_find_widget(child, p, flags);
- if (ret) {
- return ret;
- }
- l=g_list_next(l);
- }
- return NULL;
-
-}
-
-void
-gui_internal_highlight_do(struct gui_priv *this, struct widget *found)
-{
- if (found == this->highlighted)
- return;
-
- graphics_draw_mode(this->gra, draw_mode_begin);
- if (this->highlighted) {
- this->highlighted->state &= ~STATE_HIGHLIGHTED;
- if (this->root.children && this->highlighted_menu == g_list_last(this->root.children)->data)
- gui_internal_widget_render(this, this->highlighted);
- this->highlighted=NULL;
- this->highlighted_menu=NULL;
- }
- if (found) {
- this->highlighted=found;
- this->highlighted_menu=g_list_last(this->root.children)->data;
- this->highlighted->state |= STATE_HIGHLIGHTED;
- gui_internal_widget_render(this, this->highlighted);
- dbg(lvl_debug,"%d,%d %dx%d\n", found->p.x, found->p.y, found->w, found->h);
- }
- graphics_draw_mode(this->gra, draw_mode_end);
-}
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void
-gui_internal_highlight(struct gui_priv *this)
-{
- struct widget *menu,*found=NULL;
- if (this->current.x > -1 && this->current.y > -1) {
- menu=g_list_last(this->root.children)->data;
- found=gui_internal_find_widget(menu, &this->current, STATE_SENSITIVE);
- if (!found) {
- found=gui_internal_find_widget(menu, &this->current, STATE_EDITABLE);
- if (found) {
- if (this->editable && this->editable != found) {
- this->editable->state &= ~ STATE_EDIT;
- gui_internal_widget_render(this, this->editable);
- }
- found->state |= STATE_EDIT;
- gui_internal_widget_render(this, found);
- this->editable=found;
- found=NULL;
- }
- }
- }
- gui_internal_highlight_do(this, found);
- this->motion_timeout_event=NULL;
-}
-
-
-struct widget *
-gui_internal_box_new_with_label(struct gui_priv *this, enum flags flags, const char *label)
-{
- struct widget *widget=g_new0(struct widget, 1);
-
- if (label)
- widget->text=g_strdup(label);
- widget->type=widget_box;
- widget->flags=flags;
- return widget;
-}
-
-struct widget *
-gui_internal_box_new(struct gui_priv *this, enum flags flags)
-{
- return gui_internal_box_new_with_label(this, flags, NULL);
-}
-
-
-static void gui_internal_box_render(struct gui_priv *this, struct widget *w)
-{
- struct widget *wc;
- GList *l;
-
- gui_internal_background_render(this, w);
- if (w->foreground && w->border) {
- struct point pnt[5];
- pnt[0]=w->p;
- pnt[1].x=pnt[0].x+w->w;
- pnt[1].y=pnt[0].y;
- pnt[2].x=pnt[0].x+w->w;
- pnt[2].y=pnt[0].y+w->h;
- pnt[3].x=pnt[0].x;
- pnt[3].y=pnt[0].y+w->h;
- pnt[4]=pnt[0];
- graphics_gc_set_linewidth(w->foreground, w->border ? w->border : 1);
- graphics_draw_lines(this->gra, w->foreground, pnt, 5);
- graphics_gc_set_linewidth(w->foreground, 1);
- }
-
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_render(this, wc);
- l=g_list_next(l);
- }
- if (w->scroll_buttons)
- gui_internal_widget_render(this, w->scroll_buttons->button_box);
-}
-
-
-/**
- * @brief Computes the size and location for the widget.
- *
- * @param this The internal GUI instance
- * @param w The widget to render
- */
-static void gui_internal_box_pack(struct gui_priv *this, struct widget *w)
-{
- struct widget *wc;
- int x0,x=0,y=0,width=0,height=0,owidth=0,oheight=0,expand=0,expandd=1,count=0,rows=0,cols=w->cols ? w->cols : 0;
- int hb=w->scroll_buttons?w->scroll_buttons->button_box->h:0;
- GList *l;
- int orientation=w->flags & 0xffff0000;
-
- if (!cols)
- cols=this->cols;
- if (!cols) {
- if ( this->root.w > this->root.h )
- cols=3;
- else
- cols=2;
- width=0;
- height=0;
- }
-
-
- /*
- * count the number of children
- */
- l=w->children;
- while (l) {
- count++;
- l=g_list_next(l);
- }
- if (orientation == orientation_horizontal_vertical && count <= cols)
- orientation=orientation_horizontal;
- switch (orientation) {
- case orientation_horizontal:
- /*
- * For horizontal orientation:
- * pack each child and find the largest height and
- * compute the total width. x spacing (spx) is considered
- *
- * If any children want to be expanded
- * we keep track of this
- */
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_pack(this, wc);
- if (height < wc->h)
- height=wc->h;
- width+=wc->w;
- if (wc->flags & flags_expand)
- expand+=wc->w ? wc->w : 1;
- l=g_list_next(l);
- if (l)
- width+=w->spx;
- }
- owidth=width;
- if (expand && w->w) {
- expandd=w->w-width+expand;
- owidth=w->w;
- } else
- expandd=expand=1;
- break;
- case orientation_vertical:
- /*
- * For vertical layouts:
- * We pack each child and compute the largest width and
- * the total height. y spacing (spy) is considered
- *
- * If the expand flag is set then teh expansion amount
- * is computed.
- */
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_pack(this, wc);
- if (width < wc->w)
- width=wc->w;
- height+=wc->h;
- if (wc->flags & flags_expand)
- expand+=wc->h ? wc->h : 1;
- l=g_list_next(l);
- if (l)
- height+=w->spy;
- }
- oheight=height;
- if (expand && w->h) {
- expandd=w->h-hb-height+expand;
- oheight=w->h-hb;
- } else
- expandd=expand=1;
- break;
- case orientation_horizontal_vertical:
- /*
- * For horizontal_vertical orientation
- * pack the children.
- * Compute the largest height and largest width.
- * Layout the widgets based on having the
- * number of columns specified by (cols)
- */
- count=0;
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_pack(this, wc);
- if (height < wc->h)
- height=wc->h;
- if (width < wc->w)
- width=wc->w;
- l=g_list_next(l);
- count++;
- }
- if (count < cols)
- cols=count;
- rows=(count+cols-1)/cols;
- width*=cols;
- height*=rows;
- width+=w->spx*(cols-1);
- height+=w->spy*(rows-1);
- owidth=width;
- oheight=height;
- expandd=expand=1;
- break;
- default:
- /*
- * No orientation was specified.
- * width and height are both 0.
- * The width & height of this widget
- * will be used.
- */
- if(!w->w && !w->h)
- dbg(lvl_error,"Warning width and height of a widget are 0");
- break;
- }
- if (! w->w && ! w->h) {
- w->w=w->bl+w->br+width;
- w->h=w->bt+w->bb+height+hb;
- w->packed=1;
- }
-#if 0
- if (expand < 100)
- expand=100;
-#endif
-
- /*
- * At this stage the width and height of this
- * widget has been computed.
- * We now make a second pass assigning heights,
- * widths and coordinates to each child widget.
- */
-
- if (w->flags & gravity_left)
- x=w->p.x+w->bl;
- if (w->flags & gravity_xcenter)
- x=w->p.x+w->w/2-owidth/2;
- if (w->flags & gravity_right)
- x=w->p.x+w->w-w->br-owidth;
- if (w->flags & gravity_top)
- y=w->p.y+w->bt;
- if (w->flags & gravity_ycenter)
- y=w->p.y+(w->h-hb)/2-oheight/2;
- if (w->flags & gravity_bottom)
- y=w->p.y+(w->h-hb)-w->bb-oheight;
- l=w->children;
- switch (orientation) {
- case orientation_horizontal:
- l=w->children;
- while (l) {
- wc=l->data;
- wc->p.x=x;
- if (wc->flags & flags_fill)
- wc->h=w->h-hb;
- if (wc->flags & flags_expand) {
- if (! wc->w)
- wc->w=1;
- wc->w=wc->w*expandd/expand;
- }
- if (w->flags & gravity_top)
- wc->p.y=y;
- if (w->flags & gravity_ycenter)
- wc->p.y=y-wc->h/2;
- if (w->flags & gravity_bottom)
- wc->p.y=y-wc->h;
- x+=wc->w+w->spx;
- l=g_list_next(l);
- }
- break;
- case orientation_vertical:
- l=w->children;
- while (l) {
- wc=l->data;
- wc->p.y=y;
- if (wc->flags & flags_fill)
- wc->w=w->w;
- if (wc->flags & flags_expand) {
- if (! wc->h)
- wc->h=1;
- wc->h=wc->h*expandd/expand;
- }
- if (w->flags & gravity_left)
- wc->p.x=x;
- if (w->flags & gravity_xcenter)
- wc->p.x=x-wc->w/2;
- if (w->flags & gravity_right)
- wc->p.x=x-wc->w;
- y+=wc->h+w->spy;
- l=g_list_next(l);
- }
- break;
- case orientation_horizontal_vertical:
- l=w->children;
- x0=x;
- count=0;
- width/=cols;
- height/=rows;
- while (l) {
- wc=l->data;
- wc->p.x=x;
- wc->p.y=y;
- if (wc->flags & flags_fill) {
- wc->w=width;
- wc->h=height;
- }
- if (w->flags & gravity_left)
- wc->p.x=x;
- if (w->flags & gravity_xcenter)
- wc->p.x=x+(width-wc->w)/2;
- if (w->flags & gravity_right)
- wc->p.x=x+width-wc->w;
- if (w->flags & gravity_top)
- wc->p.y=y;
- if (w->flags & gravity_ycenter)
- wc->p.y=y+(height-wc->h)/2;
- if (w->flags & gravity_bottom)
- wc->p.y=y-height-wc->h;
- x+=width;
- if (++count == cols) {
- count=0;
- x=x0;
- y+=height;
- }
- l=g_list_next(l);
- }
- break;
- default:
- break;
- }
- if ((w->flags & flags_scrolly) && y > w->h+w->p.y && !w->scroll_buttons) {
- w->scroll_buttons=g_new0(struct scroll_buttons, 1);
- gui_internal_scroll_buttons_init(this, w, w->scroll_buttons);
- w->scroll_buttons->button_box->w=w->w;
- w->scroll_buttons->button_box->p.x=w->p.x;
- w->scroll_buttons->button_box->p.y=w->p.y+w->h-w->scroll_buttons->button_box->h;
- gui_internal_widget_pack(this, w->scroll_buttons->button_box);
- dbg(lvl_debug,"needs buttons %d vs %d\n",y,w->h);
- gui_internal_box_pack(this, w);
- return;
- }
- /*
- * Call pack again on each child,
- * the child has now had its size and coordinates
- * set so they can repack their children.
- */
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_pack(this, wc);
- l=g_list_next(l);
- }
-}
-
-void
-gui_internal_widget_reset_pack(struct gui_priv *this, struct widget *w)
-{
- struct widget *wc;
- GList *l;
-
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_reset_pack(this, wc);
- l=g_list_next(l);
- }
- if (w->packed) {
- w->w=0;
- w->h=0;
- }
-}
-
-/**
- * @brief Adds a child widget to a parent widget, making it the last child.
- *
- * @param parent The parent widget
- * @param child The child widget
- */
-void
-gui_internal_widget_append(struct widget *parent, struct widget *child)
-{
- if (! child)
- return;
- if (! child->background)
- child->background=parent->background;
- parent->children=g_list_append(parent->children, child);
- child->parent=parent;
-}
-
-/**
- * @brief Adds a child widget to a parent widget, making it the first child.
- *
- * @param parent The parent widget
- * @param child The child widget
- */
-void
-gui_internal_widget_prepend(struct widget *parent, struct widget *child)
-{
- if (! child->background)
- child->background=parent->background;
- parent->children=g_list_prepend(parent->children, child);
- child->parent=parent;
-}
-
-/**
- * @brief Adds a child widget to a parent widget.
- *
- * Placement of the child widget among its siblings depends on the comparison function {@code func}.
- *
- * @param parent The parent widget
- * @param child The child widget
- * @param func The comparison function
- */
-void
-gui_internal_widget_insert_sorted(struct widget *parent, struct widget *child, GCompareFunc func)
-{
- if (! child->background)
- child->background=parent->background;
-
- parent->children=g_list_insert_sorted(parent->children, child, func);
- child->parent=parent;
-}
-
-
-/**
- * @brief Destroys all child widgets.
- *
- * This function is recursive, destroying all widgets in the child hierarchy of {@code w}.
- *
- * @param this The internal GUI instance
- * @param w The widget whose children are to be destroyed
- */
-void
-gui_internal_widget_children_destroy(struct gui_priv *this, struct widget *w)
-{
- GList *l;
- struct widget *wc;
-
- l=w->children;
- while (l) {
- wc=l->data;
- gui_internal_widget_destroy(this, wc);
- l=g_list_next(l);
- }
- g_list_free(w->children);
- w->children=NULL;
-}
-
-
-/**
- * @brief Destroys a widget.
- *
- * This function also takes care of recursively destroying the entire child widget hierarchy of
- * {@code w} prior to destroying {@code w} itself.
- *
- * @param this The internal GUI instance
- * @param w The widget to destroy
- */
-void
-gui_internal_widget_destroy(struct gui_priv *this, struct widget *w)
-{
- gui_internal_widget_children_destroy(this, w);
- g_free(w->command);
- g_free(w->speech);
- g_free(w->text);
- if (w->img)
- graphics_image_free(this->gra, w->img);
- if (w->prefix)
- g_free(w->prefix);
- if (w->name)
- g_free(w->name);
- if (w->data_free)
- w->data_free(w->data);
- if (w->cb && w->remove_cb)
- w->remove_cb(w->instance, w->cb);
- if (w==this->highlighted)
- this->highlighted=NULL;
- if(w->wfree)
- w->wfree(this,w);
- else
- g_free(w);
-}
-
-
-void
-gui_internal_widget_render(struct gui_priv *this, struct widget *w)
-{
- if(w->p.x > this->root.w || w->p.y > this->root.h || w->state & STATE_INVISIBLE)
- return;
-
- switch (w->type) {
- case widget_box:
- gui_internal_box_render(this, w);
- break;
- case widget_label:
- gui_internal_label_render(this, w);
- break;
- case widget_image:
- gui_internal_image_render(this, w);
- break;
- case widget_table:
- gui_internal_table_render(this,w);
- break;
- default:
- break;
- }
-}
-
-void
-gui_internal_widget_pack(struct gui_priv *this, struct widget *w)
-{
- switch (w->type) {
- case widget_box:
- gui_internal_box_pack(this, w);
- break;
- case widget_table:
- gui_internal_table_pack(this,w);
- default:
- break;
- }
-}
-
-struct widget *
-gui_internal_button_label(struct gui_priv *this, const char *label, int mode)
-{
- struct widget *wl,*wlb;
- struct widget *wb=gui_internal_menu_data(this)->button_bar;
- wlb=gui_internal_box_new(this, gravity_right_center|orientation_vertical);
- wl=gui_internal_label_new(this, label);
- wlb->border=1;
- wlb->foreground=this->text_foreground;
- wlb->bl=20;
- wlb->br=20;
- wlb->bb=6;
- wlb->bt=6;
- gui_internal_widget_append(wlb, wl);
- if (mode == 1)
- gui_internal_widget_prepend(wb, wlb);
- if (mode == -1)
- gui_internal_widget_append(wb, wlb);
-
- return wlb;
-}
-
-static void
-gui_internal_scroll_buttons_init(struct gui_priv *this, struct widget *widget, struct scroll_buttons *sb)
-{
- sb->next_button = gui_internal_button_new_with_callback(this, _("Next"), image_new_xs(this, "gui_arrow_right"),
- gravity_center|orientation_horizontal|flags_swap, gui_internal_table_button_next, widget);
- sb->prev_button = gui_internal_button_new_with_callback(this, _("Prev"), image_new_xs(this, "gui_arrow_left"),
- gravity_center|orientation_horizontal, gui_internal_table_button_prev, widget);
-
- sb->button_box=gui_internal_box_new(this, gravity_center|orientation_horizontal);
- sb->button_box->background=this->background;
- if(this->hide_keys){
- sb->prev_button->state |= STATE_INVISIBLE;
- sb->next_button->state |= STATE_INVISIBLE;
- }
- sb->prev_button->state &= ~STATE_SENSITIVE;
- sb->next_button->state &= ~STATE_SENSITIVE;
- gui_internal_widget_append(sb->button_box, sb->prev_button);
- gui_internal_widget_append(sb->button_box, sb->next_button);
-
- sb->button_box->bl=this->spacing;
- gui_internal_widget_pack(this,sb->button_box);
-}
-
-/**
- * @brief Creates a new table widget.
- *
- * Creates and returns a new table widget. This function will
- * setup next/previous buttons as children.
- *
- * @param this The graphics context.
- * @param flags widget sizing flags.
- * @return The newly created widget
- */
-struct widget * gui_internal_widget_table_new(struct gui_priv * this, enum flags flags, int buttons)
-{
- struct widget * widget = g_new0(struct widget,1);
- struct table_data * data = NULL;
- widget->type=widget_table;
- widget->flags=flags;
- widget->state=STATE_SCROLLABLE;
- widget->data=g_new0(struct table_data,1);
- widget->data_free=gui_internal_table_data_free;
-
- // We have to set background here explicitly
- // because it will be used by inner elements created later in this
- // function (navigation buttons). Else that elements won't have
- // any background.
- widget->background=this->background;
- data = (struct table_data*)widget->data;
-
- if (buttons) {
- gui_internal_scroll_buttons_init(this, widget, &data->scroll_buttons);
- gui_internal_widget_append(widget, data->scroll_buttons.button_box);
- }
-
- return widget;
-
-}
-
-/**
- * @brief Clears all the rows from the table.
- *
- * This function removes all rows from a table.
- * New rows can later be added to the table.
- *
- * @param this The internal GUI instance
- * @param table The table widget
- */
-void gui_internal_widget_table_clear(struct gui_priv * this,struct widget * table)
-{
- GList * iter;
- struct table_data * table_data = (struct table_data* ) table->data;
-
- iter = table->children;
- while(iter ) {
- if(iter->data != table_data->scroll_buttons.button_box) {
- struct widget * child = (struct widget*)iter->data;
- gui_internal_widget_destroy(this,child);
- if(table->children == iter) {
- table->children = g_list_remove(iter,iter->data);
- iter=table->children;
- }
- else
- iter = g_list_remove(iter,iter->data);
- }
- else {
- iter = g_list_next(iter);
- }
-
- }
- table_data->top_row=NULL;
- table_data->bottom_row=NULL;
-}
-
-/**
- * @brief Moves GList pointer to the next table row, skipping other table children (button box, for example).
- *
- * @param row GList pointer into the children list
- *
- * @return GList pointer to the next row in the children list, or NULL if there are no any rows left.
- */
-GList *
-gui_internal_widget_table_next_row(GList * row)
-{
- while((row=g_list_next(row))!=NULL) {
- if(row->data && ((struct widget *)(row->data))->type == widget_table_row)
- break;
- }
- return row;
-}
-
-/**
- * @brief Moves GList pointer to the previous table row, skipping other table children (button box, for example).
- *
- * @param row GList pointer into the children list
- *
- * @return GList pointer to the previous row in the children list, or NULL if there are no any rows left.
- */
-GList *
-gui_internal_widget_table_prev_row(GList * row)
-{
- while((row=g_list_previous(row))!=NULL) {
- if(row->data && ((struct widget *)(row->data))->type == widget_table_row)
- break;
- }
- return row;
-}
-
-/**
- * @brief Moves GList pointer to the first table row, skipping other table children (button box, for example).
- *
- * @param row GList pointer into the children list
- *
- * @return GList pointer to the first row in the children list, or NULL if table is empty.
- */
-GList *
-gui_internal_widget_table_first_row(GList * row)
-{
- if(!row)
- return NULL;
-
- if(row->data && ((struct widget *)(row->data))->type == widget_table_row)
- return row;
-
- return gui_internal_widget_table_next_row(row);
-}
-
-/**
- * @brief Gets GList pointer to the table row drawn on the top of the screen.
- *
- * @return GList pointer to the top row in the children list, or NULL.
- */
-GList *
-gui_internal_widget_table_top_row(struct gui_priv *this, struct widget * table)
-{
- if(table && table->type==widget_table) {
- struct table_data *d=table->data;
- return gui_internal_widget_table_first_row(d->top_row);
- }
- return NULL;
-}
-
-/**
- * @brief Sets internal top row pointer of the table to point to a given row widget.
- *
- * @return GList pointer to the top row in the children list of the table.
- */
-GList *
-gui_internal_widget_table_set_top_row(struct gui_priv *this, struct widget * table, struct widget *row)
-{
- if(table && table->type==widget_table) {
- struct table_data *d=table->data;
- d->top_row=table->children;
- while(d->top_row && d->top_row->data!=row)
- d->top_row=g_list_next(d->top_row);
- if(!d->top_row)
- d->top_row=gui_internal_widget_table_first_row(table->children);
- return d->top_row;
- }
- return NULL;
-}
-
-
-/**
- * @brief Creates a new table_row widget.
- *
- * @param this The graphics context
- * @param flags Sizing flags for the row
- *
- * @return The new table_row widget.
- */
-struct widget *
-gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags)
-{
- struct widget * widget = g_new0(struct widget,1);
- widget->type=widget_table_row;
- widget->flags=flags;
- return widget;
-}
-
-
-
-/**
- * @brief Computes the column dimensions for the table.
- *
- * @param this The internal GUI instance
- * @param w The table widget to compute dimensions for.
- *
- * This function examines all of the rows and columns for the table w
- * and returns a list (GList) of table_column_desc elements that
- * describe each column of the table.
- *
- * The caller is responsible for freeing the returned list.
- */
-static GList *
-gui_internal_compute_table_dimensions(struct gui_priv * this,struct widget * w)
-{
-
- GList * column_desc = NULL;
- GList * current_desc=NULL;
- GList * cur_row = w->children;
- struct widget * cur_row_widget=NULL;
- GList * cur_column=NULL;
- struct widget * cell_w=NULL;
- struct table_column_desc * current_cell=NULL;
- struct table_data * table_data=NULL;
- int height=0;
- int width=0;
- int total_width=0;
- int column_count=0;
-
- /*
- * Scroll through the the table and
- * 1. Compute the maximum width + height of each column across all rows.
- */
- table_data = (struct table_data*) w->data;
- for(cur_row=w->children; cur_row ; cur_row = g_list_next(cur_row) )
- {
- cur_row_widget = (struct widget*) cur_row->data;
- current_desc = column_desc;
- if(cur_row_widget == table_data->scroll_buttons.button_box)
- {
- continue;
- }
- column_count=0;
- for(cur_column = cur_row_widget->children; cur_column;
- cur_column=g_list_next(cur_column))
- {
- cell_w = (struct widget*) cur_column->data;
- gui_internal_widget_pack(this,cell_w);
- if(current_desc == 0)
- {
- current_cell = g_new0(struct table_column_desc,1);
- column_desc = g_list_append(column_desc,current_cell);
- current_desc = g_list_last(column_desc);
- current_cell->height=cell_w->h;
- current_cell->width=cell_w->w;
- total_width+=cell_w->w;
-
- }
- else
- {
- current_cell = current_desc->data;
- height = cell_w->h;
- width = cell_w->w;
- if(current_cell->height < height )
- {
- current_cell->height = height;
- }
- if(current_cell->width < width)
- {
- total_width += (width-current_cell->width);
- current_cell->width = width;
-
-
-
- }
- current_desc = g_list_next(current_desc);
- }
- column_count++;
-
- }/* column loop */
-
- } /*row loop */
-
-
- /*
- * If the width of all columns is less than the width off
- * the table expand each cell proportionally.
- *
- */
- if(total_width+(this->spacing*column_count) < w->w ) {
- for(current_desc=column_desc; current_desc; current_desc=g_list_next(current_desc)) {
- current_cell = (struct table_column_desc*) current_desc->data;
- current_cell->width= ( (current_cell->width+this->spacing)/(float)total_width) * w->w ;
- }
- }
-
- return column_desc;
-}
-
-
-/**
- * @brief Computes the height and width for the table.
- *
- * The height and width are computed to display all cells in the table
- * at the requested height/width.
- *
- * @param this The graphics context
- * @param w The widget to pack.
- */
-void
-gui_internal_table_pack(struct gui_priv * this, struct widget * w)
-{
-
- int height=0;
- int width=0;
- int count=0;
- GList * column_data = gui_internal_compute_table_dimensions(this,w);
- GList * current=0;
- struct table_column_desc * cell_desc=0;
- struct table_data * table_data = (struct table_data*)w->data;
-
- for(current = column_data; current; current=g_list_next(current))
- {
- if(table_data->scroll_buttons.button_box == current->data )
- {
- continue;
- }
- cell_desc = (struct table_column_desc *) current->data;
- width = width + cell_desc->width + this->spacing;
- if(height < cell_desc->height)
- {
- height = cell_desc->height ;
- }
- }
-
-
-
- for(current=w->children; current; current=g_list_next(current))
- {
- if(current->data!= table_data->scroll_buttons.button_box)
- {
- count++;
- }
- }
-
- w->w = width;
- if(w->w + w->c.x > this->root.w)
- {
- w->w = this->root.w - w->c.x;
- }
-
-
- if(w->h + w->c.y > this->root.h )
- {
- /*
- * Do not allow the widget to exceed the screen.
- *
- */
- w->h = this->root.h- w->c.y - height;
- }
-
- if (table_data->scroll_buttons.button_box)
- {
- gui_internal_widget_pack(this,table_data->scroll_buttons.button_box);
- }
-
-
- /*
- * Deallocate column descriptions.
- */
- g_list_foreach(column_data,(GFunc)g_free,NULL);
- g_list_free(column_data);
-}
-
-
-
-
-/**
- * @brief Invalidates coordinates for previously rendered table widget rows.
- *
- * @param table_data Data from the table object.
- */
-void
-gui_internal_table_hide_rows(struct table_data * table_data)
-{
- GList*cur_row;
- for(cur_row=table_data->top_row; cur_row ; cur_row = g_list_next(cur_row))
- {
- struct widget * cur_row_widget = (struct widget*)cur_row->data;
- if (cur_row_widget->type!=widget_table_row)
- continue;
- cur_row_widget->p.x=0;
- cur_row_widget->p.y=0;
- cur_row_widget->w=0;
- cur_row_widget->h=0;
- if(cur_row==table_data->bottom_row)
- break;
- }
-}
-
-
-/**
- * @brief Renders a table widget.
- *
- * @param this The graphics context
- * @param w The table widget to render.
- */
-void
-gui_internal_table_render(struct gui_priv * this, struct widget * w)
-{
-
- int x;
- int y;
- GList * column_desc=NULL;
- GList * cur_row = NULL;
- GList * current_desc=NULL;
- struct table_data * table_data = (struct table_data*)w->data;
- int drawing_space_left=1;
- int is_first_page;
- struct table_column_desc * dim=NULL;
-
- dbg_assert(table_data);
- column_desc = gui_internal_compute_table_dimensions(this,w);
- if(!column_desc)
- return;
- y=w->p.y;
- gui_internal_table_hide_rows(table_data);
- /*
- * Skip rows that are on previous pages.
- */
- if(table_data->top_row && table_data->top_row != w->children && !table_data->scroll_buttons.button_box_hide)
- {
- cur_row = table_data->top_row;
- is_first_page=0;
- } else {
- cur_row = w->children;
- table_data->top_row=NULL;
- is_first_page=1;
- }
-
- /* First, let's mark all columns as off-screen that are in rows which are *before*
- * our current page.
- * */
- GList *row = w->children;
- while (row != cur_row) {
- struct widget * cur_row_widget = (struct widget*)row->data;
- GList * cur_column=NULL;
- if(cur_row_widget == table_data->scroll_buttons.button_box)
- {
- row = g_list_next(row);
- continue;
- }
- for(cur_column = cur_row_widget->children; cur_column;
- cur_column=g_list_next(cur_column))
- {
- struct widget * cur_widget = (struct widget*) cur_column->data;
- if(this->hide_keys){
- cur_widget->state |= STATE_INVISIBLE;
- cur_widget->state &= ~STATE_SENSITIVE;
- }else{
- cur_widget->state |= STATE_OFFSCREEN;
- }
- }
- row = g_list_next(row);
- }
-
- /*
- * Loop through each row. Drawing each cell with the proper sizes,
- * at the proper positions.
- */
- for(table_data->top_row=cur_row; cur_row; cur_row = g_list_next(cur_row))
- {
- int max_height=0, bbox_height=0;
- struct widget * cur_row_widget;
- GList * cur_column=NULL;
- current_desc = column_desc;
- cur_row_widget = (struct widget*)cur_row->data;
- x =w->p.x+this->spacing;
- if(cur_row_widget == table_data->scroll_buttons.button_box)
- {
- continue;
- }
- dim = (struct table_column_desc*)current_desc->data;
-
- if (table_data->scroll_buttons.button_box && !table_data->scroll_buttons.button_box_hide)
- bbox_height=table_data->scroll_buttons.button_box->h;
-
- if( y + dim->height + bbox_height + this->spacing >= w->p.y + w->h )
- {
- drawing_space_left=0;
- }
- for(cur_column = cur_row_widget->children; cur_column;
- cur_column=g_list_next(cur_column))
- {
- struct widget * cur_widget = (struct widget*) cur_column->data;
- if (drawing_space_left) {
- cur_widget->p.x=x;
- cur_widget->w=dim->width;
- cur_widget->p.y=y;
- cur_widget->h=dim->height;
- x=x+cur_widget->w;
- max_height = dim->height;
- /* We pack the widget before rendering to ensure that the x and y
- * coordinates get pushed down.
- */
- if(this->hide_keys){
- cur_widget->state &= ~STATE_INVISIBLE;
- cur_widget->state |= STATE_SENSITIVE;
- }else{
- cur_widget->state &= ~STATE_OFFSCREEN;
- }
- gui_internal_widget_pack(this,cur_widget);
- gui_internal_widget_render(this,cur_widget);
-
- if(dim->height > max_height)
- {
- max_height = dim->height;
- }
- } else {
- /* Deactivate contents that we don't have space for. */
- if(this->hide_keys){
- cur_widget->state |= STATE_INVISIBLE;
- cur_widget->state &= ~STATE_SENSITIVE;
- }else{
- cur_widget->state |= STATE_OFFSCREEN;
- }
- }
- }
-
- if (drawing_space_left) {
- /* Row object should have its coordinates in actual
- * state to be able to pass mouse clicks to Column objects
- */
- cur_row_widget->p.x=w->p.x;
- cur_row_widget->w=w->w;
- cur_row_widget->p.y=y;
- cur_row_widget->h=max_height;
- y = y + max_height;
- table_data->bottom_row=cur_row;
- current_desc = g_list_next(current_desc);
- }
- }
-
- /* By default, hide all scroll buttons. */
- if(this->hide_keys){
- table_data->scroll_buttons.next_button->state|= STATE_INVISIBLE;
- table_data->scroll_buttons.prev_button->state|= STATE_INVISIBLE;
- }
- table_data->scroll_buttons.next_button->state&= ~STATE_SENSITIVE;
- table_data->scroll_buttons.prev_button->state&= ~STATE_SENSITIVE;
-
- if(table_data->scroll_buttons.button_box && (!drawing_space_left || !is_first_page) && !table_data->scroll_buttons.button_box_hide )
- {
- table_data->scroll_buttons.button_box->p.y =w->p.y+w->h-table_data->scroll_buttons.button_box->h -
- this->spacing;
- if(table_data->scroll_buttons.button_box->p.y < y )
- {
- table_data->scroll_buttons.button_box->p.y=y;
- }
- table_data->scroll_buttons.button_box->p.x = w->p.x;
- table_data->scroll_buttons.button_box->w = w->w;
- gui_internal_widget_pack(this,table_data->scroll_buttons.button_box);
- if(table_data->scroll_buttons.next_button->p.y > w->p.y + w->h + table_data->scroll_buttons.next_button->h)
- {
- table_data->scroll_buttons.button_box->p.y = w->p.y + w->h -
- table_data->scroll_buttons.button_box->h;
- }
- if(!drawing_space_left)
- {
- table_data->scroll_buttons.next_button->state|= STATE_SENSITIVE;
- table_data->scroll_buttons.next_button->state&= ~STATE_INVISIBLE;
- }
-
- if(table_data->top_row != w->children)
- {
- table_data->scroll_buttons.prev_button->state|= STATE_SENSITIVE;
- table_data->scroll_buttons.prev_button->state&= ~STATE_INVISIBLE;
- }
- gui_internal_widget_render(this,table_data->scroll_buttons.button_box);
- }
-
- /*
- * Deallocate column descriptions.
- */
- g_list_foreach(column_desc,(GFunc)g_free,NULL);
- g_list_free(column_desc);
-}
-
-/**
- * @brief Handles the 'next page' table event.
- *
- * A callback function that is invoked when the 'next page' button is pressed
- * to advance the contents of a table widget.
- *
- * @param this The graphics context.
- * @param wm The button widget that was pressed.
- * @param data
- */
-void
-gui_internal_table_button_next(struct gui_priv * this, struct widget * wm, void *data)
-{
- struct widget * table_widget=NULL;
- struct table_data * table_data = NULL;
-
- if(wm)
- table_widget = (struct widget * ) wm->data;
- else
- table_widget = data;
-
- if(table_widget && table_widget->type==widget_table)
- table_data = (struct table_data*) table_widget->data;
-
- if(table_data)
- {
- GList *l=g_list_next(table_data->bottom_row);
- if(l) {
- gui_internal_table_hide_rows(table_data);
- table_data->top_row=l;
- }
- }
-
- if(wm)
- wm->state&= ~STATE_HIGHLIGHTED;
-
- gui_internal_menu_render(this);
-}
-
-
-
-/**
- * @brief Handles the 'previous page' table event.
- *
- * A callback function that is invoked when the 'previous page' button is pressed
- * to go back in the contents of a table widget.
- *
- * @param this The graphics context.
- * @param wm The button widget that was pressed.
- */
-void
-gui_internal_table_button_prev(struct gui_priv * this, struct widget * wm, void *data)
-{
- struct widget * table_widget = NULL;
- struct table_data * table_data = NULL;
-
- if(wm)
- table_widget=(struct widget * ) wm->data;
- else
- table_widget=(struct widget * ) data;
-
- if(table_widget && table_widget->type==widget_table)
- table_data = (struct table_data*) table_widget->data;
-
- if(table_data) {
- int bottomy=table_widget->p.y+table_widget->h;
- int n;
- GList *top=table_data->top_row;
- struct widget *w=(struct widget*)top->data;
- if(table_data->scroll_buttons.button_box->p.y!=0) {
- bottomy=table_data->scroll_buttons.button_box->p.y;
- }
- n=(bottomy-w->p.y)/w->h;
- while(n-- > 0 && (top=g_list_previous(top))!=NULL);
- gui_internal_table_hide_rows(table_data);
- table_data->top_row=top;
- }
- if(wm)
- wm->state&= ~STATE_HIGHLIGHTED;
- gui_internal_menu_render(this);
-}
-
-
-/**
- * @brief Deallocates a table_data structure.
- *
- * @note button_box and its children (next_button,prev_button)
- * have their memory managed by the table itself.
- *
- * @param p The table_data structure
- */
-void gui_internal_table_data_free(void * p)
-{
- g_free(p);
-}
diff --git a/navit/gui/internal/gui_internal_widget.h b/navit/gui/internal/gui_internal_widget.h
deleted file mode 100644
index 33f03e478..000000000
--- a/navit/gui/internal/gui_internal_widget.h
+++ /dev/null
@@ -1,193 +0,0 @@
-enum gui_internal_reason {
- gui_internal_reason_click=1,
- gui_internal_reason_keypress,
- gui_internal_reason_keypress_finish
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# 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);
-
- /**
- * @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;
-};
-
-/**
- * @brief A structure to store information about a table.
- *
- * The table_data widget stores pointers to extra information needed by the
- * table widget.
- *
- * 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 scroll_buttons scroll_buttons;
-
-};
-
-/**
- * A data structure that holds information about a column that makes up a table.
- *
- *
- */
-struct table_column_desc
-{
-
- /**
- * The computed height of a cell in the table.
- */
- int height;
-
- /**
- * The computed width of a cell in the table.
- */
- int width;
-};
-/* prototypes */
-enum flags;
-struct graphics_image;
-struct gui_priv;
-struct point;
-struct table_data;
-struct widget;
-struct widget *gui_internal_label_font_new(struct gui_priv *this, const char *text, int font);
-struct widget *gui_internal_label_new(struct gui_priv *this, const char *text);
-struct widget *gui_internal_label_new_abbrev(struct gui_priv *this, const char *text, int maxwidth);
-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_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);
-struct widget *gui_internal_box_new_with_label(struct gui_priv *this, enum flags flags, const char *label);
-struct widget *gui_internal_box_new(struct gui_priv *this, enum flags flags);
-void gui_internal_widget_reset_pack(struct gui_priv *this, struct widget *w);
-void gui_internal_widget_append(struct widget *parent, struct widget *child);
-void gui_internal_widget_prepend(struct widget *parent, struct widget *child);
-void gui_internal_widget_insert_sorted(struct widget *parent, struct widget *child, GCompareFunc func);
-void gui_internal_widget_children_destroy(struct gui_priv *this, struct widget *w);
-void gui_internal_widget_destroy(struct gui_priv *this, struct widget *w);
-void gui_internal_widget_render(struct gui_priv *this, struct widget *w);
-void gui_internal_widget_pack(struct gui_priv *this, struct widget *w);
-struct widget *gui_internal_button_label(struct gui_priv *this, const char *label, int mode);
-struct widget *gui_internal_widget_table_new(struct gui_priv *this, enum flags flags, int buttons);
-void gui_internal_widget_table_clear(struct gui_priv *this, struct widget *table);
-GList *gui_internal_widget_table_next_row(GList *row);
-GList *gui_internal_widget_table_prev_row(GList *row);
-GList *gui_internal_widget_table_first_row(GList *row);
-GList *gui_internal_widget_table_top_row(struct gui_priv *this, struct widget *table);
-GList *gui_internal_widget_table_set_top_row(struct gui_priv *this, struct widget * table, struct widget *row);
-struct widget *gui_internal_widget_table_row_new(struct gui_priv *this, enum flags flags);
-void gui_internal_table_pack(struct gui_priv *this, struct widget *w);
-void gui_internal_table_hide_rows(struct table_data *table_data);
-void gui_internal_table_render(struct gui_priv *this, struct widget *w);
-void gui_internal_table_button_next(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_table_button_prev(struct gui_priv *this, struct widget *wm, void *data);
-void gui_internal_table_data_free(void *p);
-/* end of prototypes */
diff --git a/navit/gui/qml/CMakeLists.txt b/navit/gui/qml/CMakeLists.txt
deleted file mode 100644
index 05456d9bd..000000000
--- a/navit/gui/qml/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-file(COPY "skins" DESTINATION ".")
-add_definitions( -DMODULE=gui_qml )
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-QT4_GENERATE_MOC(proxy.h ${CMAKE_CURRENT_BINARY_DIR}/proxy.moc)
-QT4_GENERATE_MOC(ngqpoint.h ${CMAKE_CURRENT_BINARY_DIR}/ngqpoint.moc)
-QT4_GENERATE_MOC(searchProxy.h ${CMAKE_CURRENT_BINARY_DIR}/searchProxy.moc)
-QT4_GENERATE_MOC(bookmarksProxy.h ${CMAKE_CURRENT_BINARY_DIR}/bookmarksProxy.moc)
-QT4_GENERATE_MOC(vehicleProxy.h ${CMAKE_CURRENT_BINARY_DIR}/vehicleProxy.moc)
-QT4_GENERATE_MOC(navitProxy.h ${CMAKE_CURRENT_BINARY_DIR}/navitProxy.moc)
-QT4_GENERATE_MOC(guiProxy.h ${CMAKE_CURRENT_BINARY_DIR}/guiProxy.moc)
-QT4_GENERATE_MOC(routeProxy.h ${CMAKE_CURRENT_BINARY_DIR}/routeProxy.moc)
-QT4_GENERATE_MOC(gui_qml.cpp ${CMAKE_CURRENT_BINARY_DIR}/gui_qml.moc)
-module_add_library(gui_qml gui_qml.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/proxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/ngqpoint.moc
- ${CMAKE_CURRENT_BINARY_DIR}/searchProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/bookmarksProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/vehicleProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/navitProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/guiProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/routeProxy.moc
- ${CMAKE_CURRENT_BINARY_DIR}/gui_qml.moc
-)
diff --git a/navit/gui/qml/bookmarksProxy.h b/navit/gui/qml/bookmarksProxy.h
deleted file mode 100644
index 03cbcbc88..000000000
--- a/navit/gui/qml/bookmarksProxy.h
+++ /dev/null
@@ -1,171 +0,0 @@
-#ifndef NAVIT_GUI_QML_BOOKMARKSPROXY_H
-#define NAVIT_GUI_QML_BOOKMARKSPROXY_H
-
-class NGQProxyBookmarks : public NGQProxy {
- Q_OBJECT;
-
-public:
- NGQProxyBookmarks(struct gui_priv* object, QObject* parent) : NGQProxy(object,parent) { };
-
-public slots:
- void moveRoot() {
- struct attr mattr;
- navit_get_attr(this->object->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_move_root(mattr.u.bookmarks);
- }
- void moveUp() {
- struct attr mattr;
- navit_get_attr(this->object->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_move_up(mattr.u.bookmarks);
- }
- void moveDown(QString path) {
- struct attr mattr;
- navit_get_attr(this->object->nav, attr_bookmarks, &mattr, NULL);
- bookmarks_move_down(mattr.u.bookmarks,path.toLocal8Bit().constData());
- }
-
- QString getBookmarks() {
- struct attr attr,mattr;
- struct item* item;
- struct coord c;
- QDomDocument retDoc("bookmarks");
- QDomElement entries;
-
- entries=retDoc.createElement("bookmarks");
- retDoc.appendChild(entries);
-
- navit_get_attr(this->object->nav, attr_bookmarks, &mattr, NULL);
-
- if (bookmarks_item_cwd(mattr.u.bookmarks)) {
- QDomElement entry=retDoc.createElement("bookmark");
- entry.appendChild(this->_fieldValueHelper(retDoc,"label",".."));
- entry.appendChild(this->_fieldValueHelper(retDoc,"path",".."));
- entry.appendChild(this->_fieldValueHelper(retDoc,"type",QString(item_to_name(type_bookmark_folder))));
- entry.appendChild(this->_fieldValueHelper(retDoc,"distance",""));
- entry.appendChild(this->_fieldValueHelper(retDoc,"direction",""));
- entry.appendChild(this->_fieldValueHelper(retDoc,"coords",QString("%1 %2").arg(0).arg(0)));
- entries.appendChild(entry);
- }
-
- bookmarks_item_rewind(mattr.u.bookmarks);
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
- QString label;
- QString path;
-
- if (item->type != type_bookmark && item->type != type_bookmark_folder) continue;
- if (!item_attr_get(item, attr_label, &attr)) continue;
- label=QString::fromLocal8Bit(attr.u.str);
- if (!item_attr_get(item, attr_path, &attr)) {
- path="";
- }
- path=QString::fromLocal8Bit(attr.u.str);
- item_coord_get(item, &c, 1);
- QDomElement entry=retDoc.createElement("bookmark");
- entry.appendChild(this->_fieldValueHelper(retDoc,"label",label));
- entry.appendChild(this->_fieldValueHelper(retDoc,"path",path));
- entry.appendChild(this->_fieldValueHelper(retDoc,"type",QString(item_to_name(item->type))));
- //entry.appendChild(this->_fieldValueHelper(retDoc,"distance",QString::number(idist/1000)));
- entry.appendChild(this->_fieldValueHelper(retDoc,"distance","100500"));
- //entry.appendChild(this->_fieldValueHelper(retDoc,"direction",dirbuf));
- entry.appendChild(this->_fieldValueHelper(retDoc,"direction","nahut"));
- entry.appendChild(this->_fieldValueHelper(retDoc,"coords",QString("%1 %2").arg(c.x).arg(c.y)));
- entries.appendChild(entry);
- }
-
- dbg(lvl_info,"%s\n",retDoc.toString().toLocal8Bit().constData());
- return retDoc.toString();
- }
- QString AddFolder(QString description) {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_add_bookmark(attr.u.bookmarks, NULL, description.toLocal8Bit().constData()) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- QString AddBookmark(QString description) {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_add_bookmark(attr.u.bookmarks, this->object->currentPoint->pc(), description.toLocal8Bit().constData()) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- QString Cut(QString description) {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_cut_bookmark(attr.u.bookmarks, description.toLocal8Bit().constData()) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- QString Copy(QString description) {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_copy_bookmark(attr.u.bookmarks, description.toLocal8Bit().constData()) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- QString Paste() {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_paste_bookmark(attr.u.bookmarks) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- QString Delete(QString bookmark) {
- struct attr attr;
- navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
- if (!bookmarks_delete_bookmark(attr.u.bookmarks, bookmark.toLocal8Bit().constData()) ) {
- return "Failed!";
- } else {
- return "Success";
- }
- }
- void setPoint(QString bookmark) {
- struct attr attr, mattr;
- struct item* item;
- struct coord c;
-
- navit_get_attr(this->object->nav, attr_bookmarks, &mattr, NULL);
-
- bookmarks_item_rewind(mattr.u.bookmarks);
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
- QString label;
-
- if (item->type != type_bookmark) continue;
- if (!item_attr_get(item, attr_label, &attr)) continue;
-
- label=QString::fromLocal8Bit(attr.u.str);
- dbg(lvl_debug,"Bookmark is %s\n",bookmark.toStdString().c_str());
- if (label.compare(bookmark)) continue;
- item_coord_get(item, &c, 1);
- if (this->object->currentPoint!=NULL) {
- delete this->object->currentPoint;
- }
- this->object->currentPoint=new NGQPoint(this->object,&c,bookmark,Bookmark,NULL);
- this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
- }
-
- return;
- }
-
-protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) { return 0; }
- int setAttrFunc(struct attr* attr) {return 0; }
- struct attr_iter* getIterFunc() { return NULL; };
- void dropIterFunc(struct attr_iter* iter) { return; };
-
-private:
-};
-
-#include "bookmarksProxy.moc"
-
-#endif /* NAVIT_GUI_QML_BOOKMARKSPROXY_H */
diff --git a/navit/gui/qml/guiProxy.h b/navit/gui/qml/guiProxy.h
deleted file mode 100644
index 7648eb5b3..000000000
--- a/navit/gui/qml/guiProxy.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef NAVIT_GUI_QML_GUIPROXY_H
-#define NAVIT_GUI_QML_GUIPROXY_H
-
-class NGQProxyGui : public NGQProxy {
- Q_OBJECT;
-
- Q_PROPERTY(QString iconPath READ iconPath CONSTANT);
-
- Q_PROPERTY(QString commandFunction READ commandFunction CONSTANT);
-
- Q_PROPERTY(QString localeName READ localeName CONSTANT);
- Q_PROPERTY(QString langName READ langName CONSTANT);
- Q_PROPERTY(QString ctryName READ ctryName CONSTANT);
-
- Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthSignal STORED false);
- Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightSignal STORED false);
-
-private:
- QStringList returnPath;
-
-public:
- NGQProxyGui(struct gui_priv* this_,QObject *parent) : NGQProxy(this_, parent) {
- this->source=QString("");
- }
-
- void setNewPoint(struct point* p,NGQPointTypes type) {
- if (this->object->currentPoint!=NULL) {
- delete this->object->currentPoint;
- }
- this->object->currentPoint = new NGQPoint(this->object,p,type,NULL);
- this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
- }
- void setNewPoint(struct coord* c,NGQPointTypes type) {
- if (this->object->currentPoint!=NULL) {
- delete this->object->currentPoint;
- }
- this->object->currentPoint = new NGQPoint(this->object,c,type,NULL);
- this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
- }
- void setNewPoint(struct pcoord* pc,NGQPointTypes type) {
- if (this->object->currentPoint!=NULL) {
- delete this->object->currentPoint;
- }
- this->object->currentPoint = new NGQPoint(this->object,pc,type,NULL);
- this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
- }
- void processCommand(QString function) {
- //QDeclarativeExpression commandJS(this->object->guiWidget->rootContext(),QString(),qobject_cast<QObject*>(this->object->guiWidget->rootObject()));
- //commandJS.setSourceLocation("command.js",0);
- //this->function=function;
- //commandJS.eval(qobject_cast<QObject*>(this->object->guiWidget->rootObject()));
- }
-signals:
- void widthSignal(int);
- void heightSignal(int);
-public slots:
- void pushPage(QString page) {
- returnPath.push_front(page);
- }
- QString popPage() {
- if (!returnPath.empty()) {
- if (returnPath.length()>1) {
- returnPath.pop_front();
- }
- return returnPath.first();
- }
- return QString();
- }
- int lengthPage() {
- return returnPath.length();
- }
- void backToMap() {
- if (this->object->graphicsWidget) {
- this->object->graphicsWidget->setFocus(Qt::ActiveWindowFocusReason);
- this->object->switcherWidget->setCurrentWidget(this->object->graphicsWidget);
- this->object->graphicsWidget->show();
- }
- }
- void switchToMenu(struct point* p) {
- if (!this->object->lazy) {
- this->returnPath.clear();
- this->object->guiWidget->setSource(QUrl::fromLocalFile(QString(this->object->source)+"/"+this->object->skin+"/main.qml"));
- }
- this->setNewPoint(p,MapPoint);
- this->object->guiWidget->setFocus(Qt::ActiveWindowFocusReason);
- this->object->switcherWidget->setCurrentWidget(this->object->guiWidget);
-
- }
- //Properties
- QString iconPath() {
- return QString(this->object->icon_src);
- }
- int width() {
- return this->object->w;
- }
- void setWidth(int w) {
- this->object->w=w;
- this->widthSignal(w);
- }
- int height() {
- return this->object->h;
- }
- void setHeight(int h) {
- this->object->h=h;
- this->heightSignal(h);
- }
- QString commandFunction() {
- return this->function;
- }
-
- //Locale properties
- QString localeName() {
- return QString()+"LANG="+getenv("LANG");
- }
- QString langName() {
-#ifdef HAVE_API_WIN32_BASE
- char str[32];
-
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, str, sizeof(str));
- return QString()+"LOCALE_SABBREVLANGNAME="+str;
-#else
- return QString();
-#endif
- }
- QString ctryName() {
-#ifdef HAVE_API_WIN32_BASE
- char str[32];
-
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, str, sizeof(str));
- return QString()+"LOCALE_SABBREVCTRYNAME="+str;
-#else
- return QString();
-#endif
- }
-protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) { return gui_get_attr(this->object->gui, type, attr, iter); }
- int setAttrFunc(struct attr* attr) {return gui_set_attr(this->object->gui,attr); }
-private:
- QString source;
- QString function;
-};
-
-void __setNewPoint(struct gui_priv* this_,struct coord* c, NGQPointTypes type) {
- this_->guiProxy->setNewPoint(c,type);
-}
-void __setNewPoint(struct gui_priv* this_,struct pcoord* pc, NGQPointTypes type) {
- this_->guiProxy->setNewPoint(pc,type);
-}
-
-#include "guiProxy.moc"
-
-#endif /* NAVIT_GUI_QML_GUIPROXY_H */
diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp
deleted file mode 100644
index 3efc719dd..000000000
--- a/navit/gui/qml/gui_qml.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-#include <glib.h>
-#include <QtCore>
-#include <QtGui>
-#include <QtDeclarative>
-#include <QtXml>
-#include "config.h"
-#ifdef HAVE_API_WIN32_BASE
-#include <windows.h>
-#endif
-#include "plugin.h"
-#include "item.h"
-#include "attr.h"
-#include "xmlconfig.h"
-#include "color.h"
-#include "gui.h"
-#include "callback.h"
-#include "debug.h"
-#include "navit.h"
-#include "point.h"
-#include "graphics.h"
-#include "event.h"
-#include "map.h"
-#include "coord.h"
-#include "vehicle.h"
-#include "coord.h"
-#include "transform.h"
-#include "mapset.h"
-#include "route.h"
-#include "country.h"
-#include "track.h"
-#include "search.h"
-#include "bookmarks.h"
-#include "command.h"
-#include "keys.h"
-
-#include "layout.h"
-
-struct gui_priv {
- struct navit *nav;
- struct gui *gui;
- struct attr self;
- struct vehicle* currVehicle;
-
- //configuration items
- int fullscreen;
- int menu_on_map_click;
- int signal_on_map_click;
- int w;
- int h;
- char *source;
- char *skin;
- char* icon_src;
- int radius;
- int pitch;
- int lazy; //When TRUE - menu state will not be changed during map/menu switches, FALSE - menu will be always reset to main.qml
-
- //Interface stuff
- struct callback_list *cbl;
- QCoreApplication *app;
- struct window *win;
- struct graphics *gra;
- QWidget *mainWindow;
- QWidget *graphicsWidget;
- QDeclarativeView *guiWidget;
- QDeclarativeView *prevGuiWidget;
- QStackedLayout *switcherWidget;
- struct callback *button_cb;
- struct callback *motion_cb;
- struct callback *resize_cb;
- struct callback *keypress_cb;
- struct callback *window_closed_cb;
-
- //Proxy objects
- class NGQProxyGui* guiProxy;
- class NGQProxyNavit* navitProxy;
- class NGQProxyVehicle* vehicleProxy;
- class NGQProxySearch* searchProxy;
- class NGQProxyBookmarks* bookmarksProxy;
- class NGQProxyRoute* routeProxy;
- class NGQPoint* currentPoint;
-};
-
-#include "proxy.h"
-#include "ngqpoint.h"
-#include "searchProxy.h"
-#include "routeProxy.h"
-#include "bookmarksProxy.h"
-#include "vehicleProxy.h"
-#include "navitProxy.h"
-#include "guiProxy.h"
-
-//Main window class for resizeEvent handling
-#ifdef Q_WS_X11
-#include <QX11EmbedWidget>
-class NGQMainWindow : public QX11EmbedWidget
-{
-#else
-class NGQMainWindow : public QWidget
-{
-#endif /* Q_WS_X11 */
-public:
-
-#ifdef Q_WS_X11
- NGQMainWindow(struct gui_priv* this_,QWidget *parent) : QX11EmbedWidget(parent) {
-#else
- NGQMainWindow(struct gui_priv* this_,QWidget *parent) : QWidget(parent) {
-#endif /* Q_WS_X11 */
- this->object=this_;
- }
-protected:
- void resizeEvent(QResizeEvent *) {
- this->object->w=this->width();
- this->object->h=this->height();
- //YES, i KNOW about signal/slot thing
- this->object->guiProxy->setWidth(this->width());
- this->object->guiProxy->setHeight(this->height());
- }
- void closeEvent(QCloseEvent* event) {
- this->object->graphicsWidget->close();
- }
-private:
- struct gui_priv* object;
-};
-
-//Meta object
-#include "gui_qml.moc"
-
-static void gui_qml_dbus_signal(struct gui_priv *this_, struct point *p)
-{
- struct displaylist_handle *dlh;
- struct displaylist *display;
- struct displayitem *di;
-
- display=navit_get_displaylist(this_->nav);
- dlh=graphics_displaylist_open(display);
- while ((di=graphics_displaylist_next(dlh))) {
- struct item *item=graphics_displayitem_get_item(di);
- if (item_is_point(*item) && graphics_displayitem_get_displayed(di) &&
- graphics_displayitem_within_dist(display, di, p, 10)) {
- struct map_rect *mr=map_rect_new(item->map, NULL);
- struct item *itemo=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- struct attr attr;
- if (item_attr_get(itemo, attr_data, &attr)) {
- struct attr cb,*attr_list[2];
- int valid=0;
- attr.type=attr_data;
- attr_list[0]=&attr;
- attr_list[1]=NULL;
- if (navit_get_attr(this_->nav, attr_callback_list, &cb, NULL))
- callback_list_call_attr_4(cb.u.callback_list, attr_command, "dbus_send_signal", attr_list, NULL, &valid);
- }
- map_rect_destroy(mr);
- }
- }
- graphics_displaylist_close(dlh);
-}
-
-static void gui_qml_button(void *data, int pressed, int button, struct point *p)
-{
- struct gui_priv *this_=(struct gui_priv*)data;
-
- // check whether the position of the mouse changed during press/release OR if it is the scrollwheel
- if (!navit_handle_button(this_->nav, pressed, button, p, NULL)) {
- dbg(lvl_debug,"navit has handled button\n");
- return;
- }
-
- dbg(lvl_debug,"enter %d %d\n", pressed, button);
- if (this_->signal_on_map_click) {
- gui_qml_dbus_signal(this_, p);
- return;
- }
-
- if ( button == 1 && this_->menu_on_map_click ) {
- this_->guiProxy->switchToMenu(p);
- }
-}
-
-static void gui_qml_motion(void *data, struct point *p)
-{
- struct gui_priv *this_=(struct gui_priv*)data;
- navit_handle_motion(this_->nav, p);
- return;
-}
-static void gui_qml_resize(void *data, int w, int h)
-{
- struct gui_priv *this_=(struct gui_priv*)data;
- navit_handle_resize(this_->nav, w, h);
-}
-
-static void gui_qml_keypress(void *data, char *key)
-{
- struct gui_priv *this_=(struct gui_priv*) data;
- int w,h;
- struct point p;
- transform_get_size(navit_get_trans(this_->nav), &w, &h);
- switch (*key) {
- case NAVIT_KEY_UP:
- p.x=w/2;
- p.y=0;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_DOWN:
- p.x=w/2;
- p.y=h;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_LEFT:
- p.x=0;
- p.y=h/2;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_RIGHT:
- p.x=w;
- p.y=h/2;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_ZOOM_IN:
- navit_zoom_in(this_->nav, 2, NULL);
- break;
- case NAVIT_KEY_ZOOM_OUT:
- navit_zoom_out(this_->nav, 2, NULL);
- break;
- case NAVIT_KEY_RETURN:
- case NAVIT_KEY_MENU:
- p.x=w/2;
- p.y=h/2;
- this_->guiProxy->switchToMenu(&p);
- break;
- }
- return;
-}
-
-static void
-gui_qml_window_closed(struct gui_priv *data)
-{
- struct gui_priv *this_=(struct gui_priv*) data;
- this_->navitProxy->quit();
-}
-//GUI interface calls
-static int argc=1;
-static char *argv[]={(char *)"navit",NULL};
-
-static int gui_qml_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- QString xid;
- NGQMainWindow* _mainWindow;
- bool ok;
-
- this_->gra=gra;
-
- //Check if we are already in Qt environment
- if (QApplication::instance()==NULL) {
- //Not yet
- this_->app=new QApplication(argc,argv);
- } else {
- this_->app=QApplication::instance();
- }
-
- //Link graphics events
- this_->button_cb=callback_new_attr_1(callback_cast(gui_qml_button), attr_button, this_);
- graphics_add_callback(gra, this_->button_cb);
- this_->motion_cb=callback_new_attr_1(callback_cast(gui_qml_motion), attr_motion, this_);
- graphics_add_callback(gra, this_->motion_cb);
- this_->resize_cb=callback_new_attr_1(callback_cast(gui_qml_resize), attr_resize, this_);
- graphics_add_callback(gra, this_->resize_cb);
- this_->keypress_cb=callback_new_attr_1(callback_cast(gui_qml_keypress), attr_keypress, this_);
- graphics_add_callback(gra, this_->keypress_cb);
- this_->window_closed_cb=callback_new_attr_1(callback_cast(gui_qml_window_closed), attr_window_closed, this_);
- graphics_add_callback(gra, this_->window_closed_cb);
-
-
- //Create main window
- this_->switcherWidget = new QStackedLayout();
- _mainWindow = new NGQMainWindow(this_, NULL);
-#ifdef Q_WS_X11
- xid=getenv("NAVIT_XID");
- if (xid.length()>0) {
- _mainWindow->embedInto(xid.toULong(&ok,0));
- }else{
- dbg(lvl_error, "\nFATAL: Environment variable NAVIT_XID not set.\n"
- " Please set NAVIT_XID to the window ID of the window to embed into.\n");
- exit(1);
- }
-#endif /* Q_WS_X11 */
- this_->mainWindow=_mainWindow;
- if ( this_->w && this_->h ) {
- this_->mainWindow->resize(this_->w,this_->h);
- }
- if ( this_->fullscreen ) {
- this_->mainWindow->showFullScreen();
- }
-
- this_->mainWindow->setLayout(this_->switcherWidget);
-
- //Create proxy object and bind them to gui widget
- this_->guiProxy = new NGQProxyGui(this_,this_->mainWindow);
- this_->navitProxy = new NGQProxyNavit(this_,this_->mainWindow);
- this_->vehicleProxy = new NGQProxyVehicle(this_,this_->mainWindow);
- this_->searchProxy = new NGQProxySearch(this_,this_->mainWindow);
- this_->bookmarksProxy = new NGQProxyBookmarks(this_,this_->mainWindow);
- this_->routeProxy = new NGQProxyRoute(this_,this_->mainWindow);
-
- //Check, if we have compatible graphics
- this_->graphicsWidget = (QWidget*)graphics_get_data(gra,"qt_widget");
- if (this_->graphicsWidget == NULL ) {
- this_->graphicsWidget = new QLabel(QString("Sorry, current graphics type is incompatible with this gui."));
- }
- this_->switcherWidget->addWidget(this_->graphicsWidget);
-
- //Instantiate qml components
- this_->guiWidget = new QDeclarativeView(NULL);
- this_->guiWidget->setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- this_->guiWidget->rootContext()->setContextProperty("gui",this_->guiProxy);
- this_->guiWidget->rootContext()->setContextProperty("navit",this_->navitProxy);
- this_->guiWidget->rootContext()->setContextProperty("vehicle",this_->vehicleProxy);
- this_->guiWidget->rootContext()->setContextProperty("search",this_->searchProxy);
- this_->guiWidget->rootContext()->setContextProperty("bookmarks",this_->bookmarksProxy);
- this_->guiWidget->rootContext()->setContextProperty("route",this_->routeProxy);
- this_->guiWidget->rootContext()->setContextProperty("point",this_->currentPoint);
-
- QString mainQml = QString(this_->source)+"/"+this_->skin+"/main.qml";
- if (!QFile(mainQml).exists()){
- dbg(lvl_error, "FATAL: QML file %s not found. Navit is not installed correctly.\n", mainQml.toAscii().constData());
- exit(1);
- }
- this_->guiWidget->setSource(QUrl::fromLocalFile(mainQml));
- this_->switcherWidget->addWidget(this_->guiWidget);
-
- //Switch to graphics
- navit_draw(this_->nav);
- this_->switcherWidget->setCurrentWidget(this_->graphicsWidget);
-
- this_->mainWindow->show();
-
- return 0;
-}
-
-static int
-gui_qml_get_attr(struct gui_priv *this_, enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_fullscreen:
- attr->u.num=this_->fullscreen;
- break;
- case attr_skin:
- attr->u.str=this_->skin;
- break;
- case attr_pitch:
- attr->u.num=this_->pitch;
- break;
- case attr_radius:
- attr->u.num=this_->radius;
- break;
- default:
- return 0;
- }
- attr->type=type;
- return 1;
-}
-
-static int
-gui_qml_set_attr(struct gui_priv *this_, struct attr *attr)
-{
- switch (attr->type) {
- case attr_fullscreen:
- if (!(this_->fullscreen) && (attr->u.num)) {
- this_->mainWindow->showFullScreen();
- }
- if ((this_->fullscreen) && !(attr->u.num)) {
- this_->mainWindow->showNormal();
- }
- this_->fullscreen=attr->u.num;
- return 1;
- case attr_pitch:
- this_->pitch=attr->u.num;
- return 1;
- case attr_radius:
- this_->radius=attr->u.num;
- return 1;
- default:
- dbg(lvl_error,"unknown attr: %s\n",attr_to_name(attr->type));
- return 1;
- }
-}
-
-struct gui_methods gui_qml_methods = {
- NULL,
- NULL,
- gui_qml_set_graphics,
- NULL,
- NULL,
- NULL,
- NULL,
- gui_qml_get_attr,
- NULL,
- gui_qml_set_attr,
-};
-
-static void
-gui_qml_command(struct gui_priv *this_, char *function, struct attr **in, struct attr ***out, int *valid) {
- this_->guiProxy->processCommand(function);
-}
-
-static struct command_table commands[] = {
- {"*",command_cast(gui_qml_command)},
-};
-
-static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)
-{
- struct gui_priv *this_;
- struct attr *attr;
- *meth=gui_qml_methods;
- this_=g_new0(struct gui_priv, 1);
-
- this_->nav=nav;
- this_->gui=gui;
-
- this_->self.type=attr_gui;
- this_->self.u.gui=gui;
-
- navit_ignore_graphics_events(this_->nav, 1);
-
- this_->fullscreen = 0; //NO by default
- if( (attr=attr_search(attrs,NULL,attr_fullscreen)))
- this_->fullscreen=attr->u.num;
- this_->menu_on_map_click = 1; //YES by default;
- if( (attr=attr_search(attrs,NULL,attr_menu_on_map_click)))
- this_->menu_on_map_click=attr->u.num;
- this_->signal_on_map_click = 0; //YES by default;
- if( (attr=attr_search(attrs,NULL,attr_signal_on_map_click)))
- this_->signal_on_map_click=attr->u.num;
- this_->radius = 10; //Default value
- if( (attr=attr_search(attrs,NULL,attr_radius)))
- this_->radius=attr->u.num;
- this_->pitch = 20; //Default value
- if( (attr=attr_search(attrs,NULL,attr_pitch)))
- this_->pitch=attr->u.num;
- this_->lazy = 1; //YES by default
- if( (attr=attr_search(attrs,NULL,attr_lazy)))
- this_->lazy=attr->u.num;
- this_->w=800; //Default value
- if( (attr=attr_search(attrs,NULL,attr_width)))
- this_->w=attr->u.num;
- this_->h=600; //Default value
- if( (attr=attr_search(attrs,NULL,attr_height)))
- this_->h=attr->u.num;
- if( (attr=attr_search(attrs,NULL,attr_source)))
- this_->source=attr->u.str;
- if( (attr=attr_search(attrs,NULL,attr_skin)))
- this_->skin=attr->u.str;
- if( (attr=attr_search(attrs,NULL,attr_icon_src)))
- this_->icon_src=attr->u.str;
-
- if ( this_->source==NULL ) {
- this_->source=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"),"/gui/qml/skins",NULL);
- }
- if ( this_->skin==NULL ) {
- this_->skin=g_strdup("navit");
- }
- if ( this_->icon_src==NULL ) {
- this_->icon_src=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"),"/icons/",NULL);
- }
-
- if ((attr=attr_search(attrs, NULL, attr_callback_list))) {
- command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this_);
- }
-
- this_->cbl=callback_list_new();
-
- return this_;
-}
-
-void plugin_init(void) {
- plugin_register_category_gui("qml",gui_qml_new);
-}
diff --git a/navit/gui/qml/navitProxy.h b/navit/gui/qml/navitProxy.h
deleted file mode 100644
index 423863b0e..000000000
--- a/navit/gui/qml/navitProxy.h
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifndef NAVIT_GUI_QML_NAVIT_H
-#define NAVIT_GUI_QML_NAVIT_H
-
-void __setNewPoint(struct gui_priv* this_,struct coord* c, NGQPointTypes type);
-
-class NGQProxyNavit : public NGQProxy {
- Q_OBJECT;
-
-public:
- NGQProxyNavit(struct gui_priv* object, QObject* parent) : NGQProxy(object,parent) { };
-
-public slots:
- void quit() {
- struct attr navit;
- navit.type=attr_navit;
- navit.u.navit=this->object->nav;
- navit_destroy(navit.u.navit);
- event_main_loop_quit();
- }
- void setObjectByName(const QString& attr_name,const QString& attr_value) {
- if (attr_name=="layout") {
- navit_set_layout_by_name(this->object->nav,attr_value.toStdString().c_str());
- }
- if (attr_name=="vehicle") {
- navit_set_vehicle_by_name(this->object->nav,attr_value.toStdString().c_str());
- }
- return;
- }
- QString getAttrList(const QString &attr_name) {
- struct attr attr;
- struct attr_iter *iter;
- int counter=0;
- QString currentValue;
- QDomDocument retDoc;
- QDomElement entries;
-
- entries=retDoc.createElement("attributes");
- retDoc.appendChild(entries);
-
- //Find current value
- getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, NULL) ;
- if (attr.type==attr_layout) {
- currentValue=attr.u.layout->name;
- }
-
- //Fill da list
- iter=getIterFunc();
- if (iter == NULL) {
- return QString();
- }
-
- while (getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, iter) ) {
- QStandardItem* curItem=new QStandardItem();
- //Listed attributes are usualy have very complex structure
- if (attr.type==attr_layout) {
- curItem->setData(QVariant(counter),NGQStandardItemModel::ItemId);
- curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemName);
- curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemValue);
- if (currentValue==attr.u.layout->name) {
- this->_itemId=counter;
- }
- }
- if (attr.type==attr_vehicle) {
- QStandardItem* curItem=new QStandardItem();
- QDomElement entry=retDoc.createElement("vehicle");
- entries.appendChild(entry);
-
- this->object->currVehicle=attr.u.vehicle;
- curItem->setData(QVariant(this->object->vehicleProxy->getAttr("name")),NGQStandardItemModel::ItemName);
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"), QString(this->object->vehicleProxy->getAttr("name"))));
-
- //Detecting current vehicle
- struct attr vehicle_attr;
- navit_get_attr(this->object->nav, attr_vehicle, &vehicle_attr, NULL);
- if (vehicle_attr.u.vehicle==attr.u.vehicle) {
- this->_itemId=counter;
- }
- }
- counter++;
- }
-
- dropIterFunc(iter);
-
- dbg(lvl_debug,QString::number(_itemId).toStdString().c_str());
-
- return retDoc.toString();
- }
- QString getDestination() {
- struct attr attr;
- struct coord c;
-
- if (getAttrFunc(attr_destination, &attr, NULL) ) {
- c.x=attr.u.pcoord->x;
- c.y=attr.u.pcoord->y;
- __setNewPoint(this->object,&c,Destination);
- return this->object->currentPoint->pointName();
- }
- return QString();
- }
- void setDestination() {
- navit_set_destination(this->object->nav,this->object->currentPoint->pc(),this->object->currentPoint->coordString().toStdString().c_str(),1);
- }
- void stopNavigation() {
- navit_set_destination(this->object->nav,NULL,NULL,0);
- }
- QString getPosition() {
- struct attr attr;
- struct pcoord pc;
- struct coord c;
- struct transformation *trans;
-
- trans=navit_get_trans(this->object->nav);
-
- getAttrFunc(attr_vehicle, &attr, NULL);
- this->object->currVehicle=attr.u.vehicle;
-
- if (vehicle_get_attr(this->object->currVehicle, attr_position_coord_geo, &attr, NULL)) {
- pc.pro=transform_get_projection(trans);
- transform_from_geo(pc.pro, attr.u.coord_geo, &c);
- __setNewPoint(this->object,&c,Position);
- return this->object->currentPoint->pointName();
- }
- return QString();
- }
- void setPosition() {
- navit_set_position(this->object->nav,this->object->currentPoint->pc());
- }
- void setCenter() {
- navit_set_center(this->object->nav,this->object->currentPoint->pc(),1);
- }
- void command(QString command) {
- struct attr navit;
- navit.type=attr_navit;
- navit.u.navit=this->object->nav;
- command_evaluate(&navit,command.toLocal8Bit().constData());
- }
-protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) { return navit_get_attr(this->object->nav, type, attr, iter); }
- int setAttrFunc(struct attr* attr) {return navit_set_attr(this->object->nav,attr); }
- struct attr_iter* getIterFunc() { return navit_attr_iter_new(); };
- void dropIterFunc(struct attr_iter* iter) { navit_attr_iter_destroy(iter); };
-
-private:
-
-};
-
-#include "navitProxy.moc"
-
-#endif /* NAVIT_GUI_QML_NAVITPROXY_H */
diff --git a/navit/gui/qml/ngqpoint.h b/navit/gui/qml/ngqpoint.h
deleted file mode 100644
index 05142e5bf..000000000
--- a/navit/gui/qml/ngqpoint.h
+++ /dev/null
@@ -1,382 +0,0 @@
-#ifndef NAVIT_GUI_QML_POINT_H
-#define NAVIT_GUI_QML_POINT_H
-
-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;
- }
-}
-
-enum NGQPointTypes {MapPoint,Bookmark,Position,Destination,PointOfInterest};
-
-class NGQPoint : public QObject {
- Q_OBJECT;
-
- Q_PROPERTY(QString coordString READ coordString CONSTANT);
- Q_PROPERTY(QString pointName READ pointName CONSTANT);
- Q_PROPERTY(QString pointType READ pointType CONSTANT);
- Q_PROPERTY(QUrl pointUrl READ pointUrl CONSTANT);
-public:
- NGQPoint(struct gui_priv* this_,struct point* p,NGQPointTypes type=MapPoint,QObject *parent=NULL) : QObject(parent) {
- this->object=this_;
- this->item.map=0;
- transform_reverse(navit_get_trans(this->object->nav), p, &co);
- transform_to_geo(transform_get_projection(navit_get_trans(this->object->nav)), &co, &g);
- c.pro = transform_get_projection(navit_get_trans(this->object->nav));
- c.x = co.x;
- c.y = co.y;
- this->p.x=p->x;
- this->p.y=p->y;
- this->type=type;
-
- this->name=this->_coordName();
- this->coord=this->_coordString();
- }
- NGQPoint(struct gui_priv* this_,struct coord* c,NGQPointTypes type=Bookmark,QObject *parent=NULL) : QObject(parent) {
- this->object=this_;
- this->item.map=0;
- this->co.x=c->x;
- this->co.y=c->y;
- transform_to_geo(transform_get_projection(navit_get_trans(this->object->nav)), &co, &g);
- this->c.pro = transform_get_projection(navit_get_trans(this->object->nav));
- this->c.x = c->x;
- this->c.y = c->y;
- this->type=type;
-
- this->name=this->_coordName();
- this->coord=this->_coordString();
- }
-
- NGQPoint(struct gui_priv* this_,struct pcoord* pc,NGQPointTypes type=Bookmark,QObject *parent=NULL) : QObject(parent) {
- this->object=this_;
- this->item.map=0;
- this->c.pro = pc->pro;
- this->c.x = pc->x;
- this->c.y = pc->y;
- this->co.x=pc->x;
- this->co.y=pc->y;
- transform_to_geo(this->c.pro, &co, &g);
- this->type=type;
-
- this->name=this->_coordName();
- this->coord=this->_coordString();
- }
-
- NGQPoint(struct gui_priv* this_,struct coord* c,QString name,NGQPointTypes type=Bookmark,QObject *parent=NULL) : QObject(parent) {
- this->object=this_;
- this->item.map=0;
- this->co.x=c->x;
- this->co.y=c->y;
- transform_to_geo(transform_get_projection(navit_get_trans(this->object->nav)), &co, &g);
- this->c.pro = transform_get_projection(navit_get_trans(this->object->nav));
- this->c.x = c->x;
- this->c.y = c->y;
- this->type=type;
-
- this->name=name;
- this->coord=this->_coordString();
- }
-
- struct pcoord* pc() { return &c; }
-public slots:
- void setNewPoint(QString coord,NGQPointTypes type=PointOfInterest) {
- this->item.map=0;
- QStringList coordSplit=coord.split(" ",QString::SkipEmptyParts);
- this->co.x=coordSplit[0].toInt();
- this->co.y=coordSplit[1].toInt();
- transform_to_geo(transform_get_projection(navit_get_trans(this->object->nav)), &co, &g);
- this->c.pro = transform_get_projection(navit_get_trans(this->object->nav));
- this->c.x = coordSplit[0].toInt();
- this->c.y = coordSplit[1].toInt();
- this->type=type;
-
- this->name=this->_coordName();
- this->coord=this->_coordString();
- }
- QString pointName() {
- return this->name;
- }
- QString coordString() {
- return this->coord;
- }
- QString pointType() {
- switch(this->type) {
- case MapPoint:
- return QString("MapPoint");
- case Bookmark:
- return QString("Bookmark");
- case Position:
- return QString("Position");
- case Destination:
- return QString("Destination");
- case PointOfInterest:
- return QString("PointOfInterest");
- }
- return QString("");
- }
- QUrl pointUrl() {
- return this->url;
- }
- QString getInformation() {
- struct map_rect *mr;
- struct item* item;
- struct attr attr;
-
- QDomDocument retDoc;
- QDomElement entries;
- entries=retDoc.createElement("point");
- retDoc.appendChild(entries);
-
- if (this->type!=Bookmark and this->item.map) {
- mr=map_rect_new(this->item.map, NULL);
- item = map_rect_get_item_byid(mr, this->item.id_hi, this->item.id_lo);
- if (item) {
- while(item_attr_get(item, attr_any, &attr)) {
- entries.appendChild(this->_fieldValueHelper(retDoc,QString::fromLocal8Bit(attr_to_name(attr.type)), QString::fromLocal8Bit(attr_to_text(&attr,this->item.map, 1))));
- }
- }
- map_rect_destroy(mr);
- }
- return retDoc.toString();
- }
- QString getPOI(const QString &attr_name) {
- struct attr attr;
- struct item* item;
- struct mapset_handle *h;
- struct map_selection *sel,*selm;
- struct map_rect *mr;
- struct map *m;
- int idist,dist;
- struct coord center;
- QDomDocument retDoc(attr_name);
- QDomElement entries;
- char dirbuf[32];
-
- if (!gui_get_attr(this->object->gui,attr_radius,&attr,NULL)) {
- return QString();
- }
-
- dist=attr.u.num*1000;
-
- sel=map_selection_rect_new(&this->c, dist, 18);
- center.x=this->c.x;
- center.y=this->c.y;
- h=mapset_open(navit_get_mapset(this->object->nav));
-
- entries=retDoc.createElement(attr_name);
- retDoc.appendChild(entries);
-
- while ((m=mapset_next(h, 1))) {
- selm=map_selection_dup_pro(sel, this->c.pro, map_projection(m));
- mr=map_rect_new(m, selm);
- if (mr) {
- while ((item=map_rect_get_item(mr))) {
- struct coord c;
- if ( item_coord_get_pro(item, &c, 1, this->c.pro) && coord_rect_contains(&sel->u.c_rect, &c) && (idist=transform_distance(this->c.pro, &center, &c)) < dist && item->type<type_line) {
- char* label;
- QString rs;
- if (item_attr_get(item, attr_label, &attr)) {
- label=map_convert_string(m, attr.u.str);
- if (QString(item_to_name(item->type)).startsWith(QString("poi_"))) {
- rs=QString::fromLocal8Bit(item_to_name(item->type));
- rs=rs.remove(QString("poi_"));
- rs+=QString(" ")+QString::fromLocal8Bit(label);
-
- } else if (QString(item_to_name(item->type)).startsWith(QString("poly_"))) {
- rs=QString::fromLocal8Bit(item_to_name(item->type));
- rs=rs.remove(QString("poly_"));
- rs+=QString(" ")+QString::fromLocal8Bit(label);
-
- } else if (QString(item_to_name(item->type)).startsWith(QString("street_"))) {
- rs="Street ";
- rs+=QString::fromLocal8Bit(label);
- }
- map_convert_free(label);
- } else
- rs=item_to_name(item->type);
- get_direction(dirbuf, transform_get_angle_delta(&center, &c, 0), 1);
- if (rs.length()>0) {
- QDomElement entry=retDoc.createElement("point");
- QDomElement nameTag=retDoc.createElement("name");
- QDomElement typeTag=retDoc.createElement("type");
- QDomElement distTag=retDoc.createElement("distance");
- QDomElement directTag=retDoc.createElement("direction");
- QDomElement coordsTag=retDoc.createElement("coords");
- QDomText nameT=retDoc.createTextNode(rs);
- QDomText typeT=retDoc.createTextNode(QString(item_to_name(item->type)));
- QDomText distT=retDoc.createTextNode(QString::number(idist/1000));
- QDomText directT=retDoc.createTextNode(dirbuf);
- QDomText coordsT=retDoc.createTextNode(QString("%1 %2").arg(c.x).arg(c.y));
- nameTag.appendChild(nameT);
- typeTag.appendChild(typeT);
- distTag.appendChild(distT);
- directTag.appendChild(directT);
- coordsTag.appendChild(coordsT);
- entry.appendChild(nameTag);
- entry.appendChild(typeTag);
- entry.appendChild(distTag);
- entry.appendChild(directTag);
- entry.appendChild(coordsTag);
- entries.appendChild(entry);
- }
- }
- }
- }
- map_selection_destroy(selm);
- }
- map_selection_destroy(sel);
- mapset_close(h);
- dbg(lvl_info,"%s\n",retDoc.toString().toLocal8Bit().constData());
- return retDoc.toString();
- }
-protected:
- QDomElement _fieldValueHelper(QDomDocument doc, QString field,QString value) {
- QDomElement fieldTag=doc.createElement(field);
- QDomText valueText=doc.createTextNode(value);
- fieldTag.appendChild(valueText);
- return fieldTag;
- }
- QString _coordString() {
- char latc='N',lngc='E';
- int lat_deg,lat_min,lat_sec;
- int lng_deg,lng_min,lng_sec;
- struct coord_geo g=this->g;
-
- if (g.lat < 0) {
- g.lat=-g.lat;
- latc='S';
- }
- if (g.lng < 0) {
- g.lng=-g.lng;
- lngc='W';
- }
- lat_deg=g.lat;
- lat_min=fmod(g.lat*60,60);
- lat_sec=fmod(g.lat*3600,60);
- lng_deg=g.lng;
- lng_min=fmod(g.lng*60,60);
- lng_sec=fmod(g.lng*3600,60);
- return QString(QString::fromLocal8Bit("%1°%2'%3\" %4%5%6°%7'%8\" %9")).arg(lat_deg).arg(lat_min).arg(lat_sec).arg(latc).arg(' ').arg(lng_deg).arg(lng_min).arg(lng_sec).arg(lngc);
- }
- QString _coordName() {
- int dist=10;
- struct mapset *ms;
- struct mapset_handle *h;
- struct map_rect *mr;
- struct map *m;
- struct item *item;
- struct street_data *data;
- struct map_selection sel;
- struct transformation *trans;
- enum projection pro;
- struct attr attr;
- char *label;
- QString ret;
-
- trans=navit_get_trans(this->object->nav);
- pro=transform_get_projection(trans);
- transform_from_geo(pro, &g, &co);
- ms=navit_get_mapset(this->object->nav);
- sel.next=NULL;
- sel.u.c_rect.lu.x=c.x-dist;
- sel.u.c_rect.lu.y=c.y+dist;
- sel.u.c_rect.rl.x=c.x+dist;
- sel.u.c_rect.rl.y=c.y-dist;
- sel.order=18;
- sel.range=item_range_all;
- h=mapset_open(ms);
- while ((m=mapset_next(h,1))) {
- mr=map_rect_new(m, &sel);
- if (! mr)
- continue;
- while ((item=map_rect_get_item(mr))) {
- data=street_get_data(item);
- if (transform_within_dist_item(&co, item->type, data->c, data->count, dist)) {
- if (item_attr_get(item, attr_label, &attr)) {
- label=map_convert_string(m, attr.u.str);
- this->item=*item;
- this->_setUrl(item);
- if (QString(item_to_name(item->type)).startsWith(QString("poi_"))) {
- ret=QString::fromLocal8Bit(item_to_name(item->type));
- ret=ret.remove(QString("poi_"));
- ret+=QString(" ")+QString::fromLocal8Bit(label);
- }
- if (QString(item_to_name(item->type)).startsWith(QString("poly_"))) {
- ret=QString::fromLocal8Bit(item_to_name(item->type));
- ret=ret.remove(QString("poly_"));
- ret+=QString(" ")+QString::fromLocal8Bit(label);
- }
- if (QString(item_to_name(item->type)).startsWith(QString("street_"))) {
- ret="Street ";
- ret+=QString::fromLocal8Bit(label);
- }
- map_convert_free(label);
- street_data_free(data);
- map_rect_destroy(mr);
- mapset_close(h);
- return ret;
- } else
- this->item=*item;
- this->_setUrl(item);
- ret=item_to_name(item->type);
- }
- street_data_free(data);
- }
- map_rect_destroy(mr);
- }
- mapset_close(h);
- return ret;
- }
- void _setUrl(struct item *item) {
- struct attr attr;
- if (item_attr_get(item,attr_osm_nodeid,&attr)) {
- url.setUrl(QString("http://www.openstreetmap.org/browse/node/%1").arg(*attr.u.num64));
- } else if (item_attr_get(item,attr_osm_wayid,&attr)) {
- url.setUrl(QString("http://www.openstreetmap.org/browse/way/%1").arg(*attr.u.num64));
- } else if (item_attr_get(item,attr_osm_relationid,&attr)) {
- url.setUrl(QString("http://www.openstreetmap.org/browse/relation/%1").arg(*attr.u.num64));
- } else {
- url.clear();
- }
- }
-private:
- struct gui_priv* object;
-
- NGQPointTypes type;
- struct coord_geo g;
- struct coord co;
- struct pcoord c;
- struct point p;
-
- struct item item;
-
- QString name;
- QString coord;
- QUrl url;
-};
-
-#include "ngqpoint.moc"
-
-#endif /* NAVIT_GUI_QML_POINT_H */
diff --git a/navit/gui/qml/proxy.h b/navit/gui/qml/proxy.h
deleted file mode 100644
index 3243dc8cb..000000000
--- a/navit/gui/qml/proxy.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef NAVIT_GUI_QML_PROXY_H
-#define NAVIT_GUI_QML_PROXY_H
-
-class NGQStandardItemModel : public QStandardItemModel {
-public:
- NGQStandardItemModel(QObject* parent) : QStandardItemModel(parent) {
- //Populate role list
- roleNames.insert(NGQStandardItemModel::ItemId, "itemId");
- roleNames.insert(NGQStandardItemModel::ItemName, "itemName");
- roleNames.insert(NGQStandardItemModel::ItemIcon, "itemIcon");
- roleNames.insert(NGQStandardItemModel::ItemPath, "itemPath");
- roleNames.insert(NGQStandardItemModel::ItemValue, "itemValue");
- this->setRoleNames(roleNames);
- }
-
- enum listRoles {ItemId=Qt::UserRole+1,ItemName=Qt::UserRole+2,ItemIcon=Qt::UserRole+3,ItemPath=Qt::UserRole+4,ItemValue=Qt::UserRole+5};
-private:
- QHash<int, QByteArray> roleNames;
-};
-
-class NGQProxy : public QObject {
- Q_OBJECT;
-
- Q_PROPERTY(int itemId READ itemId NOTIFY itemIdSignal);
-public:
- NGQProxy(struct gui_priv* this_,QObject *parent) : QObject(parent) {
- this->object=this_;
- }
-
-signals:
- void itemIdSignal(int itemId);
-
-public slots:
- //Attribute read/write
- QString getAttr(const QString &attr_name) {
- QString ret;
- struct attr attr;
-
- getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, NULL);
- if (ATTR_IS_INT(attr.type)) {
- ret.setNum(attr.u.num);
- }
- if (ATTR_IS_DOUBLE(attr.type)) {
- ret.setNum(*attr.u.numd);
- }
- if (ATTR_IS_STRING(attr.type)) {
- ret=attr.u.str;
- }
- if (attr.type==attr_layout) {
- ret=attr.u.layout->name;
- }
- return ret;
- }
- void setAttr(const QString &attr_name, const QString &attr_string) {
- struct attr attr_value;
- double *helper;
-
- dbg(lvl_debug,"Setting %s to %s\n",attr_name.toStdString().c_str(),attr_string.toStdString().c_str());
- getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr_value, NULL);
-
- if (ATTR_IS_INT(attr_value.type)) {
- //Special handling for "true"/"false"
- if (attr_string=="true") {
- attr_value.u.num=1;
- } else if (attr_string=="false") {
- attr_value.u.num=0;
- } else {
- attr_value.u.num=attr_string.toInt();
- }
- }
- if (ATTR_IS_DOUBLE(attr_value.type)) {
- helper = g_new0(double,1);
- *helper=attr_string.toDouble();
- attr_value.u.numd=helper;
- }
- if (ATTR_IS_STRING(attr_value.type)) {
- attr_value.u.str=(char*)attr_string.toStdString().c_str();
- }
-
- setAttrFunc(&attr_value);
-
- return;
- }
-
- int itemId() {
- return _itemId;
- }
-protected:
- struct gui_priv* object;
-
- int _itemId;
-
- virtual int setAttrFunc(struct attr *attr)=0;
- virtual int getAttrFunc(enum attr_type type, struct attr *attr, struct attr_iter *iter)=0;
- virtual struct attr_iter* getIterFunc() { return NULL; };
- virtual void dropIterFunc(struct attr_iter*) { return; };
-
- QDomElement _fieldValueHelper(QDomDocument doc, QString field,QString value) {
- QDomElement fieldTag=doc.createElement(field);
- QDomText valueText=doc.createTextNode(value);
- fieldTag.appendChild(valueText);
- return fieldTag;
- }
-
-};
-
-#include "proxy.moc"
-
-#endif /* NAVIT_GUI_QML_PROXY_H */
diff --git a/navit/gui/qml/routeProxy.h b/navit/gui/qml/routeProxy.h
deleted file mode 100644
index a2fb4c793..000000000
--- a/navit/gui/qml/routeProxy.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef NAVIT_GUI_QML_ROUTEPROXY_H
-#define NAVIT_GUI_QML_ROUTEPROXY_H
-
-
-class NGQProxyRoute : public NGQProxy {
- Q_OBJECT;
-
-public:
- NGQProxyRoute(struct gui_priv* this_,QObject* parent) : NGQProxy(this_,parent) { };
-
-public slots:
- void addDestination() {
- int counter=0;
- QList<struct attr> destinations=this->_routeDestinations();
- struct pcoord *coords=(struct pcoord*)malloc(sizeof(struct pcoord)*(destinations.size()+1)); //Additional destination included
-
- for (QList<struct attr>::const_iterator iter=destinations.begin();iter!=destinations.end();iter++) {
- coords[counter]=*(iter->u.pcoord);
- counter++;
- }
-
- //Add new one
- coords[counter]=*(this->object->currentPoint->pc());
-
- //Propagate to route engine
- route_set_destinations(navit_get_route(this->object->nav),coords,counter+1,1);
- }
- QString getDestinations() {
-
- QList<struct attr> destinations=this->_routeDestinations();
- for (QList<struct attr>::const_iterator iter=destinations.begin();iter!=destinations.end();iter++) {
- NGQPoint helperPoint(this->object,iter->u.pcoord,MapPoint);
- dbg(lvl_debug,"Added destination %s\n",helperPoint.coordString().toLocal8Bit().constData());
- }
-
- //dbg(lvl_debug,QString::number(_itemId).toStdString().c_str());
-
- //return retDoc.toString();
- return QString();
- }
-
-protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) {return route_get_attr(navit_get_route(this->object->nav), type, attr, iter); }
- int setAttrFunc(struct attr* attr) {return route_set_attr(navit_get_route(this->object->nav),attr); }
- struct attr_iter* getIterFunc() { return route_attr_iter_new(); };
- void dropIterFunc(struct attr_iter* iter) { route_attr_iter_destroy(iter); };
-
- QList<struct attr> _routeDestinations() {
- QList<struct attr> ret;
- struct attr attr;
- struct attr_iter *iter;
-
- //Fill da list
- iter=getIterFunc();
- if (iter == NULL) {
- return ret;
- }
-
- while (getAttrFunc(attr_destination, &attr, iter) ) {
- struct attr c_attr=attr;
- ret.push_front(c_attr); //List is reversed in route engine
- }
-
- dropIterFunc(iter);
-
- return ret;
- }
-};
-
-#include "routeProxy.moc"
-
-#endif /* NAVIT_GUI_QML_ROUTEPROXY_H */
diff --git a/navit/gui/qml/searchProxy.h b/navit/gui/qml/searchProxy.h
deleted file mode 100644
index 579ac3dac..000000000
--- a/navit/gui/qml/searchProxy.h
+++ /dev/null
@@ -1,229 +0,0 @@
-#ifndef NAVIT_GUI_QML_SEARCHPROXY_H
-#define NAVIT_GUI_QML_SEARCHPROXY_H
-
-void __setNewPoint(struct gui_priv* this_,struct pcoord* pc, NGQPointTypes type);
-
-class NGQProxySearch : public NGQProxy {
- Q_OBJECT;
-
- Q_PROPERTY(QString countryName READ countryName WRITE setCountryName NOTIFY countryNameSignal);
- Q_PROPERTY(QString countryISO2 READ countryISO2 WRITE setCountryISO2 NOTIFY countryISO2Signal);
- Q_PROPERTY(QString townName READ townName WRITE setTownName NOTIFY townNameSignal);
- Q_PROPERTY(QString streetName READ streetName WRITE setStreetName NOTIFY streetNameSignal);
-
- Q_PROPERTY(QString searchContext READ searchContext WRITE setSearchContext);
-
-public:
- NGQProxySearch(struct gui_priv* this_,QObject* parent) : NGQProxy(this_,parent) {
- struct attr search_attr, country_name, country_iso2, *country_attr;
- struct item *item;
- struct country_search *cs;
- struct tracking *tracking;
- struct search_list_result *res;
-
- this->sl=search_list_new(navit_get_mapset(this->object->nav));
- this->search_context="country";
-
- country_attr=country_default();
- tracking=navit_get_tracking(this->object->nav);
- if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
- country_attr=&search_attr;
- if (country_attr) {
- cs=country_search_new(country_attr, 0);
- item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name)) {
- search_attr.type=attr_country_all;
- dbg(lvl_debug,"country %s\n", country_name.u.str);
- this->country_name=QString::fromLocal8Bit(country_name.u.str);
- search_attr.u.str=country_name.u.str;
- search_list_search(this->sl, &search_attr, 0);
- while((res=search_list_get_result(this->sl)));
- if (item_attr_get(item, attr_country_iso2, &country_iso2)) {
- this->country_iso2=QString::fromLocal8Bit(country_iso2.u.str);
- }
- }
- country_search_destroy(cs);
- } else {
- dbg(lvl_error,"warning: no default country found\n");
- if (!this->country_iso2.isEmpty()) {
- dbg(lvl_debug,"attempting to use country '%s'\n",this->country_iso2.toStdString().c_str());
- search_attr.type=attr_country_iso2;
- search_attr.u.str=(char*)this->country_iso2.toStdString().c_str();
- search_list_search(this->sl, &search_attr, 0);
- while((res=search_list_get_result(this->sl)));
- }
- }
- }
- ~NGQProxySearch() {
- search_list_destroy(this->sl);
- }
-
-signals:
- void countryNameSignal(QString);
- void countryISO2Signal(QString);
- void townNameSignal(QString);
- void streetNameSignal(QString);
-
-public slots:
- void setPointToResult() {
- struct attr attr;
- struct search_list_result *res;
-
- if (this->street_name.length()>0) {
- attr.type=attr_street_name;
- attr.u.str=this->street_name.toLocal8Bit().data();
- } else if (this->town_name.length()>0) {
- attr.type=attr_town_or_district_name;
- attr.u.str=this->town_name.toLocal8Bit().data();
- } else if (this->country_name.length()>0) {
- attr.type=attr_country_name;
- attr.u.str=this->country_name.toLocal8Bit().data();
- }
- search_list_search(this->sl,&attr,0);
- if ((res=search_list_get_result(this->sl))) {
- __setNewPoint(this->object,res->c,PointOfInterest);
- }
- return;
- }
- QString searchXml() {
- NGQStandardItemModel* ret=new NGQStandardItemModel(this);
- struct attr attr;
- struct search_list_result *res;
- int counter=0;
- QDomDocument retDoc;
- QDomElement entries;
-
- entries=retDoc.createElement("search");
- retDoc.appendChild(entries);
-
- if (this->search_context=="country") {
- attr.type=attr_country_name;
- attr.u.str=this->country_name.toLocal8Bit().data();
- }
- if (this->search_context=="town") {
- if (this->town_name.length()<3) {
- return retDoc.toString();
- }
- attr.type=attr_town_or_district_name;
- attr.u.str=this->town_name.toLocal8Bit().data();
- }
- if (this->search_context=="street") {
- attr.type=attr_street_name;
- attr.u.str=this->street_name.toLocal8Bit().data();
- }
-
- search_list_search(this->sl,&attr,1);
-
- while ((res=search_list_get_result(this->sl))) {
- QStandardItem* curItem=new QStandardItem();
- QDomElement entry=retDoc.createElement("item");
- entries.appendChild(entry);
- //Result processing depends on search type
- if (this->search_context=="country") {
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"), QString::fromLocal8Bit(res->country->name)));
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("icon"), QString("country_%1%2").arg(res->country->iso2).arg(".svgz")));
- }
- if (this->search_context=="town") {
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
- if (res->town->common.town_name) {
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"),QString::fromLocal8Bit(res->town->common.town_name)));
- }
- if (res->town->common.district_name) {
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"), QString::fromLocal8Bit(res->town->common.district_name)));
- }
- }
- if (this->search_context=="street") {
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"),QString::fromLocal8Bit(res->street->name)));
- }
- counter++;
- ret->appendRow(curItem);
- }
-
- return retDoc.toString();
- }
- QString countryName() {
- return this->country_name;
- }
- void setCountryName(QString countryName) {
- this->country_name=countryName;
- struct attr attr;
- struct search_list_result *res;
-
- //We need to update ISO2
- attr.type=attr_country_name;
- attr.u.str=countryName.toLocal8Bit().data();
- search_list_search(this->sl,&attr,0);
- while ((res=search_list_get_result(this->sl))) {
- this->setCountryISO2(QString::fromLocal8Bit(res->country->iso2));
- }
- //...and current town
- this->town_name="";
- this->street_name="";
-
- countryNameSignal(countryName);
- }
- QString countryISO2() {
- return this->country_iso2;
- }
- void setCountryISO2(QString countryISO2) {
- this->country_iso2=countryISO2;
- countryISO2Signal(countryISO2);
- }
- QString townName() {
- return this->town_name;
- }
- void setTownName(QString townName) {
- struct attr attr;
-
- this->town_name=townName;
-
- //Specialize search
- attr.type=attr_town_or_district_name;
- attr.u.str=townName.toLocal8Bit().data();
- search_list_search(this->sl,&attr,0);
-
- //...and street
- this->street_name="";
-
- townNameSignal(townName);
- }
- QString streetName() {
- return this->street_name;
- }
- void setStreetName(QString streetName) {
- struct attr attr;
-
- this->street_name=streetName;
-
- //Specialize search
- attr.type=attr_street_name;
- attr.u.str=streetName.toLocal8Bit().data();
- search_list_search(this->sl,&attr,0);
-
- streetNameSignal(streetName);
- }
- QString searchContext() {
- return this->search_context;
- }
- void setSearchContext(QString searchContext) {
- this->search_context=searchContext;
- }
-
-protected:
- virtual int getAttrFunc(enum attr_type type, struct attr *attr, struct attr_iter *iter) {
- return 0;
- }
- virtual int setAttrFunc(struct attr *attr) {
- return 0;
- }
-private:
- struct search_list *sl;
- QString search_context;
- QString country_iso2,country_name,town_name,street_name;
-};
-
-#include "searchProxy.moc"
-
-#endif /* NAVIT_GUI_QML_SEARCHPROXY_H */
diff --git a/navit/gui/qml/skins/navit/ButtonIcon.qml b/navit/gui/qml/skins/navit/ButtonIcon.qml
deleted file mode 100644
index f969ebb5a..000000000
--- a/navit/gui/qml/skins/navit/ButtonIcon.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- id: container
-
- signal clicked
- property string text: "Button"
- property string icon: "Icon.png"
-
- color: "black"; smooth: true; opacity: 0.75
- width: imgItem.width+20; height: txtItem.height + 6 + imgItem.height;
- transformOrigin: Rectangle.Center;
-
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
-
- Image {
- id: imgItem; source: gui.iconPath+container.icon; anchors.top: container.top; anchors.horizontalCenter: container.horizontalCenter;
- width: gui.height/4; height: gui.height/4
- }
-
- Text {
- id: txtItem; text: container.text; anchors.top: imgItem.bottom; anchors.horizontalCenter: container.horizontalCenter;
- color: "White"; font.pointSize: gui.height/32; horizontalAlignment: Qt.AlignHCenter
- }
-
- states: [
- State {
- name: "Pressed"; when: mr.pressed == true
- PropertyChanges { target: container; scale: 2.0 }
- PropertyChanges { target: container; opacity: 1 }
-
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 }
- NumberAnimation { properties: "opacity"; easing.type: "InQuad"; duration: 200 }
- }
-
-}
diff --git a/navit/gui/qml/skins/navit/Cellar.qml b/navit/gui/qml/skins/navit/Cellar.qml
deleted file mode 100644
index de4d3c146..000000000
--- a/navit/gui/qml/skins/navit/Cellar.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
-
- function onStartup(currentPage) {
- btnBack.opacity=0;
- btnQuit.opacity=0;
- if ( gui.lengthPage() > 1 ) {
- btnBack.opacity=1;
- }
- if ( gui.lengthPage() == 1 && currentPage == "PageMain.qml" ) {
- btnQuit.opacity=1;
- }
- }
-
-
- ButtonIcon {
- id: btnMap; icon: "gui_map.svg"; text:"Map"; onClicked: gui.backToMap();
- anchors.left: parent.left; anchors.leftMargin: 3
- anchors.bottom: parent.bottom; anchors.bottomMargin: 3
- }
-
- ButtonIcon {
- id: btnBack; icon: "gui_arrow_left.svg"; text: "Back"; onClicked: Navit.back();
- anchors.right: parent.right; anchors.leftMargin: 3
- anchors.bottom: parent.bottom; anchors.bottomMargin: 3
- opacity: 0;
- }
-
- ButtonIcon {
- id: btnQuit; icon: "gui_quit.svg"; text: "Quit"; onClicked: navit.quit()
- anchors.right: parent.right; anchors.leftMargin: 3
- anchors.bottom: parent.bottom; anchors.bottomMargin: 3
- opacity: 0;
- }
-
-}
diff --git a/navit/gui/qml/skins/navit/CommonHighlight.qml b/navit/gui/qml/skins/navit/CommonHighlight.qml
deleted file mode 100644
index 3f4d035e0..000000000
--- a/navit/gui/qml/skins/navit/CommonHighlight.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import Qt 4.7
-
-Component {
- Rectangle {
- color: "lightsteelblue"
- radius: 5
- }
-}
-
diff --git a/navit/gui/qml/skins/navit/ListSelector.qml b/navit/gui/qml/skins/navit/ListSelector.qml
deleted file mode 100644
index 09c927cf1..000000000
--- a/navit/gui/qml/skins/navit/ListSelector.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- id: listselector
- width: parent.width; height: parent.height
- color: "Black"
-
-
- property string text: "ListSelector"
- property string value: ""
- property int itemId: 0
- property bool showScroller: false
- signal changed
-
- function startup() {
- if (listselector.showScroller == true) {
- listScroller.opacity=0.5;
- }
- }
-
- Component.onCompleted: startup();
-
- Text {
- id: labelTxt; text: listselector.text; color: "White"; font.pointSize: 22;
- anchors.horizontalCenter: list.horizontalCenter
- anchors.verticalCenter: listselector.top
- }
-
- ListView {
- id: list;
- width: listselector.width*0.8; height: listselector.height
- anchors.top: labelTxt.bottom;
- anchors.left: listselector.left
- model: listModel
- delegate: listDelegate
- highlight: listHighlight
- clip: true
- highlightFollowsCurrentItem: true
- keyNavigationWraps: true
-
- Component.onCompleted: { list.currentIndex=listselector.itemId; }
- }
- Rectangle {
- id: listScroller
- opacity: 0; anchors.left: list.right; anchors.leftMargin: 4; width: 6
- y: (list.visibleArea.yPosition * list.height)+(list.visibleArea.heightRatio * list.height/4)
- height: list.visibleArea.heightRatio * list.height
- }
-}
diff --git a/navit/gui/qml/skins/navit/PageAbout.qml b/navit/gui/qml/skins/navit/PageAbout.qml
deleted file mode 100644
index a96baabca..000000000
--- a/navit/gui/qml/skins/navit/PageAbout.qml
+++ /dev/null
@@ -1,28 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text { id: navitText; anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: urlText.top; text: "Navit"; color: "White"; font.pointSize: gui.height/32 }
- Text { id: urlText; anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter; text: "http://www.navit-project.org/"; color: "White"; font.pointSize: gui.height/32 }
- Text { id: authorsText; anchors.horizontalCenter: parent.horizontalCenter; anchors.top: urlText.bottom; text: "By: Martin Schaller, Michael Farmbauer, Alexander Atanasov, Pierre Grandin"; color: "White"; font.pointSize: gui.height/32 }
- Text { id: contributorsText; anchors.horizontalCenter: parent.horizontalCenter; anchors.top: authorsText.bottom; text: "and all the Navit Team members and contributors"; color: "White"; font.pointSize: gui.height/32 }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageBookmarks.qml b/navit/gui/qml/skins/navit/PageBookmarks.qml
deleted file mode 100644
index 15a5982b6..000000000
--- a/navit/gui/qml/skins/navit/PageBookmarks.qml
+++ /dev/null
@@ -1,144 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function bookmarkReload() {
- listModel.xml=bookmarks.getBookmarks();
- listModel.query="/bookmarks/bookmark";
- listModel.reload();
- }
-
- function bookmarkClick(itemName,itemType,itemCoord) {
- if (itemType=="bookmark_folder") {
- if ( itemName==".." ) {
- bookmarks.moveUp();
- } else {
- bookmarks.moveDown(itemName);
- }
- bookmarkReload();
- } else {
- bookmarks.setPoint(itemName);
- pageLoader.source="PageNavigate.qml";
- }
- }
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- ButtonIcon { id: folderBtn; text: "New folder"; icon: "gui_active.svg"; onClicked: folderDialog.opacity=1
- anchors.top: parent.top; anchors.topMargin: page.height/16; anchors.left: parent.left; anchors.leftMargin: page.width/16
- }
- ButtonIcon { id: pasteBtn; text: "Paste"; icon: "gui_active.svg"; onClicked: { bookmarks.Paste(); bookmarkReload(); }
- anchors.top: parent.top; anchors.topMargin: page.height/16; anchors.left: folderBtn.right; anchors.leftMargin: page.width/16
- }
-
- XmlListModel {
- id: listModel
- xml: bookmarks.getBookmarks("bookmarks")
- query: "/bookmarks/bookmark"
- XmlRole { name: "itemName"; query: "label/string()" }
- XmlRole { name: "itemType"; query: "type/string()" }
- XmlRole { name: "itemDistance"; query: "distance/string()" }
- XmlRole { name: "itemDirection"; query: "direction/string()" }
- XmlRole { name: "itemValue"; query: "coords/string()" }
- }
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Text { id: txtItem; text: itemName; color: {itemType== "bookmark" ? "White" : "Yellow"}
- font.bold: {itemType!= "bookmark" }
- width: list.width-imgDelete.width
- MouseArea {
- id:delegateMouse
- anchors.fill: parent
- onClicked: bookmarkClick(itemName,itemType,itemValue);
- }
- }
- Image {
- id: imgCut; source: gui.iconPath+"zoom_out.svg"; anchors.right: imgCopy.left;anchors.rightMargin: 5;
- width: 20; height: 20;
-
- MouseArea {
- id:delegateMouseCut
- anchors.fill: parent
- onClicked: { bookmarks.Cut(itemName); bookmarkReload(); }
- }
- }
- Image {
- id: imgCopy; source: gui.iconPath+"zoom_in.svg"; anchors.right: imgDelete.left;anchors.rightMargin: 5;
- width: 20; height: 20;
-
- MouseArea {
- id:delegateMouseCopy
- anchors.fill: parent
- onClicked: { bookmarks.Copy(itemName); bookmarkReload(); }
- }
- }
- Image {
- id: imgDelete; source: gui.iconPath+"gui_inactive.svg"; anchors.right: wrapper.right;anchors.rightMargin: 5;
- width: 20; height: 20;
-
- MouseArea {
- id:delegateMouseDelete
- anchors.fill: parent
- onClicked: { bookmarks.Delete(itemName); bookmarkReload(); }
- }
- }
- }
- }
-
- Component {
- id: listHighlight
- Rectangle {
- opacity: 0
- }
- }
-
- ListSelector {
- id:layoutList; text: ""
- anchors.top: pasteBtn.bottom;
- anchors.left: parent.left;
- anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width; height: page.height*0.25
- }
-
- Cellar {id: cellar; anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-
- Rectangle {
- id: folderDialog
- opacity:0
- anchors.horizontalCenter: page.horizontalCenter; anchors.verticalCenter: page.verticalCenter;
- width: page.width; height:page.height/3
- color: "Grey";
-
- TextInput{
- id: folderTxt; text: "Enter folder name here..."
- anchors.top: parent.top;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- width: page.width; font.pointSize: 14; color: "White";focus: true; readOnly: false
- }
-
- ButtonIcon {
- id: btnOk; text: "Add"; icon: "gui_active.svg"; onClicked: { bookmarks.AddFolder(folderTxt.text); bookmarkReload(); folderDialog.opacity=0 }
- anchors.top: folderTxt.bottom;anchors.topMargin: 5;anchors.right:parent.horizontalCenter;anchors.rightMargin:10
- }
- ButtonIcon {
- id: btnCancel; text: "Cancel"; icon: "gui_inactive.svg"; onClicked: folderDialog.opacity=0;
- anchors.top: folderTxt.bottom;anchors.topMargin: 5;anchors.left:parent.horizontalCenter;anchors.leftMargin:10
- }
- }
-}
diff --git a/navit/gui/qml/skins/navit/PageBookmarksAdd.qml b/navit/gui/qml/skins/navit/PageBookmarksAdd.qml
deleted file mode 100644
index 39694d2af..000000000
--- a/navit/gui/qml/skins/navit/PageBookmarksAdd.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- Timer {
- id: backTimer
- interval: 2000;
- onTriggered: Navit.back();
- }
-
- function add(description) {
- resultTxt.text=bookmarks.AddBookmark(description);
- btnOk.opacity=0;
- btnCancel.opacity=0;
- resultTxt.opacity=1;
- backTimer.start()
- }
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text {
- id: infoTxt;
- text: point.coordString; color: "White"; font.pointSize: gui.height/20;
- anchors.top:parent.top;anchors.horizontalCenter:parent.horizontalCenter
- }
- Text {
- id: nameTxt;
- text: point.pointName; color: "White"; font.pointSize: gui.height/20;
- anchors.top:infoTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- }
-
- TextInput{
- id: searchTxt; text: "Enter bookmark name..."
- anchors.top: nameTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- width: page.width; font.pointSize: 14; color: "White";focus: true; readOnly: false
- }
-
-
- ButtonIcon {
- id: btnOk; text: "Add"; icon: "gui_active.svg"; onClicked: add(searchTxt.text)
- anchors.top: searchTxt.bottom;anchors.topMargin: 5;anchors.right:parent.horizontalCenter;anchors.rightMargin:10
- }
- ButtonIcon {
- id: btnCancel; text: "Cancel"; icon: "gui_inactive.svg"; onClicked: gui.backToPrevPage();
- anchors.top: searchTxt.bottom;anchors.topMargin: 5;anchors.left:parent.horizontalCenter;anchors.leftMargin:10
- }
-
- Text {
- id: resultTxt;
- text: point.pointName; color: "White"; font.pointSize: gui.height/20;
- anchors.top:btnCancel.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- opacity: 0
- }
-
- Cellar {id: cellar; anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageMain.qml b/navit/gui/qml/skins/navit/PageMain.qml
deleted file mode 100644
index f07ae8b06..000000000
--- a/navit/gui/qml/skins/navit/PageMain.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: main.width; height: main.height
- color: "Black"
-
- Grid {
- columns: 2; rows: 2
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.top: page.top;anchors.topMargin:page.height/10
- spacing: parent.height/6
-
- ButtonIcon {
- id: btnDestination; text: "Drive to\npoint on map"; icon: "gui_active.svg"; onClicked: { route.addDestination(); gui.backToMap() }
- }
- ButtonIcon {
- id: btnNavigate; text: "Navigate\nto . . ."; icon: "cursor.svg"; onClicked: Navit.load("PageNavigate.qml");
- }
- ButtonIcon {
- id: btnRoute; text: "Route\ninformation"; icon: "nav_destination_wh.svg"; onClicked: Navit.load("PageRoute.qml");
- }
- ButtonIcon {
- id: btnSettings; text: "Settings"; icon: "gui_settings.svg"; onClicked: Navit.load("PageSettings.qml");
- }
- }
-}
diff --git a/navit/gui/qml/skins/navit/PageNavigate.qml b/navit/gui/qml/skins/navit/PageNavigate.qml
deleted file mode 100644
index 3d4e04bc2..000000000
--- a/navit/gui/qml/skins/navit/PageNavigate.qml
+++ /dev/null
@@ -1,88 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- if (point.pointType!="Bookmark") {
- btnAddBookmark.opacity=1;
- }
- if (point.pointType!="MapPoint") {
- btnView.opacity=1;
- }
- if (point.pointType!="Position") {
- btnPosition.opacity=1;
- }
- if (point.pointType!="Destination") {
- btnDestination.opacity=1;
- }
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text {
- id: infoTxt;
- text: point.coordString; color: "White"; font.pointSize: gui.height/20;
- anchors.top:parent.top;anchors.horizontalCenter:parent.horizontalCenter
- }
- Text {
- id: nameTxt;
- text: point.pointName; color: "White"; font.pointSize: gui.height/20;
- anchors.top:infoTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- }
-
- ButtonIcon {
- id: btnView; text: "View on map"; icon: "gui_maps.svg"; onClicked: { navit.setCenter(); gui.backToMap(); }
- opacity: 0
- anchors.top: nameTxt.bottom;anchors.topMargin:gui.height/32
- anchors.left:page.left;anchors.leftMargin: gui.height/6
- }
- ButtonIcon {
- id: btnPosition; text: "Set as\nposition"; icon: "gui_active.svg"; onClicked: { navit.setPosition(); gui.backToMap() }
- opacity: 0
- anchors.top: nameTxt.bottom;anchors.topMargin:gui.height/32
- anchors.left:btnView.right;anchors.leftMargin: gui.height/6
- }
- ButtonIcon {
- id: btnDestination; text: "Set as\ndestination"; icon: "gui_active.svg"; onClicked: { route.addDestination(); gui.backToMap() }
- opacity: 0
- anchors.top: nameTxt.bottom;anchors.topMargin:gui.height/32
- anchors.left:btnPosition.right;anchors.leftMargin: gui.height/6
- }
- ButtonIcon {
- id: btnAddBookmark; text: "Add as\na bookmark"; icon: "gui_active.svg"; onClicked: Navit.load("PageBookmarksAdd.qml");
- opacity: 0
- anchors.top: nameTxt.bottom;anchors.topMargin:gui.height/32
- anchors.left:btnDestination.right;anchors.leftMargin: gui.height/6
- }
- Grid {
- columns: 4;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.top: btnDestination.bottom;anchors.topMargin:gui.height/32
- spacing: gui.height/6
- ButtonIcon {
- id: btnBookmarks; text: "Bookmarks"; icon: "gui_bookmark.svg"; onClicked: {bookmarks.moveRoot(); Navit.load("PageBookmarks.qml"); }
- }
- ButtonIcon {
- id: btnPOI; text: "Nearest\nPOIs"; icon: "attraction.svg"; onClicked: Navit.load("PagePoi.qml");
- }
- ButtonIcon {
- id: btnSearch; text: "Address\nSearch"; icon: "gui_town.svg"; onClicked: Navit.load("PageSearch.qml");
- }
- ButtonIcon {
- id: btnInfo; text: "Point\ninformation"; icon: "gui_menu.svg"; onClicked: Navit.load("PagePointInfo.qml");
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PagePoi.qml b/navit/gui/qml/skins/navit/PagePoi.qml
deleted file mode 100644
index 4ab9f5c0f..000000000
--- a/navit/gui/qml/skins/navit/PagePoi.qml
+++ /dev/null
@@ -1,150 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- property string poiFilter: ""
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function calculateFilter() {
- page.poiFilter='/points/point[type="point_begin" or ';
- if (bankBtn.state=="on") {
- page.poiFilter+='type="poi_bank" or ';
- }
- if (fuelBtn.state=="on") {
- page.poiFilter+='type="poi_fuel" or ';
- page.poiFilter+='type="poi_autoservice" or ';
- page.poiFilter+='type="poi_repair_service" or ';
- }
- if (hotelBtn.state=="on") {
- page.poiFilter+='type="poi_hotel" or ';
- page.poiFilter+='type="poi_camp_rv" or ';
- page.poiFilter+='type="poi_camping" or ';
- page.poiFilter+='type="poi_resort" or ';
- page.poiFilter+='type="poi_motel" or ';
- page.poiFilter+='type="poi_hostel" or ';
- }
- if (foodBtn.state=="on") {
- page.poiFilter+='type="poi_bar" or ';
- page.poiFilter+='type="poi_picnic" or ';
- page.poiFilter+='type="poi_burgerking" or ';
- page.poiFilter+='type="poi_fastfood" or ';
- page.poiFilter+='type="poi_restaurant" or ';
- }
- if (shopBtn.state=="on") {
- page.poiFilter+='type="poi_shop_grocery" or ';
- page.poiFilter+='type="poi_mall" or ';
- }
- if (serviceBtn.state=="on") {
- page.poiFilter+='type="poi_marina" or ';
- page.poiFilter+='type="poi_hospital" or ';
- page.poiFilter+='type="poi_public_utilities" or ';
- page.poiFilter+='type="poi_police" or ';
- page.poiFilter+='type="poi_information" or ';
- page.poiFilter+='type="poi_personal_service" or ';
- page.poiFilter+='type="poi_restroom" or ';
- }
- if (parkingBtn.state=="on") {
- page.poiFilter+='type="poi_car_parking" or ';
- }
- if (landBtn.state=="on") {
- page.poiFilter+='type="poi_land_feature" or ';
- page.poiFilter+='type="poi_rock" or ';
- page.poiFilter+='type="poi_dam" or ';
- }
- page.poiFilter+='type="point_end"]';
- listModel.query=page.poiFilter;
- listModel.reload();
- }
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text {
- id: labelTxt; text: "Points of interest"; color: "White"; font.pointSize: 14;
- anchors.horizontalCenter: page.horizontalCenter
- anchors.top: page.top
- }
-
- VisualItemModel {
- id: selectorsModel
-
- ToggleButton { id: bankBtn; text: "Bank"; icon: "bank.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: fuelBtn; text: "Fuel"; icon: "fuel.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: hotelBtn; text: "Hotel"; icon: "bar.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: foodBtn; text: "Food"; icon: "fastfood.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: shopBtn; text: "Shop"; icon: "shopping.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: serviceBtn; text: "Service"; icon: "hospital.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: parkingBtn; text: "Parking"; icon: "police.svg";stOn: "true"; onChanged: calculateFilter(); }
- ToggleButton { id: landBtn; text: "Land features"; icon: "peak.svg";stOn: "true"; onChanged: calculateFilter(); }
- }
-
- ListView {
- id: selectorsList; model: selectorsModel
- focus: true; clip: true; orientation: Qt.Horizontal
- anchors.horizontalCenter: page.horizontalCenter; anchors.top: labelTxt.bottom
- width: page.width; height: bankBtn.height*2
- }
-
- Slider {
- id: distanceSlider; minValue: 1; maxValue: 250; value: gui.getAttr("radius"); text: "Distance"; onChanged: { gui.setAttr("radius",distanceSlider.value); listModel.xml=point.getPOI("points"); listModel.reload(); }
- anchors.top: selectorsList.bottom; anchors.horizontalCenter: page.horizontalCenter;
- }
-
- XmlListModel {
- id: listModel
- xml: point.getPOI("points")
- query: "/points/point"
- XmlRole { name: "itemName"; query: "name/string()" }
- XmlRole { name: "itemType"; query: "type/string()" }
- XmlRole { name: "itemDistance"; query: "distance/string()" }
- XmlRole { name: "itemDirection"; query: "direction/string()" }
- XmlRole { name: "itemValue"; query: "coords/string()" }
- }
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Column {
- x: 5; y: 5
- Text { id: txtItemName; text: itemName; color: "White" }
- Text { id: txtItemDist; text: itemDistance; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemName.right;anchors.top: txtItemName.top }
- Text { id: txtItemDirect; text: itemDirection; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemDist.right;anchors.top: txtItemDist.top }
- }
- MouseArea {
- id:delegateMouse
- anchors.fill: parent
- onClicked: { point.setNewPoint(itemValue); gui.returnSource="/main.qml"; Navit.load("PageNavigate.qml"); }
- }
- }
- }
-
- Component {
- id: listHighlight
- Rectangle {
- opacity: 0
- }
- }
-
- ListSelector {
- id:layoutList; text: ""
- anchors.top: distanceSlider.bottom;
- anchors.left: parent.left;
- anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width; height: page.height*0.25
- }
-
- Cellar {id: cellar; anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PagePointInfo.qml b/navit/gui/qml/skins/navit/PagePointInfo.qml
deleted file mode 100644
index 1014c63df..000000000
--- a/navit/gui/qml/skins/navit/PagePointInfo.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-import Qt 4.7
-import org.webkit 1.0
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text {
- id: infoTxt;
- text: point.coordString; color: "White"; font.pointSize: gui.height/20;
- anchors.top:parent.top;anchors.horizontalCenter:parent.horizontalCenter
- }
- Text {
- id: nameTxt;
- text: point.pointName; color: "White"; font.pointSize: gui.height/20;
- anchors.top:infoTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- }
- Text {
- id: typeTxt;
- text: point.pointType; color: "White"; font.pointSize: gui.height/20;
- anchors.top:nameTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- }
- Text {
- id: urlTxt;
- text: point.pointUrl; color: "Blue"; font.pointSize: gui.height/20;font.underline: true;
- anchors.top:typeTxt.bottom;anchors.topMargin: 5;anchors.horizontalCenter:parent.horizontalCenter
- }
-
- XmlListModel {
- id: listModel
- xml: point.getInformation();
- query: "/point/element()"
- XmlRole { name: "itemType"; query: "name()" }
- XmlRole { name: "itemAttribute"; query: "string()" }
- }
-
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Column {
- x: 5; y: 5
- Text { id: txtItemType; text: itemType; color: "White"; font.bold: true; }
- Text { id: txtItemAttribute; text: itemAttribute; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemType.right;anchors.top: txtItemType.top }
- }
- }
- }
-
- Component {
- id: listHighlight
- Rectangle {
- opacity: 0
- }
- }
-
- ListSelector {
- id:layoutList; text: "Attributes";
- anchors.top: urlTxt.bottom;
- anchors.left: parent.left;
- anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width; height: page.height*0.25
- }
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageRoute.qml b/navit/gui/qml/skins/navit/PageRoute.qml
deleted file mode 100644
index a340eaa1b..000000000
--- a/navit/gui/qml/skins/navit/PageRoute.qml
+++ /dev/null
@@ -1,94 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- if (navit.getPosition().length>0) {
- btnPoi.opacity=0.8;
- }
- if (navit.getDestination().length>0 && navit.getPosition().length>0) {
- btnRouteView.opacity=0.8;
- btnRouteBook.opacity=0.8;
- btnRouteHeight.opacity=0.8;
- }
- route.getDestinations();
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Text {
- id: statusTxt;
- text: route.getAttr("route_status"); color: "White"; font.pointSize: gui.height/20;
- anchors.top:parent.top;anchors.left:parent.left;anchors.topMargin: gui.height/20;anchors.leftMargin: gui.height/20;
- }
- Text {
- id: timeLabel;
- text: "Time to drive route: "; color: "White"; font.pointSize: gui.height/20;
- anchors.top:statusTxt.top;anchors.left:statusTxt.right;anchors.leftMargin: gui.height/20;
- }
- Text {
- id: timeTxt;
- text: route.getAttr("destination_time"); color: "White"; font.pointSize: gui.height/20;
- anchors.top:timeLabel.top;anchors.left:timeLabel.right;anchors.leftMargin: gui.height/20;
- }
- Text {
- id: lengthLabel;
- text: "Route length: "; color: "White"; font.pointSize: gui.height/20;
- anchors.top:timeTxt.top;anchors.left:timeTxt.right;anchors.leftMargin: gui.height/20;
- }
- Text {
- id: lengthTxt;
- text: route.getAttr("destination_length"); color: "White"; font.pointSize: gui.height/20;
- anchors.top:lengthLabel.top;anchors.left:lengthLabel.right;anchors.leftMargin: gui.height/20;
- }
-
- Grid {
- columns: 3;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.bottom: parent.verticalCenter; anchors.bottomMargin: gui.height/16;
- spacing: gui.width/12
- ButtonIcon {
- id: btnRouteView; text: "View route"; icon: "gui_town.svg"; onClicked: { navit.command("zoom_to_route()"), gui.backToMap(); }
- opacity: 0;
- }
- ButtonIcon {
- id: btnRouteBook; text: "Roadbook"; icon: "gui_log.svg"; onClicked: console.log("Implement me!");
- opacity: 0;
- }
- ButtonIcon {
- id: btnRouteHeight; text: "Height profile"; icon: "peak.svg"; onClicked: console.log("Implement me!");
- opacity: 0;
- }
- }
-
- Grid {
- columns: 3;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
- spacing: gui.width/12
- ButtonIcon {
- id: btnView; text: "View position\non map"; icon: "gui_maps.svg"; onClicked: { navit.getPosition();navit.setCenter();gui.backToMap(); }
- }
- ButtonIcon {
- id: btnPoi; text: "POIs near\nPosition"; icon: "attraction.svg"; onClicked: Navit.load("PagePoi.qml");
- opacity: 0;
- }
- ButtonIcon {
- id: btnStop; text: "Stop"; icon: "gui_stop.svg"; onClicked: { navit.stopNavigation(); Navit.back(); }
- opacity: 0;
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSearch.qml b/navit/gui/qml/skins/navit/PageSearch.qml
deleted file mode 100644
index 3d9419920..000000000
--- a/navit/gui/qml/skins/navit/PageSearch.qml
+++ /dev/null
@@ -1,92 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- if ( search.countryName.length>0 ) {
- gridCity.opacity = 1;
- }
- if ( search.townName.length>0 ) {
- gridStreet.opacity = 1;
- }
- if ( search.streetName.length>0 ) {
- gridAddress.opacity = 0; //Disabled ,because housenamuber search is broken
- }
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Grid {
- columns: 2;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.bottom: parent.verticalCenter; anchors.bottomMargin: gui.height/16;
- spacing: gui.width/12
- Grid {
- columns: 1;rows: 2;
- id: gridCountry;
- Text {
- id: txtItemCountry; text: "Country";
- color: "White"; font.pointSize: gui.height/32; horizontalAlignment: Qt.AlignHCenter
- }
- ButtonIcon {
- id: btnCountry; text: search.countryName; icon: "country_"+search.countryISO2+".svgz"; onClicked: { search.searchContext="country"; Navit.load("PageSearchSelector.qml"); }
- }
- }
- Grid {
- columns: 1; rows: 2;
- id: gridCity
- opacity: 0;
- Text {
- id: txtItemCity; text: "Town";
- color: "White"; font.pointSize: gui.height/32; horizontalAlignment: Qt.AlignHCenter
- }
- ButtonIcon {
- id: btnCity; text: search.townName; icon: "gui_bookmark.svg"; onClicked: { search.searchContext="town"; Navit.load("PageSearchSelector.qml"); }
- }
- }
- }
-
- Grid {
- columns: 2;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
- spacing: gui.width/12
- Grid {
- columns: 1; rows: 2;
- id: gridStreet
- opacity: 0;
- Text {
- id: txtItemStreet; text: "Street";
- color: "White"; font.pointSize: gui.height/32; horizontalAlignment: Qt.AlignHCenter
- }
- ButtonIcon {
- id: btnStreet; text: search.streetName; icon: "gui_town.svg"; onClicked: { search.searchContext="street"; Navit.load("PageSearchSelector.qml"); }
- }
- }
- Grid {
- columns: 1; rows: 2;
- id: gridAddress;
- opacity: 0;
- Text {
- id: txtItemAddress; text: "Address";
- color: "White"; font.pointSize: gui.height/32; horizontalAlignment: Qt.AlignHCenter
- }
- ButtonIcon {
- id: btnAddress; text: "Address"; icon: "attraction.svg"; onClicked: console.log("Implement me!");
- }
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSearchSelector.qml b/navit/gui/qml/skins/navit/PageSearchSelector.qml
deleted file mode 100644
index ec1ca73dd..000000000
--- a/navit/gui/qml/skins/navit/PageSearchSelector.qml
+++ /dev/null
@@ -1,108 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- color: "Black"
- opacity: 0
-
- function setSearchResult(listValue) {
- if (search.searchContext=="country") {
- search.countryName=listValue;
- Navit.back;
- }
- if (search.searchContext=="town") {
- search.townName=listValue;
- Navit.back();
- }
- if (search.searchContext=="street") {
- search.streetName=listValue;
- search.setPointToResult();
- Navit.returnSource="main.qml";
- Navit.load("PageNavigate.qml");
- }
- }
-
- function pageOpen() {
- if (search.searchContext=="country") {
- searchTxt.text=search.countryName;
- countryBinding.when=true;
- }
- if (search.searchContext=="town") {
- searchTxt.text=search.townName;
- townBinding.when=true;
- }
- if (search.searchContext=="street") {
- searchTxt.text=search.streetName;
- streetBinding.when=true;
- }
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- TextInput{
- id: searchTxt;
- anchors.top: parent.top; anchors.left: parent.left; anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width; font.pointSize: 14; color: "White";focus: true; readOnly: false; cursorVisible: true;
- }
- Binding {id: countryBinding; target: search; property: "countryName"; value: searchTxt.text; when: false}
- Binding {id: townBinding; target: search; property: "townName"; value: searchTxt.text; when: false}
- Binding {id: streetBinding; target: search; property: "streetName"; value: searchTxt.text; when: false}
-
- Connections { target: search; onCountryNameSignal: {listModel.xml=search.searchXml(); listModel.query="/search/item"; listModel.reload(); } }
- Connections { target: search; onTownNameSignal: {listModel.xml=search.searchXml(); listModel.query="/search/item"; listModel.reload(); } }
- Connections { target: search; onStreetNameSignal: {listModel.xml=search.searchXml(); listModel.query="/search/item"; listModel.reload(); } }
-
- XmlListModel {
- id: listModel
- xml: search.searchXml();
- query: "/search/item"
- XmlRole { name: "itemId"; query: "id/string()" }
- XmlRole { name: "itemName"; query: "name/string()" }
- XmlRole { name: "itemIcon"; query: "icon/string()" }
- }
-
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Image {
- id: imgIcon; source: gui.iconPath+itemIcon
- width: 20; height: 20;
- }
- Text {
- id: txtItemName; text: itemName; color: "White";
- anchors.left: imgIcon.right;anchors.leftMargin: 5
- width: list.width-imgIcon.width
- }
- MouseArea {
- id:delegateMouse
- anchors.fill: parent
- onClicked: { setSearchResult(itemName); }
- }
- }
- }
-
- Component {
- id: listHighlight
- Rectangle {
- opacity: 0
- }
- }
-
- ListSelector {
- id:layoutList; text: search.searchContext; onChanged: setSearchResult()
- anchors.top: searchTxt.bottom; anchors.left: parent.left; anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width; height: page.height/2-cellar.height
- }
-
- Cellar {id: cellar; anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettings.qml b/navit/gui/qml/skins/navit/PageSettings.qml
deleted file mode 100644
index f7efcacd5..000000000
--- a/navit/gui/qml/skins/navit/PageSettings.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Grid {
- columns: 3;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.bottom: parent.verticalCenter; anchors.bottomMargin: gui.height/16;
- spacing: gui.width/12
- ButtonIcon {
- id: btnDisplay; text: "Display"; icon: "gui_display.svg"; onClicked: Navit.load("PageSettingsDisplay.qml");
- }
- ButtonIcon {
- id: btnMap; text: "Map"; icon: "gui_maps.svg"; onClicked: console.log("Implement me!");
- }
- ButtonIcon {
- id: btnVehicle; text: "Vehicle"; icon: "gui_vehicle.svg"; onClicked: Navit.load("PageSettingsVehicle.qml");
- }
- }
- Grid {
- columns: 3;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
- spacing: gui.width/12
- ButtonIcon {
- id: btnRules; text: "Rules"; icon: "gui_rules.svg"; onClicked: Navit.load("PageSettingsRules.qml");
- }
- ButtonIcon {
- id: btnTools; text: "Tools"; icon: "gui_tools.svg"; onClicked: Navit.load("PageSettingsTools.qml");
- }
- ButtonIcon {
- id: btnAbout; text: "About"; icon: "gui_about.svg"; onClicked: Navit.load("PageAbout.qml");
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettingsDisplay.qml b/navit/gui/qml/skins/navit/PageSettingsDisplay.qml
deleted file mode 100644
index 61db6a385..000000000
--- a/navit/gui/qml/skins/navit/PageSettingsDisplay.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function setTripleD(flag) {
- if ( flag=="true" ) {
- navit.setAttr("pitch",gui.getAttr("pitch"));
- pitchSlider.value = navit.getAttr("pitch");
- pitchSlider.startup();
- pitchSlider.opacity = 1
- } else {
- navit.setAttr("pitch","0");
- pitchSlider.opacity = 0
- }
- }
-
- function isTripleD() {
- if ( navit.getAttr("pitch") == "0" )
- return "0";
- else
- return "1";
- }
-
- function pageOpen() {
- if ( isTripleD() == "1" ) {
- pitchSlider.opacity = 1
- }
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Column {
- x: 5; y: 5
- Text { id: txtItemName; text: itemName; color: "White" }
- Text { id: txtItemDist; text: itemDistance; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemName.right;anchors.top: txtItemName.top }
- Text { id: txtItemDirect; text: itemDirection; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemDist.right;anchors.top: txtItemDist.top }
- }
- MouseArea {
- id:delegateMouse
- anchors.fill: parent
- onClicked: { list.currentIndex=itemId; listselector.value=itemValue; listselector.changed() }
- }
- }
- }
-
- CommonHighlight { id: listHighlight}
-
- ListSelector {
- id:layoutList; text: "Current layout"; itemId: navit.getAttrList("layout"); onChanged: navit.setObjectByName("layout",layoutList.value)
- anchors.top: parent.top;
- anchors.left: parent.left;
- anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- width: page.width/2; height: page.height*0.25
- }
- Grid {
- columns: 1; rows: 3
- anchors.right: parent.right
- anchors.top: parent.top;
- anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- spacing: gui.width/12
- ToggleSwitch {
- id: fullscreenSw; stOn: gui.getAttr("fullscreen"); text: "Fullscreen"; onChanged: gui.setAttr("fullscreen",fullscreenSw.stOn)
- }
- ToggleSwitch {
- id: tripledSw; stOn: page.isTripleD(); text: "2D/3D"; onChanged: setTripleD(tripledSw.stOn)
- }
- Slider {
- id: pitchSlider; minValue: 5; maxValue: 90; value: navit.getAttr("pitch"); text: "Pitch"; onChanged: { navit.setAttr("pitch",pitchSlider.value); gui.setAttr("pitch",pitchSlider.value) }
- opacity: 0
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettingsLocale.qml b/navit/gui/qml/skins/navit/PageSettingsLocale.qml
deleted file mode 100644
index 441248484..000000000
--- a/navit/gui/qml/skins/navit/PageSettingsLocale.qml
+++ /dev/null
@@ -1,33 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Grid {
- columns: 1;rows: 3
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.verticalCenter: parent.verticalCenter;
-
- Text { id: lang; text: gui.localeName; color: "White";font.pointSize: gui.height/24 }
- Text { id: langname; text: gui.langName; color: "White";font.pointSize: gui.height/24 }
- Text { id: ctryname; text: gui.ctryName; color: "White";font.pointSize: gui.height/24 }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettingsRules.qml b/navit/gui/qml/skins/navit/PageSettingsRules.qml
deleted file mode 100644
index e5238f584..000000000
--- a/navit/gui/qml/skins/navit/PageSettingsRules.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- VisualItemModel {
- id: selectorsModel
-
- ToggleSwitch { id: trackingSw; stOn: navit.getAttr("tracking"); text: "Lock on road"; onChanged: navit.setAttr("tracking",trackingSw.stOn) }
- ToggleSwitch { id: orientationSw; stOn: navit.getAttr("orientation"); text: "Northing"; onChanged: navit.setAttr("orientation",orientationSw.stOn) }
- ToggleSwitch { id: followcursorSw; stOn: navit.getAttr("follow_cursor"); text: "Map follows Vehicle"; onChanged: navit.setAttr("follow_cursor",followcursorSw.stOn) }
- ToggleSwitch { id: autozoomSw; stOn: navit.getAttr("autozoom_active"); text: "Auto zoom"; onChanged: navit.setAttr("autozoom_active",autozoomSw.stOn) }
- }
-
- ListView {
- id: selectorsList; model: selectorsModel
- focus: true; clip: true; orientation: Qt.Vertical
- anchors.verticalCenter: parent.verticalCenter; anchors.horizontalCenter: parent.horizontalCenter;
- width: trackingSw.width*1.5; height: trackingSw.height*4
- }
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettingsTools.qml b/navit/gui/qml/skins/navit/PageSettingsTools.qml
deleted file mode 100644
index a4af1222e..000000000
--- a/navit/gui/qml/skins/navit/PageSettingsTools.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- Grid {
- columns: 1;rows: 1
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.verticalCenter: parent.verticalCenter;
- ButtonIcon {
- id: btnDisplay; text: "Locale"; icon: "gui_actions.svg"; onClicked: Navit.load("PageSettingsLocale.qml");
- }
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/PageSettingsVehicle.qml b/navit/gui/qml/skins/navit/PageSettingsVehicle.qml
deleted file mode 100644
index 157afcb00..000000000
--- a/navit/gui/qml/skins/navit/PageSettingsVehicle.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: page
-
- width: gui.width; height: gui.height
- border.width: 1
- color: "Black"
- opacity: 0
-
- function pageOpen() {
- page.opacity = 1;
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
- XmlListModel {
- id: listModel
- xml: navit.getAttrList("vehicle");
- query: "/attributes/vehicle"
- XmlRole { name: "itemId"; query: "id/string()" }
- XmlRole { name: "itemName"; query: "name/string()" }
- }
-
- Component {
- id: listDelegate
- Item {
- id: wrapper
- width: list.width; height: txtItemName.height
- Column {
- x: 5; y: 5
- Text { id: txtItemName; text: itemName; color: "White"; font.pointSize: 42 }
- }
- MouseArea {
- id:delegateMouse
- anchors.fill: parent
- onClicked: { list.currentIndex=itemId; listselector.value=itemName; listselector.changed() }
- }
- }
- }
- CommonHighlight { id: listHighlight}
-
- ListSelector {
- id:vehicleList; text: "Current vehicle profile"; itemId: navit.itemId; onChanged: {navit.setObjectByName("vehicle",vehicleList.value) }
- anchors.top: parent.top; anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
- anchors.left: parent.left; width: page.width/2;height: page.height/2
- }
-
- ButtonIcon {
- id: btnVehicle; text: navit.getAttr("vehicle"); icon: "gui_vehicle.svg"; onClicked: Navit.load("PageSettingsVehicleOptions.qml");
- anchors.verticalCenter: vehicleList.verticalCenter; anchors.leftMargin: gui.width/32
- anchors.left: vehicleList.right;
- }
-
- Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
-}
diff --git a/navit/gui/qml/skins/navit/Slider.qml b/navit/gui/qml/skins/navit/Slider.qml
deleted file mode 100644
index e4d56e031..000000000
--- a/navit/gui/qml/skins/navit/Slider.qml
+++ /dev/null
@@ -1,74 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- id: slider
- width: background.width + label.width + gui.width/24; height: label.height
- color: "Black"
-
- property int minValue: 0
- property int value: 50
- property int maxValue: 100
- property string text: "Slider"
- signal changed
-
- function toSlider(inputVal) {
- return 2+(((inputVal-minValue)/(maxValue-minValue))*(background.width-knob.width-2));
- }
- function fromSlider(inputVal) {
- return minValue+(((inputVal-2)/(background.width-knob.width-2))*(maxValue-minValue));
- }
-
- function startup () {
- if ( slider.value < slider.minValue ) {
- slider.value = slider.minValue;
- }
- if ( slider.value > slider.maxValue ) {
- slider.value = slider.maxValue;
- }
- knob.x = toSlider(slider.value);
- }
-
- Component.onCompleted: startup();
-
- Rectangle {
- id: background
- x: 20; width: gui.width/5; height: gui.height/24
- gradient: Gradient {
- GradientStop { position: 0.0; color: "steelblue" }
- GradientStop { position: 1.0; color: "lightsteelblue" }
- }
- MouseArea {
- anchors.fill: parent
- onReleased: { knob.x=mouse.x-15; slider.value=Math.round(fromSlider(knob.x)); slider.changed(); }
- }
-
- radius: 8; opacity: 0.7
- Rectangle {
- id: knob
- x: 2; y: 2; width: gui.width/26; height: gui.height/35
- radius: 6
- gradient: Gradient {
- GradientStop { position: 0.0; color: "lightgray" }
- GradientStop { position: 1.0; color: "gray" }
- }
- MouseArea {
- anchors.fill: parent
- drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: background.width-knob.width
- onPositionChanged: slider.value=Math.round(fromSlider(knob.x))
- onReleased: slider.changed()
- }
- }
- Text {
- id: valueTxt; text: slider.value; color: "White"; font.pointSize: gui.height/32;
- anchors.horizontalCenter: knob.horizontalCenter;
- anchors.verticalCenter: knob.verticalCenter
- }
- }
-
-
- Text {
- id: label; text: slider.text; color: "White"; font.pointSize: gui.height/24;
- anchors.left: background.right; anchors.leftMargin: gui.width/24;
- anchors.verticalCenter: background.verticalCenter
- }
-}
diff --git a/navit/gui/qml/skins/navit/ToggleButton.qml b/navit/gui/qml/skins/navit/ToggleButton.qml
deleted file mode 100644
index 29d986601..000000000
--- a/navit/gui/qml/skins/navit/ToggleButton.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-import Qt 4.7
-
- Item {
- id: togglebutton
- width: imgItem.width + txtItem.width + gui.width/24; height: imgItem.height
-
- property string stOn: "false"
- property string text: "Toggle button"
- property string icon: "Icon.png"
-
- signal changed
-
- function toggle() {
- if (togglebutton.state == "on")
- togglebutton.state = "off";
- else
- togglebutton.state = "on";
- }
-
- function startup () {
- if (togglebutton.stOn == "1" )
- togglebutton.stOn = "true";
- else if (togglebutton.stOn == "0" )
- togglebutton.stOn = "false";
- if (togglebutton.stOn == "true")
- togglebutton.state = "on";
- else
- togglebutton.state = "off";
- }
-
- Component.onCompleted: startup();
-
- MouseArea { id: mr; anchors.fill: parent; onReleased: toggle() }
-
- Image {
- id: imgItem; source: gui.iconPath+togglebutton.icon; anchors.top: togglebutton.top; anchors.horizontalCenter: togglebutton.horizontalCenter;
- width: gui.height/32; height: gui.height/32
- }
-
- Text {
- id: txtItem; text: togglebutton.text; anchors.top: imgItem.bottom; anchors.horizontalCenter: togglebutton.horizontalCenter;
- color: "White"; font.pointSize: gui.height/64; horizontalAlignment: Qt.AlignHCenter
- }
-
- states: [
- State {
- name: "on"
- PropertyChanges { target: imgItem; opacity: 1 }
- PropertyChanges { target: txtItem; opacity: 1 }
- PropertyChanges { target: togglebutton; stOn: "true" }
- StateChangeScript { script: togglebutton.changed(); }
- },
- State {
- name: "off"
- PropertyChanges { target: imgItem; opacity: 0.3 }
- PropertyChanges { target: txtItem; opacity: 0.3 }
- PropertyChanges { target: togglebutton; stOn: "false" }
- StateChangeScript { script: togglebutton.changed(); }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 }
- NumberAnimation { properties: "opacity"; easing.type: "InQuad"; duration: 200 }
- }
- }
diff --git a/navit/gui/qml/skins/navit/ToggleSwitch.qml b/navit/gui/qml/skins/navit/ToggleSwitch.qml
deleted file mode 100644
index b1b262461..000000000
--- a/navit/gui/qml/skins/navit/ToggleSwitch.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-import Qt 4.7
-
- Item {
- id: toggleswitch
- width: background.width + label.width + gui.width/24; height: background.height
-
- property string stOn: "false"
- property string text: "Toggle switch"
- signal changed
-
- function toggle() {
- if (toggleswitch.state == "on")
- toggleswitch.state = "off";
- else toggleswitch.state = "on";
- }
-
- function startup () {
- if (toggleswitch.stOn == "1" )
- toggleswitch.stOn = "true";
- else if (toggleswitch.stOn == "0" )
- toggleswitch.stOn = "false";
- if (toggleswitch.stOn == "true")
- toggleswitch.state = "on";
- else
- toggleswitch.state = "off";
- }
-
- Component.onCompleted: startup();
-
- Text {
- id: label; text: toggleswitch.text; color: "White"; font.pointSize: gui.height/20;
- anchors.left: background.right; anchors.leftMargin: gui.width/24;
- anchors.verticalCenter: background.verticalCenter
- }
-
-
- Image {
- id: background; source: "background.svg"
- MouseArea { anchors.fill: parent; onClicked: toggle() }
- height: gui.height/6; width: height*2.4;
- }
-
- Image {
- id: knob; source: "knob.svg"; x: 1; y: 2
- height: gui.height/6; width: gui.height/6;
-
- MouseArea {
- anchors.fill: parent
- drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: background.width-knob.width
- hoverEnabled: false; onReleased: toggle()
- }
- }
-
- states: [
- State {
- name: "on"
- PropertyChanges { target: knob; x: background.width-knob.width }
- PropertyChanges { target: toggleswitch; stOn: "true" }
- StateChangeScript { script: toggleswitch.changed(); }
- },
- State {
- name: "off"
- PropertyChanges { target: knob; x: 1 }
- PropertyChanges { target: toggleswitch; stOn: "false" }
- StateChangeScript { script: toggleswitch.changed(); }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: "InOutQuad"; duration: 200 }
- }
- }
diff --git a/navit/gui/qml/skins/navit/background.svg b/navit/gui/qml/skins/navit/background.svg
deleted file mode 100644
index f920d3e47..000000000
--- a/navit/gui/qml/skins/navit/background.svg
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
-]>
-<svg version="1.1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
- x="0px" y="0px" width="130px" height="56px" viewBox="0 0 130 56" enable-background="new 0 0 130 56" xml:space="preserve">
-<defs>
-</defs>
-<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-37.5005" y1="-66" x2="-37.5005" y2="-121.9985" gradientTransform="matrix(1 0 0 -1 102.5 -66)">
- <stop offset="0.0056" style="stop-color:#000000"/>
- <stop offset="1" style="stop-color:#EAECEF"/>
-</linearGradient>
-<path fill="url(#SVGID_1_)" d="M101.998,55.998H28c-15.439,0-28-12.562-28-28C0,12.56,12.561,0,28,0h73.998
- c15.439,0,28,12.559,28,27.998C129.998,43.438,117.438,55.998,101.998,55.998L101.998,55.998z"/>
-<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-5.5" y1="-132.1338" x2="-69.5002" y2="-55.8613" gradientTransform="matrix(1 0 0 -1 102.5 -66)">
- <stop offset="0.0056" style="stop-color:#000000"/>
- <stop offset="1" style="stop-color:#828385"/>
-</linearGradient>
-<path fill="url(#SVGID_2_)" d="M127.999,27.998c0,14.359-11.642,26-26,26h-74c-14.359,0-26-11.641-26-26l0,0
- c0-14.359,11.641-26,26-26h74C116.357,1.998,127.999,13.639,127.999,27.998L127.999,27.998z"/>
-</svg>
diff --git a/navit/gui/qml/skins/navit/command.js b/navit/gui/qml/skins/navit/command.js
deleted file mode 100644
index 071653acf..000000000
--- a/navit/gui/qml/skins/navit/command.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- id: page
-
- function pageOpen(command) {
- if ( command=="menu") {
- gui.returnSource="";
- Loader {source: "main.qml"};
- }
- if (command=="quit") {
- navit.quit();
- }
-
- }
-
- Component.onCompleted: pageOpen(gui.commandFunction);
-
- Text { id: myText; anchors.centerIn: parent; text: "Hi, i'm Navit!"; color: "Black"; font.pointSize: gui.height/32 }
-}
diff --git a/navit/gui/qml/skins/navit/knob.svg b/navit/gui/qml/skins/navit/knob.svg
deleted file mode 100644
index fb6933718..000000000
--- a/navit/gui/qml/skins/navit/knob.svg
+++ /dev/null
@@ -1,867 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- x="0px"
- y="0px"
- width="52px"
- height="52px"
- viewBox="0 0 52 52"
- enable-background="new 0 0 52 52"
- xml:space="preserve"
- id="svg3883"
- sodipodi:version="0.32"
- inkscape:version="0.44.1"
- sodipodi:docname="knob_on.svg"
- sodipodi:docbase="/local/axel/embeddedwidgets/embeddedstories/skins/svgslideswitch/MetallicBrush"><metadata
- id="metadata4200"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
- inkscape:window-height="640"
- inkscape:window-width="937"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- guidetolerance="10.0"
- gridtolerance="10.0"
- objecttolerance="10.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- inkscape:zoom="8.3653846"
- inkscape:cx="26.000002"
- inkscape:cy="26"
- inkscape:window-x="0"
- inkscape:window-y="0"
- inkscape:current-layer="svg3883" />
-<defs
- id="defs3885">
-</defs>
-<linearGradient
- id="SVGID_1_"
- gradientUnits="userSpaceOnUse"
- x1="-59.7866"
- y1="-115.917"
- x2="-93.2123"
- y2="-76.0818"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#000000"
- id="stop3888" />
- <stop
- offset="1"
- style="stop-color:#EAECEF"
- id="stop3890" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="26"
- id="circle3892"
- style="fill:url(#SVGID_1_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="26"
- sodipodi:ry="26"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_2_"
- gradientUnits="userSpaceOnUse"
- x1="-100.5"
- y1="-96"
- x2="-52.5"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop3895" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop3897" />
- <stop
- offset="0.6043"
- style="stop-color:#E7EAED"
- id="stop3899" />
- <stop
- offset="0.6751"
- style="stop-color:#DEE4E7"
- id="stop3901" />
- <stop
- offset="0.7358"
- style="stop-color:#CFD9DD"
- id="stop3903" />
- <stop
- offset="0.791"
- style="stop-color:#B9CACF"
- id="stop3905" />
- <stop
- offset="0.8425"
- style="stop-color:#9EB6BD"
- id="stop3907" />
- <stop
- offset="0.891"
- style="stop-color:#7B9EA7"
- id="stop3909" />
- <stop
- offset="0.9374"
- style="stop-color:#53828C"
- id="stop3911" />
- <stop
- offset="0.9809"
- style="stop-color:#25626E"
- id="stop3913" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop3915" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="24"
- id="circle3917"
- style="fill:url(#SVGID_2_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="24"
- sodipodi:ry="24"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_3_"
- gradientUnits="userSpaceOnUse"
- x1="-98.6328"
- y1="-96"
- x2="-54.3672"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop3920" />
- <stop
- offset="0.073"
- style="stop-color:#8FAECB"
- id="stop3922" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop3924" />
- <stop
- offset="0.5902"
- style="stop-color:#E7E9ED"
- id="stop3926" />
- <stop
- offset="0.618"
- style="stop-color:#E4E7EB"
- id="stop3928" />
- <stop
- offset="0.6697"
- style="stop-color:#E0E4E9"
- id="stop3930" />
- <stop
- offset="0.7211"
- style="stop-color:#D4DCE1"
- id="stop3932" />
- <stop
- offset="0.7722"
- style="stop-color:#C0CFD5"
- id="stop3934" />
- <stop
- offset="0.809"
- style="stop-color:#ADC2C9"
- id="stop3936" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop3938" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="22.132999"
- id="circle3940"
- style="fill:url(#SVGID_3_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="22.132999"
- sodipodi:ry="22.132999"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_4_"
- gradientUnits="userSpaceOnUse"
- x1="-96.7671"
- y1="-96"
- x2="-56.2324"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop3943" />
- <stop
- offset="0.073"
- style="stop-color:#86A7C4"
- id="stop3945" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop3947" />
- <stop
- offset="0.577"
- style="stop-color:#E7EAED"
- id="stop3949" />
- <stop
- offset="0.618"
- style="stop-color:#E1E6EA"
- id="stop3951" />
- <stop
- offset="0.6697"
- style="stop-color:#DDE3E8"
- id="stop3953" />
- <stop
- offset="0.7211"
- style="stop-color:#D1DBE1"
- id="stop3955" />
- <stop
- offset="0.7722"
- style="stop-color:#BDCDD5"
- id="stop3957" />
- <stop
- offset="0.809"
- style="stop-color:#AAC0CA"
- id="stop3959" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop3961" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="20.267"
- id="circle3963"
- style="fill:url(#SVGID_4_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="20.267"
- sodipodi:ry="20.267"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_5_"
- gradientUnits="userSpaceOnUse"
- x1="-94.8999"
- y1="-96"
- x2="-58.0996"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop3966" />
- <stop
- offset="0.073"
- style="stop-color:#7E9FBC"
- id="stop3968" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop3970" />
- <stop
- offset="0.5709"
- style="stop-color:#E6E9ED"
- id="stop3972" />
- <stop
- offset="0.618"
- style="stop-color:#DFE4E9"
- id="stop3974" />
- <stop
- offset="0.6687"
- style="stop-color:#DBE1E7"
- id="stop3976" />
- <stop
- offset="0.7193"
- style="stop-color:#CFD9E0"
- id="stop3978" />
- <stop
- offset="0.7695"
- style="stop-color:#BBCCD6"
- id="stop3980" />
- <stop
- offset="0.809"
- style="stop-color:#A6BECA"
- id="stop3982" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop3984" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="18.4"
- id="circle3986"
- style="fill:url(#SVGID_5_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="18.4"
- sodipodi:ry="18.4"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_6_"
- gradientUnits="userSpaceOnUse"
- x1="-93.0332"
- y1="-96"
- x2="-59.9668"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop3989" />
- <stop
- offset="0.073"
- style="stop-color:#7697B4"
- id="stop3991" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop3993" />
- <stop
- offset="0.5636"
- style="stop-color:#E6E9ED"
- id="stop3995" />
- <stop
- offset="0.618"
- style="stop-color:#DCE2E8"
- id="stop3997" />
- <stop
- offset="0.6687"
- style="stop-color:#D8DFE6"
- id="stop3999" />
- <stop
- offset="0.7193"
- style="stop-color:#CCD7E0"
- id="stop4001" />
- <stop
- offset="0.7695"
- style="stop-color:#B8CAD5"
- id="stop4003" />
- <stop
- offset="0.809"
- style="stop-color:#A3BCCA"
- id="stop4005" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4007" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="16.533001"
- id="circle4009"
- style="fill:url(#SVGID_6_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="16.533001"
- sodipodi:ry="16.533001"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_7_"
- gradientUnits="userSpaceOnUse"
- x1="-91.167"
- y1="-96"
- x2="-61.833"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4012" />
- <stop
- offset="0.073"
- style="stop-color:#6D8FAD"
- id="stop4014" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4016" />
- <stop
- offset="0.5605"
- style="stop-color:#E5E8EC"
- id="stop4018" />
- <stop
- offset="0.618"
- style="stop-color:#DAE1E7"
- id="stop4020" />
- <stop
- offset="0.6679"
- style="stop-color:#D6DEE5"
- id="stop4022" />
- <stop
- offset="0.7175"
- style="stop-color:#CAD6DF"
- id="stop4024" />
- <stop
- offset="0.7669"
- style="stop-color:#B6C9D6"
- id="stop4026" />
- <stop
- offset="0.809"
- style="stop-color:#9FBACB"
- id="stop4028" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4030" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="14.667"
- id="circle4032"
- style="fill:url(#SVGID_7_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="14.667"
- sodipodi:ry="14.667"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_8_"
- gradientUnits="userSpaceOnUse"
- x1="-89.2998"
- y1="-96"
- x2="-63.7002"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4035" />
- <stop
- offset="0.073"
- style="stop-color:#6587A5"
- id="stop4037" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4039" />
- <stop
- offset="0.5588"
- style="stop-color:#E4E8EC"
- id="stop4041" />
- <stop
- offset="0.618"
- style="stop-color:#D8DFE7"
- id="stop4043" />
- <stop
- offset="0.6675"
- style="stop-color:#D4DCE5"
- id="stop4045" />
- <stop
- offset="0.7167"
- style="stop-color:#C8D5E0"
- id="stop4047" />
- <stop
- offset="0.7657"
- style="stop-color:#B4C8D6"
- id="stop4049" />
- <stop
- offset="0.809"
- style="stop-color:#9CB8CB"
- id="stop4051" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4053" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="12.8"
- id="circle4055"
- style="fill:url(#SVGID_8_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="12.8"
- sodipodi:ry="12.8"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_9_"
- gradientUnits="userSpaceOnUse"
- x1="-87.4331"
- y1="-96"
- x2="-65.5664"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4058" />
- <stop
- offset="0.073"
- style="stop-color:#5D809D"
- id="stop4060" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4062" />
- <stop
- offset="0.5567"
- style="stop-color:#E3E7EC"
- id="stop4064" />
- <stop
- offset="0.618"
- style="stop-color:#D5DDE6"
- id="stop4066" />
- <stop
- offset="0.6671"
- style="stop-color:#D1DAE4"
- id="stop4068" />
- <stop
- offset="0.7159"
- style="stop-color:#C5D3DF"
- id="stop4070" />
- <stop
- offset="0.7645"
- style="stop-color:#B1C6D6"
- id="stop4072" />
- <stop
- offset="0.809"
- style="stop-color:#98B5CB"
- id="stop4074" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4076" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="10.933"
- id="circle4078"
- style="fill:url(#SVGID_9_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="10.933"
- sodipodi:ry="10.933"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_10_"
- gradientUnits="userSpaceOnUse"
- x1="-85.5659"
- y1="-96"
- x2="-67.4336"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4081" />
- <stop
- offset="0.073"
- style="stop-color:#547896"
- id="stop4083" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4085" />
- <stop
- offset="0.5588"
- style="stop-color:#E1E6EB"
- id="stop4087" />
- <stop
- offset="0.618"
- style="stop-color:#D3DCE5"
- id="stop4089" />
- <stop
- offset="0.6663"
- style="stop-color:#CFD9E3"
- id="stop4091" />
- <stop
- offset="0.7143"
- style="stop-color:#C3D2DF"
- id="stop4093" />
- <stop
- offset="0.7621"
- style="stop-color:#AFC5D7"
- id="stop4095" />
- <stop
- offset="0.809"
- style="stop-color:#94B3CC"
- id="stop4097" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4099" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="9.066"
- id="circle4101"
- style="fill:url(#SVGID_10_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="9.066"
- sodipodi:ry="9.066"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_11_"
- gradientUnits="userSpaceOnUse"
- x1="-83.7002"
- y1="-96"
- x2="-69.2998"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4104" />
- <stop
- offset="0.073"
- style="stop-color:#4C708E"
- id="stop4106" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4108" />
- <stop
- offset="0.5625"
- style="stop-color:#DEE4EA"
- id="stop4110" />
- <stop
- offset="0.618"
- style="stop-color:#D0DAE4"
- id="stop4112" />
- <stop
- offset="0.6663"
- style="stop-color:#CCD7E2"
- id="stop4114" />
- <stop
- offset="0.7143"
- style="stop-color:#C0D0DE"
- id="stop4116" />
- <stop
- offset="0.7621"
- style="stop-color:#ACC3D6"
- id="stop4118" />
- <stop
- offset="0.809"
- style="stop-color:#91B1CC"
- id="stop4120" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4122" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="7.1999998"
- id="circle4124"
- style="fill:url(#SVGID_11_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="7.1999998"
- sodipodi:ry="7.1999998"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_12_"
- gradientUnits="userSpaceOnUse"
- x1="-81.833"
- y1="-96"
- x2="-71.167"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4127" />
- <stop
- offset="0.073"
- style="stop-color:#446986"
- id="stop4129" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4131" />
- <stop
- offset="0.5757"
- style="stop-color:#D9E0E8"
- id="stop4133" />
- <stop
- offset="0.618"
- style="stop-color:#CED8E3"
- id="stop4135" />
- <stop
- offset="0.6655"
- style="stop-color:#CAD5E2"
- id="stop4137" />
- <stop
- offset="0.7129"
- style="stop-color:#BECEDD"
- id="stop4139" />
- <stop
- offset="0.7601"
- style="stop-color:#AAC1D6"
- id="stop4141" />
- <stop
- offset="0.807"
- style="stop-color:#8EB0CC"
- id="stop4143" />
- <stop
- offset="0.809"
- style="stop-color:#8DAFCC"
- id="stop4145" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4147" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="5.3330002"
- id="circle4149"
- style="fill:url(#SVGID_12_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="5.3330002"
- sodipodi:ry="5.3330002"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_13_"
- gradientUnits="userSpaceOnUse"
- x1="-79.9658"
- y1="-96"
- x2="-73.0342"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4152" />
- <stop
- offset="0.073"
- style="stop-color:#3B617F"
- id="stop4154" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4156" />
- <stop
- offset="0.6087"
- style="stop-color:#CED9E3"
- id="stop4158" />
- <stop
- offset="0.618"
- style="stop-color:#CBD7E2"
- id="stop4160" />
- <stop
- offset="0.6655"
- style="stop-color:#C7D4E1"
- id="stop4162" />
- <stop
- offset="0.7129"
- style="stop-color:#BBCDDD"
- id="stop4164" />
- <stop
- offset="0.7601"
- style="stop-color:#A7C0D6"
- id="stop4166" />
- <stop
- offset="0.807"
- style="stop-color:#8BAECD"
- id="stop4168" />
- <stop
- offset="0.809"
- style="stop-color:#8AADCD"
- id="stop4170" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4172" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="3.4660001"
- id="circle4174"
- style="fill:url(#SVGID_13_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="3.4660001"
- sodipodi:ry="3.4660001"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-<linearGradient
- id="SVGID_14_"
- gradientUnits="userSpaceOnUse"
- x1="-78.1001"
- y1="-96"
- x2="-74.9004"
- y2="-96"
- gradientTransform="matrix(1,0,0,-1,102.5,-70)">
- <stop
- offset="0.0056"
- style="stop-color:#8AADCE"
- id="stop4177" />
- <stop
- offset="0.073"
- style="stop-color:#335977"
- id="stop4179" />
- <stop
- offset="0.5"
- style="stop-color:#EAECEF"
- id="stop4181" />
- <stop
- offset="0.618"
- style="stop-color:#C9D5E1"
- id="stop4183" />
- <stop
- offset="0.6648"
- style="stop-color:#C5D3E0"
- id="stop4185" />
- <stop
- offset="0.7114"
- style="stop-color:#B9CBDC"
- id="stop4187" />
- <stop
- offset="0.758"
- style="stop-color:#A5BFD6"
- id="stop4189" />
- <stop
- offset="0.8042"
- style="stop-color:#89ADCE"
- id="stop4191" />
- <stop
- offset="0.809"
- style="stop-color:#86ABCD"
- id="stop4193" />
- <stop
- offset="1"
- style="stop-color:#0E525F"
- id="stop4195" />
-</linearGradient>
-<circle
- cx="26"
- cy="26"
- r="1.6"
- id="circle4197"
- style="fill:url(#SVGID_14_)"
- sodipodi:cx="26"
- sodipodi:cy="26"
- sodipodi:rx="1.6"
- sodipodi:ry="1.6"
- transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
-</svg> \ No newline at end of file
diff --git a/navit/gui/qml/skins/navit/main.qml b/navit/gui/qml/skins/navit/main.qml
deleted file mode 100644
index 20b93d113..000000000
--- a/navit/gui/qml/skins/navit/main.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-import Qt 4.7
-import "pagenavigation.js" as Navit
-
-Rectangle {
- id: main
- property variant returnPath:[ "test" ]
-
- width: gui.width; height: gui.height
- color: "Black"
-
- function pageOpen() {
- Navit.load("PageMain.qml");
- }
-
- Component.onCompleted: pageOpen();
-
- Behavior on opacity {
- NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
- }
-
-
- Loader {
- id: pageLoader;
- width: gui.width;
- height: gui.height-cellar.height;
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.verticalCenter: parent.verticalCenter;
- }
-
- Cellar {id: cellar;anchors.bottom: main.bottom; anchors.horizontalCenter: main.horizontalCenter; width: main.width }
-}
diff --git a/navit/gui/qml/skins/navit/pagenavigation.js b/navit/gui/qml/skins/navit/pagenavigation.js
deleted file mode 100644
index f5b8dc43e..000000000
--- a/navit/gui/qml/skins/navit/pagenavigation.js
+++ /dev/null
@@ -1,15 +0,0 @@
-var returnPath=new Array();
-
-function load(page) {
- gui.pushPage(page);
- pageLoader.source=page;
- cellar.onStartup(page);
-}
-
-function back() {
- var page=gui.popPage();
- console.log(page);
- pageLoader.source=page;
- cellar.onStartup(page);
-}
-
diff --git a/navit/gui/qml/vehicleProxy.h b/navit/gui/qml/vehicleProxy.h
deleted file mode 100644
index 483a1837b..000000000
--- a/navit/gui/qml/vehicleProxy.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef NAVIT_GUI_QML_VEHICLEPROXY_H
-#define NAVIT_GUI_QML_VEHICLEPROXY_H
-
-class NGQProxyVehicle : public NGQProxy {
- Q_OBJECT;
-
-public:
- NGQProxyVehicle(struct gui_priv* object, QObject* parent) : NGQProxy(object,parent) { };
-
-public slots:
-
-protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) { return vehicle_get_attr(this->object->currVehicle, type, attr, iter); }
- int setAttrFunc(struct attr* attr) {return vehicle_set_attr(this->object->currVehicle,attr); }
- struct attr_iter* getIterFunc() { return vehicle_attr_iter_new(); };
- void dropIterFunc(struct attr_iter* iter) { vehicle_attr_iter_destroy(iter); };
-
-private:
-
-};
-
-#include "vehicleProxy.moc"
-
-#endif /* NAVIT_GUI_QML_VEHICLEPROXY_H */
diff --git a/navit/gui/qt5_qml/CMakeLists.txt b/navit/gui/qt5_qml/CMakeLists.txt
deleted file mode 100644
index 770c9a2f0..000000000
--- a/navit/gui/qt5_qml/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-
-qt5_add_resources(GUI_QT5_QML_QRC "gui_qt5_qml.qrc")
-
-module_add_library(gui_qt5_qml gui_qt5_qml.cpp ${GUI_QT5_QML_QRC} backend.cpp
- qml_map.cpp qml_poi.cpp qml_vehicle.cpp qml_bookmark.cpp qml_search.cpp proxy.c)
diff --git a/navit/gui/qt5_qml/backend.cpp b/navit/gui/qt5_qml/backend.cpp
deleted file mode 100644
index 395fff425..000000000
--- a/navit/gui/qt5_qml/backend.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-#include <glib.h>
-
-#include "item.h"
-#include "attr.h"
-#include "navit.h"
-#include "xmlconfig.h" // for NAVIT_OBJECT
-#include "layout.h"
-#include "map.h"
-#include "transform.h"
-#include "vehicle.h"
-#include "bookmarks.h"
-#include "backend.h"
-
-#include "qml_map.h"
-#include "qml_poi.h"
-#include "qml_search.h"
-
-#include "mapset.h"
-
-#include <QQmlContext>
-
-#include "search.h"
-
-extern "C" {
-#include "proxy.h"
-}
-
-Backend::Backend(QObject * parent):QObject(parent)
-{
- set_default_country();
- this->search = NULL;
- _current_town = NULL;
- _current_street = NULL;
-}
-
-/**
- * @brief Set some variables and display the main menu
- * @param struct point *p the point coordinate where we clicked on the screen
- * @returns nothing
- */
-void Backend::showMenu(struct point *p)
-{
- struct coord co;
-
- transform_reverse(navit_get_trans(nav), p, &co);
- dbg(lvl_debug, "Point 0x%x 0x%x\n", co.x, co.y);
- dbg(lvl_debug, "Screen coord : %d %d\n", p->x, p->y);
- transform_to_geo(transform_get_projection(navit_get_trans(nav)), &co, &(this->g));
- dbg(lvl_debug, "%f %f\n", this->g.lat, this->g.lng);
- dbg(lvl_debug, "%p %p\n", nav, &c);
- this->c.pro = transform_get_projection(navit_get_trans(nav));
- this->c.x = co.x;
- this->c.y = co.y;
- dbg(lvl_debug, "c : %x %x\n", this->c.x, this->c.y);
-
- // As a test, set the Demo vehicle position to wherever we just clicked
- navit_set_position(this->nav, &c);
- navit_block(this->nav, 1);
- emit displayMenu("MainMenu.qml");
-}
-
-/**
- * @brief update the private m_maps list. Expected to be called from QML
- * @param none
- * @returns nothing
- */
-void Backend::get_maps()
-{
- struct attr attr, on, off, description, type, data, active;
- char * label;
- bool is_active;
- struct attr_iter * iter;
- _maps.clear();
-
- iter = navit_attr_iter_new();
- on.type = off.type = attr_active;
- on.u.num = 1;
- off.u.num = 0;
- while (navit_get_attr(this->nav, attr_map, &attr, iter)) {
- if (map_get_attr(attr.u.map, attr_description, &description, NULL)) {
- label = g_strdup(description.u.str);
- } else {
- if (!map_get_attr(attr.u.map, attr_type, &type, NULL))
- type.u.str = "";
- if (!map_get_attr(attr.u.map, attr_data, &data, NULL))
- data.u.str = "";
- label = g_strdup_printf("%s:%s", type.u.str, data.u.str);
- }
- is_active = false;
- if (map_get_attr(attr.u.map, attr_active, &active, NULL)) {
- if (active.u.num == 1) {
- is_active = true;
- }
- }
- _maps.append(new MapObject(label, is_active));
- }
- emit mapsChanged();
-}
-
-
-/**
- * @brief update the private m_vehicles list. Expected to be called from QML
- * @param none
- * @returns nothing
- */
-void Backend::get_vehicles()
-{
- struct attr attr,attr2,vattr;
- struct attr_iter *iter;
- struct attr active_vehicle;
- _vehicles.clear();
-
- iter=navit_attr_iter_new();
- if (navit_get_attr(this->nav, attr_vehicle, &attr, iter) && !navit_get_attr(this->nav, attr_vehicle, &attr2, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
- navit_attr_iter_destroy(iter);
- _vehicles.append(new VehicleObject(g_strdup(vattr.u.str), active_vehicle.u.vehicle, attr.u.vehicle));
- dbg(lvl_debug, "done\n");
- emit vehiclesChanged();
- return;
- }
- navit_attr_iter_destroy(iter);
-
- if (!navit_get_attr(this->nav, attr_vehicle, &active_vehicle, NULL))
- active_vehicle.u.vehicle=NULL;
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
- dbg(lvl_debug, "adding vehicle %s\n", vattr.u.str);
- _vehicles.append(
- new VehicleObject(
- g_strdup(vattr.u.str),
- attr.u.vehicle == active_vehicle.u.vehicle,
- attr.u.vehicle
- )
- );
- }
- navit_attr_iter_destroy(iter);
- emit vehiclesChanged();
-}
-
-/**
- * @brief set a pointer to the struct navit * for local use
- * @param none
- * @returns nothing
- */
-void Backend::set_navit(struct navit *nav)
-{
- this->nav = nav;
-}
-
-/**
- * @brief set a pointer to the QQmlApplicationEngine * for local use
- * @param none
- * @returns nothing
- */
-void Backend::set_engine(QQmlApplicationEngine * engine)
-{
- this->engine = engine;
-}
-
-/**
- * @brief apply search filters on one specific item
- * @param struct item * the item to filter
- * @returns 0 if the item should be discarded, 1 otherwise
- */
-int Backend::filter_pois(struct item *item)
-{
- enum item_type *types;
- enum item_type type=item->type;
- if (type >= type_line)
- return 0;
- return 1;
-}
-
-/**
- * @brief update the private m_bookmarks list. Expected to be called from QML
- * @param none
- * @returns nothing
- */
-void Backend::get_bookmarks()
-{
- struct attr attr,mattr;
- struct navigation * nav = NULL;
- struct item *item;
- struct coord c;
- struct pcoord pc;
-
- _bookmarks.clear();
-
- pc.pro = transform_get_projection(navit_get_trans(this->nav));
-
- if(navit_get_attr(this->nav, attr_bookmarks, &mattr, NULL) ) {
- bookmarks_item_rewind(mattr.u.bookmarks);
- while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
- if (!item_attr_get(item, attr_label, &attr)) continue;
- dbg(lvl_debug,"full_label: %s\n", attr.u.str);
- if (item_coord_get(item, &c, 1)) {
- pc.x = c.x;
- pc.y = c.y;
- dbg(lvl_debug, "coords : %i x %i\n", pc.x, pc.y);
- _bookmarks.append(new BookmarkObject(attr.u.str, pc));
- }
- }
- }
- emit bookmarksChanged();
-}
-
-/**
- * @brief update the private m_pois list. Expected to be called from QML
- * @param none
- * @returns nothing
- */
-void Backend::get_pois()
-{
- struct map_selection * sel, * selm;
- struct coord c, center;
- struct mapset_handle * h;
- struct map * m;
- struct map_rect * mr;
- struct item * item;
- enum projection pro = this->c.pro;
- int idist, dist;
- _pois.clear();
- dist = 10000;
- sel = map_selection_rect_new(&(this->c), dist * transform_scale(abs(this->c.y) + dist * 1.5), 18);
- center.x = this->c.x;
- center.y = this->c.y;
-
- dbg(lvl_debug, "center is at %x, %x\n", center.x, center.y);
-
- h = mapset_open(navit_get_mapset(this->nav));
- while ((m = mapset_next(h, 1))) {
- selm = map_selection_dup_pro(sel, pro, map_projection(m));
- mr = map_rect_new(m, selm);
- dbg(lvl_debug, "mr=%p\n", mr);
- if (mr) {
- while ((item = map_rect_get_item(mr))) {
- if ( filter_pois(item) &&
- item_coord_get_pro(item, &c, 1, pro) &&
- coord_rect_contains(&sel->u.c_rect, &c) &&
- (idist=transform_distance(pro, &center, &c)) < dist) {
-
- struct attr attr;
- char * label;
- char * icon = get_icon(this->nav, item);
- struct pcoord item_coord;
- item_coord.pro = transform_get_projection(navit_get_trans(nav));
- item_coord.x = c.x;
- item_coord.y = c.y;
-
- idist = transform_distance(pro, &center, &c);
- if (item_attr_get(item, attr_label, &attr)) {
- label = map_convert_string(item->map, attr.u.str);
- if (icon) {
- _pois.append(new PoiObject(label, item_to_name(item->type), idist, icon, item_coord));
- }
- }
- }
- }
- map_rect_destroy(mr);
- }
- map_selection_destroy(selm);
- }
- map_selection_destroy(sel);
- mapset_close(h);
- emit poisChanged();
-}
-
-/**
- * @brief get the POIs as a QList
- * @param none
- * @returns the pois QList
- */
-QQmlListProperty<QObject> Backend::getPois(){
- return QQmlListProperty<QObject>(this, _pois);
-}
-
-/**
- * @brief get the Bookmarks as a QList
- * @param none
- * @returns the bookmarks QList
- */
-QQmlListProperty<QObject> Backend::getBookmarks(){
- return QQmlListProperty<QObject>(this, _bookmarks);
-}
-
-/**
- * @brief get the maps as a QList
- * @param none
- * @returns the maps QList
- */
-QQmlListProperty<QObject> Backend::getMaps(){
- return QQmlListProperty<QObject>(this, _maps);
-}
-
-
-/**
- * @brief get the vehicles as a QList
- * @param none
- * @returns the vehicles QList
- */
-QQmlListProperty<QObject> Backend::getVehicles(){
- return QQmlListProperty<QObject>(this, _vehicles);
-}
-
-/**
- * @brief get the search results as a QList
- * @param none
- * @returns the search results QList
- */
-QQmlListProperty<QObject> Backend::getSearchResults(){
- return QQmlListProperty<QObject>(this, _search_results);
-}
-
-/**
- * @brief get the active POI. Used when displaying the relevant menu
- * @param none
- * @returns the active POI
- */
-PoiObject * Backend::activePoi() {
- dbg(lvl_debug, "name : %s\n", m_activePoi->name().toUtf8().data());
- dbg(lvl_debug, "type : %s\n", m_activePoi->type().toLatin1().data());
- return m_activePoi;
-}
-
-/**
- * @brief get the current bookmark. Used when displaying the relevant menu
- * @param none
- * @returns the current bookmark
- */
-BookmarkObject * Backend::currentBookmark() {
- return m_currentBookmark;
-}
-
-/**
- * @brief get the currently selected vehicle. Used when displaying the relevant menu
- * @param none
- * @returns the active POI
- */
-VehicleObject * Backend::currentVehicle() {
- struct attr attr;
- dbg(lvl_debug, "name : %s\n", m_currentVehicle->name().toUtf8().data());
- if (m_currentVehicle->vehicle()) {
- if (vehicle_get_attr(m_currentVehicle->vehicle(), attr_position_nmea, &attr, NULL))
- dbg(lvl_debug, "NMEA : %s\n", attr.u.str);
- } else {
- dbg(lvl_debug, "m_currentVehicle->v is null\n");
- }
-
- return m_currentVehicle;
-}
-
-
-void Backend::block_draw(){
- navit_block(this->nav, 1);
- dbg(lvl_debug, "Draw operations blocked per UI request\n");
-}
-
-/**
- * @brief set the canvas size to use when drawing the map
- * @param int width
- * @param int height
- * @returns nothing
- */
-void Backend::resize(int width, int height){
- // If we need to resize the canvas, it means that something (the main map,
- // or a menu item) wants to display a map. Ensure that draw operations
- // are not blocked then.
- navit_block(this->nav, -1);
- navit_handle_resize(nav, width, height);
-}
-
-/**
- * @brief set the active POI. Used when clicking on a POI list to display one single POI
- * @param int index the index of the POI in the m_pois list
- * @returns nothing
- */
-void Backend::setActivePoi(int index) {
- struct pcoord c;
- m_activePoi = (PoiObject *)_pois.at(index);
- c = m_activePoi->coords();
- resize(320, 240);
- navit_set_center(this->nav, &c, 1);
- emit activePoiChanged();
-}
-/**
- * @brief set the current bookmark. Used when clicking on a bookmark list to display one single bookmark
- * @param int index the index of the bookmark in the m_bookmarks list
- * @returns nothing
- */
-void Backend::setCurrentBookmark(int index) {
- struct pcoord c;
- m_currentBookmark = (BookmarkObject *)_bookmarks.at(index);
- c = m_currentBookmark->coords();
- resize(320, 240);
- navit_set_center(this->nav, &c, 1);
- emit currentBookmarkChanged();
-}
-
-/**
- * @brief set the current vehicle. Used when clicking on a vehicle list to display one single vehicle
- * @param int index the index of the vehicle in the m_vehicles list
- * @returns nothing
- */
-void Backend::setCurrentVehicle(int index) {
- m_currentVehicle = (VehicleObject *)_vehicles.at(index);
- emit currentVehicleChanged();
-}
-
-/**
- * @brief returns the icon absolute path
- * @param none
- * @returns the icon absolute path as a QString
- */
-QString Backend::get_icon_path(){
- return QString(g_strjoin(NULL,"file://",getenv("NAVIT_SHAREDIR"),"/icons/",NULL));
-}
-
-/**
- * @brief set the destination using the currently active POI's coordinates
- * @param none
- * @returns nothing
- */
-void Backend::setActivePoiAsDestination(){
- struct pcoord c;
- c = m_activePoi->coords();
- dbg(lvl_debug, "Destination : %s c=%d:0x%x,0x%x\n",
- m_activePoi->name().toUtf8().data(),
- c.pro, c.x, c.y);
- navit_set_destination(this->nav, &c, m_activePoi->name().toUtf8().data(), 1);
- emit hideMenu();
-}
-
-/**
- * @brief save the search result for the next search step
- * @param int index the index of the result in the m_search_results list
- * @returns nothing
- */
-void Backend::searchValidateResult(int index){
- SearchObject * r = (SearchObject *)_search_results.at(index);
- dbg(lvl_debug, "Saving %s [%i] as search result\n", r->name().toUtf8().data(), index);
- if (r->getCoords()){
- dbg(lvl_debug, "Item is at %x x %x\n", r->getCoords()->x, r->getCoords()->y);
- }
- if (_search_context == attr_country_all) {
- _current_country = g_strdup(r->name().toUtf8().data());
- _current_town = NULL;
- _current_street = NULL;
- } else if (_search_context == attr_town_name) {
- _current_town = g_strdup(r->name().toUtf8().data());
- _current_street = NULL;
- } else if (_search_context == attr_street_name) {
- _current_street = g_strdup(r->name().toUtf8().data());
- } else {
- dbg(lvl_error, "Unknown search context for '%s'\n", r->name().toUtf8().data());
- }
- // navit_set_center(this->nav, r->getCoords(), 1);
- emit displayMenu("destination_address.qml");
-}
-
-/**
- * @brief get the icon that matches the country currently used for searches
- * @param none
- * @returns an absolute path for the country icon
- */
-QString Backend::get_country_icon(char * country_iso_code){
-// if ( country_iso_code == "" ) {
-// country_iso_code = _country_iso2;
-// }
- return QString(g_strjoin(NULL,"file://",getenv("NAVIT_SHAREDIR"),"/icons/",country_iso_code,".svg",NULL));
-}
-
-
-static struct search_param {
- struct navit *nav;
- struct mapset *ms;
- struct search_list *sl;
- struct attr attr;
- int partial;
- void *entry_country, *entry_postal, *entry_city, *entry_district;
- void *entry_street, *entry_number;
-} search_param;
-
-/**
- * @brief set the default country
- * @param none
- * returns nothing
- */
-void Backend::set_default_country(){
- _current_country = "Germany";
- _country_iso2 = "DE";
-}
-
-
-/**
- * @brief update the current search results according to new inputs. Currently only works to search for towns
- * @param QString text the text to search for
- * @returns nothing
- */
-void Backend::updateSearch(QString text){
- struct search_list_result *res;
- struct attr search_attr;
-
- if (search == NULL){
- search=&search_param;
- dbg(lvl_debug, "search = %p\n", search);
- search->nav=this->nav;
- search->ms=navit_get_mapset(this->nav);
- search->sl=search_list_new(search->ms);
- search->partial = 1;
- dbg(lvl_debug,"attempting to use country '%s'\n", _country_iso2);
- search_attr.type=attr_country_iso2;
- search_attr.u.str=_country_iso2;
- search_list_search(search->sl, &search_attr, 0);
-
- while((res=search_list_get_result(search->sl)));
- }
-
- _search_results.clear();
- // search->attr.type=attr_country_all;
- // search->attr.type=attr_town_postal;
- // search->attr.type=attr_town_name;
- // search->attr.type=attr_street_name;
-
-// search->attr.type=attr_town_name;
-// search->attr.u.str="Oberhaching";
-// search_list_search(search->sl, &search->attr, search->partial);
-// while((res=search_list_get_result(search->sl)));
-
- search->attr.u.str = text.toUtf8().data();
- dbg(lvl_error, "searching for %s partial %d\n", search->attr.u.str, search->partial);
-
- search->attr.type = _search_context;
- search_list_search(search->sl, &search->attr, search->partial);
- int count = 0;
- while((res=search_list_get_result(search->sl))) {
- if ( _search_context == attr_country_all && res->country) {
- char * label;
- label = g_strdup(res->country->name);
- _search_results.append(
- new SearchObject(label, get_country_icon(res->country->flag) , res->c)
- );
- }
- if ( _search_context == attr_town_name && res->town) {
- char * label;
- label = g_strdup(res->town->common.town_name);
- _search_results.append(
- new SearchObject(label, "icons/bigcity.png", res->c)
- );
- }
- if (res->street) {
- char * label;
- label = g_strdup(res->street->name);
- _search_results.append(
- new SearchObject(label, "icons/smallcity.png", res->c)
- );
- }
- if (count ++ > 50) {
- break;
- }
- }
- emit searchResultsChanged();
-}
-
-void Backend::setSearchContext(QString text){
- if (text == "country") {
- _search_context = attr_country_all;
- } else if (text == "town") {
- _search_context = attr_town_name;
- } else if (text == "street") {
- _search_context = attr_street_name;
- } else {
- dbg(lvl_error, "Unhandled search context '%s'\n", text.toUtf8().data());
- }
-
-}
-
-QString Backend::currentCountry() {
- dbg(lvl_debug, "Current country : %s/%s\n", _country_iso2, _current_country);
- return QString(_current_country);
-}
-
-QString Backend::currentCountryIso2() {
- dbg(lvl_debug, "Current country : %s/%s\n", _country_iso2, _current_country);
- return QString(_country_iso2);
-}
-
-QString Backend::currentTown() {
- if (_current_town == NULL) {
- _current_town = "Enter City";
- }
- dbg(lvl_debug, "Current town : %s\n", _current_town);
- return QString(_current_town);
-}
-
-QString Backend::currentStreet() {
- if (_current_street == NULL) {
- _current_street = "Enter Street";
- }
- dbg(lvl_debug, "Current street : %s\n", _current_street);
- return QString(_current_street);
-}
diff --git a/navit/gui/qt5_qml/backend.h b/navit/gui/qt5_qml/backend.h
deleted file mode 100644
index 259be516c..000000000
--- a/navit/gui/qt5_qml/backend.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef BACKEND_H
-#define BACKEND_H
-
-#include <QObject>
-#include <QQmlApplicationEngine>
-#include <QQmlListProperty>
-
-#include "qml_map.h"
-#include "qml_poi.h"
-#include "qml_bookmark.h"
-#include "qml_vehicle.h"
-
-#include "coord.h"
-#include "item.h"
-#include "attr.h"
-
-class Backend : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QObject> pois READ getPois NOTIFY poisChanged)
- Q_PROPERTY(QQmlListProperty<QObject> bookmarks READ getBookmarks NOTIFY bookmarksChanged)
- Q_PROPERTY(QQmlListProperty<QObject> maps READ getMaps NOTIFY mapsChanged)
- Q_PROPERTY(QQmlListProperty<QObject> vehicles READ getVehicles NOTIFY vehiclesChanged)
- Q_PROPERTY(PoiObject * activePoi READ activePoi NOTIFY activePoiChanged)
- Q_PROPERTY(BookmarkObject * currentBookmark READ currentBookmark NOTIFY currentBookmarkChanged)
- Q_PROPERTY(VehicleObject * currentVehicle READ currentVehicle NOTIFY currentVehicleChanged)
- Q_PROPERTY(QQmlListProperty<QObject> searchresults READ getSearchResults NOTIFY searchResultsChanged)
- // Search properties
- Q_PROPERTY(QString currentCountry READ currentCountry NOTIFY currentCountryChanged)
- Q_PROPERTY(QString currentCountryIso2 READ currentCountryIso2 NOTIFY currentCountryIso2Changed)
- Q_PROPERTY(QString currentTown READ currentTown NOTIFY currentTownChanged)
- Q_PROPERTY(QString currentStreet READ currentStreet NOTIFY currentStreetChanged)
-
-public:
- explicit Backend(QObject *parent = 0);
-
- void showMenu(struct point* p);
- void set_navit(struct navit* nav);
- void set_engine(QQmlApplicationEngine* engine);
-
- QList < PoiObject * > pois;
- QQmlListProperty<QObject> getPois();
- QList < BookmarkObject * > bookmarks;
- QQmlListProperty<QObject> getBookmarks();
- QList < MapObject * > maps;
- QQmlListProperty<QObject> getMaps();
- QList < MapObject * > vehicles;
- QQmlListProperty<QObject> getVehicles();
- PoiObject * activePoi();
- BookmarkObject * currentBookmark();
- VehicleObject * currentVehicle();
- QQmlListProperty<QObject> getSearchResults();
- QString currentCountry();
- QString currentCountryIso2();
- QString currentTown();
- QString currentStreet();
-
-signals:
- void displayMenu(QString source);
- void hideMenu();
- void poisChanged();
- void bookmarksChanged();
- void activePoiChanged();
- void currentBookmarkChanged();
- void currentVehicleChanged();
- void mapsChanged();
- void vehiclesChanged();
- void searchResultsChanged();
- void currentCountryChanged();
- void currentCountryIso2Changed();
- void currentTownChanged();
- void currentStreetChanged();
-
-public slots:
- void get_maps();
- void get_pois();
- void get_bookmarks();
- void get_vehicles();
- QString get_icon_path();
- QString get_country_icon(char * country_iso_code);
- void setActivePoi(int index);
- void setCurrentBookmark(int index);
- void setCurrentVehicle(int index);
- void setActivePoiAsDestination();
- void updateSearch(QString text);
- void searchValidateResult(int index);
- void resize(int width, int height);
- void setSearchContext(QString text);
- void block_draw();
-
-private:
- struct navit *nav;
- struct point *p;
- struct coord_geo g;
- struct pcoord c;
- int filter_pois(struct item *item);
- QQmlApplicationEngine* engine;
- QList<QObject *> _pois;
- QList<QObject *> _bookmarks;
- QList<QObject *> _maps;
- QList<QObject *> _vehicles;
- PoiObject * m_activePoi;
- BookmarkObject * m_currentBookmark;
- VehicleObject * m_currentVehicle;
- QList<QObject *> _search_results;
- void set_default_country();
- char * _country_iso2;
- char * _current_country;
- char * _current_town;
- char * _current_street;
- struct search_param *search;
- enum attr_type _search_context;
-};
-
-#endif // BACKEND_H
diff --git a/navit/gui/qt5_qml/editor/.gitignore b/navit/gui/qt5_qml/editor/.gitignore
deleted file mode 100644
index fab7372d7..000000000
--- a/navit/gui/qt5_qml/editor/.gitignore
+++ /dev/null
@@ -1,73 +0,0 @@
-# This file is used to ignore files which are generated
-# ----------------------------------------------------------------------------
-
-*~
-*.autosave
-*.a
-*.core
-*.moc
-*.o
-*.obj
-*.orig
-*.rej
-*.so
-*.so.*
-*_pch.h.cpp
-*_resource.rc
-*.qm
-.#*
-*.*#
-core
-!core/
-tags
-.DS_Store
-.directory
-*.debug
-Makefile*
-*.prl
-*.app
-moc_*.cpp
-ui_*.h
-qrc_*.cpp
-Thumbs.db
-*.res
-*.rc
-/.qmake.cache
-/.qmake.stash
-
-# qtcreator generated files
-*.pro.user*
-
-# xemacs temporary files
-*.flc
-
-# Vim temporary files
-.*.swp
-
-# Visual Studio generated files
-*.ib_pdb_index
-*.idb
-*.ilk
-*.pdb
-*.sln
-*.suo
-*.vcproj
-*vcproj.*.*.user
-*.ncb
-*.sdf
-*.opensdf
-*.vcxproj
-*vcxproj.*
-
-# MinGW generated files
-*.Debug
-*.Release
-
-# Python byte code
-*.pyc
-
-# Binaries
-# --------
-*.dll
-*.exe
-
diff --git a/navit/gui/qt5_qml/editor/editor.pro b/navit/gui/qt5_qml/editor/editor.pro
deleted file mode 100644
index d0d4cd297..000000000
--- a/navit/gui/qt5_qml/editor/editor.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-QT += qml quick
-
-CONFIG += c++11
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
-
-# Additional import path used to resolve QML modules just for Qt Quick Designer
-QML_DESIGNER_IMPORT_PATH =
-
-# The following define makes your compiler emit warnings if you use
-# any feature of Qt which as been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if you use deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
-# Default rules for deployment.
-qnx: target.path = /tmp/$${TARGET}/bin
-else: unix:!android: target.path = /opt/$${TARGET}/bin
-!isEmpty(target.path): INSTALLS += target
diff --git a/navit/gui/qt5_qml/editor/gui_qt5_qml.qml b/navit/gui/qt5_qml/editor/gui_qt5_qml.qml
deleted file mode 100644
index f8c2daa4a..000000000
--- a/navit/gui/qt5_qml/editor/gui_qt5_qml.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import QtQuick 2.7
-import QtQuick.Controls 2.0
-import QtQuick.Layouts 1.0
-
-ApplicationWindow {
- id: applicationWindow
- visible: true
- width: 800
- height: 480
- title: qsTr("Navit Stub")
-
- MouseArea {
- id: mouseArea
- z: -1
- anchors.fill: parent
- onClicked: {
- mainMenu.source = "skins/modern/menu.qml"
- mainMenu.state = 'visible'
- console.log("showing menu")
- }
-
- Image {
- id: image
- anchors.left: parent.left
- anchors.rightMargin: 0
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 0
- source: "map.png"
- }
-
- }
-
- Loader {
- id: mainMenu
- width: parent.width
- height: parent.height
- x: parent.width
- opacity: 0
-
- states: [
- State {
- name: "visible"
- PropertyChanges {
- target: mainMenu
- x: 0
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "x,y,opacity";duration: 300
- }
- }
- ]
- }
-
-}
diff --git a/navit/gui/qt5_qml/editor/main.cpp b/navit/gui/qt5_qml/editor/main.cpp
deleted file mode 100644
index 9089c5a29..000000000
--- a/navit/gui/qt5_qml/editor/main.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QLatin1String("qrc:/gui_qt5_qml.qml")));
-
- return app.exec();
-}
diff --git a/navit/gui/qt5_qml/editor/main.qml b/navit/gui/qt5_qml/editor/main.qml
deleted file mode 100644
index be7157513..000000000
--- a/navit/gui/qt5_qml/editor/main.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import QtQuick 2.7
-import QtQuick.Controls 2.0
-import QtQuick.Layouts 1.0
-
-ApplicationWindow {
- id: applicationWindow
- visible: true
- width: 800
- height: 480
- title: qsTr("Hello World 2")
-
- MouseArea {
- id: mouseArea
- z: -1
- anchors.fill: parent
- onClicked: {
- mainMenu.source = "skins/menu.qml"
- mainMenu.state = 'visible'
- console.log("showing menu")
- }
-
- Image {
- id: image
- anchors.left: parent.left
- anchors.rightMargin: 0
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 0
- source: "map.png"
- }
-
- }
-
- Loader {
- id: mainMenu
- width: parent.width
- height: parent.height
- x: parent.width
- opacity: 0
-
- states: [
- State {
- name: "visible"
- PropertyChanges {
- target: mainMenu
- x: 0
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "x,y,opacity";duration: 300
- }
- }
- ]
- }
-
-}
diff --git a/navit/gui/qt5_qml/editor/map.png b/navit/gui/qt5_qml/editor/map.png
deleted file mode 100644
index 998b85eb3..000000000
--- a/navit/gui/qt5_qml/editor/map.png
+++ /dev/null
Binary files differ
diff --git a/navit/gui/qt5_qml/editor/qml.qrc b/navit/gui/qt5_qml/editor/qml.qrc
deleted file mode 100644
index a1db879a2..000000000
--- a/navit/gui/qt5_qml/editor/qml.qrc
+++ /dev/null
@@ -1,42 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>map.png</file>
- <file>skins/modern/main.qml</file>
- <file>skins/modern/menu.qml</file>
- <file>skins/modern/MainMenu.qml</file>
- <file>skins/modern/navit.svg</file>
- <file>skins/modern/MainButton.qml</file>
- <file>skins/modern/settings.qml</file>
- <file>skins/modern/maps.qml</file>
- <file>skins/modern/poi.qml</file>
- <file>skins/modern/pois.qml</file>
- <file>skins/modern/bookmark.qml</file>
- <file>skins/modern/bookmarks.qml</file>
- <file>skins/modern/icons/appbar.home.variant.svg</file>
- <file>skins/modern/icons/appbar.rocket.svg</file>
- <file>skins/modern/icons/appbar.power.svg</file>
- <file>skins/modern/icons/appbar.cog.svg</file>
- <file>skins/modern/icons/appbar.layer.svg</file>
- <file>skins/modern/icons/appbar.layer.delete.svg</file>
- <file>skins/modern/icons/appbar.map.svg</file>
- <file>skins/modern/icons/appbar.information.circle.svg</file>
- <file>skins/modern/icons/appbar.chevron.up.svg</file>
- <file>skins/modern/icons/appbar.chevron.down.svg</file>
- <file>skins/modern/icons/appbar.fullscreen.box.svg</file>
- <file>skins/modern/icons/appbar.transit.car.svg</file>
- <file>skins/modern/icons/appbar.location.checkin.svg</file>
- <file>skins/modern/icons/appbar.cogs.svg</file>
- <file>skins/modern/icons/bigcity.png</file>
- <file>skins/modern/search.qml</file>
- <file>skins/modern/destination.qml</file>
- <file>skins/modern/icons/appbar.city.svg</file>
- <file>skins/modern/icons/appbar.location.svg</file>
- <file>skins/modern/icons/appbar.timer.rewind.svg</file>
- <file>skins/modern/icons/appbar.book.list.svg</file>
- <file>skins/modern/icons/smallcity.png</file>
- <file>skins/modern/destination_address.qml</file>
- <file>skins/modern/search_result_item.qml</file>
- <file>skins/modern/vehicles.qml</file>
- <file>skins/modern/vehicle.qml</file>
- </qresource>
-</RCC>
diff --git a/navit/gui/qt5_qml/editor/skins b/navit/gui/qt5_qml/editor/skins
deleted file mode 120000
index cdb8b4e07..000000000
--- a/navit/gui/qt5_qml/editor/skins
+++ /dev/null
@@ -1 +0,0 @@
-../skins/ \ No newline at end of file
diff --git a/navit/gui/qt5_qml/gui_qt5_qml.cpp b/navit/gui/qt5_qml/gui_qt5_qml.cpp
deleted file mode 100644
index 1b4062d33..000000000
--- a/navit/gui/qt5_qml/gui_qt5_qml.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2010 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.
- */
-// style with: clang-format -style=WebKit -i *
-
-#include <QQmlApplicationEngine>
-#include <QQmlContext>
-
-#include <glib.h>
-
-extern "C" {
-#include "item.h" /* needs to be first, as attr.h depends on it */
-
-#include "attr.h"
-#include "bookmarks.h"
-#include "callback.h"
-#include "color.h"
-#include "command.h"
-#include "config.h"
-#include "coord.h"
-#include "coord.h"
-#include "country.h"
-#include "debug.h"
-#include "event.h"
-
-#include "point.h" /* needs to be before graphics.h */
-
-#include "graphics.h"
-#include "gui.h"
-#include "keys.h"
-#include "map.h"
-#include "mapset.h"
-#include "navit.h"
-#include "plugin.h"
-#include "route.h"
-#include "search.h"
-#include "track.h"
-#include "transform.h"
-#include "vehicle.h"
-#include "xmlconfig.h"
-
-#include "layout.h"
-}
-struct gui_priv {
- /* navit internal handle */
- struct navit* nav;
- /* gui handle */
- struct gui* gui;
-
- /* attributes given to us */
- struct attr attributes;
-
- /* list of callbacks to navit */
- struct callback_list* callbacks;
- /* own callbacks *
- * TODO: Why do we need them as members? */
- struct callback* button_cb;
- struct callback* motion_cb;
- struct callback* resize_cb;
- struct callback* keypress_cb;
- struct callback* window_closed_cb;
-
- /* current graphics */
- struct graphics* gra;
- /* root window */
- struct window* win;
- /* navit root widget dimesnions */
- int w;
- int h;
-
- /* Qt application instance */
- QQmlApplicationEngine* engine;
- QObject* loader; /* Loader QML component to load our QML parts to the QML engine */
-
- class Backend* backend;
-
- /* configuration */
- int menu_on_map_click;
-};
-
-#include "backend.h"
-
-static void
-gui_qt5_qml_button(void* data, int pressed, int button, struct point* p)
-{
- struct gui_priv* gui_priv = (struct gui_priv*)data;
-
- /* check if navit wants to handle this */
- if (!navit_handle_button(gui_priv->nav, pressed, button, p, NULL)) {
- dbg(lvl_debug, "navit has handled button\n");
- return;
- }
- dbg(lvl_debug, "enter %d %d\n", pressed, button);
-
- /* check if user requested menu */
- if (button == 1 && gui_priv->menu_on_map_click) {
- dbg(lvl_debug, "navit wants us to enter menu\n");
- /*TODO: want to emit a signal somewhere? */
- gui_priv->backend->showMenu(p);
- }
-}
-
-static void
-gui_qt5_qml_motion(void* data, struct point* p)
-{
- struct gui_priv* gui_priv = (struct gui_priv*)data;
- dbg(lvl_debug, "enter (%d, %d)\n", p->x, p->y);
- /* forward this to navit */
- navit_handle_motion(gui_priv->nav, p);
-}
-
-static void
-gui_qt5_qml_resize(void* data, int w, int h)
-{
- struct gui_priv* gui_priv = (struct gui_priv*)data;
- dbg(lvl_debug, "enter\n");
- /* forward this to navit */
- navit_handle_resize(gui_priv->nav, w, h);
-}
-
-static void
-gui_qml_keypress(void* data, char* key)
-{
- struct gui_priv* this_ = (struct gui_priv*)data;
- int w, h;
- struct point p;
- transform_get_size(navit_get_trans(this_->nav), &w, &h);
- switch (*key) {
- case NAVIT_KEY_UP:
- dbg(lvl_debug, "got KEY_UP\n");
- p.x = w / 2;
- p.y = 0;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_DOWN:
- p.x = w / 2;
- p.y = h;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_LEFT:
- p.x = 0;
- p.y = h / 2;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_RIGHT:
- p.x = w;
- p.y = h / 2;
- navit_set_center_screen(this_->nav, &p, 1);
- break;
- case NAVIT_KEY_ZOOM_IN:
- dbg(lvl_debug, "got ZOOM_IN\n");
- navit_zoom_in(this_->nav, 2, NULL);
- break;
- case NAVIT_KEY_ZOOM_OUT:
- navit_zoom_out(this_->nav, 2, NULL);
- break;
- case NAVIT_KEY_RETURN:
- case NAVIT_KEY_MENU:
- p.x = w / 2;
- p.y = h / 2;
- break;
- }
-
- return;
-}
-
-static int
-gui_qt5_qml_set_graphics(struct gui_priv* gui_priv, struct graphics* gra)
-{
- struct transformation* trans;
- dbg(lvl_debug, "enter\n");
-
- /* get navit transition */
- trans = navit_get_trans(gui_priv->nav);
-
- /* Tell navit to ignore events from graphics. We will hook the ones being supported. */
- navit_ignore_graphics_events(gui_priv->nav, 1);
-
- /* remeber graphics */
- gui_priv->gra = gra;
-
- /* hook button callback */
- gui_priv->button_cb = callback_new_attr_1(callback_cast(gui_qt5_qml_button), attr_button, gui_priv);
- graphics_add_callback(gra, gui_priv->button_cb);
-
- /* hook motion callback */
- gui_priv->motion_cb = callback_new_attr_1(callback_cast(gui_qt5_qml_motion), attr_motion, gui_priv);
- graphics_add_callback(gra, gui_priv->motion_cb);
-
- gui_priv->keypress_cb = callback_new_attr_1(callback_cast(gui_qml_keypress), attr_keypress, gui_priv);
- graphics_add_callback(gra, gui_priv->keypress_cb);
-
- /* hook resize callback. Will be called imediately! */
- gui_priv->resize_cb = callback_new_attr_1(callback_cast(gui_qt5_qml_resize), attr_resize, gui_priv);
- graphics_add_callback(gra, gui_priv->resize_cb);
-
- /* get main navit window */
- gui_priv->win = (struct window*)graphics_get_data(gra, "window");
- if (!gui_priv->win) {
- dbg(lvl_error, "failed to obtain window from graphics plugin, cannot set graphics\n");
- return 1;
- }
-
- /* expect to have qt5 graphics. So get the qml engine prepared by graphics */
- gui_priv->engine = (QQmlApplicationEngine*)graphics_get_data(gra, "engine");
- if (gui_priv->engine == NULL) {
- dbg(lvl_error, "Graphics doesn't seem to be qt5, or doesn't have QML. Cannot set graphics\n");
- return 1;
- }
-
- gui_priv->backend = new Backend();
- gui_priv->backend->set_navit(gui_priv->nav);
- gui_priv->backend->set_engine(gui_priv->engine);
-
- gui_priv->engine->rootContext()->setContextProperty("backend", gui_priv->backend);
- // gui_priv->engine->rootContext()->setContextProperty("myModel", QVariant::fromValue(dataList));
-
- /* find the loader component */
- gui_priv->loader = gui_priv->engine->rootObjects().value(0)->findChild<QObject*>("navit_loader");
- if (gui_priv->loader != NULL) {
- dbg(lvl_debug, "navit_loader found\n");
- /* load our root window into the loader component */
- gui_priv->loader->setProperty("source", "qrc:///skins/modern/main.qml");
- }
-
- transform_get_size(trans, &gui_priv->w, &gui_priv->h);
- dbg(lvl_debug, "navit provided geometry: (%d, %d)\n", gui_priv->w, gui_priv->h);
-
- /* Was resize callback already issued? */
- // if (navit_get_ready(gui_priv->nav) & 2)
- // gui_internal_setup(this);
-
- /* allow navit to draw */
- navit_draw(gui_priv->nav);
-
- return 0;
-}
-
-static int
-gui_qt5_qml_get_attr(struct gui_priv* gui_priv, enum attr_type type, struct attr* attr)
-{
- dbg(lvl_debug, "enter\n");
- return 1;
-}
-
-static int
-gui_qt5_qml_set_attr(struct gui_priv* gui_priv, struct attr* attr)
-{
- dbg(lvl_debug, "enter\n");
- return 1;
-}
-
-struct gui_methods gui_qt5_qml_methods = {
- NULL,
- NULL,
- gui_qt5_qml_set_graphics,
- NULL,
- NULL,
- NULL,
- NULL,
- gui_qt5_qml_get_attr,
- NULL,
- gui_qt5_qml_set_attr,
-};
-
-static struct gui_priv*
-gui_qt5_qml_new(struct navit* nav, struct gui_methods* meth, struct attr** attrs, struct gui* gui)
-{
- struct gui_priv* gui_priv;
- struct attr* attr;
-
- dbg(lvl_debug, "enter\n");
-
- /* tell navit our methods */
- *meth = gui_qt5_qml_methods;
-
- /* allocate gui private structure */
- gui_priv = g_new0(struct gui_priv, 1);
-
- /* default config */
- gui_priv->menu_on_map_click = 1;
-
- /* read config */
- if ((attr = attr_search(attrs, NULL, attr_menu_on_map_click)))
- gui_priv->menu_on_map_click = attr->u.num;
-
- /* remember navit internal handle */
- gui_priv->nav = nav;
- /* remember our gui handle */
- gui_priv->gui = gui;
-
- /* remember the attributes given to us */
- gui_priv->attributes.type = attr_gui;
- gui_priv->attributes.u.gui = gui;
-
- /* create new callbacks */
- gui_priv->callbacks = callback_list_new();
-
- /* return self */
- return gui_priv;
-}
-
-void plugin_init(void)
-{
- Q_INIT_RESOURCE(gui_qt5_qml);
- plugin_register_category_gui("qt5_qml", gui_qt5_qml_new);
-}
diff --git a/navit/gui/qt5_qml/gui_qt5_qml.qrc b/navit/gui/qt5_qml/gui_qt5_qml.qrc
deleted file mode 100644
index a1db879a2..000000000
--- a/navit/gui/qt5_qml/gui_qt5_qml.qrc
+++ /dev/null
@@ -1,42 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>map.png</file>
- <file>skins/modern/main.qml</file>
- <file>skins/modern/menu.qml</file>
- <file>skins/modern/MainMenu.qml</file>
- <file>skins/modern/navit.svg</file>
- <file>skins/modern/MainButton.qml</file>
- <file>skins/modern/settings.qml</file>
- <file>skins/modern/maps.qml</file>
- <file>skins/modern/poi.qml</file>
- <file>skins/modern/pois.qml</file>
- <file>skins/modern/bookmark.qml</file>
- <file>skins/modern/bookmarks.qml</file>
- <file>skins/modern/icons/appbar.home.variant.svg</file>
- <file>skins/modern/icons/appbar.rocket.svg</file>
- <file>skins/modern/icons/appbar.power.svg</file>
- <file>skins/modern/icons/appbar.cog.svg</file>
- <file>skins/modern/icons/appbar.layer.svg</file>
- <file>skins/modern/icons/appbar.layer.delete.svg</file>
- <file>skins/modern/icons/appbar.map.svg</file>
- <file>skins/modern/icons/appbar.information.circle.svg</file>
- <file>skins/modern/icons/appbar.chevron.up.svg</file>
- <file>skins/modern/icons/appbar.chevron.down.svg</file>
- <file>skins/modern/icons/appbar.fullscreen.box.svg</file>
- <file>skins/modern/icons/appbar.transit.car.svg</file>
- <file>skins/modern/icons/appbar.location.checkin.svg</file>
- <file>skins/modern/icons/appbar.cogs.svg</file>
- <file>skins/modern/icons/bigcity.png</file>
- <file>skins/modern/search.qml</file>
- <file>skins/modern/destination.qml</file>
- <file>skins/modern/icons/appbar.city.svg</file>
- <file>skins/modern/icons/appbar.location.svg</file>
- <file>skins/modern/icons/appbar.timer.rewind.svg</file>
- <file>skins/modern/icons/appbar.book.list.svg</file>
- <file>skins/modern/icons/smallcity.png</file>
- <file>skins/modern/destination_address.qml</file>
- <file>skins/modern/search_result_item.qml</file>
- <file>skins/modern/vehicles.qml</file>
- <file>skins/modern/vehicle.qml</file>
- </qresource>
-</RCC>
diff --git a/navit/gui/qt5_qml/map.png b/navit/gui/qt5_qml/map.png
deleted file mode 100644
index 998b85eb3..000000000
--- a/navit/gui/qt5_qml/map.png
+++ /dev/null
Binary files differ
diff --git a/navit/gui/qt5_qml/proxy.c b/navit/gui/qt5_qml/proxy.c
deleted file mode 100644
index 6a3546716..000000000
--- a/navit/gui/qt5_qml/proxy.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <glib.h>
-
-#include "item.h"
-#include "attr.h"
-#include "navit.h"
-#include "xmlconfig.h" // for NAVIT_OBJECT
-#include "layout.h"
-#include "map.h"
-#include "transform.h"
-#include "debug.h"
-#include "search.h"
-
-
-char * get_icon(struct navit *nav, struct item *item)
-{
-
- struct attr layout;
- struct attr icon_src;
- GList *layer;
- navit_get_attr(nav, attr_layout, &layout, NULL);
- layer=layout.u.layout->layers;
-
- while(layer) {
- GList *itemgra=((struct layer *)layer->data)->itemgras;
- while(itemgra) {
- GList *types=((struct itemgra *)itemgra->data)->type;
- while(types) {
- if((long)types->data==item->type) {
- GList *element=((struct itemgra *)itemgra->data)->elements;
- while(element) {
- struct element * el=element->data;
- if(el->type==element_icon) {
- char *src;
- char *icon;
- struct graphics_image *img;
- if(item_is_custom_poi(*item)) {
- struct map_rect *mr=map_rect_new(item->map, NULL);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if(item_attr_get(item, attr_icon_src, &icon_src)) {
- src=el->u.icon.src;
- if(!src || !src[0])
- src="%s";
- icon=g_strdup_printf(src,map_convert_string_tmp(item->map,icon_src.u.str));
- }
- else {
- icon=g_strdup(el->u.icon.src);
- }
- }
- else {
- icon=g_strdup(el->u.icon.src);
- }
- icon[strlen(icon)-3]='s';
- icon[strlen(icon)-2]='v';
- icon[strlen(icon)-1]='g';
- return icon;
- // FIXME
- g_free(icon);
- }
- element=g_list_next(element);
- }
- }
- types=g_list_next(types);
- }
- itemgra=g_list_next(itemgra);
- }
- layer=g_list_next(layer);
- }
- return "unknown.svg";
-}
-
diff --git a/navit/gui/qt5_qml/proxy.h b/navit/gui/qt5_qml/proxy.h
deleted file mode 100644
index 16e74f55c..000000000
--- a/navit/gui/qt5_qml/proxy.h
+++ /dev/null
@@ -1 +0,0 @@
-char * get_icon(struct navit *nav, struct item *item);
diff --git a/navit/gui/qt5_qml/qml_bookmark.cpp b/navit/gui/qt5_qml/qml_bookmark.cpp
deleted file mode 100644
index e215bcd11..000000000
--- a/navit/gui/qt5_qml/qml_bookmark.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "qml_bookmark.h"
-
-BookmarkObject::BookmarkObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-BookmarkObject::BookmarkObject(
- const QString &name,
- struct pcoord &coords,
- QObject *parent)
- : QObject(parent), m_name(name), m_coords(coords)
-{
-}
-
-QString BookmarkObject::name() const
-{
- return m_name;
-}
-
-void BookmarkObject::setName(const QString &name)
-{
- if (name != m_name) {
- m_name = name;
- emit nameChanged();
- }
-}
-
-struct pcoord BookmarkObject::coords() const
-{
- return m_coords;
-}
diff --git a/navit/gui/qt5_qml/qml_bookmark.h b/navit/gui/qt5_qml/qml_bookmark.h
deleted file mode 100644
index fa676582e..000000000
--- a/navit/gui/qt5_qml/qml_bookmark.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef BOOKMARKOBJECT_H
-#define BOOKMARKOBJECT_H
-
-#include <QObject>
-#include "coord.h"
-
-class BookmarkObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(struct pcoord coords NOTIFY coordsChanged)
-
-public:
- BookmarkObject(QObject *parent=0);
- BookmarkObject(const QString &name, struct pcoord &coords, QObject *parent=0);
- QString name() const;
- void setName(const QString &name);
-
- struct pcoord coords() const;
-
-signals:
- void nameChanged();
-
-private:
- struct pcoord m_coords;
- QString m_name;
-};
-
-#endif // BOOKMARKOBJECT_H
-
diff --git a/navit/gui/qt5_qml/qml_map.cpp b/navit/gui/qt5_qml/qml_map.cpp
deleted file mode 100644
index 0f38a4768..000000000
--- a/navit/gui/qt5_qml/qml_map.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "qml_map.h"
-
-MapObject::MapObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-MapObject::MapObject(const QString &name, const bool &active, QObject *parent)
- : QObject(parent), m_name(name), m_active(active)
-{
-}
-
-QString MapObject::name() const
-{
- return m_name;
-}
-
-void MapObject::setName(const QString &name)
-{
- if (name != m_name) {
- m_name = name;
- emit nameChanged();
- }
-}
-
-bool MapObject::active() const
-{
- return m_active;
-}
-
-void MapObject::setActive(const bool &active)
-{
- if (active != m_active) {
- m_active = active;
- emit activeChanged();
- }
-}
-
diff --git a/navit/gui/qt5_qml/qml_map.h b/navit/gui/qt5_qml/qml_map.h
deleted file mode 100644
index 55046c712..000000000
--- a/navit/gui/qt5_qml/qml_map.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef MAPOBJECT_H
-#define MAPOBJECT_H
-
-#include <QObject>
-
-class MapObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
-
-public:
- MapObject(QObject *parent=0);
- MapObject(const QString &name, const bool &active, QObject *parent=0);
-
- QString name() const;
- void setName(const QString &name);
-
- bool active() const;
- void setActive(const bool &active);
-
-signals:
- void nameChanged();
- void activeChanged();
-
-private:
- QString m_name;
- bool m_active;
-};
-
-#endif // MAPOBJECT_H
diff --git a/navit/gui/qt5_qml/qml_poi.cpp b/navit/gui/qt5_qml/qml_poi.cpp
deleted file mode 100644
index 93adf2925..000000000
--- a/navit/gui/qt5_qml/qml_poi.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "qml_poi.h"
-
-PoiObject::PoiObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-PoiObject::PoiObject(
- const QString &name,
- const QString &type,
- const int distance,
- const QString &icon,
- struct pcoord &coords,
- QObject *parent)
- : QObject(parent), m_name(name), m_type(type), m_icon(icon), m_coords(coords)
-{
-}
-
-QString PoiObject::name() const
-{
- return m_name;
-}
-
-void PoiObject::setName(const QString &name)
-{
- if (name != m_name) {
- m_name = name;
- emit nameChanged();
- }
-}
-
-QString PoiObject::type() const
-{
- return m_type;
-}
-
-void PoiObject::setType(const QString &type)
-{
- if (type != m_type) {
- m_type = type;
- emit typeChanged();
- }
-}
-
-float PoiObject::distance() const
-{
- return m_distance/1000;
-}
-
-void PoiObject::setDistance(const int distance)
-{
- if (distance != m_distance) {
- m_distance = distance;
- emit distanceChanged();
- }
-}
-
-void PoiObject::setIcon(const QString &icon)
-{
- if (icon != m_icon) {
- m_icon = icon;
- emit iconChanged();
- }
-}
-
-QString PoiObject::icon() const
-{
- return m_icon;
-}
-
-struct pcoord PoiObject::coords() const
-{
- return m_coords;
-}
diff --git a/navit/gui/qt5_qml/qml_poi.h b/navit/gui/qt5_qml/qml_poi.h
deleted file mode 100644
index 328244372..000000000
--- a/navit/gui/qt5_qml/qml_poi.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef POIOBJECT_H
-#define POIOBJECT_H
-
-#include <QObject>
-#include "coord.h"
-
-class PoiObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
- Q_PROPERTY(int distance READ distance WRITE setDistance NOTIFY distanceChanged)
- Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
- Q_PROPERTY(struct pcoord coords NOTIFY coordsChanged)
-
-public:
- PoiObject(QObject *parent=0);
- PoiObject(const QString &name, const QString &type, const int distance, const QString &icon, struct pcoord &coords, QObject *parent=0);
- QString name() const;
- void setName(const QString &name);
-
- QString type() const;
- void setType(const QString &type);
-
- float distance() const;
- void setDistance(const int distance);
-
- QString icon() const;
- void setIcon(const QString &icon);
-
- struct pcoord coords() const;
-// void setcoords(const struct pcoord &c);
-
-signals:
- void nameChanged();
- void typeChanged();
- void distanceChanged();
- void iconChanged();
-// void coordsChanged();
-
-private:
- struct pcoord m_coords;
- QString m_name;
- QString m_type;
- int m_distance;
- QString m_icon;
-};
-
-#endif // POIOBJECT_H
-
diff --git a/navit/gui/qt5_qml/qml_search.cpp b/navit/gui/qt5_qml/qml_search.cpp
deleted file mode 100644
index 0a82e37d3..000000000
--- a/navit/gui/qt5_qml/qml_search.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "qml_search.h"
-
-SearchObject::SearchObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-SearchObject::SearchObject(const QString &name, const QString &icon, struct pcoord *c, QObject *parent)
- : QObject(parent), m_name(name), m_icon(icon), m_c(c)
-{
-}
-
-QString SearchObject::name() const
-{
- return m_name;
-}
-
-void SearchObject::setName(const QString &name)
-{
- if (name != m_name) {
- m_name = name;
- emit nameChanged();
- }
-}
-
-QString SearchObject::icon() const
-{
- return m_icon;
-}
-
-void SearchObject::setIcon(const QString &icon)
-{
- if (icon != m_icon) {
- m_icon = icon;
- emit iconChanged();
- }
-}
-
-struct pcoord * SearchObject::getCoords() const
-{
- return m_c;
-}
diff --git a/navit/gui/qt5_qml/qml_search.h b/navit/gui/qt5_qml/qml_search.h
deleted file mode 100644
index 656d85f3c..000000000
--- a/navit/gui/qt5_qml/qml_search.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef SEARCHOBJECT_H
-#define SEARCHOBJECT_H
-
-#include <QObject>
-
-class SearchObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
-
-public:
- SearchObject(QObject *parent=0);
- SearchObject(const QString &name, const QString &icon, struct pcoord *c, QObject *parent=0);
-
- QString name() const;
- void setName(const QString &name);
-
- QString icon() const;
- void setIcon(const QString &icon);
- struct pcoord * getCoords() const;
-
-signals:
- void nameChanged();
- void iconChanged();
-
-private:
- QString m_name;
- QString m_icon;
- struct pcoord *m_c;
-};
-
-#endif // SEARCHOBJECT_H
diff --git a/navit/gui/qt5_qml/qml_vehicle.cpp b/navit/gui/qt5_qml/qml_vehicle.cpp
deleted file mode 100644
index bf79ad4c4..000000000
--- a/navit/gui/qt5_qml/qml_vehicle.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "qml_vehicle.h"
-
-VehicleObject::VehicleObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-VehicleObject::VehicleObject(const QString &name, const bool &active, struct vehicle *v, QObject *parent)
- : QObject(parent), m_name(name), m_active(active), m_vehicle(v)
-{
-}
-
-QString VehicleObject::name() const
-{
- return m_name;
-}
-
-void VehicleObject::setName(const QString &name)
-{
- if (name != m_name) {
- m_name = name;
- emit nameChanged();
- }
-}
-
-bool VehicleObject::active() const
-{
- return m_active;
-}
-
-void VehicleObject::setActive(const bool &active)
-{
- if (active != m_active) {
- m_active = active;
- emit activeChanged();
- }
-}
-
-struct vehicle * VehicleObject::vehicle() const
-{
- return m_vehicle;
-}
-
-void VehicleObject::setVehicle(struct vehicle * vehicle)
-{
- if (vehicle != m_vehicle) {
- m_vehicle = vehicle;
- emit vehicleChanged();
- }
-}
-
-
diff --git a/navit/gui/qt5_qml/qml_vehicle.h b/navit/gui/qt5_qml/qml_vehicle.h
deleted file mode 100644
index 84bb42160..000000000
--- a/navit/gui/qt5_qml/qml_vehicle.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef VEHICLEOBJECT_H
-#define VEHICLEOBJECT_H
-
-#include <QObject>
-#include "item.h"
-#include "vehicle.h"
-
-class VehicleObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
- //Q_PROPERTY(struct vehicle * vehicle READ vehicle WRITE setVehicle NOTIFY vehicleChanged)
-
-public:
- VehicleObject(QObject *parent=0);
- VehicleObject(const QString &name, const bool &active, struct vehicle *v, QObject *parent=0);
-
- QString name() const;
- void setName(const QString &name);
-
- bool active() const;
- void setActive(const bool &active);
-
- struct vehicle * vehicle() const;
- void setVehicle(struct vehicle * vehicle);
-
-signals:
- void nameChanged();
- void activeChanged();
- void vehicleChanged();
-
-private:
- QString m_name;
- bool m_active;
- struct vehicle *m_vehicle;
-};
-
-#endif // MAPOBJECT_H
diff --git a/navit/gui/qt5_qml/skins/MainButton.qml b/navit/gui/qt5_qml/skins/MainButton.qml
deleted file mode 100644
index e189ad9a2..000000000
--- a/navit/gui/qt5_qml/skins/MainButton.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Layouts 1.0
-
-Rectangle {
- id: container
-
- signal clicked
- property string text: "Button"
- property string icon: "icons/appbar.home.variant.svg"
-
- smooth: true;
- width: 200;
- height: 80
- color: "#35322f"
- radius: 2
- border.width: 1
-
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
-
- Text {
- id: txtItem;
- color: "#ffffff"
- text: container.text
- font.pointSize: 18
- anchors.left: rectangle.right
- anchors.leftMargin: 8
- anchors.verticalCenter: parent.verticalCenter
- z: 1
- }
-
- Rectangle {
- id: rectangle
- width: container.height
- height: container.height
- color: "#35322f"
- radius: 2
- border.width: 1
- anchors.verticalCenter: parent.verticalCenter
-
- Image {
- id: imgItem;
- width: parent.width;
- height: parent.height;
- source: container.icon
- smooth: true
- scale: 1
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
-// anchors.leftMargin: 8
- sourceSize.width: parent.width
- sourceSize.height: parent.height
- }
- }
-
- states: [
- State {
- name: "Pressed"; when: mr.pressed == true
- PropertyChanges {
- target: txtItem;
- opacity: 0.6;
- color: "#84ca43";
- }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 }
- }
-
-}
-
diff --git a/navit/gui/qt5_qml/skins/MainMenu.qml b/navit/gui/qt5_qml/skins/MainMenu.qml
deleted file mode 100644
index 5d2a2b34c..000000000
--- a/navit/gui/qt5_qml/skins/MainMenu.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Layouts 1.0
-
-GridLayout {
- id: gridLayout
- anchors.fill: parent
- columnSpacing: 4
- rowSpacing: 4
- rows: 3
- columns: 2
-
- MainButton {
- text: "Where To?"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.location.checkin.svg"
- }
-
- MainButton {
- text: "Around Me"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.information.circle.svg"
- onClicked: {
- menucontent.source = "pois.qml"
- }
- }
-
- MainButton {
- text: "Go Home"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-
-
- MainButton {
- text: "Settings"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.cog.svg"
- onClicked: {
- menucontent.source = "settings.qml"
- console.log("showing settings")
- }
- }
-
- MainButton {
- text: "Quit"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.power.svg"
- onClicked: Qt.quit()
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.chevron.down.svg b/navit/gui/qt5_qml/skins/icons/appbar.chevron.down.svg
deleted file mode 100644
index 3917fc7cd..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.chevron.down.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 37.8516,39.5833L 52.1016,24.9375L 52.1016,35.2292L 37.8516,50.2708L 23.6016,35.2292L 23.6016,24.9375L 37.8516,39.5833 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.chevron.up.svg b/navit/gui/qt5_qml/skins/icons/appbar.chevron.up.svg
deleted file mode 100644
index b737d9773..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.chevron.up.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 37.8516,35.625L 34.6849,38.7917L 23.6016,50.2708L 23.6016,39.9792L 37.8516,24.9375L 52.1016,39.9792L 52.1016,50.2708L 41.0182,38.7917L 37.8516,35.625 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.cog.svg b/navit/gui/qt5_qml/skins/icons/appbar.cog.svg
deleted file mode 100644
index 4ef1ef8c2..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.cog.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 27.5314,21.8628L 33.0126,19.4224L 34.7616,23.3507C 36.6693,22.9269 38.6044,22.8903 40.4668,23.2026L 42.0083,19.1868L 47.6098,21.337L 46.0683,25.3528C 47.6612,26.3669 49.0747,27.6889 50.2088,29.2803L 54.1371,27.5313L 56.5776,33.0126L 52.6493,34.7616C 53.0731,36.6693 53.1097,38.6043 52.7974,40.4668L 56.8131,42.0083L 54.6629,47.6097L 50.6472,46.0683C 49.6331,47.6613 48.3111,49.0748 46.7197,50.2089L 48.4686,54.1372L 42.9874,56.5776L 41.2384,52.6493C 39.3307,53.0731 37.3957,53.1097 35.5333,52.7974L 33.9918,56.8131L 28.3903,54.6629L 29.9318,50.6472C 28.3388,49.6331 26.9252,48.3111 25.7911,46.7196L 21.8628,48.4686L 19.4224,42.9873L 23.3507,41.2383C 22.9269,39.3307 22.8903,37.3957 23.2026,35.5332L 19.1869,33.9918L 21.3371,28.3903L 25.3528,29.9318C 26.3669,28.3388 27.6889,26.9252 29.2804,25.7911L 27.5314,21.8628 Z M 34.3394,29.7781C 29.7985,31.7998 27.7564,37.1198 29.7781,41.6606C 31.7998,46.2015 37.1198,48.2436 41.6606,46.2219C 46.2015,44.2002 48.2436,38.8802 46.2219,34.3394C 44.2002,29.7985 38.8802,27.7564 34.3394,29.7781 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.cogs.svg b/navit/gui/qt5_qml/skins/icons/appbar.cogs.svg
deleted file mode 100644
index e3fdaa4ce..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.cogs.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 32.6227,68.9728C 33.1208,70.2446 33.7077,71.4719 34.3757,72.6471C 35.567,72.7702 36.7761,72.8333 38,72.8333C 40.6447,72.8333 43.2205,72.5386 45.6965,71.9802C 42.2807,68.5449 40.1698,63.8107 40.1698,58.5835C 40.1698,48.0901 48.6764,39.5835 59.1698,39.5835C 64.2047,39.5835 68.7822,41.5419 72.182,44.7385C 72.6094,42.5584 72.8333,40.3053 72.8333,38C 72.8333,36.442 72.731,34.908 72.5328,33.4041C 70.4772,32.3109 68.2718,31.4621 65.9554,30.8963L 65.6219,22.7367C 63.5664,22.3692 61.4511,22.1741 59.2916,22.1671L 57.491,30.1322C 54.2845,30.3184 51.2204,31.0348 48.3848,32.1949L 43.318,25.7887C 41.3995,26.7177 39.5749,27.8102 37.8622,29.0479L 41.0883,36.5527C 38.6742,38.5364 36.5919,40.9091 34.9373,43.575L 27.0703,41.3697C 26.073,43.2256 25.2319,45.178 24.5646,47.2093L 31.5867,51.385C 30.9883,53.6844 30.6698,56.0968 30.6698,58.5835L 30.746,60.6839L 23.0854,63.5239C 23.3743,65.6539 23.8474,67.7255 24.4881,69.7219L 32.6227,68.9728 Z M 27.0669,37.1755L 34.9338,39.3807C 35.9312,37.5248 36.7723,35.5724 37.4395,33.5412L 30.4175,29.3654C 31.0159,27.066 31.3344,24.6537 31.3344,22.1669L 31.2581,20.0665L 38.9187,17.2265C 38.6299,15.0965 38.1568,13.0249 37.5161,11.0285L 29.3815,11.7776C 28.4787,9.47258 27.2844,7.31377 25.8439,5.34655C 22.7943,6.48232 19.9467,8.03307 17.3698,9.93015C 20.1557,13.2359 21.8344,17.5054 21.8344,22.1669C 21.8344,32.5019 13.5826,40.9096 3.30816,41.1611C 3.60321,44.4411 4.35293,47.59 5.49381,50.5444C 8.34489,50.2806 11.0742,49.5968 13.6194,48.5555L 18.6861,54.9617C 20.6046,54.0327 22.4293,52.9403 24.142,51.7025L 20.9158,44.1977C 23.3299,42.2141 25.4123,39.8414 27.0669,37.1755 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.fullscreen.box.svg b/navit/gui/qt5_qml/skins/icons/appbar.fullscreen.box.svg
deleted file mode 100644
index 13e6840e5..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.fullscreen.box.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 19,57L 19,19L 57,19L 57,57L 19,57 Z M 24,29L 47,29L 47,52L 52,52L 52,24L 24,24L 24,29 Z M 24,34L 24,52L 42,52L 42,34L 24,34 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.home.variant.svg b/navit/gui/qt5_qml/skins/icons/appbar.home.variant.svg
deleted file mode 100644
index ea951fd19..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.home.variant.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 24.0033,56.0078L 24.0033,38.0053L 22.0031,40.0056L 19.0027,35.0049L 38.0053,20.0028L 45.0063,25.5299L 45.0063,21.753L 49.0068,21.0029L 49.0068,28.6882L 57.008,35.0049L 54.0075,40.0056L 52.0073,38.0053L 52.0073,56.0078L 24.0033,56.0078 Z M 38.0053,26.9204L 27.0038,36.005L 27.0038,53.0074L 38.0045,53.0075L 38.0045,41.0061L 46.0058,41.0061L 46.0059,53.0075L 49.0068,53.0074L 49.0068,36.005L 38.0053,26.9204 Z M 30.004,41.0057L 35.0049,41.0057L 35.0049,47.0066L 30.004,47.0066L 30.004,41.0057 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.information.circle.svg b/navit/gui/qt5_qml/skins/icons/appbar.information.circle.svg
deleted file mode 100644
index 031bd37f5..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.information.circle.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 38,19C 48.4934,19 57,27.5066 57,38C 57,48.4934 48.4934,57 38,57C 27.5066,57 19,48.4934 19,38C 19,27.5066 27.5066,19 38,19 Z M 33.25,33.25L 33.25,36.4167L 36.4166,36.4167L 36.4166,47.5L 33.25,47.5L 33.25,50.6667L 44.3333,50.6667L 44.3333,47.5L 41.1666,47.5L 41.1666,36.4167L 41.1666,33.25L 33.25,33.25 Z M 38.7917,25.3333C 37.48,25.3333 36.4167,26.3967 36.4167,27.7083C 36.4167,29.02 37.48,30.0833 38.7917,30.0833C 40.1033,30.0833 41.1667,29.02 41.1667,27.7083C 41.1667,26.3967 40.1033,25.3333 38.7917,25.3333 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.layer.delete.svg b/navit/gui/qt5_qml/skins/icons/appbar.layer.delete.svg
deleted file mode 100644
index ddbeb21ca..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.layer.delete.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 18.5088,44.0374L 21.8676,40.6786L 27.4655,46.2765L 33.0634,40.6786L 36.4222,44.0374L 30.8243,49.6353L 36.4222,55.2332L 33.0634,58.592L 27.4655,52.994L 21.8676,58.592L 18.5088,55.2332L 24.1068,49.6353L 18.5088,44.0374 Z M 57.0079,38.0053L 38.0053,47.5066L 36.7482,46.8781L 39.5889,44.0374L 35.2559,39.7977L 38.0053,41.1724L 50.6737,34.8382L 57.0079,38.0053 Z M 19.0026,38.0053L 25.3369,34.8382L 32.3326,38.3361L 29.8968,40.7719L 28.1098,42.5589L 25.7193,41.3636L 21.8676,37.6052L 20.6459,38.8269L 19.0026,38.0053 Z M 38.0053,19.0027L 57.0079,28.504L 38.0053,38.0053L 19.0026,28.504L 38.0053,19.0027 Z M 57.0079,47.5066L 38.0053,57.008L 37.8778,56.9442L 39.5889,55.2332L 33.9909,49.6353L 34.6367,48.9895L 38.0053,50.6738L 50.6737,44.3395L 57.0079,47.5066 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.layer.svg b/navit/gui/qt5_qml/skins/icons/appbar.layer.svg
deleted file mode 100644
index 9eb28235c..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.layer.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 57.0079,38.0053L 38.0053,47.5066L 19.0027,38.0053L 25.3369,34.8382L 38.0053,41.1724L 50.6737,34.8382L 57.0079,38.0053 Z M 38.0053,19.0027L 57.0079,28.504L 38.0053,38.0053L 19.0026,28.504L 38.0053,19.0027 Z M 57.0079,47.5066L 38.0053,57.008L 19.0026,47.5066L 25.3369,44.3395L 38.0053,50.6737L 50.6737,44.3395L 57.0079,47.5066 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.location.checkin.svg b/navit/gui/qt5_qml/skins/icons/appbar.location.checkin.svg
deleted file mode 100644
index 3b21754c6..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.location.checkin.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-linejoin="round" d="M 38,19C 42.9706,19 47,23.0294 47,28C 47,30.5642 45.9276,32.878 38,49C 30.0724,32.878 29,30.5642 29,28C 29,23.0294 33.0294,19 38,19 Z M 38,24C 35.7909,24 34,25.7909 34,28C 34,30.2092 35.7909,32 38,32C 40.2091,32 42,30.2092 42,28C 42,25.7909 40.2091,24 38,24 Z M 19,57L 24,42L 31.5,42L 33.5,46L 27.6641,46L 25.3324,53L 50.6676,53L 48.3359,46L 42.5,46L 44.5,42L 52,42L 57,57L 19,57 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.map.svg b/navit/gui/qt5_qml/skins/icons/appbar.map.svg
deleted file mode 100644
index 241f71e59..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.map.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 27.7083,23.75L 38.7917,26.9167L 48.2917,20.5833L 62,24L 62,51L 48.2917,47.5L 38.7917,53.8333L 27.7083,50.6667L 16,55.5L 16,28.5L 27.7083,23.75 Z M 27,46.25L 27,29L 20,31.75L 20,49L 27,46.25 Z M 49,25.5L 49,42.75L 58,45.25L 58,28L 49,25.5 Z M 39,31.5L 39,49L 48,43L 48,25.5L 39,31.5 Z M 28,28.75L 28,46L 38,48.5L 38,31.75L 28,28.75 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.power.svg b/navit/gui/qt5_qml/skins/icons/appbar.power.svg
deleted file mode 100644
index d3f865c0d..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.power.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 36.4167,36.4167L 36.4167,17.4167L 41.1667,17.4167L 41.1667,36.4167L 36.4167,36.4167 Z M 57,39.5833C 57,50.0767 48.4934,58.5833 38,58.5833C 27.5066,58.5833 19,50.0767 19,39.5833C 19,30.7301 25.0552,23.2911 33.25,21.1819L 33.25,27.8374C 28.6079,29.7165 25.3333,34.2675 25.3333,39.5833C 25.3333,46.5789 31.0044,52.25 38,52.25C 44.9956,52.25 50.6667,46.5789 50.6667,39.5833C 50.6667,34.8949 48.1194,30.8014 44.3333,28.6113L 44.3333,21.6645C 51.7129,24.2728 57,31.3106 57,39.5833 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.rocket.svg b/navit/gui/qt5_qml/skins/icons/appbar.rocket.svg
deleted file mode 100644
index a8c5c273a..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.rocket.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 38,19C 39.4823,20.6344 43,26.1259 43,41L 47,46L 47,55L 43,50L 33,50L 29,55L 29,46L 33,41C 33,26.1259 36.0177,20.6344 38,19 Z M 38,57.5L 35,51L 41,51L 38,57.5 Z M 38,27L 36.1552,27.4612L 35.6203,30.5949L 38,30L 40.2918,30.573L 39.6953,27.4238L 38,27 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/icons/appbar.transit.car.svg b/navit/gui/qt5_qml/skins/icons/appbar.transit.car.svg
deleted file mode 100644
index 8ea1a7c5d..000000000
--- a/navit/gui/qt5_qml/skins/icons/appbar.transit.car.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 17.4167,50.6667C 16.5422,50.6667 15.8333,49.9578 15.8333,49.0833L 15.8333,39.5834C 15.8333,37.0877 17.2768,34.9292 19.3745,33.8972L 25.3333,19L 26.9167,19L 30.0833,19L 45.9167,19L 49.0833,19L 50.6667,19L 56.6255,33.8972C 58.7231,34.9292 60.1666,37.0877 60.1666,39.5834L 60.1667,49.0833C 60.1667,49.9578 59.4578,50.6667 58.5833,50.6667L 57,50.6667L 57,53.8333C 57,55.5822 55.5822,57 53.8333,57C 52.0844,57 50.6667,55.5822 50.6667,53.8333L 50.6667,50.6667L 25.3333,50.6667L 25.3333,53.8333C 25.3333,55.5822 23.9156,57 22.1667,57C 20.4178,57 19,55.5822 19,53.8333L 19,50.6667L 17.4167,50.6667 Z M 24.3833,33.25L 51.6166,33.25L 47.8166,23.75L 28.1833,23.75L 24.3833,33.25 Z M 24.1458,36.0209C 22.3969,36.0209 20.5833,37.8344 20.5833,39.5833C 20.5833,41.3322 22.3969,43.1458 24.1458,43.1458C 25.8947,43.1458 27.7083,41.3323 27.7083,39.5834C 27.7083,37.8345 25.8947,36.0209 24.1458,36.0209 Z M 51.8542,36.0208C 50.1053,36.0208 48.2917,37.8344 48.2917,39.5833C 48.2917,41.3322 50.1053,43.1458 51.8542,43.1458C 53.6031,43.1458 55.4167,41.3322 55.4167,39.5833C 55.4167,37.8344 53.6031,36.0208 51.8542,36.0208 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/maps.qml b/navit/gui/qt5_qml/skins/maps.qml
deleted file mode 100644
index 6e41891d6..000000000
--- a/navit/gui/qt5_qml/skins/maps.qml
+++ /dev/null
@@ -1,36 +0,0 @@
-import QtQuick 2.0
-
-ListView {
- model: maps
- delegate: Rectangle {
- height: 64
- color: "#ff0000"
- radius: 2
- border.width: 1
-
- Image {
- id: image1
- height: parent.height - 4;
- source : active ? "icons/appbar.layer.svg" : "icons/appbar.layer.delete.svg"
- opacity: active ? 1 : 0.4
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- MouseArea{
- anchors.fill: parent
- hoverEnabled: true
- onEntered: {
- // backend.list_maps(1)
- }
- }
- }
-
- Component.onCompleted: backend.list_maps(0)
-}
diff --git a/navit/gui/qt5_qml/skins/menu.qml b/navit/gui/qt5_qml/skins/menu.qml
deleted file mode 100644
index 540a16032..000000000
--- a/navit/gui/qt5_qml/skins/menu.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-import QtQuick.Layouts 1.0
-import QtQuick 2.2
-
-Rectangle {
- id: rectangle
- visible: true
- height: 300
- color: "#000000"
-
- Rectangle {
- id: rectangle1
- x: 0
- y: 200
- height: 300
- color: "#1e1b18"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 0
- anchors.right: parent.right
- anchors.rightMargin: 0
-
- Loader {
- id: menucontent
- width: parent.width
- height: parent.height
- Component.onCompleted: menucontent.source = "MainMenu.qml"
- }
-
- }
-
- MainButton {
- id: mainButton3
- width: 260
- height: 80
- radius: 1
- text: "Map"
- anchors.right: parent.right
- anchors.rightMargin: 0
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 0
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.map.svg"
- onClicked: {
- mainMenu.state = ''
- mainMenu.source = ""
- }
-
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/MainButton.qml b/navit/gui/qt5_qml/skins/modern/MainButton.qml
deleted file mode 100644
index 18a41dd8d..000000000
--- a/navit/gui/qt5_qml/skins/modern/MainButton.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Layouts 1.0
-
-Rectangle {
- id: container
-
- signal clicked
- property string text: "Button"
- property string icon: "icons/appbar.home.variant.svg"
-
- smooth: true;
- width: 200;
- height: 80
- color: "#35322f"
- radius: 2
- border.width: 1
-
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
-
- Text {
- id: txtItem;
- color: "#ffffff"
- text: container.text
- font.pointSize: 18
- anchors.left: rectangle.right
- anchors.leftMargin: 8
- anchors.verticalCenter: parent.verticalCenter
- z: 1
- }
-
- Rectangle {
- id: rectangle
- width: container.height
- height: container.height
- color: "#35322f"
- radius: 2
- border.width: 1
- anchors.verticalCenter: parent.verticalCenter
-
- Image {
- id: imgItem;
- width: parent.width;
- height: parent.height;
- source: container.icon
- smooth: true
- scale: 1
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- // anchors.leftMargin: 8
- // sourceSize.width: parent.width
- // sourceSize.height: parent.height
- fillMode: Image.PreserveAspectFit
- }
- }
-
- states: [
- State {
- name: "Pressed"; when: mr.pressed == true
- PropertyChanges {
- target: txtItem;
- opacity: 0.6;
- color: "#84ca43";
- }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 }
- }
-
-}
-
diff --git a/navit/gui/qt5_qml/skins/modern/MainMenu.qml b/navit/gui/qt5_qml/skins/modern/MainMenu.qml
deleted file mode 100644
index 748a5ab0f..000000000
--- a/navit/gui/qt5_qml/skins/modern/MainMenu.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Layouts 1.0
-
-GridLayout {
- id: gridLayout
- anchors.fill: parent
- columnSpacing: 4
- rowSpacing: 4
- rows: 3
- columns: 2
-
- MainButton {
- text: "Where To?"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.rocket.svg"
- onClicked: {
- menucontent.source = "destination.qml"
- }
- }
-
- MainButton {
- text: "My position"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.location.checkin.svg"
- }
-
- MainButton {
- text: "Around Me"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.information.circle.svg"
- onClicked: {
- menucontent.source = "pois.qml"
- }
- }
-
- MainButton {
- text: "Settings"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.cog.svg"
- onClicked: {
- menucontent.source = "settings.qml"
- }
- }
-
- MainButton {
- text: "My route"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.book.list.svg"
- }
-
- MainButton {
- text: "Quit"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.power.svg"
- onClicked: Qt.quit()
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/bookmark.qml b/navit/gui/qt5_qml/skins/modern/bookmark.qml
deleted file mode 100644
index 66261576c..000000000
--- a/navit/gui/qt5_qml/skins/modern/bookmark.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import com.navit.graphics_qt5 1.0
-
-
-Item {
- id: bookmarkItem
- visible: true
- property var small_font_size : 16
-
-
- Text {
- x: 8
- y: 8
- color: "#ffffff"
- text: backend.currentBookmark.name
- font.pixelSize: 32
- }
-
- Text {
- x: 80
- y: 64
- color: "#ffffff"
- text: qsTr("Type")
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 80
- y: 96
- color: "#ffffff"
- text: qsTr("Distance")
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 160
- y: 64
- color: "#ffffff"
- text: backend.currentBookmark.type
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 160
- y: 96
- color: "#ffffff"
- text: backend.currentBookmark.distance
- font.pixelSize: small_font_size
- }
-
- Rectangle {
- id: rectangle
- x: 8
- y: 64
- height: 64
- width: height
- color: "#ffffff"
- radius: 8
- border.width: 1
- Image {
- height: parent.width
- width: parent.height
- source : backend.get_icon_path() + backend.currentBookmark.icon
- sourceSize.width: parent.width
- sourceSize.height: parent.height
- }
- }
-
- ColumnLayout {
- id: columnLayout
- width: parent.width/2
- height: parent.height
- anchors.right: parent.right
- anchors.rightMargin: 0
- QNavitQuick {
- id: navit1
- width: 300
- height: 240
- Component.onCompleted: {
- navit1.setGraphicContext(graphics_qt5_context)
- }
- Component.onDestruction: {
- console.log("Destroying a navit widget. Blocking draw operations")
- backend.block_draw()
- }
- }
- }
-
- MainButton {
- id: mainButton3
- x: 8
- y: parent.height-78
- width: parent.width/2 - 16
- height: 64
- radius: 1
- text: "Set as destination"
- icon: "icons/appbar.location.checkin.svg"
- onClicked: {
- backend.setCurrentBookmarkAsDestination()
- }
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/bookmarks.qml b/navit/gui/qt5_qml/skins/modern/bookmarks.qml
deleted file mode 100644
index b8e644081..000000000
--- a/navit/gui/qt5_qml/skins/modern/bookmarks.qml
+++ /dev/null
@@ -1,108 +0,0 @@
-import QtQuick 2.0
-
-Item {
- id: bookmarklist
- ListView {
- anchors.fill: parent
- id: listView
- model: backend.bookmarks
- delegate: Item {
- height: 64
- width: parent.width;
- Rectangle {
- color: "#1e1b18"
- height: parent.height;
- width: parent.width;
- border.width: 1
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: distanceText.right
- anchors.leftMargin: 8
- }
-
- MouseArea {
- id: mouse_area1
- z: 1
- hoverEnabled: false
- anchors.fill: parent
-
- onClicked:{
- listView.currentIndex = index
- backend.setCurrentBookmark(index);
- menucontent.source = "bookmark.qml"
- }
- }
- }
-
- }
-
- Component.onCompleted: backend.get_bookmarks()
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height * 2
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.up.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listUp
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listUp.pressed
- velocity: 1000
- to: 0
- }
- onReleased: {
- if (!listView.atYBeginning)
- listView.flick(0, 1000)
- }
- }
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.down.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listDown
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listDown.pressed
- to: listView.contentHeight - listView.height
- velocity: 1000
- }
- onReleased: {
- if (!listView.atYEnd)
- listView.flick(0, -1000)
- }
- }
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/destination.qml b/navit/gui/qt5_qml/skins/modern/destination.qml
deleted file mode 100644
index 00e1f5579..000000000
--- a/navit/gui/qt5_qml/skins/modern/destination.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-GridLayout {
- id: gridLayout
- anchors.fill: parent
- columnSpacing: 4
- rowSpacing: 4
- rows: 4
- columns: 1
-
- MainButton {
- text: "Address lookup"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.city.svg"
- onClicked: {
- menucontent.source = "destination_address.qml"
- }
- }
-
- MainButton {
- text: "Go Home"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-
- MainButton {
- text: "Bookmarks"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.location.svg"
- onClicked: {
- menucontent.source = "bookmarks.qml"
- }
- }
-
- MainButton {
- text: "Previous destinations"
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.timer.rewind.svg"
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/destination_address.qml b/navit/gui/qt5_qml/skins/modern/destination_address.qml
deleted file mode 100644
index 35d11a68c..000000000
--- a/navit/gui/qt5_qml/skins/modern/destination_address.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-GridLayout {
- id: gridLayout
- anchors.fill: parent
- columnSpacing: 4
- rowSpacing: 4
- rows: 3
- columns: 1
-
- MainButton {
- id: townSearchButton
- height: 100
- text: backend.currentTown
- Layout.fillWidth: true
- onClicked: {
- backend.setSearchContext('town')
- menucontent.source = "search.qml"
- }
- }
-
- MainButton {
- id: streetSearchButton
- height: 100
- text: backend.currentStreet
- Layout.fillWidth: true
- onClicked: {
- backend.setSearchContext('street')
- menucontent.source = "search.qml"
- }
- }
-
- MainButton {
- id: countrySearchButton
- height: 100
- text: backend.currentCountry
- icon: backend.get_icon_path() + 'country_' + backend.currentCountryIso2 + ".svg"
- Layout.fillWidth: true
- onClicked: {
- backend.setSearchContext('country')
- menucontent.source = "search.qml"
- }
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.book.list.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.book.list.svg
deleted file mode 100644
index 9dda725d2..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.book.list.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 22,19L 24,19L 24,57L 22,57L 22,19 Z M 26,57L 26,19.0001L 53.9999,19.0001L 53.9999,57L 26,57 Z M 30,24L 30,27L 50,27L 50,24L 30,24 Z M 30,32L 30,35L 33,35L 33,32L 30,32 Z M 36,32L 36,35L 49,35L 49,32L 36,32 Z M 30,40L 30,43L 33,43L 33,40L 30,40 Z M 36,40L 36,43L 48,43L 48,40L 36,40 Z M 30,48L 30,51L 33,51L 33,48L 30,48 Z M 36,48L 36,51L 50,51L 50,48L 36,48 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.down.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.down.svg
deleted file mode 100644
index 3917fc7cd..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.down.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 37.8516,39.5833L 52.1016,24.9375L 52.1016,35.2292L 37.8516,50.2708L 23.6016,35.2292L 23.6016,24.9375L 37.8516,39.5833 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.up.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.up.svg
deleted file mode 100644
index b737d9773..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.chevron.up.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 37.8516,35.625L 34.6849,38.7917L 23.6016,50.2708L 23.6016,39.9792L 37.8516,24.9375L 52.1016,39.9792L 52.1016,50.2708L 41.0182,38.7917L 37.8516,35.625 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.city.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.city.svg
deleted file mode 100644
index f66893f7e..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.city.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 44.3333,30.0833L 57,30.0833L 57,57L 44.3333,57L 44.3333,30.0833 Z M 46.3125,35.2292L 46.3125,38L 49.0833,38L 49.0833,35.2292L 46.3125,35.2292 Z M 52.25,35.2292L 52.25,38L 55.0208,38L 55.0208,35.2292L 52.25,35.2292 Z M 46.3125,39.9792L 46.3125,42.75L 49.0833,42.75L 49.0833,39.9792L 46.3125,39.9792 Z M 52.25,39.9792L 52.25,42.75L 55.0208,42.75L 55.0208,39.9792L 52.25,39.9792 Z M 46.3125,44.7292L 46.3125,47.5L 49.0833,47.5L 49.0833,44.7292L 46.3125,44.7292 Z M 52.25,44.7292L 52.25,47.5L 55.0208,47.5L 55.0208,44.7292L 52.25,44.7292 Z M 46.3125,49.4792L 46.3125,52.25L 49.0833,52.25L 49.0833,49.4792L 46.3125,49.4792 Z M 52.25,49.4792L 52.25,52.25L 55.0208,52.25L 55.0208,49.4792L 52.25,49.4792 Z M 23.75,25.3333L 25.3333,22.1667L 26.9167,22.1667L 26.9167,18.2084L 28.5,18.2084L 28.5,22.1667L 31.6667,22.1667L 31.6667,18.2084L 33.25,18.2084L 33.25,22.1667L 34.8333,22.1667L 36.4167,25.3333L 36.4167,34.8334L 38.7917,34.8333L 41.1667,37.2083L 41.1667,57L 19,57L 19,37.2083L 21.375,34.8333L 23.75,34.8334L 23.75,25.3333 Z M 25.7291,27.3125L 25.7291,30.0834L 28.1041,30.0834L 28.1041,27.3125L 25.7291,27.3125 Z M 32.0625,27.3125L 32.0625,30.0834L 34.4375,30.0834L 34.4375,27.3125L 32.0625,27.3125 Z M 25.7291,32.0625L 25.7291,34.8334L 28.1041,34.8334L 28.1041,32.0625L 25.7291,32.0625 Z M 32.0625,32.0625L 32.0625,34.8334L 34.4375,34.8334L 34.4375,32.0625L 32.0625,32.0625 Z M 30.875,39.9792L 28.8958,39.9792L 28.8958,42.75L 30.875,42.75L 30.875,39.9792 Z M 24.5416,39.9792L 24.5416,42.75L 26.9166,42.75L 26.9166,39.9792L 24.5416,39.9792 Z M 36.0208,39.9792L 33.25,39.9792L 33.25,42.75L 36.0208,42.75L 36.0208,39.9792 Z M 30.875,44.7292L 28.8958,44.7292L 28.8958,47.5L 30.875,47.5L 30.875,44.7292 Z M 26.9166,44.7292L 24.5416,44.7292L 24.5416,47.5L 26.9166,47.5L 26.9166,44.7292 Z M 36.0208,44.7292L 33.25,44.7292L 33.25,47.5L 36.0208,47.5L 36.0208,44.7292 Z M 30.875,49.4792L 28.8958,49.4792L 28.8958,52.25L 30.875,52.25L 30.875,49.4792 Z M 26.9166,49.4792L 24.5416,49.4792L 24.5417,52.25L 26.9167,52.25L 26.9166,49.4792 Z M 36.0208,49.4792L 33.25,49.4792L 33.25,52.25L 36.0208,52.25L 36.0208,49.4792 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.cog.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.cog.svg
deleted file mode 100644
index 4ef1ef8c2..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.cog.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 27.5314,21.8628L 33.0126,19.4224L 34.7616,23.3507C 36.6693,22.9269 38.6044,22.8903 40.4668,23.2026L 42.0083,19.1868L 47.6098,21.337L 46.0683,25.3528C 47.6612,26.3669 49.0747,27.6889 50.2088,29.2803L 54.1371,27.5313L 56.5776,33.0126L 52.6493,34.7616C 53.0731,36.6693 53.1097,38.6043 52.7974,40.4668L 56.8131,42.0083L 54.6629,47.6097L 50.6472,46.0683C 49.6331,47.6613 48.3111,49.0748 46.7197,50.2089L 48.4686,54.1372L 42.9874,56.5776L 41.2384,52.6493C 39.3307,53.0731 37.3957,53.1097 35.5333,52.7974L 33.9918,56.8131L 28.3903,54.6629L 29.9318,50.6472C 28.3388,49.6331 26.9252,48.3111 25.7911,46.7196L 21.8628,48.4686L 19.4224,42.9873L 23.3507,41.2383C 22.9269,39.3307 22.8903,37.3957 23.2026,35.5332L 19.1869,33.9918L 21.3371,28.3903L 25.3528,29.9318C 26.3669,28.3388 27.6889,26.9252 29.2804,25.7911L 27.5314,21.8628 Z M 34.3394,29.7781C 29.7985,31.7998 27.7564,37.1198 29.7781,41.6606C 31.7998,46.2015 37.1198,48.2436 41.6606,46.2219C 46.2015,44.2002 48.2436,38.8802 46.2219,34.3394C 44.2002,29.7985 38.8802,27.7564 34.3394,29.7781 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.cogs.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.cogs.svg
deleted file mode 100644
index e3fdaa4ce..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.cogs.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 32.6227,68.9728C 33.1208,70.2446 33.7077,71.4719 34.3757,72.6471C 35.567,72.7702 36.7761,72.8333 38,72.8333C 40.6447,72.8333 43.2205,72.5386 45.6965,71.9802C 42.2807,68.5449 40.1698,63.8107 40.1698,58.5835C 40.1698,48.0901 48.6764,39.5835 59.1698,39.5835C 64.2047,39.5835 68.7822,41.5419 72.182,44.7385C 72.6094,42.5584 72.8333,40.3053 72.8333,38C 72.8333,36.442 72.731,34.908 72.5328,33.4041C 70.4772,32.3109 68.2718,31.4621 65.9554,30.8963L 65.6219,22.7367C 63.5664,22.3692 61.4511,22.1741 59.2916,22.1671L 57.491,30.1322C 54.2845,30.3184 51.2204,31.0348 48.3848,32.1949L 43.318,25.7887C 41.3995,26.7177 39.5749,27.8102 37.8622,29.0479L 41.0883,36.5527C 38.6742,38.5364 36.5919,40.9091 34.9373,43.575L 27.0703,41.3697C 26.073,43.2256 25.2319,45.178 24.5646,47.2093L 31.5867,51.385C 30.9883,53.6844 30.6698,56.0968 30.6698,58.5835L 30.746,60.6839L 23.0854,63.5239C 23.3743,65.6539 23.8474,67.7255 24.4881,69.7219L 32.6227,68.9728 Z M 27.0669,37.1755L 34.9338,39.3807C 35.9312,37.5248 36.7723,35.5724 37.4395,33.5412L 30.4175,29.3654C 31.0159,27.066 31.3344,24.6537 31.3344,22.1669L 31.2581,20.0665L 38.9187,17.2265C 38.6299,15.0965 38.1568,13.0249 37.5161,11.0285L 29.3815,11.7776C 28.4787,9.47258 27.2844,7.31377 25.8439,5.34655C 22.7943,6.48232 19.9467,8.03307 17.3698,9.93015C 20.1557,13.2359 21.8344,17.5054 21.8344,22.1669C 21.8344,32.5019 13.5826,40.9096 3.30816,41.1611C 3.60321,44.4411 4.35293,47.59 5.49381,50.5444C 8.34489,50.2806 11.0742,49.5968 13.6194,48.5555L 18.6861,54.9617C 20.6046,54.0327 22.4293,52.9403 24.142,51.7025L 20.9158,44.1977C 23.3299,42.2141 25.4123,39.8414 27.0669,37.1755 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.fullscreen.box.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.fullscreen.box.svg
deleted file mode 100644
index 13e6840e5..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.fullscreen.box.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 19,57L 19,19L 57,19L 57,57L 19,57 Z M 24,29L 47,29L 47,52L 52,52L 52,24L 24,24L 24,29 Z M 24,34L 24,52L 42,52L 42,34L 24,34 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.home.variant.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.home.variant.svg
deleted file mode 100644
index ea951fd19..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.home.variant.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 24.0033,56.0078L 24.0033,38.0053L 22.0031,40.0056L 19.0027,35.0049L 38.0053,20.0028L 45.0063,25.5299L 45.0063,21.753L 49.0068,21.0029L 49.0068,28.6882L 57.008,35.0049L 54.0075,40.0056L 52.0073,38.0053L 52.0073,56.0078L 24.0033,56.0078 Z M 38.0053,26.9204L 27.0038,36.005L 27.0038,53.0074L 38.0045,53.0075L 38.0045,41.0061L 46.0058,41.0061L 46.0059,53.0075L 49.0068,53.0074L 49.0068,36.005L 38.0053,26.9204 Z M 30.004,41.0057L 35.0049,41.0057L 35.0049,47.0066L 30.004,47.0066L 30.004,41.0057 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.information.circle.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.information.circle.svg
deleted file mode 100644
index 031bd37f5..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.information.circle.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 38,19C 48.4934,19 57,27.5066 57,38C 57,48.4934 48.4934,57 38,57C 27.5066,57 19,48.4934 19,38C 19,27.5066 27.5066,19 38,19 Z M 33.25,33.25L 33.25,36.4167L 36.4166,36.4167L 36.4166,47.5L 33.25,47.5L 33.25,50.6667L 44.3333,50.6667L 44.3333,47.5L 41.1666,47.5L 41.1666,36.4167L 41.1666,33.25L 33.25,33.25 Z M 38.7917,25.3333C 37.48,25.3333 36.4167,26.3967 36.4167,27.7083C 36.4167,29.02 37.48,30.0833 38.7917,30.0833C 40.1033,30.0833 41.1667,29.02 41.1667,27.7083C 41.1667,26.3967 40.1033,25.3333 38.7917,25.3333 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.delete.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.delete.svg
deleted file mode 100644
index ddbeb21ca..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.delete.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 18.5088,44.0374L 21.8676,40.6786L 27.4655,46.2765L 33.0634,40.6786L 36.4222,44.0374L 30.8243,49.6353L 36.4222,55.2332L 33.0634,58.592L 27.4655,52.994L 21.8676,58.592L 18.5088,55.2332L 24.1068,49.6353L 18.5088,44.0374 Z M 57.0079,38.0053L 38.0053,47.5066L 36.7482,46.8781L 39.5889,44.0374L 35.2559,39.7977L 38.0053,41.1724L 50.6737,34.8382L 57.0079,38.0053 Z M 19.0026,38.0053L 25.3369,34.8382L 32.3326,38.3361L 29.8968,40.7719L 28.1098,42.5589L 25.7193,41.3636L 21.8676,37.6052L 20.6459,38.8269L 19.0026,38.0053 Z M 38.0053,19.0027L 57.0079,28.504L 38.0053,38.0053L 19.0026,28.504L 38.0053,19.0027 Z M 57.0079,47.5066L 38.0053,57.008L 37.8778,56.9442L 39.5889,55.2332L 33.9909,49.6353L 34.6367,48.9895L 38.0053,50.6738L 50.6737,44.3395L 57.0079,47.5066 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.svg
deleted file mode 100644
index 9eb28235c..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.layer.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 57.0079,38.0053L 38.0053,47.5066L 19.0027,38.0053L 25.3369,34.8382L 38.0053,41.1724L 50.6737,34.8382L 57.0079,38.0053 Z M 38.0053,19.0027L 57.0079,28.504L 38.0053,38.0053L 19.0026,28.504L 38.0053,19.0027 Z M 57.0079,47.5066L 38.0053,57.008L 19.0026,47.5066L 25.3369,44.3395L 38.0053,50.6737L 50.6737,44.3395L 57.0079,47.5066 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.location.checkin.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.location.checkin.svg
deleted file mode 100644
index 3b21754c6..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.location.checkin.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-linejoin="round" d="M 38,19C 42.9706,19 47,23.0294 47,28C 47,30.5642 45.9276,32.878 38,49C 30.0724,32.878 29,30.5642 29,28C 29,23.0294 33.0294,19 38,19 Z M 38,24C 35.7909,24 34,25.7909 34,28C 34,30.2092 35.7909,32 38,32C 40.2091,32 42,30.2092 42,28C 42,25.7909 40.2091,24 38,24 Z M 19,57L 24,42L 31.5,42L 33.5,46L 27.6641,46L 25.3324,53L 50.6676,53L 48.3359,46L 42.5,46L 44.5,42L 52,42L 57,57L 19,57 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.location.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.location.svg
deleted file mode 100644
index fff6bf3e1..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.location.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 26.9167,13.8542L 50.6666,13.8542L 50.6667,39.5833L 26.9167,63.3333L 26.9167,13.8542 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.map.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.map.svg
deleted file mode 100644
index 241f71e59..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.map.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 27.7083,23.75L 38.7917,26.9167L 48.2917,20.5833L 62,24L 62,51L 48.2917,47.5L 38.7917,53.8333L 27.7083,50.6667L 16,55.5L 16,28.5L 27.7083,23.75 Z M 27,46.25L 27,29L 20,31.75L 20,49L 27,46.25 Z M 49,25.5L 49,42.75L 58,45.25L 58,28L 49,25.5 Z M 39,31.5L 39,49L 48,43L 48,25.5L 39,31.5 Z M 28,28.75L 28,46L 38,48.5L 38,31.75L 28,28.75 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.power.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.power.svg
deleted file mode 100644
index d3f865c0d..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.power.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 36.4167,36.4167L 36.4167,17.4167L 41.1667,17.4167L 41.1667,36.4167L 36.4167,36.4167 Z M 57,39.5833C 57,50.0767 48.4934,58.5833 38,58.5833C 27.5066,58.5833 19,50.0767 19,39.5833C 19,30.7301 25.0552,23.2911 33.25,21.1819L 33.25,27.8374C 28.6079,29.7165 25.3333,34.2675 25.3333,39.5833C 25.3333,46.5789 31.0044,52.25 38,52.25C 44.9956,52.25 50.6667,46.5789 50.6667,39.5833C 50.6667,34.8949 48.1194,30.8014 44.3333,28.6113L 44.3333,21.6645C 51.7129,24.2728 57,31.3106 57,39.5833 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.rocket.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.rocket.svg
deleted file mode 100644
index a8c5c273a..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.rocket.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 38,19C 39.4823,20.6344 43,26.1259 43,41L 47,46L 47,55L 43,50L 33,50L 29,55L 29,46L 33,41C 33,26.1259 36.0177,20.6344 38,19 Z M 38,57.5L 35,51L 41,51L 38,57.5 Z M 38,27L 36.1552,27.4612L 35.6203,30.5949L 38,30L 40.2918,30.573L 39.6953,27.4238L 38,27 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.timer.rewind.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.timer.rewind.svg
deleted file mode 100644
index a02cff6b7..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.timer.rewind.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 53.8333,41.1667C 53.8333,49.9112 46.7445,57 38,57C 29.2555,57 22.1667,49.9112 22.1667,41.1667C 22.1667,32.9565 28.4156,26.2059 36.4167,25.4115L 36.4167,23.75L 31.6667,23.75L 31.6667,19L 44.3333,19L 44.3333,23.75L 39.5833,23.75L 39.5833,25.4115C 42.7678,25.7277 45.6747,26.9874 48.0205,28.907L 49.1629,27.7646L 46.9237,25.5254L 50.2825,22.1667L 57,28.8842L 53.6412,32.2429L 51.4021,30.0038L 50.2597,31.1462C 52.4932,33.8756 53.8333,37.3647 53.8333,41.1667 Z M 26.2296,39.5834L 30.0833,39.5834L 30.0833,42.75L 26.2296,42.75C 26.9347,48.0419 31.1248,52.232 36.4166,52.9371L 36.4166,49.0833L 39.5833,49.0833L 39.5833,52.9371C 44.8752,52.232 49.0653,48.0419 49.7703,42.75L 45.9166,42.75L 45.9166,39.5834L 49.7703,39.5834C 49.0652,34.2915 44.8751,30.1014 39.5833,29.3964L 39.5833,33.25L 36.4166,33.25L 36.4166,29.3964C 31.1248,30.1014 26.9347,34.2915 26.2296,39.5834 Z M 38,38C 39.7488,38 41.1666,39.4178 41.1666,41.1667C 41.1666,42.9156 39.7488,44.3334 38,44.3334L 31.6666,49.0834L 34.8333,41.1667C 34.8333,39.4178 36.2511,38 38,38 Z M 19.7917,33.25L 19.7917,26.938C 17.2963,30.5244 15.8333,34.883 15.8333,39.5833C 15.8333,51.8257 25.7577,61.75 38,61.75L 42.3542,61.75C 54.3778,61.75 64.1249,51.8257 64.125,39.5835C 64.125,54.0119 52.4284,65.7083 38,65.7083C 23.5716,65.7083 11.875,54.0118 11.875,39.5833C 11.875,33.9832 13.6371,28.7946 16.637,24.5417L 11.0833,24.5417L 15.0417,20.5834L 23.75,20.5833L 23.75,29.2917L 19.7917,33.25 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/appbar.transit.car.svg b/navit/gui/qt5_qml/skins/modern/icons/appbar.transit.car.svg
deleted file mode 100644
index 8ea1a7c5d..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/appbar.transit.car.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
- <path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 17.4167,50.6667C 16.5422,50.6667 15.8333,49.9578 15.8333,49.0833L 15.8333,39.5834C 15.8333,37.0877 17.2768,34.9292 19.3745,33.8972L 25.3333,19L 26.9167,19L 30.0833,19L 45.9167,19L 49.0833,19L 50.6667,19L 56.6255,33.8972C 58.7231,34.9292 60.1666,37.0877 60.1666,39.5834L 60.1667,49.0833C 60.1667,49.9578 59.4578,50.6667 58.5833,50.6667L 57,50.6667L 57,53.8333C 57,55.5822 55.5822,57 53.8333,57C 52.0844,57 50.6667,55.5822 50.6667,53.8333L 50.6667,50.6667L 25.3333,50.6667L 25.3333,53.8333C 25.3333,55.5822 23.9156,57 22.1667,57C 20.4178,57 19,55.5822 19,53.8333L 19,50.6667L 17.4167,50.6667 Z M 24.3833,33.25L 51.6166,33.25L 47.8166,23.75L 28.1833,23.75L 24.3833,33.25 Z M 24.1458,36.0209C 22.3969,36.0209 20.5833,37.8344 20.5833,39.5833C 20.5833,41.3322 22.3969,43.1458 24.1458,43.1458C 25.8947,43.1458 27.7083,41.3323 27.7083,39.5834C 27.7083,37.8345 25.8947,36.0209 24.1458,36.0209 Z M 51.8542,36.0208C 50.1053,36.0208 48.2917,37.8344 48.2917,39.5833C 48.2917,41.3322 50.1053,43.1458 51.8542,43.1458C 53.6031,43.1458 55.4167,41.3322 55.4167,39.5833C 55.4167,37.8344 53.6031,36.0208 51.8542,36.0208 Z "/>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/icons/bigcity.png b/navit/gui/qt5_qml/skins/modern/icons/bigcity.png
deleted file mode 100644
index cdc265d02..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/bigcity.png
+++ /dev/null
Binary files differ
diff --git a/navit/gui/qt5_qml/skins/modern/icons/smallcity.png b/navit/gui/qt5_qml/skins/modern/icons/smallcity.png
deleted file mode 100644
index 4b8d354ee..000000000
--- a/navit/gui/qt5_qml/skins/modern/icons/smallcity.png
+++ /dev/null
Binary files differ
diff --git a/navit/gui/qt5_qml/skins/modern/main.qml b/navit/gui/qt5_qml/skins/modern/main.qml
deleted file mode 100644
index 3c35a4dd0..000000000
--- a/navit/gui/qt5_qml/skins/modern/main.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-import com.navit.graphics_qt5 1.0
-import QtQuick 2.2
-
-Rectangle {
- width: 800
- height: 480
-
- Connections {
- target: backend
- onHideMenu: {
- hideMainMenu()
- }
- onDisplayMenu: {
- mainMenu.submenu = source
- mainMenu.state = 'visible'
- console.log("showing menu with submenu " + mainMenu.submenu)
- mainMenu.source = '' // Needed when switching submenus from the code to refresh the menu
- mainMenu.source = "menu.qml"
- }
- }
-
- function hideMainMenu(){
- mainMenu.source = ''
- mainMenu.state = 'default'
- }
-
- color: "black"
- id: container
-
- QNavitQuick {
- id: navit1
- width: parent.width
- height: parent.height
- // focus: true
- opacity: 0;
- Component.onCompleted: {
- console.log(width + "x" + height)
- navit1.setGraphicContext(graphics_qt5_context);
- navit1.opacity = 1;
- }
- Behavior on opacity {
- NumberAnimation {
- id: opacityAnimation;duration: 1000;alwaysRunToEnd: true
- }
- }
- }
-
- Loader {
- id: mainMenu
- width: parent.width
- height: parent.height
- x: parent.width
- opacity: 0
- property string submenu
-
- states: [
- State {
- name: "visible"
- PropertyChanges {
- target: mainMenu
- x: 0
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "x,y,opacity";duration: 200
- }
- onRunningChanged: {
- if ((mainMenu.opacity == 0) && (!running)){
- backend.resize(navit1.width, navit1.height);
- console.log("transition done, hiding menu window size " + navit1.width + " x " + navit1.height)
- }
- }
- }
- ]
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/maps.qml b/navit/gui/qt5_qml/skins/modern/maps.qml
deleted file mode 100644
index 2eab6798d..000000000
--- a/navit/gui/qt5_qml/skins/modern/maps.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-
-ListView {
- id: list
- model: backend.maps
- delegate: Item {
- height: 64
- width: parent.width;
- Rectangle {
- color: "#1e1b18"
- height: parent.height;
- width: parent.width;
- border.width: 1
-
- Image {
- id: image1
- height: parent.height - 4;
- source : active ? "icons/appbar.layer.svg" : "icons/appbar.layer.delete.svg"
- opacity: active ? 1 : 0.1
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- MouseArea {
- id: mouse_area1
- z: 1
- hoverEnabled: false
- anchors.fill: parent
-
- onClicked:{
- list.currentIndex = index
- console.log("test " + index);
- }
- }
- }
- }
-
- Component.onCompleted: backend.get_maps()
-}
diff --git a/navit/gui/qt5_qml/skins/modern/menu.qml b/navit/gui/qt5_qml/skins/modern/menu.qml
deleted file mode 100644
index ee51f68a2..000000000
--- a/navit/gui/qt5_qml/skins/modern/menu.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-import QtQuick.Layouts 1.0
-import QtQuick 2.2
-
-Item {
- Rectangle {
- id: menuArea
- color: "#1e1b18"
- width: parent.width
- y: topBar.height
- height: parent.height - ( topBar.height + bottomBar.height )
-
- Loader {
- id: menucontent
- width: parent.width
- height: parent.height
- Component.onCompleted: {
- console.log("submenu : " + mainMenu.submenu)
- menucontent.source = mainMenu.submenu
- }
- }
- }
-
- Rectangle {
- id: bottomBar
- width: parent.width
- height: 64
- color: "#1e1b18"
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 0
-
- MainButton {
- id: mainButton3
- x: 380
- y: 220
- width: 260
- height: 56
- radius: 1
- text: "Map"
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 4
- Layout.fillHeight: true
- Layout.fillWidth: true
- icon: "icons/appbar.map.svg"
- onClicked: {
- container.hideMainMenu()
- }
-
- }
- }
-
- Rectangle {
- id: topBar
- width: parent.width
- height: 80
- color: "#1e1b18"
- anchors.top: parent.top
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/navit.svg b/navit/gui/qt5_qml/skins/modern/navit.svg
deleted file mode 100644
index 591d9ee57..000000000
--- a/navit/gui/qt5_qml/skins/modern/navit.svg
+++ /dev/null
@@ -1,393 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="22"
- height="22"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.48.4 r9939"
- version="1.0"
- sodipodi:docname="navit.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="/home/jeff/projets/navit/navit.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
- <defs
- id="defs4">
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3376">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3378" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3380" />
- </linearGradient>
- <linearGradient
- id="linearGradient3365">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.61904764;"
- offset="0"
- id="stop3367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3369" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3328">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3330" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3332" />
- </linearGradient>
- <linearGradient
- id="linearGradient3320">
- <stop
- style="stop-color:#116cbf;stop-opacity:1;"
- offset="0"
- id="stop3322" />
- <stop
- id="stop3354"
- offset="0.08"
- style="stop-color:#116cbf;stop-opacity:1;" />
- <stop
- id="stop3352"
- offset="0.4893617"
- style="stop-color:#1a6cb6;stop-opacity:1;" />
- <stop
- style="stop-color:#329eff;stop-opacity:1;"
- offset="1"
- id="stop3324" />
- </linearGradient>
- <linearGradient
- id="linearGradient3308">
- <stop
- style="stop-color:#062643;stop-opacity:1;"
- offset="0"
- id="stop3310" />
- <stop
- style="stop-color:#0d5799;stop-opacity:1;"
- offset="1"
- id="stop3312" />
- </linearGradient>
- <linearGradient
- id="linearGradient3235">
- <stop
- style="stop-color:#c17d11;stop-opacity:1;"
- offset="0"
- id="stop3237" />
- <stop
- style="stop-color:#e9cb14;stop-opacity:1;"
- offset="1"
- id="stop3239" />
- </linearGradient>
- <linearGradient
- id="linearGradient3227">
- <stop
- style="stop-color:#76650c;stop-opacity:1;"
- offset="0"
- id="stop3229" />
- <stop
- style="stop-color:#76650c;stop-opacity:0;"
- offset="1"
- id="stop3231" />
- </linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="15.556349 : 133.02972 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3235"
- id="linearGradient3241"
- x1="64"
- y1="115.11359"
- x2="64"
- y2="17.40102"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3308"
- id="linearGradient3314"
- x1="-7.7781754"
- y1="4.2563133"
- x2="43.133514"
- y2="4.2563133"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3320"
- id="linearGradient3326"
- x1="7.6363606"
- y1="87.731171"
- x2="58.391151"
- y2="38.450466"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15669503,0.02174581,-0.02174581,0.15669503,4.357122,0.76802046)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3340"
- gradientUnits="userSpaceOnUse"
- x1="63"
- y1="106.75"
- x2="92"
- y2="29.25" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3328"
- id="linearGradient3342"
- gradientUnits="userSpaceOnUse"
- x1="71"
- y1="69.5"
- x2="87.25"
- y2="33.5" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3365"
- id="linearGradient3371"
- x1="-1.5"
- y1="86.5"
- x2="73.5"
- y2="40"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3376"
- id="linearGradient3382"
- x1="62.147858"
- y1="67.453751"
- x2="11.016594"
- y2="24.242672"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter3424">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.90523025"
- id="feGaussianBlur3426" />
- </filter>
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.894586"
- inkscape:cy="27.303943"
- inkscape:document-units="px"
- inkscape:current-layer="layer2"
- showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="948"
- inkscape:window-x="0"
- inkscape:window-y="24"
- showborder="true"
- inkscape:window-maximized="1" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Calque 1"
- inkscape:groupmode="layer"
- id="layer1"
- style="display:inline">
- <rect
- style="fill:url(#linearGradient3241);fill-opacity:1;stroke:#43350f;stroke-width:0.79098374;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect2403"
- width="18.792814"
- height="15.381022"
- x="2.7210562"
- y="3.1272359"
- rx="1.5819675"
- ry="1.5819675" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="lignes"
- style="display:inline">
- <g
- id="g3336"
- transform="matrix(0.15819674,0,0,0.15819674,5.1568068,0.69315656)">
- <path
- sodipodi:nodetypes="cczzczc"
- id="path3223"
- d="m 92,27 8,-4 c 0,0 -32.803776,29.787015 -21.5,41.25 11.303776,11.462985 5.61873,46.35859 -6,46.25 L 19,110 C 39.916667,101.41667 73.874441,83.136394 61,66.25 48.125559,49.363606 92,27 92,27 z"
- style="fill:url(#linearGradient3340);fill-opacity:1;stroke:none"
- inkscape:connector-curvature="0" />
- <path
- sodipodi:nodetypes="czc"
- id="path3244"
- d="M 49.5,110 C 60.666667,104.16667 83.256846,86.358298 72,70.5 60.743153,54.641702 77.5,38.5 92.5,29"
- style="fill:none;stroke:url(#linearGradient3342);stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:9, 9;stroke-dashoffset:0"
- inkscape:connector-curvature="0" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer4"
- inkscape:label="bulle"
- style="display:none">
- <path
- sodipodi:type="arc"
- style="fill:url(#linearGradient3314);fill-opacity:1;stroke:#1f3157;stroke-width:5.30526352;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- id="path3305"
- sodipodi:cx="17.67767"
- sodipodi:cy="4.2563133"
- sodipodi:rx="25.455845"
- sodipodi:ry="25.455845"
- d="m 43.133514,4.2563133 a 25.455845,25.455845 0 1 1 -50.9116894,0 25.455845,25.455845 0 1 1 50.9116894,0 z"
- transform="matrix(1.3194444,0,0,1.3194444,18.394598,29.399489)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer3"
- inkscape:label="rose des vents"
- style="display:none">
- <g
- id="g3256"
- transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,36.903806,-19.093669)"
- style="opacity:0.5">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3258"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3260"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- <g
- id="g3252">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3248"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3250"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer6"
- inkscape:label="ondes"
- style="display:inline">
- <path
- sodipodi:type="spiral"
- style="fill:none;stroke:url(#linearGradient3382);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3424)"
- id="path3374"
- sodipodi:cx="14.142136"
- sodipodi:cy="19.812662"
- sodipodi:expansion="1"
- sodipodi:revolution="7"
- sodipodi:radius="54.341515"
- sodipodi:argument="-17.841497"
- sodipodi:t0="0"
- d="m 14.142136,19.812662 c 0.622964,0.987625 -1.02395,1.327003 -1.641498,1.035408 -1.673515,-0.790205 -1.44576,-3.111369 -0.429317,-4.318403 1.818177,-2.1591 5.16668,-1.702115 6.995307,0.176773 2.683583,2.757343 1.972982,7.252372 -0.782863,9.672211 C 14.610657,29.603916 8.9345884,28.6291 5.934649,24.989699 2.1595315,20.409885 3.4032379,13.538342 7.9296913,9.9636782 13.411833,5.6342815 21.486273,7.1492634 25.632617,12.56481 30.51894,18.946845 28.731319,28.228517 22.425395,32.944641 15.144955,38.389593 4.6532955,36.328487 -0.63134024,29.131329 -6.6360792,20.95346 -4.300928,9.2499464 3.7880618,3.3976889 12.862686,-3.1676594 25.779376,-0.55807441 32.198606,8.4231809 39.325168,18.394077 36.440869,32.524914 26.567024,39.51063 15.700216,47.198863 0.35449515,44.039641 -7.1973295,33.272958 -15.447588,21.510513 -12.013284,4.9493376 -0.35356778,-3.1683003 12.304301,-11.980865 30.081381,-8.2713528 38.764595,4.2815513 48.13969,17.834674 44.154872,36.828022 30.708654,46.076619 16.260416,56.014427 -3.9494981,51.754222 -13.763319,37.414588 -24.263992,22.071347 -19.728335,0.64462208 -4.4951973,-9.7342896 11.742953,-20.797954 34.386694,-15.98679 45.330585,0.1399218 56.957348,17.272902 51.870631,41.133834 34.850283,52.642608 16.822539,64.832562 -8.2557318,59.470254 -20.329308,41.556217 -33.082529,22.633765 -27.444596,-3.6619713 -8.6368269,-16.300279 11.180283,-29.616836 38.693597,-23.70325 51.896574,-4.0017077 65.776525,16.710018 59.587261,45.441005 38.991913,59.208598 17.385609,73.651995 -12.563136,67.187032 -26.895297,45.697847 -41.902187,23.196997 -35.161504,-7.9695799 -12.778456,-22.866268 10.616911,-38.436689 43.001386,-31.420272 58.462563,-8.1433373 74.596552,16.146521 67.304385,49.748954 43.133542,65.774587"
- transform="matrix(-0.15819674,0,0,0.15819674,22.262049,1.7055356)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer5"
- inkscape:label="flèche"
- style="display:inline">
- <path
- style="fill:url(#linearGradient3326);fill-opacity:1;stroke:#1f3157;stroke-width:0.47459021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="M 5.6166617,6.6702162 C 8.5498903,6.3591404 11.366732,6.8627725 14.089084,8.0278339 L 12.323485,12.25995 11.465549,10.2747 C 9.1936105,11.38659 7.6712925,13.621104 6.8096897,16.845097 L 0.57820215,12.334567 C 2.318135,10.026025 5.9650066,8.1110997 8.889601,7.8565979 L 5.6166617,6.6702162 z"
- id="rect3317"
- sodipodi:nodetypes="cccccccc"
- inkscape:connector-curvature="0" />
- <path
- style="fill:url(#linearGradient3371);fill-opacity:1;stroke:none"
- d="M 8.2416433,7.021026 C 9.8257327,6.8500961 11.315051,7.2477939 12.75025,7.9702064 8.920071,9.4835882 6.1923078,11.598289 4.6822166,14.377175 L 1.7555768,12.162421 C 3.6037773,9.8056523 6.570797,8.7541746 9.6654142,7.8515586 L 8.2416433,7.021026 z"
- id="rect3362"
- sodipodi:nodetypes="cccccc"
- inkscape:connector-curvature="0" />
- </g>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/modern/poi.qml b/navit/gui/qt5_qml/skins/modern/poi.qml
deleted file mode 100644
index 36168ecfe..000000000
--- a/navit/gui/qt5_qml/skins/modern/poi.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import com.navit.graphics_qt5 1.0
-
-
-Item {
- id: poiItem
- visible: true
- property var small_font_size : 16
-
-
- Text {
- x: 8
- y: 8
- color: "#ffffff"
- text: backend.activePoi.name
- font.pixelSize: 32
- }
-
- Text {
- x: 80
- y: 64
- color: "#ffffff"
- text: qsTr("Type")
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 80
- y: 96
- color: "#ffffff"
- text: qsTr("Distance")
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 160
- y: 64
- color: "#ffffff"
- text: backend.activePoi.type
- font.pixelSize: small_font_size
- }
-
- Text {
- x: 160
- y: 96
- color: "#ffffff"
- text: backend.activePoi.distance
- font.pixelSize: small_font_size
- }
-
- Rectangle {
- id: rectangle
- x: 8
- y: 64
- height: 64
- width: height
- color: "#ffffff"
- radius: 8
- border.width: 1
- Image {
- height: parent.width
- width: parent.height
- source : backend.get_icon_path() + backend.activePoi.icon
- sourceSize.width: parent.width
- sourceSize.height: parent.height
- }
- }
-
- ColumnLayout {
- id: columnLayout
- width: parent.width/2
- height: parent.height
- anchors.right: parent.right
- anchors.rightMargin: 0
- QNavitQuick {
- id: navit1
- width: 300
- height: 240
- Component.onCompleted: {
- navit1.setGraphicContext(graphics_qt5_context)
- }
- Component.onDestruction: {
- console.log("Destroying a navit widget. Blocking draw operations")
- backend.block_draw()
- }
- }
- }
-
- MainButton {
- id: mainButton3
- x: 8
- y: parent.height-78
- width: parent.width/2 - 16
- height: 64
- radius: 1
- text: "Set as destination"
- icon: "icons/appbar.location.checkin.svg"
- onClicked: {
- backend.setActivePoiAsDestination()
- }
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/pois.qml b/navit/gui/qt5_qml/skins/modern/pois.qml
deleted file mode 100644
index d70ea8b10..000000000
--- a/navit/gui/qt5_qml/skins/modern/pois.qml
+++ /dev/null
@@ -1,128 +0,0 @@
-import QtQuick 2.0
-
-Item {
- id: poiList
- ListView {
- anchors.fill: parent
- id: listView
- model: backend.pois
- delegate: Item {
- height: 64
- width: parent.width;
- Rectangle {
- color: "#1e1b18"
- height: parent.height;
- width: parent.width;
- border.width: 1
-
- Image {
- id: image1
- height: parent.height - 4;
- width: height
-// smooth: true
- source : backend.get_icon_path() + icon
- sourceSize.width: parent.width
- sourceSize.height: parent.height
- }
-
- Text {
- width: 128
- id: distanceText
- text: distance
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: distanceText.right
- anchors.leftMargin: 8
- }
-
- MouseArea {
- id: mouse_area1
- z: 1
- hoverEnabled: false
- anchors.fill: parent
-
- onClicked:{
- listView.currentIndex = index
- backend.setActivePoi(index);
- menucontent.source = "poi.qml"
- }
- }
- }
-
- }
-
- Component.onCompleted: backend.get_pois()
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height * 2
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.up.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listUp
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listUp.pressed
- velocity: 1000
- to: 0
- }
- onReleased: {
- if (!listView.atYBeginning)
- listView.flick(0, 1000)
- }
- }
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.down.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listDown
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listDown.pressed
- to: listView.contentHeight - listView.height
- velocity: 1000
- }
- onReleased: {
- if (!listView.atYEnd)
- listView.flick(0, -1000)
- }
- }
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/search.qml b/navit/gui/qt5_qml/skins/modern/search.qml
deleted file mode 100644
index cc420b87e..000000000
--- a/navit/gui/qt5_qml/skins/modern/search.qml
+++ /dev/null
@@ -1,132 +0,0 @@
-import QtQuick 2.0
-
-Item {
- Rectangle {
- x : 16
- y : 64
- width: parent.width-32
- height: parent.height-64
- id: searchResults
- color: "#35322f"
-
- ListView {
- anchors.fill: parent
- id: listView
- model: backend.searchresults
- delegate: Loader { source: "search_result_item.qml"}
-
- Component.onCompleted: {
- backend.updateSearch("")
- }
-
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height * 2
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.up.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listUp
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listUp.pressed
- velocity: 1000
- to: 0
- }
- onReleased: {
- if (!listView.atYBeginning)
- listView.flick(0, 1000)
- }
- }
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.down.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listDown
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listDown.pressed
- to: listView.contentHeight - listView.height
- velocity: 1000
- }
- onReleased: {
- if (!listView.atYEnd)
- listView.flick(0, -1000)
- }
- }
- }
- }
-
- Rectangle {
- id: rectangle
- x: 16
- y: 16
- width: parent.width-32
- height: 50
- color: "#35322f"
- radius: 3
- border.width: 1
-
- Image {
- id: image
- x: 16
- y: 2
- width: 64
- height: 48
- fillMode: Image.PreserveAspectFit
- source: backend.get_country_icon("")
- }
-
-
- TextEdit {
- id: textEdit
- y: 8
- height: 20
- color: "#ffffff"
- text: qsTr("")
- focus: true
- anchors.rightMargin: 8
- anchors.verticalCenterOffset: 0
- anchors.leftMargin: 8
- horizontalAlignment: Text.AlignLeft
- anchors.verticalCenter: parent.verticalCenter
- anchors.top: parent.top
- anchors.right: parent.right
- anchors.left: image.right
- font.pixelSize: 24
- onTextChanged: {
- backend.updateSearch(textEdit.text)
- }
- }
- }
-
-}
diff --git a/navit/gui/qt5_qml/skins/modern/search_result_item.qml b/navit/gui/qt5_qml/skins/modern/search_result_item.qml
deleted file mode 100644
index 6ba4bb283..000000000
--- a/navit/gui/qt5_qml/skins/modern/search_result_item.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-import QtQuick 2.0
-
-
-Item {
- height: 64
- width: searchResults.width;
- Rectangle {
- color: "#1e1b18"
- height: parent.height;
- width: parent.width;
-
- Image {
- id: image1
- height: 36;
- width: 64
- source : icon
- fillMode: Image.PreserveAspectFit
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- MouseArea {
- id: mouse_area1
- z: 1
- hoverEnabled: false
- anchors.fill: parent
-
- onClicked:{
- listView.currentIndex = index
- backend.searchValidateResult(index)
- // backend.setActivePoi(index);
- // menucontent.source = "poi.qml"
- }
- }
- }
-}
-
diff --git a/navit/gui/qt5_qml/skins/modern/settings.qml b/navit/gui/qt5_qml/skins/modern/settings.qml
deleted file mode 100644
index de7dc36f5..000000000
--- a/navit/gui/qt5_qml/skins/modern/settings.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-
-GridLayout {
- id: gridLayout
- height: 200
- columnSpacing: 4
- rowSpacing: 4
- rows: 3
- columns: 2
-
- MainButton {
- text: "Maps"
- icon: "icons/appbar.layer.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- onClicked: {
- menucontent.source = "maps.qml"
- }
- }
- MainButton {
- text: "Vehicles"
- icon: "icons/appbar.transit.car.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- onClicked: {
- menucontent.source = "vehicles.qml"
- }
- }
- MainButton {
- text: "Display"
- icon: "icons/appbar.fullscreen.box.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-
- MainButton {
- text: "Rules"
- icon: "icons/appbar.cogs.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/vehicle.qml b/navit/gui/qt5_qml/skins/modern/vehicle.qml
deleted file mode 100644
index de425cec8..000000000
--- a/navit/gui/qt5_qml/skins/modern/vehicle.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import QtQuick 2.0
-
-Item {
- Text {
- x: 8
- y: 8
- color: "#ffffff"
- text: backend.currentVehicle.name
- font.pixelSize: 32
- }
-}
diff --git a/navit/gui/qt5_qml/skins/modern/vehicles.qml b/navit/gui/qt5_qml/skins/modern/vehicles.qml
deleted file mode 100644
index b96458b57..000000000
--- a/navit/gui/qt5_qml/skins/modern/vehicles.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-import QtQuick 2.0
-
-ListView {
- id: list
- model: backend.vehicles
- delegate: Item {
- height: 64
- width: parent.width;
- Rectangle {
- color: "#1e1b18"
- height: parent.height;
- width: parent.width;
- border.width: 1
-
- Image {
- id: image1
- height: parent.height - 4;
- source : "icons/appbar.transit.car.svg"
- opacity: active ? 1 : 0.1
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- MouseArea {
- id: mouse_area1
- z: 1
- hoverEnabled: false
- anchors.fill: parent
-
- onClicked:{
- list.currentIndex = index
- backend.setCurrentVehicle(index);
- menucontent.source = "vehicle.qml"
- }
- }
- }
- }
-
- Component.onCompleted: backend.get_vehicles()
-}
diff --git a/navit/gui/qt5_qml/skins/navit.svg b/navit/gui/qt5_qml/skins/navit.svg
deleted file mode 100644
index 591d9ee57..000000000
--- a/navit/gui/qt5_qml/skins/navit.svg
+++ /dev/null
@@ -1,393 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="22"
- height="22"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.48.4 r9939"
- version="1.0"
- sodipodi:docname="navit.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="/home/jeff/projets/navit/navit.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
- <defs
- id="defs4">
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3376">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3378" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3380" />
- </linearGradient>
- <linearGradient
- id="linearGradient3365">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.61904764;"
- offset="0"
- id="stop3367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3369" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3328">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3330" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3332" />
- </linearGradient>
- <linearGradient
- id="linearGradient3320">
- <stop
- style="stop-color:#116cbf;stop-opacity:1;"
- offset="0"
- id="stop3322" />
- <stop
- id="stop3354"
- offset="0.08"
- style="stop-color:#116cbf;stop-opacity:1;" />
- <stop
- id="stop3352"
- offset="0.4893617"
- style="stop-color:#1a6cb6;stop-opacity:1;" />
- <stop
- style="stop-color:#329eff;stop-opacity:1;"
- offset="1"
- id="stop3324" />
- </linearGradient>
- <linearGradient
- id="linearGradient3308">
- <stop
- style="stop-color:#062643;stop-opacity:1;"
- offset="0"
- id="stop3310" />
- <stop
- style="stop-color:#0d5799;stop-opacity:1;"
- offset="1"
- id="stop3312" />
- </linearGradient>
- <linearGradient
- id="linearGradient3235">
- <stop
- style="stop-color:#c17d11;stop-opacity:1;"
- offset="0"
- id="stop3237" />
- <stop
- style="stop-color:#e9cb14;stop-opacity:1;"
- offset="1"
- id="stop3239" />
- </linearGradient>
- <linearGradient
- id="linearGradient3227">
- <stop
- style="stop-color:#76650c;stop-opacity:1;"
- offset="0"
- id="stop3229" />
- <stop
- style="stop-color:#76650c;stop-opacity:0;"
- offset="1"
- id="stop3231" />
- </linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="15.556349 : 133.02972 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3235"
- id="linearGradient3241"
- x1="64"
- y1="115.11359"
- x2="64"
- y2="17.40102"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3308"
- id="linearGradient3314"
- x1="-7.7781754"
- y1="4.2563133"
- x2="43.133514"
- y2="4.2563133"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3320"
- id="linearGradient3326"
- x1="7.6363606"
- y1="87.731171"
- x2="58.391151"
- y2="38.450466"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15669503,0.02174581,-0.02174581,0.15669503,4.357122,0.76802046)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3340"
- gradientUnits="userSpaceOnUse"
- x1="63"
- y1="106.75"
- x2="92"
- y2="29.25" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3328"
- id="linearGradient3342"
- gradientUnits="userSpaceOnUse"
- x1="71"
- y1="69.5"
- x2="87.25"
- y2="33.5" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3365"
- id="linearGradient3371"
- x1="-1.5"
- y1="86.5"
- x2="73.5"
- y2="40"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3376"
- id="linearGradient3382"
- x1="62.147858"
- y1="67.453751"
- x2="11.016594"
- y2="24.242672"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter3424">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.90523025"
- id="feGaussianBlur3426" />
- </filter>
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.894586"
- inkscape:cy="27.303943"
- inkscape:document-units="px"
- inkscape:current-layer="layer2"
- showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="948"
- inkscape:window-x="0"
- inkscape:window-y="24"
- showborder="true"
- inkscape:window-maximized="1" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Calque 1"
- inkscape:groupmode="layer"
- id="layer1"
- style="display:inline">
- <rect
- style="fill:url(#linearGradient3241);fill-opacity:1;stroke:#43350f;stroke-width:0.79098374;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect2403"
- width="18.792814"
- height="15.381022"
- x="2.7210562"
- y="3.1272359"
- rx="1.5819675"
- ry="1.5819675" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="lignes"
- style="display:inline">
- <g
- id="g3336"
- transform="matrix(0.15819674,0,0,0.15819674,5.1568068,0.69315656)">
- <path
- sodipodi:nodetypes="cczzczc"
- id="path3223"
- d="m 92,27 8,-4 c 0,0 -32.803776,29.787015 -21.5,41.25 11.303776,11.462985 5.61873,46.35859 -6,46.25 L 19,110 C 39.916667,101.41667 73.874441,83.136394 61,66.25 48.125559,49.363606 92,27 92,27 z"
- style="fill:url(#linearGradient3340);fill-opacity:1;stroke:none"
- inkscape:connector-curvature="0" />
- <path
- sodipodi:nodetypes="czc"
- id="path3244"
- d="M 49.5,110 C 60.666667,104.16667 83.256846,86.358298 72,70.5 60.743153,54.641702 77.5,38.5 92.5,29"
- style="fill:none;stroke:url(#linearGradient3342);stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:9, 9;stroke-dashoffset:0"
- inkscape:connector-curvature="0" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer4"
- inkscape:label="bulle"
- style="display:none">
- <path
- sodipodi:type="arc"
- style="fill:url(#linearGradient3314);fill-opacity:1;stroke:#1f3157;stroke-width:5.30526352;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- id="path3305"
- sodipodi:cx="17.67767"
- sodipodi:cy="4.2563133"
- sodipodi:rx="25.455845"
- sodipodi:ry="25.455845"
- d="m 43.133514,4.2563133 a 25.455845,25.455845 0 1 1 -50.9116894,0 25.455845,25.455845 0 1 1 50.9116894,0 z"
- transform="matrix(1.3194444,0,0,1.3194444,18.394598,29.399489)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer3"
- inkscape:label="rose des vents"
- style="display:none">
- <g
- id="g3256"
- transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,36.903806,-19.093669)"
- style="opacity:0.5">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3258"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3260"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- <g
- id="g3252">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3248"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3250"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer6"
- inkscape:label="ondes"
- style="display:inline">
- <path
- sodipodi:type="spiral"
- style="fill:none;stroke:url(#linearGradient3382);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3424)"
- id="path3374"
- sodipodi:cx="14.142136"
- sodipodi:cy="19.812662"
- sodipodi:expansion="1"
- sodipodi:revolution="7"
- sodipodi:radius="54.341515"
- sodipodi:argument="-17.841497"
- sodipodi:t0="0"
- d="m 14.142136,19.812662 c 0.622964,0.987625 -1.02395,1.327003 -1.641498,1.035408 -1.673515,-0.790205 -1.44576,-3.111369 -0.429317,-4.318403 1.818177,-2.1591 5.16668,-1.702115 6.995307,0.176773 2.683583,2.757343 1.972982,7.252372 -0.782863,9.672211 C 14.610657,29.603916 8.9345884,28.6291 5.934649,24.989699 2.1595315,20.409885 3.4032379,13.538342 7.9296913,9.9636782 13.411833,5.6342815 21.486273,7.1492634 25.632617,12.56481 30.51894,18.946845 28.731319,28.228517 22.425395,32.944641 15.144955,38.389593 4.6532955,36.328487 -0.63134024,29.131329 -6.6360792,20.95346 -4.300928,9.2499464 3.7880618,3.3976889 12.862686,-3.1676594 25.779376,-0.55807441 32.198606,8.4231809 39.325168,18.394077 36.440869,32.524914 26.567024,39.51063 15.700216,47.198863 0.35449515,44.039641 -7.1973295,33.272958 -15.447588,21.510513 -12.013284,4.9493376 -0.35356778,-3.1683003 12.304301,-11.980865 30.081381,-8.2713528 38.764595,4.2815513 48.13969,17.834674 44.154872,36.828022 30.708654,46.076619 16.260416,56.014427 -3.9494981,51.754222 -13.763319,37.414588 -24.263992,22.071347 -19.728335,0.64462208 -4.4951973,-9.7342896 11.742953,-20.797954 34.386694,-15.98679 45.330585,0.1399218 56.957348,17.272902 51.870631,41.133834 34.850283,52.642608 16.822539,64.832562 -8.2557318,59.470254 -20.329308,41.556217 -33.082529,22.633765 -27.444596,-3.6619713 -8.6368269,-16.300279 11.180283,-29.616836 38.693597,-23.70325 51.896574,-4.0017077 65.776525,16.710018 59.587261,45.441005 38.991913,59.208598 17.385609,73.651995 -12.563136,67.187032 -26.895297,45.697847 -41.902187,23.196997 -35.161504,-7.9695799 -12.778456,-22.866268 10.616911,-38.436689 43.001386,-31.420272 58.462563,-8.1433373 74.596552,16.146521 67.304385,49.748954 43.133542,65.774587"
- transform="matrix(-0.15819674,0,0,0.15819674,22.262049,1.7055356)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer5"
- inkscape:label="flèche"
- style="display:inline">
- <path
- style="fill:url(#linearGradient3326);fill-opacity:1;stroke:#1f3157;stroke-width:0.47459021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="M 5.6166617,6.6702162 C 8.5498903,6.3591404 11.366732,6.8627725 14.089084,8.0278339 L 12.323485,12.25995 11.465549,10.2747 C 9.1936105,11.38659 7.6712925,13.621104 6.8096897,16.845097 L 0.57820215,12.334567 C 2.318135,10.026025 5.9650066,8.1110997 8.889601,7.8565979 L 5.6166617,6.6702162 z"
- id="rect3317"
- sodipodi:nodetypes="cccccccc"
- inkscape:connector-curvature="0" />
- <path
- style="fill:url(#linearGradient3371);fill-opacity:1;stroke:none"
- d="M 8.2416433,7.021026 C 9.8257327,6.8500961 11.315051,7.2477939 12.75025,7.9702064 8.920071,9.4835882 6.1923078,11.598289 4.6822166,14.377175 L 1.7555768,12.162421 C 3.6037773,9.8056523 6.570797,8.7541746 9.6654142,7.8515586 L 8.2416433,7.021026 z"
- id="rect3362"
- sodipodi:nodetypes="cccccc"
- inkscape:connector-curvature="0" />
- </g>
-</svg>
diff --git a/navit/gui/qt5_qml/skins/pois.qml b/navit/gui/qt5_qml/skins/pois.qml
deleted file mode 100644
index bc083e1ed..000000000
--- a/navit/gui/qt5_qml/skins/pois.qml
+++ /dev/null
@@ -1,119 +0,0 @@
-import QtQuick 2.0
-
-Item {
- ListView {
- model: pois
- anchors.fill: parent
- id: listView
- delegate: Rectangle {
- height: 64
- color: "#ff0000"
- radius: 2
- border.width: 1
-
- Image {
- id: image1
- height: parent.height - 4;
- source : model.modelData.active ? "icons/appbar.layer.svg" : "icons/appbar.layer.delete.svg"
- opacity: model.modelData.active ? 1 : 0.4
- }
-
- Text {
- width: 128
- id: distanceText
- text: distance
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: image1.right
- anchors.leftMargin: 8
- }
-
- Text {
- text: name
- color: "#ffffff"
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: distanceText.right
- anchors.leftMargin: 8
- }
-
- MouseArea{
- anchors.fill: parent
- hoverEnabled: true
- onEntered: {
- // backend.list_maps(1)
- }
- }
- }
-
- Component.onCompleted: backend.get_pois()
- }
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height * 2
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.up.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listUp
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listUp.pressed
- velocity: 1000
- to: 0
- }
- onReleased: {
- if (!listView.atYBeginning)
- listView.flick(0, 1000)
- }
- }
- }
-
-
-
- Rectangle {
- height: 64
- width: height
-
- x: parent.width - width
- y: parent.height - height
-
- color: "#35322f"
-
- Image {
- anchors.centerIn: parent
- source: "icons/appbar.chevron.down.svg"
- }
-
- MouseArea {
- anchors.fill: parent
- id: listDown
-
- SmoothedAnimation {
- target: listView
- property: "contentY"
- running: listDown.pressed
- to: listView.contentHeight - listView.height
- velocity: 1000
- }
- onReleased: {
- if (!listView.atYEnd)
- listView.flick(0, -1000)
- }
- }
- }
-
-
-
-}
diff --git a/navit/gui/qt5_qml/skins/settings.qml b/navit/gui/qt5_qml/skins/settings.qml
deleted file mode 100644
index d2a50d764..000000000
--- a/navit/gui/qt5_qml/skins/settings.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-
-GridLayout {
- id: gridLayout
- height: 200
- columnSpacing: 4
- rowSpacing: 4
- rows: 3
- columns: 2
-
- MainButton {
- text: "Maps"
- icon: "icons/appbar.layer.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- onClicked: {
- menucontent.source = "maps.qml"
- }
- }
- MainButton {
- text: "Vehicles"
- icon: "icons/appbar.transit.car.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
- MainButton {
- text: "Display"
- icon: "icons/appbar.fullscreen.box.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-
- MainButton {
- text: "Rules"
- icon: "icons/appbar.cogs.svg"
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-}
diff --git a/navit/gui/win32/CMakeLists.txt b/navit/gui/win32/CMakeLists.txt
deleted file mode 100644
index 16b653c9f..000000000
--- a/navit/gui/win32/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-module_add_library(gui_win32 gui_win32.c win32_gui_destination.c win32_gui_notify.c ceglue.c)
-
diff --git a/navit/gui/win32/ceglue.c b/navit/gui/win32/ceglue.c
deleted file mode 100644
index a0817f935..000000000
--- a/navit/gui/win32/ceglue.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <windows.h>
-#include "ceglue.h"
-
-BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
-
-void InitCeGlue (void)
-{
- HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
- if (ayg != NULL) {
- SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
- GetProcAddressW (ayg, TEXT ("SHFullScreen"));
- }
-}
-
-// code to turn of screen adopted from
-// http://msdn.microsoft.com/en-us/library/ms838354.aspx
-
-// GDI Escapes for ExtEscape()
-#define QUERYESCSUPPORT 8
-
-// The following are unique to CE
-#define GETVFRAMEPHYSICAL 6144
-#define GETVFRAMELEN 6145
-#define DBGDRIVERSTAT 6146
-#define SETPOWERMANAGEMENT 6147
-#define GETPOWERMANAGEMENT 6148
-
-
-typedef enum _VIDEO_POWER_STATE {
- VideoPowerOn = 1,
- VideoPowerStandBy,
- VideoPowerSuspend,
- VideoPowerOff
-} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
-
-
-typedef struct _VIDEO_POWER_MANAGEMENT {
- ULONG Length;
- ULONG DPMSVersion;
- ULONG PowerState;
-} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
-
-
-int CeEnableBacklight(int enable)
-{
- HDC gdc;
- int iESC=SETPOWERMANAGEMENT;
-
- gdc = GetDC(NULL);
- if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
- 0, NULL)==0)
- {
- MessageBox(NULL,
- L"Sorry, your Pocket PC does not support DisplayOff",
- L"Pocket PC Display Off Feature",
- MB_OK);
- ReleaseDC(NULL, gdc);
- return FALSE;
- }
- else
- {
- VIDEO_POWER_MANAGEMENT vpm;
- vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
- vpm.DPMSVersion = 0x0001;
- if (enable) {
- vpm.PowerState = VideoPowerOn;
- } else {
- vpm.PowerState = VideoPowerOff;
- }
- // Power off the display
- ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
- 0, NULL);
- ReleaseDC(NULL, gdc);
- return TRUE;
- }
-}
-
diff --git a/navit/gui/win32/ceglue.h b/navit/gui/win32/ceglue.h
deleted file mode 100644
index b0dc79d42..000000000
--- a/navit/gui/win32/ceglue.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef CEGLUE_H
-#define CEGLUE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state);
-void InitCeGlue (void);
-
-int CeEnableBacklight(int enable);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/gui/win32/gui_win32.c b/navit/gui/win32/gui_win32.c
deleted file mode 100644
index 8a8cb37b9..000000000
--- a/navit/gui/win32/gui_win32.c
+++ /dev/null
@@ -1,643 +0,0 @@
-#include <stdlib.h>
-#include <process.h>
-#include <windows.h>
-#include <glib.h>
-#include "config.h"
-#include "plugin.h"
-#include "gui.h"
-#include "graphics_win32.h"
-#include "point.h"
-#include "menu.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include <commctrl.h>
-#include "debug.h"
-#include "util.h"
-#include "navit.h"
-#include "navit_nls.h"
-#ifdef __CEGCC__
-#include <sipapi.h>
-#include <aygshell.h>
-#include "ceglue.h"
-
-static int ce_backlight = 1;
-static int ce_fullscreen;
-#endif
-
-#ifdef HAVE_GLIB
-//static GHashTable *popup_callback_hash = NULL;
-static GArray *popup_menu_array;
-#endif
-
-const TCHAR g_szClassName[] = TEXT("navit_gui_class");
-
-
-static UINT_PTR menu_id = 0;
-
-#if 0
-static gboolean message_pump( gpointer data )
-{
- MSG messages;
-
- Sleep( 1 );
-
- if (GetMessage (&messages, NULL, 0, 0))
- {
- TranslateMessage(&messages);
- DispatchMessage(&messages);
- }
- else{
- exit( 0 );
- }
- return TRUE;
-}
-
-static BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
-{
- LPRECT rcParent;
- int idChild;
-
- idChild = GetWindowLong(hwndChild, GWL_ID);
-
- if ( idChild == ID_CHILD_GFX )
- {
- rcParent = (LPRECT) lParam;
-
- MoveWindow( hwndChild, 0, 0, rcParent->right, rcParent->bottom, TRUE );
- PostMessage( hwndChild, WM_USER+1, 0, 0 );
- }
-
- return TRUE;
-}
-#endif
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-static void CreateToolBar(HWND hwnd)
-{
- // Create Toolbar
- HWND hTool;
- TBBUTTON tbb[8];
- TBADDBITMAP tbab;
-#if 0 /* def _WIN32_WCE */
- /* Have to initialize common controls under CE */
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
- iccex.dwICC = ICC_BAR_CLASSES;
- InitCommonControlsEx (&iccex);
-#else
- InitCommonControls();
-#endif
-
- hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
- hwnd, (HMENU)ID_CHILD_TOOLBAR, GetModuleHandle(NULL), NULL);
-
- if(hTool == NULL)
- MessageBox(hwnd, TEXT("Could not create tool bar."), TEXT("Error"), MB_OK | MB_ICONERROR);
-
- SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
-
- tbab.hInst = GetModuleHandle(NULL);
- tbab.nID = IDB_NAVITTOOLBAR;
- int iImageOffset = SendMessage(hTool, TB_ADDBITMAP, 10, (LPARAM) &tbab);
-
- int iStr;
-
- ZeroMemory(tbb, sizeof(tbb));
-
- tbb[0].iBitmap = iImageOffset;
- tbb[0].fsState = TBSTATE_ENABLED;
- tbb[0].fsStyle = TBSTYLE_BUTTON;
- tbb[0].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomIn" );
- tbb[0].iString = iStr;
-
- tbb[1].iBitmap = iImageOffset+1;
- tbb[1].fsState = TBSTATE_ENABLED;
- tbb[1].fsStyle = TBSTYLE_BUTTON;
- tbb[1].idCommand = ID_DISPLAY_ZOOMOUT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomOut" );
- tbb[1].iString = iStr;
-
- tbb[2].iBitmap = iImageOffset+4;
- tbb[2].fsState = TBSTATE_ENABLED;
- tbb[2].fsStyle = TBSTYLE_BUTTON;
- tbb[2].idCommand = ID_DISPLAY_REFRESH;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Refresh" );
- tbb[2].iString = iStr;
-
- tbb[3].iBitmap = iImageOffset+2;
- tbb[3].fsState = TBSTATE_ENABLED;
- tbb[3].fsStyle = TBSTYLE_BUTTON;
- tbb[3].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Cursor" );
- tbb[3].iString = iStr;
-
- tbb[4].iBitmap = iImageOffset+5;
- tbb[4].fsState = TBSTATE_ENABLED;
- tbb[4].fsStyle = TBSTYLE_BUTTON;
- tbb[4].idCommand = ID_DISPLAY_ORIENT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Orientation" );
- tbb[4].iString = iStr;
-
- tbb[5].iBitmap = iImageOffset+8;
- tbb[5].fsState = TBSTATE_ENABLED;
- tbb[5].fsStyle = TBSTYLE_BUTTON;
- tbb[5].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Destination" );
- tbb[5].iString = iStr;
-
- tbb[6].iBitmap = iImageOffset+3;
- tbb[6].fsState = TBSTATE_ENABLED;
- tbb[6].fsStyle = TBSTYLE_BUTTON;
- tbb[6].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Roadbook" );
- tbb[6].iString = iStr;
-
- tbb[7].iBitmap = iImageOffset+9;
- tbb[7].fsState = TBSTATE_ENABLED;
- tbb[7].fsStyle = TBSTYLE_BUTTON;
- tbb[7].idCommand = ID_FILE_EXIT;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"_Quit" );
- tbb[7].iString = iStr;
-
- SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
-}
-
-static void window_layout( HWND hwnd )
-{
-#ifndef HAVE_API_WIN32_CE
- RECT rcClient;
- RECT rcTool;
- int iToolHeight;
-
- HWND hChild = GetDlgItem(hwnd, ID_CHILD_TOOLBAR);
- SendMessage(hChild, TB_AUTOSIZE, 0, 0);
-
- GetWindowRect(hChild, &rcTool);
- iToolHeight = rcTool.bottom - rcTool.top;
-
- GetClientRect(hwnd, &rcClient);
- //printf( "BEFORE resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
- rcClient.top += iToolHeight;
-
- dbg(lvl_debug, "resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
-
- hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
- if ( hChild )
- {
- MoveWindow( hChild, rcClient.left, rcClient.top, rcClient.right- rcClient.left, rcClient.bottom - rcClient.top, TRUE );
- PostMessage( hChild, WM_USER+1, 0, 0 );
- }
-#endif
-}
-#ifdef __CEGCC__
-static void toggle_fullscreen(HWND mWnd)
-{
- if (SHFullScreenPtr) {
- if (!ce_fullscreen) {
- (*SHFullScreenPtr)(mWnd, SHFS_HIDETASKBAR |
- SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
- } else {
- (*SHFullScreenPtr)(mWnd, SHFS_HIDESIPBUTTON);
- }
- ce_fullscreen = !ce_fullscreen;
- }
-}
-
-static void toggle_backlight(void)
-{
- if (ce_backlight)
- if (CeEnableBacklight(FALSE))
- ce_backlight = 0;
- else
- if (CeEnableBacklight(TRUE))
- ce_backlight = 1;
-}
-#endif
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
- RECT rcClient;
-
-// printf( "PARENT %d %d %d \n", Message, wParam, lParam );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HMENU hMenu, hSubMenu;
-
- CreateToolBar( hwnd );
-
- hMenu = CreateMenu();
- // g_this_->hwnd = hwnd;
-
- hSubMenu = CreatePopupMenu();
-
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMIN, L"ZoomIn" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMOUT, L"ZoomOut" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh" );
- AppendMenuW(hSubMenu, MF_SEPARATOR, 0, NULL );
- AppendMenuW(hSubMenu, MF_STRING, ID_FILE_EXIT, L"_Quit" );
-
- AppendMenuW(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"Display" );
- hSubMenu = CreatePopupMenu();
- AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, TEXT("&Go"));
- AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, TEXT("&Stuff"));
-
-#ifndef HAVE_API_WIN32_CE
- SetMenu(hwnd, hMenu);
-#endif
-
- window_layout( hwnd );
-
- }
- break;
- case WM_COMMAND:
- {
- printf( "WM_COMMAND %d\n", LOWORD(wParam) );
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
-
- switch(LOWORD(wParam))
- {
- case ID_DISPLAY_ZOOMIN:
- navit_zoom_in(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_ZOOMOUT:
- navit_zoom_out(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_REFRESH:
- navit_draw(gui->nav);
- return 0;
- break;
- case ID_DISPLAY_CURSOR:
- {
- struct attr attr;
- attr.type=attr_cursor;
- // TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(lvl_error, "Failed to set attr_cursor\n");
- }
- return 0;
- }
- break;
- case ID_DISPLAY_ORIENT:
- {
- struct attr attr;
-
- attr.type=attr_orientation;
- // attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- attr.u.num = 0; // TODO
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(lvl_error, "Failed to set attr_orientation\n");
- }
- return 0;
- }
-
- case ID_FILE_EXIT:
- PostMessage(hwnd, WM_CLOSE, 0, 0);
- return 0;
- break;
- }
-#if HAVE_GLIB
- if ( popup_menu_array )
- {
- struct menu_priv* priv = (struct menu_priv*)g_array_index( popup_menu_array, gint, LOWORD(wParam) - POPUP_MENU_OFFSET );
-
- if ( priv )
- {
- struct callback* cb = priv->cb;
- if ( priv->cb )
- {
- callback_call_0( priv->cb );
- return 0;
- }
- }
- }
-#endif
- }
- break;
- case WM_USER+ 1:
- GetClientRect(hwnd, &rcClient);
- printf( "resize gui to: %d %d \n", rcClient.right, rcClient.bottom );
-
- window_layout( hwnd );
- //EnumChildWindows(hwnd, EnumChildProc, (LPARAM) &rcClient);
- return 0;
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_SIZE:
- window_layout( hwnd );
- return 0;
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
-
- case WM_MOUSEWHEEL:
- {
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- short delta = GET_WHEEL_DELTA_WPARAM( wParam );
- if ( delta > 0 )
- {
- navit_zoom_in(gui->nav, 2, NULL);
- }
- else{
- navit_zoom_out(gui->nav, 2, NULL);
- }
- }
- break;
-#ifdef HAVE_API_WIN32_CE
- case WM_KEYDOWN:
- {
- struct point p;
- int w,h;
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
- transform_get_size(navit_get_trans(gui->nav), &w, &h);
-
- if (wParam == VK_LEFT || wParam == '4') {
- p.x=0;
- p.y=h/2;
- navit_set_center_screen(gui->nav, &p, 1);
- } else if (wParam == VK_RIGHT || wParam == '6') {
- p.x=w;
- p.y=h/2;
- navit_set_center_screen(gui->nav, &p, 1);
- } else if (wParam == VK_UP || wParam == '2') {
- p.x=w/2;
- p.y=0;
- navit_set_center_screen(gui->nav, &p, 1);
- } else if (wParam == VK_DOWN || wParam == '8') {
- p.x=w/2;
- p.y=h;
- navit_set_center_screen(gui->nav, &p, 1);
- } else if (wParam == '1') {
- navit_zoom_in(gui->nav, 2, NULL);
- } else if (wParam == '3') {
- navit_zoom_out(gui->nav, 2, NULL);
- } else if (wParam == '7') {
-#if 0
- toggle_backlight();
-#endif
- } else if (wParam == '9') {
-#if 0
- toggle_fullscreen(hwnd);
-#endif
- }
- }
- break;
-#endif
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-static HANDLE CreateWin32Window( void )
-{
-#ifdef HAVE_API_WIN32_CE
- WNDCLASS wc;
-#else
- WNDCLASSEX wc;
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.hIconSm = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-#endif
- HWND hwnd;
-// MSG Msg;
-
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
-#ifdef HAVE_API_WIN32_CE
- if(!RegisterClass(&wc))
-#else
- if(!RegisterClassEx(&wc))
-#endif
-
- {
- MessageBox(NULL, TEXT("Window Registration Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szClassName,
- TEXT( "Navit" ),
-#ifdef HAVE_API_WIN32_CE
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
-
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
-#endif
- NULL, NULL, NULL, NULL);
-
- if(hwnd == NULL)
- {
- MessageBox(NULL, TEXT("Window Creation Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- ShowWindow(hwnd, TRUE);
- UpdateWindow(hwnd);
-
-#if 0
- g_idle_add (message_pump, NULL);
-#endif
-
- return hwnd;
-}
-
-
-static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr");
- *wndHandle_ptr = this_->hwnd;
- graphics_get_data(gra, "START_CLIENT");
- return 0;
-}
-
-
-static void win32_gui_add_bookmark_do(struct gui_priv *gui)
-{
-// navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
-// gtk_widget_destroy(gui->dialog_win);
-}
-
-static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- return 1;
-}
-
-
-static struct menu_methods menu_methods;
-
-
-static struct menu_priv *add_menu( struct menu_priv *menu,
- struct menu_methods *meth,
- char *name,
- enum menu_type type,
- struct callback *cb)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
-
- *ret = *menu;
- *meth = menu_methods;
-
- TCHAR *menuname = newSysString(name);
-
- if ( type == menu_type_submenu )
- {
- HMENU hSubMenu = NULL;
- hSubMenu = CreatePopupMenu();
- AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, menuname );
- ret->hMenu = hSubMenu;
- }
- else
- {
- AppendMenu( menu->hMenu, MF_STRING, menu_id, name );
- }
-
- // g_hash_table_insert( popup_callback_hash, GINT_TO_POINTER( menu_id ), (gpointer)cb );
-#if HAVE_GLIB
- g_array_append_val( popup_menu_array, ret );
-#endif
-
- ret->cb = cb;
-
- menu_id++;
-
- return ret;
-
-}
-
-static void set_toggle(struct menu_priv *menu, int active)
-{
- // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int get_toggle(struct menu_priv *menu)
-{
- // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
- return 0;
-}
-
-static struct menu_methods menu_methods = {
- add_menu,
- set_toggle,
- get_toggle,
-};
-
-static void popup_activate(struct menu_priv *menu)
-{
- POINT pnt;
- GetCursorPos( &pnt );
-
- if (menu->hMenu)
- {
- TrackPopupMenu( menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL );
- DestroyMenu( menu->hMenu );
- }
-}
-
-
-static void popup_deactivate( struct menu_priv *menu )
-{
- DestroyMenu( menu->hMenu );
-}
-
-static struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
- *meth = menu_methods;
-
- menu_id = POPUP_MENU_OFFSET;
-
-#if HAVE_GLIB
- if ( popup_menu_array )
- {
- g_array_free (popup_menu_array, TRUE);
- popup_menu_array = NULL;
- }
-
- popup_menu_array = g_array_new (FALSE, FALSE, sizeof (gint));
-#endif
-
- ret->cb = NULL;
- ret->hMenu = CreatePopupMenu();
- ret->wnd_handle = this_->hwnd;
- meth->popup=popup_activate;
-
-printf( "create popup menu %d \n", ret->hMenu );
-
- return ret;
-}
-
-struct gui_methods win32_gui_methods = {
- NULL, // win32_gui_menubar_new,
- win32_gui_popup_new,
- win32_gui_set_graphics,
- NULL,
- NULL, // win32_gui_datawindow_new,
- win32_gui_add_bookmark,
-};
-
-
-
-static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this_;
-#ifdef HAVE_API_WIN32_CE
- /* Do not run multiple instances under CE */
- HWND prev;
- prev = FindWindow(g_szClassName, NULL);
- if (prev) {
- ShowWindow(prev, SW_RESTORE);
- SetForegroundWindow(prev);
- InvalidateRect (prev, NULL, FALSE);
- exit(0);
- }
- InitCeGlue();
-#endif
-
- *meth=win32_gui_methods;
-
- this_=g_new0(struct gui_priv, 1);
- this_->nav=nav;
-
- this_->hwnd = CreateWin32Window();
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR)this_ );
-
- return this_;
-}
-
-void plugin_init(void)
-{
- plugin_register_category_gui("win32", win32_gui_new);
-}
diff --git a/navit/gui/win32/resources/navit.ico b/navit/gui/win32/resources/navit.ico
deleted file mode 100644
index 6fd707da0..000000000
--- a/navit/gui/win32/resources/navit.ico
+++ /dev/null
Binary files differ
diff --git a/navit/gui/win32/resources/resource.h b/navit/gui/win32/resources/resource.h
deleted file mode 100644
index 55bcc2d73..000000000
--- a/navit/gui/win32/resources/resource.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <windows.h>
-
-#define IDI_NAVIT 1100
-#define IDB_NAVITTOOLBAR 1101
diff --git a/navit/gui/win32/resources/resource.rc b/navit/gui/win32/resources/resource.rc
deleted file mode 100644
index 30374c244..000000000
--- a/navit/gui/win32/resources/resource.rc
+++ /dev/null
@@ -1,16 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-#include "resource.h"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_NAVITTOOLBAR BITMAP DISCARDABLE "toolbar.bmp"
-IDI_NAVIT ICON DISCARDABLE "navit.ico"
-
-HI_RES_AWARE CEUX {1}
diff --git a/navit/gui/win32/resources/toolbar.bmp b/navit/gui/win32/resources/toolbar.bmp
deleted file mode 100644
index 17381d83e..000000000
--- a/navit/gui/win32/resources/toolbar.bmp
+++ /dev/null
Binary files differ
diff --git a/navit/gui/win32/win32_gui_destination.c b/navit/gui/win32/win32_gui_destination.c
deleted file mode 100644
index 115b9058b..000000000
--- a/navit/gui/win32/win32_gui_destination.c
+++ /dev/null
@@ -1,412 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "item.h"
-#include "attr.h"
-#include "navit.h"
-#include "search.h"
-#include "debug.h"
-#include "util.h"
-#include "win32_gui_notify.h"
-#include "resources/resource.h"
-
-static const TCHAR g_szDestinationClassName[] = TEXT("navit_gui_destinationwindow_class");
-
-struct datawindow_priv
-{
- HWND hwnd;
- HWND hwndLabel;
- HWND hwndEdit;
- HWND hwndList;
- HWND hwndButtonPrev;
- HWND hwndButtonNext;
- enum attr_type currentSearchState;
- struct search_list *sl;
- struct navit *nav;
- struct notify_priv *notifications;
-};
-
-static void setlayout(struct datawindow_priv *datawindow)
-{
- LVCOLUMN lvc;
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- RECT winrect;
- GetWindowRect (datawindow->hwndList, &winrect);
-
- lvc.iSubItem = 1;
- lvc.cx = (winrect.right - winrect.left) - 52 ;
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Country"));
- lvc.pszText = TEXT("Country");
- }
- break;
- case attr_town_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Postal or Town"));
- lvc.pszText = TEXT("Town");
- }
- break;
- case attr_street_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Street"));
- lvc.pszText = TEXT("Street");
- }
- break;
- default:
- break;
-
- }
-
- (void)ListView_SetColumn(datawindow->hwndList, 1, &lvc);
-
- Edit_SetText(datawindow->hwndEdit, TEXT(""));
- SetFocus(datawindow->hwndEdit);
-}
-
-static void notify_apply(struct datawindow_priv *datawindow, int index, int param2)
-{
- TCHAR txtBuffer[1024];
- char search_string[1024];
- struct attr search_attr;
- struct search_list_result *res;
-
-
- if ( index >= 0 )
- {
- ListView_GetItemText(datawindow->hwndList, index, 1, txtBuffer, 1024);
-
- TCHAR_TO_UTF8(txtBuffer, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- search_list_search(datawindow->sl, &search_attr, 0);
- res=search_list_get_result(datawindow->sl);
- }
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_street_name;
- }
- break;
- case attr_street_name:
- {
- navit_set_destination(datawindow->nav, res->c, "Mein Test", 1);
- DestroyWindow(datawindow->hwnd);
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-
-}
-
-static void notify_back(struct datawindow_priv *datawindow, int param1, int param2)
-{
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_country_name;
- }
- break;
- case attr_street_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-}
-
-static void notify_textchange(struct datawindow_priv *datawindow, int param1, int param2)
-{
-
- struct attr search_attr;
- struct search_list_result *res;
- char search_string[1024];
- TCHAR converted_iso2[32];
-
-
- int lineLength = Edit_LineLength(datawindow->hwndEdit, 0);
- TCHAR line[lineLength + 1];
- (void)Edit_GetLine(datawindow->hwndEdit, 0, line, lineLength + 1);
- line[lineLength] = 0;
-
-
- (void)ListView_DeleteAllItems( datawindow->hwndList);
-
- TCHAR_TO_UTF8(line, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- if (lineLength<1)
- return;
-
- search_list_search(datawindow->sl, &search_attr, 1);
-
-
- TCHAR *tcharBuffer = NULL;
- int listIndex = 0;
- LVITEM lvI;
-
- lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
- lvI.state = 0;
- lvI.stateMask = 0;
-
- while ((res=search_list_get_result(datawindow->sl)) && listIndex < 50)
- {
-
- switch (search_attr.type)
- {
- case attr_country_name:
- tcharBuffer = newSysString(res->country->name);
- break;
- case attr_town_name:
- tcharBuffer = newSysString(res->town->common.town_name);
- break;
- case attr_street_name:
- if (res->street->name)
- {
- tcharBuffer = newSysString(res->street->name);
- }
- else
- {
- continue;
- }
- break;
- default:
- dbg(lvl_error, "Unhandled search type");
- }
-
- lvI.iItem = listIndex;
- lvI.iImage = listIndex;
- lvI.iSubItem = 0;
- lvI.lParam = (LPARAM) res->country->iso2;
- UTF8_TO_TCHAR(res->country->iso2, converted_iso2);
- lvI.pszText = converted_iso2;//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISP message.
- (void)ListView_InsertItem(datawindow->hwndList, &lvI);
- ListView_SetItemText(datawindow->hwndList, listIndex, 1, tcharBuffer);
- g_free(tcharBuffer);
- dbg(lvl_debug,"%s\n", res->country->name);
- listIndex++;
- }
-}
-
-static void notify_destroy(struct datawindow_priv *datawindow, int param1, int param2)
-{
- if ( datawindow )
- {
- search_list_destroy(datawindow->sl);
- g_free(datawindow);
- }
-}
-
-static void notify_size(struct datawindow_priv *datawindow, int width, int height)
-{
- if (datawindow)
- {
- MoveWindow(datawindow->hwndLabel,
- 0, 0, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndEdit,
- 0, 20, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndList,
- 0, 40, // starting x- and y-coordinates
- width, // width of client area
- height - 60, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonPrev,
- 0, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonNext,
- width/2, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
-
- setlayout(datawindow);
-
- }
-}
-
-static BOOL init_lv_columns(HWND hWndListView)
-{
-
-// struct LVCOLUMN lvc = {LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
-// LVCFMT_LEFT, 100, szText[iCol], 0, iCol, 0, 0 };
-
- TCHAR szText[][8] = {TEXT("Iso"),TEXT("Country")}; // temporary buffer
- LVCOLUMN lvc;
- int iCol;
-
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- for (iCol = 0; iCol < 2; iCol++)
- {
- lvc.iSubItem = iCol;
- lvc.pszText = szText[iCol];
- lvc.cx = 50; // width of column in pixels
-
- if ( iCol < 2 )
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
- else
- lvc.fmt = LVCFMT_RIGHT; // right-aligned column
-
- if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL register_destination_window()
-{
- WNDCLASS wc;
-
- wc.style = 0;
- wc.lpfnWndProc = message_handler;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szDestinationClassName;
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if (!RegisterClass(&wc))
- {
- dbg(lvl_error, "Window Registration Failed!\n");
- return FALSE;
- }
- return TRUE;
-}
-
-HANDLE create_destination_window( struct navit *nav )
-{
-
-
- struct datawindow_priv *this_;
-
- this_=g_new0(struct datawindow_priv, 1);
- this_->nav = nav;
- this_->currentSearchState = attr_country_name;
- this_->sl=search_list_new(navit_get_mapset(this_->nav));
-
- this_->hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szDestinationClassName,
- TEXT("Destination Input"),
-#if defined(__CEGCC__)
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
-#endif
- NULL, NULL, NULL, NULL);
-
- if (this_->hwnd == NULL)
- {
- dbg(lvl_error, "Window Creation Failed!\n");
- return 0;
- }
-
- this_->notifications = win32_gui_notify_new(this_);
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_->notifications );
-
- this_->hwndLabel = CreateWindow(WC_STATIC, // predefined class
- TEXT("Country"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndEdit = CreateWindow(WC_EDIT, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndList = CreateWindow(WC_LISTVIEW, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndButtonPrev = CreateWindow(WC_BUTTON, // predefined class
- TEXT("<<"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
- this_->hwndButtonNext = CreateWindow(WC_BUTTON, // predefined class
- TEXT(">>"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-#ifdef LVS_EX_FULLROWSELECT
- (void)ListView_SetExtendedListViewStyle(this_->hwndList,LVS_EX_FULLROWSELECT);
-#endif
-
-
- win32_gui_notify( this_->notifications, this_->hwndEdit, CHANGE, notify_textchange);
- win32_gui_notify( this_->notifications, NULL, WINDOW_SIZE, notify_size);
- win32_gui_notify( this_->notifications, this_->hwndList, DBLCLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwnd, WINDOW_DESTROY, notify_destroy);
-
- win32_gui_notify( this_->notifications, this_->hwndButtonNext, BUTTON_CLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwndButtonPrev, BUTTON_CLICK, notify_back);
-
- init_lv_columns(this_->hwndList);
- SetFocus(this_->hwndEdit);
- ShowWindow(this_->hwnd, TRUE);
- UpdateWindow(this_->hwnd);
-
- return this_->hwnd;
-}
-
diff --git a/navit/gui/win32/win32_gui_notify.c b/navit/gui/win32/win32_gui_notify.c
deleted file mode 100644
index c801e9da8..000000000
--- a/navit/gui/win32/win32_gui_notify.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "win32_gui_notify.h"
-
-struct window_data
-{
- HWND hwnd;
- UINT message;
- void(*func)(struct datawindow_priv *parent, int param1, int param2);
-};
-
-struct notify_priv
-{
- GList *window_list;
- struct datawindow_priv *parent;
-
-};
-
-
-void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2))
-{
- struct window_data *wnd_data = g_new( struct window_data,1);
-
- wnd_data->hwnd = hwnd;
- wnd_data->message = message_id;
- wnd_data->func = func;
-
- notify->window_list = g_list_append( notify->window_list, (gpointer) wnd_data );
-
-}
-
-struct notify_priv* win32_gui_notify_new(struct datawindow_priv *parent)
-{
- struct notify_priv* notify = g_new0(struct notify_priv,1);
- notify->parent = parent;
- return notify;
-}
-
-LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam)
-{
- enum message_id message = INVALID;
- int param1 = -1;
- int param2 = -1;
- HWND hwndDlg = hwnd;
-
- switch (win_message)
- {
- case WM_CREATE:
- {
- message = WINDOW_CREATE;
- }
- break;
- case WM_SIZE:
- {
- message = WINDOW_SIZE;
- param1 = LOWORD(lParam);
- param2 = HIWORD(lParam);
- }
- break;
- case WM_DESTROY:
- {
- message = WINDOW_DESTROY;
- }
- break;
- case WM_NOTIFY:
- {
- hwndDlg = (((LPNMHDR)lParam)->hwndFrom);
- switch (((LPNMHDR)lParam)->code)
- {
- case NM_DBLCLK:
- {
- message = DBLCLICK;
-#ifdef LPNMITEMACTIVATE
- param1 = ((LPNMITEMACTIVATE)lParam)->iItem;
-#endif
- }
- break;
- case NM_CLICK:
- message = CLICK;
- break;
- }
- }
- break;
- case WM_COMMAND:
- {
- hwndDlg = (HWND)lParam;
-
- switch (HIWORD(wParam))
- {
- case EN_CHANGE:
- {
- message = CHANGE;
- }
- break;
- case BN_CLICKED:
- {
- message = BUTTON_CLICK;
- }
- break;
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, win_message, wParam, lParam);
- }
-
- struct notify_priv* notify_data = (struct notify_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- if ( message != INVALID && notify_data && notify_data->window_list )
- {
-
- GList* current_element = g_list_first(notify_data->window_list);
-
-
- struct window_data* wnd_data = NULL;
- while (current_element != NULL)
- {
- wnd_data = current_element->data;
-
- if ( (wnd_data->hwnd == hwndDlg || wnd_data->hwnd == NULL) && message == wnd_data->message)
- {
- wnd_data->func(notify_data->parent, param1, param2);
- }
-
- current_element = g_list_next(current_element);
- }
- }
- return FALSE;
-}
diff --git a/navit/gui/win32/win32_gui_notify.h b/navit/gui/win32/win32_gui_notify.h
deleted file mode 100644
index 7c791e15b..000000000
--- a/navit/gui/win32/win32_gui_notify.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-enum message_id
-{
- WINDOW_CREATE,
- WINDOW_SIZE,
- WINDOW_DESTROY,
- DBLCLICK,
- CLICK,
- CHANGE,
- BUTTON_CLICK,
- INVALID
-
-};
-
-struct datawindow_priv;
-struct notify_priv* win32_gui_notify_new();
-void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2));
-LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam);