diff options
author | mvglasow <michael -at- vonglasow.com> | 2015-11-13 17:37:08 +0100 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2015-11-13 17:37:08 +0100 |
commit | def7757f79478e333f4f4119b80996f6e7e597cf (patch) | |
tree | e27d3f454d39788cf62195eb30cf7be079ee5e2c /navit/gui/internal | |
parent | e661dd1a8949e7072a11399a265bef3a6cefb185 (diff) | |
download | navit-def7757f79478e333f4f4119b80996f6e7e597cf.tar.gz |
Refactor:gui_internal:Use enum for keyboard modes and flags
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit/gui/internal')
-rw-r--r-- | navit/gui/internal/gui_internal_bookmark.c | 6 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_command.c | 6 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_html.c | 2 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_keyboard.c | 156 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_keyboard.h | 21 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_poi.c | 4 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_search.c | 6 |
7 files changed, 107 insertions, 94 deletions
diff --git a/navit/gui/internal/gui_internal_bookmark.c b/navit/gui/internal/gui_internal_bookmark.c index 20b65d594..21102ba1a 100644 --- a/navit/gui/internal/gui_internal_bookmark.c +++ b/navit/gui/internal/gui_internal_bookmark.c @@ -103,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(getenv("LANG")))); + gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); } @@ -131,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(getenv("LANG")))); + gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_2 | gui_internal_keyboard_init_mode(getenv("LANG")))); gui_internal_menu_render(this); } @@ -160,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(getenv("LANG")))); + gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_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 b7f561a91..03d1e59e5 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -308,8 +308,8 @@ gui_internal_cmd_enter_coord(struct gui_priv *this, char *function, struct attr gui_internal_widget_append(wr,row); if (this->keyboard) - gui_internal_widget_append(w, gui_internal_keyboard(this,56)); - gui_internal_menu_render(this); + gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_DEGREE)); + gui_internal_menu_render(this); } static void @@ -874,7 +874,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(getenv("LANG")))); + gui_internal_widget_append(w, gui_internal_keyboard(this, VKBD_FLAG_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 aef3bdc70..8350dbdcc 100644 --- a/navit/gui/internal/gui_internal_html.c +++ b/navit/gui/internal/gui_internal_html.c @@ -493,7 +493,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(getenv("LANG")))); + gui_internal_widget_append(this->html_container, gui_internal_keyboard(this, VKBD_FLAG_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 509cc5ed4..3e0d1aa33 100644 --- a/navit/gui/internal/gui_internal_keyboard.c +++ b/navit/gui/internal/gui_internal_keyboard.c @@ -16,8 +16,8 @@ /** * @brief Processes a key press on the internal GUI keyboard * - * If the keyboard is currently in uppercase mode, it is then switched to the corresponding lowercase - * mode. + * If the keyboard is currently in uppercase mode and {@code VKBD_MODE_2} is set, it is then switched to + * the corresponding lowercase mode. * * @param this The internal GUI instance * @param wm @@ -30,12 +30,12 @@ gui_internal_cmd_keypress(struct gui_priv *this, struct widget *wm, void *data) gui_internal_keypress_do(this, (char *) wm->data); md=gui_internal_menu_data(this); // Switch to lowercase after the first key is pressed - if (md->keyboard_mode == 2) // Latin - gui_internal_keyboard_do(this, md->keyboard, 10); - if (md->keyboard_mode == 26) // Umlaut - gui_internal_keyboard_do(this, md->keyboard, 34); - if (md->keyboard_mode == 42) // Russian/Ukrainian/Belorussian - gui_internal_keyboard_do(this, md->keyboard, 50); + if (md->keyboard_mode == (VKBD_LATIN_UPPER | VKBD_FLAG_2)) // Latin + gui_internal_keyboard_do(this, md->keyboard, VKBD_LATIN_LOWER | VKBD_FLAG_2); + if (md->keyboard_mode == (VKBD_UMLAUT_UPPER | VKBD_FLAG_2)) // Umlaut + gui_internal_keyboard_do(this, md->keyboard, VKBD_UMLAUT_LOWER | VKBD_FLAG_2); + if (md->keyboard_mode == (VKBD_CYRILLIC_UPPER | VKBD_FLAG_2)) // Russian/Ukrainian/Belorussian + gui_internal_keyboard_do(this, md->keyboard, VKBD_CYRILLIC_LOWER | VKBD_FLAG_2); } static struct widget * @@ -78,14 +78,14 @@ struct gui_internal_keyb_mode { 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*/ {"ABC", 2, 8, 24}, - /* 8*/ {"abc", 2, 0, 32}, - /*16*/ {"123", 2, 0, 24}, - /*24*/ {"ÄÖÜ", 2, 40, 0}, - /*32*/ {"äöü", 2, 32, 8}, - /*40*/ {"АБВ", 2, 48, 0}, - /*48*/ {"абв", 2, 40, 8}, - /*56*/ {"DEG", 2, 2, 2} + /* 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_UPPER, 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} }; @@ -97,7 +97,7 @@ struct gui_internal_keyb_mode { 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&7)+((x)&~7) + -> 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) /** @@ -130,7 +130,7 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) this->current.x=-1; this->current.y=-1; gui_internal_highlight(this); - if (md->keyboard_mode >= 1024) + if (md->keyboard_mode & VKBD_FLAG_1024) render=2; else render=1; @@ -147,55 +147,55 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) 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>=40&&mode<56) { // Russian/Ukrainian/Belarussian layout needs more space... + 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 >= 0 && mode < 8) { + 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 == 0) { + 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+1024; + 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+1024; + wk->datai = mode | VKBD_FLAG_1024; SWCASE(); - MODE(16); + MODE(VKBD_NUMERIC); } UMLAUT(); gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 8 && mode < 16) { + 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 == 8) { + 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+1024; + 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+1024; + wk->datai = mode | VKBD_FLAG_1024; SWCASE(); - MODE(16); + MODE(VKBD_NUMERIC); } UMLAUT(); gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 16 && mode < 24) { + if ((mode & VKBD_LAYOUT_MASK) == VKBD_NUMERIC) { for (i = 0 ; i < 10 ; i++) { char text[]={'0'+i,'\0'}; KEY(text); @@ -205,27 +205,27 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) - if (mode == 16) { + 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+1024; + wk->datai = mode | VKBD_FLAG_1024; SPACER(); SPACER(); } else { SPACER(); - MODE(40); - MODE(48); + 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+1024; - MODE(0); - MODE(8); + 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 >= 24 && mode < 32) { + 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("Ź"); @@ -235,7 +235,7 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 32 && mode < 40) { + 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("ź"); @@ -245,7 +245,7 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 40 && mode < 48) { + 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("Ъ"); @@ -254,17 +254,17 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) 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+1024; + wk->datai = mode | VKBD_FLAG_1024; SWCASE(); - MODE(16); + MODE(VKBD_NUMERIC); SPACER(); gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 48 && mode < 56) { + 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("ъ"); @@ -273,11 +273,11 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) 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+1024; + wk->datai = mode | VKBD_FLAG_1024; SWCASE(); - MODE(16); + MODE(VKBD_NUMERIC); SPACER(); @@ -287,10 +287,10 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) 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<1024; + td->scroll_buttons.button_box_hide = !(mode & VKBD_FLAG_1024); } - if (mode >= 56 && mode < 64) { /* special case for coordinates input screen (enter_coord) */ + 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("'"); @@ -298,17 +298,17 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) SPACER(); wk=gui_internal_keyboard_key_data(this, wkbd, hide, 0, gui_internal_keyboard_change, wkbdb, NULL,max_w,max_h); - wk->datai=mode+1024; + wk->datai = mode | VKBD_FLAG_1024; SPACER(); gui_internal_keyboard_key(this, wkbd, backspace,"\b",max_w,max_h); } - if (mode >= 1024) { + if (mode & VKBD_FLAG_1024) { char *text=NULL; int font=0; struct widget *wkl; - mode -= 1024; + 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); @@ -352,20 +352,11 @@ gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode) * * 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: - * <ul> - * <li>0: ABC (Latin uppercase)</li> - * <li>8: abc (Latin lowercase)</li> - * <li>16: 123 (Numeric)</li> - * <li>24: ÄÖÜ (Umlaut uppercase)</li> - * <li>32: äöü (Umlaut lowercase)</li> - * <li>40: АБВ (Cyrillic uppercase)</li> - * <li>48: абв (Cyrillic lowercase)</li> - * <li>56: DEG (Coordinate input: 0–9, decimal dot, NESW, degree/minute signs)</li> - * </ul> + * 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, see description + * @param mode The mode for the keyboard * * @return A new keyboard widget */ @@ -391,7 +382,8 @@ gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *da * * @param lang The two-letter country code * - * @return 40 (АБВ) for countries using the Cyrillic alphabet, 0 (ABC) otherwise + * @return {@code VKBD_CYRILLIC_UPPER} for countries using the Cyrillic alphabet, + * {@code VKBD_LATIN_UPPER} otherwise */ int gui_internal_keyboard_init_mode(char *lang) @@ -403,25 +395,25 @@ gui_internal_keyboard_init_mode(char *lang) * 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; + 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; } diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h index 83c347a13..09a4573ff 100644 --- a/navit/gui/internal/gui_internal_keyboard.h +++ b/navit/gui/internal/gui_internal_keyboard.h @@ -1,3 +1,24 @@ +/** + * 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; diff --git a/navit/gui/internal/gui_internal_poi.c b/navit/gui/internal/gui_internal_poi.c index 39ef362a0..c3eed5e60 100644 --- a/navit/gui/internal/gui_internal_poi.c +++ b/navit/gui/internal/gui_internal_poi.c @@ -499,7 +499,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(getenv("LANG")); + 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); @@ -532,7 +532,7 @@ gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *dat wb->data=wk; if (this->keyboard) - gui_internal_widget_append(w, gui_internal_keyboard(this,keyboard_mode)); + gui_internal_widget_append(w, gui_internal_keyboard(this, keyboard_mode)); gui_internal_menu_render(this); diff --git a/navit/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c index 76be35718..7a0f4869b 100644 --- a/navit/gui/internal/gui_internal_search.c +++ b/navit/gui/internal/gui_internal_search.c @@ -502,7 +502,7 @@ gui_internal_search(struct gui_priv *this, const char *what, const char *type, i char *country; int keyboard_mode; gui_internal_search_list_new(this); - keyboard_mode=2+gui_internal_keyboard_init_mode(this->country_iso2?this->country_iso2:getenv("LANG")); + 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); @@ -543,7 +543,7 @@ gui_internal_search(struct gui_priv *this, const char *what, const char *type, i 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=18; + keyboard_mode = VKBD_NUMERIC | VKBD_FLAG_2; } gui_internal_widget_append(we, wk=gui_internal_label_new(this, NULL)); if (wnext) { @@ -559,7 +559,7 @@ gui_internal_search(struct gui_priv *this, const char *what, const char *type, i 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)); + gui_internal_widget_append(w, gui_internal_keyboard(this, keyboard_mode)); gui_internal_menu_render(this); } |