gui_inputs.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:662k
源码类别:
MTK
开发平台:
C/C++
- move_cursor_prev_p += 2;
- /* END TARUN PMT 20050128 */
- #endif /* __MMI_HINDI_ALG__ */
- }
- #ifdef __MMI_HINDI_ALG__
- else
- {
- /* Move pointer by the cluster width */
- //Performance issue
- //move_cursor_curr_p = hf_get_next_cluster_p((PU16)b->text,move_cursor_prev_p);
- move_cursor_curr_p = hf_get_next_cluster_p(move_cursor_prev_p, move_cursor_prev_p);
- skip_moves = move_cursor_curr_p - move_cursor_prev_p; /* Number of moves */
- if (skip_moves <= 0) /* Not Required Now 20041228 */
- {
- skip_moves = 1; /* At least 1 */
- }
- else
- {
- skip_moves = skip_moves >> 1;
- }
- saved_skip_moves = skip_moves; /* Save moves to skip the current_text_p also */
- /* Calculate the width of current cluster as well as english character */
- /* current_cluster_width = hf_size_of_current_cluster((PU16)b->text,move_cursor_curr_p,0); */
- current_cluster_width = hf_size_of_current_cluster(move_cursor_prev_p, move_cursor_curr_p, 0);
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "pixtel_UI_show_multi_line_input_box:[current_cluster_width] :%d",
- current_cluster_width));
- if (current_cluster_width + current_line_width >= edit_width)
- {
- previous_text_p = move_cursor_prev_p;
- }
- move_cursor_prev_p = move_cursor_curr_p;
- }
- #endif /* __MMI_HINDI_ALG__ */
- /* 120104 Calvin added */
- #ifdef __MMI_MESSAGES_CHAT__
- if(b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY)
- {
- if (UI_TEST_GRP_SEP_CHARACTER(current_character))
- {
- gdi_image_get_dimension(
- (U8*) GetImage(CHAT_LOCAL_IMG),
- ¤t_cluster_width,
- &character_height);
- }
- else if (UI_TEST_FILE_SEP_CHARACTER(current_character))
- {
- gdi_image_get_dimension(
- (U8*) GetImage(CHAT_REMOTE_IMG),
- ¤t_cluster_width,
- &character_height);
- }
- else if (UI_TEST_SENDER_TRUNCATE_SEP_CHARACTER(current_character))
- {
- gdi_image_get_dimension(
- (U8*) GetImage(CHAT_SENDER_TRUNCATE_IMG),
- ¤t_cluster_width,
- &character_height);
- }
- else if (UI_TEST_RECEIVER_TRUNCATE_SEP_CHARACTER(current_character))
- {
- gdi_image_get_dimension(
- (U8*) GetImage(CHAT_RECEIVER_TRUNCATE_IMG),
- ¤t_cluster_width,
- &character_height);
- }
- }
- #endif /* __MMI_MESSAGES_CHAT__ */
- /* Calvin end */
- }
- if (UI_TEST_LF_CHARACTER(current_character) || UI_TEST_CR_CHARACTER(current_character))
- {
- current_cluster_width = 0;
- }
- #if(MULTILINE_INPUTBOX_DISPLAY_SPECIAL_CHARACTERS)
- }
- #endif
- if (UI_STRING_END_OF_STRING_CHARACTER(current_character) ||
- UI_STRING_LINE_BREAK_CHARACTER(current_character))
- {
- current_cluster_width = 0;
- }
- #ifdef __MMI_HINDI_ALG__ //??hjf it should not need this compile option, and HINDI should also cached!
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character) && !(UI_STRING_END_OF_STRING_CHARACTER(current_character))) /* bakshi */
- #endif
- {
- character_str_cache[current_line_character_counter] = (U16) current_character;
- character_widths_cache[current_line_character_counter] = (U8) current_cluster_width; /* TARUN 20041122 */
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- character_heights_cache[current_line_character_counter] = (U8) gui_get_character_height() + 2;
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- character_heights_cache[current_line_character_counter] = (U8) character_height;
- }
- if (RequireToMoveCursor(pre_character, current_character))
- {
- #ifdef __MMI_HINDI_ALG__
- /* To stop the unwanted text to be added in cuurent_line_width */
- if (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- /* Calculate the width for the whole string as well as single english char */
- if (current_cluster_width != 0)
- {
- current_line_width += current_cluster_width + text_gap; /* text_gap added by TARUN 20041123 */
- }
- }
- else
- {
- current_line_width += text_gap * 2;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_multi_line_input_box:[current_line_width] :%d",
- current_line_width));
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- hindi_cluster_counter = current_line_character_counter; /* TARUN 20041123 */
- while (saved_skip_moves--)
- {
- character_widths_cache[hindi_cluster_counter] = 0;
- character_heights_cache[hindi_cluster_counter] = (U8) character_height;
- hindi_cluster_counter++;
- }
- /* START TARUN 20050107 */
- cluster_width_filler[cluster_filler_count] = current_cluster_width;
- /* END TARUN 20050107 */
- }
- #else /* __MMI_HINDI_ALG__ */
- if (current_cluster_width != 0)
- {
- current_line_width += current_cluster_width + text_gap;
- }
- /* MTK Terry for cursor overlap scroll bar */
- if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- current_line_width += text_gap;
- }
- #endif /* __MMI_HINDI_ALG__ */
- }
- else
- {
- current_line_width += current_cluster_width /* +text_gap */ ; /* TARUN 20041122 */
- }
- pre2_character = pre_character;
- pre_character = current_character;
- /* MTK end */
- #ifdef __MMI_HINDI_ALG__
- current_line_character_counter += skip_moves;
- /* START TARUN 20050107 */
- cluster_filler_count++;
- /* END TARUN 20050107 */
- #else /* __MMI_HINDI_ALG__ */
- current_line_character_counter++;
- #endif /* __MMI_HINDI_ALG__ */
- if (char_cnt_for_control_seq == 0 && !(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_WRAPPING_BY_WORD))
- {
- UI_MULTI_LINE_INPUT_BOX_BREAK_CHARACTER(current_character, break_character_flag);
- }
- else
- {
- break_character_flag = 0;
- }
- /* MTK Terry For the last character of the line is 0x20 and the cursor moving will be incorrect */
- if ((!break_character_flag || current_character == 0x20) && (current_line_width > edit_width - 1))
- {
- /* Get rid of infinite loop If editor width is smaller than one character. */
- if (current_line_character_counter == 1)
- {
- done = 1;
- }
- break;
- }
- saved_line_height = current_line_height;
- /*hjf character height + 1 if bigger then current line height */
- if((character_height + rich_text.more_line_spacing +reserve_line_height_for_hilite + 1) > current_line_height)
- {
- current_line_height = character_height + rich_text.more_line_spacing + reserve_line_height_for_hilite +1;
- }
- if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- current_line_break_character_counter = current_line_character_counter;
- line_break_text_p = current_text_p;
- b->last_position_p = current_text_p;
- previous_line_width = current_line_width - current_cluster_width - text_gap;
- previous_line_height = saved_line_height;
- done = 1;
- break;
- }
- else if (UI_STRING_LINE_BREAK_CHARACTER(current_character))
- {
- current_line_break_character_counter = current_line_character_counter;
- line_break_text_p = current_text_p;
- previous_line_width = current_line_width - current_cluster_width - text_gap;
- previous_line_height = saved_line_height;
- break;
- }
- else
- {
- if (break_character_flag)
- {
- current_line_break_character_counter = current_line_character_counter;
- line_break_text_p = current_text_p;
- if (UI_MULTI_LINE_INPUT_BOX_SPACE_CHARACTER(current_character))
- {
- previous_line_width = current_line_width - current_cluster_width - text_gap;
- previous_line_height = saved_line_height;
- /* MTK for Chinese Characters Display */
- break_flag = 1;
- /* MTK end */
- }
- else
- {
- previous_line_width = current_line_width;
- previous_line_height = current_line_height;
- }
- }
- /* MTK for Chinese Characters Display */
- #ifdef __MMI_HINDI_ALG__
- /* Hindi Word wrapping issue */
- if (!UI_MULTI_LINE_INPUT_BOX_ALPHABETIC_CHARACTER(current_character) &&
- !((flags & UI_MULTI_LINE_INPUT_BOX_RICHTEXT) &&
- GUI_INPUT_IS_MARKER(current_character)) &&
- (1 == break_flag) && (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character)))
- #else /* __MMI_HINDI_ALG__ */
- if (!UI_MULTI_LINE_INPUT_BOX_ALPHABETIC_CHARACTER(current_character) &&
- !((flags & UI_MULTI_LINE_INPUT_BOX_RICHTEXT) && GUI_INPUT_IS_MARKER(current_character)) &&
- (1 == break_flag))
- #endif /* __MMI_HINDI_ALG__ */
- {
- current_line_break_character_counter = 0;
- }
- /* MTK end */
- }
- if (char_cnt_for_control_seq > 0)
- {
- char_cnt_for_control_seq--;
- }
- }
- if ((current_line_break_character_counter == 0) && (current_line_character_counter > 0))
- {
- #ifdef __MMI_HINDI_ALG__
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_multi_line_input_box:NEW LINE "));
- current_line_break_character_counter = current_line_character_counter - skip_moves;
- #else /* __MMI_HINDI_ALG__ */
- current_line_break_character_counter = current_line_character_counter - 1;
- #endif /* __MMI_HINDI_ALG__ */
- line_break_text_p = previous_text_p;
- previous_line_width = current_line_width - current_cluster_width - text_gap;
- previous_line_height = saved_line_height;
- }
- /* Second pass. Display the entire line */
- pre2_character = 0;
- pre_character = 0;
- #ifdef __MMI_HINDI_ALG__
- cluster_filler_count = 0;
- //START FARHAD PMT 20050211
- // move_cursor_disp_prev_p= b->text;
- b->last_position_p = current_text_p;
- /* END FARHAD PMT 20050211 */
- #endif /* __MMI_HINDI_ALG__ */
- current_line_character_counter = 0;
- #ifdef __MMI_BIDI_ALG__
- saved_current_text_p = current_text_p;
- #endif
- current_text_p = line_start_text_p;
- current_line_height = previous_line_height;
- tx = 0;
- /* Restore the font at the beginning of line */
- rich_text.curr_font = rich_text.line_begin_font;
- rich_text.curr_border = rich_text.line_begin_border;
- /* USAT */
- rich_text.curr_strikethrough = rich_text.line_begin_strikethrough;
- gui_set_font(&rich_text.curr_font);
- /***ritesh is adding code for page height concept from here***/
- #ifdef __UI_PAGING_IN_MULTILINE_EDITOR__
- if (b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_VIEW_PAGING_MODE)
- {
- /** to determine the height of the currently displayed window.if condition is taken here to get the current **/
- if (total_page_height >= -(b->text_offset_y) &&
- b->edit_height_displayed_lines + current_line_height <= edit_height)
- {
- if (total_page_height == -b->text_offset_y)
- {
- if (b->text_offset_y == 0)
- {
- b->text_offset = 0; /* text_count :offset of the character where text_offset_y is currently pointing.char_count variable is needed when application exit. */
- }
- else
- {
- b->text_offset = char_count;
- }
- }
- if (total_page_height > -b->text_offset_y &&
- total_page_height - (-b->text_offset_y) < current_line_height)
- {
- b->text_offset = char_count;
- }
- total_page_height += current_line_height;
- b->edit_height_displayed_lines += current_line_height;
- }
- else
- {
- total_page_height += current_line_height;
- }
- char_count += current_line_break_character_counter; /* for every line ,char_count is incermented by the no of containing in that line */
- /* if concerned application wants to show the text from the particular offset then this offset value is copied into
- page_offset element of the multiline structure.According to this text_offset_y is calculated.This page_offset is compared against char_count to get text_offset_y */
- if (b->page_offset >= char_count || b->jump_offset_from_app >= char_count)
- {
- b->text_offset_y -= current_line_height;
- b->text_offset = char_count;
- }
- /*
- * this condition is tested for the 1st page.
- * "b->previous_shared_bytes" is considered to be the part of the page at 0th index in the buffer.it is needed to maintain the height of page
- * available in the buffer.height of page is also dependent on the shared_bytes with next or previous page.
- * In case of next page entry,the page at 0th index will be out from the buffer and the page next to the removed one will come to 0th index and so on
- *
- * check_flag: check_flag is needed to prevent the body of every if should be executed once.
- *
- * page_size=512 bytes.if char_count>=512 then it should go through the if condition and set the check_flag to 1.
- */
- if (char_count >= (GUI_PAGE_SIZE + (b->previous_shared_bytes / ENCODING_LENGTH)) && check_flag == 0)
- {
- /* if shared bytes is zero. previous_shared_bytes is the bytes which is shared between page at 0th and 1st index in the buffer** */
- if ((shared_data_count =
- char_count % (GUI_PAGE_SIZE + (b->previous_shared_bytes / ENCODING_LENGTH))) == 0)
- {
- b->page_details[PAGE_ZERO].page_id = b->start_id;
- b->page_details[PAGE_ZERO].page_height = total_page_height;
- b->page_details[PAGE_ZERO].shared_no_of_bytes = 0;
- }
- else
- {
- memcpy(
- b->page_details[PAGE_ZERO].shared_data,
- b->text + (GUI_PAGE_SIZE + (b->previous_shared_bytes / ENCODING_LENGTH) - current_line_break_character_counter + shared_data_count) * ENCODING_LENGTH,
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH);
- b->page_details[PAGE_ZERO].page_id = b->start_id;
- b->page_details[PAGE_ZERO].page_height = total_page_height - current_line_height;
- b->page_details[PAGE_ZERO].shared_no_of_bytes =
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH;
- }
- check_flag = 1;
- }
- /*
- * 2nd page details calculation:
- * GUI_PAGE_SIZE=512 bytes.if char_count>=GUI_PAGE_SIZE*2 then it should go through the if condition and set the check_flag to 2.
- */
- else if (char_count >= GUI_PAGE_SIZE * 2 && check_flag == 1)
- {
- if ((shared_data_count = char_count % (GUI_PAGE_SIZE * 2)) == 0)
- {
- b->page_details[PAGE_ONE].page_id = b->start_id + 1;
- b->page_details[PAGE_ONE].page_height =
- total_page_height - b->page_details[PAGE_ZERO].page_height;
- b->page_details[PAGE_ONE].shared_no_of_bytes = 0;
- }
- else
- {
- memcpy(
- b->page_details[PAGE_ONE].shared_data,
- b->text + ((GUI_PAGE_SIZE * 2) - current_line_break_character_counter + shared_data_count) * ENCODING_LENGTH,
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH);
- b->page_details[PAGE_ONE].page_id = b->start_id + 1;
- b->page_details[PAGE_ONE].page_height =
- total_page_height - b->page_details[PAGE_ZERO].page_height - current_line_height;
- b->page_details[PAGE_ONE].shared_no_of_bytes =
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH;
- }
- check_flag = 2;
- }
- /*
- * 3rd page details calculation:
- * GUI_PAGE_SIZE=512 bytes.if char_count>=GUI_PAGE_SIZE*3 then it should go through the if condition and set the check_flag to 3.
- */
- else if (char_count >= GUI_PAGE_SIZE * 3 && check_flag == 2)
- {
- if ((shared_data_count = char_count % (GUI_PAGE_SIZE * 3)) == 0)
- {
- b->page_details[PAGE_TWO].page_id = b->start_id + 2;
- b->page_details[PAGE_TWO].page_height =
- total_page_height - b->page_details[PAGE_ONE].page_height -
- b->page_details[PAGE_ZERO].page_height;
- b->page_details[PAGE_TWO].shared_no_of_bytes = 0;
- }
- else
- {
- memcpy(
- b->page_details[PAGE_TWO].shared_data,
- b->text + ((GUI_PAGE_SIZE * 3) - current_line_break_character_counter + shared_data_count) * ENCODING_LENGTH,
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH);
- b->page_details[PAGE_TWO].page_id = b->start_id + 2;
- b->page_details[PAGE_TWO].page_height =
- total_page_height - b->page_details[page_index + 1].page_height -
- b->page_details[page_index + 0].page_height + current_line_height;
- b->page_details[PAGE_TWO].shared_no_of_bytes =
- (current_line_break_character_counter - shared_data_count) * ENCODING_LENGTH;
- }
- check_flag = 3;
- }
- /*
- * 4th page details calculation:
- * GUI_PAGE_SIZE=512 bytes.if char_count>=GUI_PAGE_SIZE*4 then it should go through the if coditon.
- */
- else if ((char_count >= GUI_PAGE_SIZE * 3 /* && count_flag==0 */ ) && check_flag == 3)
- {
- /* count_flag=1; */
- b->page_details[PAGE_THREE].shared_no_of_bytes = 0;
- b->page_details[PAGE_THREE].page_id = b->start_id + 3;
- b->page_details[PAGE_THREE].page_height =
- total_page_height - b->page_details[page_index + PAGE_TWO].page_height -
- b->page_details[page_index + PAGE_ONE].page_height - b->page_details[page_index +
- PAGE_ZERO].page_height;
- }
- }
- #endif /* __UI_PAGING_IN_MULTILINE_EDITOR__ */
- /****ritesh has ended****/
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- if (rich_text.curr_alignment == GUI_INPUT_ALIGN_CENTER)
- {
- temp_text_p = current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(temp_text_p, current_character);
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- //next_unicode = String[2];
- //next_unicode |= (String[3]<<8);
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c); /* get next character */
- 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
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, dummy_c);
- }
- }
- else
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, dummy_c);
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- if (UI_MULTI_LINE_INPUT_BOX_SPACE_CHARACTER(current_character))
- {
- /* MTK Terry for Center Align when the beginning of the line is space */
- //previous_line_width-=(character_widths_cache[current_line_character_counter]+text_gap);
- //UI_STRING_GET_NEXT_CHARACTER(current_text_p,dummy_c);
- //current_line_character_counter++;
- //current_line_break_character_counter--;
- }
- if (default_direction == BIDI_R)
- {
- tx = ((edit_width >> 1) + (previous_line_width >> 1));
- if (tx < 0)
- {
- tx = 0;
- }
- if (tx > edit_width)
- {
- tx = edit_width - 1;
- }
- }
- else
- {
- tx = ((edit_width >> 1) - (previous_line_width >> 1));
- if (tx < 0)
- {
- tx = 0;
- }
- }
- }
- else if (rich_text.curr_alignment == GUI_INPUT_ALIGN_RIGHT)
- {
- if (default_direction == BIDI_R)
- {
- tx = edit_width - 1;
- if (tx < 0)
- {
- tx = 0;
- }
- if (tx > edit_width)
- {
- tx = edit_width - 1;
- }
- }
- else
- {
- tx = edit_width - previous_line_width;
- if (tx < 0)
- {
- tx = 0;
- }
- }
- }
- else
- {
- if (default_direction == BIDI_R)
- {
- tx = edit_width - 1;
- }
- else
- {
- tx = 0;
- }
- }
- }
- #ifdef __MMI_HINDI_ALG__
- cluster_width = 0;
- cursor_width = 0;
- #endif /* __MMI_HINDI_ALG__ */
- char_cnt_for_control_seq = 0;
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- U16 i = 0;
- U16 k = (saved_current_text_p - line_start_text_p) / 2 - 1;
- U16 j = (line_start_text_p - b->text) / 2;
- U16 ligature_count = 0;
- i += j;
- k += j;
- while (i < k)
- {
- if (OrgToSha[i] == OrgToSha[i + 1])
- {
- if (i - 1 >= 0)
- {
- if (OrgToSha[i - 1] != OrgToSha[i])
- {
- ligature_count++;
- }
- }
- else
- {
- ligature_count++;
- }
- }
- i++;
- }
- num_char = current_line_break_character_counter + ligature_count;
- MMI_ASSERT(!(num_char > ((MAX_NUM_OF_CHAR_FOR_EACH_LINE >> 1) - 1)));
- /* bidi_get_char_type(b->text, (U8 *)&default_direction); */
- if (b->cursor_p < current_text_p)
- {
- logical_cur_pos = 0xFFFF;
- }
- else if (((b->cursor_p - current_text_p) / ENCODING_LENGTH) > (num_char))
- {
- logical_cur_pos = 0xFFFF;
- }
- else
- {
- logical_cur_pos = (b->cursor_p - current_text_p) / ENCODING_LENGTH;
- }
- /* to get the last character unicode of previous line */
- if (line_counter == 0)
- {
- pfnEncodingSchemeToUnicode(
- &test_current_character,
- (current_text_p + num_char * ENCODING_LENGTH - ENCODING_LENGTH));//hjf should use num_char to fetch the last char
- }
- else
- {
- pfnEncodingSchemeToUnicode(&test_current_character, (current_text_p - ENCODING_LENGTH));
- }
- //hjf, cursor already be show
- if(is_cursor_show)
- logical_cur_pos = 0xFFFF;
- //hjfif ((line_counter == 0 && logical_cur_pos == current_line_break_character_counter))
- //hjf{
- //hjf if (UI_STRING_LINE_BREAK_CHARACTER(test_current_character) || test_current_character == 0x20)
- //hjf {
- //hjf logical_cur_pos = 0xFFFF;
- //hjf }
- //hjf}
- //if cursor pointer is at the last char of current line, it will cause that logical_cur_pos is zero at the next line
- //this check is to avoid that cursor displayed at both previous line and current line
- //hjf it should be the same process as english mode
- //hjfelse if ((line_counter != 0 && logical_cur_pos == 0))
- //hjf{
- //hjf if (!UI_STRING_LINE_BREAK_CHARACTER(test_current_character))
- //hjf {
- //hjf logical_cur_pos = 0xFFFF;
- //hjf }
- //hjf}
- //if last char of current line is n, cursor shall displayed at next line instead of current line.
- //if(UI_STRING_LINE_BREAK_CHARACTER(test_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 !*/
- #endif /* 0 */
- {
- logical_hilight_start = 0;
- logical_hilight_end = 0;
- }
- bidi_get_char_type(current_text_p, (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;
- }
- /* MTK begin chat issue 2005.10.27 */
- #ifdef __MMI_MESSAGES_CHAT__
- if(b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY)
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, dummy_c);
- if (UI_TEST_GRP_SEP_CHARACTER(current_character) ||
- UI_TEST_FILE_SEP_CHARACTER(current_character) ||
- UI_TEST_SENDER_TRUNCATE_SEP_CHARACTER(current_character) ||
- UI_TEST_RECEIVER_TRUNCATE_SEP_CHARACTER(current_character))
- {
- Show_Chat_NickName = MMI_TRUE;
- current_text_p += 2;
- num_char -= 1;
- }
- }
- #endif /* __MMI_MESSAGES_CHAT__ */
- /* MTK End */
- bidi_main(
- current_text_p,
- (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);
- /* MTK begin chat issue 2005.10.27 */
- #ifdef __MMI_MESSAGES_CHAT__
- if(b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY)
- {
- if (Show_Chat_NickName)
- {
- current_text_p -= 2;
- pTemp = visual_str_chat;
- UI_STRING_INSERT_CHARACTER(pTemp, current_character);
- memcpy(visual_str_chat + 2, visual_str, (pfnUnicodeStrlen((S8*) visual_str)) * ENCODING_LENGTH);
- memcpy(visual_str, visual_str_chat, MAX_TEXT_LENGTH * BIDI_ENCODING_LENGTH);
- Show_Chat_NickName = MMI_FALSE;
- }
- }
- #endif /* __MMI_MESSAGES_CHAT__ */
- /* MTK End */
- temp_text_pt = current_text_p;
- current_text_p = visual_str;
- temp_cursor_p = current_cursor_p;
- temp_pre_cursor_p = previous_cursor_p;
- if (visual_cur_pos != 0xFFFF)
- {
- current_cursor_p = previous_cursor_p = current_text_p + (visual_cur_pos) * ENCODING_LENGTH;
- /* previous_cursor_p = current_cursor_p - ENCODING_LENGTH; */
- if (previous_cursor_p != current_text_p)
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(previous_cursor_p, dummy_c);
- }
- }
- //if (default_line_direction == BIDI_L ||
- // (default_direction == BIDI_L && default_line_direction == BIDI_R))
- if(arabic_char_flag)
- {
- MMI_ASSERT(visual_str_len<128);
- memcpy(shaping_str1, visual_str, visual_str_len * 2);
- OrgToSha1[visual_str_len] = 0xffff;
- #ifdef __MMI_ZI__
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_ARABIC__) && defined(__MMI_ZI_PERSIAN__)
- ZiStringShapeEx(ZI8_LANG_FA, (U16*) & visual_str_len, (U16*) shaping_str1, (U16*) OrgToSha1, NULL); /* 19 is the Arabic id */
- #elif defined(__MMI_ZI_PERSIAN__)
- ZiStringShapeEx(ZI8_LANG_FA, (U16*) & visual_str_len, (U16*) shaping_str1, (U16*) OrgToSha1, NULL); /* 19 is the Arabic id */
- #elif defined(__MMI_ZI_ARABIC__)
- ZiStringShapeEx(ZI8_LANG_AR, (U16*) & visual_str_len, (U16*) shaping_str1, (U16*) OrgToSha1, NULL); /* 19 is the Arabic id */
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape2((U16*) & visual_str_len, (U16*) shaping_str1, (U16*) OrgToSha1, NULL);
- #endif /* __MMI_ZI_V7__ */
- #else /* __MMI_ZI__ */
- ArabicShapeEngine2((U16*) & visual_str_len, (U16*) shaping_str1, (U16*) OrgToSha1, NULL);
- #endif /* __MMI_ZI__ */
- }
- BIDI_done_flag = MMI_TRUE;
- #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 !*/
- #endif /* 0 */
- }
- #endif /* __MMI_BIDI_ALG__ */
- while (current_line_break_character_counter)
- {
- previous_text_p = current_text_p;
- /* PMT FARHAD START 20050708 */
- #ifdef __MMI_HINDI_ALG__
- temp_hindi_cursor_p = current_text_p;
- #endif
- /* PMT FARHAD START 20050708 */
- if (flags & UI_MULTI_LINE_INPUT_BOX_WORD_HIGHLIGHT)
- {
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- word_highlight = 0;
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- if (current_text_p == b->highlight_start_position)
- {
- /* barcode */
- int temp_y = ty;
- word_highlight = 1;
- if (b->hilite_cb != NULL)
- {
- b->curr_hilite_text_offset_y = -temp_y;
- if(b->hilite_str_number == 0)
- {
- word_highlight = 0;
- }
- }
- }
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- word_highlight = 0;
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- if (current_text_p == b->highlight_end_position)
- {
- word_highlight = 0;
- }
- }
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character); /* get next character */
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- //next_unicode = String[2];
- //next_unicode |= (String[3]<<8);
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c); /* get next character */
- 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
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, dummy_c);
- }
- }
- else
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, dummy_c);
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- if (IS_ARABIC_CHARACTER(current_character))
- {
- U32 idx = 0;
- U32 ligature_move = 0;
- UI_character_type dummy_c_arabic = 0;
- if (BIDI_done_flag)
- {
- idx = (current_text_p - visual_str) / 2 - 1;
- }
- else
- {
- idx = (current_text_p - b->text) / 2 - 1;
- }
- // if (default_line_direction != BIDI_L && default_direction != BIDI_L)
- // {
- // idx += (line_start_text_p - b->text) / 2;
- // }
- current_character = (UI_character_type) shaping_str1[OrgToSha1[idx]];
- while (idx < unshaped_text_len - 1)
- {
- if (OrgToSha1[idx] == OrgToSha1[idx + 1])
- {
- ligature_move++;
- }
- else
- {
- break;
- }
- idx++;
- }
- while (ligature_move > 0)
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
- ligature_move--;
- }
- }
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- S32 e = current_line_character_counter + current_line_break_character_counter -1;
- S32 i;
- static S32 p=0,n=0;
- if(current_line_character_counter == 0) {p=e;n=0;}
- for(i=0;i<=e;i++)
- {
- if(character_str_cache[p]==current_character) break;
- if(character_str_cache[n]==current_character) {p=n;break;}
- if( (--p) <0) p = e;
- if( (++n) >e) n = 0;
- }
- if(i <= e)
- {
- character_width = character_widths_cache[p];
- character_height = character_heights_cache[p];
- }
- else
- {
- gui_measure_character(current_character, &character_width, &character_height);
- }
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- {
- character_width = character_widths_cache[current_line_character_counter]; /* +text_gap; manju: Dec-11-2003 */
- character_height = character_heights_cache[current_line_character_counter];
- }
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character)) /* space shud have been added in the Hindi range */
- {
- if (move_cursor_disp_prev_p <= (b->last_position_p)) /* tarun1 */
- {
- /* move_cursor_disp_curr_p = hf_get_next_cluster_p((PU16)b->text,move_cursor_disp_prev_p); */
- move_cursor_disp_curr_p = hf_get_next_cluster_p(move_cursor_disp_prev_p, move_cursor_disp_prev_p);
- display_skip_moves = move_cursor_disp_curr_p - move_cursor_disp_prev_p;
- display_skip_moves = display_skip_moves >> 1;
- #if 0
- /* under construction !*/
- #else /* 0 */
- cluster_width = cursor_width = cluster_width_filler[cluster_filler_count];
- #endif /* 0 */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_cursor_width[cursor_width]:%d ",
- cursor_width));
- move_cursor_disp_prev_p = move_cursor_disp_curr_p;
- saved_display_skip_moves = display_skip_moves;
- display_skip_moves--;
- for (idx = 0; idx < display_skip_moves; idx++)
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character); /* get next character */
- }
- }
- }
- else
- {
- move_cursor_disp_prev_p += 2;
- saved_display_skip_moves = 1;
- }
- #endif /* __MMI_HINDI_ALG__ */
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- /* MTK Elvis for R2L characters */
- if (default_direction == BIDI_L)
- {
- xtx = xx + tx;
- yty = yy + ty;
- }
- else
- {
- /* START FARHAD PMT 20050211 */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- /* tx-= (cluster_width+text_gap); */
- tx -= cluster_width;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- /* MTK Arabic connectivity issue */
- #if defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__
- if (IS_ARABIC_CHARACTER(current_character))
- {
- tx -= character_width;
- }
- else
- #endif /* defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__ */
- /* MTK end */
- tx -= (character_width + text_gap);
- }
- /* END FARHAD PMT 20050211 */
- xtx = xx + tx;
- yty = yy + ty;
- }
- /* MTK end */
- #if(MULTILINE_INPUTBOX_DISPLAY_WHOLE_LINES)
- /* MTK Terry for speed up Editor by only display the characters in the display area */
- /* MTK Terry for show the last line in the display area even it can't display whole line */
- if ((((-1) == move_to_x) || ((-1) == move_to_y)) &&
- ((!(flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE) && (yty >= y1 - current_line_height) &&
- ((yty - current_line_height) <= y2)) || ((flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE) &&
- ((yty /* +current_line_height */ ) <= y2)
- /* START TARUN PMT 20041002 No need to check it */
- #ifndef MMI_HALF_LINE_MARQUEE_SCROLLING_ENABLE
- && (yty >= y1)
- #endif
- /* END TARUN PMT 20041002 */
- )))
- {
- #endif /* (MULTILINE_INPUTBOX_DISPLAY_WHOLE_LINES) */
- UI_MULTI_LINE_INPUT_BOX_SET_TEXT_COLOR(rich_text.curr_color);
- if (word_highlight || (multitap_flag && (previous_text_p == previous_cursor_p)))
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- /* PMT START 17082006 */
- if (MMI_current_input_mode == INPUT_MODE_SMART_HINDI)
- {
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- gui_fill_rectangle(
- xtx - 1,
- yty,
- xtx + cluster_width + 1,
- yty + current_line_height - 1,
- selector_color);
- }
- else
- {
- gui_fill_rectangle(
- xtx + 1,
- yty,
- xtx + cluster_width + 1,
- yty + current_line_height - 1,
- selector_color);
- }
- }
- else
- {
- gui_fill_rectangle(
- xtx - 1,
- yty,
- xtx + cluster_width - 1,
- yty + current_line_height - 1,
- selector_color);
- }
- }
- else
- /* PMT END 17082006 */
- #endif /* __MMI_HINDI_ALG__ */
- {
- gui_fill_rectangle(
- xtx,
- yty,
- xtx + character_width,
- yty + current_line_height - 1,
- selector_color);
- }
- UI_MULTI_LINE_INPUT_BOX_SET_TEXT_COLOR(selected_text_color); /* set text color */
- }
- if (previous_text_p == current_cursor_p)
- {
- if (overwrite_flag && !multitap_flag)
- {
- gui_fill_rectangle(
- xtx,
- yty,
- xtx + character_width - 1,
- yty + current_line_height - 1,
- selector_color);
- UI_MULTI_LINE_INPUT_BOX_SET_TEXT_COLOR(selected_text_color);
- }
- }
- if (flags & UI_MULTI_LINE_INPUT_BOX_DRAW_UNDERLINE) /* Prevent text and underline connected together */
- {
- UI_MULTI_LINE_INPUT_BOX_MOVE_TEXT_CURSOR(
- xtx,
- yty + current_line_height - character_height - 2);
- }
- else
- {
- UI_MULTI_LINE_INPUT_BOX_MOVE_TEXT_CURSOR(xtx, yty + current_line_height - character_height - reserve_line_height_for_hilite);
- }
- #if(MULTILINE_INPUTBOX_DISPLAY_SPECIAL_CHARACTERS)
- if (UI_TEST_CR_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) EMS_CR_display_character,
- 0);
- }
- else if (UI_TEST_LF_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) EMS_LF_display_character,
- 0);
- }
- else if (UI_TEST_ESC_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) EMS_ESC_display_character,
- 0);
- }
- else
- #endif /* (MULTILINE_INPUTBOX_DISPLAY_SPECIAL_CHARACTERS) */
- if (char_cnt_for_control_seq > 0)
- {
- /* Dummy */
- }
- else if ((flags & UI_MULTI_LINE_INPUT_BOX_RICHTEXT) && GUI_INPUT_IS_MARKER(current_character))
- {
- BOOL change_font = MMI_FALSE;
- BOOL change_color = MMI_FALSE;
- switch (current_character)
- {
- /* Alignment is handled in the first pass */
- case GUI_INPUT_MARKER_RESET_ALL:
- /* Reset font format and color (no paragraph) */
- rich_text.curr_font = *b->text_font;
- rich_text.curr_border = 0;
- /* USAT */
- rich_text.curr_strikethrough = 0;
- rich_text.curr_text_bg_color = rich_text.default_text_bg_color;
- rich_text.draw_text_bg_color = 0;
- rich_text.curr_color = rich_text.default_color;
- change_font = MMI_TRUE;
- change_color = MMI_TRUE;
- break;
- case GUI_INPUT_MARKER_RESET_PARAGRAPH:
- /* Paragraph handled in the first pass */
- break;
- case GUI_INPUT_MARKER_RESET_FORMAT:
- rich_text.curr_font = *b->text_font;
- rich_text.curr_border = 0;
- /* USAT */
- rich_text.curr_strikethrough = 0;
- change_font = MMI_TRUE;
- break;
- case GUI_INPUT_MARKER_RESET_COLOR:
- rich_text.curr_color = rich_text.default_color;
- /* USAT */
- rich_text.curr_text_bg_color = rich_text.default_text_bg_color;
- rich_text.draw_text_bg_color = 0;
- change_color = MMI_TRUE;
- break;
- default:
- if (current_character >= GUI_INPUT_MARKER_COLOR_BEGIN &&
- current_character <= GUI_INPUT_MARKER_COLOR_END)
- {
- if (current_character - GUI_INPUT_MARKER_COLOR_BEGIN < MAX_GUI_INPUT_COLOR)
- {
- rich_text.curr_color =
- g_mmi_gui_input_format_color_table[current_character -
- GUI_INPUT_MARKER_COLOR_BEGIN];
- change_color = MMI_TRUE;
- }
- }
- else if (current_character >= GUI_INPUT_MARKER_W3C_COLOR_BEGIN &&
- current_character <= GUI_INPUT_MARKER_W3C_COLOR_END)
- {
- if (current_character - GUI_INPUT_MARKER_W3C_COLOR_BEGIN <
- MAX_GUI_INPUT_W3C_COLOR)
- {
- rich_text.curr_color =
- g_mmi_gui_input_format_w3c_color_table[current_character -
- GUI_INPUT_MARKER_W3C_COLOR_BEGIN];
- change_color = MMI_TRUE;
- }
- }
- /* USAT */
- else if (current_character >= GUI_INPUT_MARKER_TEXT_BACKGROUND_COLOR_BEGIN &&
- current_character <= GUI_INPUT_MARKER_TEXT_BACKGROUND_COLOR_END)
- {
- if (current_character - GUI_INPUT_MARKER_TEXT_BACKGROUND_COLOR_BEGIN <
- MAX_GUI_INPUT_W3C_TEXT_BG_COLOR)
- {
- rich_text.curr_text_bg_color =
- g_mmi_gui_input_format_w3c_text_background_color_table[current_character
- -
- GUI_INPUT_MARKER_TEXT_BACKGROUND_COLOR_BEGIN];
- rich_text.draw_text_bg_color = 1;
- }
- }
- if (current_character >= GUI_INPUT_MARKER_BORDER_COLOR_BEGIN &&
- current_character <= GUI_INPUT_MARKER_BORDER_COLOR_END)
- {
- if (current_character - GUI_INPUT_MARKER_BORDER_COLOR_BEGIN <
- MAX_GUI_INPUT_COLOR)
- {
- gui_set_text_border_color(g_mmi_gui_input_format_color_table
- [current_character -
- GUI_INPUT_MARKER_BORDER_COLOR_BEGIN]);
- }
- }
- else if (current_character >= GUI_INPUT_MARKER_W3C_BORDER_COLOR_BEGIN &&
- current_character <= GUI_INPUT_MARKER_W3C_BORDER_COLOR_END)
- {
- if (current_character - GUI_INPUT_MARKER_W3C_BORDER_COLOR_BEGIN <
- MAX_GUI_INPUT_W3C_COLOR)
- {
- gui_set_text_border_color(g_mmi_gui_input_format_w3c_color_table
- [current_character -
- GUI_INPUT_MARKER_W3C_BORDER_COLOR_BEGIN]);
- }
- }
- else if (GUI_INPUT_IS_FORMAT_MARKER(current_character))
- {
- if (GUI_INPUT_CHECK_FORMAT_MARKER(current_character, GUI_INPUT_MARKER_BOLD))
- {
- rich_text.curr_font.bold = 1;
- change_font = MMI_TRUE;
- }
- if (GUI_INPUT_CHECK_FORMAT_MARKER(current_character, GUI_INPUT_MARKER_ITALIC))
- {
- rich_text.curr_font.italic = 1;
- change_font = MMI_TRUE;
- }
- if (GUI_INPUT_CHECK_FORMAT_MARKER
- (current_character, GUI_INPUT_MARKER_UNDERLINE))
- {
- rich_text.curr_font.underline = 1;
- change_font = MMI_TRUE;
- }
- /* USAT */
- if (GUI_INPUT_CHECK_FORMAT_MARKER
- (current_character, GUI_INPUT_MARKER_STRIKETHROUGH))
- {
- rich_text.curr_strikethrough = 1;
- }
- if (GUI_INPUT_CHECK_FORMAT_MARKER(current_character, GUI_INPUT_MARKER_BORDER))
- {
- /* We do not increase font size for bordered font because text gap is already enlarged */
- rich_text.curr_border = 1;
- }
- if (GUI_INPUT_CHECK_SIZE_MARKER(current_character, GUI_INPUT_MARKER_SMALL))
- {
- rich_text.curr_font.size = SMALL_FONT;
- change_font = MMI_TRUE;
- }
- else if (GUI_INPUT_CHECK_SIZE_MARKER
- (current_character, GUI_INPUT_MARKER_MEDIUM))
- {
- rich_text.curr_font.size = MEDIUM_FONT;
- change_font = MMI_TRUE;
- }
- else if (GUI_INPUT_CHECK_SIZE_MARKER(current_character, GUI_INPUT_MARKER_LARGE))
- {
- rich_text.curr_font.size = LARGE_FONT;
- change_font = MMI_TRUE;
- }
- }
- /* Paragraph handled in the first pass */
- break;
- }
- if (change_font)
- {
- gui_set_font(&rich_text.curr_font);
- }
- if (change_color)
- {
- UI_MULTI_LINE_INPUT_BOX_SET_TEXT_COLOR(rich_text.curr_color);
- }
- }
- else if (b->icon_callback &&
- (char_cnt_for_control_seq =
- b->icon_callback(
- previous_text_p,
- MMI_TRUE,
- NULL,
- NULL,
- xtx,
- /* current_line_height-character_height+ */ yty)) > 0)
- {
- /* Dummy */
- }
- else
- #ifdef __MMI_MESSAGES_CHAT__
- if ((b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY) && UI_TEST_GRP_SEP_CHARACTER(current_character))
- {
- /* For Chat Buddy Icon - Gurinder - 15/4/2004 */
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) GetImage(CHAT_LOCAL_IMG),
- 0);
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag == MMI_TRUE)
- {
- tx += character_width;
- current_line_width += character_width;
- }
- #endif /* __MMI_BIDI_ALG__ */
- }
- else if ((b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY) && UI_TEST_FILE_SEP_CHARACTER(current_character))
- {
- /* For Chat Buddy Icon - Gurinder - 15/4/2004 */
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) GetImage(CHAT_REMOTE_IMG),
- 0);
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag == MMI_TRUE)
- {
- tx += character_width;
- current_line_width += character_width;
- }
- #endif /* __MMI_BIDI_ALG__ */
- }
- else if ((b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY) && UI_TEST_SENDER_TRUNCATE_SEP_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) GetImage(CHAT_SENDER_TRUNCATE_IMG),
- 0);
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag == MMI_TRUE)
- {
- tx += character_width;
- current_line_width += character_width;
- }
- #endif /* __MMI_BIDI_ALG__ */
- }
- else if ((b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_CHAT_ICON_DISPLAY) && UI_TEST_RECEIVER_TRUNCATE_SEP_CHARACTER(current_character))
- {
- gui_show_transparent_image(
- xtx,
- current_line_height - character_height + yty,
- (PU8) GetImage(CHAT_RECEIVER_TRUNCATE_IMG),
- 0);
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag == MMI_TRUE)
- {
- tx += character_width;
- current_line_width += character_width;
- }
- #endif /* __MMI_BIDI_ALG__ */
- }
- else
- #endif /* __MMI_MESSAGES_CHAT__ */
- if (!(UI_STRING_END_OF_STRING_CHARACTER(current_character) ||
- UI_TEST_LF_CHARACTER(current_character) ||
- UI_TEST_CR_CHARACTER(current_character) || UI_TEST_ESC_CHARACTER(current_character)))
- {
- #ifdef __MMI_HINDI_ALG__
- PU8 prev_temp_cursor_p;
- #endif
- /* USAT */
- if (rich_text.draw_text_bg_color)
- {
- UI_fill_rectangle(
- xtx,
- yty - 1,
- xtx + character_width,
- yty + current_line_height /* character_height */ - 1,
- rich_text.curr_text_bg_color);
- }
- if((b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_TRUNCATE_CONTENT) && (flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR))
- {
- if(b->text_height > b->edit_height)
- {
- if(yty + current_line_height * 2 > y2)
- {
- UI_character_type next_char;
- {
- UI_buffer_type tmp = current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(tmp,next_char);
- }
- if(current_line_break_character_counter == 1
- || UI_TEST_LF_CHARACTER(next_char)
- || UI_TEST_CR_CHARACTER(next_char))
- {
- gui_move_text_cursor(UI_text_x,UI_text_y);
- gui_print_character((UI_character_type)'.');
- gui_move_text_cursor(UI_text_x+3,UI_text_y);
- gui_print_character((UI_character_type)'.');
- gui_move_text_cursor(UI_text_x+3,UI_text_y);
- gui_print_character((UI_character_type)'.');
- done = 1;
- break;
- }
- }
- }
- }
- #ifdef __MMI_HINDI_ALG__
- /* START FARHAD PMT 20050211 */
- if (temp_hindi_cursor_p == (b->last_position_p)) /* tarun2 don't go further after whole string */
- {
- goto enddisp;
- }
- {
- prev_temp_cursor_p = temp_hindi_cursor_p;
- temp_hindi_cursor_p = hf_get_next_cluster_p(temp_hindi_cursor_p, temp_hindi_cursor_p);
- }
- if (flags & UI_MULTI_LINE_INPUT_BOX_MASK_CHARACTERS)
- {
- /* W06.09 Touch Screen With Keypad V1 */
- #if defined(__MMI_FULL_SCREEN_EDITOR__) || defined(__MMI_TOUCH_SCREEN__)
- /* MTK Terry for password display for __MMI_FULL_SCREEN_EDITOR__ */
- if ((flags & UI_MULTI_LINE_INPUT_BOX_STATE_MULTITAP) &&
- (previous_text_p == previous_cursor_p))
- {
- gui_print_character(current_character);
- }
- else
- #endif /* defined(__MMI_FULL_SCREEN_EDITOR__) || defined(__MMI_TOUCH_SCREEN__) */
- {
- gui_print_character(b->mask_character);
- }
- }
- /* for getting the current cluster for display */
- else if (hf_get_current_cluster(prev_temp_cursor_p, temp_hindi_cursor_p, disp_cluster))
- /* END FARHAD PMT 20050211 */
- {
- S32 disp_multi_clust_len = pfnUnicodeStrlen((PS8) disp_cluster);
- MMI_ASSERT(!(disp_multi_clust_len > MAX_EDITOR_DISP_LEN));
- UI_text_height = character_height;
- /* To avoid rule appln in showstring */
- hf_disable_hindi_rules_parsing();
- hf_padding_value(0);
- /* START TARUN PMT 20050128 */
- UI_set_current_text_color(UI_text_color);
- if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- cancelWidth = 1;
- ShowString(
- UI_text_x,
- UI_text_y,
- *UI_font,
- 0,
- (U8*) (disp_cluster),
- UI_text_height);
- cancelWidth = 0;
- }
- else
- {
- cancelWidth = 1;
- ShowString(
- UI_text_x,
- UI_text_y,
- *UI_font,
- 0,
- (U8*) (disp_cluster),
- UI_text_height);
- cancelWidth = 0;
- }
- //END TARUN PMT 20050128
- //Open it again
- hf_enable_hindi_rules_parsing();
- hf_padding_def_value();
- }
- else
- {
- if (rich_text.curr_border)
- {
- gui_print_bordered_stacked_character(
- current_character,
- pre2_character,
- pre_character);
- }
- else
- {
- gui_print_stacked_character(current_character, pre2_character, pre_character);
- }
- }
- enddisp:
- memset(disp_cluster, 0, sizeof(disp_cluster));
- #else /* __MMI_HINDI_ALG__ */
- if (flags & UI_MULTI_LINE_INPUT_BOX_MASK_CHARACTERS)
- {
- /* W06.09 Touch Screen With Keypad V1 */
- #if defined(__MMI_FULL_SCREEN_EDITOR__) || defined(__MMI_TOUCH_SCREEN__)
- /* MTK Terry for password display for __MMI_FULL_SCREEN_EDITOR__ */
- if ((flags & UI_MULTI_LINE_INPUT_BOX_STATE_MULTITAP) &&
- (previous_text_p == previous_cursor_p))
- {
- //VIKAS 20060120 PMT START
- //gui_print_character(current_character);
- gui_print_stacked_character(current_character, pre2_character, pre_character);
- /* VIKAS 20060120 PMT END */
- }
- else
- #endif /* defined(__MMI_FULL_SCREEN_EDITOR__) || defined(__MMI_TOUCH_SCREEN__) */
- {
- //VIKAS 20060120 PMT START
- //gui_print_character(b->mask_character);
- gui_print_stacked_character(b->mask_character, pre2_character, pre_character);
- /* VIKAS 20060120 PMT END */
- }
- }
- else
- {
- if (rich_text.curr_border)
- {
- gui_print_bordered_stacked_character(
- current_character,
- pre2_character,
- pre_character);
- }
- else
- {
- gui_print_stacked_character(current_character, pre2_character, pre_character);
- }
- /* USAT */
- if (rich_text.curr_strikethrough)
- {
- UI_draw_horizontal_line(
- xtx,
- xtx + character_width - 1,
- yty + (current_line_height >> 1),
- gui_richtext_strikethrough_color);
- }
- /* barcode */
- if (b->hilite_cb != NULL)
- {
- if (gui_multi_line_input_box_is_pos_inside_hilite(b, current_text_p - 2))
- {
- UI_draw_horizontal_line(
- xtx,
- xtx + character_width,
- yty + current_line_height -1 ,
- gui_hilite_underline_color);
- }
- }
- }
- #endif /* __MMI_HINDI_ALG__ */
- }
- #ifdef __MMI_HINDI_ALG__
- else
- {
- /* START FARHAD PMT 20050211 */
- temp_hindi_cursor_p += 2;
- /* END FARHAD PMT 20050211 */
- }
- #endif /* __MMI_HINDI_ALG__ */
- if ((previous_text_p == current_cursor_p) &&
- !(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW))
- {
- S32 BX2,BY2;
- //hjf x2 already - vbar width,
- BX2 = x2;
- BY2 = y2-2;
- is_cursor_show = MMI_TRUE; // hjf, to record the cursor is be show
- /* gui_multi_line_input_box_show_cursor(b,xtx,yty,current_line_height,x1,x2-b->vbar.width); */
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- xtx -= cluster_width;
- xtx += cursor_width;
- }
- #endif /* __MMI_HINDI_ALG__ */
- /* For every multiline input box the value remains as y1-2 */
- if (default_direction != BIDI_L)
- {
- if (g_mmi_wgui_halfline_marquee_scroll_enable)
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx + character_width,
- y1,
- current_line_height,
- x1,
- y1,
- BX2,
- BY2);
- }
- else
- {
- if (flags & UI_MULTI_LINE_INPUT_BOX_DRAW_UNDERLINE)
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx + character_width,
- yty,
- current_line_height - 2,
- x1,
- y1,
- BX2,
- BY2);
- }
- else
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx + character_width,
- yty,
- current_line_height,
- x1,
- y1,
- BX2,
- BY2);
- }
- }
- }
- else
- {
- if (g_mmi_wgui_halfline_marquee_scroll_enable)
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx,
- y1 + 2,
- current_line_height,
- x1,
- y1,
- BX2,
- BY2);
- }
- else
- {
- if (flags & UI_MULTI_LINE_INPUT_BOX_DRAW_UNDERLINE)
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx,
- yty,
- current_line_height - 2,
- x1,
- y1,
- BX2,
- BY2);
- }
- else
- {
- gui_multi_line_input_box_show_cursor(
- b,
- xtx,
- yty,
- current_line_height,
- x1,
- y1,
- BX2,
- BY2);
- }
- }
- }
- }
- #if(MULTILINE_INPUTBOX_DISPLAY_WHOLE_LINES)
- }
- #endif
- if (default_direction == BIDI_L)
- {
- if (RequireToMoveCursor(pre_character, current_character))
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- tx += cluster_width;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- /* MTK Arabic connectivity issue */
- #if defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__
- if (IS_ARABIC_CHARACTER(current_character))
- {
- tx += character_width;
- }
- else
- #endif /* defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__ */
- /* MTK end */
- tx += character_width + text_gap;
- }
- }
- else
- {
- tx += character_width /* +text_gap */ ;
- }
- }
- pre2_character = pre_character;
- pre_character = current_character;
- }
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- if ((((-1) == move_to_x) || ((-1) == move_to_y)))
- {
- if (previous_text_p == current_cursor_p)
- {
- b->cursor_line_position_counter = current_line_character_counter;
- b->line_before_cursor_line_p = previous_line_start_text_p;
- b->cursor_line_p = line_start_text_p;
- b->cursor_x = tx;
- b->cursor_y = ty;
- }
- }
- else
- {
- if (((tx + b->x) > move_to_x) && ((ty + b->y + current_line_height + b->text_offset_y) > move_to_y)
- && (!set_cursor_flag))
- {
- b->cursor_line_position_counter = current_line_character_counter;
- b->line_before_cursor_line_p = previous_line_start_text_p;
- b->cursor_line_p = line_start_text_p;
- b->cursor_x = tx;
- b->cursor_y = ty;
- b->cursor_p = previous_text_p;
- set_cursor_flag = 1;
- }
- else if (((ty + b->y + current_line_height + b->text_offset_y) > move_to_y) && (!set_cursor_flag) &&
- ((1 == current_line_break_character_counter) || (UI_TEST_CR_CHARACTER(current_character))))
- {
- b->cursor_line_position_counter = current_line_character_counter;
- b->line_before_cursor_line_p = previous_line_start_text_p;
- b->cursor_line_p = line_start_text_p;
- b->cursor_x = tx;
- b->cursor_y = ty;
- b->cursor_p = previous_text_p;
- set_cursor_flag = 1;
- }
- }
- }
- #ifdef __MMI_HINDI_ALG__
- current_line_break_character_counter -= saved_display_skip_moves;
- current_line_character_counter += saved_display_skip_moves;
- cluster_filler_count++;
- #else /* __MMI_HINDI_ALG__ */
- current_line_break_character_counter--;
- current_line_character_counter++;
- #endif /* __MMI_HINDI_ALG__ */
- if (char_cnt_for_control_seq > 0)
- {
- char_cnt_for_control_seq--;
- }
- }
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- current_text_p = temp_text_pt + (current_text_p - visual_str);
- previous_text_p = temp_text_pt + (previous_text_p - visual_str);
- current_cursor_p = temp_cursor_p;
- previous_cursor_p = temp_pre_cursor_p;
- /*
- * if(flags & UI_MULTI_LINE_INPUT_BOX_WORD_HIGHLIGHT)
- * {
- * b->highlight_start_position = temp_hilight_start;
- * b->highlight_end_position = temp_hilight_end;
- * }
- */
- }
- #endif /* __MMI_BIDI_ALG__ */
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) &&
- (flags & UI_MULTI_LINE_INPUT_BOX_DRAW_SEPARATOR) && draw_separator)
- {
- static const U8 dotted_line_bitvalues[] = {1, 1, 0, 0};
- #ifdef __MMI_BIDI_ALG__
- if (arabic_char_flag)
- {
- gdi_draw_line_style(
- xx + 5,
- yty + current_line_height - 1,
- xx + b->edit_width - 1 - 5,
- yty + current_line_height - 1,
- gdi_act_color_from_rgb(255, 112, 125, 240),
- sizeof(dotted_line_bitvalues),
- dotted_line_bitvalues);
- }
- else
- #endif /* __MMI_BIDI_ALG__ */
- gdi_draw_line_style(
- xx + 5,
- yty + current_line_height - 0,
- xx + b->edit_width - 1 - 5,
- yty + current_line_height - 0,
- gdi_act_color_from_rgb(255, 112, 125, 240),
- sizeof(dotted_line_bitvalues),
- dotted_line_bitvalues);
- }
- if (rich_text.line_separator)
- {
- static const U8 line_separator_value[] = {1, 0};
- S32 gap = b->edit_width >> 3;
- S32 yoffset = (rich_text.more_line_spacing >> 1) + 1;
- gdi_draw_line_style(
- (S32) xx + gap,
- (S32) yty + yoffset,
- (S32) xx + b->edit_width - 1 - gap,
- (S32) yty + yoffset,
- (gdi_color) gdi_act_color_from_rgb(255, rich_text.curr_color.r, rich_text.curr_color.g, rich_text.curr_color.b),
- sizeof(line_separator_value),
- line_separator_value);
- }
- ty += current_line_height; /* Previously: character_height+text_gap */
- if (current_line_height > b->max_line_height)
- {
- b->max_line_height = current_line_height;
- }
- if (b->cursor_line_p == previous_line_start_text_p)
- {
- b->line_after_cursor_line_p = line_start_text_p;
- b->line_after_cursor_line_last_p = previous_text_p;
- next_line_found_flag = 1;
- }
- previous_line_start_text_p = line_start_text_p;
- line_start_text_p = line_break_text_p;
- if (flags & UI_MULTI_LINE_INPUT_BOX_ONLY_SHOW_FIRST_LINE)
- {
- /* Used by WAP to emulate single line input gadget */
- done = 1;
- }
- line_counter++;
- }
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- if ((((-1) != move_to_x) || ((-1) != move_to_y)) && (!set_cursor_flag))
- {
- b->cursor_line_position_counter = current_line_character_counter;
- b->line_before_cursor_line_p = previous_line_start_text_p;
- b->cursor_line_p = line_start_text_p;
- b->cursor_x = tx;
- b->cursor_y = ty;
- b->cursor_p = previous_text_p;
- set_cursor_flag = 1;
- }
- /* ty + b->footer_height will become b->text_height */
- if (b->min_text_height > 0 && ty + b->footer_height < b->min_text_height)
- {
- ty = b->min_text_height - b->footer_height;
- }
- if (b->max_empty_text_height > 0 && !b->text[0] && !b->text[1])
- {
- ty = b->header_height + b->max_empty_text_height;
- }
- /* Draw underline */
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) && (flags & UI_MULTI_LINE_INPUT_BOX_DRAW_UNDERLINE))
- {
- S32 line_x, line_x2, line_y, line_y_end, line_jump = b->min_line_height;
- line_y = yy + b->header_height + line_jump - 1;
- line_y_end = b->y + b->text_y + b->edit_height - 1;
- if (b->footer_height > 0 && (line_y_end > yy + ty))
- {
- line_y_end = yy + ty;
- }
- line_x = b->x + b->text_x;
- line_x2 = line_x + b->edit_width - 1;
- line_x++;
- line_x2--;
- while (line_y <= line_y_end)
- {
- gdi_draw_line(line_x, line_y, line_x2, line_y, gdi_act_color_from_rgb(255, 112, 125, 240));
- line_y += line_jump;
- }
- }
- /* Draw header region */
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) &&
- b->header_callback && (b->header_height > 0) && (b->text_offset_y + b->header_height > 0))
- {
- /* Not overlapped with single-pixel border */
- b->header_callback(yy, x1 + 1, y1 + 1, x2 - 1, y2 - 1);
- }
- /* Draw footer region */
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) &&
- b->footer_callback && (b->footer_height > 0) && (b->text_offset_y + ty < b->edit_height))
- {
- /* Not overlapped with single-pixel border */
- b->footer_callback(yy + ty, x1 + 1, y1 + 1, x2 - 1, y2 - 1);
- }
- if (b->max_line_height > 0)
- {
- if (b->text_length == 0)
- {
- b->max_line_height = 0;
- }
- else if ((b->text != NULL) && (b->text[0] == 0 && b->text[1] == 0))
- {
- b->max_line_height = 0;
- }
- }
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- gui_pop_text_clip();
- gui_pop_clip();
- }
- if (!next_line_found_flag)
- {
- b->line_after_cursor_line_p = b->cursor_line_p;
- }
- /* Footer area should be included in b->text_height */
- ty += b->footer_height;
- b->text_height = ty;
- temp_d = b->text_offset_y + ty;
- /* View mode condition added. Nov-19, TESTFIX */
- if (!(b->flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE) && (flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- if (temp_d < edit_height)
- {
- #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_WRITE)
- {
- b->text_offset_y += 15;
- }
- else
- #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */
- b->text_offset_y += (edit_height - temp_d);
- if (b->text_offset_y > 0)
- {
- b->text_offset_y = 0;
- }
- }
- }
- b->n_lines = line_counter;
- #ifdef __UI_PAGING_IN_MULTILINE_EDITOR__
- /* Once text_offset_y value is acheived for the text display from the offset given by the concerned application
- then reset the offset value */
- if (b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_VIEW_PAGING_MODE)
- {
- if (b->jump_offset_from_app != 0 && b->search_flag_is_on)
- {
- /* PMT Start 09_08_06 00071 */
- if(((-b->text_offset_y) % b->edit_height_displayed_lines)<b->edit_height_displayed_lines -(current_line_height*2))
- {
- b->text_offset_y += (-b->text_offset_y) % b->edit_height_displayed_lines;
- }
- /* PMT End 09_08_06 00071 */
- }
- //begin steven ebook
- if(-b->text_offset_y==b->text_height && b->text_height >b->edit_height_displayed_lines)
- {
- b->text_offset_y+=b->edit_height_displayed_lines;
- }
- //end steve ebook
- b->page_offset = 0;
- b->jump_offset_from_app = 0;
- /* PMT Start 06_08_06 00071 */
- if(b->size_of_total_data < GUI_PAGE_SIZE)
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, b->edit_height);
- }
- else
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, 1);
- }
- /* PMT End 06_08_06 00071 */
- rich_text.curr_font.bold = rich_text.curr_font.italic = 0;
- }
- else
- #endif /* __UI_PAGING_IN_MULTILINE_EDITOR__ */
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, b->edit_height);
- gui_set_vertical_scrollbar_range(&b->vbar, ty);
- gui_set_vertical_scrollbar_value(&b->vbar, -b->text_offset_y);
- }
- /* Set global font to default because rich_text.curr_font is local variable released dynamically. */
- gui_set_font(b->text_font);
- }
- else /* else of if(b->text != NULL) */
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, b->edit_height);
- gui_set_vertical_scrollbar_range(&b->vbar, 0);
- gui_set_vertical_scrollbar_value(&b->vbar, 0);
- }
- #ifdef __UI_PAGING_IN_MULTILINE_EDITOR__
- count_flag = 0; /* ritesh */
- #endif
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW)) /* if not disable draw then do .. */
- {
- gui_pop_clip();
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR) && (edit_width > 0))
- {
- if (flags & UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR)
- {
- if (b->vbar.scale < b->vbar.range)
- {
- if (r2lMMIFlag)
- {
- vbar_x = b->vbar.x;
- vbar_button_x = b->vbar.scroll_button.x;
- b->vbar.x = b->vbar.x + b->vbar.width - b->width;
- b->vbar.scroll_button.x = b->vbar.scroll_button.x + b->vbar.scroll_button.width - b->width;
- gui_show_vertical_scrollbar(&b->vbar);
- }
- else
- {
- gui_show_vertical_scrollbar(&b->vbar);
- }
- if (r2lMMIFlag)
- {
- b->vbar.x = vbar_x;
- b->vbar.scroll_button.x = vbar_button_x;
- }
- }
- }
- else
- {
- if (r2lMMIFlag)
- {
- vbar_x = b->vbar.x;
- vbar_button_x = b->vbar.scroll_button.x;
- b->vbar.x = b->vbar.x + b->vbar.width - b->width;
- b->vbar.scroll_button.x = b->vbar.scroll_button.x + b->vbar.scroll_button.width - b->width;
- gui_show_vertical_scrollbar(&b->vbar);
- }
- else
- {
- gui_show_vertical_scrollbar(&b->vbar);
- }
- if (r2lMMIFlag)
- {
- b->vbar.x = vbar_x;
- b->vbar.scroll_button.x = vbar_button_x;
- }
- }
- }
- if (((b->flags & UI_MULTI_LINE_INPUT_BOX_AUTO_VERTICAL_SCROLL) ==
- UI_MULTI_LINE_INPUT_BOX_AUTO_VERTICAL_SCROLL) && !b->vertical_scroll_on)
- {
- #if(UI_BLINKING_CURSOR_SUPPORT)
- StopMyTimer(BLINKING_CURSOR);
- #endif
- gui_cancel_timer(multiline_inputbox_vertical_scroll);
- gui_start_timer(UI_MULTI_LINE_INIT_SCROLL, multiline_inputbox_vertical_scroll);
- }
- }
- #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 !*/
- #endif
- #endif /* 0 */
- #ifdef __MMI_BIDI_ALG__
- UI_UNUSED_PARAMETER(temp_hilight_start);
- UI_UNUSED_PARAMETER(temp_hilight_end);
- #endif /* __MMI_BIDI_ALG__ */
- #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_WRITE)
- {
- g_nsm_msg_context.UCS2_count = b->UCS2_count; /* To fix outbox edit bug */
- g_nsm_msg_context.textlength = b->text_length;
- }
- if ((GetExitScrnID() == SCR_ID_MSG_OUTBOX_MSG) && (mmi_nsm_get_msg_type() == PICTURE_MESSAGE))
- {
- g_nsm_msg_context.UCS2_count = b->UCS2_count; /* To fix outbox SEND bug */
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */
- /* PMT VIKAS START 20050707 */
- #ifdef __MMI_UI_DALMATIAN_EDITOR__
- if(!(b->ext_flags & GUI_MULTI_LINE_INPUT_BOX_DISABLE_DALMATIAN_EDITOR))
- {
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))//053006 dalmatian editor Calvin
- {
- S32 draw_dal_image = 1;
- if (!(flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW) &&
- b->header_callback && (b->header_height > 0) && (b->text_offset_y + b->header_height >= 0))
- {
- draw_dal_image = 0; /* Not to draw image when image insert in editor. */
- }
- /* Draw Dalmatian editor image */
- if (b->height >= 100) /* To draw image according to screen size. */
- {
- gui_measure_image(get_image(IMG_EDITOR_DALMATIAN), &image_width, &image_height);
- }
- else
- {
- gui_measure_image(get_image(IMG_EDITOR_DALMATIAN_SMALL), &image_width, &image_height);
- }
- //PMT SUKRIT START 20060104
- //The image will be drawn if the editor height is 25% more than image height
- if (image_height > (b->height - (image_height >> 2)))
- {
- draw_dal_image = 0;
- }
- /* PMT SUKRIT END 20060104 */
- if (draw_dal_image && b->text_length <= 2 && (!(flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE)) &&
- (0 == b->footer_height))
- {
- /* PMT VIKAS START 20050817 */
- if (b->height >= 100)
- if (!r2lMMIFlag)
- {
- gui_show_image(
- (U16) b->x + b->width - (b->vbar.width + image_width + 2),
- (U16) b->y + b->height - (image_height + 4),
- get_image(IMG_EDITOR_DALMATIAN));
- }
- else
- {
- gui_show_image(
- (U16) b->x + (b->vbar.width + 2),
- (U16) b->y + b->height - (image_height + 4),
- get_image(IMG_EDITOR_DALMATIAN));
- }
- else if (!r2lMMIFlag)
- {
- gui_show_image(
- (U16) b->x + b->width - (b->vbar.width + image_width + 2),
- (U16) b->y + b->height - (image_height + 4),
- get_image(IMG_EDITOR_DALMATIAN_SMALL));
- }
- else
- {
- gui_show_image(
- (U16) b->x + (b->vbar.width + 2),
- (U16) b->y + b->height - (image_height + 4),
- get_image(IMG_EDITOR_DALMATIAN_SMALL));
- }
- /* PMT VIKAS END 20050817 */
- }
- }
- }
- #endif /* __MMI_UI_DALMATIAN_EDITOR__ */
- /* PMT VIKAS END 20050707 */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if ((GetMessagesCurrScrnID() == SCR_ID_NSM_EDITOR) || ((GetExitScrnID() == SCR_ID_MSG_OUTBOX_MSG) && (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)) /* Update ucs2 flag when entering outbox msg */
- )
- {
- picmsg_text_struct.ucs2_count = b->UCS2_count;
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- //W05.49 Fix cursor in Information Bar Issue
- //W06.03 Fix cursor issue when adding image in MMS
- if (!(b->flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE))/* if not view mode then do .. */
- if(!(b->ext_flags &GUI_MULTI_LINE_INPUT_BOX_DISABLE_FORCE_CURSOR_APPEAR))
- //W06.51 Fix cursor may not update the offset_y if ((flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW))
- {
- if ((b->cursor_y+current_line_height+b->text_offset_y) > edit_height && edit_height > character_height)
- {
- b->text_offset_y = -(b->cursor_y+current_line_height - edit_height);
- }
- else if ((b->cursor_y + b->text_offset_y) < 0)
- {
- b->text_offset_y = -(b->cursor_y);
- }
- StopMyTimer(BLINKING_CURSOR);
- }
- UI_UNUSED_PARAMETER(dummy_c);
- /* PMT RAKESH START 20061006 */
- #if defined __MMI_HINDI_ALG__
- restore_current_language_for_hindi_rules();
- #endif
- /* PMT RAKESH END 20061006 */
- }
- /*****************************************************************************
- * FUNCTION
- * gui_destroy_multi_line_input_box
- * DESCRIPTION
- * Destroys the multi-line inputbox
- *
- * This function only frees the buffer used by the multi-line input box.
- * It does not destroy the multi-line inputbox object.
- * PARAMETERS
- * b [IN] Is the multi-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_destroy_multi_line_input_box(multi_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_free(b->text);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_delete_character
- * DESCRIPTION
- * Deletes a character before the current cursor position (Backspace)
- * PARAMETERS
- * b [IN] Is the multi-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_multi_line_input_box_delete_character(multi_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type current_text_p;
- UI_buffer_type previous_text_p;
- UI_character_type current_character = (UI_character_type) - 1;
- UI_character_type dummy_c = 0;
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- U8 input_mode = 1;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(b->change_event_handler)
- {
- UI_buffer_type tmp_p = b->cursor_p;
- UI_STRING_GET_PREVIOUS_CHARACTER(tmp_p,dummy_c);
- if(!b->change_event_handler(GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR,(U16)dummy_c))
- return;
- }
- current_text_p = b->cursor_p;
- previous_text_p = b->cursor_p;
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- WCSS_input_change_enable = 0;
- if (b->flags & UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE)
- {
- if (b->cursor_p - 2 >= b->text)
- {
- UI_buffer_type cursor_p = b->cursor_p;
- BOOL has_editable_char = MMI_FALSE;
- while (cursor_p - 2 >= b->text)
- {
- if (cat115buffer[(cursor_p - 2 - b->text) >> 1] != 0xFF)
- {
- has_editable_char = MMI_TRUE;
- break;
- }
- cursor_p -= 2;
- }
- if (!has_editable_char) /* eg. "--nnn" */
- {
- UI_editor_play_tone_cannot_change();
- WCSS_input_change_enable = 1;
- return;
- }
- input_mode = cat115buffer[(b->cursor_p - 2 - b->text) >> 1];
- while (input_mode == 0xFF && b->cursor_p - 2 >= b->text /* redundant check */ )
- {
- gui_multi_line_input_box_previous(&MMI_multiline_inputbox);
- input_mode = cat115buffer[(b->cursor_p - 2 - b->text) >> 1];
- }
- current_text_p = b->cursor_p;
- previous_text_p = b->cursor_p;
- }
- }
- #endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */
- if (previous_text_p == b->text)
- {
- UI_editor_play_tone_cannot_change(); /* play tone */
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- WCSS_input_change_enable = 1; /* change back to 1 after returing from this function */
- #endif
- return;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(previous_text_p, dummy_c);
- if (UI_TEST_GSM_EXTENDED(dummy_c))
- {
- if (b->GSM_ext_count > 0)
- {
- b->GSM_ext_count--;
- }
- }
- if (b->icon_callback)
- {
- /* previous_text_p is the first character to be deleted */
- S32 cnt, gsm_char_cnt = 0;
- UI_buffer_type tmp_text_p = previous_text_p;
- UI_character_type tmp_c;
- UI_STRING_GET_PREVIOUS_CHARACTER(tmp_text_p, tmp_c);
- if (UI_TEST_GSM_EXTENDED(tmp_c))
- {
- gsm_char_cnt++;
- }
- for (cnt = 2; cnt <= MMI_MULTILINE_ICON_MAX_STRING_LEN; cnt++)
- {
- if (tmp_text_p < b->text)
- {
- break;
- }
- if (cnt == b->icon_callback(tmp_text_p, MMI_FALSE, NULL, NULL, 0, 0))
- {
- /* Delete an icon as character sequence */
- previous_text_p = tmp_text_p;
- dummy_c = tmp_c;
- if (b->GSM_ext_count > gsm_char_cnt)
- {
- b->GSM_ext_count -= gsm_char_cnt;
- }
- else
- {
- b->GSM_ext_count = 0;
- }
- break;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(tmp_text_p, tmp_c);
- if (UI_TEST_GSM_EXTENDED(tmp_c))
- {
- gsm_char_cnt++;
- }
- }
- }
- #if(MULTILINE_INPUTBOX_USE_CRLF_COMBINATION)
- if (UI_TEST_LF_CHARACTER(dummy_c))
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(previous_text_p, dummy_c);
- if (!UI_TEST_CR_CHARACTER(dummy_c)
- || (b->change_event_handler && !b->change_event_handler(GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR,(U16)dummy_c)))
- {
- UI_STRING_GET_NEXT_CHARACTER(previous_text_p, dummy_c);
- }
- }
- #endif /* (MULTILINE_INPUTBOX_USE_CRLF_COMBINATION) */
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- /* If In Non * Mode No Need To Decrease the text_length */
- if (((b->flags & UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE) && (input_mode & PIXTEL_UI_WCSS_STAR_INPUT)) ||
- !(b->flags & UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE))
- {
- #endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */
- b->text_length -= ((S32) current_text_p - (S32) previous_text_p);
- b->cursor_p = previous_text_p;
- if (b->flags & UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- UI_TEST_UCS2_DECREMENT_COUNT_SET_LENGTH(dummy_c, b->UCS2_count, b->allocated_length, b->available_length);
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- UI_STRING_INSERT_CHARACTER(previous_text_p, current_character); /* insert character */
- }
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- } /* if non-WCSS or not in * mode */
- else if ((b->flags & UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE) && (!(input_mode & PIXTEL_UI_WCSS_STAR_INPUT)))
- {
- b->cursor_p = previous_text_p;
- if (input_mode & PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER)
- {
- current_character = 0x20; /* ' ' */
- }
- else
- {
- current_character = 0x30; /* '0' */
- }
- UI_STRING_INSERT_CHARACTER(previous_text_p, current_character);
- }
- WCSS_input_change_enable = 1;
- #endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */
- b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- #ifdef __MMI_HINDI_ALG__
- if ((b->cursor_p - b->text) >= 4)
- {
- UI_buffer_type temp_multi_line_cursor_p;
- temp_multi_line_cursor_p = b->cursor_p;
- if ((UI_CHK_CONSONANT(*(temp_multi_line_cursor_p - 4))) && (UI_CHK_CONSONANT(*(temp_multi_line_cursor_p))) &&
- (*(temp_multi_line_cursor_p - 2) == 0x4d))
- {
- U8 skip_after_delete = 0;
- PU8 first_pos_p = temp_multi_line_cursor_p;
- PU8 second_pos_p;
- /* second_pos_p = hf_get_next_cluster_p(b->text,first_pos_p); */
- second_pos_p = hf_get_next_cluster_p(first_pos_p, first_pos_p);
- skip_after_delete = second_pos_p - first_pos_p; /* Number of moves */
- skip_after_delete = skip_after_delete >> 1;
- while (skip_after_delete--)
- {
- UI_STRING_GET_NEXT_CHARACTER(b->cursor_p, dummy_c);
- }
- }
- }
- #endif /* __MMI_HINDI_ALG__ */
- if (b->show_action_flag)
- {
- gui_show_multi_line_input_box(b); /* show multiline input box */
- }
- b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
- /* !!! Note : For for Nokia smart message write message screen */
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_WRITE)
- {
- g_nsm_msg_context.UCS2_count = b->UCS2_count;
- if (g_nsm_msg_context.UCS2_count == 0)
- {
- MMI_multiline_inputbox.available_length = mmi_nsm2_get_remaining_len();
- wgui_inputbox_buffer_size = (MMI_multiline_inputbox.available_length >> 1);
- wgui_redraw_input_information_bar();
- }
- g_nsm_msg_context.textlength = b->text_length;
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if (GetMessagesCurrScrnID() == SCR_ID_NSM_EDITOR)
- {
- picmsg_text_struct.ucs2_count = b->UCS2_count;
- if (picmsg_text_struct.ucs2_count == 0)
- {
- MMI_multiline_inputbox.available_length = mmi_nsm_get_infobar_maxlen();
- wgui_inputbox_buffer_size = (MMI_multiline_inputbox.available_length >> 1);
- wgui_redraw_input_information_bar();
- }
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- b->validation_callback(b->text, b->cursor_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_delete_all
- * DESCRIPTION
- * Deletes all characters
- * PARAMETERS
- * b [IN] Is the multi-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_multi_line_input_box_delete_all(multi_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type c;
- UI_buffer_type p = b->text;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(p, c);
- UI_UNUSED_PARAMETER(c);
- if(b->change_event_handler)
- {
- if(!b->change_event_handler(GUI_MULTI_LINE_INPUT_BOX_DELETEALL,0))
- return;
- }
- gui_multi_line_input_box_clear(b); /* initilaize multiline box */
- b->cursor_p = b->text;
- b->cursor_line_position_counter = 0;
- b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- gui_show_multi_line_input_box(b); /* show multiline input box */
- b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- /* For clear all characters from multiline input box */
- #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_WRITE) /* For nsm2 write message only */
- {
- g_nsm_msg_context.UCS2_count = b->UCS2_count;
- MMI_multiline_inputbox.available_length = mmi_nsm2_get_remaining_len();
- wgui_inputbox_buffer_size = (MMI_multiline_inputbox.available_length >> 1);
- if (wgui_inputbox_information_flag)
- {
- wgui_redraw_remaining_characters_display();
- }
- g_nsm_msg_context.textlength = b->text_length;
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if (GetMessagesCurrScrnID() == SCR_ID_NSM_EDITOR)
- {
- picmsg_text_struct.ucs2_count = b->UCS2_count;
- MMI_multiline_inputbox.available_length = mmi_nsm_get_infobar_maxlen();
- wgui_inputbox_buffer_size = (MMI_multiline_inputbox.available_length >> 1);
- wgui_redraw_input_information_bar();
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- b->validation_callback(b->text, b->cursor_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_delete_current_character
- * DESCRIPTION
- * Deletes a character at the current cursor position (Delete)
- * PARAMETERS
- * b [IN] Is the multi-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_multi_line_input_box_delete_current_character(multi_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type current_text_p;
- UI_buffer_type previous_text_p;
- UI_character_type current_character = (UI_character_type) - 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_text_p = b->cursor_p;
- previous_text_p = b->cursor_p;
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- if (b->icon_callback)
- {
- /* current_text_p is the character next to the last character to be deleted */
- S32 cnt;
- if ((cnt = b->icon_callback(previous_text_p, MMI_FALSE, NULL, NULL, 0, 0)) > 0)
- {
- /* Delete an icon as character sequence */
- current_text_p = previous_text_p + ((cnt - 1) << 1);
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- }
- }
- #if(MULTILINE_INPUTBOX_USE_CRLF_COMBINATION)
- if (UI_TEST_CR_CHARACTER(current_character))
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- if (!UI_TEST_LF_CHARACTER(current_character)
- || !b->change_event_handler(GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR,(U16)current_character))
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
- }
- }
- #endif /* (MULTILINE_INPUTBOX_USE_CRLF_COMBINATION) */
- if (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- if (UI_TEST_GSM_EXTENDED(current_character))
- {
- if (b->GSM_ext_count > 0)
- {
- b->GSM_ext_count--;
- }
- }
- if (b->flags & UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- UI_TEST_UCS2_DECREMENT_COUNT_SET_LENGTH(
- current_character,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- UI_STRING_INSERT_CHARACTER(previous_text_p, current_character);
- }
- b->text_length -= ((S32) current_text_p - (S32) previous_text_p);
- if (b->flags & UI_MULTI_LINE_INPUT_BOX_STATE_MULTITAP)
- {
- b->flags &= ~UI_MULTI_LINE_INPUT_BOX_STATE_MULTITAP;
- }
- b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- gui_show_multi_line_input_box(b); /* show multiline input box */
- b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
- b->validation_callback(b->text, b->cursor_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- else
- {
- UI_editor_play_tone_cannot_change(); /* play error tone */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_insert_character
- * DESCRIPTION
- * Inserts a character at the current cursor position
- * PARAMETERS
- * b [IN] Is the multi-line inputbox object
- * c [IN] Is the character to be inserted
- * RETURNS
- * void
- *****************************************************************************/
- MMI_BOOL gui_multi_line_input_box_insert_character_internal(multi_line_input_box *b, UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type p1, p2;
- UI_character_type old_c, dummy_c = 0;
- U32 b_flags = b->flags;
- S32 text_length = b->text_length;
- U8 GSM_extended_flag = 0;
- /* MTK Terry for 0x81 encoding support for Phone Book */
- U8 temp_0x81 = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(b->change_event_handler)
- {
- if(!b->change_event_handler(GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR,(U16)c))
- return MMI_FALSE;
- }
- /* MTK Terry for 0x81 memory corrupt issue */
- if (MMI_current_input_ext_type & INPUT_TYPE_EXT_USE_0x81_ENCODING)
- {
- temp_0x81 = mmi_phb_convert_to_0x81((S8*) MMI_multiline_inputbox.text, FALSE);
- }
- if ((MMI_current_input_ext_type & INPUT_TYPE_EXT_USE_0x81_ENCODING) && (0 != temp_0x81))
- {
- if ((text_length >> 1) - 1 >= b->available_length - 3)
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone */
- return MMI_FALSE;
- }
- }
- else
- {
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_CHECK_GSM_EXTENDED)
- {
- if (UI_TEST_GSM_EXTENDED(c))
- {
- GSM_extended_flag = 1;
- }
- if (b->UCS2_count == 0)
- {
- text_length += (b->GSM_ext_count * ENCODING_LENGTH);
- }
- }
- if ((b_flags & UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) &&
- UI_TEST_UCS2_CHARACTER(c))
- {
- if ((b_flags & UI_MULTI_LINE_INPUT_BOX_ONE_LESS_CHARACTER) &&
- (text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone */
- return MMI_FALSE;
- }
- if ((b_flags & UI_MULTI_LINE_INPUT_BOX_FORTY_FOUR_LESS_CHARACTER) &&
- (text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_FORTYFOUR(b->available_length)))
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone */
- return MMI_FALSE;
- }
- else if (text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
- {
- UI_editor_play_tone_cannot_insert(); /* play eror tone */
- return MMI_FALSE;
- }
- }
- if (GSM_extended_flag && (text_length >= (b->available_length - ENCODING_LENGTH)))
- {
- UI_editor_play_tone_cannot_insert();
- return MMI_FALSE;
- }
- }
- p1 = p2 = b->cursor_p;
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_OVERWRITE_MODE)
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- if ((p1 == b->last_position_p) && (text_length >= b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return MMI_FALSE;
- }
- if (GSM_extended_flag)
- {
- b->GSM_ext_count++;
- }
- if (!UI_STRING_END_OF_STRING_CHARACTER(old_c)) /* check for end of string */
- {
- UI_STRING_INSERT_CHARACTER(p2, c);
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else if (b_flags & UI_MULTI_LINE_INPUT_BOX_FORTY_FOUR_LESS_CHARACTER)
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE3(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- b->cursor_p = p2;
- }
- else /* UI_STRING_END_OF_STRING_CHARACTER(old_c) */
- {
- p1 = b->cursor_p;
- UI_STRING_GET_NEXT_CHARACTER(b->cursor_p, dummy_c); /* get next character */
- while (!UI_STRING_END_OF_STRING_CHARACTER(c)) /* check for end of string */
- {
- 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 */
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_MULTI_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else if (b_flags & UI_MULTI_LINE_INPUT_BOX_FORTY_FOUR_LESS_CHARACTER)
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE3(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- b->text_length += ((S32) p2 - (S32) p1);
- }
- }
- else /* b_flags & UI_MULTI_LINE_INPUT_BOX_OVERWRITE_MODE */
- {
- if (text_length >= (b->available_length) &&
- !((MMI_current_input_ext_type & INPUT_TYPE_EXT_USE_0x81_ENCODING) && (0 != temp_0x81)))