gui_ems.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:414k
- ResetTextFormat(&wgui_EMS_text_format);
- }
- #if(EMS_USE_CRLF_COMBINATION || EMS_USE_ESC_COMBINATION)
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_delete
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_delete(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if (UI_TEST_CR_CHARACTER(b->data->textBuffer[b->data->CurrentPosition.OffsetToText]))
- {
- if (ForwardCurrentPosition(b->data, 1) == 1)
- {
- if (!UI_TEST_LF_CHARACTER(b->data->textBuffer[b->data->CurrentPosition.OffsetToText]))
- {
- BackwardCurrentPosition(b->data, 1);
- }
- }
- }
- if (gui_EMS_input_box_forward_cursor(b) == 1)
- {
- gui_EMS_cancel_current_position(b);
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- }
- else
- {
- UI_editor_play_tone_cannot_change();
- }
- b->saved_cursor_ax = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_previous
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_previous(UI_EMS_input_box *b)
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- UI_character_type current_character, dummy_c = 0;
- EMSData *data = b->data;
- EMSObject *current_object;
- U8 object_type;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /* MTK Add Steven 20050505 */
- #if defined(__MMI_LANG_THAI__)
- EMSPosition mapped_cursor_position_thai;
- UI_character_type current_character_thai, dummy_c_thai = 0;
- EMSData *data_thai = b->data;
- EMSObject *current_object_thai;
- U8 object_type_thai;
- UI_character_type pre_one_char = 0;
- UI_character_type pre_two_char = 0;
- UI_character_type pre_three_char = 0;
- #endif /* defined(__MMI_LANG_THAI__) */
- /* MTK End */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- EMSPosition mapped_cursor_position_arabic;
- UI_character_type current_character_arabic, dummy_c_arabic = 0;
- EMSData *data_arabic = b->data;
- EMSObject *current_object_arabic;
- U8 object_type_arabic;
- S32 saved_text_len = 0;
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK End */
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- #if defined(__MMI_LANG_VIETNAMESE__)
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, ¤t_character, ¤t_object);
- if (1 == object_type)
- {
- if ((current_character >= 0x0300) && (current_character <= 0x0323))
- {
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, &dummy_c, ¤t_object); /* get next character */
- if (1 == object_type)
- {
- viet_vowel = mmi_viet_vowel_letter(dummy_c);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- tone_mark = mmi_viet_tone_mark(current_character);
- if (VIET_TONE_NONE != tone_mark)
- {
- current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- BackwardCurrentPositionSkipCR(b->data);
- }
- else
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else if (0 != object_type)
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /* MTK Steven 20050505 */
- #if defined(__MMI_LANG_THAI__)
- EMS_map_position(data_thai, &data_thai->CurrentPosition, &mapped_cursor_position_thai);
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- ¤t_character_thai,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(current_character_thai)) /* object type == 1 --> character */
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &pre_one_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(pre_one_char))
- {
- if (!RequireToMoveCursor(pre_one_char, current_character_thai))
- {
- BackwardCurrentPositionSkipCR(b->data);
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &pre_two_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(pre_two_char))
- {
- if (!RequireToMoveCursor(pre_two_char, pre_one_char))
- {
- BackwardCurrentPositionSkipCR(b->data);
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &pre_three_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(pre_three_char))
- {
- if (!RequireToMoveCursor(pre_three_char, pre_two_char))
- {
- BackwardCurrentPositionSkipCR(b->data);
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- #endif /* defined(__MMI_LANG_THAI__) */
- /* MTK End */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- mapped_cursor_position_arabic.OffsetToText = data_arabic->CurrentPosition.OffsetToText;
- mapped_cursor_position_arabic.Object = data_arabic->CurrentPosition.Object;
- object_type_arabic = gui_EMS_input_box_get_previous_object(
- data_arabic,
- &mapped_cursor_position_arabic,
- ¤t_character_arabic,
- ¤t_object_arabic);
- if (1 == object_type_arabic)
- {
- if (IS_ARABIC_CHARACTER(current_character_arabic))
- {
- U16 idx;
- idx = gui_get_ems_text_actual_idx(b, data_arabic->CurrentPosition.OffsetToText) / 2 - 1;
- while (idx > 0)
- {
- if (OrgToSha[idx] == OrgToSha[idx - 1])
- {
- BackwardCurrentPositionSkipCR(b->data);
- }
- else
- {
- break;
- }
- idx--;
- }
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- if (BackwardCurrentPositionSkipCR(b->data) != 1)
- {
- UI_editor_play_tone_cannot_navigate();
- }
- else
- {
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_forward_cursor
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_forward_cursor(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->data->CurrentPosition.OffsetToText <= (b->data->textLength))
- { /* START TARUN 20041212 */
- if (ForwardCurrentPositionSkipCR(b->data) == 1)
- //if(ForwardCurrentPositionSkipCR(b->data)>=1)
- //END TARUN 20041212
- {
- return (1);
- }
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_next
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_next(UI_EMS_input_box *b)
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- UI_character_type current_character, dummy_c = 0;
- EMSData *data = b->data;
- EMSObject *current_object;
- U8 object_type;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /* MTK Add Steven 20050505 */
- #if defined(__MMI_LANG_THAI__)
- EMSPosition mapped_cursor_position_thai;
- UI_character_type current_character_thai, dummy_c_thai = 0;
- EMSData *data_thai = b->data;
- EMSObject *current_object_thai;
- U8 object_type_thai;
- UI_character_type next_one_char = 0;
- UI_character_type next_two_char = 0;
- UI_character_type next_three_char = 0;
- #endif /* defined(__MMI_LANG_THAI__) */
- /* MTK End */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- EMSPosition mapped_cursor_position_arabic;
- UI_character_type current_character_arabic, dummy_c_arabic = 0;
- EMSData *data_arabic = b->data;
- EMSObject *current_object_arabic;
- U8 object_type_arabic;
- S32 saved_text_len = 0;
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK End */
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- #if defined(__MMI_LANG_VIETNAMESE__)
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, ¤t_character, ¤t_object);
- if (1 == object_type)
- {
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object); /* get next character */
- if (1 == object_type)
- {
- tone_mark = mmi_viet_tone_mark(dummy_c);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(current_character);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- gui_EMS_input_box_forward_cursor(b);
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- &mapped_cursor_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else if (0 != object_type)
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /* MTK Steven 20050505 */
- #if defined(__MMI_LANG_THAI__)
- EMS_map_position(data_thai, &data_thai->CurrentPosition, &mapped_cursor_position_thai);
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- ¤t_character_thai,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(current_character_thai)) /* object type == 1 --> character */
- {
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &next_one_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(next_one_char))
- {
- if (!RequireToMoveCursor(current_character_thai, next_one_char))
- {
- gui_EMS_input_box_forward_cursor(b);
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &next_two_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(next_two_char))
- {
- if (!RequireToMoveCursor(next_one_char, next_two_char))
- {
- gui_EMS_input_box_forward_cursor(b);
- object_type_thai = gui_EMS_input_box_get_next_object(
- data_thai,
- &mapped_cursor_position_thai,
- &next_three_char,
- ¤t_object_thai);
- if (object_type_thai == 1 && isThaiChar(next_three_char))
- {
- if (!RequireToMoveCursor(next_two_char, next_three_char))
- {
- gui_EMS_input_box_forward_cursor(b);
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- else
- {
- object_type_thai = gui_EMS_input_box_get_previous_object(
- data_thai,
- &mapped_cursor_position_thai,
- &dummy_c_thai,
- ¤t_object_thai);
- }
- }
- #endif /* defined(__MMI_LANG_THAI__) */
- /* MTK End */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- mapped_cursor_position_arabic.OffsetToText = data_arabic->CurrentPosition.OffsetToText;
- mapped_cursor_position_arabic.Object = data_arabic->CurrentPosition.Object;
- object_type_arabic = gui_EMS_input_box_get_next_object(
- data_arabic,
- &mapped_cursor_position_arabic,
- ¤t_character_arabic,
- ¤t_object_arabic);
- if (1 == object_type_arabic)
- {
- if (IS_ARABIC_CHARACTER(current_character_arabic))
- {
- U16 idx;
- U16 offset = 0;
- if (mapped_cursor_position_arabic.Object != NULL)
- {
- offset += 2;
- }
- idx = gui_get_ems_text_actual_idx(b, data_arabic->CurrentPosition.OffsetToText + offset);
- if (idx != 0)
- {
- idx = idx / 2 - 1;
- }
- while (idx < unshaped_text_len)
- {
- if (OrgToSha[idx] == OrgToSha[idx + 1])
- {
- gui_EMS_input_box_forward_cursor(b);
- }
- else
- {
- break;
- }
- idx++;
- }
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- if (gui_EMS_input_box_forward_cursor(b) != 1)
- {
- UI_editor_play_tone_cannot_navigate();
- }
- else
- {
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- }
- #else /* (EMS_USE_CRLF_COMBINATION || EMS_USE_ESC_COMBINATION) */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_delete
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_delete(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if (gui_EMS_input_box_forward_cursor(b) == 1)
- {
- gui_EMS_cancel_current_position(b);
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- }
- else
- {
- UI_editor_play_tone_cannot_change();
- }
- b->saved_cursor_ax = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_previous
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_previous(UI_EMS_input_box *b)
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- UI_character_type current_character, dummy_c = 0;
- EMSData *data = b->data;
- EMSObject *current_object;
- U8 object_type;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- EMSPosition mapped_cursor_position_arabic;
- UI_character_type current_character_arabic, dummy_c_arabic = 0;
- EMSData *data_arabic = b->data;
- EMSObject *current_object_arabic;
- U8 object_type_arabic;
- S32 saved_text_len = 0;
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- #if defined(__MMI_LANG_VIETNAMESE__)
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, ¤t_character, ¤t_object);
- if (1 == object_type)
- {
- if ((current_character >= 0x0300) && (current_character <= 0x0323))
- {
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, &dummy_c, ¤t_object); /* get next character */
- if (1 == object_type)
- {
- viet_vowel = mmi_viet_vowel_letter(dummy_c);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- tone_mark = mmi_viet_tone_mark(current_character);
- if (VIET_TONE_NONE != tone_mark)
- {
- current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- BackwardCurrentPosition(b->data, 1);
- }
- else
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else if (0 != object_type)
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- mapped_cursor_position_arabic.OffsetToText = data_arabic->CurrentPosition.OffsetToText;
- mapped_cursor_position_arabic.Object = data_arabic->CurrentPosition.Object;
- object_type_arabic = gui_EMS_input_box_get_previous_object(
- data_arabic,
- &mapped_cursor_position_arabic,
- ¤t_character_arabic,
- ¤t_object_arabic);
- if (1 == object_type_arabic)
- {
- if (IS_ARABIC_CHARACTER(current_character_arabic))
- {
- U16 idx;
- idx = gui_get_ems_text_actual_idx(b, data_arabic->CurrentPosition.OffsetToText) / 2 - 1;
- while (idx > 0)
- {
- if (OrgToSha[idx] == OrgToSha[idx - 1])
- {
- BackwardCurrentPositionSkipCR(b->data);
- }
- else
- {
- break;
- }
- idx--;
- }
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- UI_editor_play_tone_cannot_navigate();
- }
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_forward_cursor
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_forward_cursor(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->data->CurrentPosition.OffsetToText <= (b->data->textLength))
- {
- if (ForwardCurrentPosition(b->data, 1) == 1)
- {
- return (1);
- }
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_next
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_next(UI_EMS_input_box *b)
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- UI_character_type current_character, dummy_c = 0;
- EMSData *data = b->data;
- EMSObject *current_object;
- U8 object_type;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- EMSPosition mapped_cursor_position_arabic;
- UI_character_type current_character_arabic, dummy_c_arabic = 0;
- EMSData *data_arabic = b->data;
- EMSObject *current_object_arabic;
- U8 object_type_arabic;
- S32 saved_text_len = 0;
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- #if defined(__MMI_LANG_VIETNAMESE__)
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, ¤t_character, ¤t_object);
- if (1 == object_type)
- {
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object); /* get next character */
- if (1 == object_type)
- {
- tone_mark = mmi_viet_tone_mark(dummy_c);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(current_character);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- gui_EMS_input_box_forward_cursor(b);
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- &mapped_cursor_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- else if (0 != object_type)
- {
- object_type = gui_EMS_input_box_get_next_object(data, &mapped_cursor_position, &dummy_c, ¤t_object);
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) defined(__MMI_LANG_PERSIAN__)
- mapped_cursor_position_arabic.OffsetToText = data_arabic->CurrentPosition.OffsetToText;
- mapped_cursor_position_arabic.Object = data_arabic->CurrentPosition.Object;
- object_type_arabic = gui_EMS_input_box_get_next_object(
- data_arabic,
- &mapped_cursor_position_arabic,
- ¤t_character_arabic,
- ¤t_object_arabic);
- if (1 == object_type_arabic)
- {
- if (IS_ARABIC_CHARACTER(current_character_arabic))
- {
- U16 idx;
- U16 offset = 0;
- if (mapped_cursor_position_arabic.Object != NULL)
- {
- offset += 2;
- }
- idx = gui_get_ems_text_actual_idx(b, data_arabic->CurrentPosition.OffsetToText + offset);
- if (idx != 0)
- {
- idx = idx / 2 - 1;
- }
- while (idx < unshaped_text_len)
- {
- if (OrgToSha[idx] == OrgToSha[idx + 1])
- {
- gui_EMS_input_box_forward_cursor(b);
- }
- else
- {
- break;
- }
- idx++;
- }
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) defined(__MMI_LANG_PERSIAN__) */ /* defined(__MMI_LANG_ARABIC__) */
- if (gui_EMS_input_box_forward_cursor(b) != 1)
- {
- UI_editor_play_tone_cannot_navigate();
- }
- gui_EMS_input_box_set_text_format_cursor_position(b);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- #endif /* (EMS_USE_CRLF_COMBINATION || EMS_USE_ESC_COMBINATION) */
- /*****************************************************************************
- * FUNCTION
- * gui_move_EMS_input_box
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_move_EMS_input_box(UI_EMS_input_box *b, S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->x = x;
- b->y = y;
- gui_move_vertical_scrollbar(&b->vbar, b->x + b->width - b->vbar.width - 1, b->y + 1);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_resize_EMS_input_box
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * width [IN]
- * height [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_resize_EMS_input_box(UI_EMS_input_box *b, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->width = width;
- b->height = height;
- gui_move_vertical_scrollbar(&b->vbar, b->x + b->width - b->vbar.width - 1, b->y + 1);
- gui_resize_vertical_scrollbar(&b->vbar, b->vbar.width, b->height - 2);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- /* Returns 0: none, 1: character, 2:object */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_get_next_object
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * current_position [?]
- * c [?]
- * o [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_get_next_object(
- EMSData *data,
- EMSPosition *current_position,
- UI_character_type *c,
- EMSObject **o)
- {
- #if(0) /* Error in code: Do not enable this block */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- byte return_type=0;
- if((current_position->Object!=NULL) && (current_position->Object->OffsetToText==current_position->OffsetToText))
- {
- if((current_position->Object->next!=NULL) && (current_position->Object->OffsetToText==current_position->Object->next->OffsetToText))
- {
- return_type=2;
- *o=current_position->Object;
- current_position->Object=current_position->Object->next;
- }
- else if(current_position->OffsetToText<=EMS_DATA_END_OFFSET(data->textLength))
- {
- return_type=2;
- *o=current_position->Object;
- current_position->Object=current_position->Object->next;
- }
- }
- else if(current_position->OffsetToText<EMS_DATA_END_OFFSET(data->textLength))
- {
- return_type=1;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- *c=(data->textBuffer[current_position->OffsetToText+1]|(data->textBuffer[current_position->OffsetToText]<<8));
- #else
- *c=(data->textBuffer[current_position->OffsetToText]|(data->textBuffer[current_position->OffsetToText+1]<<8));
- #endif
- current_position->OffsetToText+=2;
- }
- return(return_type);
- #else /* (0) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (EMSGetNextObject(data, current_position, c, o));
- #endif /* (0) */
- }
- /* MTK Add By Elvis for Input method */
- /* Returns 0: none, 1: character, 2:object */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_get_next_object_for_input_method
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * current_position [?]
- * c [?]
- * o [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_get_next_object_for_input_method(
- EMSData *data,
- EMSPosition *current_position,
- UI_character_type *c,
- EMSObject **o)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 return_type = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_position->Object != NULL)
- {
- if (current_position->Object->next != NULL &&
- current_position->Object->next->OffsetToText == current_position->OffsetToText)
- {
- return_type = 2;
- *o = current_position->Object->next;
- current_position->Object = current_position->Object->next;
- }
- else if (current_position->OffsetToText < EMS_DATA_END_OFFSET(data->textLength))
- {
- return_type = 1;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- *c = (data->
- textBuffer[current_position->OffsetToText +
- 1] | (data->textBuffer[current_position->OffsetToText] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- *c = (data->
- textBuffer[current_position->OffsetToText] | (data->
- textBuffer[current_position->OffsetToText + 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_position->OffsetToText += 2;
- }
- }
- else if (data->listHead != NULL)
- {
- if (data->listHead->OffsetToText == current_position->OffsetToText)
- {
- return_type = 2;
- *o = data->listHead;
- current_position->Object = data->listHead;
- }
- else if (current_position->OffsetToText < EMS_DATA_END_OFFSET(data->textLength))
- {
- return_type = 1;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- *c = (data->
- textBuffer[current_position->OffsetToText +
- 1] | (data->textBuffer[current_position->OffsetToText] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- *c = (data->
- textBuffer[current_position->OffsetToText] | (data->
- textBuffer[current_position->OffsetToText + 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_position->OffsetToText += 2;
- }
- }
- else if (current_position->OffsetToText < EMS_DATA_END_OFFSET(data->textLength))
- {
- return_type = 1;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- *c = (data->
- textBuffer[current_position->OffsetToText + 1] | (data->textBuffer[current_position->OffsetToText] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- *c = (data->
- textBuffer[current_position->OffsetToText] | (data->textBuffer[current_position->OffsetToText + 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_position->OffsetToText += 2;
- }
- return (return_type);
- }
- /* MTK end */
- /* Returns 0: none, 1: character, 2:object */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_get_previous_object
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * current_position [?]
- * c [?]
- * o [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_get_previous_object(
- EMSData *data,
- EMSPosition *current_position,
- UI_character_type *c,
- EMSObject **o)
- {
- #if(0)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- byte return_type=0;
- //MTK Elvis
- if((current_position->Object!=NULL) && (current_position->Object->OffsetToText==current_position->OffsetToText))
- {
- if((current_position->Object->prev!=NULL) && (current_position->Object->OffsetToText==current_position->Object->prev->OffsetToText))
- {
- return_type=2;
- *o=current_position->Object;
- current_position->Object=current_position->Object->prev;
- }
- else if(current_position->OffsetToText>=0)
- {
- return_type=2;
- *o=current_position->Object;
- current_position->Object=current_position->Object->prev;
- }
- }
- else if(current_position->OffsetToText <= EMS_DATA_END_OFFSET(data->textLength) && current_position->OffsetToText >= 2)
- {
- return_type=1;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- *c=(data->textBuffer[current_position->OffsetToText-1]|(data->textBuffer[current_position->OffsetToText-2]<<8));
- #else
- *c=(data->textBuffer[current_position->OffsetToText-2]|(data->textBuffer[current_position->OffsetToText-1]<<8));
- #endif
- current_position->OffsetToText-=2;
- }
- //MTK end
- return(return_type);
- #else /* (0) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (EMSGetPreviousObject(data, current_position, c, o));
- #endif /* (0) */
- }
- /* MTK Elvis 20031225 to avoid the cursor display out of editing window */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(UI_BLINKING_CURSOR_SUPPORT)
- /* under construction !*/
- #else
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(UI_BLINKING_CURSOR_SUPPORT)
- /* under construction !*/
- #else
- /* under construction !*/
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(UI_BLINKING_CURSOR_SUPPORT)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /*****************************************************************************
- * FUNCTION
- * gui_show_EMS_input_box_cursor
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * x [IN]
- * y [IN]
- * width [IN]
- * height [IN]
- * flags [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_show_EMS_input_box_cursor(UI_EMS_input_box *b, S32 x, S32 y, S32 width, S32 height, U32 flags)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 cursor_type = (U8) (flags & 0x0f);
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (cursor_type == 1)
- {
- x1 = x - 1;
- y1 = y;
- x2 = x;
- y2 = y + height - 1;
- if (x1 < (b->x + 1))
- {
- x1 = b->x + 1;
- }
- if (y1 < (b->y + 1))
- {
- y1 = b->y + 1;
- }
- if (x2 > (b->x + b->width - 2))
- {
- x2 = b->x + b->width - 2;
- }
- if (y2 > (b->y + b->height - 2))
- {
- y2 = b->y + b->height - 2;
- }
- #if(UI_BLINKING_CURSOR_SUPPORT)
- UI_inputbox_show_cursor(x1, y1, x2, y2, b->cursor_color);
- #else
- gui_fill_rectangle(x1, y1, x2, y2, b->cursor_color);
- #endif
- }
- else if (cursor_type == 2)
- {
- x1 = x - 2;
- y1 = y;
- x2 = x - 1;
- y2 = y + height - 1;
- if (x1 < (b->x + 1))
- {
- x1 = b->x + 1;
- }
- if (y1 < (b->y + 1))
- {
- y1 = b->y + 1;
- }
- if (x2 > (b->x + b->width - 2))
- {
- x2 = b->x + b->width - 2;
- }
- if (y2 > (b->y + b->height - 2))
- {
- y2 = b->y + b->height - 2;
- }
- #if(UI_BLINKING_CURSOR_SUPPORT)
- UI_inputbox_show_cursor(x1, y1, x2, y2, b->cursor_color);
- #else /* (UI_BLINKING_CURSOR_SUPPORT) */
- /* gui_draw_rectangle(x1,y1,x2,y2,b->cursor_color); */
- gui_fill_rectangle(x1, y1, x2, y2, b->cursor_color);
- #endif /* (UI_BLINKING_CURSOR_SUPPORT) */
- }
- else if (cursor_type == 3)
- {
- x1 = x - 1;
- y1 = y - 1;
- x2 = x + width - 1;
- y2 = y + height - 1;
- if (x1 < (b->x + 1))
- {
- x1 = b->x + 1;
- }
- if (y1 < (b->y + 1))
- {
- y1 = b->y + 1;
- }
- if (x2 > (b->x + b->width - 2))
- {
- x2 = b->x + b->width - 2;
- }
- if (y2 > (b->y + b->height - 2))
- {
- y2 = b->y + b->height - 2;
- }
- #if(UI_BLINKING_CURSOR_SUPPORT)
- //gui_cancel_timer(UI_inputbox_blink_cursor);
- //MTK Elvis
- StopMyTimer(BLINKING_CURSOR);
- /* MTK end */
- #endif /* (UI_BLINKING_CURSOR_SUPPORT) */
- gui_draw_rectangle(x1, y1, x2, y2, b->cursor_color);
- }
- }
- /* MTK end */
- /* CRLF/Esc sequence handling functions: */
- /* These must be made available in the EMS library */
- /* Navigates CRLF/Esc sequence as a single object */
- /* Currently assumes Little endian byte ordering only */
- /* Supports only steps=1 */
- /*****************************************************************************
- * FUNCTION
- * BackwardCurrentPositionSkipCR
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * RETURNS
- *
- *****************************************************************************/
- kal_uint16 BackwardCurrentPositionSkipCR(EMSData *data)
- {
- #ifdef __MMI_HINDI_ALG__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type current_character = 0;
- U8 object_type_check;
- EMSObject *o;
- EMSPosition p = data->CurrentPosition;
- EMSData *data_chk_type = data;
- UI_character_type dummy_c = 0;
- S32 prev_ems_moves = 0;
- UI_buffer_type check_ems_hindi_p;
- PU8 src_p;
- PU8 dest_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- check_ems_hindi_p = src_p = (data->textBuffer + data->CurrentPosition.OffsetToText);
- UI_STRING_GET_PREVIOUS_CHARACTER(check_ems_hindi_p, dummy_c); /* get previous character */
- if (UI_HINDI_CHARACTER_UCS2_RANGE(dummy_c))
- {
- /* Move by a syllable rather than by a character as in English */
- dest_p = hf_get_prev_cluster_p(data->textBuffer, src_p);
- prev_ems_moves = src_p - dest_p;
- prev_ems_moves = prev_ems_moves >> 1;
- object_type_check = gui_EMS_input_box_get_previous_object(data_chk_type, &p, ¤t_character, &o);
- if (object_type_check == 2)
- {
- prev_ems_moves = 1;
- }
- }
- else
- {
- prev_ems_moves = 1;
- }
- /* To be checked why its returning 0 for prev_ems_moves>1 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "BackwardCurrentPositionSkipCR[prev_ems_moves]:%d ", prev_ems_moves));
- MMI_ASSERT(!(prev_ems_moves < 0));
- if (BackwardCurrentPosition(data, prev_ems_moves) >= 1)
- #else /* __MMI_HINDI_ALG__ */
- if (BackwardCurrentPosition(data, 1) == 1)
- #endif /* __MMI_HINDI_ALG__ */
- {
- if (data->textBuffer == NULL)
- {
- return (1);
- }
- #if(EMS_USE_CRLF_COMBINATION)
- if (UI_TEST_LF_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText]))
- {
- if (BackwardCurrentPosition(data, 1) == 1)
- {
- if (!UI_TEST_CR_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText]))
- {
- ForwardCurrentPosition(data, 1);
- }
- }
- }
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- #if(EMS_USE_ESC_COMBINATION)
- if (BackwardCurrentPosition(data, 1) == 1)
- {
- if (!UI_TEST_ESC_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText]))
- {
- ForwardCurrentPosition(data, 1);
- }
- #ifdef __MMI_HINDI_ALG__
- else if ((UI_TEST_ESC_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText])) &&
- (data->textBuffer[data->CurrentPosition.OffsetToText + 1 == 0x09]))
- {
- ForwardCurrentPosition(data, 1);
- }
- #endif /* __MMI_HINDI_ALG__ */
- }
- #endif /* (EMS_USE_ESC_COMBINATION) */
- return (1);
- }
- return (0);
- }
- /* Navigates CRLF/Esc sequence as a single object */
- /* Currently assumes Little endian byte ordering only */
- /* Supports only steps=1 */
- /*****************************************************************************
- * FUNCTION
- * ForwardCurrentPositionSkipCR
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * RETURNS
- *
- *****************************************************************************/
- kal_uint16 ForwardCurrentPositionSkipCR(EMSData *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 count = 0;
- #ifdef __MMI_HINDI_ALG__
- UI_character_type current_character = 0;
- U8 object_type_check;
- EMSObject *o;
- EMSPosition p = data->CurrentPosition;
- EMSData *data_chk_type = data;
- UI_character_type dummy_c = 0;
- S32 next_ems_moves = 0;
- UI_buffer_type check_ems_hindi_p;
- PU8 src_p;
- PU8 dest_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- check_ems_hindi_p = src_p = (data->textBuffer + data->CurrentPosition.OffsetToText);
- UI_STRING_GET_NEXT_CHARACTER(check_ems_hindi_p, dummy_c); /* get previous character */
- if (UI_HINDI_CHARACTER_UCS2_RANGE(dummy_c))
- {
- /* Move by a syllable rather than by a character as in English */
- /* dest_p = hf_get_next_cluster_p(data->textBuffer,src_p); */
- dest_p = hf_get_next_cluster_p(src_p, src_p);
- next_ems_moves = dest_p - src_p;
- next_ems_moves = next_ems_moves >> 1;
- object_type_check = gui_EMS_input_box_get_next_object(data_chk_type, &p, ¤t_character, &o);
- /* PMT START FIX HINDI ISSUES 20060604 */
- if (object_type_check == 2 && (next_ems_moves >= 2) && p.Object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- /* Do nothing */
- }
- else if (object_type_check == 2)
- {
- next_ems_moves = 1;
- }
- /* PMT END FIX HINDI ISSUES 20060604 */
- }
- else
- {
- next_ems_moves = 1;
- }
- #endif /* __MMI_HINDI_ALG__ */
- if (data->textBuffer == NULL)
- {
- count = ForwardCurrentPosition(data, 1);
- return (count);
- }
- #if(EMS_USE_ESC_COMBINATION)
- if ((data->dcs == SMSAL_DEFAULT_DCS) &&
- (UI_TEST_ESC_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText])))
- {
- count = ForwardCurrentPosition(data, 1);
- if (count == 1)
- {
- ForwardCurrentPosition(data, 1);
- }
- }
- else
- #endif /* (EMS_USE_ESC_COMBINATION) */
- #if(EMS_USE_CRLF_COMBINATION)
- if (UI_TEST_CR_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText]))
- {
- count = ForwardCurrentPosition(data, 1);
- if (UI_TEST_LF_CHARACTER(data->textBuffer[data->CurrentPosition.OffsetToText]))
- {
- ForwardCurrentPosition(data, 1);
- }
- }
- else
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- {
- #ifdef __MMI_HINDI_ALG__
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "ForwardCurrentPositionSkipCR[next_ems_moves]:%d ", next_ems_moves));
- MMI_ASSERT(!(next_ems_moves < 0));
- count = ForwardCurrentPosition(data, next_ems_moves);
- /* PMT MISSED START 20060711 */
- if (count >= 1)
- {
- count = 1;
- }
- /* PMT MISSED END 20060711 */
- #else /* __MMI_HINDI_ALG__ */
- count = ForwardCurrentPosition(data, 1);
- #endif /* __MMI_HINDI_ALG__ */
- }
- return (count);
- }
- /* Moves the cursor forwards by the number of steps specified.
- Cursor starts at start position. (If data->CursorPosition is not at
- the given start position, then the cursor will be moved to start position first)
- The cursor will not move beyond one step before the given end position */
- /*****************************************************************************
- * FUNCTION
- * MoveCurrentPosition
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * start [?]
- * end [?]
- * steps [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void MoveCurrentPosition(EMSData *data, EMSPosition *start, EMSPosition *end, kal_uint16 steps)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 diff;
- U8 object_flag;
- U8 done_flag = 0;
- S32 count = 0;
- U8 back_flag = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- object_flag = 0;
- diff = data->CurrentPosition.OffsetToText - start->OffsetToText;
- if ((start->Object != NULL) && (start->Object->OffsetToText == start->OffsetToText))
- {
- object_flag = 1;
- }
- if (diff < 0)
- {
- while (!done_flag)
- {
- if (data->CurrentPosition.OffsetToText == start->OffsetToText)
- {
- if (object_flag)
- {
- if ((data->CurrentPosition.Object == start->Object) &&
- (data->CurrentPosition.Object->OffsetToText == start->OffsetToText))
- {
- BackwardCurrentPosition(data, 1);
- break;
- }
- }
- else
- {
- break;
- }
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- else if (diff > 0)
- {
- while (!done_flag)
- {
- if (data->CurrentPosition.OffsetToText == start->OffsetToText)
- {
- if (object_flag)
- {
- if ((data->CurrentPosition.Object == start->Object) &&
- (data->CurrentPosition.Object->OffsetToText == start->OffsetToText))
- {
- BackwardCurrentPosition(data, 1);
- break;
- }
- }
- else
- {
- break;
- }
- }
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- else
- {
- S32 old_OffsetToText = data->CurrentPosition.OffsetToText;
- while (data->CurrentPosition.OffsetToText == old_OffsetToText)
- {
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- while (!done_flag)
- {
- if (data->CurrentPosition.OffsetToText == start->OffsetToText)
- {
- if (object_flag)
- {
- if ((data->CurrentPosition.Object == start->Object) &&
- (data->CurrentPosition.Object->OffsetToText == start->OffsetToText))
- {
- BackwardCurrentPosition(data, 1);
- break;
- }
- }
- else
- {
- break;
- }
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- if (steps == 0)
- {
- return;
- }
- object_flag = 0;
- if ((end->Object != NULL) && (end->Object->OffsetToText == end->OffsetToText))
- {
- object_flag = 1;
- }
- if (data->CurrentPosition.OffsetToText == end->OffsetToText)
- {
- S32 old_OffsetToText = data->CurrentPosition.OffsetToText;
- while (data->CurrentPosition.OffsetToText == old_OffsetToText)
- {
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- count--;
- }
- while (!done_flag)
- {
- if (count >= steps)
- {
- break;
- }
- count++;
- if (data->CurrentPosition.OffsetToText == end->OffsetToText)
- {
- if (object_flag)
- {
- if ((data->CurrentPosition.Object == end->Object) &&
- (data->CurrentPosition.Object->OffsetToText == end->OffsetToText))
- {
- back_flag = 1;
- break;
- }
- }
- else
- {
- back_flag = 1;
- break;
- }
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- if (back_flag)
- {
- BackwardCurrentPosition(data, 1);
- }
- if (data->CurrentPosition.OffsetToText > end->OffsetToText)
- {
- BackwardCurrentPosition(data, 1);
- }
- }
- else
- {
- while (!done_flag)
- {
- if (count >= steps)
- {
- break;
- }
- count++;
- if (data->CurrentPosition.OffsetToText == end->OffsetToText)
- {
- if (object_flag)
- {
- if ((data->CurrentPosition.Object == end->Object) &&
- (data->CurrentPosition.Object->OffsetToText == end->OffsetToText))
- {
- back_flag = 1;
- break;
- }
- }
- else
- {
- back_flag = 1;
- break;
- }
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- if (back_flag)
- {
- BackwardCurrentPosition(data, 1);
- }
- if (data->CurrentPosition.OffsetToText >= end->OffsetToText)
- {
- if ((end->OffsetToText != data->textLength) && !((end->Object != NULL) && (end->Object != data->listHead)))
- {
- BackwardCurrentPosition(data, 1);
- }
- if ((data->CurrentPosition.Object != NULL) && (end->Object != NULL))
- {
- while (data->CurrentPosition.Object->OffsetToText > end->Object->OffsetToText)
- {
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- }
- }
- }
- /* Moves the cursor to a given position */
- /*****************************************************************************
- * FUNCTION
- * MoveCursorToPosition
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * dst [?]
- * RETURNS
- * void
- *****************************************************************************/
- void MoveCursorToPosition(EMSData *data, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 diff;
- U8 done_flag = 0;
- EMSPosition dst_copy = *dst;
- EMSPosition mapped_cursor_position;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_map_position(data, &dst_copy, dst);
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- diff = data->CurrentPosition.OffsetToText - dst->OffsetToText;
- if (diff < 0)
- {
- while (!done_flag)
- {
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.OffsetToText == dst->OffsetToText) &&
- (mapped_cursor_position.Object == dst->Object))
- {
- break;
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- else if (diff > 0)
- {
- while (!done_flag)
- {
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.OffsetToText == dst->OffsetToText) &&
- (mapped_cursor_position.Object == dst->Object))
- {
- break;
- }
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- else
- {
- S32 old_OffsetToText = data->CurrentPosition.OffsetToText;
- while (data->CurrentPosition.OffsetToText == old_OffsetToText)
- {
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- if (data->CurrentPosition.OffsetToText < old_OffsetToText)
- {
- ForwardCurrentPosition(data, 1);
- }
- while (!done_flag)
- {
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if (mapped_cursor_position.Object == dst->Object)
- {
- break;
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- }
- }
- }
- /* Moves the cursor backwards to the given position. If an object is encountered, it breaks */
- /* Returns 1 if dst is reached, otherwise, returns 0 */
- /*****************************************************************************
- * FUNCTION
- * BackwardCurrentPositionObject
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * dst [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 BackwardCurrentPositionObject(EMSData *data, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- U8 done = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- return (1);
- }
- while (!done)
- {
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- done = 1;
- break;
- }
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.Object != NULL) && (mapped_cursor_position.Object->Type != EMS_TYPE_TEXT_FORMAT))
- {
- break;
- }
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- done = 1;
- break;
- }
- }
- return (done);
- }
- /*****************************************************************************
- * FUNCTION
- * ForwardCurrentPositionObject
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * dst [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 ForwardCurrentPositionObject(EMSData *data, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- U8 done = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- return (1);
- }
- while (!done)
- {
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- done = 1;
- break;
- }
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.Object != NULL) && (mapped_cursor_position.Object->Type != EMS_TYPE_TEXT_FORMAT))
- {
- break;
- }
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- done = 1;
- break;
- }
- }
- return (done);
- }
- /* Moves the cursor backwards to the given position. If an object is encountered, it breaks */
- /* Returns 1 if dst is reached, otherwise, returns 0 */
- /*****************************************************************************
- * FUNCTION
- * BackwardCurrentPositionSeekObject
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * dst [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 BackwardCurrentPositionSeekObject(EMSData *data, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- U8 done = 0;
- U8 object_flag = 0;
- EMSPosition last_object_position = data->CurrentPosition;
- S32 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- return (1);
- }
- while (!done)
- {
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.Object != NULL) && (mapped_cursor_position.Object->Type != EMS_TYPE_TEXT_FORMAT))
- {
- last_object_position = data->CurrentPosition;
- object_flag = 1;
- if (count > 0)
- {
- break;
- }
- }
- if (BackwardCurrentPosition(data, 1) != 1)
- {
- done = 1;
- break;
- }
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- done = 1;
- break;
- }
- count++;
- }
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if (object_flag && (count > 0) &&
- ((data->CurrentPosition.OffsetToText != dst->OffsetToText) || (data->CurrentPosition.Object != dst->Object)))
- {
- MoveCursorToPosition(data, &last_object_position);
- }
- else if (mapped_cursor_position.Object == NULL)
- {
- MoveCursorToPosition(data, &last_object_position);
- }
- return (done);
- }
- /*****************************************************************************
- * FUNCTION
- * ForwardCurrentPositionSeekObject
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * dst [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 ForwardCurrentPositionSeekObject(EMSData *data, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition mapped_cursor_position;
- U8 done = 0;
- EMSPosition last_object_position = data->CurrentPosition;
- S32 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- return (1);
- }
- while (!done)
- {
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- if ((mapped_cursor_position.Object != NULL) && (mapped_cursor_position.Object->Type != EMS_TYPE_TEXT_FORMAT))
- {
- last_object_position = data->CurrentPosition;
- if (count > 0)
- {
- break;
- }
- }
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- done = 1;
- break;
- }
- if ((data->CurrentPosition.OffsetToText == dst->OffsetToText) && (data->CurrentPosition.Object == dst->Object))
- {
- done = 1;
- break;
- }
- count++;
- }
- MoveCursorToPosition(data, &last_object_position);
- return (done);
- }
- /* Returns true if the given position is the last position */
- /* p=un-mapped EMS position */
- /*****************************************************************************
- * FUNCTION
- * TestLastPosition
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * p [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 TestLastPosition(EMSData *data, EMSPosition *p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition dst;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_map_position(data, p, &dst);
- if ((dst.OffsetToText >= data->textLength) && (dst.Object == NULL))
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- /* Returns true if the given position is the first position */
- /* p=un-mapped EMS position */
- /*****************************************************************************
- * FUNCTION
- * TestFirstPosition
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * p [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 TestFirstPosition(EMSData *data, EMSPosition *p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((p->OffsetToText == 0) && (p->Object == NULL))
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_map_position
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * src [?]
- * dst [?]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_map_position(EMSData *data, EMSPosition *src, EMSPosition *dst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (data->listHead == NULL)
- {
- *dst = *src;
- }
- else
- {
- EMSObject *object;
- if (src->Object == NULL)
- {
- object = data->listHead;
- if (object->OffsetToText == src->OffsetToText)
- {
- #if(EMS_ENABLE_TESTFIX_OBJECT_ORDERING)
- /* Nov-21-2003: TESTFIX: text format object followed by EMS object fix */
- /* Object ordering must be as text format object followed by other objects to use this fix */
- if (object != NULL)
- {
- if (object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- if (object->next != NULL)
- {
- if (object->next->OffsetToText == object->OffsetToText)
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object->next;
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object;
- }
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object;
- }
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object;
- }
- }
- else
- {
- /* Nov-21-2003: TESTFIX: ends */
- #endif /* (EMS_ENABLE_TESTFIX_OBJECT_ORDERING) */
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object;
- #if(EMS_ENABLE_TESTFIX_OBJECT_ORDERING)
- /* Nov-21-2003: TESTFIX */
- }
- /* Nov-21-2003: TESTFIX: ends */
- #endif /* (EMS_ENABLE_TESTFIX_OBJECT_ORDERING) */
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = NULL;
- }
- }
- else
- {
- object = src->Object->next;
- if ((object != NULL) && (object->OffsetToText == src->OffsetToText))
- {
- #if(EMS_ENABLE_TESTFIX_OBJECT_ORDERING)
- /* Nov-21-2003: TESTFIX: text format object followed by EMS object fix */
- /* Object ordering must be as text format object followed by other objects to use this fix */
- if (object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- if (object->next != NULL)
- {
- if (object->next->OffsetToText == object->OffsetToText)
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object->next;
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = NULL;
- }
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = NULL;
- }
- }
- else
- {
- /* Nov-21-2003: TESTFIX: ends */
- #endif /* (EMS_ENABLE_TESTFIX_OBJECT_ORDERING) */
- dst->OffsetToText = src->OffsetToText;
- dst->Object = object;
- #if(EMS_ENABLE_TESTFIX_OBJECT_ORDERING)
- /* Nov-21-2003: TESTFIX */
- }
- /* Nov-21-2003: TESTFIX: ends */
- #endif /* (EMS_ENABLE_TESTFIX_OBJECT_ORDERING) */
- }
- else
- {
- dst->OffsetToText = src->OffsetToText;
- dst->Object = NULL;
- }
- }
- }
- }
- U8 EMS_view_mode = 0;
- #ifdef __MMI_MESSAGES_EMS__
- #define EMS_ANIMATION_TIME 500
- S32 EMS_current_predefined_sound_ID = -1;
- U8 EMS_object_pre_defined_sound_flag = 0;
- U8 EMS_object_user_defined_melody_flag = 0;
- PU8 EMS_editor_sound_icon = NULL;
- PU8 EMS_editor_melody_icon = NULL;
- S32 EMS_object_x = 0;
- S32 EMS_object_y = 0;
- S32 EMS_object_width = 0;
- S32 EMS_object_height = 0;
- S32 EMS_object_frame_counter = 0;
- S32 EMS_object_n_frames = 0;
- S32 EMS_object_current_frame_size = 0;
- S32 EMS_object_repeat_counter = 0;
- U8 EMS_object_animation_timer_flag = 0;
- U8 EMS_object_predefined_animation_timer_flag = 0;
- EMSObject *EMS_current_object = NULL;
- PU8 EMS_current_predefined_image;
- extern PU8 get_image(U16 i);
- extern void AudioPlayIMelodyString(U8 *string, U16 len, U8 style);
- extern U16 EMS_predefined_sounds[];
- #ifdef __MMI_AUDIO_PLAYER__
- extern BOOL mmi_audply_is_play_activated(void);
- #endif
- /*****************************************************************************
- * FUNCTION
- * EMS_normal_play_pre_defined_sound
- * DESCRIPTION
- *
- * PARAMETERS
- * ID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_normal_play_pre_defined_sound(S32 ID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ID < 0)
- {
- ID = 0;
- }
- if (ID > 9)
- {
- ID = 9;
- }
- EMS_current_predefined_sound_ID = EMS_predefined_sounds[ID];
- StopCurrentKeyPadTone();
- AudioPlayReq((U8) EMS_current_predefined_sound_ID, DEVICE_AUDIO_PLAY_ONCE);
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_normal_stop_pre_defined_sound
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_normal_stop_pre_defined_sound(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AudioStopReq((U8) EMS_current_predefined_sound_ID);
- }
- #include "Mdi_datatype.h"
- #include "Mdi_audio.h"
- /*****************************************************************************
- * FUNCTION
- * EMS_normal_play_user_defined_melody
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_normal_play_user_defined_melody(U8 *data, S32 length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mdi_audio_play_string(data, (U16) length, MDI_FORMAT_IMELODY, DEVICE_AUDIO_PLAY_ONCE, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_normal_stop_user_defined_melody
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_normal_stop_user_defined_melody(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mdi_audio_stop_string();
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_silent_play_pre_defined_sound
- * DESCRIPTION
- *
- * PARAMETERS
- * ID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_silent_play_pre_defined_sound(S32 ID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(ID);
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_silent_stop_pre_defined_sound
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_silent_stop_pre_defined_sound(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_silent_play_user_defined_melody
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_silent_play_user_defined_melody(U8 *data, S32 length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(data);
- UI_UNUSED_PARAMETER(length);
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_silent_stop_user_defined_melody
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_silent_stop_user_defined_melody(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- void (*EMS_play_pre_defined_sound) (S32 ID) = EMS_normal_play_pre_defined_sound;
- void (*EMS_stop_pre_defined_sound) (void) = EMS_normal_stop_pre_defined_sound;
- void (*EMS_play_user_defined_melody) (U8 *data, S32 length) = EMS_normal_play_user_defined_melody;
- void (*EMS_stop_user_defined_melody) (void) = EMS_normal_stop_user_defined_melody;
- /*****************************************************************************
- * FUNCTION
- * EMS_enable_audio_playback
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_enable_audio_playback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_play_pre_defined_sound = EMS_normal_play_pre_defined_sound;
- EMS_stop_pre_defined_sound = EMS_normal_stop_pre_defined_sound;
- EMS_play_user_defined_melody = EMS_normal_play_user_defined_melody;
- EMS_stop_user_defined_melody = EMS_normal_stop_user_defined_melody;
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_disable_audio_playback
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_disable_audio_playback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_play_pre_defined_sound = EMS_silent_play_pre_defined_sound;
- EMS_stop_pre_defined_sound = EMS_silent_stop_pre_defined_sound;
- EMS_play_user_defined_melody = EMS_silent_play_user_defined_melody;
- EMS_stop_user_defined_melody = EMS_silent_stop_user_defined_melody;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_measure_object
- * DESCRIPTION
- *
- * PARAMETERS
- * o [?]
- * width [?]
- * height [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_measure_object(EMSObject *o, S32 *width, S32 *height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *width = 0;
- *height = 0;
- switch (o->Type)
- {
- case EMS_TYPE_PIC:
- {
- *width = o->data->picture.hDim;
- *height = o->data->picture.vDim;
- }
- break;
- case EMS_TYPE_USERDEF_ANM:
- {
- *width = o->data->animation.hDim;
- *height = o->data->animation.vDim;
- }
- break;
- case EMS_TYPE_PREDEF_ANM:
- {
- PU8 image = get_image(EMS_predefined_animations[o->PredefNo]);
- gui_measure_image(image, width, height);
- }
- break;
- case EMS_TYPE_PREDEF_SND:
- {
- gui_measure_image(EMS_editor_sound_icon, width, height);
- }
- break;
- case EMS_TYPE_USERDEF_SND:
- {
- gui_measure_image(EMS_editor_melody_icon, width, height);
- }
- break;
- }
- }
- void gui_EMS_input_box_display_object_pic(S32 x,S32 y,U8* src,S32 src_size,S32 w,S32 h,S32 bits_per_pixel)
- {
- gdi_color palette[64]; // maximum is 64 colors
- switch(bits_per_pixel)
- {
- case 1:
- {
- palette[0] = gdi_act_color_from_rgb(255,255,255,255); // white
- palette[1] = gdi_act_color_from_rgb(255,0,0,0); // black
- }
- break;
- case 2:
- {
- palette[0] = gdi_act_color_from_rgb(255,0,0,0); // black
- palette[1] = gdi_act_color_from_rgb(255,85,85,85); // dark grey
- palette[2] = gdi_act_color_from_rgb(255,170,170,170); // light grey
- palette[3] = gdi_act_color_from_rgb(255,255,255,255); // white
- }
- break;
- case 6:
- {
- S32 R,G,B,index;
- const static S32 value[]={0,85,170,255};
- index = 0;
- for(R=0;R<4;R++)
- for(G=0;G<4;G++)
- for(B=0;B<4;B++,index++)
- palette[index] = gdi_act_color_from_rgb(255,value[R],value[G],value[B]);
- }
- break;
- default:
- MMI_ASSERT(0); // strange bits_per_pixel
- break;
- }
- gdi_bits_draw(
- x,y,
- src,
- src_size,
- w,h,
- bits_per_pixel,
- palette);
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_input_box_show_animation_frame
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_input_box_show_animation_frame(void)
- {
- S32 width,height;
- EMS_object_frame_counter++;
- if (EMS_object_frame_counter >= EMS_current_object->data->animation.cFrame)
- EMS_object_frame_counter = 0;
- width = EMS_current_object->data->animation.hDim;
- height = EMS_current_object->data->animation.vDim;
-
- gui_EMS_input_box_display_object_pic(
- EMS_object_x,EMS_object_y,
- (U8*) (EMS_current_object->data->animation.pdu
- + EMS_object_frame_counter * EMS_object_current_frame_size),
- EMS_object_current_frame_size,
- width,
- height,
- EMS_current_object->data->animation.bitsPerPixel);
- gui_BLT_double_buffer(EMS_object_x, EMS_object_y, EMS_object_x + width - 1, EMS_object_y + height - 1);
- if (EMS_current_object->data->animation.cFrame != 0)
- {
- if (EMS_object_frame_counter % EMS_current_object->data->animation.cFrame == 0)
- EMS_object_repeat_counter++;
- }
- if (EMS_current_object->data->animation.cRepeat != 0
- && EMS_object_repeat_counter >= EMS_current_object->data->animation.cRepeat)
- {
- gui_cancel_timer(NULL);
- }
- else
- {
- gui_start_timer((EMS_current_object->data->animation.Duration + 1) * 100, EMS_input_box_show_animation_frame);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_input_box_show_predefined_animation_frame
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_input_box_show_predefined_animation_frame(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_object_frame_counter++;
- if (EMS_object_frame_counter >= EMS_object_n_frames)
- {
- EMS_object_frame_counter = 0;
- }
- gui_push_clip();
- gui_set_clip(0, MMI_title_y + MMI_title_height, UI_device_width - 1, UI_device_height - MMI_button_bar_height - 2);
- gui_show_animated_image_frame(
- EMS_object_x,
- EMS_object_y,
- EMS_current_predefined_image,
- (S16) EMS_object_frame_counter);
- gui_pop_clip();
- #if(UI_DOUBLE_BUFFER_SUPPORT)
- gui_BLT_double_buffer(
- EMS_object_x,
- EMS_object_y,
- EMS_object_x + EMS_object_width - 1,
- EMS_object_y + EMS_object_height - 1);
- #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */
- gui_start_timer(EMS_ANIMATION_TIME, EMS_input_box_show_predefined_animation_frame);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_display_object
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * o [?]
- * display_cursor [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_display_object(S32 x, S32 y, EMSObject *o, U8 display_cursor)
- {
- #if(EMS_ENABLE_EDITOR_OBJECT_PLAYBACK)
- U8 playback_flag = 1;
- #else
- U8 playback_flag = 0;
- if (EMS_view_mode)
- playback_flag = 1;
- #endif
- switch (o->Type)
- {