From e66b1be7b9c9e7404c9b723ddb8cd5a1a26cc8ad Mon Sep 17 00:00:00 2001 From: mdankov Date: Sat, 6 Apr 2013 21:19:46 +0000 Subject: Add:gui_internatl:In town and street search dialogs, select default keyboard based on the country selected, not on interface language. Expand Cyrillic country list. git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5429 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/gui/internal/gui_internal_bookmark.c | 7 ++++--- navit/gui/internal/gui_internal_command.c | 2 +- navit/gui/internal/gui_internal_html.c | 2 +- navit/gui/internal/gui_internal_keyboard.c | 25 +++++++++++++++++-------- navit/gui/internal/gui_internal_keyboard.h | 2 +- navit/gui/internal/gui_internal_poi.c | 2 +- navit/gui/internal/gui_internal_search.c | 3 ++- 7 files changed, 27 insertions(+), 16 deletions(-) (limited to 'navit/gui/internal') diff --git a/navit/gui/internal/gui_internal_bookmark.c b/navit/gui/internal/gui_internal_bookmark.c index 4479c6d5a..26d338f96 100644 --- a/navit/gui/internal/gui_internal_bookmark.c +++ b/navit/gui/internal/gui_internal_bookmark.c @@ -1,4 +1,5 @@ #include +#include #include "color.h" #include "coord.h" #include "point.h" @@ -102,7 +103,7 @@ gui_internal_cmd_add_bookmark2(struct gui_priv *this, struct widget *wm, void *d 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,2+gui_internal_keyboard_init_mode())); + gui_internal_widget_append(w, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); } @@ -130,7 +131,7 @@ gui_internal_cmd_add_bookmark_folder2(struct gui_priv *this, struct widget *wm, 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,2+gui_internal_keyboard_init_mode())); + gui_internal_widget_append(w, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); } @@ -159,7 +160,7 @@ gui_internal_cmd_rename_bookmark(struct gui_priv *this, struct widget *wm, void 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,2+gui_internal_keyboard_init_mode())); + gui_internal_widget_append(w, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); } diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 0d168ea0b..7ac90ea37 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -827,7 +827,7 @@ gui_internal_cmd_log(struct gui_priv *this) 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,2+gui_internal_keyboard_init_mode())); + gui_internal_widget_append(w, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); gui_internal_leave(this); } diff --git a/navit/gui/internal/gui_internal_html.c b/navit/gui/internal/gui_internal_html.c index 161bc8a6c..865b80a49 100644 --- a/navit/gui/internal/gui_internal_html.c +++ b/navit/gui/internal/gui_internal_html.c @@ -486,7 +486,7 @@ gui_internal_html_menu(struct gui_priv *this, const char *document, char *anchor g_free(doc); if (this->keyboard_required && this->keyboard) { this->html_container->flags=gravity_center|orientation_vertical|flags_expand|flags_fill; - gui_internal_widget_append(this->html_container, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode())); + gui_internal_widget_append(this->html_container, gui_internal_keyboard(this,2+gui_internal_keyboard_init_mode(getenv("LANG")))); } gui_internal_menu_render(this); graphics_draw_mode(this->gra, draw_mode_end); diff --git a/navit/gui/internal/gui_internal_keyboard.c b/navit/gui/internal/gui_internal_keyboard.c index 0d0262fc7..f04ff9760 100644 --- a/navit/gui/internal/gui_internal_keyboard.c +++ b/navit/gui/internal/gui_internal_keyboard.c @@ -330,22 +330,31 @@ gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *da gui_internal_keyboard_do(this, key->data, key->datai); } int -gui_internal_keyboard_init_mode(void) +gui_internal_keyboard_init_mode(char *lang) { -/* - Set cyrillic keyboard for Russia, Ukraine, Belarus, Kazakhstan -*/ - int ret; - char *lang; - lang=getenv("LANG"); - ret=0; + int ret=0; + /* + * Set cyrillic keyboard for countries using Cyrillic alphabet + */ if (strstr(lang,"RU")) ret = 40; if (strstr(lang,"UA")) ret = 40; if (strstr(lang,"BY")) ret = 40; + if (strstr(lang,"RS")) + ret = 40; + if (strstr(lang,"BG")) + ret = 40; + if (strstr(lang,"MK")) + ret = 40; if (strstr(lang,"KZ")) ret = 40; + if (strstr(lang,"KG")) + ret = 40; + if (strstr(lang,"TJ")) + ret = 40; + if (strstr(lang,"MN")) + ret = 40; return ret; } diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h index 0e2fe90cd..83c347a13 100644 --- a/navit/gui/internal/gui_internal_keyboard.h +++ b/navit/gui/internal/gui_internal_keyboard.h @@ -3,5 +3,5 @@ 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); -int gui_internal_keyboard_init_mode(void); +int gui_internal_keyboard_init_mode(char *lang); /* end of prototypes */ diff --git a/navit/gui/internal/gui_internal_poi.c b/navit/gui/internal/gui_internal_poi.c index b69f8a0cf..99ad196f8 100644 --- a/navit/gui/internal/gui_internal_poi.c +++ b/navit/gui/internal/gui_internal_poi.c @@ -484,7 +484,7 @@ gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *dat { struct widget *wb, *w, *wr, *wk, *we; int keyboard_mode; - keyboard_mode=2+gui_internal_keyboard_init_mode(); + keyboard_mode=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); diff --git a/navit/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c index 784927934..a066a59fa 100644 --- a/navit/gui/internal/gui_internal_search.c +++ b/navit/gui/internal/gui_internal_search.c @@ -1,4 +1,5 @@ #include +#include #include "config.h" #include "color.h" #include "coord.h" @@ -479,8 +480,8 @@ gui_internal_search(struct gui_priv *this, char *what, char *type, int flags) struct widget *wb,*wk,*w,*wr,*we,*wl,*wnext=NULL; char *country; int keyboard_mode; - keyboard_mode=2+gui_internal_keyboard_init_mode(); gui_internal_search_list_new(this); + keyboard_mode=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); -- cgit v1.2.1