gui_ems.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:414k
- ty + line_height - (object_height >> 1),
- strikethrough_color);
- }
- }
- #ifdef __MMI_HINDI_ALG__
- end_ems_disp:
- memset(disp_ems_cluster, 0, sizeof(disp_ems_cluster));
- #endif /* __MMI_HINDI_ALG__ */
- #endif /* (EMS_ENABLE_SPECIAL_FONT_DISPLAY) */ /* end of #if(EMS_ENABLE_SPECIAL_FONT_DISPLAY) */
- }
- #ifdef __MMI_HINDI_ALG__
- else
- {
- temp_ems_cursor_p += 2;
- }
- #endif /* __MMI_HINDI_ALG__ */
- }
- }
- if (!(((-1) != move_to_x) || ((-1) != move_to_y)))
- {
- if ((!cursor_displayed_flag) &&
- (mapped_previous_position.OffsetToText == mapped_cursor_position.OffsetToText))
- {
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- if (!disable_draw_flag && !(flags & UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW))
- {
- if (default_direction != BIDI_L)
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- /* PMT START FIX HINDI ISSUES 20060604 */
- S32 h, w;
- gui_measure_character(pre_character, &w, &h);
- tx -= ems_cluster_width;
- tx += ems_cursor_width;
- gui_show_EMS_input_box_cursor(b, tx + 1 + ems_cluster_width, ty, 0, h, 1);
- }
- else
- {
- gui_show_EMS_input_box_cursor(
- b,
- tx + 1 + ems_cluster_width,
- line_height - object_height + ty,
- 0,
- object_height,
- 1);
- }
- /* PMT END FIX HINDI ISSUES 20060604 */
- #else /* __MMI_HINDI_ALG__ */
- gui_show_EMS_input_box_cursor(
- b,
- tx + object_width,
- line_height - object_height + ty,
- 0,
- object_height,
- 1);
- #endif /* __MMI_HINDI_ALG__ */
- }
- else
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- /* PMT START FIX HINDI ISSUES 20060604 */
- S32 h, w;
- gui_measure_character(pre_character, &w, &h);
- tx -= ems_cluster_width;
- tx += ems_cursor_width;
- gui_show_EMS_input_box_cursor(b, tx + 1, ty, 0, h, 1);
- }
- else
- {
- gui_show_EMS_input_box_cursor(
- b,
- tx + 1,
- line_height - object_height + ty,
- 0,
- object_height,
- 1);
- }
- /* PMT END FIX HINDI ISSUES 20060604 */
- #else /* __MMI_HINDI_ALG__ */
- gui_show_EMS_input_box_cursor(
- b,
- tx,
- line_height - object_height + ty,
- 0,
- object_height,
- 1);
- #endif /* __MMI_HINDI_ALG__ */
- }
- }
- cursor_displayed_flag = 1;
- }
- }
- else if ((((-1) != move_to_x) || ((-1) != move_to_y)))
- {
- if (((tx + b->x + object_width) > move_to_x) &&
- ((cursor_ay + line_height + b->y + b->display_y + b->header_height) > move_to_y) &&
- (!set_cursor_flag))
- {
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- /* EMS_map_position(data,&previous_position,&(data->CurrentPosition)); */
- MoveCursorToPosition(data, &previous_position);
- set_cursor_flag = 1;
- #if(EMS_USE_ESC_COMBINATION)
- /* W05.52 Fix Cursor Moviong issue for ESC character */
- gui_EMS_input_box_back_cursor_for_ESC_character(data, &previous_position);
- #endif /* (EMS_USE_ESC_COMBINATION) */
- }
- else if (((cursor_ay + line_height + b->y + b->display_y + b->header_height) > move_to_y) &&
- (n_lines < (b->n_lines)) && (!set_cursor_flag) &&
- (((line_object_count + 1) >= break_line_object_count) ||
- (UI_TEST_CR_CHARACTER(current_character))))
- {
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- /* EMS_map_position(data,&previous_position,&(data->CurrentPosition)); */
- MoveCursorToPosition(data, &previous_position);
- set_cursor_flag = 1;
- #if(EMS_USE_ESC_COMBINATION)
- /* W05.52 Fix Cursor Moviong issue for ESC character */
- gui_EMS_input_box_back_cursor_for_ESC_character(data, &previous_position);
- #endif /* (EMS_USE_ESC_COMBINATION) */
- }
- }
- /* START FARHAD PMT 20050211 */
- if (default_direction == BIDI_L)
- {
- #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;
- }
- }
- #ifdef __MMI_HINDI_ALG__
- line_object_count += saved_ems_display_skip_moves;
- hindi_cache_counter++;
- #else /* __MMI_HINDI_ALG__ */
- line_object_count++;
- #endif /* __MMI_HINDI_ALG__ */
- 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 (line_object_count == 0)
- {
- line_height = object_height;
- }
- current_text_format = &UI_EMS_normal_text_format_object;
- #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) */
- }
- }
- pre2_character = pre_character;
- pre_character = current_character;
- break;
- #ifdef __MMI_MESSAGES_EMS__
- case 2: /* object */
- /* MTK Terry for speed up Editor by only display the characters in the display area */
- if (((ty + line_height) < (y1 + 2)) && ((ty - line_height) > y2))
- {
- break;
- }
- if (current_object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- gui_EMS_input_box_set_text_format(b, current_object);
- object_height = gui_get_character_height();
- current_text_format = current_object;
- #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) */
- text_format_object_count = ((current_object->data->text_format.textLength) >> 1);
- if (line_object_count == 0)
- {
- switch (current_text_format->data->text_format.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;
- }
- }
- }
- else
- {
- object_width = object_width_cache[line_object_count];
- object_height = object_height_cache[line_object_count];
- if (first_object_flag)
- {
- if (default_direction == BIDI_L)
- {
- object_width += 1;
- tx += 1;
- }
- else
- {
- object_width += 1;
- tx -= 1;
- }
- }
- else
- {
- if(default_direction == BIDI_L)
- {
- tx += 3;
- }
- }
- if (default_direction == BIDI_R)
- {
- tx -= object_width;
- cursor_ax -= object_width;
- }
- /* MTK end */
- if (!(((-1) != move_to_x) || ((-1) != move_to_y)))
- {
- if ((mapped_cursor_position.Object != NULL) &&
- (mapped_previous_position.Object != NULL) &&
- (mapped_previous_position.OffsetToText == mapped_cursor_position.OffsetToText) &&
- (mapped_previous_position.Object == mapped_cursor_position.Object))
- {
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- if (!disable_draw_flag)
- {
- gui_EMS_input_box_display_object(
- tx,
- line_height - object_height + ty,
- current_object,
- 1);
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW))
- {
- /* MTK Terry for EMS Multitap Highlight Issue */
- if (overwrite_mode_flag ||
- selection_flag && !(flags & UI_EMS_INPUT_BOX_STATE_MULTITAP))
- {
- S32 rx1, ry1, rx2, ry2;
- rx1 = tx;
- ry1 = line_height - object_height + ty;
- rx2 = rx1 + object_width - 1;
- ry2 = ry1 + object_height - 1;
- gui_cross_hatch_fill_rectangle(rx1, ry1, rx2, ry2, b->selection_color);
- }
- if (default_direction != BIDI_L)
- /* PMT START MAUI_00223197 */
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- S32 h, w;
- gui_measure_character(pre_character, &w, &h);
- gui_show_EMS_input_box_cursor(
- b,
- tx + object_width,
- ty,
- object_width,
- h,
- 2);
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- /* PMT END MAUI_00223197 */
- gui_show_EMS_input_box_cursor(
- b,
- tx + object_width,
- line_height - object_height + ty,
- object_width,
- object_height,
- 2);
- /* PMT START MAUI_00223197 */
- }
- }
- else
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- S32 h, w;
- gui_measure_character(pre_character, &w, &h);
- gui_show_EMS_input_box_cursor(b, tx, ty, object_width, h, 2);
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- /* PMT END MAUI_00223197 */
- gui_show_EMS_input_box_cursor(
- b,
- tx,
- line_height - object_height + ty,
- object_width,
- object_height,
- 2);
- /* PMT START MAUI_00223197 */
- }
- }
- }
- else if (EMS_view_mode)
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(pre_character))
- {
- S32 h, w;
- gui_measure_character(pre_character, &w, &h);
- gui_show_EMS_input_box_cursor(b, tx, ty, object_width, h, 3);
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- {
- gui_show_EMS_input_box_cursor(
- b,
- tx,
- line_height - object_height + ty,
- object_width,
- object_height,
- 3);
- }
- }
- /* PMT END MAUI_00223197 */
- }
- cursor_displayed_flag = 1;
- }
- else if (!disable_draw_flag)
- {
- gui_EMS_input_box_display_object(
- tx,
- line_height - object_height + ty,
- current_object,
- 0);
- }
- }
- else if ((((-1) != move_to_x) || ((-1) != move_to_y)))
- {
- if (((tx + b->x + object_width) > move_to_x) &&
- ((cursor_ay + line_height + b->y + b->display_y + b->header_height) > move_to_y) &&
- (!set_cursor_flag))
- {
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- /* EMS_map_position(data,&previous_position,&(data->CurrentPosition)); */
- MoveCursorToPosition(data, &previous_position);
- set_cursor_flag = 1;
- }
- }
- if (default_direction == BIDI_L)
- {
- tx += object_width;
- cursor_ax += object_width;
- }
- line_object_count++;
- }
- current_character = 0;
- break;
- #endif /* __MMI_MESSAGES_EMS__ */
- }
- first_object_flag = 0;
- }
- #ifdef __MMI_BIDI_ALG__
- if (!(flags & UI_EMS_INPUT_BOX_DISABLE_DRAW) && arabic_char_flag)
- {
- memcpy(data->textBuffer + temp_text_position, temp_text_buffer, visual_str_len * ENCODING_LENGTH);
- mapped_cursor_position.OffsetToText = temp_cursor_position;
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- }
- #endif /* __MMI_BIDI_ALG__ */
- line_start_position = current_position;
- if ((current_character == EMS_INPUTBOX_PARAGRAPH_BREAK_CHARACTER)
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_NEWLINE)
- || (UI_TEST_LF_CHARACTER(current_character) && (flags & UI_EMS_INPUT_BOX_NEWLINE_DRAW))
- #endif
- )
- {
- if (!disable_draw_flag)
- {
- EMS_EDITOR_DRAW_DOTTED_LINE(x1 + 2, x2 - 1, ty + line_height + 2, paragraph_color);
- }
- ty += 4; /* 4=height of line break horizontal rule display */
- cursor_ay += 4;
- b->display_height += 4;
- }
- /* START PMT NEERAJ 20050916 */
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES)
- else
- {
- if (flags & UI_EMS_INPUT_BOX_ALL_LINE_DRAW)
- {
- if (!disable_draw_flag)
- {
- UI_draw_horizontal_line(x1 + 2, x2 - 1, ty + line_height + 2, gui_color(112, 125, 240));
- last_line_y = ty + line_height + 2;
- line_height += 4;
- }
- else
- {
- line_height += 4;
- }
- }
- }
- #endif /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- /* END PMT NEERAJ 20050916 */
- line_height += 1; /* +1 added for 1 pixel gap between lines */
- ty += line_height;
- cursor_ay += line_height;
- b->display_height += line_height;
- }
- b->n_lines = n_lines;
- /* START PMT NEERAJ 20050916 */
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES)
- if (flags & UI_EMS_INPUT_BOX_ALL_LINE_DRAW)
- {
- minimum_line_height = object_height;
- if (!disable_draw_flag)
- {
- while (last_line_y <= y2)
- {
- last_line_y += minimum_line_height + 5;
- UI_draw_horizontal_line(x1 + 2, x2 - 1, last_line_y, gui_color(112, 125, 240));
- }
- /* if (EMS_view_mode)
- {
- #if defined(__MMI_MAINLCD_240X320__)
- if (last_line_y - y2 <= minimum_line_height - 13 && b->display_y != 0)
- #elif defined(__MMI_MAINLCD_128X128__)
- if (last_line_y - y2 <= minimum_line_height - 12 && b->display_y != 0)
- #else
- if (last_line_y - y2 <= minimum_line_height - 11 && b->display_y != 0)
- #endif
- {
- b->display_y -= 3;
- }
- }*/
- }
- }
- #endif /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- /* END PMT NEERAJ 20050916 */
- /* W06.12 cursor_displayed_flag is only used when not moving cusrsor by pen */
- if (!cursor_displayed_flag && ((move_to_x == (-1)) && (move_to_y == (-1))))
- {
- cursor_ay -= (line_height);
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height - 1;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- if (!disable_draw_flag && !(flags & UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW))
- {
- /* START PMT NEERAJ 20050916 */
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES)
- #ifdef __MMI_HINDI_ALG__
- if (flags & UI_EMS_INPUT_BOX_ALL_LINE_DRAW)
- {
- gui_show_EMS_input_box_cursor(b, tx + 1, ty - line_height, 0, line_height - 5, 1);
- }
- else
- {
- gui_show_EMS_input_box_cursor(b, tx + 1, ty - line_height, 0, line_height - 1, 1);
- }
- #else /* __MMI_HINDI_ALG__ */
- if (flags & UI_EMS_INPUT_BOX_ALL_LINE_DRAW)
- {
- gui_show_EMS_input_box_cursor(b, tx, ty - line_height, 0, line_height - 5, 1);
- }
- else
- {
- gui_show_EMS_input_box_cursor(b, tx, ty - line_height, 0, line_height - 1, 1);
- }
- #endif /* __MMI_HINDI_ALG__ */
- #else /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- /* END PMT NEERAJ 20050916 */
- #ifdef __MMI_HINDI_ALG__
- /* if( UI_HINDI_CHARACTER_UCS2_RANGE(pre_character)) */
- gui_show_EMS_input_box_cursor(b, tx + 1, ty - line_height, 0, line_height - 1, 1);
- #else /* __MMI_HINDI_ALG__ */
- gui_show_EMS_input_box_cursor(b, tx, ty - line_height, 0, line_height - 1, 1);
- #endif /* __MMI_HINDI_ALG__ */
- /* START PMT NEERAJ 20050916 */
- #endif /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- /* END PMT NEERAJ 20050916 */
- }
- cursor_ay += line_height;
- }
- if ((((-1) != move_to_x) || ((-1) != move_to_y)) && (!set_cursor_flag))
- {
- cursor_ay -= (line_height);
- b->cursor_ax = cursor_ax;
- b->cursor_ay = cursor_ay;
- b->cursor_line_height = line_height - 1;
- b->cursor_line_position = line_object_count;
- b->current_line = n_lines - 1;
- /* EMS_map_position(data,¤t_position,&(data->CurrentPosition)); */
- MoveCursorToPosition(data, ¤t_position);
- //W05.34 Fix warning tone in stylus on the blank area
- //gui_EMS_input_box_next(b);
- cursor_ay += line_height;
- }
- #if(EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES)
- /* W06.16 If EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES, the height of the last line is different */
- if ((flags & UI_EMS_INPUT_BOX_ALL_LINE_DRAW) && (b->current_line == (b->n_lines - 1)))
- {
- b->cursor_line_height = line_height;
- }
- #endif /* (EMS_SHOW_HORIZONTAL_RULE_FOR_ALL_LINES) */
- if (b->saved_cursor_ax == -1)
- {
- b->saved_cursor_ax = b->cursor_ax;
- }
- /* W06.16 Set text format after changing cursor position by pen */
- if ((!EMS_view_mode) && (((-1) != move_to_x) || ((-1) != move_to_y)))
- {
- gui_EMS_input_box_set_text_format_cursor_position(b);
- }
- if (!disable_draw_flag && !(flags & UI_EMS_INPUT_BOX_DISABLE_SCROLLBAR))
- {
- if (flags & UI_EMS_INPUT_BOX_DISPLAY_HEADER)
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, b->height - 2);
- gui_set_vertical_scrollbar_range(&b->vbar, cursor_ay + b->header_height);
- gui_set_vertical_scrollbar_value(&b->vbar, -b->display_y);
- }
- else
- {
- gui_set_vertical_scrollbar_scale(&b->vbar, b->height - 2);
- /* W06.12 Use b->display_height + 2 instead of cursor_ay
- 1.cursor_ay is different when the cusrosr at the last line
- 2.(+2)because that the box_height is b->height - 4 in gui_EMS_input_box_locate_cursor */
- gui_set_vertical_scrollbar_range(&b->vbar, b->display_height + 2);
- /* gui_set_vertical_scrollbar_range( &b->vbar, cursor_ay ); */
- gui_set_vertical_scrollbar_value(&b->vbar, -b->display_y);
- }
- if (flags & UI_EMS_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;
- }
- }
- }
- /* Handle next line, previous line navigation */
- if (disable_draw_flag)
- {
- if (flags & UI_EMS_INPUT_BOX_PREVIOUS_LINE)
- {
- if (EMS_view_mode)
- {
- S32 fdl = b->first_displayed_line;
- EMSPosition new_position;
- if (data->listHead == NULL)
- {
- b->current_line = fdl;
- if (b->current_line > 0)
- {
- b->current_line--;
- }
- else
- {
- b->cursor_ay = 0;
- }
- new_position = b->line_positions[b->current_line];
- MoveCursorToPosition(data, &new_position);
- }
- else
- {
- if ((data->CurrentPosition.OffsetToText > 0) || (data->CurrentPosition.Object != NULL))
- {
- EMSPosition new_position;
- U8 flag;
- U8 done = 0;
- while (!done)
- {
- flag = 0;
- if (b->current_line > 0)
- {
- flag = 1;
- b->current_line--;
- }
- else
- {
- b->cursor_ay = 0;
- }
- new_position = b->line_positions[b->current_line];
- if (BackwardCurrentPositionObject(data, &new_position))
- {
- if (flag)
- {
- b->current_line++;
- }
- }
- else
- {
- break;
- }
- if (b->current_line > 0)
- {
- b->current_line--;
- }
- else
- {
- break;
- }
- if (b->current_line <= (fdl - 1))
- {
- break;
- }
- }
- }
- }
- }
- else
- {
- if (b->current_line > 0)
- {
- EMSPosition new_position;
- S32 object_count = b->cursor_line_position;
- S32 new_position_object_count;
- b->current_line--;
- new_position = b->line_positions[b->current_line];
- new_position_object_count = b->line_object_counts[b->current_line] - 1;
- if (object_count > new_position_object_count)
- {
- object_count = new_position_object_count;
- }
- MoveCursorToPosition(data, &new_position);
- #if(EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT)
- EMS_move_graphical_cursor(
- data,
- b->line_x_positions[b->current_line],
- b->saved_cursor_ax,
- new_position_object_count);
- #else /* (EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT) */
- ForwardCurrentPosition(data, (U16) object_count);
- #endif /* (EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT) */
- }
- else
- {
- if (flags & UI_EMS_INPUT_BOX_DISABLE_TONE)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_DISABLE_TONE;
- }
- else
- {
- UI_editor_play_tone_cannot_navigate();
- }
- }
- }
- /* MTK Terry for scroll down problem for extension character in EMS_view_mode temp solution */
- if (!EMS_view_mode)
- {
- EMS_handle_CRLF_navigation(data);
- }
- /* if(!TestFirstPosition(data,&data->CurrentPosition)) */
- gui_EMS_input_box_set_text_format_cursor_position(b);
- }
- else if (flags & UI_EMS_INPUT_BOX_PREVIOUS_OBJECT)
- {
- if (EMS_view_mode && (data->listHead != NULL))
- {
- if ((data->CurrentPosition.OffsetToText > 0) || (data->CurrentPosition.Object != NULL))
- {
- EMSPosition new_position;
- new_position = b->line_positions[b->current_line];
- BackwardCurrentPositionSeekObject(data, &new_position);
- }
- }
- }
- if (flags & UI_EMS_INPUT_BOX_NEXT_LINE)
- {
- if (EMS_view_mode)
- {
- S32 ldl = b->last_displayed_line;
- EMSPosition new_position;
- if (data->listHead == NULL)
- {
- b->current_line = ldl;
- if (b->current_line < (b->n_lines - 1))
- {
- b->current_line++;
- }
- new_position = b->line_positions[b->current_line];
- MoveCursorToPosition(data, &new_position);
- }
- else
- {
- if (!TestLastPosition(data, &data->CurrentPosition))
- {
- EMSPosition new_position, old_position;
- U8 flag;
- U8 done = 0;
- while (!done)
- {
- flag = 0;
- if (b->current_line < (b->n_lines - 1))
- {
- flag = 1;
- b->current_line++;
- }
- new_position = b->line_positions[b->current_line];
- if (ForwardCurrentPositionObject(data, &new_position))
- {
- if (flag)
- {
- b->current_line--;
- }
- }
- else
- {
- break;
- }
- flag = 0;
- if (b->current_line < (b->n_lines - 1))
- {
- new_position = b->line_positions[b->current_line + 1];
- }
- else
- {
- new_position.OffsetToText = data->textLength;
- new_position.Object = data->listTail;
- flag = 1;
- }
- old_position = data->CurrentPosition;
- if (ForwardCurrentPositionObject(data, &new_position))
- {
- if (!flag)
- {
- MoveCursorToPosition(data, &old_position);
- }
- }
- else
- {
- break;
- }
- if (b->current_line < (b->n_lines - 1))
- {
- b->current_line++;
- }
- else
- {
- break;
- }
- if (b->current_line >= (ldl + 1))
- {
- break;
- }
- }
- }
- }
- }
- else
- {
- if (b->current_line < (b->n_lines - 1))
- {
- EMSPosition new_position;
- S32 object_count = b->cursor_line_position;
- S32 new_position_object_count;
- b->current_line++;
- new_position = b->line_positions[b->current_line];
- new_position_object_count = b->line_object_counts[b->current_line];
- if (b->current_line != (b->n_lines - 1))
- {
- new_position_object_count -= 1;
- }
- if (object_count > new_position_object_count)
- {
- object_count = new_position_object_count;
- }
- MoveCursorToPosition(data, &new_position);
- #if(EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT)
- EMS_move_graphical_cursor(
- data,
- b->line_x_positions[b->current_line],
- b->saved_cursor_ax,
- new_position_object_count);
- #else /* (EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT) */
- ForwardCurrentPosition(data, (U16) object_count);
- #endif /* (EMS_ENABLE_GRAPHICAL_CURSOR_MOVEMENT) */
- }
- else
- {
- if (flags & UI_EMS_INPUT_BOX_DISABLE_TONE)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_DISABLE_TONE;
- }
- else
- {
- UI_editor_play_tone_cannot_navigate();
- }
- }
- }
- /* MTK Terry for scroll down problem for extension character in EMS_view_mode temp solution */
- if (!EMS_view_mode)
- {
- EMS_handle_CRLF_navigation(data);
- }
- /* if(!TestLastPosition(data,&data->CurrentPosition)) */
- gui_EMS_input_box_set_text_format_cursor_position(b);
- }
- else if (flags & UI_EMS_INPUT_BOX_NEXT_OBJECT)
- {
- if (EMS_view_mode && (data->listHead != NULL))
- {
- if (!TestLastPosition(data, &data->CurrentPosition))
- {
- EMSPosition new_position;
- if (b->current_line >= (b->n_lines - 1))
- {
- new_position.OffsetToText = data->textLength;
- new_position.Object = data->listTail;
- }
- else
- {
- new_position = b->line_positions[b->current_line + 1];
- }
- ForwardCurrentPositionSeekObject(data, &new_position);
- }
- }
- }
- }
- #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 !*/
- #endif
- #endif /* 0 */
- #ifdef __MMI_BIDI_ALG__
- UI_UNUSED_PARAMETER(temp_hilight_start);
- UI_UNUSED_PARAMETER(temp_hilight_end);
- UI_UNUSED_PARAMETER(temp_text_pt);
- #endif /* __MMI_BIDI_ALG__ */
- /* PMT RAKESH START 20061006 */
- #if defined __MMI_HINDI_ALG__
- restore_current_language_for_hindi_rules();
- #endif
- /* PMT RAKESH END 20061006 */
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_toggle_insert_mode
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_toggle_insert_mode(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if (b->flags & UI_EMS_INPUT_BOX_OVERWRITE_MODE)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_OVERWRITE_MODE;
- }
- else
- {
- b->flags |= UI_EMS_INPUT_BOX_OVERWRITE_MODE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_backspace
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_backspace(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 paragraph_text_align_flag = 0;
- U8 previous_paragraph_text_alignment = EMS_ALIGN_LANG_DEP;
- EMSPosition current_position;
- UI_character_type c;
- EMSObject *o;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if ((b->data != NULL) && (b->data->listHead != NULL))
- {
- current_position = b->data->CurrentPosition;
- if (gui_EMS_input_box_test_paragraph_start(b, ¤t_position))
- {
- gui_EMS_input_box_get_previous_object(b->data, ¤t_position, &c, &o);
- previous_paragraph_text_alignment = gui_EMS_input_box_get_previous_text_alignment(b, ¤t_position);
- paragraph_text_align_flag = 1;
- }
- }
- if (gui_EMS_cancel_current_position(b) == 0)
- {
- UI_editor_play_tone_cannot_change();
- }
- else
- {
-
- if (b->locate_cursor_flag)
- {
- gui_EMS_input_box_locate_cursor(b);
- }
-
- gui_EMS_input_box_set_text_format_cursor_position(b);
- if (paragraph_text_align_flag)
- {
- current_position = b->data->CurrentPosition;
- gui_EMS_input_box_set_paragraph_text_alignment(b, ¤t_position, previous_paragraph_text_alignment);
- }
- }
- b->saved_cursor_ax = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_previous_line
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_previous_line(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 hflag = 0;
- EMSPosition current_position = b->data->CurrentPosition;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- if(b->cursor_ay == 0 && b->display_y <0)
- {
- b->display_y +=20;
- if(b->display_y >0) b->display_y = 0;
- return;
- }
- b->flags |= (UI_EMS_INPUT_BOX_PREVIOUS_LINE | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_show_EMS_input_box(b);
- b->flags &= ~(UI_EMS_INPUT_BOX_PREVIOUS_LINE | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- if (b->cursor_ay == 0)
- {
- hflag = 1;
- }
- /* if(!TestFirstPosition(b->data,¤t_position)) */
- gui_EMS_input_box_locate_cursor(b);
- if ((b->flags & UI_EMS_INPUT_BOX_DISPLAY_HEADER) && hflag
- && (b->cursor_ay == 0) && (b->display_y != 0) &&
- (current_position.Object == NULL) /* && TestFirstPosition(b->data,¤t_position) */ )
- {
- b->flags |= UI_EMS_INPUT_BOX_DISABLE_TONE;
- b->display_y += EMS_HEADER_SCROLL_SIZE; /* Scroll through header */
- if (b->display_y > 0)
- {
- b->display_y = 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_next_line
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_next_line(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- b->flags |= (UI_EMS_INPUT_BOX_NEXT_LINE | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_show_EMS_input_box(b);
- b->flags &= ~(UI_EMS_INPUT_BOX_NEXT_LINE | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- /* if(!TestLastPosition(b->data,&b->data->CurrentPosition)) */
- gui_EMS_input_box_locate_cursor(b);
- }
- #ifdef __MMI_MESSAGES_EMS__
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_view_previous_object
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_view_previous_object(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_cancel_object_focus();
- b->flags |= (UI_EMS_INPUT_BOX_PREVIOUS_OBJECT | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_show_EMS_input_box(b);
- b->flags &= ~(UI_EMS_INPUT_BOX_PREVIOUS_OBJECT | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_view_next_object
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_view_next_object(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_cancel_object_focus();
- b->flags |= (UI_EMS_INPUT_BOX_NEXT_OBJECT | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_show_EMS_input_box(b);
- b->flags &= ~(UI_EMS_INPUT_BOX_NEXT_OBJECT | UI_EMS_INPUT_BOX_DISABLE_DRAW);
- gui_EMS_input_box_locate_cursor(b);
- b->saved_cursor_ax = -1;
- }
- #endif /* __MMI_MESSAGES_EMS__ */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_inputbox_empty
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_inputbox_empty(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((b->data->textLength == 0) && (b->data->listHead == NULL))
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_highlight_cursor_end
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 gui_EMS_input_box_highlight_cursor_end(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition *current_position = &b->data->CurrentPosition;
- EMSPosition previous_position;
- EMSPosition saved_current_position = b->data->CurrentPosition;
- U8 done = 0, bflag;
- UI_character_type current_character;
- S32 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Move cursor backwards until a break character is encountered */
- while (!done)
- {
- previous_position = *current_position;
- if ((current_position->Object != NULL) &&
- (current_position->Object->OffsetToText == current_position->OffsetToText))
- {
- break;
- }
- if (current_position->OffsetToText == 0)
- {
- break;
- }
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- count++;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- break;
- }
- }
- b->highlight_start_position = previous_position;
- /* *current_position=saved_current_position; */
- MoveCursorToPosition(b->data, &saved_current_position);
- /* Move cursor forwards until a break character is encountered */
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (b->data->CurrentPosition.OffsetToText >= b->data->textLength)
- {
- bflag = 1;
- }
- if (bflag)
- {
- done = 1;
- b->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- }
- else
- {
- done = 0;
- b->flags |= UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- }
- while (!done)
- {
- if ((current_position->Object != NULL) &&
- (current_position->Object->OffsetToText == current_position->OffsetToText))
- {
- break;
- }
- if (current_position->OffsetToText >= b->data->textLength)
- {
- break;
- }
- if (ForwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- count++;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- break;
- }
- }
- b->highlight_end_position = *current_position;
- gui_EMS_input_box_locate_cursor(b);
- return (count);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_highlight_cursor_number
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * numOfChar [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 gui_EMS_input_box_highlight_cursor_number(UI_EMS_input_box *b, S32 numOfChar)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition *current_position = &b->data->CurrentPosition;
- EMSPosition saved_current_position = b->data->CurrentPosition;
- U8 bflag;
- UI_character_type current_character;
- S32 count = 0, i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < numOfChar; i++)
- {
- if ((current_position->Object != NULL) &&
- (current_position->Object->OffsetToText == current_position->OffsetToText))
- {
- break;
- }
- if (current_position->OffsetToText == 0)
- {
- break;
- }
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- count++;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- break;
- }
- }
- b->highlight_start_position = *current_position;
- /* *current_position=saved_current_position; */
- MoveCursorToPosition(b->data, &saved_current_position);
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if(current_character == (UI_character_type)0x20) bflag =0;
- if (bflag)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- }
- else
- {
- b->flags |= UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- }
- b->highlight_end_position = *current_position;
-
- if (b->locate_cursor_flag)
- {
- gui_EMS_input_box_locate_cursor(b);
- }
-
- return (count);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_highlight_cursor_start
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 gui_EMS_input_box_highlight_cursor_start(UI_EMS_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition *current_position = &b->data->CurrentPosition;
- EMSPosition previous_position;
- EMSPosition saved_current_position = b->data->CurrentPosition;
- U8 done = 0, bflag;
- UI_character_type current_character;
- S32 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- return (0);
- }
- /* Move cursor forwards until a break character is encountered */
- while (!done)
- {
- if ((current_position->Object != NULL) &&
- (current_position->Object->OffsetToText == current_position->OffsetToText))
- {
- break;
- }
- if (current_position->OffsetToText >= b->data->textLength)
- {
- break;
- }
- if (ForwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- count++;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- break;
- }
- }
- b->highlight_end_position = *current_position;
- /* *current_position=saved_current_position; */
- MoveCursorToPosition(b->data, &saved_current_position);
- /* Move cursor backwards until a break character is encountered */
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- b->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- return (0);
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- ForwardCurrentPosition(b->data, 1);
- done = 1;
- b->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- return (0);
- }
- else
- {
- done = 0;
- b->flags |= UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
- }
- while (!done)
- {
- previous_position = *current_position;
- if ((current_position->Object != NULL) &&
- (current_position->Object->OffsetToText == current_position->OffsetToText))
- {
- break;
- }
- if (current_position->OffsetToText == 0)
- {
- break;
- }
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- current_character =
- b->data->textBuffer[current_position->OffsetToText +
- 1] | (b->data->textBuffer[current_position->OffsetToText] << 8);
- #else /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- current_character =
- b->data->textBuffer[current_position->OffsetToText] | (b->data->
- textBuffer[current_position->OffsetToText + 1] << 8);
- #endif /* (EMS_BYTE_ORDER_BIG_ENDIAN) */
- count++;
- UI_EMS_INPUT_BOX_BREAK_CHARACTER(current_character, bflag);
- if (bflag)
- {
- break;
- }
- }
- b->highlight_start_position = previous_position;
- /* *current_position=previous_position; */
- MoveCursorToPosition(b->data, &previous_position);
- gui_EMS_input_box_locate_cursor(b);
- return (count);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_text_format_forward_seek
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * t [?]
- * length [?]
- * isModifyExistedTextformat [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_text_format_forward_seek(
- UI_EMS_input_box *b,
- EMSTextFormat *t,
- S32 *length,
- BOOL isModifyExistedTextformat)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition current_position = b->data->CurrentPosition;
- UI_character_type c;
- EMSObject *o;
- U8 r;
- U8 done = 0;
- S32 text_format_object_count = 0;
- S32 text_length = 0;
- BOOL isModify = isModifyExistedTextformat;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (!done)
- {
- if (current_position.OffsetToText >= b->data->textLength)
- {
- break;
- }
- r = gui_EMS_input_box_get_next_object(b->data, ¤t_position, &c, &o);
- switch (r)
- {
- case 0:
- done = 1;
- break;
- case 1:
- if (c == EMS_INPUTBOX_PARAGRAPH_BREAK_CHARACTER)
- {
- done = 1;
- }
- if (text_format_object_count == 0)
- {
- text_length++;
- }
- break;
- case 2:
- if (o->Type == EMS_TYPE_TEXT_FORMAT)
- {
- text_format_object_count++;
- if (isModify)
- {
- o->data->text_format.Alignment = t->Alignment;
- }
- }
- break;
- }
- }
- *length = text_length;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_text_format_backward_seek
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * t [?]
- * length [?]
- * isModifyExistedTextformat [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_text_format_backward_seek(
- UI_EMS_input_box *b,
- EMSTextFormat *t,
- S32 *length,
- BOOL isModifyExistedTextformat)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 text_length = *length;
- EMSPosition current_position = b->data->CurrentPosition;
- UI_character_type c;
- EMSObject *o;
- U8 r;
- U8 done = 0;
- U8 counter_reset_flag = 0;
- S32 saved_text_length = 0;
- S32 old_OffsetToText;
- BOOL isModify = isModifyExistedTextformat;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (!done)
- {
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- if (counter_reset_flag)
- {
- text_length = saved_text_length;
- }
- break;
- }
- gui_EMS_input_box_set_text_format_cursor_position(b);
- current_position = b->data->CurrentPosition;
- r = gui_EMS_input_box_get_next_object(b->data, ¤t_position, &c, &o);
- switch (r)
- {
- case 0:
- if (counter_reset_flag)
- {
- text_length = saved_text_length;
- }
- counter_reset_flag = 0;
- done = 1;
- break;
- case 1:
- if (c == EMS_INPUTBOX_PARAGRAPH_BREAK_CHARACTER)
- {
- if (counter_reset_flag)
- {
- text_length = saved_text_length;
- }
- ForwardCurrentPosition(b->data, 1);
- done = 1;
- }
- else
- {
- text_length++;
- }
- counter_reset_flag = 0;
- break;
- case 2:
- if (o->Type == EMS_TYPE_TEXT_FORMAT)
- {
- if (text_length > 0)
- {
- saved_text_length = text_length + 1;
- }
- else
- {
- saved_text_length = text_length;
- }
- text_length = 0;
- if (isModify)
- {
- o->data->text_format.Alignment = t->Alignment;
- }
- counter_reset_flag = 1;
- }
- break;
- }
- }
- *length = text_length;
- #if(EMS_ENABLE_TESTFIX_OBJECT_ORDERING)
- old_OffsetToText = b->data->CurrentPosition.OffsetToText;
- while (b->data->CurrentPosition.OffsetToText == old_OffsetToText)
- {
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- }
- if (b->data->CurrentPosition.OffsetToText != old_OffsetToText)
- {
- ForwardCurrentPosition(b->data, 1);
- }
- #endif /* (EMS_ENABLE_TESTFIX_OBJECT_ORDERING) */
- }
- /*****************************************************************************
- * FUNCTION
- * GetTextFormatObjectAtPosition
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * p [?]
- * RETURNS
- *
- *****************************************************************************/
- EMSObject *GetTextFormatObjectAtPosition(EMSData *data, EMSPosition *p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSObject *current = data->listHead;
- U16 OffsetToText = (U16) p->OffsetToText;
- EMSObject *return_object = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (current != NULL)
- {
- if ((current->Type == EMS_TYPE_TEXT_FORMAT) && (current->OffsetToText == OffsetToText))
- {
- return_object = current;
- break;
- }
- if (current->OffsetToText > OffsetToText)
- {
- break;
- }
- current = current->next;
- }
- return (return_object);
- }
- #ifdef __MMI_MESSAGES_EMS__
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_find_paragraph_range
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * offsetToText [?]
- * textLength [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_find_paragraph_range(UI_EMS_input_box *b, kal_uint16 *offsetToText, kal_uint16 *textLength)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 *offset = offsetToText;
- kal_uint16 *textLen = textLength;
- EMSPosition saved_position = b->data->CurrentPosition;
- EMSPosition current_position = b->data->CurrentPosition;
- UI_character_type c;
- EMSObject *o;
- U8 r;
- U8 done = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Move to the beginning of paragraph */
- while (!done)
- {
- /* Reach the first position */
- if (BackwardCurrentPosition(b->data, 1) != 1)
- {
- break;
- }
- current_position = b->data->CurrentPosition;
- r = gui_EMS_input_box_get_next_object(b->data, ¤t_position, &c, &o);
- switch (r)
- {
- /* check if reach the start of paragraph */
- case 1:
- if (c == EMS_INPUTBOX_PARAGRAPH_BREAK_CHARACTER)
- {
- ForwardCurrentPosition(b->data, 1);
- done = 1;
- }
- break;
- /* ignore object */
- case 2:
- break;
- /* impossible case */
- case 0:
- default:
- MMI_ASSERT(0);
- break;
- }
- }
- *offset = b->data->CurrentPosition.OffsetToText;
- done = 0;
- current_position = b->data->CurrentPosition;
- /* count to the end of the paragraph */
- while (!done)
- {
- if (current_position.OffsetToText >= b->data->textLength)
- {
- break;
- }
- r = gui_EMS_input_box_get_next_object(b->data, ¤t_position, &c, &o);
- switch (r)
- {
- /* count the number of characters in the paragraph */
- case 1:
- if (c == EMS_INPUTBOX_PARAGRAPH_BREAK_CHARACTER)
- {
- done = 1;
- (*textLen)++;
- /* Exclude 0x0d and 0x0a */
- /* (*textLen)--; */
- }
- else
- {
- (*textLen)++;
- }
- break;
- /* To the end of the message */
- case 0:
- done = 1;
- break;
- /* ignore object */
- case 2:
- break;
- /* impossible case */
- default:
- MMI_ASSERT(0);
- break;
- }
- }
- MoveCursorToPosition(b->data, &saved_position);
- }
- /* Warning: Function requires the parameter t to be modified in some cases.
- So it is necessary to pass a copy instead of the actual data */
- /* MTK Joy added for text format insert, 0112 */
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_insert_text_alignment
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * t [?]
- * RETURNS
- *
- *****************************************************************************/
- EMSTATUS gui_EMS_input_box_insert_text_alignment(UI_EMS_input_box *b, EMSTextFormat *t)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(1)
- /* 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 !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(0)
- /* under construction !*/
- /* under construction !*/
- /* 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 !*/
- #if(1)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #if(EMS_BYTE_ORDER_BIG_ENDIAN)
- /* under construction !*/
- /* under construction !*/
- #else
- /* 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 !*/
- /* 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) */
- kal_uint16 offsetToText = 0;
- kal_uint16 textLength = 0;
- EMSTATUS emsObjectStatus = EMS_OK;
- EMSTextFormat textFormat = *t;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->data->textLength == 0)
- {
- return EMS_OK;
- }
- gui_EMS_input_box_find_paragraph_range(b, &offsetToText, &textLength);
- if (textLength == 0)
- {
- return EMS_OK;
- }
- textFormat.textLength = textLength * 2;
- textFormat.FontSize = EMS_FONTSIZE_NORMAL;
- textFormat.isBold = KAL_FALSE;
- textFormat.isItalic = KAL_FALSE;
- textFormat.isStrikethrough = KAL_FALSE;
- textFormat.isUnderline = KAL_FALSE;
- emsObjectStatus = AddTextAlignment(b->data, offsetToText, &textFormat);
- gui_EMS_input_box_set_text_format_cursor_position(b);
- return emsObjectStatus;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_insert_new_paragraph
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * t [?]
- * RETURNS
- *
- *****************************************************************************/
- EMSTATUS gui_EMS_input_box_insert_new_paragraph(UI_EMS_input_box *b, EMSTextFormat *t)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSTATUS emsObjectStatus;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- emsObjectStatus = gui_EMS_input_box_insert_new_line(b);
- if (emsObjectStatus == EMS_OK)
- {
- emsObjectStatus = gui_EMS_input_box_insert_text_alignment(b, t);
- }
- return emsObjectStatus;
- }
- /* MTK end */
- #endif /* __MMI_MESSAGES_EMS__ */
- /*****************************************************************************
- * FUNCTION
- * EMS_move_graphical_cursor
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * start_x [IN]
- * cursor_x [IN]
- * max_count [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EMS_move_graphical_cursor(EMSData *data, S32 start_x, S32 cursor_x, S32 max_count)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSPosition current_position = data->CurrentPosition;
- U8 done = 0;
- S32 x = start_x;
- S32 count = 0;
- U8 r;
- EMSObject *current_object;
- UI_character_type current_character;
- S32 width = 0, height;
- /* PMT START FIX HINDI ISSUES 20060604 */
- #ifdef __MMI_HINDI_ALG__
- EMSData *data_chk_type = data;
- UI_character_type dummy_c = 0;
- S32 next_ems_moves = 0;
- PU8 src_p;
- PU8 dest_p;
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT END FIX HINDI ISSUES 20060604 */
- #if defined(__MMI_LANG_VIETNAMESE__)
- /* W05.38 Fix Viet Tone Cursor Moving Issue */
- U8 viet_tone_move = 0;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (!done)
- {
- if (count >= max_count)
- {
- break;
- }
- r = gui_EMS_input_box_get_next_object(data, ¤t_position, ¤t_character, ¤t_object);
- switch (r)
- {
- case 0:
- done = 1;
- break;
- case 1:
- #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]))
- {
- width = 0;
- }
- else if (UI_TEST_LF_CHARACTER(current_character))
- {
- width = 0;
- }
- else
- #endif /* (EMS_USE_CRLF_COMBINATION) */
- #if(EMS_USE_ESC_COMBINATION)
- if (UI_TEST_ESC_CHARACTER(current_character))
- {
- width = 0;
- }
- else
- #endif /* (EMS_USE_ESC_COMBINATION) */
- {
- #if defined(__MMI_LANG_VIETNAMESE__)
- /* MTK Terry for Cursor Move Up and Down Issue */
- UI_character_type dummy_c = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- if ((current_character > 0x0040) && (current_character < 0x01B1))
- {
- r = gui_EMS_input_box_get_next_object(data, ¤t_position, &dummy_c, ¤t_object); /* get next character */
- if (1 == r)
- {
- 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);
- /* W05.38 Fix Viet Tone Cursor Moving Issue */
- viet_tone_move = 1;
- }
- else
- {
- r = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else
- {
- r = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- else if (0 != r)
- {
- r = gui_EMS_input_box_get_previous_object(
- data,
- ¤t_position,
- &dummy_c,
- ¤t_object);
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /* PMT START FIX HINDI ISSUES 20060604 */
- #ifdef __MMI_HINDI_ALG__
- #ifdef __MMI_HINDI_ALG__
- src_p = (data->textBuffer + data->CurrentPosition.OffsetToText) - 2;
- #endif
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- dest_p = hf_get_next_cluster_p(src_p, src_p);
- next_ems_moves = dest_p - src_p;
- next_ems_moves = next_ems_moves >> 1;
- if (next_ems_moves >= 2) /* && r==2) //&& current_object->Type==EMS_TYPE_TEXT_FORMAT) */
- {
- ForwardCurrentPosition(data, next_ems_moves - 1);
- count += next_ems_moves - 1;
- next_ems_moves = 0;
- width = hf_size_of_current_cluster(src_p, dest_p, 1);
- }
- else
- {
- gui_measure_character(current_character, &width, &height);
- }
- src_p = dest_p;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT END FIX HINDI ISSUES 20060604 */
- gui_measure_character(current_character, &width, &height);
- width += 1;
- }
- x += width;
- break;
- #ifdef __MMI_MESSAGES_EMS__
- case 2:
- if (current_object->Type == EMS_TYPE_TEXT_FORMAT)
- {
- width = 0;
- }
- else
- {
- gui_EMS_input_box_measure_object(current_object, &width, &height);
- width += 2;
- }
- x += width;
- break;
- #endif /* __MMI_MESSAGES_EMS__ */
- }
- if (x <= (cursor_x + (width >> 1)))
- {
- count++;
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- break;
- }
- #if defined(__MMI_LANG_VIETNAMESE__)
- /* W05.38 Fix Viet Tone Cursor Moving Issue */
- if (1 == viet_tone_move)
- {
- if (ForwardCurrentPosition(data, 1) != 1)
- {
- }
- viet_tone_move = 0;
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- }
- else
- {
- break;
- }
- }
- }
- #endif /* (!UI_DISABLE_EMS_INPUT_BOX) */
- /* msz00065_20051010 peng hua add for multitap thai begin */
- #ifdef __MMI_MULTITAP_THAI__
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_check_input_test_overflow
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * c [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 gui_EMS_check_input_test_overflow(UI_EMS_input_box *b, UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 ch = (U16) c;
- U8 s[2] = {0, 0};
- 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 <= 0)
- {
- return FALSE;
- }
- if (b->UCS2_count == 0)
- {
- if (UI_TEST_UCS2_CHARACTER(c))
- {
- if (EMSSetDCS(b->data, SMSAL_UCS2_DCS) != EMS_OK)
- {
- EMSSetDCS(b->data, SMSAL_DEFAULT_DCS);
- return FALSE;
- }
- else
- {
- if (EMS_get_remaining_length(b->data) < 2)
- {
- EMSSetDCS(b->data, SMSAL_DEFAULT_DCS);
- return FALSE;
- }
- else
- {
- EMSSetDCS(b->data, SMSAL_DEFAULT_DCS);
- return TRUE;
- }
- }
- }
- else if (UI_TEST_GSM_EXTENDED(c))
- {
- if (EMS_get_remaining_length(b->data) < 1) /* JP : 408 info bar issue */
- {
- return FALSE;
- }
- }
- }
- /* MTK end */
- /* If in Overwrite mode, delete the current character/object and insert the new one */
- if (b->flags & UI_EMS_INPUT_BOX_OVERWRITE_MODE)
- {
- return TRUE;
- }
- return TRUE;
- }
- #endif /* __MMI_MULTITAP_THAI__ */
- /* msz00065_20051010 peng hua add for multitap thai end */
- #ifdef __MMI_TOUCH_SCREEN__
- static UI_EMS_input_box *gui_pen_scroll_EMS_input_box = NULL;
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_scroll_by_pen
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * offset_y [IN]
- * EMS_input_box_event [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_EMS_input_box_scroll_by_pen(
- UI_EMS_input_box *b,
- S32 offset_y,
- gui_EMS_input_box_pen_enum *EMS_input_box_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int move_gap = b->display_y + offset_y;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_EMS__
- EMS_cancel_object_focus();
- #endif
- b->display_y = -offset_y;
- /* W06.06 Fix Cursor issue in EMS Input Box */
- if (!(b->flags & UI_EMS_INPUT_BOX_VIEW_MODE))
- {
- if (b->cursor_ay < -(b->display_y) || b->cursor_ay + b->cursor_line_height > b->height - b->display_y)
- {
- if (move_gap > 0)
- {
- gui_show_EMS_input_box_ext(b, UI_cursor_x1, UI_cursor_y1 + b->cursor_line_height);
- }
- else
- {
- if (0 == offset_y)
- {
- gui_show_EMS_input_box_ext(b, UI_cursor_x1, UI_cursor_y1 + move_gap);
- }
- else
- {
- gui_show_EMS_input_box_ext(b, UI_cursor_x1, UI_cursor_y1);
- }
- }
- }
- }
- b->display_y = -offset_y;
- if (!(b->flags & UI_EMS_INPUT_BOX_VIEW_MODE) && (0 != offset_y))
- {
- gui_EMS_input_box_locate_cursor(b);
- }
- gui_show_EMS_input_box(b);
- gui_BLT_double_buffer(b->x, b->y, b->x + b->width, b->y + b->height);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_scroll_timer_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_EMS_input_box_scroll_timer_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_EMS_input_box *b = gui_pen_scroll_EMS_input_box;
- gui_EMS_input_box_pen_enum EMS_input_box_event;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_pen_scroll_EMS_input_box = NULL;
- if (!b)
- {
- return;
- }
- gui_EMS_input_box_scroll_by_pen(b, b->pen_scroll_after_delay, &EMS_input_box_event);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_abort_scroll_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_EMS_input_box_abort_scroll_timer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_pen_scroll_EMS_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_start_scroll_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * value [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_EMS_input_box_start_scroll_timer(UI_EMS_input_box *b, S32 value)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* assert that no two input box at the same time */
- MMI_DBG_ASSERT(!gui_pen_scroll_EMS_input_box || gui_pen_scroll_EMS_input_box == b);
- b->pen_scroll_after_delay = value;
- gui_pen_scroll_EMS_input_box = b;
- gui_cancel_timer(gui_EMS_input_box_scroll_timer_hdlr);
- gui_start_timer(b->pen_scroll_delay_time, gui_EMS_input_box_scroll_timer_hdlr);
- gui_add_cleanup_hook(gui_EMS_input_box_abort_scroll_timer);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_set_pen_scroll_delay
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * delay_time [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_EMS_input_box_set_pen_scroll_delay(UI_EMS_input_box *b, S32 delay_time)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_DBG_ASSERT(delay_time < (S32) 0x0000FFFF);
- b->pen_scroll_delay_time = (S16) delay_time;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_EMS_input_box_translate_pen_event
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * pen_event [IN]
- * x [IN]
- * y [IN]
- * EMS_input_box_event [?]
- * RETURNS
- *
- *****************************************************************************/
- BOOL gui_EMS_input_box_translate_pen_event(
- UI_EMS_input_box *b,
- mmi_pen_event_type_enum pen_event,
- S16 x,
- S16 y,
- gui_EMS_input_box_pen_enum *EMS_input_box_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret = MMI_TRUE;
- gui_EMS_input_box_pen_state_struct *pen_state;
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- int scroll_bar_width;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (UI_EMS_INPUT_BOX_DISABLE_SCROLLBAR & b->flags)
- {
- scroll_bar_width = 0;
- }
- else
- {
- scroll_bar_width = b->vbar.width;
- }
- pen_state = &b->pen_state;
- ret = MMI_TRUE;
- if (pen_event != MMI_PEN_EVENT_DOWN && pen_state->pen_on_scroll_bar)
- {
- gui_vertical_scrollbar_translate_pen_event(&b->vbar, pen_event, x, y, &scrollbar_event, &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- if (b->pen_scroll_delay_time > 0) /* Delay time for scrollbar scrolling */
- {
- gui_EMS_input_box_start_scroll_timer(b, scrollbar_param._u.i);
- }
- else
- {
- gui_EMS_input_box_scroll_by_pen(b, scrollbar_param._u.i, EMS_input_box_event);
- }
- }
- *EMS_input_box_event = GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR;
- }
- else
- {
- switch (pen_event)
- {
- case MMI_PEN_EVENT_DOWN:
- if (PEN_CHECK_BOUND(x, y, b->x, b->y, b->width, b->height))
- {
- pen_state->pen_on_scroll_bar = 0;
- if (!(b->flags & UI_EMS_INPUT_BOX_DISABLE_SCROLLBAR) &&
- gui_vertical_scrollbar_translate_pen_event(
- &b->vbar,
- MMI_PEN_EVENT_DOWN,
- x,
- y,
- &scrollbar_event,
- &scrollbar_param))
- {
- pen_state->pen_on_scroll_bar = 1;
- gui_vertical_scrollbar_set_minimum_pen_offset(&b->vbar, b->cursor_line_height);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- if (b->pen_scroll_delay_time > 0) /* Delay time for scrollbar scrolling */
- {
- gui_EMS_input_box_start_scroll_timer(b, scrollbar_param._u.i);
- }
- else
- {
- gui_EMS_input_box_scroll_by_pen(b, scrollbar_param._u.i, EMS_input_box_event);
- }
- }
- *EMS_input_box_event = GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR;
- }
- else
- {
- *EMS_input_box_event = GUI_EMS_INPUT_BOX_PEN_TEXT_DOWN;
- }
- }
- else
- {
- ret = MMI_FALSE;
- }
- break;
- case MMI_PEN_EVENT_UP:
- if (PEN_CHECK_BOUND(x, y, b->x, b->y, b->width - scroll_bar_width, b->height))
- {
- *EMS_input_box_event = GUI_EMS_INPUT_BOX_PEN_TEXT_UP;
- }
- else
- {
- ret = MMI_FALSE;
- }
- break;
- case MMI_PEN_EVENT_MOVE:
- case MMI_PEN_EVENT_LONG_TAP:
- case MMI_PEN_EVENT_REPEAT:
- case MMI_PEN_EVENT_ABORT:
- if (PEN_CHECK_BOUND(x, y, b->x, b->y, b->width - scroll_bar_width, b->height))
- {
- }
- else
- {
- ret = MMI_FALSE;
- }
- break;
- }
- }
- return ret;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */