DictionaryMain.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:85k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * DictionaryMain.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for Dictionary UI implementation
- *
- * Author:
- * Rajbir Singh
- * -------
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include "MMI_features.h"
- #if defined(__MMI_DICTIONARY__)
- #if defined(MMI_ON_HARDWARE_P) /* Not support in PC Simulator */
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "GlobalConstants.h"
- #include "DebugInitDef.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "HistoryGprot.h"
- #include "Unicodexdcl.h"
- #include "GlobalDefs.h"
- #include "CommonScreens.h"
- #include "SettingProfile.h"
- #include "DictionaryMain.h"
- #if defined(__MMI_DICT_GV__)
- #include "DictionaryCoreGV.h"
- #elif defined(__MMI_DICT_MOTECH__ )
- #include "DictionaryCoreMOTECH.h"
- #elif defined(__MMI_DICT_TRILOGY__ )
- #include "DictionaryCoreTRILOGY.h"
- #endif
- /*
- * Local Variable
- */
- pBOOL g_dictionary_last_item = FALSE;
- U8 g_mmi_dictionary_prev_input_mode;
- S32 g_dictionary_prev_index;
- S32 g_dictionary_highlighted_item;
- #if defined(__MMI_DICT_GV__) || defined(__MMI_DICT_MOTECH__)
- U8 g_dictionary_result_buffer[(1024) * 7]; /* result buffer that contains all data to show to user */
- #elif defined(__MMI_DICT_TRILOGY__)
- U8 g_dictionary_result_buffer[(1024) * 3]; /* result buffer that contains all data to show to user */
- #endif
- U8 g_dictionary_input_buffer[(DICTIONARY_INPUT_LENGTH + 1) * ENCODING_LENGTH]; /* Input buffer on main dictionary screen */
- U8 g_dictionary_wildcard_exact_buffer[(DICTIONARY_INPUT_LENGTH + 1) * ENCODING_LENGTH]; /* input buffer for wildcard,exact and chinese string search */
- U8 g_dictionary_input[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- U8 g_dictionary_last_word[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- U8 g_dictionary_first_displayed_buffer[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- mmi_dictionary_search_type g_dictionary_search_type; /* Search enum : can be Browse, Exact, Wildcard search */
- mmi_dictionary_cntx g_dictionary_cntx; /* context stucture to hold various global flags */
- S16 *g_dictionary_input_mode; /* Input mode for dictionary screen */
- S16 g_dictionary_input_mode_Chinese_set[] =
- {
- INPUT_MODE_MULTITAP_UPPERCASE_ABC,
- INPUT_MODE_MULTITAP_LOWERCASE_ABC,
- INPUT_MODE_TR_MULTITAP_BOPOMO,
- INPUT_MODE_SM_MULTITAP_PINYIN,
- #if !defined(__MMI_TOUCH_SCREEN__)
- INPUT_MODE_TR_BOPOMO,
- INPUT_MODE_SM_PINYIN,
- INPUT_MODE_TR_STROKE,
- INPUT_MODE_SM_STROKE,
- #endif /* !defined(__MMI_TOUCH_SCREEN__) */
- -1
- };
- /*
- * Global Variable
- */
- extern pBOOL GetUCS2Flag(PS8);
- extern U8 MMI_current_input_mode; /* Global variable to get the input method */
- extern U8 wgui_multiline_inputbox_input_type;
- /* Adaptation layer structures */
- mmi_dict_id_str_struct g_dict_wildcard_ids[MMI_DICT_ID_FETCH_MAX + 1], ID,
- g_dict_chinese_ids[MMI_DICT_ID_FETCH_MAX + 1];
- mmi_dict_result_struct g_dict_fetchresult;
- MMI_DICTIONARY_LANGUAGE g_dict_current_language, g_dictionary_language_main_screen;
- /*
- * Global Function
- */
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_init
- * DESCRIPTION
- * Initialize Dictionary database. Set highlight handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetHiliteHandler(EXTRA_DICTIONARY_MENU, mmi_dictionary_main_menu_highlight_hdlr);
- SetHiliteHandler(DICTIONARY_OPTION_SHOW_MEANING_MENU, mmi_dictionary_show_meaning_highlight_hdlr);
- #ifdef __MMI_DICTIONARY_WILDCARD_SEARCH__
- SetHiliteHandler(DICTIONARY_OPTION_WILDCARD_SEARCH_MENU, mmi_dictionary_wildcard_highlight_hdlr);
- #endif
- SetHiliteHandler(DICTIONARY_OPTION_EXACT_SEARCH_MENU, mmi_dictionary_exact_highlight_hdlr);
- #ifndef __MMI_DICTIONARY_SMALL_SCREEN__
- SetHiliteHandler(DICTIONARY_OPTION_INPUT_METHOD, mmi_dictionary_input_method_highlight_hdlr);
- #endif
- SetHiliteHandler(DICTIONARY_EDITOR_OPTION_SEARCH_MENU, mmi_dictionary_editor_option_search_highlight_hdlr);
- SetHiliteHandler(
- DICTIONARY_EDITOR_OPTION_INPUT_METHOD_MENU,
- mmi_dictionary_editor_option_input_method_highlight_hdlr);
- /* Assign input mode for the dictionary */
- g_dictionary_input_mode = g_dictionary_input_mode_Chinese_set;
- }
- /*
- * Local Function
- */
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_main_menu_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the Dictionary menu in Extra menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_main_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_welcome_screen, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_welcome_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_show_meaning_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the Show Meaning in Dictionary option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_show_meaning_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- g_dictionary_search_type = DICTIONARY_BROWSE;
- #ifdef __MMI_DICTIONARY_SMALL_SCREEN__
- g_dict_current_language = DICTIONARY_ENGLISH;
- #else
- g_dict_current_language = g_dictionary_language_main_screen;
- #endif
- SetLeftSoftkeyFunction(mmi_dictionary_entry_result_screen, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_result_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_wildcard_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the Wildcard Search menu in Dictionary option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_wildcard_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- g_dictionary_search_type = DICTIONARY_WILDCARD_SEARCH;
- memset(g_dictionary_wildcard_exact_buffer, 0, ENCODING_LENGTH);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_wildcard_exact_editor_screen, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_wildcard_exact_editor_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_exact_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the Exact Search menu in Dictionary option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_exact_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- g_dictionary_search_type = DICTIONARY_EXACT_SEARCH;
- memset(g_dictionary_wildcard_exact_buffer, 0, ENCODING_LENGTH);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_wildcard_exact_editor_screen, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_wildcard_exact_editor_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_input_method_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the input method menu in Dictionary option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_input_method_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(EntryAPRequiredInputMethodScreen, KEY_EVENT_UP);
- SetKeyHandler(EntryAPRequiredInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- RegisterInputMethodScreenCloseFunction(DictionaryGoBackMainScreen);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_editor_option_search_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the search menu in Dictionary editor option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_editor_option_search_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_search, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_search, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_editor_option_input_method_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the input method menu in Dictionary option menu list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_editor_option_input_method_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(EntryAPRequiredInputMethodScreen, KEY_EVENT_UP);
- SetKeyHandler(EntryAPRequiredInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- RegisterInputMethodScreenCloseFunction(DictionaryGoBackEditorScreen);
- }
- /*****************************************************************************
- * FUNCTION
- * DictionaryGoBackMainScreen
- * DESCRIPTION
- * Go back to Main dictionary screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DictionaryGoBackMainScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBackToHistory(SCR_DICTIONARY_MAIN);
- }
- /*****************************************************************************
- * FUNCTION
- * DictionaryGoBackEditorScreen
- * DESCRIPTION
- * Go back to dictionary editor screen(exact/wildcard).
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DictionaryGoBackEditorScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBackToHistory(SCR_DICTIONARY_WILDCARD_EXACT_EDITOR);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_welcome_screen
- * DESCRIPTION
- * Welcome screen, when user enter first time in this screen,a customer logo is shown.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_welcome_screen(void)
- {
- #ifdef __MMI_DICTIONARY_WELCOME_SCREEN__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_WELCOME_SCREEN);
- EntryNewScreen(SCR_DICTIONARY_WELCOME_SCREEN, NULL, mmi_dictionary_entry_welcome_screen, NULL);
- ShowCategory129Screen(
- (U8*) get_string(STR_DICTIONARY_TITLE),
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- IMG_DICTIONARY_LOGO,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_dictionary_pre_entry_main_screen, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- #else /* __MMI_DICTIONARY_WELCOME_SCREEN__ */
- mmi_dictionary_pre_entry_main_screen();
- #endif /* __MMI_DICTIONARY_WELCOME_SCREEN__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_pre_entry_main_screen
- * DESCRIPTION
- * initialize dictionary database
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_pre_entry_main_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL dictResult;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dictResult = mmi_dict_init();
- if (dictResult == FALSE)
- {
- PRINT_INFORMATION(("---[DictionaryMain.c] Failed to initialize Dictionary n"));
- return;
- }
- mmi_dictionary_entry_main_screen();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_main_screen
- * DESCRIPTION
- * Entry function for main dictionary screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_main_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 cnt;
- MMI_DICTIONARY_LANGUAGE currentLanguage;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dictionary_search_type = DICTIONARY_BROWSE;
- g_dict_current_language = g_dictionary_language_main_screen;
- g_dictionary_prev_index = -1;
- EntryNewScreen(SCR_DICTIONARY_MAIN, mmi_dictionary_exit_main_screen, mmi_dictionary_entry_main_screen, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_MAIN);
- RegisterCat200SearchFunction(mmi_dictionary_find_entry);
- RegisterHighlightHandler(mmi_dictionary_word_hdlr);
- if (guiBuffer == NULL)
- {
- memset(g_dict_chinese_ids, 0, sizeof(mmi_dict_id_str_struct) * (MMI_DICT_ID_FETCH_MAX + 1));
- g_dictionary_cntx.current_selected_index = 0;
- wgui_multiline_inputbox_input_type = 0;
- /* Default language is English for first time entry */
- g_dict_current_language = DICTIONARY_ENGLISH;
- memset(g_dictionary_input_buffer, 0, ENCODING_LENGTH);
- if (g_dict_current_language == DICTIONARY_ENGLISH)
- {
- AnsiiToUnicodeString((S8*) g_dictionary_input, (S8*) "a");
- cnt = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.total_browse_entry = (S32) mmi_dict_get_total_num((PS8) g_dictionary_input);
- g_dictionary_cntx.starting_index = cnt;
- }
- else if (g_dict_current_language == DICTIONARY_CHINESE)
- {
- g_dictionary_cntx.total_browse_entry = 0;
- g_dictionary_cntx.starting_index = 0;
- }
- ClearKeyHandler(KEY_UP_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- memset(g_dictionary_last_word, 0, ENCODING_LENGTH);
- /*
- * Previous input method is just set to any member of previous family. Here Family is important to know.
- * the assigned mode can be any mode from a family
- */
- switch (g_dict_current_language)
- {
- case DICTIONARY_ENGLISH:
- g_mmi_dictionary_prev_input_mode = INPUT_MODE_MULTITAP_LOWERCASE_ABC;
- break;
- case DICTIONARY_CHINESE:
- g_mmi_dictionary_prev_input_mode = INPUT_MODE_TR_MULTITAP_BOPOMO;
- break;
- default:
- g_mmi_dictionary_prev_input_mode = INPUT_MODE_MULTITAP_LOWERCASE_ABC;
- }
- /*
- * wgui_multiline_inputbox_input_type =0 means set to none.
- * wgui_multiline_inputbox_input_type is set when input method is changed from "input method" option.
- */
- if (wgui_multiline_inputbox_input_type != 0)
- {
- currentLanguage = mmi_dictionary_check_input_family((U8) wgui_multiline_inputbox_input_type);
- if (currentLanguage != g_dict_current_language)
- {
- switch (currentLanguage)
- {
- case DICTIONARY_ENGLISH:
- AnsiiToUnicodeString((S8*) g_dictionary_input, (S8*) "a");
- cnt = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.total_browse_entry = (S32) mmi_dict_get_total_num((PS8) g_dictionary_input);
- g_dictionary_cntx.starting_index = cnt;
- break;
- case DICTIONARY_CHINESE:
- g_dictionary_cntx.total_browse_entry = 0;
- g_dictionary_cntx.starting_index = 0;
- break;
- default:
- g_dictionary_cntx.total_browse_entry = 0;
- g_dictionary_cntx.starting_index = 0;
- }
- }
- }
- }
- #ifdef __MMI_UI_HINTS_IN_MENUITEM__
- set_force_icon_on_highlight_only_in_menuitem();
- #endif
- Register_pound_key_buffer_flush_test_function(mmi_dictionary_flush_editor_buffer);
- Register_appl_present_function(isFromDictionary);
- #ifdef __MMI_DICTIONARY_SMALL_SCREEN__
- ShowCategory200Screen(
- STR_DICTIONARY_TITLE,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_dictionary_cntx.total_browse_entry,
- mmi_dictionary_list_get_item,
- NULL,
- 0,
- IMG_DICTIONARY_SEARCH,
- (U8*) g_dictionary_input_buffer,
- DICTIONARY_INPUT_LENGTH + 1,
- guiBuffer);
- SetCategory200RightSoftkeyFunction(mmi_dictionary_exit_engine, KEY_EVENT_UP);
- #else /* __MMI_DICTIONARY_SMALL_SCREEN__ */
- wgui_set_e_dictionary_test_clear_inputbox_buffer_funcptr(dictionary_dummy_function);
- cat201_register_language_changed_indicator(IsDictionaryLanguageChanged);
- ShowCategory201Screen(
- STR_DICTIONARY_TITLE,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_dictionary_cntx.total_browse_entry,
- mmi_dictionary_list_get_item,
- NULL,
- 0,
- IMG_DICTIONARY_SEARCH,
- (U8*) g_dictionary_input_buffer,
- DICTIONARY_INPUT_LENGTH + 1,
- INPUT_TYPE_ALPHANUMERIC_UPPERCASE,
- guiBuffer,
- g_dictionary_input_mode);
- SetCategory201RightSoftkeyFunction(mmi_dictionary_exit_engine, KEY_EVENT_UP);
- #endif /* __MMI_DICTIONARY_SMALL_SCREEN__ */
- g_mmi_dictionary_prev_input_mode = MMI_current_input_mode;
- SetKeyHandler(mmi_dictionary_entry_result_screen, KEY_ENTER, KEY_EVENT_DOWN);
- SetCategory200LeftSoftkeyFunction(mmi_dictionary_entry_main_option_screen, KEY_EVENT_UP);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_main_option_screen, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_exit_main_screen
- * DESCRIPTION
- * Exit function for main screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_exit_main_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(g_dictionary_last_word, 0, ENCODING_LENGTH);
- memset(g_dictionary_first_displayed_buffer, 0, ENCODING_LENGTH);
- g_dictionary_language_main_screen = g_dict_current_language;
- g_dictionary_highlighted_item = DynamicListGetHighlightedItem((U8*) g_dictionary_last_word);
- DynamicGetFirstDisplayedItem((U8*) g_dictionary_first_displayed_buffer);
- g_dictionary_prev_index = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * dictionary_dummy_function
- * DESCRIPTION
- * dummy function assigned
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL dictionary_dummy_function(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * IsDictionaryLanguageChanged
- * DESCRIPTION
- * This function tell the GUI layer if language has been changes while coming back from history
- * PARAMETERS
- * input_type [IN] changed input type
- * RETURNS
- * BOOL TRUE : language has been changed.
- * FALSE : language is not changed
- *****************************************************************************/
- BOOL IsDictionaryLanguageChanged(U8 input_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_DICTIONARY_LANGUAGE currentLanguage;
- pBOOL languageChanged = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currentLanguage = mmi_dictionary_check_input_family((U8) input_type);
- if (g_dict_current_language != currentLanguage)
- {
- languageChanged = MMI_TRUE;
- memset(g_dictionary_input_buffer, 0, ENCODING_LENGTH);
- }
- else
- {
- languageChanged = MMI_FALSE;
- }
- switch (currentLanguage)
- {
- case DICTIONARY_ENGLISH:
- g_dict_current_language = DICTIONARY_ENGLISH;
- break;
- case DICTIONARY_CHINESE:
- g_dict_current_language = DICTIONARY_CHINESE;
- break;
- default:
- g_dict_current_language = DICTIONARY_NONE;
- }
- return languageChanged;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_exit_engine
- * DESCRIPTION
- * Exit function dictionary. Deinitilize dictionary memory
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_exit_engine(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- result = mmi_dict_exit();
- if (result == FALSE)
- {
- PRINT_INFORMATION(("---[DictionaryMain.c] Failed to De-initialize Dictionary n"));
- /* return; */
- }
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_word_hdlr
- * DESCRIPTION
- * General highlight handler for word list in main dictionary screen
- * PARAMETERS
- * index [IN] UI index of current selected word.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_word_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL result;
- S32 dynamicItems;
- U8 g_dictionary_output[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dictionary_cntx.current_selected_index = index;
- g_dictionary_prev_index = index;
- DynamicListGetHighlightedItem((U8*) g_dictionary_last_word);
- dynamicItems = DynamicListGetItems(NULL, 0);
- if (index <= 0)
- {
- ClearKeyHandler(KEY_UP_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
- return;
- }
- else
- {
- SetKeyHandler(dynamic_list_goto_previous_item, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(dynamic_list_goto_previous_item, KEY_VOL_UP, KEY_EVENT_DOWN);
- }
- if (g_dict_current_language == DICTIONARY_ENGLISH)
- {
- if (g_dictionary_last_item || dynamicItems < 6)
- {
- return;
- }
- if (index >= (S32) (dynamicItems - 1))
- {
- /* this function is called to find out :whether further words exist in the word list */
- result = mmi_dict_get_word_by_indx(
- (U8) g_dict_current_language,
- (U16) (g_dictionary_cntx.starting_index + index + 1),
- (S8*) g_dictionary_output);
- if (result == TRUE)
- {
- g_dictionary_last_item = FALSE;
- }
- else
- {
- g_dictionary_last_item = TRUE;
- }
- g_dictionary_cntx.total_browse_entry++;
- DynamicListIncreaseItem((S16) 1);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_list_get_item
- * DESCRIPTION
- * Fill the UI list for display, on request from UI.
- * mmi_dict_exact_search_id/mmi_dict_exact_search_prev_id/mmi_dict_exact_search_next_id : set the focus to the word,
- * mmi_dict_get_word_by_indx : get the focused word
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL mmi_dictionary_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 g_dictionary_output[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- pBOOL result, bufferCheck;
- S32 index = 0;
- S32 steps;
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_MAIN);
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- if (g_dict_current_language == DICTIONARY_ENGLISH)
- {
- /* there is no need to give first 32 elements while coming to history ,when highlighted item is > 35 */
- if (guiBuffer && (g_dictionary_highlighted_item >= 35) && (item_index <= 31))
- {
- index = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- str_buff = NULL;
- *img_buff_p = get_image(IMG_DICTIONARY_WORD_LIST_SCREEN);
- return TRUE;
- }
- /* While coming back from history, and UI gets the items to display */
- if (guiBuffer && (item_index > 31))
- {
- steps = DynamicGetFirstDisplayedItem(NULL) - item_index;
- pfnUnicodeStrcpy((S8*) g_dictionary_input, (S8*) g_dictionary_first_displayed_buffer);
- if (steps > 0)
- {
- index = mmi_dict_exact_search_prev_id(
- (PS8) g_dictionary_input,
- (steps),
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- }
- else
- {
- index = mmi_dict_exact_search_next_id(
- (PS8) g_dictionary_input,
- (-steps),
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- }
- }
- else if (item_index == 0)
- {
- pfnUnicodeStrcpy((S8*) g_dictionary_input, (S8*) g_dictionary_input_buffer);
- bufferCheck = mmi_dictionary_check_input_buffer((U8*) g_dictionary_input, (U8) g_dict_current_language);
- if (bufferCheck == TRUE)
- {
- index = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.starting_index = index;
- }
- else
- {
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- AnsiiToUnicodeString((S8*) g_dictionary_input, "a");
- index = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.starting_index = index;
- }
- }
- else if (g_dictionary_prev_index > item_index)
- {
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- /* get the dynamic element from UI. */
- DynamicListGetItems((U8*) g_dictionary_input, (U16) (item_index + 1));
- index = mmi_dict_exact_search_prev_id(
- (PS8) g_dictionary_input,
- 1,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- }
- else if (g_dictionary_prev_index < item_index)
- {
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- /* get the dynamic element from UI. */
- DynamicListGetItems((U8*) g_dictionary_input, (U16) (item_index - 1));
- index = mmi_dict_exact_search_next_id(
- (PS8) g_dictionary_input,
- 1,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- }
- memset(g_dictionary_output, 0, ENCODING_LENGTH);
- result = mmi_dict_get_word_by_indx((U8) g_dict_current_language, (U16) (index), (S8*) g_dictionary_output);
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_dictionary_output);
- *img_buff_p = get_image(IMG_DICTIONARY_WORD_LIST_SCREEN);
- g_dictionary_prev_index = item_index;
- return TRUE;
- }
- #ifndef __MMI_DICTIONARY_SMALL_SCREEN__
- if (g_dict_current_language == DICTIONARY_CHINESE)
- {
- if (item_index < g_dictionary_cntx.total_browse_entry)
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_dict_chinese_ids[item_index].dict_word);
- *img_buff_p = get_image(IMG_DICTIONARY_WORD_LIST_SCREEN);
- return TRUE;
- }
- return FALSE;
- }
- #endif /* __MMI_DICTIONARY_SMALL_SCREEN__ */
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_find_entry
- * DESCRIPTION
- * Find the entries in dictionary based upon the input buffer.
- * PARAMETERS
- * keyword [?]
- * RETURNS
- * void
- *****************************************************************************/
- S32 mmi_dictionary_find_entry(U8 *keyword)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 stringLength, cnt = 0;
- pBOOL bufferCheck;
- #ifndef __MMI_DICTIONARY_SMALL_SCREEN__
- U16 resultCount;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dictionary_last_item = FALSE;
- g_dictionary_prev_index = 0;
- switch (MMI_current_input_mode)
- {
- #ifndef __MMI_DICTIONARY_SMALL_SCREEN__
- case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
- case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
- case INPUT_MODE_SMART_UPPERCASE_ABC:
- case INPUT_MODE_SMART_LOWERCASE_ABC:
- case INPUT_MODE_MMI_LOWERCASE_ABC:
- #else /* __MMI_DICTIONARY_SMALL_SCREEN__ */
- case INPUT_MODE_MMI_LOWERCASE_ABC:
- #endif /* __MMI_DICTIONARY_SMALL_SCREEN__ */
- {
- stringLength = pfnUnicodeStrlen((S8*) keyword);
- g_dict_current_language = DICTIONARY_ENGLISH;
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- if (stringLength > 0)
- {
- pfnUnicodeStrcpy((S8*) g_dictionary_input, (S8*) keyword);
- bufferCheck = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (bufferCheck == FALSE)
- {
- /* First character is not alphabet */
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- g_dictionary_cntx.starting_index = 0;
- AnsiiToUnicodeString((S8*) g_dictionary_input, "a");
- cnt = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.total_browse_entry = mmi_dict_get_total_num((S8*) g_dictionary_input);
- break;
- }
- cnt = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.starting_index = cnt;
- g_dictionary_cntx.total_browse_entry = mmi_dict_get_total_num((PS8) g_dictionary_input);
- break;
- }
- else
- {
- g_dict_current_language = DICTIONARY_ENGLISH;
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- AnsiiToUnicodeString((S8*) g_dictionary_input, "a");
- cnt = mmi_dict_exact_search_id(
- (PS8) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) ! g_dict_current_language);
- g_dictionary_cntx.starting_index = cnt;
- g_dictionary_cntx.total_browse_entry = mmi_dict_get_total_num((PS8) g_dictionary_input);
- break;
- }
- break;
- }
- #ifndef __MMI_DICTIONARY_SMALL_SCREEN__
- case INPUT_MODE_TR_MULTITAP_BOPOMO:
- case INPUT_MODE_TR_STROKE:
- case INPUT_MODE_SM_MULTITAP_PINYIN:
- case INPUT_MODE_SM_STROKE:
- case INPUT_MODE_SM_PINYIN:
- case INPUT_MODE_TR_BOPOMO:
- g_dict_current_language = DICTIONARY_CHINESE;
- stringLength = pfnUnicodeStrlen((S8*) keyword);
- memset(g_dictionary_input, 0, ENCODING_LENGTH);
- memset(g_dict_chinese_ids, 0, sizeof(mmi_dict_id_str_struct) * (MMI_DICT_ID_FETCH_MAX + 1));
- g_dictionary_cntx.current_selected_index = 0;
- if (stringLength != 0)
- {
- pfnUnicodeStrcpy((S8*) g_dictionary_input, (S8*) keyword);
- bufferCheck = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (bufferCheck == FALSE)
- {
- /* First character is not chinese character */
- g_dictionary_cntx.starting_index = 0;
- g_dictionary_cntx.total_browse_entry = 0;
- break;
- }
- resultCount = mmi_dict_wild_search(
- (U8) g_dict_current_language,
- (S8*) g_dictionary_input,
- 0,
- MMI_DICT_ID_FETCH_MAX,
- (void*)g_dict_chinese_ids);
- g_dictionary_cntx.starting_index = 0;
- g_dictionary_cntx.total_browse_entry = resultCount;
- break;
- }
- else
- {
- memset(g_dict_chinese_ids, 0, sizeof(mmi_dict_id_str_struct) * (MMI_DICT_ID_FETCH_MAX + 1));
- g_dictionary_cntx.starting_index = 0;
- g_dictionary_cntx.total_browse_entry = 0;
- break;
- }
- break;
- #endif /* __MMI_DICTIONARY_SMALL_SCREEN__ */ /* ifndef __MMI_DICTIONARY_SMALL_SCREEN__ */
- default:
- g_dict_current_language = DICTIONARY_NONE;
- g_dictionary_cntx.starting_index = 0;
- g_dictionary_cntx.total_browse_entry = 0;
- break;
- }
- return g_dictionary_cntx.total_browse_entry;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_result_screen
- * DESCRIPTION
- * Entry screen for result screen. Shows the meaning of word to the user.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_result_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 tempBuf[MMI_DICT_CORE_WORD_MAX * ENCODING_LENGTH];
- BOOL result = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_DICTIONARY_RESULT, NULL, mmi_dictionary_entry_result_screen, NULL);
- memset(g_dictionary_result_buffer, 0, ENCODING_LENGTH);
- memset(&g_dict_fetchresult, 0, sizeof(mmi_dict_result_struct));
- DeleteScreenIfPresent(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- switch (g_dictionary_search_type)
- {
- case DICTIONARY_BROWSE:
- if (g_dict_current_language == DICTIONARY_ENGLISH)
- {
- result = mmi_dict_exact_search(
- (S8*) g_dictionary_last_word,
- (U8) g_dict_current_language,
- (U8) (!g_dict_current_language),
- MMI_DICT_SYNO | MMI_DICT_ANTO | MMI_DICT_SENTS,
- &g_dict_fetchresult);
- }
- else if (g_dict_current_language == DICTIONARY_CHINESE)
- {
- if (pfnUnicodeStrlen((S8*) g_dict_chinese_ids[g_dictionary_cntx.current_selected_index].dict_word))
- {
- result = mmi_dict_exact_search(
- (S8*) g_dict_chinese_ids[g_dictionary_cntx.current_selected_index]. dict_word,
- (U8) g_dict_current_language,
- (U8) (!g_dict_current_language),
- MMI_DICT_SYNO | MMI_DICT_ANTO | MMI_DICT_SENTS,
- &g_dict_fetchresult);
- }
- else
- {
- result = FALSE;
- }
- }
- else
- {
- result = FALSE;
- }
- break;
- case DICTIONARY_WILDCARD_SEARCH:
- result = mmi_dict_exact_search(
- (S8*) g_dict_wildcard_ids[g_dictionary_cntx.current_wildcard_search_index]. dict_word,
- (U8) g_dict_current_language,
- (U8) (!g_dict_current_language),
- MMI_DICT_SYNO | MMI_DICT_ANTO | MMI_DICT_SENTS,
- &g_dict_fetchresult);
- break;
- case DICTIONARY_EXACT_SEARCH:
- result = mmi_dict_exact_search(
- (S8*) g_dictionary_input,
- (U8) g_dict_current_language,
- (U8) (!g_dict_current_language),
- MMI_DICT_SYNO | MMI_DICT_ANTO | MMI_DICT_SENTS,
- &g_dict_fetchresult);
- break;
- }
- if (result == FALSE)
- {
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_NO_MATCH_FOUND),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_RESULT);
- return;
- }
- if (pfnUnicodeStrlen((S8*) g_dict_fetchresult.dict_word))
- {
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) g_dict_fetchresult.dict_word);
- pfnUnicodeStrcat((PS8) g_dictionary_result_buffer, (S8*) L"n");
- }
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) g_dict_fetchresult.dict_meaning);
- if (g_dict_current_language == DICTIONARY_ENGLISH)
- {
- if (g_dict_fetchresult.dict_synonym[0] != 0 || g_dict_fetchresult.dict_synonym[1] != 0)
- {
- pfnUnicodeStrcpy((S8*) tempBuf, (S8*) L"nn[");
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) GetString(STR_DICTIONARY_SYNONYMS));
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) L"]n");
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) tempBuf);
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) & g_dict_fetchresult.dict_synonym[2]);
- }
- if (g_dict_fetchresult.dict_antonym[0] != 0 || g_dict_fetchresult.dict_antonym[1] != 0)
- {
- pfnUnicodeStrcpy((S8*) tempBuf, (S8*) L"nn[");
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) GetString(STR_DICTIONARY_ANTONYMS));
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) L"]n");
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) tempBuf);
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) & g_dict_fetchresult.dict_antonym[2]);
- }
- if (g_dict_fetchresult.dict_example_sentence[0] != 0 || g_dict_fetchresult.dict_example_sentence[1] != 0)
- {
- pfnUnicodeStrcpy((S8*) tempBuf, (S8*) L"nn[");
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) GetString(STR_DICTIONARY_EXAMPLE_SENTENCE));
- pfnUnicodeStrcat((S8*) tempBuf, (S8*) L"]n");
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) tempBuf);
- pfnUnicodeStrcat((S8*) g_dictionary_result_buffer, (S8*) & g_dict_fetchresult.dict_example_sentence[2]);
- }
- }
- ShowCategory78Screen(
- STR_DICTIONARY_TITLE,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- NULL,
- (U8*) g_dictionary_result_buffer,
- pfnUnicodeStrlen((S8*) g_dictionary_result_buffer),
- NULL /* guiBuffer */ );
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_main_option_screen
- * DESCRIPTION
- * Entry screen for dictionary option screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_main_option_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[4]; /* Need Expansion when has more options. */
- U16 nNumofItem;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_DICTIONARY_OPTION, NULL, mmi_dictionary_entry_main_option_screen, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_OPTION);
- nNumofItem = GetNumOfChild(DICTIONARY_OPTION_MENU);
- GetSequenceStringIds(DICTIONARY_OPTION_MENU, nStrItemList);
- SetParentHandler(DICTIONARY_OPTION_MENU);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_wildcard_exact_editor_screen
- * DESCRIPTION
- * Entry screen for wildcard, exact and chinese string search
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_wildcard_exact_editor_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 strID = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_DICTIONARY_WILDCARD_EXACT_EDITOR,
- mmi_dictionary_exit_wildcard_exact_editor_screen,
- mmi_dictionary_entry_wildcard_exact_editor_screen,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_WILDCARD_EXACT_EDITOR);
- switch (g_dictionary_search_type)
- {
- case DICTIONARY_WILDCARD_SEARCH:
- #ifdef __MMI_DICT_GV__
- strID = STR_DICTIONARY_WILDCARD_SEARCH;
- #else
- strID = STR_DICTIONARY_CHINESE_STRING;
- #endif
- break;
- case DICTIONARY_EXACT_SEARCH:
- strID = STR_DICTIONARY_EXACT_SEARCH;
- break;
- }
- Register_cat5_editor_buffer_need_flush(mmi_dictionary_flush_exact_wild_editor_buffer);
- ShowCategory5Screen_ext(
- strID,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- INPUT_TYPE_ALPHANUMERIC_UPPERCASE,
- (PU8) g_dictionary_wildcard_exact_buffer,
- DICTIONARY_INPUT_LENGTH + 1,
- guiBuffer,
- 0,
- g_dictionary_input_mode,
- NULL);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_editor_option_screen, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_editor_option_screen, KEY_SEND, KEY_EVENT_UP);
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- g_mmi_dictionary_prev_input_mode = MMI_current_input_mode;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_exit_wildcard_exact_editor_screen
- * DESCRIPTION
- * Exit function for exact/wildcard buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_exit_wildcard_exact_editor_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_multiline_inputbox_input_type = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_editor_option_screen
- * DESCRIPTION
- * Entry function for editor option screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_editor_option_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nStrItemList[2]; /* Stores the strings id of submenus returned */
- U16 nNumofItem; /* Stores no of children in the submenu */
- U8 *guiBuffer; /* Buffer holding history data */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_DICTIONARY_EDITOR_OPTION_SCREEN, NULL, mmi_dictionary_entry_editor_option_screen, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- nNumofItem = GetNumOfChild(DICTIONARY_EDITOR_OPTION_MENU);
- GetSequenceStringIds(DICTIONARY_EDITOR_OPTION_MENU, nStrItemList);
- SetParentHandler(DICTIONARY_EDITOR_OPTION_MENU);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_search
- * DESCRIPTION
- * This function search the database according to input in wildcard/exact search buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 cnt = 0, resultCount = 0;
- U8 length;
- pBOOL result = TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- length = pfnUnicodeStrlen((S8*) g_dictionary_wildcard_exact_buffer);
- length = length * 2;
- if (length == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_NO_MATCH_FOUND),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- return;
- }
- pfnUnicodeStrcpy((S8*) g_dictionary_input, (S8*) g_dictionary_wildcard_exact_buffer);
- if (g_dictionary_search_type == DICTIONARY_WILDCARD_SEARCH)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
- case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
- case INPUT_MODE_SMART_UPPERCASE_ABC:
- case INPUT_MODE_SMART_LOWERCASE_ABC:
- /* clean the string .check: for english string only */
- g_dict_current_language = DICTIONARY_ENGLISH;
- result = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (result == FALSE)
- {
- break;
- }
- memset(g_dict_wildcard_ids, 0, sizeof(mmi_dict_id_str_struct) * (MMI_DICT_ID_FETCH_MAX + 1));
- /* DictionaryWaitingPopup(IMG_DICTIONARY_WAIT); */
- resultCount = mmi_dict_wild_search(
- (U8) g_dict_current_language,
- (S8*) g_dictionary_input,
- 0,
- MMI_DICT_ID_FETCH_MAX,
- (void*)g_dict_wildcard_ids);
- if (resultCount != 0)
- {
- g_dictionary_cntx.wildcard_results = resultCount;
- mmi_dictionary_entry_wildcard_result_list_screen();
- }
- break;
- case INPUT_MODE_TR_MULTITAP_BOPOMO:
- case INPUT_MODE_TR_STROKE:
- case INPUT_MODE_SM_MULTITAP_PINYIN:
- case INPUT_MODE_SM_STROKE:
- case INPUT_MODE_SM_PINYIN:
- case INPUT_MODE_TR_BOPOMO:
- /* clean the string .check: for chinese string only */
- g_dict_current_language = DICTIONARY_CHINESE;
- result = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (result == FALSE)
- {
- break;
- }
- memset(g_dict_wildcard_ids, 0, sizeof(mmi_dict_id_str_struct) * (MMI_DICT_ID_FETCH_MAX + 1));
- /* DictionaryWaitingPopup(IMG_DICTIONARY_WAIT); */
- resultCount = mmi_dict_wild_search(
- (U8) g_dict_current_language,
- (S8*) g_dictionary_input,
- 0,
- MMI_DICT_ID_FETCH_MAX,
- (void*) /* g_dict_chinese_ids */ g_dict_wildcard_ids);
- if (resultCount != 0)
- {
- g_dictionary_cntx.wildcard_results = resultCount;
- mmi_dictionary_entry_wildcard_result_list_screen();
- }
- break;
- default:
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_LANGUAGE_NOT_SUPPORTED),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- break;
- }
- if (resultCount == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_NO_MATCH_FOUND),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- }
- }
- else if (g_dictionary_search_type == DICTIONARY_EXACT_SEARCH)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
- case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
- case INPUT_MODE_SMART_UPPERCASE_ABC:
- case INPUT_MODE_SMART_LOWERCASE_ABC:
- /* clean the string */
- g_dict_current_language = DICTIONARY_ENGLISH;
- result = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (result == FALSE)
- {
- break;
- }
- /* DictionaryWaitingPopup(IMG_DICTIONARY_WAIT); */
- mmi_dictionary_entry_result_screen();
- break;
- case INPUT_MODE_TR_MULTITAP_BOPOMO:
- case INPUT_MODE_TR_STROKE:
- case INPUT_MODE_SM_MULTITAP_PINYIN:
- case INPUT_MODE_SM_STROKE:
- case INPUT_MODE_SM_PINYIN:
- case INPUT_MODE_TR_BOPOMO:
- /* clean the string */
- g_dict_current_language = DICTIONARY_CHINESE;
- result = mmi_dictionary_check_input_buffer(g_dictionary_input, (U8) g_dict_current_language);
- if (result == FALSE)
- {
- break;
- }
- /* DictionaryWaitingPopup(IMG_DICTIONARY_WAIT); */
- mmi_dictionary_entry_result_screen();
- break;
- default:
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_LANGUAGE_NOT_SUPPORTED),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- break;
- }
- }
- /* result popup */
- if (result == FALSE)
- {
- DisplayPopup(
- (PU8) GetString(STR_DICTIONARY_NO_MATCH_FOUND),
- IMG_GLOBAL_WARNING,
- FALSE,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- DeleteNScrId(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_check_input_buffer
- * DESCRIPTION
- * This function check the input buffer according to language passed
- * PARAMETERS
- * inputBuffer [?]
- * language [IN]
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL mmi_dictionary_check_input_buffer(U8 *inputBuffer, U8 language)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 length, cnt = 0;
- S16 end_cnt;
- U8 tempBuf[(MMI_DICT_CORE_WORD_MAX + 1) * ENCODING_LENGTH];
- U16 chineseCode;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* filter out any space in the beginning */
- pfnUnicodeStrcpy((S8*) tempBuf, (S8*) inputBuffer);
- length = pfnUnicodeStrlen((S8*) inputBuffer);
- length = length * ENCODING_LENGTH;
- while (length > cnt)
- {
- if ((tempBuf[cnt] == 0x20) && (tempBuf[cnt + 1] == 0x00)) /* if first character is space */
- {
- cnt = cnt + 2;
- continue;
- }
- else
- {
- break;
- }
- }
- if (cnt == length)
- {
- /* user has entered only spaces in editor screen */
- return FALSE;
- }
- /* filter out any space in the end */
- end_cnt = length - 1;
- while (end_cnt > 0)
- {
- if ((tempBuf[end_cnt - 1] == 0x20) && (tempBuf[end_cnt] == 0x00))
- {
- end_cnt = end_cnt - 2;
- }
- else
- {
- break;
- }
- }
- memset(&tempBuf[end_cnt + 1], 0, 2);
- if (cnt != length)
- {
- pfnUnicodeStrcpy((S8*) inputBuffer, (S8*) & tempBuf[cnt]); /* copy after intitial space */
- switch (language)
- {
- case DICTIONARY_ENGLISH:
- /* first char have to be english alphabet only */
- if (!((inputBuffer[0] >= 65) && (inputBuffer[0] <= 90))
- && !((inputBuffer[0] >= 97) && (inputBuffer[0] <= 122)))
- {
- return FALSE;
- }
- /* there should not be any chinese character in english string */
- if (GetUCS2Flag((S8*) inputBuffer))
- {
- return FALSE;
- }
- break;
- case DICTIONARY_CHINESE:
- memcpy(&chineseCode, &inputBuffer[0], 2);
- if ((chineseCode < 0x4e00) || (chineseCode > 0x9fa5))
- {
- /* First character is not chinese character */
- return FALSE;
- }
- break;
- }
- }
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_entry_wildcard_result_list_screen
- * DESCRIPTION
- * This function shows the search result of wildcard and chinese search strings
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_entry_wildcard_result_list_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_DICTIONARY_WILDCARD_RESULT_LIST, NULL, mmi_dictionary_entry_wildcard_result_list_screen, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DICTIONARY_WILDCARD_RESULT_LIST);
- RegisterHighlightHandler(mmi_dictionary_wildcard_word_list_hdlr);
- DeleteScreenIfPresent(SCR_DICTIONARY_EDITOR_OPTION_SCREEN);
- ShowCategory184Screen(
- #ifdef __MMI_DICT_GV__
- STR_DICTIONARY_WILDCARD_SEARCH,
- #else
- STR_DICTIONARY_CHINESE_STRING,
- #endif
- GetRootTitleIcon(EXTRA_DICTIONARY_MENU),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK, g_dictionary_cntx.wildcard_results, mmi_dictionary_wildcard_list_get_item,
- /* HintPtr */ 0,
- 0, guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetLeftSoftkeyFunction(mmi_dictionary_entry_result_screen, KEY_EVENT_UP);
- SetKeyHandler(mmi_dictionary_entry_result_screen, KEY_ENTER, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_wildcard_list_get_item
- * DESCRIPTION
- * This function is to pass the wildcard and chinese strings to the UI to display
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL mmi_dictionary_wildcard_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (item_index < g_dictionary_cntx.wildcard_results)
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_dict_wildcard_ids[item_index].dict_word);
- *img_buff_p = get_image(IMG_DICTIONARY_WORD_LIST_SCREEN);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_wildcard_word_list_hdlr
- * DESCRIPTION
- * This function is the highlight handler for words in wildcard and chinese search list
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_wildcard_word_list_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dictionary_cntx.current_wildcard_search_index = index;
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * isFromDictionary
- * DESCRIPTION
- * This function returns to the UI whether control has come from dictionary or not
- * vice versa
- * PARAMETERS
- * max_number [?]
- * RETURNS
- * pBOOL : TRUE :From dictionary
- * FALSE : Not from the dictionary
- *****************************************************************************/
- BOOL isFromDictionary(S32 *max_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 scrID;
- BOOL scrPresent;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- scrID = GetActiveScreenId();
- scrPresent = IsScreenPresent(SCR_DICTIONARY_MAIN);
- if (scrID == SCR_DICTIONARY_MAIN || scrPresent)
- {
- *max_number = DICTIONARY_MAX_WORDS;
- return MMI_TRUE;
- }
- else
- {
- *max_number = 0;
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_flush_editor_buffer
- * DESCRIPTION
- * This function is to flush buffer when user change input method, from english family to chinese
- * vice versa
- * PARAMETERS
- * void
- * RETURNS
- * pBOOL : TRUE :Family has been changed. Flush the buffer
- * FALSE : Need to flush the output.
- *****************************************************************************/
- BOOL mmi_dictionary_flush_editor_buffer()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL isOldFamily, scrPresent;
- U16 activeScrID;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- activeScrID = GetActiveScreenId();
- scrPresent = IsScreenPresent(SCR_DICTIONARY_MAIN);
- if (activeScrID == SCR_INPUT_METHOD_LIST)
- {
- if (!scrPresent)
- {
- return MMI_FALSE;
- }
- }
- else if (!(activeScrID == SCR_DICTIONARY_WILDCARD_EXACT_EDITOR || activeScrID == SCR_DICTIONARY_MAIN))
- {
- return MMI_FALSE;
- }
- switch (g_mmi_dictionary_prev_input_mode)
- {
- case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
- case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
- case INPUT_MODE_SMART_UPPERCASE_ABC:
- case INPUT_MODE_SMART_LOWERCASE_ABC:
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
- case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
- case INPUT_MODE_SMART_UPPERCASE_ABC:
- case INPUT_MODE_SMART_LOWERCASE_ABC:
- isOldFamily = MMI_TRUE;
- break;
- default:
- isOldFamily = MMI_FALSE;
- }
- break;
- case INPUT_MODE_TR_MULTITAP_BOPOMO:
- case INPUT_MODE_TR_STROKE:
- case INPUT_MODE_SM_MULTITAP_PINYIN:
- case INPUT_MODE_SM_STROKE:
- case INPUT_MODE_SM_PINYIN:
- case INPUT_MODE_TR_BOPOMO:
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_TR_MULTITAP_BOPOMO:
- case INPUT_MODE_TR_STROKE:
- case INPUT_MODE_SM_MULTITAP_PINYIN:
- case INPUT_MODE_SM_STROKE:
- case INPUT_MODE_SM_PINYIN:
- case INPUT_MODE_TR_BOPOMO:
- isOldFamily = MMI_TRUE;
- break;
- default:
- isOldFamily = MMI_FALSE;
- }
- break;
- default:
- isOldFamily = MMI_FALSE;
- }
- g_mmi_dictionary_prev_input_mode = MMI_current_input_mode;
- if (isOldFamily)
- {
- return MMI_FALSE;
- }
- else
- {
- return MMI_TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_check_input_family
- * DESCRIPTION
- * This function is return the input family type
- * PARAMETERS
- * inputType [IN]
- * input type(?)
- * RETURNS
- * MMI_DICTIONARY_LANGUAGE : english/chinese/none
- *****************************************************************************/
- MMI_DICTIONARY_LANGUAGE mmi_dictionary_check_input_family(U8 inputType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_DICTIONARY_LANGUAGE family;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (inputType)
- {
- case INPUT_TYPE_ALPHANUMERIC_UPPERCASE:
- case INPUT_TYPE_ALPHANUMERIC_LOWERCASE:
- case INPUT_TYPE_SMART_UPPERCASE_ABC:
- case INPUT_TYPE_SMART_LOWERCASE_ABC:
- family = DICTIONARY_ENGLISH;
- break;
- case INPUT_TYPE_TR_MULTITAP_BOPOMO:
- case INPUT_TYPE_SM_MULTITAP_PINYIN:
- case INPUT_TYPE_TR_BOPOMO:
- case INPUT_TYPE_SM_PINYIN:
- case INPUT_TYPE_TR_STROKE:
- case INPUT_TYPE_SM_STROKE:
- family = DICTIONARY_CHINESE;
- break;
- default:
- family = DICTIONARY_NONE;
- }
- return family;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_flush_exact_wild_editor_buffer
- * DESCRIPTION
- * This function is called when input method is changed from exact/wildcard editor -> option->input method
- * PARAMETERS
- * void
- * RETURNS
- * BOOL TRUE : language has been changed
- * FALSE : language is not changed
- *****************************************************************************/
- BOOL mmi_dictionary_flush_exact_wild_editor_buffer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL scrPresent;
- U16 activeScrID;
- MMI_DICTIONARY_LANGUAGE currentLanguage;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- activeScrID = GetActiveScreenId();
- scrPresent = IsScreenPresent(SCR_DICTIONARY_WILDCARD_EXACT_EDITOR);
- if (activeScrID == SCR_INPUT_METHOD_LIST)
- {
- if (!scrPresent)
- {
- return MMI_FALSE;
- }
- }
- else if (!(activeScrID == SCR_DICTIONARY_WILDCARD_EXACT_EDITOR))
- {
- return MMI_FALSE;
- }
- if (wgui_multiline_inputbox_input_type != 0)
- {
- currentLanguage = mmi_dictionary_check_input_family((U8) wgui_multiline_inputbox_input_type);
- if (currentLanguage != g_dict_current_language)
- {
- g_dict_current_language = currentLanguage;
- return MMI_TRUE;
- }
- }
- else
- {
- /* Reset language if input type not assigned */
- g_dict_current_language = DICTIONARY_ENGLISH;
- return MMI_FALSE;
- }
- return MMI_FALSE;
- }
- #else /* defined(MMI_ON_HARDWARE_P) */ /* #if defined(MMI_ON_HARDWARE_P) */
- #include "PixtelDataTypes.h"
- #include "CommonScreens.h"
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_main_menu_highlight_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_main_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(PopupNoSupport, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(PopupNoSupport, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_init
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_dictionary_init()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetHiliteHandler(EXTRA_DICTIONARY_MENU, mmi_dictionary_main_menu_highlight_hdlr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_dictionary_flush_editor_buffer
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_dictionary_flush_editor_buffer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return FALSE;
- }
- #endif /* defined(MMI_ON_HARDWARE_P) */ /* #if defined(MMI_ON_HARDWARE_P) */
- #endif /* defined(__MMI_DICTIONARY__) */ /* #if defined(__MMI_DICTIONARY__) */