gui_ems.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:414k
- case EMS_TYPE_PIC:
- gui_EMS_input_box_display_object_pic(
- x,y,
- (U8*)o->data->picture.pdu,
- o->data->picture.pdu_length,
- o->data->picture.hDim,o->data->picture.vDim,
- o->data->picture.bitsPerPixel);
- break;
- case EMS_TYPE_USERDEF_ANM:
- if (display_cursor)
- {
- EMS_object_x = x;
- EMS_object_y = y;
- EMS_object_frame_counter = 0;
- EMS_object_repeat_counter = 0;
- EMS_current_object = o;
- }
-
- EMS_object_current_frame_size = o->data->animation.pdu_length;
- if (o->data->animation.cFrame != 0)
- EMS_object_current_frame_size /= o->data->animation.cFrame;
- gui_EMS_input_box_display_object_pic(
- x,y,
- (U8*) o->data->animation.pdu,
- EMS_object_current_frame_size,
- o->data->animation.hDim,o->data->animation.vDim,
- o->data->animation.bitsPerPixel);
-
- if (display_cursor && playback_flag)
- {
- EMS_object_animation_timer_flag = 1;
- gui_start_timer((o->data->animation.Duration + 1) * 100, EMS_input_box_show_animation_frame);
- }
- break;
- case EMS_TYPE_PREDEF_ANM:
- {
- PU8 image = get_image(EMS_predefined_animations[o->PredefNo]);
- gui_show_animated_image_frame(x, y, image, 0);
- if (display_cursor && playback_flag)
- {
- EMS_object_x = x;
- EMS_object_y = y;
- gui_measure_image(image, &EMS_object_width, &EMS_object_height);
- EMS_object_n_frames = gui_image_n_frames(image);
- EMS_object_frame_counter = 0;
- EMS_current_object = o;
- EMS_current_predefined_image = image;
- EMS_object_predefined_animation_timer_flag = 1;
- gui_start_timer(EMS_ANIMATION_TIME, EMS_input_box_show_predefined_animation_frame);
- }
- }
- break;
- case EMS_TYPE_PREDEF_SND:
- {
- gui_show_transparent_image(x, y, EMS_editor_sound_icon, 0);
- if (display_cursor && playback_flag)
- {
- EMS_object_pre_defined_sound_flag = 1;
- EMS_play_pre_defined_sound(o->PredefNo);
- }
- }
- break;
- case EMS_TYPE_USERDEF_SND:
- {
- gui_show_transparent_image(x, y, EMS_editor_melody_icon, 0);
- if (display_cursor && playback_flag)
- {
- EMS_object_user_defined_melody_flag = 1;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- EMS_play_user_defined_melody(o->data->sound.pdu, o->data->sound.pdu_length);
- #endif
- /* MTK end */
- }
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_playback_object
- * DESCRIPTION
- *
- * PARAMETERS
- * o [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_playback_object(EMSObject *o)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (o->Type)
- {
- case EMS_TYPE_PREDEF_SND:
- {
- EMS_object_pre_defined_sound_flag = 1;
- EMS_play_pre_defined_sound(o->PredefNo);
- }
- break;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_TYPE_USERDEF_SND:
- {
- EMS_object_user_defined_melody_flag = 1;
- EMS_play_user_defined_melody(o->data->sound.pdu, o->data->sound.pdu_length);
- }
- break;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_cancel_object_focus
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_cancel_object_focus(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (EMS_object_animation_timer_flag)
- {
- gui_cancel_timer(EMS_input_box_show_animation_frame);
- EMS_object_animation_timer_flag = 0;
- }
- else if (EMS_object_predefined_animation_timer_flag)
- {
- gui_cancel_timer(EMS_input_box_show_predefined_animation_frame);
- EMS_object_predefined_animation_timer_flag = 0;
- }
- else if (EMS_object_pre_defined_sound_flag)
- {
- EMS_stop_pre_defined_sound();
- EMS_object_pre_defined_sound_flag = 0;
- }
- else if (EMS_object_user_defined_melody_flag)
- {
- EMS_stop_user_defined_melody();
- EMS_object_user_defined_melody_flag = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_set_text_format
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * o [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_set_text_format(UI_EMS_input_box *b, EMSObject *o)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 font_size = (U8) MEDIUM_FONT;
- U8 font_bold = 0;
- U8 font_italic = 0;
- U8 font_underline = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* color c={0,0,0,100}; */
- /* UI_EMS_inputbox_text_color=c; */
- if (o == NULL)
- {
- EMS_SET_FONT(&UI_EMS_inputbox_medium_font);
- EMS_SET_TEXT_COLOR(UI_EMS_inputbox_text_color);
- b->flags &=
- ~(UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT | UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER);
- }
- else
- {
- if (o->Type == EMS_TYPE_TEXT_FORMAT)
- {
- EMSTextFormat *t = &(o->data->text_format);
- b->flags &=
- ~(UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT | UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER);
- switch (t->Alignment)
- {
- case EMS_ALIGN_LEFT:
- b->flags |= UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT;
- break;
- case EMS_ALIGN_RIGHT:
- b->flags |= UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT;
- break;
- case EMS_ALIGN_CENTER:
- b->flags |= UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER;
- break;
- case EMS_ALIGN_LANG_DEP:
- b->flags |= UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT;
- break;
- }
- switch (t->FontSize)
- {
- case EMS_FONTSIZE_NORMAL:
- font_size = (U8) UI_EMS_inputbox_medium_font.size;
- /* c.r=0;c.g=0;c.b=0; */
- break;
- case EMS_FONTSIZE_LARGE:
- font_size = (U8) UI_EMS_inputbox_large_font.size;
- /* c.r=255;c.g=0;c.b=0; */
- break;
- case EMS_FONTSIZE_SMALL:
- font_size = (U8) UI_EMS_inputbox_small_font.size;
- /* c.r=0;c.g=0;c.b=255; */
- break;
- }
- #ifndef __MMI_TEXT_FORMAT_WITHOUT_BOLD__
- if (t->isBold)
- {
- font_bold = 1;
- }
- #endif /* __MMI_TEXT_FORMAT_WITHOUT_BOLD__ */
- if (t->isItalic)
- {
- font_italic = 1;
- }
- if (t->isUnderline)
- {
- font_underline = 1;
- }
- UI_EMS_inputbox_current_font.bold = font_bold;
- UI_EMS_inputbox_current_font.italic = font_italic;
- UI_EMS_inputbox_current_font.underline = font_underline;
- UI_EMS_inputbox_current_font.size = font_size;
- EMS_SET_FONT(&UI_EMS_inputbox_current_font);
- /* UI_EMS_inputbox_text_color=c; */
- EMS_SET_TEXT_COLOR(UI_EMS_inputbox_text_color);
- }
- }
- }
- #endif /* __MMI_MESSAGES_EMS__ */
- #define UI_EMS_INPUTBOX_N_BREAK_CHARACTERS 2
- UI_character_type EMS_input_box_break_characters[] = { ' ',
- /*
- * '.',
- * ',',
- * '\',
- * '/',
- * '-',
- * ':',
- * ';',
- * '?',
- * '!',
- * '|',
- * '+',
- * '=',
- * '_',
- */
- 'n'
- };
- UI_character_type EMS_input_box_new_line_character = (UI_character_type) 'n';
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_breakable_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_breakable_character(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < UI_EMS_INPUTBOX_N_BREAK_CHARACTERS; i++)
- {
- if ((UI_character_type) c == EMS_input_box_break_characters[i])
- {
- return (1);
- }
- }
- return (0);
- }
- #define UI_EMS_INPUT_BOX_BREAK_CHARACTER(c,flag)
- { S32 _ii_;
- flag=0;
- for(_ii_=0;_ii_<UI_EMS_INPUTBOX_N_BREAK_CHARACTERS;_ii_++)
- { if((UI_character_type)c==(UI_character_type)EMS_input_box_break_characters[_ii_])
- { flag=1;
- break;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_new_line_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_new_line_character(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((UI_character_type) c == EMS_input_box_new_line_character)
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- #if(EMS_USE_CRLF_COMBINATION)
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_insert_new_line
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_insert_new_line(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 ret = EMS_OK;
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- U8 s[4] = {0x00, 0x0D, 0x00, 0x0A};
- #else
- U8 s[4] = {0x0D, 0x00, 0x0A, 0x00};
- #endif
- S32 remaining_length;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if (b->UCS2_count > 0)
- {
- remaining_length = (EMS_get_remaining_length(b->data) >> 1);
- }
- else
- {
- remaining_length = EMS_get_remaining_length(b->data);
- }
- if (remaining_length < 2)
- {
- UI_editor_play_tone_cannot_insert();
- ret = EMS_NO_SPACE;
- return ret;
- }
- /* Overwrite mode is un-implemented */
- if (AddString(b->data, s, 2, NULL) == EMS_NO_SPACE)
- {
- UI_editor_play_tone_cannot_insert();
- b->overflow_callback();
- ret = EMS_NO_SPACE;
- }
- else
- {
- b->change_callback();
- }
- b->text_format.Alignment = EMS_ALIGN_LANG_DEP; // reset alignment when input 'enter' symbol
- gui_EMS_input_box_locate_cursor(b);
- return ret;
- }
- #else /* (EMS_USE_CRLF_COMBINATION) */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_insert_new_line
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_input_box_insert_new_line(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_EMS_input_box_insert_character(b, EMS_input_box_new_line_character);
- return EMS_OK;
- }
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- #if(0)
- UI_character_type TEMP_EMS_GET_OBJECT(EMSObject *o)
- { if((o!=NULL) && (o->Type==EMS_TYPE_PIC) && (o->data->picture.pdu!=NULL))
- { return((UI_character_type)((UI_character_type)'0'+(UI_character_type)(o->data->picture.pdu[0])));
- }
- else return((UI_character_type)' ');
- }
- void temp_print_object(EMSObject *o)
- {
- if(o==NULL) PRINT_INFORMATION(("-"));
- else if(o->Type==0) PRINT_INFORMATION(("*"));
- else if(o->Type==5) PRINT_INFORMATION(("%d",o->data->picture.pdu[0]));
- }
- void temp_print_next_object(EMSObject *o)
- {
- if(o==NULL) PRINT_INFORMATION(("-"));
- else if(o->next==NULL) PRINT_INFORMATION(("-"));
- else if(o->next->Type==0) PRINT_INFORMATION(("*"));
- else if(o->next->Type==5) PRINT_INFORMATION(("%d",o->next->data->picture.pdu[0]));
- }
- #endif /* (0) */
- #define EMS_SET_BREAK_POSITION()
- { break_line_width=line_width;
- break_line_height=line_height;
- break_line_object_count=line_object_count;
- break_line_alignment=line_alignment;
- break_line_text_object_count=line_text_object_count;
- }
- #define EMS_SET_NEXT_BREAK_POSITION()
- { break_line_width=line_width;
- break_line_height=line_height;
- break_line_object_count=line_object_count+1;
- break_line_alignment=line_alignment;
- break_line_text_object_count=line_text_object_count;
- }
- /*****************************************************************************
- * FUNCTION
- * EMS_handle_CRLF_navigation
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_handle_CRLF_navigation(EMSData *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 r;
- EMSPosition p;
- UI_character_type c;
- EMSObject *o;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if(EMS_USE_CRLF_COMBINATION)
- p = data->CurrentPosition;
- r = gui_EMS_input_box_get_next_object(data, &p, &c, &o);
- if ((r == 1) && UI_TEST_LF_CHARACTER(c))
- {
- p = data->CurrentPosition;
- r = gui_EMS_input_box_get_previous_object(data, &p, &c, &o);
- if ((r == 1) && UI_TEST_CR_CHARACTER(c))
- {
- BackwardCurrentPosition(data, 1);
- return;
- }
- }
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- #if(EMS_USE_ESC_COMBINATION)
- if (data->dcs == SMSAL_DEFAULT_DCS)
- {
- p = data->CurrentPosition;
- r = gui_EMS_input_box_get_previous_object(data, &p, &c, &o);
- if ((r == 1) && UI_TEST_ESC_CHARACTER(c))
- {
- BackwardCurrentPosition(data, 1);
- }
- }
- #endif /* (EMS_USE_ESC_COMBINATION) */
- }
- #define EMS_EDITOR_DRAW_DOTTED_LINE(x1,x2,y,c)
- { S32 i,xx1=(x1),xx2=(x2),yy=(y);
- for(i=xx1;i<=xx2;i++)
- { if(i&1) gui_putpixel(i,yy,c);
- }
- }
- #define EMS_EDITOR_DRAW_LINE(x1,x2,y,c)
- { S32 i,xx1=(x1),xx2=(x2),yy=(y);
- for(i=xx1;i<=xx2;i++)
- { gui_putpixel(i,yy,c);
- }
- }
- U8 EMS_object_width_cache[128];
- U8 EMS_object_height_cache[128];
- U16 EMS_object_str_cache[128];
- /* Gurinder - 03/15/2004 - EMS Input Box InfoBar BG Image */
- extern S32 wgui_EMS_inputbox_information_bar_height;
- #define MAX_EMS_DISP_CLUSTER_LEN 50
- /* START TARUN PMT 20050128 */
- #ifdef __MMI_HINDI_ALG__
- extern BOOL cancelWidth;
- #endif
- //END TARUN PMT 20050128
- //W05.52 Fix Cursor Moviong issue for ESC character
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_back_cursor_for_ESC_character
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * position [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_back_cursor_for_ESC_character(EMSData *data, EMSPosition *position)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSObject *current_object;
- UI_character_type current_character;
- U8 object_type;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- object_type = gui_EMS_input_box_get_previous_object(data, position, ¤t_character, ¤t_object); /* get next character */
- if (1 == object_type)
- {
- if (UI_TEST_ESC_CHARACTER(current_character))
- {
- if (BackwardCurrentPositionSkipCR(data) != 1)
- {
- UI_editor_play_tone_cannot_navigate();
- }
- }
- }
- }
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- /*****************************************************************************
- * FUNCTION
- * gui_is_ems_object_can_display_in_editor
- * DESCRIPTION
- *
- * PARAMETERS
- * type [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL gui_is_ems_object_can_display_in_editor(U8 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (type == EMS_TYPE_PREDEF_SND ||
- type == EMS_TYPE_USERDEF_SND ||
- type == EMS_TYPE_PREDEF_ANM || type == EMS_TYPE_USERDEF_ANM || type == EMS_TYPE_PIC)
- {
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_insert_character_into_buffer
- * DESCRIPTION
- *
- * PARAMETERS
- * buffer [?]
- * offset [IN]
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_insert_character_into_buffer(U16 *buffer, U16 offset, UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type p1, p2;
- UI_character_type old_c;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- p1 = p2 = ((U8*) buffer) + offset;
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- }
- /*****************************************************************************
- * FUNCTION
- * gui_delete_character_from_buffer
- * DESCRIPTION
- *
- * PARAMETERS
- * buffer [?]
- * offset [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_delete_character_from_buffer(U16 *buffer, U16 offset)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type p1, p2;
- UI_character_type c, old_c;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- p1 = p2 = ((U8*) buffer) + offset;
- c = *p1;
- p1 += 2;
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, c);
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_get_ems_text_actual_idx
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * OffsetToText [IN]
- * RETURNS
- *
- *****************************************************************************/
- U16 gui_get_ems_text_actual_idx(UI_EMS_input_box *b, U16 OffsetToText)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSData *data = b->data;
- EMSObject *cur_obj = data->listHead;
- U16 offset = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (cur_obj != NULL)
- {
- if (gui_is_ems_object_can_display_in_editor((U8) cur_obj->Type))
- {
- if (cur_obj->OffsetToText < OffsetToText)
- {
- offset += 2;
- }
- else
- {
- return (OffsetToText + offset);
- }
- }
- cur_obj = cur_obj->next;
- }
- return (OffsetToText + offset);
- }
- #define dummy_char 0x01
- U16 object_position[128];
- U8 object_no = 0;
- /*****************************************************************************
- * FUNCTION
- * gui_ems_data_apply_shaping
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * text_shaping_buffer [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_ems_data_apply_shaping(UI_EMS_input_box *b, U16 *text_shaping_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSData *data = b->data;
- EMSObject *cur_obj = data->listHead;
- S32 i = 0;
- S32 text_len = (b->data->textLength / 2);
- MMI_BOOL has_ems_display_object = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- object_no = 0;
- while (cur_obj != NULL)
- {
- if (gui_is_ems_object_can_display_in_editor((U8) cur_obj->Type))
- {
- has_ems_display_object = MMI_TRUE;
- gui_insert_character_into_buffer(
- text_shaping_buffer,
- cur_obj->OffsetToText + (object_no * 2),
- (UI_character_type) dummy_char);
- text_len++;
- object_position[object_no] = cur_obj->OffsetToText / 2 + object_no + 1;
- object_no++;
- }
- cur_obj = cur_obj->next;
- }
- unshaped_text_len = text_len;
- #ifdef __MMI_ZI__
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_ARABIC__) && defined(__MMI_ZI_PERSIAN__)
- ZiStringShapeEx(ZI8_LANG_FA, (U16*) & text_len, (U16*) text_shaping_buffer, (U16*) OrgToSha, NULL); /* 19 is the Arabic id */
- #elif defined(__MMI_ZI_PERSIAN__)
- ZiStringShapeEx(ZI8_LANG_FA, (U16*) & text_len, (U16*) text_shaping_buffer, (U16*) OrgToSha, NULL); /* 19 is the Arabic id */
- #elif defined(__MMI_ZI_ARABIC__)
- ZiStringShapeEx(ZI8_LANG_AR, (U16*) & text_len, (U16*) text_shaping_buffer, (U16*) OrgToSha, NULL); /* 19 is the Arabic id */
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape2((U16*) & text_len, (U16*) text_shaping_buffer, (U16*) OrgToSha, NULL);
- #endif /* __MMI_ZI_V7__ */
-
- #else /* __MMI_ZI__ */
- ArabicShapeEngine2((U16*) & text_len, (U16*) text_shaping_buffer, (U16*) OrgToSha, NULL);
- #endif /* __MMI_ZI__ */
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /*****************************************************************************
- * FUNCTION
- * gui_show_EMS_input_box
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_show_EMS_input_box(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_show_EMS_input_box_ext(b, (-1), (-1));
- }
- /*****************************************************************************
- * FUNCTION
- * gui_show_EMS_input_box_ext
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * move_to_x [IN]
- * move_to_y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_show_EMS_input_box_ext(UI_EMS_input_box *b, S32 move_to_x, S32 move_to_y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1; /* x1,y1 -> left-top corner of the editor windows */
- S32 x2, y2; /* x2,y2 -> right-bottom of the editor windows */
- UI_filled_area f; /* Gurinder - 03/15/2004 - EMS Input Box InfoBar BG Image */
- U8 selection_flag = 0;
- U8 overwrite_mode_flag = 0;
- S32 tx = 0, ty; /* specify the positon at which the text display starts */
- EMSData *data = b->data;
- UI_character_type current_character = 0, pre2_character = 0, pre_character = 0;
- EMSPosition current_position;
- EMSPosition line_start_position;
- EMSPosition previous_position;
- U8 object_type;
- EMSObject *current_object;
- S32 line_width, line_height;
- S32 break_line_width, break_line_height;
- S32 object_width, object_height;
- U8 done = 0;
- U8 display_done;
- EMSObject *current_text_format;
- EMSObject *line_start_text_format;
- U32 flags = b->flags;
- S32 set_cursor_flag = 0;
- S32 center_x, box_width;
- S32 line_object_count;
- S32 cursor_ax, cursor_ay; /* Absolute cursor co-ordinates */
- S32 break_line_object_count;
- S32 text_format_object_count, break_text_format_object_count;
- U8 disable_draw_flag = 0;
- U8 *object_width_cache = EMS_object_width_cache;
- U8 *object_height_cache = EMS_object_height_cache;
- U8 word_highlight = 0;
- /* byte has_ems_boundary_flag = 0; //Gurinder - 03/15/2004 - EMS Input Box InfoBar BG Image */
- S32 n_lines = 0;
- U8 first_object_flag;
- EMSPosition mapped_cursor_position;
- EMSPosition mapped_current_position;
- EMSPosition mapped_previous_position;
- U8 cursor_displayed_flag = 0;
- U8 alignment, break_line_alignment = EMS_ALIGN_LANG_DEP, line_alignment;
- S32 line_text_object_count, break_line_text_object_count;
- color normal_text_color = b->normal_text_color;
- color selected_text_color = b->selected_text_color;
- /* PMT LANGUAGE START 20051221 */
- #if defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__)
- U16 unicode = 0;
- U16 clFill = 0;
- #endif /* defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__) */
- //PMT LANGUAGE END 20051221
- //START PMT NEERAJ 20050916
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES)
- S32 minimum_line_height;
- S32 last_line_y = 0;
- #endif /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- /* END PMT NEERAJ 20050916 */
- #if(EMS_ENABLE_SPECIAL_FONT_DISPLAY)
- color underline_color = b->underline_color;
- color strikethrough_color = b->strikethrough_color;
- color paragraph_color = b->paragraph_color;
- U8 underline_flag = 0, strikethrough_flag = 0;
- #endif /* (EMS_ENABLE_SPECIAL_FONT_DISPLAY) */
- #ifdef __MMI_HINDI_ALG__
- PU8 move_ems_cursor_prev_p = data->textBuffer;
- PU8 move_ems_cursor_curr_p = data->textBuffer;
- PU8 temp_ems_cursor_p = data->textBuffer;
- PU8 move_ems_cursor_disp_prev_p = data->textBuffer;
- PU8 move_ems_cursor_disp_curr_p = data->textBuffer;
- U16 disp_ems_cluster[MAX_EMS_DISP_CLUSTER_LEN];
- S32 skip_ems_moves = 1; /* for skipping by cluster */
- S32 saved_ems_skip_moves = 1;
- S32 display_ems_skip_moves = 1; /* for skipping by cluster while display */
- S32 saved_ems_display_skip_moves = 0;
- S32 ems_cluster_width = 0;
- S32 ems_cursor_width = 0;
- U8 kdx = 0;
- S32 hindi_ems_cluster_counter = 0;
- /* Performance related to store the cluster width */
- S32 hindi_cluster_cache[50];
- S32 hindi_cache_counter = 0;
- /* MTK Begin Hindi patch 0425 */
- BOOL set_hindi_text_format_flag = MMI_FALSE;
- EMSObject *hindi_text_format = NULL;
- /* MTK End Hindi patch 0425 */
- #endif /* __MMI_HINDI_ALG__ */
- PMT_BIDI_TYPES default_direction = BIDI_L;
- S32 vbar_x = 0, vbar_button_x = 0;
- #ifdef __MMI_BIDI_ALG__
- U16 logical_cur_pos;
- U8 *temp_text_pt;
- U16 temp_text_position;
- U8 temp_text_buffer[MAX_NUM_OF_CHAR_FOR_EACH_LINE];
- U16 temp_cursor_position;
- U16 visual_str_len;
- U16 visual_cur_pos;
- U16 logical_hilight_start;
- U16 logical_hilight_end;
- U16 visual_hilight_start;
- U16 visual_hilight_end;
- U16 temp_hilight_start;
- U16 temp_hilight_end;
- PMT_BIDI_TYPES default_line_direction = BIDI_L;
- pBOOL reverse_flag;
- S32 num_char;
- U32 iCount;
- pBOOL arabic_char_flag = MMI_FALSE;
- U8 lastest_char_type;
- UI_character_type test_current_character;
- /* PMT NO_AR_SL_DU START 20050909 */
- S32 text_len;
- PU8 ptr_text_buffer;
- /* PMT NO_AR_SL_DU END 20050909 */
- #endif /* __MMI_BIDI_ALG__ */
- #if defined(__MMI_LANG_VIETNAMESE__)
- UI_character_type dummy_c = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT RAKESH START 20061006 */
- #if defined __MMI_HINDI_ALG__
- overwrite_current_language_for_hindi_rules_based_on_input_method();
- #endif
- /* PMT RAKESH END 20061006 */
- if (((-1) != move_to_x) || ((-1) != move_to_y))
- {
- flags |= UI_EMS_INPUT_BOX_DISABLE_DRAW;
- }
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- if ((b->data->textLength / ENCODING_LENGTH) != 0)
- {
- if (!(flags & UI_EMS_INPUT_BOX_VIEW_MODE))
- {
- pfnUnicodeStrncpy(
- (S8*) shaping_str,
- (const S8*)b->data->textBuffer,
- b->data->textLength / ENCODING_LENGTH);
- gui_ems_data_apply_shaping(b, shaping_str);
- }
- else
- {
- pfnUnicodeStrncpy(
- (S8*) shaping_str,
- (const S8*)b->data->textBuffer,
- b->data->textLength / ENCODING_LENGTH);
- gui_ems_data_apply_shaping(b, shaping_str);
- #ifdef __MMI_HINDI_ALG__
- move_ems_cursor_prev_p = data->textBuffer;
- move_ems_cursor_curr_p = data->textBuffer;
- temp_ems_cursor_p = data->textBuffer;
- move_ems_cursor_disp_prev_p = data->textBuffer;
- move_ems_cursor_disp_curr_p = data->textBuffer;
- #endif /* __MMI_HINDI_ALG__ */
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- #if defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__)
- /* U16 unicode = 0;
- U16 clFill = 0; */
- /* PMT LANGUAGE END 20051221 */
- HINDI_PRESENT = 0;
- ARABIC_PRESENT = 0;
- while ((data->textBuffer[clFill] != ' ' || data->textBuffer[clFill + 1] != ' ') && !HINDI_PRESENT)
- {
- unicode = data->textBuffer[clFill];
- unicode |= (data->textBuffer[clFill + 1] << 8);
- if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
- {
- HINDI_PRESENT = 1;
- ARABIC_PRESENT = 0;
- }
- /* PMT LANGUAGE START 20051221 */
- else if (IS_ARABIC_CHARACTER(unicode))
- {
- ARABIC_PRESENT = 1;
- HINDI_PRESENT = 0;
- }
- /* PMT LANGUAGE END 20051221 */
- clFill += 2;
- }
- #endif /* defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__) */
- /* END PMTFARHAD 20050224 */
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_DRAW) && (data->textLength != 0))
- {
- bidi_get_char_type(data->textBuffer, (U8*) & default_direction);
- if (default_direction == BIDI_R || default_direction == AL)
- {
- default_direction = BIDI_R;
- }
- else
- {
- default_direction = BIDI_L;
- }
- for (iCount = 0; iCount < (U32) (data->textLength >> 1); iCount++)
- {
- bidi_get_char_type((U8*) (data->textBuffer + iCount * ENCODING_LENGTH), (U8*) & lastest_char_type);
- if ((lastest_char_type == AL) || (lastest_char_type == AN) || (lastest_char_type == BIDI_R))
- {
- arabic_char_flag = MMI_TRUE;
- break;
- }
- }
- }
- #endif /* __MMI_BIDI_ALG__ */
- #if 0
- #ifdef __MMI_BIDI_ALG__
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if defined __MMI_LANG_HINDI__ && ( defined __MMI_LANG_ARABIC__|| defined __MMI_LANG_PERSIAN__ )
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if defined __MMI_LANG_HINDI__ && ( defined __MMI_LANG_ARABIC__|| defined __MMI_LANG_PERSIAN__ )
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if defined __MMI_LANG_HINDI__ && ( defined __MMI_LANG_ARABIC__|| defined __MMI_LANG_PERSIAN__ )
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if defined __MMI_LANG_HINDI__ && ( defined __MMI_LANG_ARABIC__|| defined __MMI_LANG_PERSIAN__ )
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #ifdef __MMI_HINDI_ALG__
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- #endif /* 0 */
- if (r2lMMIFlag)
- {
- x1 = b->x + b->vbar.width;
- }
- else
- {
- x1 = b->x;
- }
- y1 = b->y;
- x2 = b->x /* x1 */ + b->width - 1;
- y2 = y1 + b->height - 1;
- b->display_height = 0;
- #ifdef __MMI_HINDI_ALG__
- memset(disp_ems_cluster, 0, sizeof(disp_ems_cluster));
- #endif
- if (flags & UI_EMS_INPUT_BOX_DISABLE_DRAW)
- {
- disable_draw_flag = 1;
- }
- if (flags & UI_EMS_INPUT_BOX_VIEW_MODE)
- {
- EMS_view_mode = 1;
- }
- else
- {
- EMS_view_mode = 0;
- }
- if (!disable_draw_flag)
- {
- if (flags & UI_EMS_INPUT_BOX_STATE_SELECTED)
- {
- f = *b->selected_filler;
- }
- else if (flags & UI_EMS_INPUT_BOX_STATE_DISABLED)
- {
- f = *b->disabled_filler;
- }
- /* Gurinder - 03/15/2004 - EMS Input Box InfoBar BG Image */
- else
- {
- f = *b->normal_filler;
- }
- if (r2lMMIFlag)
- {
- gui_set_clip(x1 - b->vbar.width, y1, x2 + 2 /* +b->vbar.width */ , y2 + 2);
- }
- else
- {
- gui_set_clip(x1, y1, x2 + 2, y2 + 2);
- }
- /* Gurinder - 03/15/2004 - EMS Input Box InfoBar BG Image */
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_BACKGROUND)) /* if not disable background then do ... */
- {
- if (!(flags & UI_EMS_INPUT_BOX_INCLUDE_INFO_AREA)) /* not include info area */
- {
- /* 070405 Calvin Start */
- if (r2lMMIFlag)
- {
- if ((wgui_is_wallpaper_on_bottom() == MMI_TRUE) &&
- (flags & UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND))
- {
- gdi_draw_solid_rect(
- x1 - b->vbar.width,
- y1,
- x2 /* +b->vbar.width */ ,
- y2,
- GDI_COLOR_TRANSPARENT);
- }
- else
- {
- gui_draw_filled_area(x1 - b->vbar.width, y1, x2 /* +b->vbar.width */ , y2, &f);
- }
- }
- else
- {
- if ((wgui_is_wallpaper_on_bottom() == MMI_TRUE) &&
- (flags & UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND))
- {
- gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
- }
- else
- {
- gui_draw_filled_area(x1, y1, x2, y2, &f);
- }
- }
- /* 070405 Calvin End */
- }
- else /* include info area */
- {
- if (r2lMMIFlag)
- {
- gui_set_clip(
- x1 - b->vbar.width,
- y1 - wgui_EMS_inputbox_information_bar_height,
- x2 /* +b->vbar.width */ ,
- y2);
- }
- else
- {
- gui_set_clip(x1, y1 - wgui_EMS_inputbox_information_bar_height, x2, y2);
- }
- f.flags = UI_FILLED_AREA_TYPE_BITMAP;
- f.b = get_image(WGUI_VOLUME_LEVEL1);
- if (r2lMMIFlag)
- {
- /* 070405 Calvin Start */
- if ((wgui_is_wallpaper_on_bottom() == MMI_TRUE) &&
- (flags & UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND))
- {
- gdi_draw_solid_rect(
- x1 - b->vbar.width,
- y1 - wgui_EMS_inputbox_information_bar_height,
- x2 /* + b->vbar.width */ ,
- y2,
- GDI_COLOR_TRANSPARENT);
- }
- else
- {
- gui_draw_filled_area(
- x1 - b->vbar.width,
- y1 - wgui_EMS_inputbox_information_bar_height,
- x2 /* + b->vbar.width */ ,
- y2,
- &f);
- }
- /* 070405 Calvin End */
- gui_draw_rectangle(
- x1 - b->vbar.width,
- y1,
- x2 /* + b->vbar.width */ ,
- y2,
- b->boundary_color);
- }
- else
- {
- /* 070405 Calvin Start */
- if ((wgui_is_wallpaper_on_bottom() == MMI_TRUE) &&
- (flags & UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND))
- {
- gdi_draw_solid_rect(
- x1,
- y1 - wgui_EMS_inputbox_information_bar_height,
- x2,
- y2,
- GDI_COLOR_TRANSPARENT);
- }
- else
- {
- gui_draw_filled_area(x1, y1 - wgui_EMS_inputbox_information_bar_height, x2, y2, &f);
- }
- /* 070405 Calvin End */
- gui_draw_rectangle(x1, y1, x2, y2, b->boundary_color);
- }
- if (flags & UI_MULTI_LINE_INPUT_BOX_USE_PRESET_CLIPPING)
- {
- gui_set_clip_preset(x1, y1, x2 + 2, y2 + 2);
- }
- else
- {
- gui_set_clip(x1, y1, x2 + 2, y2 + 2);
- }
- }
- }
- }
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_SCROLLBAR))
- {
- x2 -= b->vbar.width;
- }
- box_width = (x2 - x1 - 2);
- center_x = x1 + (box_width >> 1) + 1;
- ty = y1 + 2 + b->display_y;
- if (flags & UI_EMS_INPUT_BOX_DISPLAY_HEADER)
- {
- S32 h, ty1, ty2;
- h = b->measure_header();
- b->header_height = h;
- ty1 = ty - 2;
- ty2 = ty + h - 1;
- if (!disable_draw_flag && (ty2 > y1))
- {
- b->display_header(x1, ty1, x2, ty2);
- }
- ty += h;
- }
- else
- {
- b->header_height = 0;
- }
- if (!disable_draw_flag)
- {
- if (flags & UI_EMS_INPUT_BOX_STATE_MULTITAP)
- {
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- selection_flag = 0;
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- selection_flag = 1;
- }
- if ((flags & UI_EMS_INPUT_BOX_OVERWRITE_MODE) && (!selection_flag))
- {
- overwrite_mode_flag = 1;
- }
- gui_set_clip(x1 + 1, y1 + 1, x2, y2 - 1);
- EMS_SET_FONT(&UI_EMS_inputbox_medium_font);
- /* gui_set_text_clip(x1+2,y1+2,x2-2,y2-2); */
- EMS_SET_TEXT_COLOR(normal_text_color);
- }
- line_start_position.Object = NULL;
- line_start_position.OffsetToText = 0;
- current_text_format = NULL;
- cursor_ay = 0;
- text_format_object_count = 0;
- b->first_displayed_line = -1;
- b->last_displayed_line = -1;
- EMS_map_position(data, &data->CurrentPosition, &mapped_cursor_position);
- line_alignment = EMS_ALIGN_LANG_DEP;
- #if defined(__MMI_LANG_VIETNAMESE__)
- /* W05.38 Fix Viet Tone Cursor Moving Issue */
- if ((flags & UI_EMS_INPUT_BOX_DISABLE_DRAW) && (data->textLength != 0))
- {
- EMSPosition temp_cursor_position;
- EMS_map_position(data, &data->CurrentPosition, &temp_cursor_position);
- object_type = gui_EMS_input_box_get_next_object(data, &temp_cursor_position, ¤t_character, ¤t_object);
- if (1 == object_type)
- {
- if ((current_character >= 0x0300) && (current_character <= 0x0323))
- {
- EMS_map_position(data, &data->CurrentPosition, &temp_cursor_position);
- object_type = gui_EMS_input_box_get_previous_object(data, &temp_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);
- gui_EMS_input_box_forward_cursor(b);
- }
- }
- }
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- while (!done)
- { /* First Pass: Find the start and end of a line, line height and line width */
- line_start_text_format = current_text_format;
- #ifdef __MMI_MESSAGES_EMS__
- gui_EMS_input_box_set_text_format(b, current_text_format);
- #else /* __MMI_MESSAGES_EMS__ */
- {
- EMS_SET_FONT(&UI_EMS_inputbox_medium_font);
- EMS_SET_TEXT_COLOR(UI_EMS_inputbox_text_color);
- b->flags &= ~(UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT | UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER);
- }
- #endif /* __MMI_MESSAGES_EMS__ */
- break_line_height = line_height = gui_get_character_height();
- current_position = line_start_position;
- break_text_format_object_count = text_format_object_count;
- /* PMT SHAILESH START 20060619 */
- #ifdef __MMI_HINDI_ALG__
- break_line_width = line_width = 1;
- #else
- break_line_width = line_width = 0;
- #endif
- /* PMT SHAILESH END 20060619 */
- break_line_object_count = line_object_count = 0;
- break_line_text_object_count = line_text_object_count = 0;
- #ifdef __MMI_HINDI_ALG__
- hindi_cache_counter = 0;
- saved_ems_skip_moves = skip_ems_moves = 1;
- object_width = 0;
- move_ems_cursor_prev_p = (data->textBuffer + line_start_position.OffsetToText); /* TARUN */
- #endif /* __MMI_HINDI_ALG__ */
- first_object_flag = 1;
- while (!done)
- {
- previous_position = current_position;
- if (TestLastPosition(data, ¤t_position))
- {
- current_character = 0;
- EMS_SET_BREAK_POSITION();
- /* MTK Terry for adjust the line width with italic style */
- if (UI_EMS_inputbox_current_font.italic && pre_character != 0)
- {
- break_line_width += 3;
- }
- done = 1;
- break;
- }
- #ifdef __MMI_HINDI_ALG__
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_EMS_input_box[skip_ems_moves]:%d ", skip_ems_moves));
- while (skip_ems_moves--)
- {
- #endif /* __MMI_HINDI_ALG__ */
- object_type = gui_EMS_input_box_get_next_object(
- data,
- ¤t_position,
- ¤t_character,
- ¤t_object);
- #ifdef __MMI_HINDI_ALG__
- /* MTK Begin Hindi patch 0425 */
- if ((skip_ems_moves >= 1) && (object_type == 2) && (current_object->Type == EMS_TYPE_TEXT_FORMAT))
- {
- object_type = gui_EMS_input_box_get_next_object(
- data,
- ¤t_position,
- ¤t_character,
- ¤t_object);
- }
- /* MTK End Hindi patch 0425 */
- }
- /* Not when object is images */
- if (HF_HINDI_RANGE(current_character) && !(object_type == 2))
- {
- object_type = 1;
- }
- #endif /* __MMI_HINDI_ALG__ */
- switch (object_type)
- {
- case 0:
- done = 1;
- break;
- case 1: /* character */
- #if(EMS_DISPLAY_SPECIAL_CHARACTERS)
- if (UI_TEST_CR_CHARACTER(current_character) ||
- UI_TEST_LF_CHARACTER(current_character) || UI_TEST_ESC_CHARACTER(current_character))
- {
- object_width = 10;
- object_height = 10;
- }
- else
- #else /* (EMS_DISPLAY_SPECIAL_CHARACTERS) */
- #if(EMS_USE_CRLF_COMBINATION)
- if (UI_TEST_CR_CHARACTER(current_character) &&
- (current_position.OffsetToText < data->textLength) &&
- UI_TEST_LF_CHARACTER(data->textBuffer[current_position.OffsetToText]))
- {
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- #endif
- object_width = 0;
- object_height = line_height;
- }
- else if (UI_TEST_LF_CHARACTER(current_character) || UI_TEST_CR_CHARACTER(current_character))
- {
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- #endif
- object_width = 0;
- object_height = line_height;
- }
- else
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- #if(EMS_USE_ESC_COMBINATION)
- if (UI_TEST_ESC_CHARACTER(current_character))
- {
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- #endif
- object_width = 0;
- object_height = line_height;
- }
- else
- #endif /* (EMS_USE_ESC_COMBINATION) */
- #endif /* (EMS_DISPLAY_SPECIAL_CHARACTERS) */
- if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- /* PMT FARHAD START 20050708 */
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- /* PMT Start 20060725 */
- move_ems_cursor_prev_p += 2;
- /* PMT End 20060725 */
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT FARHAD END 20050708 */
- object_width = 0;
- object_height = line_height;
- }
- else
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- object_type = gui_EMS_input_box_get_next_object(data, ¤t_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);
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else if (0 != object_type)
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- if (IS_ARABIC_CHARACTER(current_character))
- {
- U32 idx = gui_get_ems_text_actual_idx(b, current_position.OffsetToText) / 2 - 1;
- U32 ligature_move = 0;
- UI_character_type dummy_c_arabic = 0;
- current_character = (UI_character_type) shaping_str[OrgToSha[idx]];
- while (idx < unshaped_text_len)
- {
- if (OrgToSha[idx] == OrgToSha[idx + 1])
- {
- ligature_move++;
- }
- else
- {
- break;
- }
- idx++;
- }
- while (ligature_move > 0)
- {
- object_type = gui_EMS_input_box_get_next_object(data, ¤t_position, &dummy_c_arabic, ¤t_object); /* get next character */
- ligature_move--;
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- #ifdef __MMI_HINDI_ALG__
- /* MTK Terry for Cursor Height Issue */
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- /* PMT START FIX HINDI ISSUES 20060604 */
- gui_measure_character(current_character, &object_width, &object_height);
- if (object_height > line_height)
- {
- line_height = object_height;
- }
- object_height = gui_get_character_height();
- /* PMT END FIX HINDI ISSUES 20060604 */
- }
- else
- {
- gui_measure_character(current_character, &object_width, &object_height);
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_EMS_input_box[object_height]:%d ",
- object_height));
- #else /* __MMI_HINDI_ALG__ */
- gui_measure_character(current_character, &object_width, &object_height);
- #endif /* __MMI_HINDI_ALG__ */
- if (!RequireToMoveCursor(pre_character, current_character))
- {
- object_width = 0;
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- /* START TARUN PMT 20050128 */
- move_ems_cursor_prev_p += 2;
- /* END TARUN PMT 20050128 */
- #endif /* __MMI_HINDI_ALG__ */
- }
- else
- {
- #ifdef __MMI_HINDI_ALG__
- /* Move pointer by the cluster width */
- //For performance issue b->text is also assumed as current cluster pos
- //move_ems_cursor_curr_p = hf_get_next_cluster_p(data->textBuffer,move_ems_cursor_prev_p);
- move_ems_cursor_curr_p = hf_get_next_cluster_p(move_ems_cursor_prev_p, move_ems_cursor_prev_p);
- skip_ems_moves = move_ems_cursor_curr_p - move_ems_cursor_prev_p; /* Number of moves */
- skip_ems_moves = skip_ems_moves >> 1;
- saved_ems_skip_moves = skip_ems_moves; /* Save moves to skip the current_text_p also */
- /* Calculate the width of current cluster as well as english character */
- /* object_width = hf_size_of_current_cluster(data->textBuffer,move_ems_cursor_curr_p,0); */
- object_width = hf_size_of_current_cluster(move_ems_cursor_prev_p, move_ems_cursor_curr_p, 0);
- /* for bold italic in hindi */
- if (UI_EMS_inputbox_current_font.italic || UI_EMS_inputbox_current_font.bold)
- {
- object_width += 1;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_EMS_input_box[object_width]:%d ",
- object_width));
- if (UI_TEST_CR_CHARACTER(current_character))
- {
- object_width = 0;
- }
- move_ems_cursor_prev_p = move_ems_cursor_curr_p;
- #else /* __MMI_HINDI_ALG__ */
- /* Arabic Connectivity issue */
- #if defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__
- if (!IS_ARABIC_CHARACTER(current_character))
- {
- #endif
- /* PMT START 17082006 */
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- /* PMT END 17082006 */
- {
- object_width += 1;
- }
- #if defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__
- }
- #endif
- #endif /* __MMI_HINDI_ALG__ */
- }
- }
- /* MTK Terry for adjust the line width with italic style */
- if ((line_width + object_width + 1) > box_width ||
- (UI_EMS_inputbox_current_font.italic && (line_width + object_width + 3) > box_width))
- {
- line_width += object_width;
- }
- else
- {
- U8 bflag;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- EMS_SET_NEXT_BREAK_POSITION();
- }
- line_width += object_width;
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- hindi_ems_cluster_counter = line_object_count;
- while (saved_ems_skip_moves--)
- {
- object_width_cache[hindi_ems_cluster_counter] = 0;
- object_height_cache[hindi_ems_cluster_counter] = (U8) object_height;
- hindi_ems_cluster_counter++;
- }
- hindi_cluster_cache[hindi_cache_counter] = object_width;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- object_width_cache[line_object_count] = (U8) object_width;
- /*
- * #ifdef __MMI_BIDI_ALG__
- * if(arabic_char_flag)
- * object_height_cache[line_object_count]=(byte)gui_get_character_height()+2;
- * else
- * #endif
- */
- object_height_cache[line_object_count] = (U8) object_height;
- }
- if (object_height > line_height)
- {
- line_height = object_height;
- }
- #ifdef __MMI_HINDI_ALG__
- line_object_count += skip_ems_moves;
- line_text_object_count += skip_ems_moves;
- hindi_cache_counter++;
- #else /* __MMI_HINDI_ALG__ */
- line_object_count++;
- line_text_object_count++;
- #endif /* __MMI_HINDI_ALG__ */
- if (UI_STRING_LINE_BREAK_CHARACTER(current_character))
- {
- EMS_SET_BREAK_POSITION();
- if (text_format_object_count <= 1)
- {
- line_alignment = EMS_ALIGN_LANG_DEP;
- }
- }
- if (text_format_object_count)
- {
- text_format_object_count--;
- if ((text_format_object_count == 0) && (current_position.OffsetToText < data->textLength))
- {
- #ifdef __MMI_MESSAGES_EMS__
- gui_EMS_input_box_set_text_format(b, &UI_EMS_normal_text_format_object);
- #else /* __MMI_MESSAGES_EMS__ */
- {
- EMS_SET_FONT(&UI_EMS_inputbox_medium_font);
- EMS_SET_TEXT_COLOR(UI_EMS_inputbox_text_color);
- b->flags &= ~(UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER);
- }
- #endif /* __MMI_MESSAGES_EMS__ */
- object_height = gui_get_character_height();
- if (object_height > line_height)
- {
- line_height = object_height;
- }
- if (line_object_count == 0)
- {
- line_height = object_height;
- }
- }
- }
- /* MTK Terry for FireFly#159 */
- #ifdef __MMI_HINDI_ALG__
- /* Hindi condition also added for word wrap issue */
- if ((!UI_MULTI_LINE_INPUT_BOX_ALPHABETIC_CHARACTER(current_character)) &&
- (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character)))
- #else /* __MMI_HINDI_ALG__ */
- if ((!UI_MULTI_LINE_INPUT_BOX_ALPHABETIC_CHARACTER(current_character)))
- #endif /* __MMI_HINDI_ALG__ */
- {
- break_line_object_count = 0;
- }
- }
- pre2_character = pre_character;
- pre_character = current_character;
- /* MTK end */
- break;
- #ifdef __MMI_MESSAGES_EMS__
- case 2: /* object */
- if (current_object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- line_alignment = current_object->data->text_format.Alignment;
- gui_EMS_input_box_set_text_format(b, current_object);
- text_format_object_count = ((current_object->data->text_format.textLength) >> 1);
- object_height = gui_get_character_height();
- if (object_height > line_height)
- {
- line_height = object_height;
- }
- if (line_object_count == 0)
- {
- line_height = object_height;
- }
- }
- else
- {
- gui_EMS_input_box_measure_object(current_object, &object_width, &object_height);
- object_width += 2;
- if (first_object_flag)
- {
- object_width += 1;
- }
- else
- {
- line_width += 3;
- }
- object_height += 1; /* 1 pixel gap between lines */
- /* MTK Elvis 20040322 to avoid the cursor overlap with scroll bar */
- if ((line_width + object_width + 1) > box_width)
- /* MTK end */
- {
- line_width += object_width;
- /* Removed line breaking rule for objects */
- /* EMS_SET_BREAK_POSITION(); */
- }
- else
- {
- if (object_height > line_height)
- {
- line_height = object_height;
- }
- line_width += object_width;
- if (first_object_flag)
- {
- object_width -= 2;
- }
- object_width_cache[line_object_count] = (S8) object_width;
- object_height_cache[line_object_count] = (S8) object_height;
- line_object_count++;
- /* Removed line breaking rule for objects */
- /* EMS_SET_BREAK_POSITION(); */
- }
- }
- current_character = 0;
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- #endif
- break;
- /* PMT FARHAD START 20050708 */
- #else /* __MMI_MESSAGES_EMS__ */
- case 2: /* object */
- current_character = 0;
- #ifdef __MMI_HINDI_ALG__
- skip_ems_moves = 1;
- #endif
- break;
- /* PMT FARHAD END 20050708 */
- #endif /* __MMI_MESSAGES_EMS__ */
- }
- first_object_flag = 0;
- /* MTK Elvis to avoid the cursor overlap with scroll bar */
- /* MTK Terry for adjust the line width with italic style only for character type */
- if ((line_width + 1 > box_width) ||
- (UI_EMS_inputbox_current_font.italic && (line_width + 3) > box_width) && (1 == object_type) ||
- UI_STRING_LINE_BREAK_CHARACTER(current_character))
- /* MTK end */
- {
- if ((break_line_object_count == 0) && (line_object_count > 0))
- {
- EMS_SET_BREAK_POSITION();
- break_line_width -= object_width;
- }
- /* MTK Terry for adjust the line width with italic style */
- if ((UI_EMS_inputbox_current_font.italic && (line_width + 3) > box_width) && pre_character != 0)
- {
- break_line_width += 3;
- }
- break;
- }
- }
- /* Second pass: Display the line */
- pre2_character = 0;
- pre_character = 0;
- #ifdef __MMI_HINDI_ALG__
- ems_cluster_width = 0;
- ems_cursor_width = 0;
- #endif /* __MMI_HINDI_ALG__ */
- line_width = break_line_width;
- line_height = break_line_height;
- current_text_format = line_start_text_format;
- current_position = line_start_position;
- alignment = break_line_alignment;
- if ((alignment != b->text_format.Alignment) &&
- (break_line_text_object_count == 0) && (b->current_line == n_lines) && (EMS_view_mode == 0))
- {
- alignment = b->text_format.Alignment;
- }
- /* Old code: For testing */
- /* else if((break_line_text_object_count!=0) && (data->textLength==0))
- alignment=b->text_format.Alignment; */
- switch (alignment)
- {
- case EMS_ALIGN_LEFT:
- if (default_direction == BIDI_L)
- {
- tx = x1 + 2;
- }
- else
- {
- tx = x1 + line_width + 2;
- }
- break;
- case EMS_ALIGN_RIGHT:
- if (default_direction == BIDI_L)
- {
- tx = x2 - line_width - 2;
- }
- else
- {
- tx = x1 + box_width;
- }
- break;
- case EMS_ALIGN_CENTER:
- if (default_direction == BIDI_L)
- {
- tx = center_x - (line_width >> 1);
- }
- else
- {
- tx = center_x + (line_width >> 1);
- }
- break;
- case EMS_ALIGN_LANG_DEP:
- if (default_direction == BIDI_L)
- {
- tx = x1 + 2;
- }
- else
- {
- tx = x1 + box_width;
- }
- break;
- default:
- tx = x1 + 2;
- break;
- }
- if (tx < (x1 + 2))
- {
- tx = x1 + 2;
- }
- cursor_ax = tx - (x1 + 2);
- if ((b->first_displayed_line == -1) && (ty >= (y1 + 2)))
- {
- b->first_displayed_line = n_lines;
- }
- if ((ty + line_height) <= y2)
- {
- b->last_displayed_line = n_lines;
- }
- b->line_positions[n_lines] = line_start_position;
- b->line_object_counts[n_lines] = (U8) break_line_object_count;
- b->line_x_positions[n_lines] = (U8) cursor_ax;
- n_lines++;
- #ifdef __MMI_MESSAGES_EMS__
- gui_EMS_input_box_set_text_format(b, current_text_format);
- #else /* __MMI_MESSAGES_EMS__ */
- {
- EMS_SET_FONT(&UI_EMS_inputbox_medium_font);
- EMS_SET_TEXT_COLOR(UI_EMS_inputbox_text_color);
- b->flags &= ~(UI_EMS_INPUT_BOX_CURRENT_ALIGN_LEFT |
- UI_EMS_INPUT_BOX_CURRENT_ALIGN_RIGHT | UI_EMS_INPUT_BOX_CURRENT_ALIGN_CENTER);
- }
- #endif /* __MMI_MESSAGES_EMS__ */
- object_height = gui_get_character_height();
- text_format_object_count = break_text_format_object_count;
- display_done = 0;
- line_object_count = 0;
- #ifdef __MMI_HINDI_ALG__
- hindi_cache_counter = 0;
- #endif
- first_object_flag = 1;
- #if(EMS_ENABLE_SPECIAL_FONT_DISPLAY)
- if (current_text_format != NULL)
- {
- if (current_text_format->data->text_format.isUnderline == KAL_TRUE)
- {
- underline_flag = 1;
- }
- else
- {
- underline_flag = 0;
- }
- if (current_text_format->data->text_format.isStrikethrough == KAL_TRUE)
- {
- strikethrough_flag = 1;
- }
- else
- {
- strikethrough_flag = 0;
- }
- }
- #endif /* (EMS_ENABLE_SPECIAL_FONT_DISPLAY) */
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- /* get last character unicode of previous line */
- if (n_lines == 1)
- {
- if (break_line_text_object_count < data->textLength / 2)
- {
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- test_current_character = (data->textBuffer[current_position.OffsetToText +
- ((1 + break_line_text_object_count) * ENCODING_LENGTH) -
- 1] | (data->textBuffer[current_position.OffsetToText +
- ((1 +
- break_line_text_object_count) *
- ENCODING_LENGTH) - 2] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- test_current_character = (data->textBuffer[current_position.OffsetToText +
- ((1 + break_line_text_object_count) * ENCODING_LENGTH) -
- 2] | (data->textBuffer[current_position.OffsetToText +
- ((1 +
- break_line_text_object_count) *
- ENCODING_LENGTH) - 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- }
- else
- {
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- test_current_character = (data->textBuffer[current_position.OffsetToText +
- ((break_line_text_object_count) * ENCODING_LENGTH) - 1] |
- (data->textBuffer[current_position.OffsetToText +
- ((break_line_text_object_count) * ENCODING_LENGTH) -
- 2] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- test_current_character = (data->textBuffer[current_position.OffsetToText +
- ((break_line_text_object_count) * ENCODING_LENGTH) - 2] |
- (data->textBuffer[current_position.OffsetToText +
- ((break_line_text_object_count) * ENCODING_LENGTH) -
- 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- }
- }
- else
- {
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- test_current_character = (data->textBuffer[current_position.OffsetToText - 1] |
- (data->textBuffer[current_position.OffsetToText - 2] << 8));
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- test_current_character = (data->textBuffer[current_position.OffsetToText - 2] |
- (data->textBuffer[current_position.OffsetToText - 1] << 8));
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- }
- if (line_text_object_count > break_line_text_object_count)
- {
- num_char = break_line_text_object_count + 1;
- }
- else
- {
- num_char = break_line_text_object_count; /* line_text_object_count; */
- }
- MMI_ASSERT(!(num_char > ((MAX_NUM_OF_CHAR_FOR_EACH_LINE >> 1) - 1)));
- if (((mapped_cursor_position.OffsetToText) / ENCODING_LENGTH) <
- ((current_position.OffsetToText) / ENCODING_LENGTH))
- {
- logical_cur_pos = 0xFFFF;
- }
- else if ((((mapped_cursor_position.OffsetToText) - (current_position.OffsetToText)) / ENCODING_LENGTH) >
- (num_char))
- {
- logical_cur_pos = 0xFFFF;
- }
- else
- {
- logical_cur_pos =
- ((mapped_cursor_position.OffsetToText) - (current_position.OffsetToText)) / ENCODING_LENGTH;
- }
- if ((n_lines > 1 && logical_cur_pos == 0))
- {
- /* pfnEncodingSchemeToUnicode(&test_current_character, (data->textBuffer + current_position.OffsetToText - ENCODING_LENGTH)); */
- if (!UI_STRING_LINE_BREAK_CHARACTER(test_current_character))
- {
- logical_cur_pos = 0xFFFF;
- }
- }
- //if(UI_STRING_LINE_BREAK_CHARACTER(current_character))
- // logical_cur_pos = 0xFFFF;
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- {
- logical_hilight_start = 0;
- logical_hilight_end = 0;
- }
- bidi_get_char_type(data->textBuffer + current_position.OffsetToText, (U8*) & default_line_direction);
- if (default_line_direction == BIDI_R || default_line_direction == AL)
- {
- default_line_direction = BIDI_R;
- }
- else
- {
- default_line_direction = BIDI_L;
- }
- if (default_direction == BIDI_R && default_line_direction == BIDI_R)
- {
- reverse_flag = MMI_TRUE;
- }
- else if (default_direction == BIDI_R && default_line_direction == BIDI_L)
- {
- reverse_flag = MMI_TRUE;
- }
- else if (default_direction == BIDI_L && default_line_direction == BIDI_R)
- {
- reverse_flag = MMI_FALSE;
- }
- else if (default_direction == BIDI_L && default_line_direction == BIDI_L)
- {
- reverse_flag = MMI_FALSE;
- }
- bidi_main(
- data->textBuffer + current_position.OffsetToText,
- (U16) num_char,
- logical_cur_pos,
- visual_str,
- &visual_str_len,
- &visual_cur_pos,
- reverse_flag,
- MMI_bidi_input_type,
- logical_hilight_start,
- logical_hilight_end,
- &visual_hilight_start,
- &visual_hilight_end);
- temp_text_position = current_position.OffsetToText;
- memcpy(
- temp_text_buffer,
- data->textBuffer + current_position.OffsetToText,
- visual_str_len * ENCODING_LENGTH);
- memcpy(data->textBuffer + current_position.OffsetToText, visual_str, visual_str_len * ENCODING_LENGTH);
- temp_cursor_position = mapped_cursor_position.OffsetToText;
- if (visual_cur_pos != 0xFFFF)
- {
- mapped_cursor_position.OffsetToText =
- line_start_position.OffsetToText + (visual_cur_pos * ENCODING_LENGTH);
- }
-
- //if (default_line_direction == BIDI_L || (default_direction == BIDI_L && default_line_direction == BIDI_R))
- if(arabic_char_flag)
- {
- pfnUnicodeStrncpy(
- (S8*) shaping_str,
- (const S8*)b->data->textBuffer,
- b->data->textLength / ENCODING_LENGTH);
- gui_ems_data_apply_shaping(b, shaping_str);
- }
-
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- }
- #endif /* __MMI_BIDI_ALG__ */ /* endif of __MMI_BIDI_ALG__ */
- while (!display_done)
- {
- previous_position = current_position;
- if (line_object_count >= break_line_object_count)
- {
- break;
- }
- if (flags & UI_EMS_INPUT_BOX_WORD_HIGHLIGHT)
- {
- if (current_position.OffsetToText == b->highlight_start_position.OffsetToText)
- {
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- word_highlight = 0;
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- word_highlight = 1;
- }
- if (current_position.OffsetToText == b->highlight_end_position.OffsetToText)
- {
- word_highlight = 0;
- }
- }
- object_type = gui_EMS_input_box_get_next_object(
- data,
- ¤t_position,
- ¤t_character,
- ¤t_object);
- EMS_map_position(data, &previous_position, &mapped_previous_position);
- EMS_map_position(data, ¤t_position, &mapped_current_position);
- switch (object_type)
- {
- int no_show_char;
- case 0:
- current_character = 0;
- display_done = 1;
- break;
- case 1: /* character */
- /* MTK Steven for speed up Editor by only display the characters in the display area */
- no_show_char = 0;
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_DRAW))
- {
- if (((ty + line_height) < (y1 + 2)) || ((ty - line_height) > y2))
- {
- no_show_char = 1;
- }
- }
- #ifdef __MMI_HINDI_ALG__
- /* MTK Begin Hindi patch 0425 */
- if (set_hindi_text_format_flag == MMI_TRUE)
- {
- gui_EMS_input_box_set_text_format(b, hindi_text_format);
- set_hindi_text_format_flag = MMI_FALSE;
- current_text_format = hindi_text_format;
- }
- /* MTK End Hindi patch 0425 */
- #endif /* __MMI_HINDI_ALG__ */
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- object_type = gui_EMS_input_box_get_next_object(data, ¤t_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);
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- object_type = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- if (IS_ARABIC_CHARACTER(current_character))
- {
- U32 idx = gui_get_ems_text_actual_idx(b, current_position.OffsetToText) / 2 - 1;
- U32 ligature_move = 0;
- UI_character_type dummy_c_arabic = 0;
- current_character = (UI_character_type) shaping_str[OrgToSha[idx]];
- while (idx < unshaped_text_len)
- {
- if (OrgToSha[idx] == OrgToSha[idx + 1])
- {
- ligature_move++;
- }
- else
- {
- break;
- }
- idx++;
- }
- while (ligature_move > 0)
- {
- object_type = gui_EMS_input_box_get_next_object(data, ¤t_position, &dummy_c_arabic, ¤t_object); /* get next character */
- ligature_move--;
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- gui_measure_character(current_character, &object_width, &object_height);
- if (!RequireToMoveCursor(pre_character, current_character))
- {
- object_width = 0;
- }
- else
- {
- /* Arabic Connectivity issue */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- /* PMT START 17082006 */
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- /* PMT END 17082006 */
- if (!IS_ARABIC_CHARACTER(current_character))
- #endif /* __MMI_LANG_ARABIC__ */
- object_width++;
- }
- object_width_cache[line_object_count] = object_width;
- }
- #endif /* __MMI_BIDI_ALG__ */
- object_width = object_width_cache[line_object_count];
- object_height = object_height_cache[line_object_count];
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character)) /* space shud have been added in the Hindi range */
- {
- if (!(TestLastPosition(data, &previous_position)))
- {
- //For performance issues first argument= second srgument
- //move_ems_cursor_disp_curr_p = hf_get_next_cluster_p(data->textBuffer,move_ems_cursor_disp_prev_p);
- move_ems_cursor_disp_curr_p = hf_get_next_cluster_p(move_ems_cursor_disp_prev_p, move_ems_cursor_disp_prev_p);
- display_ems_skip_moves = move_ems_cursor_disp_curr_p - move_ems_cursor_disp_prev_p;
- display_ems_skip_moves = display_ems_skip_moves >> 1;
- /* ems_cluster_width=ems_cursor_width=hf_size_of_current_cluster(data->textBuffer,move_ems_cursor_disp_curr_p,0); */
- #if 0
- /* under construction !*/
- #else /* 0 */
- ems_cluster_width = ems_cursor_width = hindi_cluster_cache[hindi_cache_counter];
- #endif /* 0 */
- move_ems_cursor_disp_prev_p = move_ems_cursor_disp_curr_p;
- saved_ems_display_skip_moves = display_ems_skip_moves;
- display_ems_skip_moves--;
- for (kdx = 0; kdx < display_ems_skip_moves; kdx++)
- {
- object_type = gui_EMS_input_box_get_next_object(
- data,
- ¤t_position,
- ¤t_character,
- ¤t_object);
- /* MTK Begin Hindi patch 0425 */
- if (display_ems_skip_moves >= 1 && object_type == 2 &&
- current_object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- hindi_text_format = current_object;
- set_hindi_text_format_flag = MMI_TRUE;
- object_type = gui_EMS_input_box_get_next_object(
- data,
- ¤t_position,
- ¤t_character,
- ¤t_object);
- }
- /* MTK End Hindi patch 0425 */
- }
- }
- }
- else
- {
- move_ems_cursor_disp_prev_p += 2;
- saved_ems_display_skip_moves = 1;
- }
- #endif /* __MMI_HINDI_ALG__ */
- if (!disable_draw_flag)
- {
- EMS_SET_TEXT_COLOR(normal_text_color);
- if (default_direction == BIDI_R)
- {
- /* START FARHAD PMT 20050211 */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- tx -= ems_cluster_width;
- cursor_ax -= ems_cursor_width;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- tx -= object_width;
- cursor_ax -= object_width;
- }
- /* END FARHAD PMT 20050211 */
- }
- /* MTK end */
- if (word_highlight ||
- (overwrite_mode_flag &&
- !cursor_displayed_flag &&
- (mapped_previous_position.OffsetToText == mapped_cursor_position.OffsetToText)) ||
- (selection_flag &&
- (mapped_current_position.OffsetToText == mapped_cursor_position.OffsetToText)))
- {
- S32 rx1, ry1, rx2, ry2;
- rx1 = tx;
- /* PMT START FIX HINDI ISSUES 20060604 */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- S32 h, w;
- gui_measure_character(current_character, &w, &h);
- /* PMT BEGIN 29082006 */
- ry1 = ty;
- /* PMT END 29082006 */
- rx2 = rx1 + ems_cluster_width - 1;
- ry2 = ry1 + h - 1;
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "pixtel_UI_show_EMS_input_box[ems_cluster_width]:%d ",
- ems_cluster_width));
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- ry1 = line_height - object_height + ty;
- rx2 = rx1 + object_width - 1;
- ry2 = ry1 + object_height - 1;
- }
- /* PMT END FIX HINDI ISSUES 20060604 */
- EMS_SET_TEXT_COLOR(selected_text_color);
- #ifdef __MMI_HINDI_ALG__
- /* PMT START 17082006 */
- if (MMI_current_input_mode == INPUT_MODE_SMART_HINDI)
- {
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- gui_fill_rectangle(rx1, ry1, rx2 + 2, ry2, b->selection_color);
- }
- else
- {
- gui_fill_rectangle(rx1 + 2, ry1, rx2 + 2, ry2, b->selection_color);
- }
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT END 17082006 */
- gui_fill_rectangle(rx1, ry1, rx2, ry2, b->selection_color);
- }
- /* PMT START FIX HINDI ISSUES 20060604 */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- /* PMT START 29082006 */
- EMS_MOVE_TEXT_CURSOR(tx, ty);
- /* PMT END 29082006 */
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT END FIX HINDI ISSUES 20060604 */
- EMS_MOVE_TEXT_CURSOR(tx, line_height - object_height + ty);
- #if(EMS_DISPLAY_SPECIAL_CHARACTERS)
- if (UI_TEST_CR_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- tx,
- line_height - object_height + ty,
- (PU8) EMS_CR_display_character,
- 0);
- }
- else if (UI_TEST_LF_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- tx,
- line_height - object_height + ty,
- (PU8) EMS_LF_display_character,
- 0);
- }
- else if (UI_TEST_ESC_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- tx,
- line_height - object_height + ty,
- (PU8) EMS_ESC_display_character,
- 0);
- }
- else
- #endif /* (EMS_DISPLAY_SPECIAL_CHARACTERS) */
- {
- /* MTK Terry for Skip Special Character Issue */
- if (!(
- #if(EMS_USE_ESC_COMBINATION)
- UI_TEST_ESC_CHARACTER(current_character) ||
- #endif
- #if(EMS_PREVENT_CRLF_DISPLAY)
- UI_TEST_LF_CHARACTER(current_character) || UI_TEST_CR_CHARACTER(current_character)
- ||
- #endif /* (EMS_PREVENT_CRLF_DISPLAY) */
- UI_STRING_END_OF_STRING_CHARACTER(current_character)))
- {
- /* gui_print_character(current_character); */
- #ifdef __MMI_HINDI_ALG__
- PU8 prev_temp_ems_cursor_p;
- if (TestLastPosition(data, &previous_position))
- {
- goto end_ems_disp;
- }
- //Performance issues
- //temp_ems_cursor_p = hf_get_next_cluster_p(data->textBuffer,temp_ems_cursor_p);
- prev_temp_ems_cursor_p = temp_ems_cursor_p;
- temp_ems_cursor_p = hf_get_next_cluster_p(temp_ems_cursor_p, temp_ems_cursor_p);
- /* if(hf_get_current_cluster(data->textBuffer,temp_ems_cursor_p,disp_ems_cluster)) */
- if (hf_get_current_cluster(prev_temp_ems_cursor_p, temp_ems_cursor_p, disp_ems_cluster))
- {
- S32 disp_len = pfnUnicodeStrlen((PS8) disp_ems_cluster);
- MMI_ASSERT(!(disp_len > MAX_EMS_DISP_CLUSTER_LEN));
- /* To avoid rule appln in showstring */
- hf_disable_hindi_rules_parsing();
- hf_padding_value(0);
- /* START TARUN PMT 20050128 */
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- if (no_show_char != 1)
- {
- cancelWidth = 1;
- /* PMT MAUI_00015716 START FIX */
- if (underline_flag)
- {
- UI_font->underline = 0;
- }
- /* PMT MAUI_00015716 END FIX */
- ShowString(
- UI_text_x,
- UI_text_y,
- *UI_font,
- 0,
- (U8*) (disp_ems_cluster),
- /* PMT MAUI_00015716 START FIX */
- object_height);
- if (underline_flag)
- {
- UI_font->underline = 1;
- }
- /* PMT MAUI_00015716 END FIX */
- cancelWidth = 0;
- }
- }
- else
- {
- if (no_show_char != 1)
- {
- cancelWidth = 1;
- /* PMT MAUI_00015716 START FIX */
- if (underline_flag)
- {
- UI_font->underline = 0;
- }
- /* PMT MAUI_00015716 END FIX */
- ShowString(
- UI_text_x,
- UI_text_y,
- *UI_font,
- 0,
- (U8*) (disp_ems_cluster),
- UI_text_height);
- /* PMT MAUI_00015716 START FIX */
- if (underline_flag)
- {
- UI_font->underline = 1;
- }
- /* PMT MAUI_00015716 END FIX */
- cancelWidth = 0;
- }
- }
- //END TARUN PMT 20050128
- //Open it again
- hf_enable_hindi_rules_parsing();
- hf_padding_def_value();
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- if (no_show_char != 1)
- {
- gui_print_stacked_character(current_character, pre2_character, pre_character);
- }
- }
- #if(EMS_ENABLE_SPECIAL_FONT_DISPLAY)
- if (underline_flag)
- {
- /* PMT MAUI_00015716 START FIX */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- S32 h, w;
- gui_measure_character(current_character, &w, &h);
- UI_draw_horizontal_line(
- tx,
- tx + ems_cluster_width - 1,
- ty + h,
- underline_color);
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT MAUI_00015716 END FIX */
- UI_draw_horizontal_line(
- tx,
- tx + object_width - 1,
- ty + line_height - 1,
- underline_color);
- }
- if (strikethrough_flag)
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- /* PMT MAUI_00015716 START FIX */
- S32 h, w;
- gui_measure_character(current_character, &w, &h);
- /* PMT MAUI_00015716 END FIX */
- UI_draw_horizontal_line(
- tx,
- tx + ems_cluster_width - 1,
- /* PMT MAUI_00015716 START FIX */
- ty + (h >> 1),
- /* PMT MAUI_00015716 END FIX */
- strikethrough_color);
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- UI_draw_horizontal_line(
- tx,
- tx + object_width - 1,