gui_inputs.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:662k
源码类别:
MTK
开发平台:
C/C++
- * void
- *****************************************************************************/
- void gui_dialer_input_box_delete_character(dialer_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;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_text_p = b->current_text_p;
- previous_text_p = b->current_text_p;
- if (previous_text_p == b->text)
- {
- UI_editor_play_tone_cannot_change();
- return;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(previous_text_p, dummy_c);
- b->text_length -= ((S32) current_text_p - (S32) previous_text_p);
- b->current_text_p = previous_text_p;
- if (b->flags & UI_DIALER_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);
- }
- if (b->flags & UI_DIALER_INPUT_BOX_STATE_MULTITAP)
- {
- b->flags &= ~UI_DIALER_INPUT_BOX_STATE_MULTITAP;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->last_position_p, current_character);
- /* gui_dialer_inputbox_locate_cursor(b); */
- b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_delete_current_character
- * DESCRIPTION
- * Deletes a character at the current cursor position (Delete)
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_delete_current_character(dialer_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->current_text_p;
- previous_text_p = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- if (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- if (b->flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- UI_TEST_UCS2_DECREMENT_COUNT_SET_LENGTH(
- current_character,
- b->allocated_length,
- b->UCS2_count,
- 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_DIALER_INPUT_BOX_STATE_MULTITAP)
- {
- b->flags &= ~UI_DIALER_INPUT_BOX_STATE_MULTITAP;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->last_position_p, current_character);
- /* gui_dialer_inputbox_locate_cursor(b); */
- b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- else
- {
- UI_editor_play_tone_cannot_change();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_delete_all
- * DESCRIPTION
- * Deletes all characters
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_delete_all(dialer_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);
- /* MTK Elvis 20040611 donot play tone while the text buffer is zero */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /* MTK end */
- gui_dialer_input_box_clear(b);
- b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
- b->change_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_toggle_insert_mode
- * DESCRIPTION
- * Toggles between Insert and Overwrite modes
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_toggle_insert_mode(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->flags & UI_DIALER_INPUT_BOX_OVERWRITE_MODE)
- {
- b->flags &= ~UI_DIALER_INPUT_BOX_OVERWRITE_MODE;
- }
- else
- {
- b->flags |= UI_DIALER_INPUT_BOX_OVERWRITE_MODE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_insert_character
- * DESCRIPTION
- * Inserts a character at the current cursor position
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * c [IN] Is the character to be inserted
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_insert_character(dialer_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;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) && UI_TEST_UCS2_CHARACTER(c))
- {
- if ((b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER) &&
- (b->text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- else if (b->text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone */
- return;
- }
- }
- p1 = p2 = b->current_text_p;
- if (b_flags & UI_DIALER_INPUT_BOX_OVERWRITE_MODE)
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- if ((p1 == b->last_position_p) && ((b->text_length) >= b->available_length))
- {
- return;
- }
- if (!UI_STRING_END_OF_STRING_CHARACTER(old_c)) /* check for end of string */
- {
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- b->current_text_p = p2;
- }
- else /* !UI_STRING_END_OF_STRING_CHARACTER(old_c) */
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c); /* get previous character */
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c); /* insert character */
- }
- }
- else /* (b->text_length)>=(b->available_length) */
- {
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(c)) /* check for end of string */
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- b->text_length += ((S32) p2 - (S32) p1);
- UI_STRING_GET_NEXT_CHARACTER(b->last_position_p, dummy_c);
- }
- }
- else /* b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- p1 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- while (!UI_STRING_END_OF_STRING_CHARACTER(c)) /* check for end of string */
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- 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_DIALER_INPUT_BOX_OVERWRITE_MODE */
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c);
- }
- }
- else /* (b->text_length)>=(b->available_length) */
- {
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- b->text_length += ((S32) p2 - (S32) p1);
- UI_STRING_GET_NEXT_CHARACTER(b->last_position_p, dummy_c);
- }
- }
- else /* b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(c, b->UCS2_count, b->allocated_length, b->available_length);
- }
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- b->text_length += ((S32) p2 - (S32) p1);
- UI_STRING_GET_NEXT_CHARACTER(b->last_position_p, dummy_c);
- }
- }
- /* gui_dialer_inputbox_locate_cursor(b); */
- b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
- b->change_callback();
- UI_UNUSED_PARAMETER(dummy_c);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_test_overflow
- * DESCRIPTION
- * check ifor overfloaw of dialer input box
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * byte
- *****************************************************************************/
- U8 gui_dialer_input_box_test_overflow(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((b->text_length) >= (b->available_length))
- {
- return (1);
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_test_first_position
- * DESCRIPTION
- * check if current cursorposition is at first character
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * byte
- *****************************************************************************/
- U8 gui_dialer_input_box_test_first_position(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->current_text_p == b->text)
- {
- return (1);
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_test_last_position
- * DESCRIPTION
- * return text length of dialer nut box
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * byte
- *****************************************************************************/
- U8 gui_dialer_input_box_test_last_position(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type dummy_c = 0;
- UI_buffer_type current_text_p = b->current_text_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
- UI_UNUSED_PARAMETER(dummy_c);
- if (current_text_p == b->last_position_p)
- {
- return (1);
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_test_last_character_position
- * DESCRIPTION
- * return text length of dialer nut box
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * byte
- *****************************************************************************/
- U8 gui_dialer_input_box_test_last_character_position(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type dummy_c = 0;
- UI_buffer_type current_text_p = b->current_text_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
- if (current_text_p == b->last_position_p)
- {
- return (1);
- }
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
- UI_UNUSED_PARAMETER(dummy_c);
- if (current_text_p == b->last_position_p)
- {
- return (1);
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_test_last_position_overflow
- * DESCRIPTION
- * return text length of dialer nut box
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * byte
- *****************************************************************************/
- U8 gui_dialer_input_box_test_last_position_overflow(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 flag1 = 0;
- U8 flag2 = 0;
- UI_character_type dummy_c = 0;
- UI_buffer_type current_text_p = b->current_text_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
- UI_UNUSED_PARAMETER(dummy_c);
- if (current_text_p == b->last_position_p)
- {
- flag1 = 1;
- }
- if ((b->text_length) >= (b->available_length))
- {
- flag2 = 1;
- }
- if (flag1 && flag2)
- {
- return (1);
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_get_text_length
- * DESCRIPTION
- * return text length of dialer nut box
- * PARAMETERS
- * b [IN] Is the dialer input box object
- * RETURNS
- * S32 return txt length of dialer iput box
- *****************************************************************************/
- S32 gui_dialer_input_box_get_text_length(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (((b->text_length) >> 1) - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_insert_multitap_character
- * DESCRIPTION
- * Inserts a multitap character at the current cursor position
- *
- * This function is normally used as the input_callback
- * function with multitap input objects
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * c [IN] Is the character to be inserted
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_insert_multitap_character(dialer_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;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) && UI_TEST_UCS2_CHARACTER(c))
- {
- if ((b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER) &&
- (b->text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone of cannot insert */
- return;
- }
- else if (b->text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- }
- if ((b_flags & UI_DIALER_INPUT_BOX_STATE_MULTITAP) && (b->current_text_p != b->text))
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- p1 = p2 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- if (!UI_STRING_END_OF_STRING_CHARACTER(old_c)) /* check for end of string */
- {
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- b->current_text_p = p2;
- }
- else /* !UI_STRING_END_OF_STRING_CHARACTER(old_c) */
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc); /* get next character */
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c);
- }
- }
- else /* (b->text_length)>=(b->available_length) */
- {
- p1 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- while (!UI_STRING_END_OF_STRING_CHARACTER(c)) /* check for end of string */
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c); /* get next character */
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- 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_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- p1 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- 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_DIALER_INPUT_BOX_STATE_MULTITAP) && (b->current_text_p!=b->text) */
- {
- p1 = p2 = b->current_text_p;
- if (b_flags & UI_DIALER_INPUT_BOX_OVERWRITE_MODE)
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- if ((p1 == b->last_position_p) && ((b->text_length) >= b->available_length))
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc); /* get next character */
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c);
- }
- return;
- }
- else /* b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- UI_editor_play_tone_cannot_insert(); /* play error tone of cannot insert */
- return;
- }
- }
- if (!UI_STRING_END_OF_STRING_CHARACTER(old_c)) /* check for end of string */
- {
- UI_STRING_INSERT_CHARACTER(p2, c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
- old_c,
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- b->current_text_p = p2;
- }
- else /* !UI_STRING_END_OF_STRING_CHARACTER(old_c) */
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc); /* get */
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c);
- }
- }
- else /* (b->text_length)>=(b->available_length) */
- {
- p1 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert character */
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- 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_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- p1 = b->current_text_p;
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c); /* insert chatracte */
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_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
- {
- 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_DIALER_INPUT_BOX_OVERWRITE_MODE */
- {
- if (b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE)
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_buffer_type p3, p4;
- UI_character_type cc;
- if (b->current_text_p != b->text)
- {
- p3 = p4 = b->text;
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- while (p3 != b->current_text_p)
- {
- UI_STRING_GET_NEXT_CHARACTER(p3, cc);
- UI_STRING_INSERT_CHARACTER(p4, cc);
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_STRING_INSERT_CHARACTER(b->current_text_p, c);
- }
- }
- else /* (b->text_length)>=(b->available_length) */
- {
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- b->text_length += ((S32) p2 - (S32) p1);
- UI_STRING_GET_NEXT_CHARACTER(b->last_position_p, dummy_c);
- }
- }
- else /* b_flags & UI_DIALER_INPUT_BOX_CHARACTER_QUEUE */
- {
- if ((b->text_length) >= (b->available_length))
- {
- UI_editor_play_tone_cannot_insert();
- return;
- }
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (b_flags & UI_DIALER_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
- {
- if (b_flags & UI_DIALER_INPUT_BOX_ONE_LESS_CHARACTER)
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- else
- {
- UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(
- c,
- b->UCS2_count,
- b->allocated_length,
- b->available_length);
- }
- }
- while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
- UI_STRING_INSERT_CHARACTER(p2, c);
- c = old_c;
- }
- UI_STRING_INSERT_CHARACTER(p2, c);
- b->text_length += ((S32) p2 - (S32) p1);
- UI_STRING_GET_NEXT_CHARACTER(b->last_position_p, dummy_c);
- }
- }
- b->flags |= UI_DIALER_INPUT_BOX_STATE_MULTITAP;
- }
- /* gui_dialer_inputbox_locate_cursor(b); */
- b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
- b->change_callback();
- UI_UNUSED_PARAMETER(dummy_c);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_confirm_multitap_character
- * DESCRIPTION
- * Completes the multitap input sequence.
- *
- * This function is normally used as the input_complete_callback
- * function with multitap input objects
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_confirm_multitap_character(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->flags &= ~UI_DIALER_INPUT_BOX_STATE_MULTITAP;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_previous
- * DESCRIPTION
- * Moves the cursor to the previous character
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_previous(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type dummy_c = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->text == NULL)
- {
- UI_editor_play_tone_cannot_navigate();
- return;
- }
- if (b->current_text_p == b->text)
- {
- UI_editor_play_tone_cannot_navigate();
- return;
- }
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- UI_UNUSED_PARAMETER(dummy_c);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_next
- * DESCRIPTION
- * Moves the cursor to the next character
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_next(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_buffer_type current_text_p = b->current_text_p;
- UI_character_type current_character;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (b->text == NULL)
- {
- UI_editor_play_tone_cannot_navigate();
- return;
- }
- UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
- if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
- {
- UI_editor_play_tone_cannot_navigate();
- return;
- }
- b->current_text_p = current_text_p;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_resize_dialer_input_box
- * DESCRIPTION
- * Changes the size of the single-line inputbox.
- * PARAMETERS
- * b [IN] Is the single-line inputbox object
- * width [IN] Is the new width
- * height [IN] Is the new height
- * RETURNS
- * void
- *****************************************************************************/
- void gui_resize_dialer_input_box(dialer_input_box *b, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->width = width;
- b->height = height;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_goto_first_character
- * DESCRIPTION
- * go to first charcter of dialer input box
- * PARAMETERS
- * b [IN] Dialer input bx
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_goto_first_character(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->current_text_p = b->text;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialer_input_box_goto_last_character
- * DESCRIPTION
- * go to last charcter of dialer input box
- * PARAMETERS
- * b [IN] Dialer input bx
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialer_input_box_goto_last_character(dialer_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type dummy_c = 0;
- U8 done = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->current_text_p = b->text;
- if (b->text != NULL)
- {
- while (!done)
- {
- UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
- if (UI_STRING_END_OF_STRING_CHARACTER(dummy_c))
- {
- break;
- }
- }
- if (b->current_text_p != b->text)
- {
- UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
- }
- }
- }
- /* Interfaces to play error tones in the editors */
- #include "SettingProfile.h"
- #include "ProfileGprots.h"
- #include "KeyBrd.h"
- U8 UI_editor_tones_flag = 1;
- /*****************************************************************************
- * FUNCTION
- * UI_editor_play_tone_cannot_change
- * DESCRIPTION
- * play tone of cannot change
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_editor_play_tone_cannot_change(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!UI_editor_tones_flag)
- {
- return;
- }
- StopCurrentKeyPadTone();
- playRequestedTone(ERROR_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_editor_play_tone_cannot_navigate
- * DESCRIPTION
- * play tone of cannot navigate
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_editor_play_tone_cannot_navigate(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!UI_editor_tones_flag)
- {
- return;
- }
- StopCurrentKeyPadTone();
- playRequestedTone(ERROR_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_editor_play_tone_cannot_insert
- * DESCRIPTION
- * play tone of cannot insert error
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_POPUP_REACH_MAX_LENGTH_MSG__
- #include "globaldefs.h"
- #include "t9def.h"
- #endif /* __MMI_POPUP_REACH_MAX_LENGTH_MSG__ */
- void UI_editor_play_tone_cannot_insert(void)
- {
- #ifdef __MMI_POPUP_REACH_MAX_LENGTH_MSG__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayPopup((PU8) GetString(STR_INPUT_METHOD_REACH_MAX_LEN), IMG_GLOBAL_WARNING, 0, 1000, (U8) WARNING_TONE);
- #else /* __MMI_POPUP_REACH_MAX_LENGTH_MSG__ */
- if (!UI_editor_tones_flag)
- {
- return;
- }
- StopCurrentKeyPadTone();
- playRequestedTone(ERROR_TONE);
- #endif /* __MMI_POPUP_REACH_MAX_LENGTH_MSG__ */
- }
- /*****************************************************************************
- * FUNCTION
- * UI_editor_play_tone_invalid_data
- * DESCRIPTION
- * play tone of invalid data
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_editor_play_tone_invalid_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!UI_editor_tones_flag)
- {
- return;
- }
- StopCurrentKeyPadTone(); /* stop cuurent tone */
- playRequestedTone(ERROR_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_editor_disable_tones
- * DESCRIPTION
- * disable editor tone
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_editor_disable_tones(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_editor_tones_flag = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * UI_editor_enable_tones
- * DESCRIPTION
- * enabel editor tone
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_editor_enable_tones(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_editor_tones_flag = 1;
- }
- #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
- /* Check the chracter for WCSS permitted input character */
- /*****************************************************************************
- * FUNCTION
- * UI_check_WCSS_normal_character
- * DESCRIPTION
- *
- * PARAMETERS
- * c [IN]
- * input_type [?]
- * RETURNS
- *
- *****************************************************************************/
- static S8 UI_check_WCSS_normal_character(UI_character_type c, U8 *input_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((UI_character_type) c == (UI_character_type) 0x41)) /* 'A' */
- {
- *input_type = INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x61)) /* 'a' */
- {
- *input_type = INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x4E)) /* 'N' */
- {
- *input_type = INPUT_MODE_123;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x6E)) /* 'n' */
- {
- *input_type = INPUT_MODE_123_SYMBOLS;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x58)) /* 'X' */
- {
- *input_type = INPUT_MODE_MULTITAP_UPPERCASE_ABC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x78)) /* 'x' */
- {
- *input_type = INPUT_MODE_MULTITAP_LOWERCASE_ABC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x4D)) /* 'M' */
- {
- *input_type =
- INPUT_MODE_MULTITAP_UPPERCASE_ABC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER |
- PIXTEL_UI_ALL_INPUT_METHODS_ALLOWED;
- return 1;
- }
- else if (((UI_character_type) c == (UI_character_type) 0x6D)) /* 'm' */
- {
- *input_type =
- INPUT_MODE_MULTITAP_LOWERCASE_ABC | PIXTEL_UI_WCSS_SPACE_DEFAULT_CHARACTER |
- PIXTEL_UI_ALL_INPUT_METHODS_ALLOWED;
- return 1;
- }
- else
- {
- return 0;
- }
- }
- /* Insert default chracter 0 or ' ' according to input format character. */
- /*****************************************************************************
- * FUNCTION
- * UI_insert_WCSS_default_character
- * DESCRIPTION
- *
- * PARAMETERS
- * str [?]
- * c [IN]
- * RETURNS
- *
- *****************************************************************************/
- static U8 *UI_insert_WCSS_default_character(U8 *str, UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (c)
- {
- case 0x41:
- case 0x61:
- case 0x58:
- case 0x78:
- case 0x4D:
- case 0x6D:
- c = 0x20; /* ' ' */
- break;
- case 0x4E:
- case 0x6E:
- c = 0x30; /* '0' */
- break;
- default:
- /* Keep default value of c */
- break;
- }
- (*((str))++) = (U8) (((c) & 0xff));
- (*((str))++) = (U8) (((c) >> 8));
- return str;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_parse_WCSS_string
- * DESCRIPTION
- * Parse the WCSS format string, check for invalid format and create default string.
- * PARAMETERS
- * s1 [IN] IN input format
- * s2 [IN] OUT text buffer
- * s3 [IN] OUT parsed format (typically cat115buffer)
- * str_len [IN] IN length of dchar including ' '
- * reserve_data [IN] IN whether history is present
- * for(?) [OUT] Invalid format
- * RETURNS
- * void
- *****************************************************************************/
- S8 gui_parse_WCSS_string(U8 *s1, U8 *s2, U8 *s3, S16 str_len, U8 reserve_data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type c, dst_ch;
- U8 input_type;
- U8 *original_s2 = s2;
- U8 *prev_s2;
- U8 *original_s3 = s3;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(s1, c) while (!UI_STRING_END_OF_STRING_CHARACTER(c) && str_len > 1)
- {
- if (UI_check_WCSS_normal_character(c, &input_type))
- {
- *s3++ = input_type;
- if (reserve_data == 0)
- {
- s2 = UI_insert_WCSS_default_character(s2, c);
- }
- else
- {
- /* Default string might be shorter than required by s1 (input format) */
- prev_s2 = s2;
- UI_STRING_GET_NEXT_CHARACTER(s2, dst_ch);
- if (dst_ch == 0)
- {
- reserve_data = 0;
- s2 = UI_insert_WCSS_default_character(prev_s2, c);
- }
- }
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- str_len--;
- }
- else if (c == 0x5C) /* '\' */
- {
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- if (UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- goto parse_error;
- }
- *s3++ = 0xff; /* Not editable character */
- if (reserve_data == 0)
- {
- UI_STRING_INSERT_CHARACTER(s2, c);
- }
- else
- {
- /* Default string might be shorter than required by s1 (input format) */
- prev_s2 = s2;
- UI_STRING_GET_NEXT_CHARACTER(s2, dst_ch);
- if (dst_ch == 0)
- {
- reserve_data = 0;
- s2 = prev_s2;
- UI_STRING_INSERT_CHARACTER(s2, c);
- }
- }
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- str_len--;
- }
- else if (c == 0x2A) /* '*' */
- {
- S16 i = 0;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- if (UI_STRING_END_OF_STRING_CHARACTER(c) || (!UI_check_WCSS_normal_character(c, &input_type)))
- {
- goto parse_error;
- }
- for (i = 0; i < str_len - 1; i++)
- {
- /* Setup format only. No default value for * format */
- /* s2 = UI_insert_WCSS_default_character(s2, c); */
- *s3++ = input_type | PIXTEL_UI_WCSS_STAR_INPUT;
- }
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- if (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- goto parse_error;
- }
- c = 0;
- break;
- }
- else if ((c >= 0x31) && (c <= 0x39)) /* '1' - '9' */
- {
- S16 n = c - 0x30;
- S16 i = 0;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- while ((c >= 0x30) && (c <= 0x39)) /* '0' - '9' */
- {
- n *= 10;
- n += (c - 0x30);
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- if (UI_STRING_END_OF_STRING_CHARACTER(c) || (!UI_check_WCSS_normal_character(c, &input_type)))
- {
- goto parse_error;
- }
- if (n > str_len - 1)
- {
- goto parse_error;
- }
- for (i = 0; i < n; i++)
- {
- *s3++ = input_type;
- if (reserve_data == 0)
- {
- s2 = UI_insert_WCSS_default_character(s2, c);
- }
- else
- {
- /* Default string might be shorter than required by s1 (input format) */
- prev_s2 = s2;
- UI_STRING_GET_NEXT_CHARACTER(s2, dst_ch);
- if (dst_ch == 0)
- {
- reserve_data = 0;
- s2 = UI_insert_WCSS_default_character(prev_s2, c);
- }
- }
- }
- str_len -= n;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- else
- {
- goto parse_error;
- }
- }
- /* Buffer size smaller than required by input-format */
- if (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- goto parse_error;
- }
- *s3 = ' ';
- if (reserve_data == 0)
- {
- *s2++ = 0;
- *s2 = 0;
- }
- return 0;
- parse_error:
- *original_s3 = ' ';
- if (reserve_data == 0)
- {
- *original_s2++ = 0;
- *original_s2 = 0;
- }
- return (S8) (-1);
- }
- /*****************************************************************************
- * FUNCTION
- * get_category_115_format_buffer_length
- * DESCRIPTION
- * Get the exact length of WCSS input format buffer
- * PARAMETERS
- * s1 [IN] IN input format
- * buffer_size [IN] IN maximum length of dchar including ' '
- * RETURNS
- * 0 Variable length
- * -1 Invalid format
- * otherwise
- *****************************************************************************/
- S32 get_category_115_format_buffer_length(U8 *s1, S32 buffer_size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type c;
- U8 input_type;
- S32 special_char = 0;
- S32 format_length = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_STRING_GET_NEXT_CHARACTER(s1, c) while (!UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- if (UI_check_WCSS_normal_character(c, &input_type))
- {
- format_length++;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- else if (c == 0x5C) /* '\' */
- {
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- if (UI_STRING_END_OF_STRING_CHARACTER(c))
- {
- return -1;
- }
- special_char++;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- else if (c == 0x2A) /* '*' */
- {
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- if (UI_STRING_END_OF_STRING_CHARACTER(c) || (!UI_check_WCSS_normal_character(c, &input_type)))
- {
- return -1;
- }
- else
- {
- if (format_length + special_char <= buffer_size - 1)
- {
- return 0;
- }
- else
- {
- return -1;
- }
- }
- }
- else if ((c >= 0x31) && (c <= 0x39)) /* '1' - '9' */
- {
- S16 n = c - 0x30;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- while ((c >= 0x30) && (c <= 0x39)) /* '0' - '9' */
- {
- n *= 10;
- n += (c - 0x30);
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- if (UI_STRING_END_OF_STRING_CHARACTER(c) || (!UI_check_WCSS_normal_character(c, &input_type)))
- {
- return -1;
- }
- format_length += n;
- UI_STRING_GET_NEXT_CHARACTER(s1, c);
- }
- else
- {
- return -1;
- }
- }
- /* Note: we allow the case that format_length == 0. However, user cannot
- edit at all */
- if (format_length + special_char <= buffer_size - 1)
- {
- return (format_length + special_char);
- }
- else
- {
- return -1;
- }
- }
- #endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */
- #ifdef __MMI_TOUCH_DIAL_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * gui_dialing_screen_translate_pen_position
- * DESCRIPTION
- *
- * PARAMETERS
- * dialing_keypad [?]
- * x [IN]
- * y [IN]
- * item_index [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialing_screen_translate_pen_position(dialing_keypad_struct *dialing_keypad, S32 x, S32 y, S32 *item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 total_height = 0, total_width = 0;
- S32 i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- total_height += dialing_keypad->keypad_y;
- total_width += dialing_keypad->keypad_x;
- *item_index = -1; /* 053005 Calvin added for function key */
- for (i = 0; i < dialing_keypad->n_rows; i++)
- {
- total_height += dialing_keypad->key_height;
- if (total_height > y)
- {
- for (j = 0; j < dialing_keypad->n_column; j++)
- {
- total_width += dialing_keypad->key_width;
- if (total_width > x)
- {
- *item_index = i * dialing_keypad->n_column + j + 1;
- dialing_keypad->selected_key_x =
- dialing_keypad->keypad_x + (dialing_keypad->key_width) * j +
- (dialing_keypad->horizontal_gap) * j;
- dialing_keypad->selected_key_y =
- dialing_keypad->keypad_y + (dialing_keypad->key_height) * i +
- (dialing_keypad->vertical_gap) * i;
- dialing_keypad->key_type = *item_index;
- break;
- }
- else
- {
- total_width += dialing_keypad->horizontal_gap;
- if (total_width > x)
- {
- *item_index = -1;
- return;
- }
- }
- }
- break;
- }
- else
- {
- total_height += dialing_keypad->vertical_gap;
- if (total_height > y)
- {
- *item_index = -1;
- return;
- }
- }
- }
- /* 053005 Calvin added for function key */
- #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
- if (*item_index != -1)
- {
- return;
- }
- total_height = dialing_keypad->keypad_func_y;
- total_width = dialing_keypad->keypad_func_x;
- if (x < dialing_keypad->keypad_func_x || y < dialing_keypad->keypad_func_y) /* 110105 dialing handle Calvin added */
- {
- return;
- }
- for (i = 0; i < dialing_keypad->func_n_rows; i++)
- {
- total_height += dialing_keypad->func_key_height;
- if (total_height > y)
- {
- for (j = 0; j < dialing_keypad->func_n_column; j++)
- {
- total_width += dialing_keypad->func_key_width;
- if (total_width > x)
- {
- *item_index =
- dialing_keypad->n_rows * dialing_keypad->n_column + i * dialing_keypad->func_n_column + j + 1;
- dialing_keypad->selected_key_x =
- dialing_keypad->keypad_func_x + (dialing_keypad->func_key_width) * j +
- (dialing_keypad->func_horizontal_gap) * j;
- dialing_keypad->selected_key_y =
- dialing_keypad->keypad_func_y + (dialing_keypad->func_key_height) * i +
- (dialing_keypad->func_vertical_gap) * i;
- dialing_keypad->key_type = *item_index;
- break;
- }
- else
- {
- total_width += dialing_keypad->func_horizontal_gap;
- if (total_width > x)
- {
- *item_index = -1;
- return;
- }
- }
- }
- break;
- }
- else
- {
- total_height += dialing_keypad->func_vertical_gap;
- if (total_height > y)
- {
- *item_index = -1;
- return;
- }
- }
- }
- #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */
- /* Calvin end */
- }
- /***********************************************************************
- __GDI_MEMORY_PROFILE_2__ is used to decide whether multilayer is on or off.
- if multilayer is enable, no buffer is used.
- we can use one layer for keypad bg image, and another for selected keys.
- ***********************************************************************/
- #ifndef __GDI_MEMORY_PROFILE_2__
- U8 key_buffer[(MMI_DIALING_KEY_WIDTH + 1) * (MMI_DIALING_KEY_HEIGHT + 1) * 2];
- #endif
- /*****************************************************************************
- * FUNCTION
- * gui_dialing_key_select
- * DESCRIPTION
- *
- * PARAMETERS
- * dialing_keypad [?]
- * item_index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialing_key_select(dialing_keypad_struct *dialing_keypad, S32 item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- S32 width, height;
- S32 key_width, key_height;
- MMI_ID_TYPE image_id;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 053005 Calvin added for function key */
- #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
- if (item_index >= MMI_DIALING_KEY_FUNC)
- {
- key_width = dialing_keypad->func_key_width;
- key_height = dialing_keypad->func_key_height;
- }
- else
- #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */
- {
- key_width = dialing_keypad->key_width;
- key_height = dialing_keypad->key_height;
- }
- /* Calvin end */
- x1 = dialing_keypad->selected_key_x;
- y1 = dialing_keypad->selected_key_y;
- /* 053005 Calvin added for function key */
- x2 = x1 + key_width - 1;
- y2 = y1 + key_height - 1;
- /* Calvin end */
- #ifndef __GDI_MEMORY_PROFILE_2__
- dialing_keypad->selected_key_bitmap.buf_ptr = key_buffer; /* (U8*)gui_malloc((MMI_DIALING_KEY_WIDTH+1)*(MMI_DIALING_KEY_HEIGHT+1)*2); */
- gdi_layer_push_clip();
- gdi_layer_set_clip(x1, y1, x2, y2);
- gdi_image_cache_bmp_get(x1, y1, x2, y2, &dialing_keypad->selected_key_bitmap);
- gdi_layer_pop_clip();
- #endif /* __GDI_MEMORY_PROFILE_2__ */
- gdi_layer_push_clip();
- gdi_layer_set_clip(x1, y1, x2, y2);
- image_id = dialing_key_image[item_index - 1];
- gui_measure_image(get_image(image_id), &width, &height);
- /* 053005 Calvin added for function key */
- x1 = x1 + ((key_width - width) >> 1);
- y1 = y1 + ((key_height - height) >> 1);
- /* Calvin end */
- gui_show_image(x1, y1, get_image(image_id));
- gdi_layer_pop_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * gui_dialing_key_unselect
- * DESCRIPTION
- *
- * PARAMETERS
- * dialing_keypad [?]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_dialing_key_unselect(dialing_keypad_struct *dialing_keypad)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 x1, x2, y1, y2;
- #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
- S32 item_index = dialing_keypad->key_type;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- x1 = dialing_keypad->selected_key_x;
- y1 = dialing_keypad->selected_key_y;
- #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
- if (item_index >= MMI_DIALING_KEY_FUNC)
- {
- x2 = x1 + dialing_keypad->func_key_width - 1;
- y2 = y1 + dialing_keypad->func_key_height - 1;
- }
- else
- #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */
- {
- x2 = x1 + dialing_keypad->key_width - 1;
- y2 = y1 + dialing_keypad->key_height - 1;
- }
- gdi_layer_push_clip();
- gdi_layer_set_clip(x1, y1, x2, y2);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
- #else
- gdi_image_cache_bmp_draw(x1, y1, &dialing_keypad->selected_key_bitmap);
- #endif
- gdi_layer_pop_clip();
- }
- /* 110105 dialing deflect Calvin Start */
- #ifdef __MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__
- /*****************************************************************************
- * FUNCTION
- * gui_show_dialing_key
- * DESCRIPTION
- * Shows the phonebook icon on the dialing screen.
- * PARAMETERS
- * key [IN]
- * enableFlag [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_show_dialing_key(gui_dialing_key key, BOOL enableFlag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- S32 item_index = 0;
- MMI_ID_TYPE item_icon;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (key)
- {
- case MMI_DIALING_KEY_PHB:
- if (enableFlag)
- {
- item_icon = IMG_DIALING_KEY_PHB;
- }
- else
- {
- item_icon = IMG_DIALING_KEY_PHB_DISABLED;
- }
- break;
- case MMI_DIALING_KEY_CALL:
- if (enableFlag)
- {
- item_icon = IMG_DIALING_KEY_CALL;
- }
- else
- {
- item_icon = IMG_DIALING_KEY_CALL_DISABLED;
- }
- break;
- //KP Jerry add on 2006-11-12 start
- case MMI_DIALING_KEY_IPCALL:
- if(enableFlag)
- {
- item_icon = IMG_DIALING_KEY_IPCALL;
- }
- else
- {
- item_icon = IMG_DIALING_KEY_IPCALL_DISABLED;
- }
- break;
- //KP Jerry add on 2006-11-12 end
- default:
- return;
- }
- item_index = key - (MMI_DIALING_KEY_FUNC);
- x1 = MMI_DIALING_KEYPAD_FUNC_X + (item_index / MMI_DIALING_KEYPAD_FUNC_ROWS) * (MMI_DIALING_FUNC_KEY_WIDTH +
- MMI_DIALING_FUNC_KEY_HORIZONTAL_GAP);
- y1 = MMI_DIALING_KEYPAD_FUNC_Y + (item_index / MMI_DIALING_KEYPAD_FUNC_COLOMNS) * (MMI_DIALING_FUNC_KEY_HEIGHT +
- MMI_DIALING_FUNC_KEY_VERTICAL_GAP);
- x2 = x1 + MMI_DIALING_FUNC_KEY_WIDTH - 1;
- y2 = y1 + MMI_DIALING_FUNC_KEY_HEIGHT - 1;
- gdi_layer_push_clip();
- gdi_layer_set_clip(x1, y1, x2, y2);
- gdi_image_draw(x1, y1, (U8*) get_image(item_icon));
- gdi_layer_pop_clip();
- }
- #endif /* __MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__ */
- /* 110105 dialing deflect Calvin Start */
- /*****************************************************************************
- * FUNCTION
- * gui_dialing_screen_translate_pen_event
- * DESCRIPTION
- *
- * PARAMETERS
- * dialing_keypad [?]
- * x [IN]
- * y [IN]
- * pen_event [IN]
- * menu_event [?]
- * dialing_key_param [?]
- * RETURNS
- *
- *****************************************************************************/
- BOOL gui_dialing_screen_translate_pen_event(
- dialing_keypad_struct *dialing_keypad,
- S32 x,
- S32 y,
- mmi_pen_event_type_enum pen_event,
- gui_dialing_key_pen_enum *menu_event,
- gui_pen_event_param_struct *dialing_key_param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret;
- S32 item_index;
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ret = TRUE;
- *menu_event = GUI_DIALING_PEN_NONE;
- /* 053005 Calvin */
- #if defined (__MMI_MAINLCD_240X320__) && defined (__MMI_TOUCH_DIAL_SCREEN__)
- x1 = dialing_keypad->keypad_x;
- y1 = dialing_keypad->keypad_y;
- #else /* defined (__MMI_MAINLCD_240X320__) && defined (__MMI_TOUCH_DIAL_SCREEN__) */
- x1 = dialing_keypad->keypad_x;
- y1 = dialing_keypad->keypad_y;
- #endif /* defined (__MMI_MAINLCD_240X320__) && defined (__MMI_TOUCH_DIAL_SCREEN__) */
- /* Calvin end */
- x2 = x1 + dialing_keypad->keypad_width - 1;
- y2 = y1 + dialing_keypad->keypad_height - 1;
- switch (pen_event)
- {
- case MMI_PEN_EVENT_DOWN:
- if (PEN_CHECK_BOUND(x, y, x1, y1, dialing_keypad->keypad_width, dialing_keypad->keypad_height))
- {
- gui_dialing_screen_translate_pen_position(dialing_keypad, x, y, &item_index);
- if (item_index == -1) /* No key is selected */
- {
- ret = FALSE;
- }
- /* PMT HIMANSHU START 20050825 */
- #ifdef __MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__
- else if (item_index == MMI_DIALING_KEY_CALL && mmi_bootup_get_active_flight_mode())
- {
- ret = FALSE;
- }
- //KP Jerry add on 2006-11-13 start
- else if ( (item_index == MMI_DIALING_KEY_IPCALL && mmi_bootup_get_active_flight_mode()) || (item_index == MMI_DIALING_KEY_IPCALL && g_idle_context.IsOnSimErrorDialerScreen == 1) )
- {
- ret = FALSE;
- }
- //KP Jerry add on 2006-11-13 end
- #endif /* __MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__ */
- /* PMT HIMANSHU END 20050825 */
- else
- {
- gui_dialing_key_select(dialing_keypad, item_index);
- }
- }
- else
- {
- ret = FALSE;
- }
- break;
- case MMI_PEN_EVENT_UP:
- if (PEN_CHECK_BOUND
- (x, y, dialing_keypad->selected_key_x, dialing_keypad->selected_key_y, dialing_keypad->key_width,
- dialing_keypad->key_height))
- {
- gui_dialing_screen_translate_pen_position(dialing_keypad, x, y, &item_index);
- gui_dialing_key_unselect(dialing_keypad);
- if (item_index > MMI_DIALING_KEY_START && item_index < MMI_DIALING_KEY_STAR)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, item_index);
- }
- else
- {
- switch (item_index)
- {
- case MMI_DIALING_KEY_STAR:
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, KEY_STAR);
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_STAR;
- break;
- case MMI_DIALING_KEY_ZERO:
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, 0);
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- break;
- case MMI_DIALING_KEY_HASH:
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, KEY_POUND);
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_HASH;
- break;
- /* 071005 Calvin added for function key */
- #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
- case MMI_DIALING_KEY_PHB:
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_PHB;
- break;
- case MMI_DIALING_KEY_CALL:
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_CALL;
- break;
- //KP Jerry add on 2006-11-12 start
- case MMI_DIALING_KEY_IPCALL:
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_IPCALL;
- break;
- //KP Jerry add on 2006-11-12 end
- #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */
- /* Calvin end */
- }
- }
- }
- else
- {
- ret = FALSE;
- }
- break;
- case MMI_PEN_EVENT_MOVE:
- if (!PEN_CHECK_BOUND
- (x, y, dialing_keypad->selected_key_x, dialing_keypad->selected_key_y, dialing_keypad->key_width,
- dialing_keypad->key_height))
- {
- if (dialing_keypad->key_type == MMI_DIALING_KEY_STAR)
- {
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, KEY_STAR);
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_STAR;
- }
- else
- {
- *menu_event = GUI_DIALING_KEYPAD_HIGHLIGHT_CHANGED;
- }
- }
- else if (PEN_CHECK_BOUND
- (x, y, dialing_keypad->selected_key_x, dialing_keypad->selected_key_y, dialing_keypad->key_width,
- dialing_keypad->key_height))
- {
- gui_dialing_screen_translate_pen_position(dialing_keypad, x, y, &item_index);
- gui_dialing_key_select(dialing_keypad, item_index);
- //*menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- //GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param,item_index );
- }
- break;
- case MMI_PEN_EVENT_LONG_TAP:
- if (PEN_CHECK_BOUND
- (x, y, dialing_keypad->selected_key_x, dialing_keypad->selected_key_y, dialing_keypad->key_width,
- dialing_keypad->key_height))
- {
- gui_dialing_screen_translate_pen_position(dialing_keypad, x, y, &item_index);
- /* start vijay 20050624vijay...chngaes done for activating silent mode */
- if (item_index >= MMI_DIALING_KEY_START && item_index <= MMI_DIALING_KEY_STAR)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, item_index);
- }
- else if (item_index == MMI_DIALING_KEY_HASH)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_HASH;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, KEY_POUND);
- }
- /* end vijay */
- }
- break;
- case MMI_PEN_EVENT_REPEAT:
- if (PEN_CHECK_BOUND
- (x, y, dialing_keypad->selected_key_x, dialing_keypad->selected_key_y, dialing_keypad->key_width,
- dialing_keypad->key_height))
- {
- gui_dialing_screen_translate_pen_position(dialing_keypad, x, y, &item_index);
- if (item_index > MMI_DIALING_KEY_START && item_index < MMI_DIALING_KEY_STAR)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, item_index);
- }
- else if (item_index == MMI_DIALING_KEY_STAR)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_STAR;
- }
- else if (item_index == MMI_DIALING_KEY_ZERO)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_DIG_I;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(dialing_key_param, 0);
- }
- else if (item_index == MMI_DIALING_KEY_HASH)
- {
- *menu_event = GUI_DIALING_KEYPAD_PEN_INSERT_HASH;
- }
- }
- else
- {
- ret = FALSE;
- }
- break;
- }
- return ret;
- }
- #endif /* __MMI_TOUCH_DIAL_SCREEN__ */ /* __MMI_TOUCH_SCREEN__ */
- /* end vijay */
- #ifdef __MMI_TOUCH_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * gui_single_line_input_box_translate_pen_event
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * pen_event [IN]
- * x [IN]
- * y [IN]
- * single_line_input_box_event [?]
- * RETURNS
- *
- *****************************************************************************/
- BOOL gui_single_line_input_box_translate_pen_event(
- single_line_input_box *b,
- mmi_pen_event_type_enum pen_event,
- S16 x,
- S16 y,
- gui_single_line_input_box_pen_enum *single_line_input_box_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret = MMI_TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (pen_event)
- {
- case MMI_PEN_EVENT_DOWN:
- if (PEN_CHECK_BOUND(x, y, b->x, b->y, b->width, b->height))
- {
- *single_line_input_box_event = GUI_SINGLE_LINE_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, b->height))
- {
- *single_line_input_box_event = GUI_SINGLE_LINE_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, b->height))
- {
- }
- else
- {
- ret = MMI_FALSE;
- }
- break;
- }
- return ret;
- }
- static multi_line_input_box *gui_pen_scroll_multi_line_input_box = NULL;
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_scroll_by_pen
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * offset_y [IN]
- * multi_line_input_box_event [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_multi_line_input_box_scroll_by_pen(
- multi_line_input_box *b,
- S32 offset_y,
- gui_multi_line_input_box_pen_enum *multi_line_input_box_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int move_gap = b->text_offset_y + offset_y;
- int line_height;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- b->text_offset_y = -offset_y;
- /* W05.35 For Scroll Issue with Header Height */
- /* W06.02 Fix Cursor Display Issue */
- /* W06.26 Remove compile warnings and review cursor position issue */
- StopMyTimer(BLINKING_CURSOR);
- if (b->max_line_height)
- {
- line_height = b->max_line_height;
- }
- else
- {
- line_height = b->min_line_height;
- }
- if ((b->cursor_y) < -(b->text_offset_y) ||
- (b->cursor_y + line_height) > b->edit_height - b->text_offset_y)
- {
- S32 new_UI_cursor_y1 = UI_cursor_y1;
- if (move_gap > 0)
- {
- new_UI_cursor_y1 = UI_cursor_y1 + line_height;
- }
- if ((new_UI_cursor_y1 + line_height) > (b->y + b->height))
- {
- new_UI_cursor_y1 = b->y + b->height - line_height;
- }
- else if (new_UI_cursor_y1 < b->y)
- {
- new_UI_cursor_y1 = b->y + line_height;
- }
- gui_show_multi_line_input_box_ext(b, UI_cursor_x1, new_UI_cursor_y1);
- }
- b->text_offset_y = -offset_y;
- gui_show_multi_line_input_box(b);
- gui_BLT_double_buffer(b->x, b->y, b->x + b->width, b->y + b->height);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_scroll_timer_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_multi_line_input_box_scroll_timer_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- multi_line_input_box *b = gui_pen_scroll_multi_line_input_box;
- gui_multi_line_input_box_pen_enum multi_line_input_box_event;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_pen_scroll_multi_line_input_box = NULL;
- if (!b)
- {
- return;
- }
- gui_multi_line_input_box_scroll_by_pen(b, b->pen_scroll_after_delay, &multi_line_input_box_event);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_abort_scroll_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_multi_line_input_box_abort_scroll_timer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_pen_scroll_multi_line_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_start_scroll_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * value [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void gui_multi_line_input_box_start_scroll_timer(multi_line_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_multi_line_input_box || gui_pen_scroll_multi_line_input_box == b);
- b->pen_scroll_after_delay = value;
- gui_pen_scroll_multi_line_input_box = b;
- gui_cancel_timer(gui_multi_line_input_box_scroll_timer_hdlr);
- gui_start_timer(b->pen_scroll_delay_time, gui_multi_line_input_box_scroll_timer_hdlr);
- gui_add_cleanup_hook(gui_multi_line_input_box_abort_scroll_timer);
- }
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_set_pen_scroll_delay
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * delay_time [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void gui_multi_line_input_box_set_pen_scroll_delay(multi_line_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_multi_line_input_box_translate_pen_event
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * pen_event [IN]
- * x [IN]
- * y [IN]
- * multi_line_input_box_event [?]
- * RETURNS
- *
- *****************************************************************************/
- BOOL gui_multi_line_input_box_translate_pen_event(
- multi_line_input_box *b,
- mmi_pen_event_type_enum pen_event,
- S16 x,
- S16 y,
- gui_multi_line_input_box_pen_enum *multi_line_input_box_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret = MMI_TRUE;
- gui_multi_line_input_box_pen_state_struct *pen_state;
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- int scroll_bar_width;
- BOOL scroll_bar_active = MMI_TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* W06.04 Fix UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR issue in Touch Screen */
- if ((b->flags & UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR)
- || ((b->flags & UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR) && (b->vbar.scale > b->vbar.range)))
- {
- scroll_bar_width = 0;
- scroll_bar_active = FALSE;
- }
- else
- {
- scroll_bar_width = b->vbar.width;
- scroll_bar_active = TRUE;
- }
- 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_multi_line_input_box_start_scroll_timer(b, scrollbar_param._u.i);
- }
- else
- {
- gui_multi_line_input_box_scroll_by_pen(b, scrollbar_param._u.i, multi_line_input_box_event);
- }
- }
- *multi_line_input_box_event = GUI_MULTI_LINE_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 (scroll_bar_active /* !(b->flags&UI_MULTI_LINE_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;
- /* W06.06 When the text is empty, max_line_height equals zero */
- if (b->max_line_height)
- {
- gui_vertical_scrollbar_set_minimum_pen_offset(&b->vbar, b->max_line_height);
- }
- else
- {
- gui_vertical_scrollbar_set_minimum_pen_offset(&b->vbar, b->min_line_height);
- }
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- if (b->pen_scroll_delay_time > 0) /* Delay time for scrollbar scrolling */
- {
- gui_multi_line_input_box_start_scroll_timer(b, scrollbar_param._u.i);
- }
- else
- {
- gui_multi_line_input_box_scroll_by_pen(
- b,
- scrollbar_param._u.i,
- multi_line_input_box_event);
- }
- }
- *multi_line_input_box_event = GUI_MULTI_LINE_INPUT_BOX_PEN_SCROLL_BAR;
- }
- else
- {
- *multi_line_input_box_event = GUI_MULTI_LINE_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) &&
- !(b->flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE))
- {
- *multi_line_input_box_event = GUI_MULTI_LINE_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__ */
- /*****************************************************************************
- * FUNCTION
- * gui_multi_line_input_box_get_remaining_length
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- int gui_multi_line_input_box_get_remaining_length(multi_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 n, max_n;
- U8 temp_0x81 = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- n = (b->text_length >> 1) - 1;
- max_n = (b->available_length >> 1) - 1;
- if ((b->flags & UI_MULTI_LINE_INPUT_BOX_CHECK_GSM_EXTENDED) && (b->UCS2_count == 0))
- {
- n += b->GSM_ext_count;
- }
- if ((b->flags & UI_MULTI_LINE_INPUT_BOX_PLUS_CHARACTER_HANDLING) && (b->text[0] == '+'))
- {
- n--;
- max_n--;
- }
- if (MMI_current_input_ext_type & INPUT_TYPE_EXT_USE_0x81_ENCODING)
- {
- temp_0x81 = mmi_phb_convert_to_0x81((S8*) b->text, FALSE);
- if (0 != temp_0x81)
- {
- max_n = (b->allocated_length >> 1) - 4;
- n = temp_0x81 - 3;
- }
- }
- return max_n - n;
- }
- /*****************************************************************************
- * FUNCTION
- * gui_single_line_input_box_get_remaining_length
- * DESCRIPTION
- *
- * PARAMETERS
- * b [?]
- * RETURNS
- *
- *****************************************************************************/
- int gui_single_line_input_box_get_remaining_length(single_line_input_box *b)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 n, max_n;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- n = (b->text_length >> 1) - 1;
- max_n = (b->available_length >> 1) - 1;
- if ((b->flags & UI_MULTI_LINE_INPUT_BOX_CHECK_GSM_EXTENDED) && (b->UCS2_count == 0))
- {
- n += b->GSM_ext_count;
- }
- if ((b->flags & UI_MULTI_LINE_INPUT_BOX_PLUS_CHARACTER_HANDLING) && (b->text[0] == '+'))
- {
- n--;
- max_n--;
- }
- return max_n - n;
- }
- void gui_multi_line_input_box_register_infobar_callback(
- multi_line_input_box *b,
- void(*redraw_callback)(S32 x1,S32 y1,S32 x2,S32 y2),
- void(*reminder_char_callback)(S32 x1,S32 y1,S32 x2,S32 y2),
- U32 height)
- {
- if(height==0) height = INFORMATION_BAR_HEIGHT;
- b->infobar_redraw_callback = redraw_callback;
- b->infobar_reminder_char_callback = reminder_char_callback;
- wgui_inputbox_information_bar_height = height;
- }
- void gui_multi_line_input_box_register_change_event_handler(
- multi_line_input_box *b,
- MMI_BOOL (*handler)(gui_multi_line_input_box_change_event_enum event,U16 C))
- {
- b->change_event_handler = handler;
- }