gui_inputs.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:662k
源码类别:

MTK

开发平台:

C/C++

  1.         b->width = string_width + 4;
  2.         b->height = string_height + 4;
  3.         b->text_y = 2;
  4.         x2 = x1 + b->width - 1;     /* end x position of single line input box */
  5.         y2 = y1 + b->height - 1;    /* end y position of single line input box */
  6.         gui_draw_rectangle(x1 + 1, y1 + 1, x2 - 1, y2 - 1, UI_COLOR_BLACK);
  7.     }
  8.     if (!(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW) && !(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND))
  9.     {
  10.         gui_draw_filled_area(x1, y1, x2, y2, f);
  11.     }
  12.     /* PMT VIKAS START 20050524 */
  13. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  14.     //PMT VIKAS START 20050630
  15.     // remove the function call.
  16.     //   gui_single_line_enable_transparent_effect(&f);   // to enable transparent effect flag for rest program
  17.     //PMT VIKAS END 20050630  
  18. #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  19.     /* PMT VIKAS END */
  20.     gui_push_text_clip();
  21.     switch (border_type)
  22.     {
  23.         case 0:
  24.             gui_set_text_clip(x1, y1, x2, y2);
  25.             gui_set_clip(x1, y1, x2, y2);
  26.             break;
  27.         case 1:
  28.             gui_set_text_clip(x1 + 1, y1, x2 - 1, y2);
  29.             gui_set_clip(x1 + 1, y1 + 1, x2 - 1, y2 - 1);
  30.             break;
  31.         case 2:
  32.             gui_set_text_clip(x1 + 2, y1, x2 - 2, y2);
  33.             gui_set_clip(x1 + 2, y1 + 2, x2 - 2, y2 - 2);
  34.             break;
  35.     }
  36.     /* set text font */
  37. #if defined(__MMI_TOUCH_SCREEN__)
  38.     gui_set_font(b->text_font);
  39. #else 
  40.     gui_set_font(&MMI_medium_font);
  41. #endif 
  42.     box_width = (x2 - x1 - 6);
  43.     cy = y1 + 2;
  44.     ch = y2 - y1 - 3;
  45.     if (flags & UI_SINGLE_LINE_INPUT_BOX_FULL_HEIGHT_BLOCK_CURSOR)
  46.     {
  47.         sy1 -= 1;
  48.         sy2 += 1;
  49.     }
  50.     if (current_text_p != NULL)
  51.     {
  52.         if (flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP)
  53.         {
  54.             selection_flag = 1;
  55.             #ifdef __MMI_BIDI_ALG__
  56.             if(arabic_char_flag) selection_flag = 0;
  57.             #endif
  58.         }
  59.         if ((flags & UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE) && (!selection_flag))
  60.         {
  61.             overwrite_mode_flag = 1;
  62.             #ifdef __MMI_BIDI_ALG__
  63.             if(arabic_char_flag) selection_flag = 0;
  64.             #endif
  65.         }
  66.         gui_measure_string_w((UI_string_type) current_text_p, text_gap, &current_text_width, &text_height);
  67.         text_y = b->text_y = (b->height >> 1) - (gui_get_character_height() >> 1);
  68.         if (text_y == 0)
  69.         {
  70.             text_y = 1;
  71.             b->text_y = 1;
  72.         }
  73.         /* MTK added by Elvis and Manju */
  74.         if (flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW)
  75.         {
  76.             /* MTK Elvis for R2L characters */
  77.             if (default_direction == BIDI_L)
  78.             {
  79.                 text_x = b->text_x;
  80.             }
  81.             else
  82.             {
  83.                 text_x = box_width;
  84.             }
  85.             /* MTK end */
  86.         }
  87.         else
  88.         {
  89.             /* MTK Elvis for R2L characters */
  90.             if (flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_SCROLLING)
  91.             {
  92.                 if (default_direction == BIDI_L)
  93.                 {
  94.                     text_x = b->text_x;
  95.                 }
  96.                 else
  97.                 {
  98.                     text_x = box_width;
  99.                 }
  100.             }
  101.             else
  102.             {
  103.                 if (default_direction == BIDI_L)
  104.                 {
  105.                     text_x = b->text_x + b->text_offset_x;
  106.                 }
  107.                 else
  108.                 {
  109.                     text_x = box_width - b->text_offset_x;
  110.                 }
  111.             }
  112.             /* MTK end */
  113.         }
  114.         /* MTK end */
  115.         if (current_text_width <= box_width)
  116.         {
  117.             if (flags & UI_SINGLE_LINE_INPUT_BOX_CENTER_JUSTIFY)
  118.             {
  119.                 text_x = (b->width >> 1) - (current_text_width >> 1);
  120.             }
  121.             else if (flags & UI_SINGLE_LINE_INPUT_BOX_RIGHT_JUSTIFY)
  122.             {
  123.                 text_x = (box_width - current_text_width + 4);
  124.             }
  125.         }
  126.         if ((flags & UI_SINGLE_LINE_INPUT_BOX_RIGHT_JUSTIFY) && (text_x + current_text_width) < box_width)
  127.         {
  128.             text_x = box_width - current_text_width + 4;
  129.         }
  130.         total_width = 0;
  131.     #ifdef __MMI_HINDI_ALG__
  132.         single_editor_moves = 1;
  133.     #endif 
  134.         while (!done)
  135.         {
  136.             previous_text_p = current_text_p;
  137.             if (flags & UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT)
  138.             {
  139.                 if (current_text_p == b->highlight_start_position)
  140.                 {
  141.                     #ifdef __MMI_BIDI_ALG__
  142.                     if(arabic_char_flag)
  143.                         word_highlight=0;
  144.                     else 
  145.                     #endif
  146.                         word_highlight = 1;
  147.                 }
  148.                 if (current_text_p == b->highlight_end_position)
  149.                 {
  150.                     word_highlight = 0;
  151.                 }
  152.             }
  153.             /* MTK Elvis for second word highlight */
  154.             if (flags & UI_SINGLE_LINE_INPUT_BOX_SECOND_WORD_HIGHLIGHT)
  155.             {
  156.                 if (current_text_p == (b->second_highlight_start_position))
  157.                 {
  158.                     second_word_highlight = 1;
  159.                 }
  160.                 if (current_text_p == (b->second_highlight_end_position))
  161.                 {
  162.                     second_word_highlight = 0;
  163.                 }
  164.             }
  165.             /* MTK end */
  166.         #ifdef __MMI_HINDI_ALG__
  167.             PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_single_line_input_box[single_editor_moves]:%d  ",
  168.                                  single_editor_moves));
  169.             while (single_editor_moves--)
  170.         #endif /* __MMI_HINDI_ALG__ */ 
  171.             {
  172.                 UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);        /* get next character */
  173.             }
  174.            
  175.         #if defined (__MMI_LANG_ARABIC__) || defined (__MMI_LANG_PERSIAN__)
  176.         
  177.             temp_p = current_text_p;
  178.             UI_STRING_GET_NEXT_CHARACTER(temp_p, next_char);
  179.             if (IS_ARABIC_CHARACTER(current_character) && IS_ARABIC_CHARACTER(next_char))
  180.             {
  181.                 text_gap = 0;
  182.             }
  183.             else
  184.             {
  185.                 text_gap = b->text_gap;
  186.             }
  187.         #endif /* defined (__MMI_LANG_ARABIC__) || defined (__MMI_LANG_PERSIAN__) */ 
  188.             /* MTK end */
  189.         #if defined(__MMI_LANG_VIETNAMESE__)
  190.             if ((current_character > 0x0040) && (current_character < 0x01B1))
  191.             {
  192.                 UI_STRING_GET_NEXT_CHARACTER(current_text_p, next_character);   /* get next character */
  193.                 tone_mark = mmi_viet_tone_mark(next_character);
  194.                 if (VIET_TONE_NONE != tone_mark)
  195.                 {
  196.                     viet_vowel = mmi_viet_vowel_letter(current_character);
  197.                     if (VIET_VOWEL_NONE != viet_vowel)
  198.                     {
  199.                         current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
  200.                     }
  201.                     else
  202.                     {
  203.                         UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, next_character);
  204.                     }
  205.                 }
  206.                 else
  207.                 {
  208.                     UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, next_character);
  209.                 }
  210.             }
  211.         #endif /* defined(__MMI_LANG_VIETNAMESE__) */ 
  212.         #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
  213.          if (IS_ARABIC_CHARACTER(current_character))
  214.          {
  215.          
  216.              U32 idx = 0;
  217.              
  218.              U32 ligature_move = 0;
  219.              UI_character_type   dummy_c_arabic      = 0;
  220.              if(BIDI_done_flag)
  221.              {
  222.                  idx =(current_text_p - visual_str)/2-1;                   
  223.              }
  224.              else
  225.              {
  226.                  idx =(current_text_p - b->text)/2-1;
  227.                  
  228.              }
  229.              current_character = (UI_character_type)shaping_str[OrgToSha[idx]];
  230.              while(idx < unshaped_text_len-1)
  231.              {
  232.                if(OrgToSha[idx] == OrgToSha[idx+1])
  233.                {
  234.                   ligature_move++;
  235.                }
  236.                else
  237.                {
  238.                   break;
  239.                }
  240.                idx++;
  241.              }
  242.              while(ligature_move > 0)
  243.              {    
  244.                  UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c_arabic);
  245.                  ligature_move--;
  246.              }
  247.          }
  248.         #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */ 
  249.  
  250.             if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
  251.             {
  252.                 break;
  253.             }
  254.             if (!UI_STRING_LINE_BREAK_CHARACTER(current_character))     /* check for null or space character */
  255.             {
  256.                 if (flags & UI_SINGLE_LINE_INPUT_BOX_MASK_CHARACTERS)   /* check if current caharcter is a mask character */
  257.                 {   /* single line passwd support */
  258.                     if (!((flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP) && (current_text_p == b_current_text_p)))
  259.                     {
  260.                         current_character = mask_character;
  261.                     }
  262.                 }
  263.                 if (RequireToMoveCursor(pre_character, current_character))
  264.                 {
  265.                 #ifdef __MMI_HINDI_ALG__
  266.                     /* Move pointer by the cluster width */
  267.                     single_line_curr_p = hf_get_next_cluster_p(single_line_prev_p, single_line_prev_p);
  268.                     single_editor_moves = single_line_curr_p - single_line_prev_p;      /* Number of moves */
  269.                     if (single_editor_moves <= 0)
  270.                     {
  271.                         single_editor_moves = 1;    /* At least 1 */
  272.                     }
  273.                     else
  274.                     {
  275.                         single_editor_moves = single_editor_moves >> 1;
  276.                     }
  277.                     /* Calculate the width of current cluster as well as english character */
  278.                     if (flags & UI_SINGLE_LINE_INPUT_BOX_MASK_CHARACTERS)       /* check if current caharcter is a mask character */
  279.                     {
  280.                         character_width = gui_get_character_width(mask_character);
  281.                     }
  282.                     else
  283.                     {
  284.                         character_width = hf_size_of_current_cluster(single_line_prev_p, single_line_curr_p, 0);
  285.                     }
  286.                     PRINT_INFORMATION_2((MMI_TRACE_INFO, "pixtel_UI_show_single_line_input_box[character_width]:%d  ",
  287.                                          character_width));
  288.                     previous_text_p = single_line_prev_p;
  289.                     single_line_prev_p = single_line_curr_p;
  290.                 #else /* __MMI_HINDI_ALG__ */ 
  291.                     /* single line passwd support */
  292.                     if (flags & UI_SINGLE_LINE_INPUT_BOX_MASK_CHARACTERS)       /* check if current caharcter is a mask character */
  293.                     {
  294.                         character_width = gui_get_character_width(mask_character);
  295.                     }
  296.                     else
  297.                     {
  298.                         character_width = gui_get_character_width(current_character);   /* get character width in pixels */
  299.                     }
  300.                 #endif /* __MMI_HINDI_ALG__ */ 
  301.                 }
  302.                 else
  303.                 {
  304.                     character_width = 0;
  305.                 }
  306.                 if (!(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW))
  307.                 {
  308.                     text_color = b_normal_text_color;
  309.                     if(default_direction != BIDI_L)
  310.                     {
  311.                         cx=x1+text_x-character_width;
  312.                     }
  313.                     else
  314.                     {
  315.                         cx=x1+text_x;
  316.                     }
  317.                     if (word_highlight)
  318.                     {
  319.                         if (flags & UI_SINGLE_LINE_INPUT_BOX_SWITCH_WORD_HIGHLIGHT_COLOR)
  320.                         {
  321.                             gui_fill_rectangle(
  322.                                 cx,
  323.                                 sy1,
  324.                                 cx + character_width,
  325.                                 sy2,
  326.                                 gui_color(255, 0, 0));
  327.                         }
  328.                         else
  329.                         {
  330.                             gui_fill_rectangle(cx, sy1, cx + character_width, sy2, b_selection_color);
  331.                         }
  332.                         text_color = b_selection_text_color;
  333.                     }
  334.                     if (second_word_highlight)
  335.                     {
  336.                         gui_fill_rectangle(cx, sy1, cx + character_width, sy2, b_selection_color);
  337.                         text_color = b_selection_text_color;
  338.                     }
  339.                     if (!(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW))
  340.                     {
  341.                         if (flags & UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR)
  342.                         {
  343.                             if (previous_text_p == b_current_text_p)
  344.                             {
  345.                                 if (overwrite_mode_flag)    /* if overwrite mode */
  346.                                 {
  347.                                     gui_fill_rectangle(
  348.                                         x1 + text_x,
  349.                                         sy1,
  350.                                         x1 + text_x + character_width,
  351.                                         sy2,
  352.                                         b_selection_color);
  353.                                     text_color = b_selection_text_color;
  354.                                 }
  355.                                 if (default_direction == BIDI_L)
  356.                                 {
  357.                                     b->cursor_x = text_x - 1;
  358.                                 }
  359.                                 else
  360.                                 {
  361.                                     b->cursor_x = text_x + 1;
  362.                                 }
  363.                                 cursor_displayed_flag = 1;
  364.                             }
  365.                             else if (current_text_p == b_current_text_p)
  366.                             {
  367.                                 if (selection_flag)
  368.                                 {
  369.                                     gui_fill_rectangle(
  370.                                         x1 + text_x,
  371.                                         sy1,
  372.                                         x1 + text_x + character_width,
  373.                                         sy2,
  374.                                         b_selection_color);
  375.                                     text_color = b_selection_text_color;
  376.                                 }
  377.                             }
  378.                         }
  379.                         else
  380.                         {
  381.                             if (previous_text_p == b_current_text_p)
  382.                             {
  383.                                 if (overwrite_mode_flag)
  384.                                 {
  385.                                     gui_fill_rectangle(
  386.                                         x1 + text_x,
  387.                                         sy1,
  388.                                         x1 + text_x + character_width,
  389.                                         sy2,
  390.                                         b_selection_color);
  391.                                     text_color = b_selection_text_color;
  392.                                 }
  393.                                 /* Added condition to disable vertical cursor drawing in character highlight mode   */
  394.                                 if (!(flags & UI_SINGLE_LINE_INPUT_BOX_CHARACTER_HIGHLIGHT))
  395.                                 {
  396.                                     gui_single_line_input_box_show_cursor(b, x1 + text_x - 1, cy, ch);  /* show cursor */
  397.                                 }
  398.                                 if (default_direction == BIDI_L)
  399.                                 {
  400.                                     b->cursor_x = text_x - 1;
  401.                                 }
  402.                                 else
  403.                                 {
  404.                                     b->cursor_x = text_x + 1;
  405.                                 }
  406.                                 cursor_displayed_flag = 1;
  407.                             }
  408.                             else if (current_text_p == b_current_text_p)
  409.                             {
  410.                                 if (selection_flag)
  411.                                 {
  412.                                     if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  413.                                     {
  414.                                         gui_fill_rectangle(
  415.                                             x1 + text_x,
  416.                                             sy1,
  417.                                             x1 + text_x + b->grid_width,
  418.                                             sy2,
  419.                                             b_selection_color);
  420.                                     }
  421.                                     else
  422.                                     {
  423.                                         gui_fill_rectangle(
  424.                                             x1 + text_x,
  425.                                             sy1,
  426.                                             x1 + text_x + character_width,
  427.                                             sy2,
  428.                                             b_selection_color);
  429.                                     }
  430.                                     text_color = b_selection_text_color;
  431.                                 }
  432.                             }
  433.                         }
  434.                     }
  435.                     if (flags & UI_SINGLE_LINE_INPUT_BOX_VIEW_FULL_CHARACTERS)
  436.                     {
  437.                         if ((cx >= x1) && ((cx + character_width) <= x2))
  438.                         {
  439.                             if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  440.                             {
  441.                                 gui_move_text_cursor(cx + ((b->grid_width - character_width) >> 1), y1 + text_y);
  442.                                 gdi_draw_line(
  443.                                     cx + b->grid_width,
  444.                                     sy1,
  445.                                     cx + b->grid_width,
  446.                                     sy2,
  447.                                     gdi_act_color_from_rgb(255, 112, 125, 240));
  448.                             }
  449.                             else
  450.                             {
  451.                                 gui_move_text_cursor(cx, y1 + text_y);
  452.                             }
  453.                             gui_set_text_color(text_color);
  454.                             //gui_print_character((UI_character_type)current_character);
  455.                             //MTK Elvis for stacked character
  456.                             gui_print_stacked_character(current_character, pre2_character, pre_character);
  457.                             pre2_character = pre_character;
  458.                             pre_character = current_character;
  459.                             /* MTK end */
  460.                         }
  461.                     }   /* MTK Leo add 1125, trucate too long number/name in call list. */
  462.                     else if (flags & UI_SINGLE_LINE_INPUT_BOX_TRUNCATE_CONTENT)
  463.                     {
  464.                         if ((cx >= x1) && (cx + 21) >= x2)
  465.                         {
  466.                             gui_set_text_color(text_color);
  467.                             gui_move_text_cursor(cx, y1 + text_y);
  468.                             gui_print_character((UI_character_type) '.');
  469.                             gui_move_text_cursor(cx + 7, y1 + text_y);
  470.                             gui_print_character((UI_character_type) '.');
  471.                             gui_move_text_cursor(cx + 14, y1 + text_y);
  472.                             gui_print_character((UI_character_type) '.');
  473.                             break;
  474.                         }
  475.                         else if ((cx >= x1) && ((cx + character_width) <= x2))
  476.                         {
  477.                             gui_move_text_cursor(cx, y1 + text_y);
  478.                             gui_set_text_color(text_color);
  479.                             //gui_print_character((UI_character_type)current_character);
  480.                             //MTK Elvis for stacked character
  481.                             gui_print_stacked_character(current_character, pre2_character, pre_character);
  482.                             pre2_character = pre_character;
  483.                             pre_character = current_character;
  484.                             /* MTK end */
  485.                         }
  486.                         /* MTK Leo end 1125 */
  487.                     }
  488.                     else if (flags & UI_SINGLE_LINE_INPUT_BOX_TRUNCATE_CONTENT_NO_BRIEF)        /* 022405 Calvin added */
  489.                     {
  490.                         if ((cx >= x1) && (cx + 7) >= x2)
  491.                         {
  492.                             gui_set_text_color(text_color);
  493.                             gui_move_text_cursor(cx, y1 + text_y);
  494.                             if (character_width < 7 &&
  495.                                 UI_STRING_END_OF_STRING_CHARACTER1((UI_character_type)
  496.                                                                   ((*((current_text_p) + 0)) |
  497.                                                                    ((*((current_text_p) + 1)) << 8))))
  498.                             {
  499.                                 gui_print_stacked_character(current_character, pre2_character, pre_character);
  500.                                 pre2_character = pre_character;
  501.                                 pre_character = current_character;
  502.                             }
  503.                             else
  504.                             {
  505.                                 gui_print_character((UI_character_type) ' ');
  506.                             }
  507.                             break;
  508.                         }
  509.                         else if ((cx >= x1) && ((cx + character_width) <= x2))
  510.                         {
  511.                             gui_move_text_cursor(cx, y1 + text_y);
  512.                             gui_set_text_color(text_color);
  513.                             //gui_print_character((UI_character_type)current_character);
  514.                             //MTK Elvis for stacked character
  515.                             gui_print_stacked_character(current_character, pre2_character, pre_character);
  516.                             pre2_character = pre_character;
  517.                             pre_character = current_character;
  518.                             /* MTK end */
  519.                         }
  520.                     }
  521.                     else
  522.                     {
  523.                         if ((cx + character_width) >= x1 && (cx <= x2))
  524.                         {
  525.                         #if defined(__MMI_HINDI_ALG__)
  526.                             PU8 prev_single_line_temp_p;
  527.                             if (parse_hindi)
  528.                             {
  529.                                 reset_hindi_bordered_params();
  530.                             }
  531.                             get_bordered_text_x(&cx, current_character, text_y);
  532.                             parse_hindi = 0;
  533.                         #endif /* defined(__MMI_HINDI_ALG__) */ 
  534.                             gui_move_text_cursor(cx, y1 + text_y);      /* move text cursor */
  535.                             gui_set_text_color(text_color); /* set text color */
  536.                             /* gui_print_character((UI_character_type)current_character);//print text */
  537.                         #ifdef __MMI_HINDI_ALG__
  538.                             if (single_line_temp_p == (b->last_position_p))
  539.                             {
  540.                                 goto enddisp;
  541.                             }
  542.                             /* Performance issue */
  543.                             prev_single_line_temp_p = single_line_temp_p;
  544.                             single_line_temp_p = hf_get_next_cluster_p(single_line_temp_p, single_line_temp_p);
  545.                             if (hf_get_current_cluster
  546.                                 (prev_single_line_temp_p, single_line_temp_p, single_line_disp_cluster))
  547.                             {
  548.                                 S32 disp_clus_len = pfnUnicodeStrlen((PS8) single_line_disp_cluster);
  549.                                 MMI_ASSERT(!(disp_clus_len > MAX_EDITOR_DISP_LEN));
  550.                                 /* To avoid rule appln in showstring */
  551.                                 hf_disable_hindi_rules_parsing();
  552.                                 hf_padding_value(0);
  553.                                 if (!UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
  554.                                 {
  555.                                     if (flags & UI_SINGLE_LINE_INPUT_BOX_MASK_CHARACTERS)       /* check if current caharcter is a mask character */
  556.                                     {
  557.                                         S32 str_len = UCS2Strlen((const S8*)single_line_disp_cluster);
  558.                                         S32 i;
  559.                                         for (i = 0; i < str_len; i++)
  560.                                         {   /* single line passwd support */
  561.                                             if ((flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP) &&
  562.                                                 (current_text_p == b_current_text_p))
  563.                                             {
  564.                                                 single_line_disp_cluster[i] = current_character;
  565.                                             }
  566.                                             else
  567.                                             {
  568.                                                 single_line_disp_cluster[i] = mask_character;
  569.                                             }
  570.                                         }
  571.                                     }
  572.                                     /* START FARHAD PMT 20050211 */
  573.                                     cancelWidth = 1;
  574.                                     ShowString(
  575.                                         UI_text_x,
  576.                                         UI_text_y,
  577.                                         *UI_font,
  578.                                         0,
  579.                                         (U8*) (single_line_disp_cluster),
  580.                                         UI_text_height);
  581.                                     cancelWidth = 0;
  582.                                     /* END FARHAD PMT 20050211 */
  583.                                 }
  584.                                 else
  585.                                 {
  586.                                     if (flags & UI_SINGLE_LINE_INPUT_BOX_MASK_CHARACTERS)       /* check if current caharcter is a mask character */
  587.                                     {
  588.                                         S32 str_len = UCS2Strlen((const S8*)single_line_disp_cluster);
  589.                                         S32 i;
  590.                                         for (i = 0; i < str_len; i++)
  591.                                         {   /* single line passwd support */
  592.                                             if ((flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP) &&
  593.                                                 (current_text_p == b_current_text_p))
  594.                                             {
  595.                                                 single_line_disp_cluster[i] = current_character;
  596.                                             }
  597.                                             else
  598.                                             {
  599.                                                 single_line_disp_cluster[i] = mask_character;
  600.                                             }
  601.                                         }
  602.                                     }
  603.                                     /* START FARHAD PMT 20050211 */
  604.                                     cancelWidth = 1;
  605.                                     ShowString(
  606.                                         UI_text_x,
  607.                                         UI_text_y,
  608.                                         *UI_font,
  609.                                         0,
  610.                                         (U8*) (single_line_disp_cluster),
  611.                                         UI_text_height);
  612.                                     cancelWidth = 0;
  613.                                     /* END FARHAD PMT 20050211 */
  614.                                 }
  615.                                 /* Open it again */
  616.                                 hf_enable_hindi_rules_parsing();
  617.                                 hf_padding_def_value();
  618.                             }
  619.                             else
  620.                         #endif /* __MMI_HINDI_ALG__ */ 
  621.                             {
  622.                                 gui_print_stacked_character(current_character, pre2_character, pre_character);
  623.                             }
  624.                         #ifdef __MMI_HINDI_ALG__
  625.                           enddisp:
  626.                             memset(single_line_disp_cluster, 0, sizeof(single_line_disp_cluster));
  627.                         #endif /* __MMI_HINDI_ALG__ */ 
  628.                         }
  629.                         /* START FARHAD PIXTELMTK  20050217 */
  630.                     #if defined __MMI_HINDI_ALG__
  631.                         else
  632.                         {
  633.                             single_line_temp_p += (single_editor_moves * 2);
  634.                         }
  635.                     #endif /* defined __MMI_HINDI_ALG__ */ 
  636.                         /* END FARHAD PIXTELMTK  20050217 */
  637.                     }
  638.                 }
  639.                 else if ((previous_text_p == b_current_text_p) && (((-1) == move_to_x) && ((-1) == move_to_y)))
  640.                 {
  641.                     if (default_direction == BIDI_L)
  642.                     {
  643.                         b->cursor_x = text_x - 1;
  644.                     }
  645.                     else
  646.                     {
  647.                         b->cursor_x = text_x + 1;
  648.                     }
  649.                     cursor_displayed_flag = 1;
  650.                 }
  651.                 else if ((((-1) != move_to_x) || ((-1) != move_to_y)) && (!set_cursor_flag))
  652.                 {
  653.                     int cursor_with = 0;
  654.                     if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  655.                     {
  656.                         cursor_with = b->grid_width;
  657.                     }
  658.                     else
  659.                     {
  660.                         cursor_with = character_width;
  661.                     }
  662.                     if ((b->text_offset_x + b->x + text_x + text_gap + cursor_with /* character_width */ ) > move_to_x)
  663.                     {
  664.                         b->current_text_p = previous_text_p;
  665.                         if (default_direction == BIDI_L)
  666.                         {
  667.                             b->cursor_x = text_x - 1;
  668.                         }
  669.                         else
  670.                         {
  671.                             b->cursor_x = text_x + 1;
  672.                         }
  673.                         set_cursor_flag = 1;
  674.                     }
  675.                 }
  676.                 if (default_direction == BIDI_L)
  677.                 {
  678.                     if (RequireToMoveCursor(pre_character, current_character))
  679.                     {
  680.                     #ifdef __MMI_HINDI_ALG__
  681.                         if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
  682.                         {
  683.                             if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  684.                             {
  685.                             }
  686.                             else
  687.                             {
  688.                                 text_x += character_width;
  689.                                 total_width += character_width;
  690.                             }
  691.                         }
  692.                         else
  693.                     #endif /* __MMI_HINDI_ALG__ */ 
  694.                         {
  695.                             if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  696.                             {
  697.                                 text_x += b->grid_width;
  698.                                 total_width += b->grid_width;
  699.                             }
  700.                             else
  701.                             {
  702.                                 text_x += text_gap + character_width;
  703.                                 total_width += text_gap + character_width;
  704.                             }
  705.                         }
  706.                     }
  707.                     else
  708.                     {
  709.                         if (b->ext_flags & UI_SINGLE_LINE_INPUT_BOX_EXT_FIXED_GRID)
  710.                         {
  711.                             text_x += b->grid_width;
  712.                             total_width += b->grid_width;
  713.                         }
  714.                         else
  715.                         {
  716.                             text_x += /* text_gap */ +character_width;
  717.                             total_width += /* text_gap */ +character_width;
  718.                         }
  719.                     }
  720.                 }
  721.                 else
  722.                 {
  723.                     text_x -= (character_width + text_gap);
  724.                     total_width += text_gap + character_width;
  725.                 }
  726.                 pre2_character = pre_character;
  727.                 pre_character = current_character;
  728.             }
  729.         }
  730.         if ((((-1) != move_to_x) || ((-1) != move_to_y)) && (!set_cursor_flag))
  731.         {
  732.             b->current_text_p = previous_text_p;
  733.             if (default_direction == BIDI_L)
  734.             {
  735.                 b->cursor_x = text_x - 1;
  736.             }
  737.             else
  738.             {
  739.                 b->cursor_x = text_x + 1;
  740.             }
  741.             set_cursor_flag = 1;
  742.         }
  743.         b->last_position_p = current_text_p;
  744.         /* W06.15 b->cursor_x is not correct when moving cursor by pen */
  745.         if (!cursor_displayed_flag && (((-1) == move_to_x) && ((-1) == move_to_y)))
  746.         {
  747.             if (!(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW) &&
  748.                 !(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW))
  749.             {
  750.                 if (flags & UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR)
  751.                 {
  752.                     gui_fill_rectangle(x1 + text_x, sy1, x1 + text_x + character_width, sy2, b_selection_color);
  753.                 }
  754.                 else
  755.                 {
  756.                     /* Added condition to disable vertical cursor drawing in character highlight mode   */
  757.                     if (!(flags & UI_SINGLE_LINE_INPUT_BOX_CHARACTER_HIGHLIGHT))
  758.                     {
  759.                         gui_single_line_input_box_show_cursor(b, x1 + text_x - 1, cy, ch);      /* show cursor of single line input box */
  760.                     }
  761.                 }
  762.             }
  763.             if (default_direction == BIDI_L)
  764.             {
  765.                 b->cursor_x = text_x - 1;
  766.             }
  767.             else
  768.             {
  769.                 b->cursor_x = text_x + 1;
  770.             }
  771.         }
  772.     }
  773.     b->text_width = total_width;
  774.     gui_pop_text_clip();
  775.     gui_pop_clip();
  776.     /* MTK Elvis for R2L characters */
  777.     /* PMT RAKESH START 20061006 */
  778. #if defined __MMI_HINDI_ALG__
  779.     restore_current_language_for_hindi_rules();
  780. #endif 
  781.     /* PMT RAKESH END 20061006 */
  782. #ifdef __MMI_BIDI_ALG__
  783.     if (!(flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW) && (((b->text_length >> 1) - 1) != 0) && arabic_char_flag)
  784.     {
  785.         b->text = temp_text_pt;
  786.         b->current_text_p = temp_cursor_p;
  787.         b->last_position_p = b->text + (current_text_p - visual_str);
  788.         if (flags & UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT)
  789.         {
  790.             b->highlight_start_position = temp_hilight_start;
  791.             b->highlight_end_position = temp_hilight_end;
  792.         }
  793.     }
  794. #endif /* __MMI_BIDI_ALG__ */ 
  795. }
  796. /*****************************************************************************
  797.  * FUNCTION
  798.  *  gui_destroy_single_line_input_box
  799.  * DESCRIPTION
  800.  *  frees the buffer allocated for the box and resets the input box
  801.  *  
  802.  *  This doesn't free the single-line inputbox object. It only
  803.  *  frees the buffer that is used to store the text.
  804.  * PARAMETERS
  805.  *  b       [IN]        Is the single-line inputbox object
  806.  * RETURNS
  807.  *  void
  808.  *****************************************************************************/
  809. void gui_destroy_single_line_input_box(single_line_input_box *b)
  810. {
  811.     /*----------------------------------------------------------------*/
  812.     /* Local Variables                                                */
  813.     /*----------------------------------------------------------------*/
  814.     /*----------------------------------------------------------------*/
  815.     /* Code Body                                                      */
  816.     /*----------------------------------------------------------------*/
  817.     b->text_length = 0;
  818.     b->allocated_length = 0;
  819.     b->available_length = 0;
  820.     b->UCS2_count = 0;
  821.     gui_free(b->text);
  822.     b->current_text_p = b->text;
  823. }
  824. /*****************************************************************************
  825.  * FUNCTION
  826.  *  gui_single_line_input_box_locate_cursor
  827.  * DESCRIPTION
  828.  *  calculate the position ofcusror of single line input box
  829.  * PARAMETERS
  830.  *  b       [IN]        Is the single-line inputbox object
  831.  * RETURNS
  832.  *  void
  833.  *****************************************************************************/
  834. void gui_single_line_input_box_locate_cursor(single_line_input_box *b)
  835. {
  836.     /*----------------------------------------------------------------*/
  837.     /* Local Variables                                                */
  838.     /*----------------------------------------------------------------*/
  839.     /* MTK Elvis for R2L characters */
  840. #ifdef __MMI_BIDI_ALG__
  841.     PMT_BIDI_TYPES default_direction = BIDI_L;
  842.     /*----------------------------------------------------------------*/
  843.     /* Code Body                                                      */
  844.     /*----------------------------------------------------------------*/
  845.     bidi_get_char_type(b->text, (U8*) & default_direction);
  846. #endif /* __MMI_BIDI_ALG__ */ 
  847. #ifdef __MMI_BIDI_ALG__
  848.     if (default_direction != BIDI_R && default_direction != AL)
  849.     {
  850. #endif /* __MMI_BIDI_ALG__ */ 
  851.         if ((b->cursor_x + (b->width >> 2) + b->text_offset_x) > (b->width - b->text_x))
  852.         {
  853.             b->text_offset_x = -(b->cursor_x + (b->width >> 2) - (b->width - b->text_x));
  854.             if ((b->text_offset_x + b->text_width) < (b->width - 6))
  855.             {
  856.                 b->text_offset_x = (b->width - 6) - (b->text_width);
  857.             }
  858.         }
  859.         else if ((b->cursor_x + b->text_offset_x + 2) < (b->text_x + (b->width >> 2)))
  860.         {
  861.             b->text_offset_x = -(b->cursor_x - 2 - (b->width >> 2));
  862.         }
  863.         if (b->text_offset_x > 0)
  864.         {
  865.             b->text_offset_x = 0;
  866.         }
  867.     #ifdef __MMI_BIDI_ALG__
  868.     }
  869.     else
  870.     {
  871.         if ((b->cursor_x + b->text_offset_x) < 2)
  872.         {
  873.             b->text_offset_x = (b->width - 10) - (b->text_width);
  874.         }
  875.     }
  876.     #endif /* __MMI_BIDI_ALG__ */ 
  877.     /* MTK end */
  878. }
  879. /*****************************************************************************
  880.  * FUNCTION
  881.  *  gui_single_line_input_box_delete_character
  882.  * DESCRIPTION
  883.  *  Deletes a character before the current cursor position (Backspace)
  884.  * PARAMETERS
  885.  *  b       [IN]        Is the single-line inputbox object
  886.  * RETURNS
  887.  *  void
  888.  *****************************************************************************/
  889. void gui_single_line_input_box_delete_character(single_line_input_box *b)
  890. {
  891.     /*----------------------------------------------------------------*/
  892.     /* Local Variables                                                */
  893.     /*----------------------------------------------------------------*/
  894.     UI_buffer_type current_text_p;
  895.     UI_buffer_type previous_text_p;
  896.     UI_character_type current_character = (UI_character_type) - 1;
  897.     UI_character_type dummy_c = 0;
  898.     /*----------------------------------------------------------------*/
  899.     /* Code Body                                                      */
  900.     /*----------------------------------------------------------------*/
  901.     current_text_p = b->current_text_p;
  902.     previous_text_p = b->current_text_p;
  903.     if (previous_text_p == b->text)
  904.     {
  905.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  906.         {
  907.             UI_editor_play_tone_cannot_change();
  908.         }
  909.         return;
  910.     }
  911.     UI_STRING_GET_PREVIOUS_CHARACTER(previous_text_p, dummy_c); /* get previous caharcter */
  912.     b->text_length -= ((S32) current_text_p - (S32) previous_text_p);   /* update text length ..decrease value */
  913.     b->current_text_p = previous_text_p;    /* set teh current_tet_p equalto previous */
  914.     if (b->flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  915.     {
  916.         UI_TEST_UCS2_DECREMENT_COUNT_SET_LENGTH(dummy_c, b->UCS2_count, b->allocated_length, b->available_length);
  917.     }
  918.     while (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
  919.     {
  920.         UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
  921.         UI_STRING_INSERT_CHARACTER(previous_text_p, current_character);
  922.     }
  923.     if (b->flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP)
  924.     {
  925.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP;
  926.     }
  927.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  928. #ifdef __MMI_HINDI_ALG__
  929.     /* For handling the inbetweeen halanth deletion */
  930.     if ((b->current_text_p - b->text) >= 4)
  931.     {
  932.         UI_buffer_type temp_single_line_cursor_p;
  933.         temp_single_line_cursor_p = b->current_text_p;
  934.         if ((UI_CHK_CONSONANT(*(temp_single_line_cursor_p - 4))) && (UI_CHK_CONSONANT(*(temp_single_line_cursor_p))) &&
  935.             (*(temp_single_line_cursor_p - 2) == 0x4d))
  936.         {
  937.             U8 single_deletion = 0;
  938.             PU8 single_line_first_pos_p = temp_single_line_cursor_p;
  939.             PU8 single_line_second_pos_p;
  940.             single_line_second_pos_p = hf_get_next_cluster_p(single_line_first_pos_p, single_line_first_pos_p);
  941.             single_deletion = single_line_second_pos_p - single_line_first_pos_p;       /* Number of moves */
  942.             single_deletion = single_deletion >> 1;
  943.             while (single_deletion--)
  944.             {
  945.                 UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  946.             }
  947.         }
  948.     }
  949. #endif /* __MMI_HINDI_ALG__ */ 
  950.     gui_show_single_line_input_box(b);          /* show single line input box */
  951.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  952.     gui_single_line_input_box_locate_cursor(b); /* locate the cursor position of single lie input box */
  953.     b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
  954.     b->change_callback();
  955. }
  956. /*****************************************************************************
  957.  * FUNCTION
  958.  *  gui_single_line_input_box_delete_current_character
  959.  * DESCRIPTION
  960.  *  Deletes a character at the current cursor position (Delete)
  961.  * PARAMETERS
  962.  *  b       [IN]        Is the single-line inputbox object
  963.  * RETURNS
  964.  *  void
  965.  *****************************************************************************/
  966. void gui_single_line_input_box_delete_current_character(single_line_input_box *b)
  967. {
  968.     /*----------------------------------------------------------------*/
  969.     /* Local Variables                                                */
  970.     /*----------------------------------------------------------------*/
  971.     UI_buffer_type current_text_p;
  972.     UI_buffer_type previous_text_p;
  973.     UI_character_type current_character = (UI_character_type) - 1;
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     current_text_p = b->current_text_p;
  978.     previous_text_p = b->current_text_p;
  979.     UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);    /* get next character */
  980.     if (!UI_STRING_END_OF_STRING_CHARACTER(current_character))  /* check for end of string */
  981.     {
  982.         if (b->flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  983.         {
  984.             UI_TEST_UCS2_DECREMENT_COUNT_SET_LENGTH(
  985.                 current_character,
  986.                 b->allocated_length,
  987.                 b->UCS2_count,
  988.                 b->available_length);
  989.         }
  990.         while (!UI_STRING_END_OF_STRING_CHARACTER(current_character))
  991.         {
  992.             UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
  993.             UI_STRING_INSERT_CHARACTER(previous_text_p, current_character);
  994.         }
  995.         b->text_length -= ((S32) current_text_p - (S32) previous_text_p);
  996.         if (b->flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP)
  997.         {
  998.             b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP;
  999.         }
  1000.         b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1001.         gui_show_single_line_input_box(b);          /* show single line input box */
  1002.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1003.         gui_single_line_input_box_locate_cursor(b); /* locate cursor postion */
  1004.         b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);  /* call validation callback func */
  1005.         b->change_callback();
  1006.     }
  1007.     else
  1008.     {
  1009.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1010.         {
  1011.             UI_editor_play_tone_cannot_change();    /* play tone */
  1012.         }
  1013.     }
  1014. }
  1015. /*****************************************************************************
  1016.  * FUNCTION
  1017.  *  gui_single_line_input_box_delete_all
  1018.  * DESCRIPTION
  1019.  *  Deletes all characters
  1020.  * PARAMETERS
  1021.  *  b       [IN]        Is the single-line inputbox object
  1022.  * RETURNS
  1023.  *  void
  1024.  *****************************************************************************/
  1025. void gui_single_line_input_box_delete_all(single_line_input_box *b)
  1026. {
  1027.     /*----------------------------------------------------------------*/
  1028.     /* Local Variables                                                */
  1029.     /*----------------------------------------------------------------*/
  1030.     UI_character_type c;
  1031.     UI_buffer_type p = b->text;
  1032.     /*----------------------------------------------------------------*/
  1033.     /* Code Body                                                      */
  1034.     /*----------------------------------------------------------------*/
  1035.     UI_STRING_GET_NEXT_CHARACTER(p, c);
  1036.     UI_UNUSED_PARAMETER(c);
  1037.     /* MTK Elvis 20040611 donot play tone while text buffer is zero */
  1038. #if 0
  1039. /* under construction !*/
  1040. /* under construction !*/
  1041. /* under construction !*/
  1042. /* under construction !*/
  1043. /* under construction !*/
  1044. /* under construction !*/
  1045. /* under construction !*/
  1046. #endif /* 0 */ 
  1047.     /* MTK end */
  1048.     gui_single_line_input_box_clear(b);         /* initialize single line input box to default */
  1049.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1050.     gui_show_single_line_input_box(b);          /* show single line input box */
  1051.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1052.     gui_single_line_input_box_locate_cursor(b); /* locate cursor position of sigle lien input box */
  1053.     b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
  1054.     b->change_callback();
  1055. }
  1056. /*****************************************************************************
  1057.  * FUNCTION
  1058.  *  gui_single_line_input_box_toggle_insert_mode
  1059.  * DESCRIPTION
  1060.  *  Toggles between Insert and Overwrite modes
  1061.  * PARAMETERS
  1062.  *  b       [IN]        Is the single-line inputbox object
  1063.  * RETURNS
  1064.  *  void
  1065.  *****************************************************************************/
  1066. void gui_single_line_input_box_toggle_insert_mode(single_line_input_box *b)
  1067. {
  1068.     /*----------------------------------------------------------------*/
  1069.     /* Local Variables                                                */
  1070.     /*----------------------------------------------------------------*/
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Code Body                                                      */
  1073.     /*----------------------------------------------------------------*/
  1074.     if (b->flags & UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE)
  1075.     {
  1076.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE;
  1077.     }
  1078.     else
  1079.     {
  1080.         b->flags |= UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE;
  1081.     }
  1082. }
  1083. /*****************************************************************************
  1084.  * FUNCTION
  1085.  *  gui_single_line_input_box_insert_character
  1086.  * DESCRIPTION
  1087.  *  Inserts a character at the current cursor position
  1088.  * PARAMETERS
  1089.  *  b       [IN]        Is the single-line inputbox object
  1090.  *  c       [IN]        Is the character to be inserted
  1091.  * RETURNS
  1092.  *  void
  1093.  *****************************************************************************/
  1094. void gui_single_line_input_box_insert_character(single_line_input_box *b, UI_character_type c)
  1095. {
  1096.     /*----------------------------------------------------------------*/
  1097.     /* Local Variables                                                */
  1098.     /*----------------------------------------------------------------*/
  1099.     UI_buffer_type p1, p2;
  1100.     UI_character_type old_c, dummy_c = 0;
  1101.     U8 flag = 0;
  1102.     U32 b_flags = b->flags;
  1103.     /*----------------------------------------------------------------*/
  1104.     /* Code Body                                                      */
  1105.     /*----------------------------------------------------------------*/
  1106.     if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) &&
  1107.         UI_TEST_UCS2_CHARACTER(c))
  1108.     {
  1109.         if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER) &&
  1110.             (b->text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
  1111.         {
  1112.             if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1113.             {
  1114.                 UI_editor_play_tone_cannot_insert();
  1115.             }
  1116.             return;
  1117.         }
  1118.         else if (b->text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
  1119.         {
  1120.             if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1121.             {
  1122.                 UI_editor_play_tone_cannot_insert();
  1123.             }
  1124.             return;
  1125.         }
  1126.     }
  1127.     p1 = p2 = b->current_text_p;
  1128.     if (b_flags & UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE)
  1129.     {
  1130.         UI_STRING_GET_NEXT_CHARACTER(p1, old_c);    /* get next caharater */
  1131.         if ((p1 == b->last_position_p) && ((b->last_position_p - b->text) >= b->available_length))
  1132.         {
  1133.             return;
  1134.         }
  1135.         if (!UI_STRING_END_OF_STRING_CHARACTER(old_c))  /* check for end of character */
  1136.         {
  1137.             UI_STRING_INSERT_CHARACTER(p2, c);  /* insert caharactr */
  1138.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1139.             {
  1140.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1141.                 {
  1142.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1143.                         old_c,
  1144.                         c,
  1145.                         b->UCS2_count,
  1146.                         b->allocated_length,
  1147.                         b->available_length);
  1148.                 }
  1149.                 else
  1150.                 {
  1151.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1152.                         old_c,
  1153.                         c,
  1154.                         b->UCS2_count,
  1155.                         b->allocated_length,
  1156.                         b->available_length);
  1157.                 }
  1158.             }
  1159.             b->current_text_p = p2;
  1160.             //MTK Elvis for R2L characters
  1161.             //It is not required to increase the length while in overwrite mode
  1162.             //b->text_length+=ENCODING_LENGTH;     //incraese length of text
  1163.             //MTK end
  1164.         }
  1165.         else
  1166.         {
  1167.             p1 = b->current_text_p;
  1168.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);   /* get next character */
  1169.             while (!UI_STRING_END_OF_STRING_CHARACTER(c))   /* check for end of character */
  1170.             {
  1171.                 UI_STRING_GET_NEXT_CHARACTER(p1, old_c);    /* get next character */
  1172.                 UI_STRING_INSERT_CHARACTER(p2, c);          /* insert character */
  1173.                 c = old_c;
  1174.             }
  1175.             UI_STRING_INSERT_CHARACTER(p2, c);
  1176.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1177.             {
  1178.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1179.                 {
  1180.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1181.                         old_c,
  1182.                         c,
  1183.                         b->UCS2_count,
  1184.                         b->allocated_length,
  1185.                         b->available_length);
  1186.                 }
  1187.                 else
  1188.                 {
  1189.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1190.                         old_c,
  1191.                         c,
  1192.                         b->UCS2_count,
  1193.                         b->allocated_length,
  1194.                         b->available_length);
  1195.                 }
  1196.             }
  1197.             b->text_length += ((S32) p2 - (S32) p1);
  1198.         }
  1199.     }
  1200.     else
  1201.     {
  1202.         if ((b->last_position_p - b->text) >= (b->available_length))
  1203.         {
  1204.             if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1205.             {
  1206.                 UI_editor_play_tone_cannot_insert();
  1207.             }
  1208.             return;
  1209.         }
  1210.         /* check if leading zero flag is set or not ,
  1211.            if leading zero flag is false and lengthis  equal to 4 and if character is not zero then a chatracter is insert */
  1212.         if ((numeric_leading_zero == FALSE) && (b->text_length == 4))
  1213.         {
  1214.             if (b->text[0] == 48 && (c != 46))
  1215.             {
  1216.                 p1 = b->text;
  1217.                 flag = 1;
  1218.                 UI_STRING_INSERT_CHARACTER(p1, c);  /* insert a charcter */
  1219.             }
  1220.         }
  1221.         if (flag == 0)
  1222.         {
  1223.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);   /* get next character */
  1224.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1225.             {
  1226.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1227.                 {
  1228.                     UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
  1229.                         c,
  1230.                         b->UCS2_count,
  1231.                         b->allocated_length,
  1232.                         b->available_length);
  1233.                 }
  1234.                 else
  1235.                 {
  1236.                     UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(c, b->UCS2_count, b->allocated_length, b->available_length);
  1237.                 }
  1238.             }
  1239.             while (!UI_STRING_END_OF_STRING_CHARACTER(c))   /* check for end of string */
  1240.             {
  1241.                 UI_STRING_GET_NEXT_CHARACTER(p1, old_c);    /* get next character */
  1242.                 UI_STRING_INSERT_CHARACTER(p2, c);
  1243.                 c = old_c;
  1244.             }
  1245.             UI_STRING_INSERT_CHARACTER(p2, c);
  1246.             b->text_length += ((S32) p2 - (S32) p1);
  1247.         }
  1248.     }
  1249.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1250.     gui_show_single_line_input_box(b);          /* show single lien input box */
  1251.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1252.     gui_single_line_input_box_locate_cursor(b); /* locate cursor psotion */
  1253.     b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
  1254.     b->change_callback();
  1255.     UI_UNUSED_PARAMETER(dummy_c);
  1256. }
  1257. /*****************************************************************************
  1258.  * FUNCTION
  1259.  *  gui_single_line_input_box_test_overflow
  1260.  * DESCRIPTION
  1261.  *  check for overflow..if the length is equal to availabel lengt or not
  1262.  * PARAMETERS
  1263.  *  b       [IN]        Is the single-line inputbox object
  1264.  * RETURNS
  1265.  *  byte return true if length is equa to available length else false
  1266.  *****************************************************************************/
  1267. U8 gui_single_line_input_box_test_overflow(single_line_input_box *b)
  1268. {
  1269.     /*----------------------------------------------------------------*/
  1270.     /* Local Variables                                                */
  1271.     /*----------------------------------------------------------------*/
  1272.     /*----------------------------------------------------------------*/
  1273.     /* Code Body                                                      */
  1274.     /*----------------------------------------------------------------*/
  1275.     /* MTK Elvis to allow user to change the current hilighted multitap character */
  1276.     if (b->flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP)
  1277.     {
  1278.         if ((b->last_position_p - b->text) == (b->available_length))
  1279.         {
  1280.             return (0);
  1281.         }
  1282.         else if ((b->last_position_p - b->text) > (b->available_length))
  1283.         {
  1284.             return (1);
  1285.         }
  1286.     }
  1287.     else
  1288.     {
  1289.         if ((b->last_position_p - b->text) >= (b->available_length))
  1290.         {
  1291.             return (1);
  1292.         }
  1293.     }
  1294.     /* MTK end */
  1295.     return (0);
  1296. }
  1297. /*****************************************************************************
  1298.  * FUNCTION
  1299.  *  gui_single_line_input_box_test_first_position
  1300.  * DESCRIPTION
  1301.  *  check for overflow..if the length is equal to availabel lengt or not
  1302.  * PARAMETERS
  1303.  *  b       [IN]        Is the single-line inputbox object
  1304.  * RETURNS
  1305.  *  byte return true if length is equa to available length else false
  1306.  *****************************************************************************/
  1307. U8 gui_single_line_input_box_test_first_position(single_line_input_box *b)
  1308. {
  1309.     /*----------------------------------------------------------------*/
  1310.     /* Local Variables                                                */
  1311.     /*----------------------------------------------------------------*/
  1312.     /*----------------------------------------------------------------*/
  1313.     /* Code Body                                                      */
  1314.     /*----------------------------------------------------------------*/
  1315.     if (b->current_text_p == b->text)
  1316.     {
  1317.         return (1);
  1318.     }
  1319.     return (0);
  1320. }
  1321. /*****************************************************************************
  1322.  * FUNCTION
  1323.  *  gui_single_line_input_box_test_last_position
  1324.  * DESCRIPTION
  1325.  *  check for overflow..if the length is equal to availabel lengt or not
  1326.  * PARAMETERS
  1327.  *  b       [IN]        Is the single-line inputbox object
  1328.  * RETURNS
  1329.  *  byte return true if length is equa to available length else false
  1330.  *****************************************************************************/
  1331. U8 gui_single_line_input_box_test_last_position(single_line_input_box *b)
  1332. {
  1333.     /*----------------------------------------------------------------*/
  1334.     /* Local Variables                                                */
  1335.     /*----------------------------------------------------------------*/
  1336.     UI_character_type dummy_c = 0;
  1337.     UI_buffer_type current_text_p = b->current_text_p;
  1338.     /*----------------------------------------------------------------*/
  1339.     /* Code Body                                                      */
  1340.     /*----------------------------------------------------------------*/
  1341.     UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
  1342.     UI_UNUSED_PARAMETER(dummy_c);
  1343.     if (current_text_p == b->last_position_p)
  1344.     {
  1345.         return (1);
  1346.     }
  1347.     return (0);
  1348. }
  1349. /*****************************************************************************
  1350.  * FUNCTION
  1351.  *  gui_single_line_input_box_test_last_character_position
  1352.  * DESCRIPTION
  1353.  *  
  1354.  * PARAMETERS
  1355.  *  b       [IN]        Is the single-line inputbox object
  1356.  * RETURNS
  1357.  *  byte
  1358.  *****************************************************************************/
  1359. U8 gui_single_line_input_box_test_last_character_position(single_line_input_box *b)
  1360. {
  1361.     /*----------------------------------------------------------------*/
  1362.     /* Local Variables                                                */
  1363.     /*----------------------------------------------------------------*/
  1364.     UI_character_type dummy_c = 0;
  1365.     UI_buffer_type current_text_p = b->current_text_p;
  1366.     /*----------------------------------------------------------------*/
  1367.     /* Code Body                                                      */
  1368.     /*----------------------------------------------------------------*/
  1369.     UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
  1370.     if (current_text_p == b->last_position_p)
  1371.     {
  1372.         return (1);
  1373.     }
  1374.     UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
  1375.     UI_UNUSED_PARAMETER(dummy_c);
  1376.     if (current_text_p == b->last_position_p)
  1377.     {
  1378.         return (1);
  1379.     }
  1380.     return (0);
  1381. }
  1382. /*****************************************************************************
  1383.  * FUNCTION
  1384.  *  gui_single_line_input_box_test_last_position_overflow
  1385.  * DESCRIPTION
  1386.  *  
  1387.  * PARAMETERS
  1388.  *  b       [IN]        Is the single-line inputbox object
  1389.  * RETURNS
  1390.  *  byte
  1391.  *****************************************************************************/
  1392. U8 gui_single_line_input_box_test_last_position_overflow(single_line_input_box *b)
  1393. {
  1394.     /*----------------------------------------------------------------*/
  1395.     /* Local Variables                                                */
  1396.     /*----------------------------------------------------------------*/
  1397.     U8 flag1 = 0;
  1398.     U8 flag2 = 0;
  1399.     UI_character_type dummy_c = 0;
  1400.     UI_buffer_type current_text_p = b->current_text_p;
  1401.     /*----------------------------------------------------------------*/
  1402.     /* Code Body                                                      */
  1403.     /*----------------------------------------------------------------*/
  1404.     UI_STRING_GET_NEXT_CHARACTER(current_text_p, dummy_c);
  1405.     UI_UNUSED_PARAMETER(dummy_c);
  1406.     if (current_text_p == b->last_position_p)
  1407.     {
  1408.         flag1 = 1;
  1409.     }
  1410.     if ((b->last_position_p - b->text) >= (b->available_length))
  1411.     {
  1412.         flag2 = 1;
  1413.     }
  1414.     if (flag1 && flag2)
  1415.     {
  1416.         return (1);
  1417.     }
  1418.     return (0);
  1419. }
  1420. /*****************************************************************************
  1421.  * FUNCTION
  1422.  *  gui_single_line_input_box_get_text_length
  1423.  * DESCRIPTION
  1424.  *  Return text length
  1425.  * PARAMETERS
  1426.  *  b       [IN]        Is the single-line inputbox object
  1427.  * RETURNS
  1428.  *  S32 :- return text length
  1429.  *****************************************************************************/
  1430. S32 gui_single_line_input_box_get_text_length(single_line_input_box *b)
  1431. {
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Local Variables                                                */
  1434.     /*----------------------------------------------------------------*/
  1435.     /*----------------------------------------------------------------*/
  1436.     /* Code Body                                                      */
  1437.     /*----------------------------------------------------------------*/
  1438.     return (((b->text_length) >> 1) - 1);
  1439. }
  1440. /*****************************************************************************
  1441.  * FUNCTION
  1442.  *  gui_single_line_input_box_insert_multitap_character
  1443.  * DESCRIPTION
  1444.  *  Inserts a multitap character at the current cursor position
  1445.  *  
  1446.  *  This function is normally used as the input_callback
  1447.  *  function with multitap input objects
  1448.  * PARAMETERS
  1449.  *  b       [IN]        Is the single-line inputbox object
  1450.  *  c       [IN]        Is the character to be inserted
  1451.  * RETURNS
  1452.  *  void
  1453.  *****************************************************************************/
  1454. void gui_single_line_input_box_insert_multitap_character(single_line_input_box *b, UI_character_type c)
  1455. {
  1456.     /*----------------------------------------------------------------*/
  1457.     /* Local Variables                                                */
  1458.     /*----------------------------------------------------------------*/
  1459.     UI_buffer_type p1, p2;
  1460.     UI_character_type old_c, dummy_c = 0;
  1461.     U32 b_flags = b->flags;
  1462. #ifdef __MMI_HINDI_ALG__
  1463.     UI_buffer_type middle_p, first_cons_p, second_cons_p;
  1464.     static U8 single_line_cursor_pos = 0;
  1465. #endif /* __MMI_HINDI_ALG__ */ 
  1466.     /*----------------------------------------------------------------*/
  1467.     /* Code Body                                                      */
  1468.     /*----------------------------------------------------------------*/
  1469.     if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) &&
  1470.         UI_TEST_UCS2_CHARACTER(c))
  1471.     {
  1472.         if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER) &&
  1473.             (b->text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
  1474.         {
  1475.             if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1476.             {
  1477.                 UI_editor_play_tone_cannot_insert();
  1478.             }
  1479.             return;
  1480.         }
  1481.         else if (b->text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
  1482.         {
  1483.             if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1484.             {
  1485.                 UI_editor_play_tone_cannot_insert();
  1486.             }
  1487.             return;
  1488.         }
  1489.     }
  1490.     if (b_flags & UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP)
  1491.     {
  1492.         UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
  1493.     #ifdef __MMI_HINDI_ALG__
  1494.         if (single_line_cursor_pos && ((c == 49) || (c == 0x901) || (c == 0x902)))      /* Only when multitap input is 1 */
  1495.         {
  1496.             UI_STRING_GET_PREVIOUS_CHARACTER(save_cursor_text_p, dummy_c);
  1497.             b->current_text_p = save_cursor_text_p;
  1498.             single_line_cursor_pos = 0;
  1499.         }
  1500.         single_line_cursor_pos = 0;
  1501.     #endif /* __MMI_HINDI_ALG__ */ 
  1502.         p1 = p2 = b->current_text_p;
  1503.     #ifdef __MMI_HINDI_ALG__
  1504.         middle_p = p1;
  1505.         first_cons_p = p1 - 2;
  1506.     #endif /* __MMI_HINDI_ALG__ */ 
  1507.         UI_STRING_GET_NEXT_CHARACTER(p1, old_c);        /* get next xharacter */
  1508.         if (!UI_STRING_END_OF_STRING_CHARACTER(old_c))  /* check for end of string */
  1509.         {
  1510.             UI_STRING_INSERT_CHARACTER(p2, c);  /* insert character */
  1511.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1512.             {
  1513.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1514.                 {
  1515.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1516.                         old_c,
  1517.                         c,
  1518.                         b->UCS2_count,
  1519.                         b->allocated_length,
  1520.                         b->available_length);
  1521.                 }
  1522.                 else
  1523.                 {
  1524.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1525.                         old_c,
  1526.                         c,
  1527.                         b->UCS2_count,
  1528.                         b->allocated_length,
  1529.                         b->available_length);
  1530.                 }
  1531.             }
  1532.             b->current_text_p = p2;
  1533.         #ifdef __MMI_HINDI_ALG__
  1534.             second_cons_p = b->current_text_p;
  1535.             if ((UI_CHK_CONSONANT(*first_cons_p)) && (UI_CHK_CONSONANT(*second_cons_p)) && (*middle_p == 0x4d)) /* tarun4 */
  1536.             {
  1537.                 U8 single_line_skip_moves = 0;
  1538.                 PU8 single_line_first_ptr = second_cons_p;
  1539.                 PU8 single_line_second_ptr;
  1540.                 save_cursor_text_p = b->current_text_p;
  1541.                 single_line_second_ptr = hf_get_next_cluster_p(single_line_first_ptr, single_line_first_ptr);
  1542.                 single_line_skip_moves = single_line_second_ptr - single_line_first_ptr;        /* Number of moves */
  1543.                 single_line_skip_moves = single_line_skip_moves >> 1;
  1544.                 while (single_line_skip_moves--)
  1545.                 {
  1546.                     UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1547.                 }
  1548.                 single_line_cursor_pos = 1;
  1549.             }
  1550.         #endif /* __MMI_HINDI_ALG__ */ 
  1551.         }
  1552.         else
  1553.         {
  1554.             p1 = b->current_text_p;
  1555.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);   /* get next character */
  1556.             while (!UI_STRING_END_OF_STRING_CHARACTER(c))
  1557.             {
  1558.                 UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
  1559.                 UI_STRING_INSERT_CHARACTER(p2, c);
  1560.                 c = old_c;
  1561.             }
  1562.             UI_STRING_INSERT_CHARACTER(p2, c);
  1563.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1564.             {
  1565.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1566.                 {
  1567.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1568.                         old_c,
  1569.                         c,
  1570.                         b->UCS2_count,
  1571.                         b->allocated_length,
  1572.                         b->available_length);
  1573.                 }
  1574.                 else
  1575.                 {
  1576.                     UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1577.                         old_c,
  1578.                         c,
  1579.                         b->UCS2_count,
  1580.                         b->allocated_length,
  1581.                         b->available_length);
  1582.                 }
  1583.             }
  1584.             b->text_length += ((S32) p2 - (S32) p1);
  1585.         }
  1586.     }
  1587.     else
  1588.     {
  1589.     #ifdef __MMI_HINDI_ALG__
  1590.         single_line_cursor_pos = 0;
  1591.     #endif 
  1592.         p1 = p2 = b->current_text_p;
  1593.         if (b_flags & UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE)
  1594.         {
  1595.             UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
  1596.             if ((p1 == b->last_position_p) && ((b->last_position_p - b->text) >= b->available_length))
  1597.             {
  1598.                 if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1599.                 {
  1600.                     UI_editor_play_tone_cannot_insert();
  1601.                 }
  1602.                 return;
  1603.             }
  1604.             if (!UI_STRING_END_OF_STRING_CHARACTER(old_c))
  1605.             {
  1606.                 UI_STRING_INSERT_CHARACTER(p2, c);
  1607.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1608.                 {
  1609.                     if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1610.                     {
  1611.                         UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1612.                             old_c,
  1613.                             c,
  1614.                             b->UCS2_count,
  1615.                             b->allocated_length,
  1616.                             b->available_length);
  1617.                     }
  1618.                     else
  1619.                     {
  1620.                         UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1621.                             old_c,
  1622.                             c,
  1623.                             b->UCS2_count,
  1624.                             b->allocated_length,
  1625.                             b->available_length);
  1626.                     }
  1627.                 }
  1628.                 b->current_text_p = p2;
  1629.             }
  1630.             else
  1631.             {
  1632.                 p1 = b->current_text_p;
  1633.                 UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1634.                 while (!UI_STRING_END_OF_STRING_CHARACTER(c))
  1635.                 {
  1636.                     UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
  1637.                     UI_STRING_INSERT_CHARACTER(p2, c);
  1638.                     c = old_c;
  1639.                 }
  1640.                 UI_STRING_INSERT_CHARACTER(p2, c);
  1641.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1642.                 {
  1643.                     if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1644.                     {
  1645.                         UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH_TYPE2(
  1646.                             old_c,
  1647.                             c,
  1648.                             b->UCS2_count,
  1649.                             b->allocated_length,
  1650.                             b->available_length);
  1651.                     }
  1652.                     else
  1653.                     {
  1654.                         UI_TEST_UCS2_CHANGE_COUNT_SET_LENGTH(
  1655.                             old_c,
  1656.                             c,
  1657.                             b->UCS2_count,
  1658.                             b->allocated_length,
  1659.                             b->available_length);
  1660.                     }
  1661.                 }
  1662.                 b->text_length += ((S32) p2 - (S32) p1);
  1663.             }
  1664.         }
  1665.         else
  1666.         {
  1667.             int flag = 0;
  1668.             if ((b->last_position_p - b->text) >= (b->available_length))
  1669.             {
  1670.                 if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1671.                 {
  1672.                     UI_editor_play_tone_cannot_insert();
  1673.                 }
  1674.                 return;
  1675.             }
  1676.             /* W05.33 if leading zero flag is false and lengthis  equal to 4 and if character is not zero then a chatracter is insert */
  1677.             if ((numeric_leading_zero == FALSE) && (b->text_length == 4))
  1678.             {
  1679.                 if (b->text[0] == 48 && (c != 46))
  1680.                 {
  1681.                     p1 = b->text;
  1682.                     flag = 1;
  1683.                     UI_STRING_INSERT_CHARACTER(p1, c);  /* insert a charcter */
  1684.                 }
  1685.             }
  1686.             if (0 == flag)
  1687.             {
  1688.                 UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1689.                 if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  1690.                 {
  1691.                     if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  1692.                     {
  1693.                         UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
  1694.                             c,
  1695.                             b->UCS2_count,
  1696.                             b->allocated_length,
  1697.                             b->available_length);
  1698.                     }
  1699.                     else
  1700.                     {
  1701.                         UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(
  1702.                             c,
  1703.                             b->UCS2_count,
  1704.                             b->allocated_length,
  1705.                             b->available_length);
  1706.                     }
  1707.                 }
  1708.                 while (!UI_STRING_END_OF_STRING_CHARACTER(c))
  1709.                 {
  1710.                     UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
  1711.                     UI_STRING_INSERT_CHARACTER(p2, c);
  1712.                     c = old_c;
  1713.                 }
  1714.                 UI_STRING_INSERT_CHARACTER(p2, c);
  1715.                 b->text_length += ((S32) p2 - (S32) p1);
  1716.             }
  1717.         }
  1718.         b->flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP;
  1719.     }
  1720.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1721.     gui_show_single_line_input_box(b);
  1722.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1723.     gui_single_line_input_box_locate_cursor(b);
  1724.     b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
  1725.     b->change_callback();
  1726.     UI_UNUSED_PARAMETER(dummy_c);
  1727. }
  1728. /*****************************************************************************
  1729.  * FUNCTION
  1730.  *  gui_single_line_input_box_confirm_multitap_character
  1731.  * DESCRIPTION
  1732.  *  Completes the multitap input sequence.
  1733.  *  
  1734.  *  This function is normally used as the input_complete_callback
  1735.  *  function with multitap input objects
  1736.  * PARAMETERS
  1737.  *  b       [IN]        Is the single-line inputbox object
  1738.  * RETURNS
  1739.  *  void
  1740.  *****************************************************************************/
  1741. void gui_single_line_input_box_confirm_multitap_character(single_line_input_box *b)
  1742. {
  1743.     /*----------------------------------------------------------------*/
  1744.     /* Local Variables                                                */
  1745.     /*----------------------------------------------------------------*/
  1746.     /*----------------------------------------------------------------*/
  1747.     /* Code Body                                                      */
  1748.     /*----------------------------------------------------------------*/
  1749.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_MULTITAP;
  1750. }
  1751. /* PMT dara added for multitap thai */
  1752. #ifdef __MMI_MULTITAP_THAI__
  1753. /*****************************************************************************
  1754.  * FUNCTION
  1755.  *  gui_single_line_input_box_get_previous_character
  1756.  * DESCRIPTION
  1757.  *  get  the previous character
  1758.  * PARAMETERS
  1759.  *  b               [IN]        Is the single-line inputbox object
  1760.  *  c               [?]         
  1761.  *  means(?)        [OUT]       None, 1 means have one, save in c
  1762.  * RETURNS
  1763.  *  void
  1764.  *****************************************************************************/
  1765. U8 gui_single_line_input_box_get_previous_character(single_line_input_box *b, UI_character_type *c)
  1766. {
  1767.     /*----------------------------------------------------------------*/
  1768.     /* Local Variables                                                */
  1769.     /*----------------------------------------------------------------*/
  1770.     /*----------------------------------------------------------------*/
  1771.     /* Code Body                                                      */
  1772.     /*----------------------------------------------------------------*/
  1773.     if (b->text == NULL)
  1774.     {
  1775.         return 0;
  1776.     }
  1777.     if (b->current_text_p == b->text)
  1778.     {
  1779.         return 0;
  1780.     }
  1781.     *c = (*(b->current_text_p - 2)) | (*(b->current_text_p - 1)) << 8;
  1782.     return 1;
  1783. }
  1784. #endif /* __MMI_MULTITAP_THAI__ */ 
  1785. /* msz065_20050420 Peng Hua add for multitap thai input method end */
  1786. /*****************************************************************************
  1787.  * FUNCTION
  1788.  *  gui_single_line_input_box_previous
  1789.  * DESCRIPTION
  1790.  *  Moves the cursor to the previous character
  1791.  * PARAMETERS
  1792.  *  b       [IN]        Is the single-line inputbox object
  1793.  * RETURNS
  1794.  *  void
  1795.  *****************************************************************************/
  1796. void gui_single_line_input_box_previous(single_line_input_box *b)
  1797. {
  1798.     /*----------------------------------------------------------------*/
  1799.     /* Local Variables                                                */
  1800.     /*----------------------------------------------------------------*/
  1801.     UI_character_type dummy_c = 0;
  1802. #if defined(__MMI_LANG_VIETNAMESE__)
  1803.     UI_character_type previous_unicode = 0;
  1804.     viet_tone_mark tone_mark = VIET_TONE_NONE;
  1805.     viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
  1806. #endif /* defined(__MMI_LANG_VIETNAMESE__) */ 
  1807.     /* MTK Steven 20050505 */
  1808. #if defined(__MMI_LANG_THAI__)
  1809.     UI_character_type pre_one_char = 0;
  1810.     UI_character_type pre_two_char = 0;
  1811.     UI_character_type pre_three_char = 0;
  1812. #endif /* defined(__MMI_LANG_THAI__) */ 
  1813.     /* MTK End */
  1814. #ifdef __MMI_HINDI_ALG__
  1815.     UI_buffer_type single_line_check_text_p = b->current_text_p;
  1816. #endif 
  1817.     /*----------------------------------------------------------------*/
  1818.     /* Code Body                                                      */
  1819.     /*----------------------------------------------------------------*/
  1820.     if (b->text == NULL)
  1821.     {
  1822.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1823.         {
  1824.             UI_editor_play_tone_cannot_navigate();
  1825.         }
  1826.         return;
  1827.     }
  1828.     if (b->current_text_p == b->text)
  1829.     {
  1830.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1831.         {
  1832.             UI_editor_play_tone_cannot_navigate();
  1833.         }
  1834.         return;
  1835.     }
  1836. #ifdef __MMI_HINDI_ALG__
  1837.     UI_STRING_GET_PREVIOUS_CHARACTER(single_line_check_text_p, dummy_c);        /* get previous character */
  1838.     /* If Hindi Character */
  1839.     if (UI_HINDI_CHARACTER_UCS2_RANGE(dummy_c))
  1840.     {
  1841.         /* Move by a syllable rather than by a character as in English */
  1842.         b->current_text_p = (U8*) hf_get_prev_cluster_p(b->text, b->current_text_p);
  1843.     }
  1844.     else
  1845. #endif /* __MMI_HINDI_ALG__ */ 
  1846.     {
  1847.         UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);   /* get previous character */
  1848.     }
  1849. #if defined(__MMI_LANG_VIETNAMESE__)
  1850.     if ((dummy_c >= 0x0300) && (dummy_c <= 0x0323))
  1851.     {
  1852.         UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, previous_unicode);  /* get next character */
  1853.         viet_vowel = mmi_viet_vowel_letter(previous_unicode);
  1854.         if (VIET_VOWEL_NONE != viet_vowel)
  1855.         {
  1856.             tone_mark = mmi_viet_tone_mark(dummy_c);
  1857.             if (VIET_TONE_NONE != tone_mark)
  1858.             {
  1859.                 dummy_c = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
  1860.             }
  1861.             else
  1862.             {
  1863.                 UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, previous_unicode);
  1864.             }
  1865.         }
  1866.         else
  1867.         {
  1868.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, previous_unicode);
  1869.         }
  1870.     }
  1871. #endif /* defined(__MMI_LANG_VIETNAMESE__) */ 
  1872.     /* MTK Steven 20050505  */
  1873. #if defined(__MMI_LANG_THAI__)
  1874.     if (isThaiChar(dummy_c))
  1875.     {
  1876.         UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, pre_one_char);
  1877.         if (isThaiChar(pre_one_char))
  1878.         {
  1879.             if (!RequireToMoveCursor(pre_one_char, dummy_c))
  1880.             {
  1881.                 if (b->current_text_p != b->text)
  1882.                 {
  1883.                     UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, pre_two_char);
  1884.                     if (isThaiChar(pre_two_char))
  1885.                     {
  1886.                         if (!RequireToMoveCursor(pre_two_char, pre_one_char))
  1887.                         {
  1888.                             if (b->current_text_p != b->text)
  1889.                             {
  1890.                                 UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, pre_three_char);
  1891.                                 if (isThaiChar(pre_three_char))
  1892.                                 {
  1893.                                     if (RequireToMoveCursor(pre_three_char, pre_two_char))
  1894.                                     {
  1895.                                         UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1896.                                     }
  1897.                                 }
  1898.                                 else
  1899.                                 {
  1900.                                     UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1901.                                 }
  1902.                             }
  1903.                         }
  1904.                         else
  1905.                         {
  1906.                             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1907.                         }
  1908.                     }
  1909.                     else
  1910.                     {
  1911.                         UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1912.                     }
  1913.                 }
  1914.             }
  1915.             else
  1916.             {
  1917.                 UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1918.             }
  1919.         }
  1920.         else
  1921.         {
  1922.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  1923.         }
  1924.     }
  1925. #endif /* defined(__MMI_LANG_THAI__) */ 
  1926.     /* MTK End */
  1927.        /* Begin BIRD arabic 0908 */
  1928. #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
  1929.        if (IS_ARABIC_CHARACTER(dummy_c))
  1930.        {
  1931.            U16 idx;
  1932.            idx = (b->current_text_p - b->text + 2 )/2-1;
  1933.    
  1934.            while(idx > 0)
  1935.            {
  1936.                if(OrgToSha[idx] == OrgToSha[idx-1])
  1937.                {
  1938.                    UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
  1939.                }
  1940.                else
  1941.                {
  1942.                    break;
  1943.                }
  1944.                idx--;
  1945.            }
  1946.        } 
  1947. #endif
  1948.        /* End BIRD arabic 0908 */
  1949.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1950.     gui_show_single_line_input_box(b);          /* show single line input box */
  1951.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1952.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  1953.     UI_UNUSED_PARAMETER(dummy_c);
  1954. }
  1955. /*****************************************************************************
  1956.  * FUNCTION
  1957.  *  gui_single_line_input_box_previous_steps
  1958.  * DESCRIPTION
  1959.  *  Moves the cursor to the  character
  1960.  * PARAMETERS
  1961.  *  b           [IN]        Is the single-line inputbox object
  1962.  *  steps       [IN]        
  1963.  * RETURNS
  1964.  *  S32
  1965.  *****************************************************************************/
  1966. S32 gui_single_line_input_box_previous_steps(single_line_input_box *b, S32 steps)
  1967. {
  1968.     /*----------------------------------------------------------------*/
  1969.     /* Local Variables                                                */
  1970.     /*----------------------------------------------------------------*/
  1971.     UI_character_type dummy_c;
  1972.     S32 count = 0;
  1973.     U8 done = 0;
  1974.     /*----------------------------------------------------------------*/
  1975.     /* Code Body                                                      */
  1976.     /*----------------------------------------------------------------*/
  1977.     if (b->text == NULL)
  1978.     {
  1979.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1980.         {
  1981.             UI_editor_play_tone_cannot_navigate();
  1982.         }
  1983.         return (count);
  1984.     }
  1985.     if (b->current_text_p == b->text)
  1986.     {
  1987.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  1988.         {
  1989.             UI_editor_play_tone_cannot_navigate();
  1990.         }
  1991.         return (count);
  1992.     }
  1993.     while (!done)
  1994.     {
  1995.         if (b->current_text_p == b->text)
  1996.         {
  1997.             break;
  1998.         }
  1999.         UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
  2000.         count++;
  2001.         if (count >= steps)
  2002.         {
  2003.             break;
  2004.         }
  2005.     }
  2006.     if (count != steps)
  2007.     {
  2008.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  2009.         {
  2010.             UI_editor_play_tone_cannot_navigate();
  2011.         }
  2012.     }
  2013.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2014.     gui_show_single_line_input_box(b);
  2015.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2016.     gui_single_line_input_box_locate_cursor(b);
  2017.     UI_UNUSED_PARAMETER(dummy_c);
  2018.     return (count);
  2019. }
  2020. /*****************************************************************************
  2021.  * FUNCTION
  2022.  *  gui_single_line_input_box_next
  2023.  * DESCRIPTION
  2024.  *  Moves the cursor to the next character
  2025.  * PARAMETERS
  2026.  *  b       [IN]        Is the single-line inputbox object
  2027.  * RETURNS
  2028.  *  void
  2029.  *****************************************************************************/
  2030. void gui_single_line_input_box_next(single_line_input_box *b)
  2031. {
  2032.     /*----------------------------------------------------------------*/
  2033.     /* Local Variables                                                */
  2034.     /*----------------------------------------------------------------*/
  2035.     UI_buffer_type current_text_p = b->current_text_p;
  2036.     UI_character_type current_character;
  2037. #if defined(__MMI_LANG_VIETNAMESE__)
  2038.     UI_character_type next_unicode = 0;
  2039.     viet_tone_mark tone_mark = VIET_TONE_NONE;
  2040.     viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
  2041. #endif /* defined(__MMI_LANG_VIETNAMESE__) */ 
  2042.     /* MTK Steven 20050505 */
  2043. #if defined(__MMI_LANG_THAI__)
  2044.     UI_character_type next_one_char = 0;
  2045.     UI_character_type next_two_char = 0;
  2046.     UI_character_type next_three_char = 0;
  2047. #endif /* defined(__MMI_LANG_THAI__) */ 
  2048.     /* MTK End */
  2049. #ifdef __MMI_HINDI_ALG__
  2050.     UI_buffer_type check_single_line_text_p = b->current_text_p;
  2051. #endif 
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Code Body                                                      */
  2054.     /*----------------------------------------------------------------*/
  2055.     /* text buffer is empty and want to navigate next --> play error tone if not disable tones */
  2056.     if (b->text == NULL)
  2057.     {
  2058.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  2059.         {
  2060.             UI_editor_play_tone_cannot_navigate();
  2061.         }
  2062.         return;
  2063.     }
  2064. #ifdef __MMI_HINDI_ALG__
  2065.     UI_STRING_GET_NEXT_CHARACTER(check_single_line_text_p, current_character);  /* get previous character */
  2066.     /* If Hindi Character */
  2067.     if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
  2068.     {
  2069.         /* Move by a syllable rather than by a character as in English */
  2070.         current_text_p = hf_get_next_cluster_p(b->current_text_p, b->current_text_p);
  2071.     }
  2072.     else
  2073. #endif /* __MMI_HINDI_ALG__ */ 
  2074.     {
  2075.         UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);        /* get next character */
  2076.     }
  2077. #if defined(__MMI_LANG_VIETNAMESE__)
  2078.     if ((current_character > 0x0040) && (current_character < 0x01B1))
  2079.     {
  2080.         UI_STRING_GET_NEXT_CHARACTER(current_text_p, next_unicode);     /* get next character */
  2081.         tone_mark = mmi_viet_tone_mark(next_unicode);
  2082.         if (VIET_TONE_NONE != tone_mark)
  2083.         {
  2084.             viet_vowel = mmi_viet_vowel_letter(current_character);
  2085.             if (VIET_VOWEL_NONE != viet_vowel)
  2086.             {
  2087.                 current_character = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
  2088.             }
  2089.             else
  2090.             {
  2091.                 UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, next_unicode);
  2092.             }
  2093.         }
  2094.         else
  2095.         {
  2096.             UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, next_unicode);
  2097.         }
  2098.     }
  2099. #endif /* defined(__MMI_LANG_VIETNAMESE__) */ 
  2100.     /* MTK Steven 20050505 */
  2101. #if defined(__MMI_LANG_THAI__)
  2102.     if (isThaiChar(current_character) && *current_text_p != '')
  2103.     {
  2104.         UI_STRING_GET_NEXT_CHARACTER(current_text_p, next_one_char);
  2105.         if (isThaiChar(next_one_char))
  2106.         {
  2107.             if (!RequireToMoveCursor(current_character, next_one_char))
  2108.             {
  2109.                 if (*current_text_p == '')
  2110.                 {
  2111.                     current_character = next_one_char;
  2112.                 }
  2113.                 else
  2114.                 {
  2115.                     UI_STRING_GET_NEXT_CHARACTER(current_text_p, next_two_char);
  2116.                     if (isThaiChar(next_two_char))
  2117.                     {
  2118.                         if (!RequireToMoveCursor(next_one_char, next_two_char))
  2119.                         {
  2120.                             if (*current_text_p == '')
  2121.                             {
  2122.                                 current_character = next_two_char;
  2123.                             }
  2124.                             else
  2125.                             {
  2126.                                 UI_STRING_GET_NEXT_CHARACTER(current_text_p, next_three_char);
  2127.                                 if (isThaiChar(next_three_char))
  2128.                                 {
  2129.                                     if (!RequireToMoveCursor(next_two_char, next_three_char))
  2130.                                     {
  2131.                                         current_character = next_three_char;
  2132.                                     }
  2133.                                     else
  2134.                                     {
  2135.                                         UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2136.                                     }
  2137.                                 }
  2138.                                 else
  2139.                                 {
  2140.                                     UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2141.                                 }
  2142.                             }
  2143.                         }
  2144.                         else
  2145.                         {
  2146.                             UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2147.                         }
  2148.                     }
  2149.                     else
  2150.                     {
  2151.                         UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2152.                     }
  2153.                 }
  2154.             }
  2155.             else
  2156.             {
  2157.                 UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2158.             }
  2159.         }
  2160.         else
  2161.         {
  2162.             UI_STRING_GET_PREVIOUS_CHARACTER(current_text_p, current_character);
  2163.         }
  2164.     }
  2165. #endif /* defined(__MMI_LANG_THAI__) */ 
  2166.     /* MTK End */
  2167. #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
  2168.   
  2169.      if (IS_ARABIC_CHARACTER(current_character))
  2170.      {
  2171.          U16 idx;
  2172.          idx = (current_text_p - b->text)/2-1;
  2173.        
  2174.          while(idx < unshaped_text_len)
  2175.          {
  2176.              if(OrgToSha[idx] == OrgToSha[idx+1])
  2177.              {
  2178.                  UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
  2179.              }
  2180.              else
  2181.              {
  2182.                  break;
  2183.              }
  2184.              idx++;
  2185.          }
  2186.      } 
  2187. #endif
  2188.     /* if current character is end of string and want to navigate next --> play error tone if not disable tones */
  2189.     if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
  2190.     {
  2191.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  2192.         {
  2193.             UI_editor_play_tone_cannot_navigate();
  2194.         }
  2195.         return;
  2196.     }
  2197.     b->current_text_p = current_text_p;
  2198.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2199.     gui_show_single_line_input_box(b);
  2200.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2201.     gui_single_line_input_box_locate_cursor(b);
  2202. }
  2203. /*****************************************************************************
  2204.  * FUNCTION
  2205.  *  gui_single_line_input_box_next_steps
  2206.  * DESCRIPTION
  2207.  *  Moves the cursor to the next character
  2208.  * PARAMETERS
  2209.  *  b           [IN]        Is the single-line inputbox object
  2210.  *  steps       [IN]        
  2211.  * RETURNS
  2212.  *  S32
  2213.  *****************************************************************************/
  2214. S32 gui_single_line_input_box_next_steps(single_line_input_box *b, S32 steps)
  2215. {
  2216.     /*----------------------------------------------------------------*/
  2217.     /* Local Variables                                                */
  2218.     /*----------------------------------------------------------------*/
  2219.     UI_buffer_type current_text_p = b->current_text_p;
  2220.     UI_character_type current_character;
  2221.     S32 count = 0;
  2222.     U8 done = 0;
  2223.     /*----------------------------------------------------------------*/
  2224.     /* Code Body                                                      */
  2225.     /*----------------------------------------------------------------*/
  2226.     if (0 == steps)
  2227.     {
  2228.         return 0;
  2229.     }
  2230.     if (b->text == NULL)
  2231.     {
  2232.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  2233.         {
  2234.             UI_editor_play_tone_cannot_navigate();
  2235.         }
  2236.         return (count);
  2237.     }
  2238.     while (!done)
  2239.     {
  2240.         UI_STRING_GET_NEXT_CHARACTER(current_text_p, current_character);
  2241.         if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
  2242.         {
  2243.             break;
  2244.         }
  2245.         count++;
  2246.         if (count >= steps)
  2247.         {
  2248.             break;
  2249.         }
  2250.     }
  2251.     if (count != steps)
  2252.     {
  2253.         if (!(b->flags & UI_SINGLE_LINE_INPUT_BOX_DISABLE_TONES))
  2254.         {
  2255.             UI_editor_play_tone_cannot_navigate();
  2256.         }
  2257.     }
  2258.     b->current_text_p = current_text_p;
  2259.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2260.     gui_show_single_line_input_box(b);
  2261.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2262.     gui_single_line_input_box_locate_cursor(b);
  2263.     return (count);
  2264. }
  2265. /*****************************************************************************
  2266.  * FUNCTION
  2267.  *  gui_resize_single_line_input_box
  2268.  * DESCRIPTION
  2269.  *  Changes the size of the single-line inputbox.
  2270.  * PARAMETERS
  2271.  *  b           [IN]        Is the single-line inputbox object
  2272.  *  width       [IN]        Is the new width
  2273.  *  height      [IN]        Is the new height
  2274.  * RETURNS
  2275.  *  void
  2276.  *****************************************************************************/
  2277. void gui_resize_single_line_input_box(single_line_input_box *b, S32 width, S32 height)
  2278. {
  2279.     /*----------------------------------------------------------------*/
  2280.     /* Local Variables                                                */
  2281.     /*----------------------------------------------------------------*/
  2282.     /*----------------------------------------------------------------*/
  2283.     /* Code Body                                                      */
  2284.     /*----------------------------------------------------------------*/
  2285.     b->width = width;
  2286.     b->height = height;
  2287.     /* Autocalculate the text position based on font   */
  2288.     if (b->flags & UI_SINGLE_LINE_INPUT_BOX_CENTER_Y)
  2289.     {
  2290.         S32 string_height;
  2291.         gui_set_font(b->text_font);
  2292.         string_height = gui_get_character_height();
  2293.         b->text_y = (height >> 1) - (string_height >> 1);
  2294.     }
  2295.     else
  2296.     {
  2297.         b->text_y = 2;
  2298.     }
  2299.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2300.     gui_show_single_line_input_box(b);          /* show single inout box */
  2301.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2302.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2303. }
  2304. /*****************************************************************************
  2305.  * FUNCTION
  2306.  *  gui_single_line_input_box_goto_first_character
  2307.  * DESCRIPTION
  2308.  *  Move the cursor to first chahrcter
  2309.  * PARAMETERS
  2310.  *  b       [IN]        Is the single-line inputbox object
  2311.  * RETURNS
  2312.  *  void
  2313.  *****************************************************************************/
  2314. void gui_single_line_input_box_goto_first_character(single_line_input_box *b)
  2315. {
  2316.     /*----------------------------------------------------------------*/
  2317.     /* Local Variables                                                */
  2318.     /*----------------------------------------------------------------*/
  2319.     /*----------------------------------------------------------------*/
  2320.     /* Code Body                                                      */
  2321.     /*----------------------------------------------------------------*/
  2322.     b->current_text_p = b->text;
  2323.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2324.     gui_show_single_line_input_box(b);          /* show single line input box */
  2325.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2326.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2327. }
  2328. /*****************************************************************************
  2329.  * FUNCTION
  2330.  *  gui_single_line_input_box_goto_last_character
  2331.  * DESCRIPTION
  2332.  *  Move the cursor to last  chahrcter
  2333.  * PARAMETERS
  2334.  *  b       [IN]        Is the single-line inputbox object
  2335.  * RETURNS
  2336.  *  void
  2337.  *****************************************************************************/
  2338. void gui_single_line_input_box_goto_last_character(single_line_input_box *b)
  2339. {
  2340.     /*----------------------------------------------------------------*/
  2341.     /* Local Variables                                                */
  2342.     /*----------------------------------------------------------------*/
  2343.     UI_character_type dummy_c = 0;
  2344.     U8 done = 0;
  2345.     /*----------------------------------------------------------------*/
  2346.     /* Code Body                                                      */
  2347.     /*----------------------------------------------------------------*/
  2348.     b->current_text_p = b->text;
  2349.     if (b->text != NULL)
  2350.     {
  2351.         while (!done)
  2352.         {
  2353.             UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  2354.             if (UI_STRING_END_OF_STRING_CHARACTER(dummy_c))
  2355.             {
  2356.                 break;
  2357.             }
  2358.         }
  2359.         if (b->current_text_p != b->text)
  2360.         {
  2361.             UI_STRING_GET_PREVIOUS_CHARACTER(b->current_text_p, dummy_c);
  2362.         }
  2363.     }
  2364.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2365.     gui_show_single_line_input_box(b);          /* show single line inut box */
  2366.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2367.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2368. }
  2369. /*****************************************************************************
  2370.  * FUNCTION
  2371.  *  gui_single_line_input_box_highlight_cursor_end
  2372.  * DESCRIPTION
  2373.  *  Move the cursor to last  chahrcter
  2374.  * PARAMETERS
  2375.  *  b       [IN]        Is the single-line inputbox object
  2376.  * RETURNS
  2377.  *  S32 count return the number of charcters traverse
  2378.  *****************************************************************************/
  2379. S32 gui_single_line_input_box_highlight_cursor_end(single_line_input_box *b)
  2380. {
  2381.     /*----------------------------------------------------------------*/
  2382.     /* Local Variables                                                */
  2383.     /*----------------------------------------------------------------*/
  2384.     UI_buffer_type saved_current_position = b->current_text_p;
  2385.     UI_buffer_type current_position = b->current_text_p;
  2386.     UI_buffer_type previous_position;
  2387.     UI_buffer_type last_position_p = b->last_position_p;
  2388.     U8 done = 0;
  2389.     UI_character_type current_character;
  2390.     S32 count = 0;
  2391.     /*----------------------------------------------------------------*/
  2392.     /* Code Body                                                      */
  2393.     /*----------------------------------------------------------------*/
  2394.     UI_STRING_GET_PREVIOUS_CHARACTER(last_position_p, current_character);
  2395.     /* Move cursor backwards until a break character is encountered   */
  2396.     while (!done)
  2397.     {
  2398.         previous_position = current_position;
  2399.         if (current_position == b->text)
  2400.         {
  2401.             break;
  2402.         }
  2403.         UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);
  2404.         count++;
  2405.         if (UI_STRING_SPACE_CHARACTER(current_character))
  2406.         {
  2407.             break;  /* check for space */
  2408.         }
  2409.     }
  2410.     b->highlight_start_position = previous_position;
  2411.     current_position = saved_current_position;
  2412.     /* Move cursor forwards until a break character is encountered */
  2413.     if (current_position >= last_position_p)
  2414.     {
  2415.         done = 1;
  2416.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2417.     }
  2418.     else
  2419.     {
  2420.         UI_STRING_GET_NEXT_CHARACTER(current_position, current_character);      /* get next character */
  2421.         UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);  /* get previous charcter */
  2422.         if (UI_STRING_SPACE_CHARACTER(current_character))   /* check for space */
  2423.         {
  2424.             done = 1;
  2425.             b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2426.         }
  2427.         else
  2428.         {
  2429.             done = 0;
  2430.             b->flags |= UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2431.         }
  2432.     }
  2433.     while (!done)
  2434.     {
  2435.         if (current_position >= last_position_p)
  2436.         {
  2437.             break;
  2438.         }
  2439.         UI_STRING_GET_NEXT_CHARACTER(current_position, current_character);
  2440.         count++;
  2441.         if (UI_STRING_SPACE_CHARACTER(current_character))
  2442.         {
  2443.             UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);
  2444.             break;
  2445.         }
  2446.     }
  2447.     b->highlight_end_position = current_position;
  2448.     b->current_text_p = current_position;
  2449.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2450.     gui_show_single_line_input_box(b);          /* show single line input box */
  2451.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2452.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2453.     return (count);
  2454. }
  2455. /*****************************************************************************
  2456.  * FUNCTION
  2457.  *  gui_single_line_input_box_highlight_cursor_number
  2458.  * DESCRIPTION
  2459.  *  Move the cursor to last  chahrcter
  2460.  * PARAMETERS
  2461.  *  b               [IN]        Is the single-line inputbox object
  2462.  *  numOfChar       [IN]        
  2463.  * RETURNS
  2464.  *  S32 count return the number of charcters traverse
  2465.  *****************************************************************************/
  2466. S32 gui_single_line_input_box_highlight_cursor_number(single_line_input_box *b, S32 numOfChar)
  2467. {
  2468.     /*----------------------------------------------------------------*/
  2469.     /* Local Variables                                                */
  2470.     /*----------------------------------------------------------------*/
  2471.     UI_buffer_type saved_current_position = b->current_text_p;
  2472.     UI_buffer_type current_position = b->current_text_p;
  2473.     /* UI_buffer_type previous_position; */
  2474.     UI_character_type current_character;
  2475.     S32 count = 0, i;
  2476.     /*----------------------------------------------------------------*/
  2477.     /* Code Body                                                      */
  2478.     /*----------------------------------------------------------------*/
  2479.     for (i = 0; i < numOfChar; i++)
  2480.     {
  2481.         /* previous_position=current_position; */
  2482.         if (current_position == b->text)
  2483.         {
  2484.             break;
  2485.         }
  2486.         UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);  /* get previous charcter */
  2487.         count++;
  2488.     }
  2489.     b->highlight_start_position = current_position;
  2490.     current_position = saved_current_position;
  2491.     b->highlight_end_position = current_position;
  2492.     b->current_text_p = current_position;
  2493.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2494.     gui_show_single_line_input_box(b);          /* show single lien input box */
  2495.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2496.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2497.     UI_UNUSED_PARAMETER(current_character);
  2498.     return (count);
  2499. }
  2500. /* for second word highlight */
  2501. /*****************************************************************************
  2502.  * FUNCTION
  2503.  *  gui_single_line_input_box_highlight_cursor_number_backward
  2504.  * DESCRIPTION
  2505.  *  
  2506.  * PARAMETERS
  2507.  *  b               [?]         
  2508.  *  numOfChar       [IN]        
  2509.  * RETURNS
  2510.  *  
  2511.  *****************************************************************************/
  2512. S32 gui_single_line_input_box_highlight_cursor_number_backward(single_line_input_box *b, S32 numOfChar)
  2513. {
  2514.     /*----------------------------------------------------------------*/
  2515.     /* Local Variables                                                */
  2516.     /*----------------------------------------------------------------*/
  2517.     UI_buffer_type saved_current_position = b->current_text_p;
  2518.     UI_buffer_type current_position = b->current_text_p;
  2519.     /* UI_buffer_type previous_position; */
  2520.     UI_character_type current_character = 0xff;
  2521.     S32 count = 0, i;
  2522.     /*----------------------------------------------------------------*/
  2523.     /* Code Body                                                      */
  2524.     /*----------------------------------------------------------------*/
  2525.     for (i = 0; i < numOfChar; i++)
  2526.     {
  2527.         /* previous_position=current_position; */
  2528.         if (UI_STRING_END_OF_STRING_CHARACTER(current_character))
  2529.         {
  2530.             break;
  2531.         }
  2532.         UI_STRING_GET_NEXT_CHARACTER(current_position, current_character);      /* get previous charcter */
  2533.         count++;
  2534.     }
  2535.     b->second_highlight_end_position = current_position;
  2536.     current_position = saved_current_position;
  2537.     b->second_highlight_start_position = current_position;
  2538.     b->current_text_p = current_position;
  2539.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2540.     gui_show_single_line_input_box(b);          /* show single lien input box */
  2541.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2542.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2543.     return (count);
  2544. }
  2545. /*****************************************************************************
  2546.  * FUNCTION
  2547.  *  gui_single_line_input_box_highlight_cursor_start
  2548.  * DESCRIPTION
  2549.  *  Move the cursor to last  chahrcter
  2550.  * PARAMETERS
  2551.  *  b       [IN]        Is the single-line inputbox object
  2552.  * RETURNS
  2553.  *  S32 count return the number of charcters traverse
  2554.  *****************************************************************************/
  2555. S32 gui_single_line_input_box_highlight_cursor_start(single_line_input_box *b)
  2556. {
  2557.     /*----------------------------------------------------------------*/
  2558.     /* Local Variables                                                */
  2559.     /*----------------------------------------------------------------*/
  2560.     UI_buffer_type saved_current_position = b->current_text_p;
  2561.     UI_buffer_type current_position = b->current_text_p;
  2562.     UI_buffer_type previous_position;
  2563.     UI_buffer_type last_position_p = b->last_position_p;
  2564.     U8 done = 0;
  2565.     UI_character_type current_character;
  2566.     S32 count = 0;
  2567.     /*----------------------------------------------------------------*/
  2568.     /* Code Body                                                      */
  2569.     /*----------------------------------------------------------------*/
  2570.     if (current_position == b->text)
  2571.     {
  2572.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2573.         return (0);
  2574.     }
  2575.     UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);      /* get previous charcter */
  2576.     /* Move cursor forwards until a break character is encountered */
  2577.     while (!done)
  2578.     {
  2579.         if (current_position >= last_position_p)
  2580.         {
  2581.             break;
  2582.         }
  2583.         UI_STRING_GET_NEXT_CHARACTER(current_position, current_character);
  2584.         count++;
  2585.         if (UI_STRING_SPACE_CHARACTER(current_character))
  2586.         {
  2587.             UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);
  2588.             break;
  2589.         }
  2590.     }
  2591.     b->highlight_end_position = current_position;
  2592.     current_position = saved_current_position;
  2593.     /* Move cursor backwards until a break character is encountered   */
  2594.     if (current_position == b->text)
  2595.     {
  2596.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2597.         return (0);
  2598.     }
  2599.     UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);
  2600.     if (UI_STRING_SPACE_CHARACTER(current_character))   /* check for space */
  2601.     {
  2602.         UI_STRING_GET_NEXT_CHARACTER(current_position, current_character);
  2603.         b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2604.         return (0);
  2605.     }
  2606.     else
  2607.     {
  2608.         done = 0;
  2609.         b->flags |= UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  2610.     }
  2611.     while (!done)
  2612.     {
  2613.         previous_position = current_position;
  2614.         if (current_position == b->text)
  2615.         {
  2616.             break;
  2617.         }
  2618.         UI_STRING_GET_PREVIOUS_CHARACTER(current_position, current_character);
  2619.         count++;
  2620.         if (UI_STRING_SPACE_CHARACTER(current_character))
  2621.         {
  2622.             break;
  2623.         }
  2624.     }
  2625.     b->highlight_start_position = previous_position;
  2626.     b->current_text_p = previous_position;
  2627.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2628.     gui_show_single_line_input_box(b);          /* show single line input box */
  2629.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2630.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2631.     return (count);
  2632. }
  2633. /*****************************************************************************
  2634.  * FUNCTION
  2635.  *  gui_single_line_input_box_insert_string
  2636.  * DESCRIPTION
  2637.  *  insert a string in single lien input box at particular poistion
  2638.  * PARAMETERS
  2639.  *  b       [IN]        Is the single-line inputbox object
  2640.  *  s       [IN]        String to insert
  2641.  *  o       [IN]        Index
  2642.  * RETURNS
  2643.  *  S32
  2644.  *****************************************************************************/
  2645. S32 gui_single_line_input_box_insert_string(single_line_input_box *b, UI_string_type s, S32 o)
  2646. {
  2647.     /*----------------------------------------------------------------*/
  2648.     /* Local Variables                                                */
  2649.     /*----------------------------------------------------------------*/
  2650.     UI_buffer_type p1, p2;
  2651.     UI_character_type old_c, dummy_c = 0;
  2652.     U32 b_flags = b->flags;
  2653.     U8 done = 0;
  2654.     S32 count = 0;
  2655.     UI_character_type c;
  2656.     UI_buffer_type text = (UI_buffer_type) s;
  2657.     /*----------------------------------------------------------------*/
  2658.     /* Code Body                                                      */
  2659.     /*----------------------------------------------------------------*/
  2660.     while (!done)
  2661.     {
  2662.         UI_STRING_GET_NEXT_CHARACTER(text, c);
  2663.         if (UI_STRING_END_OF_STRING_CHARACTER(c))
  2664.         {
  2665.             done = 1;
  2666.             break;
  2667.         }
  2668.         if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH) && (b->UCS2_count == 0) &&
  2669.             UI_TEST_UCS2_CHARACTER(c))
  2670.         {
  2671.             if ((b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER) &&
  2672.                 (b->text_length >= UI_UCS2_STRING_HALF_LENGTH_MINUS_ONE(b->available_length)))
  2673.             {
  2674.                 done = 1;
  2675.                 break;
  2676.             }
  2677.             else if (b->text_length >= UI_UCS2_STRING_HALF_LENGTH(b->available_length))
  2678.             {
  2679.                 done = 1;
  2680.                 break;
  2681.             }
  2682.         }
  2683.         p1 = p2 = b->current_text_p;
  2684.         if ((b->last_position_p - b->text) >= (b->available_length))
  2685.         {
  2686.             done = 1;
  2687.             break;
  2688.         }
  2689.         UI_STRING_GET_NEXT_CHARACTER(b->current_text_p, dummy_c);
  2690.         if (b_flags & UI_SINGLE_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH)
  2691.         {
  2692.             if (b_flags & UI_SINGLE_LINE_INPUT_BOX_ONE_LESS_CHARACTER)
  2693.             {
  2694.                 UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH_TYPE2(
  2695.                     c,
  2696.                     b->UCS2_count,
  2697.                     b->allocated_length,
  2698.                     b->available_length);
  2699.             }
  2700.             else
  2701.             {
  2702.                 UI_TEST_UCS2_INCREMENT_COUNT_SET_LENGTH(c, b->UCS2_count, b->allocated_length, b->available_length);
  2703.             }
  2704.         }
  2705.         while (!UI_STRING_END_OF_STRING_CHARACTER(c))
  2706.         {
  2707.             UI_STRING_GET_NEXT_CHARACTER(p1, old_c);
  2708.             /* MTK Add By Elvis */
  2709.             UI_STRING_INSERT_CHARACTER(p2, c - o);
  2710.             /* MTK end */
  2711.             c = old_c;
  2712.         }
  2713.         UI_STRING_INSERT_CHARACTER(p2, c);
  2714.         count++;
  2715.         b->text_length += ((S32) p2 - (S32) p1);
  2716.     }
  2717.     b->flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2718.     gui_show_single_line_input_box(b);          /* show single line input box */
  2719.     b->flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  2720.     gui_single_line_input_box_locate_cursor(b); /* locate cursor */
  2721.     b->validation_callback(b->text, b->current_text_p, (b->text_length >> 1) - 1);
  2722.     b->change_callback();
  2723.     UI_UNUSED_PARAMETER(dummy_c);
  2724.     return (count);
  2725. }
  2726. /* GUI: multiline input box functions              */
  2727. UI_multi_line_input_box_theme *current_multi_line_input_box_theme = NULL;
  2728. #define UI_MULTI_LINE_INPUT_BOX_NUMBER_OF_BREAK_CHARACTERS     2        /* 15 */
  2729. #define MULTILINE_INPUTBOX_DISPLAY_WHOLE_LINES              1
  2730. #define MULTILINE_INPUTBOX_USE_CRLF_COMBINATION             1