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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * wgui_ems_categories.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for UI wrapper routines for EMS .
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  *
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  * removed!
  248.  * removed!
  249.  * removed!
  250.  *
  251.  * removed!
  252.  * removed!
  253.  * removed!
  254.  *
  255.  * removed!
  256.  * removed!
  257.  * removed!
  258.  *
  259.  * removed!
  260.  * removed!
  261.  * removed!
  262.  *
  263.  * removed!
  264.  * removed!
  265.  * removed!
  266.  *
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  *
  271.  * removed!
  272.  * removed!
  273.  * removed!
  274.  *
  275.  * removed!
  276.  * removed!
  277.  * removed!
  278.  *
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  *
  283.  * removed!
  284.  * removed!
  285.  * removed!
  286.  *
  287.  * removed!
  288.  * removed!
  289.  * removed!
  290.  *
  291.  * removed!
  292.  * removed!
  293.  * removed!
  294.  *
  295.  * removed!
  296.  * removed!
  297.  * removed!
  298.  *
  299.  * removed!
  300.  * removed!
  301.  * removed!
  302.  *
  303.  * removed!
  304.  * removed!
  305.  * removed!
  306.  *
  307.  * removed!
  308.  * removed!
  309.  * removed!
  310.  *
  311.  * removed!
  312.  * removed!
  313.  * removed!
  314.  *
  315.  * removed!
  316.  * removed!
  317.  * removed!
  318.  *
  319.  * removed!
  320.  * removed!
  321.  * removed!
  322.  *
  323.  *------------------------------------------------------------------------------
  324.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  325.  *============================================================================
  326.  ****************************************************************************/
  327.  /**
  328.  * Copyright Notice
  329.  * (c) 2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  330.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  331.  *  (It is illegal to remove this copyright notice from this software or any
  332.  *  portion of it)
  333.  */
  334. /**********************************************************************************
  335.    Filename:      wgui_ems_categories.c
  336.    Author:        manju
  337.    Date Created:  March-22-2003
  338.    Contains:      UI wrapper routines for EMS and category screens
  339. **********************************************************************************/
  340. #include "PixtelDataTypes.h"
  341. #include "MMI_features.h"
  342. #include "TimerEvents.h"
  343. #include "FileSystemDef.h"
  344. #include "FileSystemGProt.h"
  345. #include "conversions.h"
  346. #include "CustDataProts.h"
  347. #include "HistoryGprot.h"
  348. #include "CustMenuRes.h"
  349. #include "DebugInitDef.h"
  350. #include "GlobalDefs.h"
  351. #include "SettingProfile.h"
  352. #include "wgui.h"
  353. #include "wgui_categories.h"
  354. #include "wgui_categories_inputs.h"
  355. #include "wgui_categories_defs.h"
  356. #include "wgui_softkeys.h"
  357. #include "gdi_include.h"
  358. #include "wgui_ems.h"
  359. #include "MessagesResourceData.h"
  360. #include "CommonScreens.h"
  361. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  362. #include "FileMgr.h"
  363. #include "FileManagerDef.h"
  364. #include "FileManagerGProt.h"
  365. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  366. #include "wgui_draw_manager.h"
  367. #include "t9def.h"
  368. #ifdef __MMI_HINDI_ALG__
  369. #include "hf_rules.h"
  370. #endif 
  371. #include "wgui_virtual_keyboard.h"
  372. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  373. #include "EditorPen.h"
  374. #endif 
  375. /* MTK Elvis for R2L characters */
  376. extern BOOL r2lMMIFlag;
  377. /* MTK end */
  378. /* PMT dara added for Multitap thai */
  379. #ifdef __MMI_MULTITAP_THAI__
  380. void handle_category28_change_input_mode_bymultitapthai(void);
  381. #endif 
  382. U8 EMS_inputbox_check_multitap_thai_input(UI_character_type inputchar, U8 *updatef);
  383. extern void handle_category28_change_input_mode(void);
  384. extern void wgui_set_EMS_inputbox_RSK(void);
  385. extern void wgui_EMS_redraw_input_information_bar(void);
  386. extern void gui_EMS_change_DCS(UI_EMS_input_box *b);
  387. #ifdef __MMI_MESSAGES_EMS__
  388. extern void EMS_cancel_object_focus(void);
  389. #endif 
  390. /* MTK end */
  391. /* MTK Elvis */
  392. extern U16 StopMyTimer(U16 nTimerId);
  393. extern U16 StartMyTimerInt(U16 nTimerId, U32 nTimeDuration, oslTimerFuncPtr TimerExpiry, U8 alignment);
  394. /* MTK end */
  395. /* W05.36 Fix Vietnamese Tone Input Issue */
  396. extern void set_current_input_box_type(mmi_editor_inoutbox_enum input_box_type);
  397. /* MTK Elvis for prefered input method */
  398. extern S16 MMI_prefered_input_type;
  399. /* MTK end */
  400. extern void dm_set_scr_bg_image_no_draw(U16 image_id, S8 *file_name, S32 x, S32 y, U8 opacity);        /* 092005 grayscale Calvin */
  401. /* 070505 Calvin Start */
  402. #if defined (__MMI_WALLPAPER_ON_BOTTOM__)
  403. static MMI_ID_TYPE editor_scr_bg_ID;
  404. static S8 *editor_scr_bg_filename;
  405. static S32 editor_scr_bg_x, editor_scr_bg_y;
  406. static U8 editor_scr_bg_opacity;    /* 070505 Calvin added */
  407. #endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */ 
  408. /* 070505 Calvin End */
  409. extern U8 PhnsetGetDefEncodingType(void);
  410. /* MTK Terry for RSK Display */
  411. void handle_category28_input(void);
  412. #if(!UI_DISABLE_EMS_CATEGORY_SCREENS)
  413. /* Temporary: Will be removed later */
  414. UI_string_type temp_EMS_buffer;
  415. EMSData *temp_EMS_data;
  416. /* EMS input box: Low level wrappers   */
  417. void (*EMS_inputbox_input_callback) (void);
  418. /*****************************************************************************
  419.  * FUNCTION
  420.  *  register_EMS_inputbox_input_callback
  421.  * DESCRIPTION
  422.  *  
  423.  * PARAMETERS
  424.  *  f       [IN]        
  425.  * RETURNS
  426.  *  void
  427.  *****************************************************************************/
  428. void register_EMS_inputbox_input_callback(void (*f) (void))
  429. {
  430.     /*----------------------------------------------------------------*/
  431.     /* Local Variables                                                */
  432.     /*----------------------------------------------------------------*/
  433.     /*----------------------------------------------------------------*/
  434.     /* Code Body                                                      */
  435.     /*----------------------------------------------------------------*/
  436.     EMS_inputbox_input_callback = f;
  437. }
  438. #if(!UI_DISABLE_EMS_INPUT_BOX)
  439. /* 072904 Calvin moved for centralized control */
  440. // #define ENABLE_EMS_INPUTBOX_FRAME_SKIPPING                   1
  441. /* Calvin end */
  442. U8 EMS_inputbox_has_changed = 0;
  443. UI_EMS_input_box MMI_EMS_inputbox;
  444. EMSTextFormat wgui_EMS_text_format;
  445. extern void wgui_EMS_redraw_remaining_characters_display(void);
  446. #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
  447. S32 wgui_EMS_inputbox_frame_counter = 0;
  448. #endif 
  449. /*****************************************************************************
  450.  * FUNCTION
  451.  *  show_EMS_inputbox
  452.  * DESCRIPTION
  453.  *  
  454.  * PARAMETERS
  455.  *  void
  456.  * RETURNS
  457.  *  void
  458.  *****************************************************************************/
  459. void show_EMS_inputbox(void)
  460. {
  461. #if(0)
  462.     /*----------------------------------------------------------------*/
  463.     /* Local Variables                                                */
  464.     /*----------------------------------------------------------------*/
  465. PRINT_INFORMATION(("nn"));
  466. if(MMI_EMS_inputbox.data->CurrentPosition.Object!=NULL)
  467. {
  468. if(MMI_EMS_inputbox.data->CurrentPosition.Object->Type==EMS_TYPE_TEXT_FORMAT)
  469. { PRINT_INFORMATION(("O: *"));
  470. }
  471. else
  472. { PRINT_INFORMATION(("O: %d",MMI_EMS_inputbox.data->CurrentPosition.Object->data.picture.pdu[0]));
  473. }
  474. }
  475. PRINT_INFORMATION((" TL: %d, TO: %d, T: %c",MMI_EMS_inputbox.data->textLength,MMI_EMS_inputbox.data->CurrentPosition.OffsetToText,MMI_EMS_inputbox.data->textBuffer[MMI_EMS_inputbox.data->CurrentPosition.OffsetToText+1]));
  476. #endif /* (0) */ 
  477.     /*----------------------------------------------------------------*/
  478.     /* Code Body                                                      */
  479.     /*----------------------------------------------------------------*/
  480.     gui_set_EMS_input_box_current_theme(&MMI_EMS_inputbox);
  481.     gui_show_EMS_input_box(&MMI_EMS_inputbox);
  482. #if(UI_DOUBLE_BUFFER_SUPPORT)
  483.     gui_BLT_double_buffer(
  484.         MMI_EMS_inputbox.x,
  485.         MMI_EMS_inputbox.y,
  486.         MMI_EMS_inputbox.x + MMI_EMS_inputbox.width - 1,
  487.         MMI_EMS_inputbox.y + MMI_EMS_inputbox.height - 1);
  488. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  489. }
  490. #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
  491. /*****************************************************************************
  492.  * FUNCTION
  493.  *  wgui_EMS_inputbox_end_frame
  494.  * DESCRIPTION
  495.  *  
  496.  * PARAMETERS
  497.  *  void
  498.  * RETURNS
  499.  *  void
  500.  *****************************************************************************/
  501. void wgui_EMS_inputbox_end_frame(void)
  502. {
  503.     /*----------------------------------------------------------------*/
  504.     /* Local Variables                                                */
  505.     /*----------------------------------------------------------------*/
  506.     /*----------------------------------------------------------------*/
  507.     /* Code Body                                                      */
  508.     /*----------------------------------------------------------------*/
  509.     if (wgui_EMS_inputbox_frame_counter >= 1)
  510.     {
  511.         S32 BLT_y2, y2;
  512.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  513.         gui_lock_double_buffer();
  514.     #endif 
  515.         gui_show_EMS_input_box(&MMI_EMS_inputbox);
  516.         if (EMS_inputbox_has_changed)
  517.         {
  518.             wgui_EMS_redraw_remaining_characters_display();
  519.             EMS_inputbox_has_changed = 0;
  520.         }
  521.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  522.         gui_unlock_double_buffer();
  523.         BLT_y2 = MMI_EMS_inputbox.y + MMI_EMS_inputbox.height;
  524.         y2 = MMI_multitap_y + MMI_multitap_height + 1;
  525.         if (BLT_y2 < y2)
  526.         {
  527.             BLT_y2 = y2;
  528.         }
  529.         gui_BLT_double_buffer(
  530.             MMI_EMS_inputbox.x,
  531.             MMI_EMS_inputbox.y,
  532.             MMI_EMS_inputbox.x + MMI_EMS_inputbox.width - 1,
  533.             BLT_y2);
  534.     #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  535.         wgui_EMS_inputbox_frame_counter = 0;
  536.         gui_start_timer(UI_FRAME_SKIP_TIMEOUT, wgui_EMS_inputbox_end_frame);
  537.     }
  538. }
  539. #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING)) */ 
  540. #if(EMS_INPUTBOX_DEBUG)
  541. #define _DEBUG_PRINT(x) _debug_print x
  542. extern void DisplayToDebugwindow(S8 *nPrintableStr);
  543. /*****************************************************************************
  544.  * FUNCTION
  545.  *  _debug_print
  546.  * DESCRIPTION
  547.  *  
  548.  * PARAMETERS
  549.  *  fmt     [?]     
  550.  * RETURNS
  551.  *  void
  552.  *****************************************************************************/
  553. void _debug_print(S8 *fmt, ...)
  554. {
  555.     /*----------------------------------------------------------------*/
  556.     /* Local Variables                                                */
  557.     /*----------------------------------------------------------------*/
  558.     S8 display_string[2048];
  559.     va_list args;
  560.     /*----------------------------------------------------------------*/
  561.     /* Code Body                                                      */
  562.     /*----------------------------------------------------------------*/
  563.     va_start(args, fmt);
  564.     vsprintf(display_string, fmt, args);
  565.     va_end(args);
  566.     DisplayToDebugwindow(display_string);
  567. }
  568. /*****************************************************************************
  569.  * FUNCTION
  570.  *  _DUMP_EMS_TEXT_FORMAT_OBJECT
  571.  * DESCRIPTION
  572.  *  
  573.  * PARAMETERS
  574.  *  x       [?]     
  575.  * RETURNS
  576.  *  void
  577.  *****************************************************************************/
  578. void _DUMP_EMS_TEXT_FORMAT_OBJECT(EMSTextFormat *x)
  579. {
  580.     /*----------------------------------------------------------------*/
  581.     /* Local Variables                                                */
  582.     /*----------------------------------------------------------------*/
  583.     /*----------------------------------------------------------------*/
  584.     /* Code Body                                                      */
  585.     /*----------------------------------------------------------------*/
  586.     if (x != NULL)
  587.     {
  588.         _DEBUG_PRINT(("L=%03d ", x->textLength));
  589.         _DEBUG_PRINT(("AL="));
  590.         switch (x->Alignment)
  591.         {
  592.             case EMS_ALIGN_LEFT:
  593.                 _DEBUG_PRINT(("L"));
  594.                 break;
  595.             case EMS_ALIGN_RIGHT:
  596.                 _DEBUG_PRINT(("R"));
  597.                 break;
  598.             case EMS_ALIGN_CENTER:
  599.                 _DEBUG_PRINT(("C"));
  600.                 break;
  601.             case EMS_ALIGN_LANG_DEP:
  602.                 _DEBUG_PRINT(("D"));
  603.                 break;
  604.         }
  605.         _DEBUG_PRINT((" SZ="));
  606.         switch (x->FontSize)
  607.         {
  608.             case EMS_FONTSIZE_NORMAL:
  609.                 _DEBUG_PRINT(("N"));
  610.                 break;
  611.             case EMS_FONTSIZE_LARGE:
  612.                 _DEBUG_PRINT(("L"));
  613.                 break;
  614.             case EMS_FONTSIZE_SMALL:
  615.                 _DEBUG_PRINT(("S"));
  616.                 break;
  617.         }
  618.         _DEBUG_PRINT((" ST="));
  619.         if (x->isBold)
  620.         {
  621.             _DEBUG_PRINT(("B"));
  622.         }
  623.         if (x->isItalic)
  624.         {
  625.             _DEBUG_PRINT(("I"));
  626.         }
  627.         if (x->isUnderline)
  628.         {
  629.             _DEBUG_PRINT(("U"));
  630.         }
  631.         if (x->isStrikethrough)
  632.         {
  633.             _DEBUG_PRINT(("S"));
  634.         }
  635.     }
  636. }
  637. /*****************************************************************************
  638.  * FUNCTION
  639.  *  _DUMP_EMS_OBJECT
  640.  * DESCRIPTION
  641.  *  
  642.  * PARAMETERS
  643.  *  x       [?]     
  644.  * RETURNS
  645.  *  void
  646.  *****************************************************************************/
  647. void _DUMP_EMS_OBJECT(EMSObject *x)
  648. {
  649.     /*----------------------------------------------------------------*/
  650.     /* Local Variables                                                */
  651.     /*----------------------------------------------------------------*/
  652.     /*----------------------------------------------------------------*/
  653.     /* Code Body                                                      */
  654.     /*----------------------------------------------------------------*/
  655.     if (x == NULL)
  656.     {
  657.         _DEBUG_PRINT(("NULL"));
  658.     }
  659.     else
  660.     {
  661.         _DEBUG_PRINT(("%8X OFF=%03d ", x, x->OffsetToText));
  662.         switch (x->Type)
  663.         {
  664.             case EMS_TYPE_TEXT_FORMAT:
  665.                 _DEBUG_PRINT(("TXT FMT "));
  666.                 _DUMP_EMS_TEXT_FORMAT_OBJECT(&x->data->text_format);
  667.                 break;
  668.             case EMS_TYPE_PREDEF_SND:
  669.                 _DEBUG_PRINT(("PRE SND %d", x->PredefNo));
  670.                 break;
  671.             case EMS_TYPE_USERDEF_SND:
  672.                 _DEBUG_PRINT(("USR SND"));
  673.                 break;
  674.             case EMS_TYPE_PREDEF_ANM:
  675.                 _DEBUG_PRINT(("PRE ANM %d", x->PredefNo));
  676.                 break;
  677.             case EMS_TYPE_USERDEF_ANM:
  678.                 _DEBUG_PRINT(("USR ANM"));
  679.                 break;
  680.             case EMS_TYPE_PIC:
  681.                 _DEBUG_PRINT(("EMS PIC"));
  682.                 break;
  683.         }
  684.     }
  685. }
  686. #else /* (EMS_INPUTBOX_DEBUG) */ 
  687. #define _DEBUG_PRINT(x)
  688. /*****************************************************************************
  689.  * FUNCTION
  690.  *  _DUMP_EMS_OBJECT
  691.  * DESCRIPTION
  692.  *  
  693.  * PARAMETERS
  694.  *  x       [?]     
  695.  * RETURNS
  696.  *  void
  697.  *****************************************************************************/
  698. void _DUMP_EMS_OBJECT(EMSObject *x)
  699. {
  700.     /*----------------------------------------------------------------*/
  701.     /* Local Variables                                                */
  702.     /*----------------------------------------------------------------*/
  703.     /*----------------------------------------------------------------*/
  704.     /* Code Body                                                      */
  705.     /*----------------------------------------------------------------*/
  706.     UI_UNUSED_PARAMETER(x);
  707. }
  708. #endif /* (EMS_INPUTBOX_DEBUG) */ 
  709. extern U16 GetExitScrnID(void);
  710. #include "IdleAppDef.h"
  711. /*****************************************************************************
  712.  * FUNCTION
  713.  *  redraw_EMS_inputbox
  714.  * DESCRIPTION
  715.  *  
  716.  * PARAMETERS
  717.  *  void
  718.  * RETURNS
  719.  *  void
  720.  *****************************************************************************/
  721. void redraw_EMS_inputbox(void)
  722. {
  723.     /*----------------------------------------------------------------*/
  724.     /* Local Variables                                                */
  725.     /*----------------------------------------------------------------*/
  726.     /*----------------------------------------------------------------*/
  727.     /* Code Body                                                      */
  728.     /*----------------------------------------------------------------*/
  729.     if ((SCR_POPUP_SCREEN != GetExitScrnID()) && (POPUP_SCREENID != GetExitScrnID()))
  730.     {
  731.     #if(EMS_INPUTBOX_DEBUG)
  732.         S32 i = 0;
  733.         UI_character_type c = '-';
  734.         EMSObject *object = MMI_EMS_inputbox.data->listHead;
  735.         EMSPosition mapped_position;
  736.         EMS_map_position(MMI_EMS_inputbox.data, &MMI_EMS_inputbox.data->CurrentPosition, &mapped_position);
  737.         if ((MMI_EMS_inputbox.data->textBuffer != NULL) && (MMI_EMS_inputbox.data->textLength > 0) &&
  738.             (MMI_EMS_inputbox.data->CurrentPosition.OffsetToText < MMI_EMS_inputbox.data->textLength))
  739.         {
  740.             c = MMI_EMS_inputbox.data->textBuffer[MMI_EMS_inputbox.data->CurrentPosition.OffsetToText];
  741.         }
  742.         if ((c == 0x0A) || (c == 0x0D))
  743.         {
  744.             c = '.';
  745.         }
  746.         _DEBUG_PRINT(("nnCurrent position: %c OFF=%03d, Object=", c,
  747.                       MMI_EMS_inputbox.data->CurrentPosition.OffsetToText));
  748.         _DUMP_EMS_OBJECT(MMI_EMS_inputbox.data->CurrentPosition.Object);
  749.         _DEBUG_PRINT(("nMapped position:  %c OFF=%03d, Object=", c, mapped_position.OffsetToText,
  750.                       mapped_position.Object));
  751.         _DUMP_EMS_OBJECT(mapped_position.Object);
  752.         _DEBUG_PRINT(("nInputbox text format: "));
  753.         _DUMP_EMS_TEXT_FORMAT_OBJECT(&MMI_EMS_inputbox.text_format);
  754.         _DEBUG_PRINT(("nWGUI text format:     "));
  755.         _DUMP_EMS_TEXT_FORMAT_OBJECT(&wgui_EMS_text_format);
  756.         _DEBUG_PRINT(("nCurrent text format:  "));
  757.         _DUMP_EMS_OBJECT(MMI_EMS_inputbox.data->CurrentTextFormatObj);
  758.         while (object != NULL)
  759.         {
  760.             _DEBUG_PRINT(("nO%d=", i));
  761.             _DUMP_EMS_OBJECT(object);
  762.             object = object->next;
  763.             i++;
  764.         }
  765.         for (i = 0; i < MMI_EMS_inputbox.n_lines; i++)
  766.         {
  767.             _DEBUG_PRINT(("nL%d OFF=%03d, Count=%02d, x=%02d, Object=", i,
  768.                           MMI_EMS_inputbox.line_positions[i].OffsetToText, MMI_EMS_inputbox.line_object_counts[i],
  769.                           MMI_EMS_inputbox.line_x_positions[i]));
  770.             _DUMP_EMS_OBJECT(MMI_EMS_inputbox.line_positions[i].Object);
  771.         }
  772.         _DEBUG_PRINT(("n"));
  773.     #endif /* (EMS_INPUTBOX_DEBUG) */ 
  774.     #if(0)
  775. PRINT_INFORMATION(("nn"));
  776. if(MMI_EMS_inputbox.data->CurrentPosition.Object!=NULL)
  777. {
  778. if(MMI_EMS_inputbox.data->CurrentPosition.Object->Type==EMS_TYPE_TEXT_FORMAT)
  779. { PRINT_INFORMATION(("O: *"));
  780. }
  781. else
  782. { PRINT_INFORMATION(("O: %d",MMI_EMS_inputbox.data->CurrentPosition.Object->data.picture.pdu[0]));
  783. }
  784. }
  785. PRINT_INFORMATION((" TL: %d, TO: %d, T: %c",MMI_EMS_inputbox.data->textLength,MMI_EMS_inputbox.data->CurrentPosition.OffsetToText,MMI_EMS_inputbox.data->textBuffer[MMI_EMS_inputbox.data->CurrentPosition.OffsetToText+1]));
  786.     #endif /* (0) */ 
  787.     #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
  788.         if (wgui_EMS_inputbox_frame_counter > 0)
  789.         {
  790.             wgui_EMS_inputbox_frame_counter++;
  791.         }
  792.         else
  793.         {
  794.             wgui_EMS_inputbox_frame_counter = 1;
  795.             gui_start_timer(UI_FRAME_START_TIMEOUT, wgui_EMS_inputbox_end_frame);
  796.         }
  797.     #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING)) */ 
  798.         gui_show_EMS_input_box(&MMI_EMS_inputbox);
  799.         /* MTK Terry fix EMS remaining characters display unsync bug firefly#278 */
  800.         if (!(MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE))
  801.         {
  802.             wgui_EMS_redraw_remaining_characters_display();
  803.             /* EMS_inputbox_has_changed=0; */
  804.         }
  805.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  806.         gui_BLT_double_buffer(
  807.             MMI_EMS_inputbox.x,
  808.             MMI_EMS_inputbox.y,
  809.             MMI_EMS_inputbox.x + MMI_EMS_inputbox.width - 1,
  810.             MMI_EMS_inputbox.y + MMI_EMS_inputbox.height - 1);
  811.     #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  812.     #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING)) */ 
  813.     }
  814. }
  815. /*****************************************************************************
  816.  * FUNCTION
  817.  *  show_EMS_inputbox_no_draw
  818.  * DESCRIPTION
  819.  *  
  820.  * PARAMETERS
  821.  *  void
  822.  * RETURNS
  823.  *  void
  824.  *****************************************************************************/
  825. void show_EMS_inputbox_no_draw(void)
  826. {
  827.     /*----------------------------------------------------------------*/
  828.     /* Local Variables                                                */
  829.     /*----------------------------------------------------------------*/
  830.     /*----------------------------------------------------------------*/
  831.     /* Code Body                                                      */
  832.     /*----------------------------------------------------------------*/
  833.     MMI_EMS_inputbox.flags |= (UI_EMS_INPUT_BOX_DISABLE_DRAW);
  834.     gui_show_EMS_input_box(&MMI_EMS_inputbox);
  835.     MMI_EMS_inputbox.flags &= ~(UI_EMS_INPUT_BOX_DISABLE_DRAW);
  836. }
  837. /*****************************************************************************
  838.  * FUNCTION
  839.  *  EMS_inputbox_previous
  840.  * DESCRIPTION
  841.  *  
  842.  * PARAMETERS
  843.  *  void
  844.  * RETURNS
  845.  *  void
  846.  *****************************************************************************/
  847. void EMS_inputbox_previous(void)
  848. {
  849.     /*----------------------------------------------------------------*/
  850.     /* Local Variables                                                */
  851.     /*----------------------------------------------------------------*/
  852.     /*----------------------------------------------------------------*/
  853.     /* Code Body                                                      */
  854.     /*----------------------------------------------------------------*/
  855.     /* W05.34 Fix Multitap in arrow keys */
  856.     if (!(MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE))
  857.     {
  858.         disable_active_multitap();
  859.     }
  860.     gui_EMS_input_box_previous(&MMI_EMS_inputbox);
  861.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  862.     redraw_EMS_inputbox();
  863. }
  864. /*****************************************************************************
  865.  * FUNCTION
  866.  *  EMS_inputbox_next
  867.  * DESCRIPTION
  868.  *  
  869.  * PARAMETERS
  870.  *  void
  871.  * RETURNS
  872.  *  void
  873.  *****************************************************************************/
  874. void EMS_inputbox_next(void)
  875. {
  876.     /*----------------------------------------------------------------*/
  877.     /* Local Variables                                                */
  878.     /*----------------------------------------------------------------*/
  879.     /*----------------------------------------------------------------*/
  880.     /* Code Body                                                      */
  881.     /*----------------------------------------------------------------*/
  882.     /* W05.34 Fix Multitap in arrow keys */
  883.     if (!(MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE))
  884.     {
  885.         disable_active_multitap();
  886.     }
  887.     gui_EMS_input_box_next(&MMI_EMS_inputbox);
  888.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  889.     redraw_EMS_inputbox();
  890. }
  891. #ifdef __MMI_MESSAGES_EMS__
  892. /*****************************************************************************
  893.  * FUNCTION
  894.  *  EMS_inputbox_previous_object
  895.  * DESCRIPTION
  896.  *  
  897.  * PARAMETERS
  898.  *  void
  899.  * RETURNS
  900.  *  void
  901.  *****************************************************************************/
  902. void EMS_inputbox_previous_object(void)
  903. {
  904.     /*----------------------------------------------------------------*/
  905.     /* Local Variables                                                */
  906.     /*----------------------------------------------------------------*/
  907.     /*----------------------------------------------------------------*/
  908.     /* Code Body                                                      */
  909.     /*----------------------------------------------------------------*/
  910.     gui_EMS_input_box_view_previous_object(&MMI_EMS_inputbox);
  911.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  912.     redraw_EMS_inputbox();
  913. }
  914. /*****************************************************************************
  915.  * FUNCTION
  916.  *  EMS_inputbox_next_object
  917.  * DESCRIPTION
  918.  *  
  919.  * PARAMETERS
  920.  *  void
  921.  * RETURNS
  922.  *  void
  923.  *****************************************************************************/
  924. void EMS_inputbox_next_object(void)
  925. {
  926.     /*----------------------------------------------------------------*/
  927.     /* Local Variables                                                */
  928.     /*----------------------------------------------------------------*/
  929.     /*----------------------------------------------------------------*/
  930.     /* Code Body                                                      */
  931.     /*----------------------------------------------------------------*/
  932.     gui_EMS_input_box_view_next_object(&MMI_EMS_inputbox);
  933.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  934.     redraw_EMS_inputbox();
  935. }
  936. #endif /* __MMI_MESSAGES_EMS__ */ 
  937. /*****************************************************************************
  938.  * FUNCTION
  939.  *  EMS_inputbox_previous_line
  940.  * DESCRIPTION
  941.  *  
  942.  * PARAMETERS
  943.  *  void
  944.  * RETURNS
  945.  *  void
  946.  *****************************************************************************/
  947. void EMS_inputbox_previous_line(void)
  948. {
  949.     /*----------------------------------------------------------------*/
  950.     /* Local Variables                                                */
  951.     /*----------------------------------------------------------------*/
  952.     /*----------------------------------------------------------------*/
  953.     /* Code Body                                                      */
  954.     /*----------------------------------------------------------------*/
  955.     /* W05.34 Fix Multitap in arrow keys */
  956.     if (!(MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE))
  957.     {
  958.         disable_active_multitap();
  959.     }
  960.     gui_EMS_input_box_previous_line(&MMI_EMS_inputbox);
  961.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  962.     redraw_EMS_inputbox();
  963. }
  964. /*****************************************************************************
  965.  * FUNCTION
  966.  *  EMS_inputbox_next_line
  967.  * DESCRIPTION
  968.  *  
  969.  * PARAMETERS
  970.  *  void
  971.  * RETURNS
  972.  *  void
  973.  *****************************************************************************/
  974. void EMS_inputbox_next_line(void)
  975. {
  976.     /*----------------------------------------------------------------*/
  977.     /* Local Variables                                                */
  978.     /*----------------------------------------------------------------*/
  979.     /*----------------------------------------------------------------*/
  980.     /* Code Body                                                      */
  981.     /*----------------------------------------------------------------*/
  982.     /* W05.34 Fix Multitap in arrow keys */
  983.     if (!(MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE))
  984.     {
  985.         disable_active_multitap();
  986.     }
  987.     gui_EMS_input_box_next_line(&MMI_EMS_inputbox);
  988.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  989.     redraw_EMS_inputbox();
  990. }
  991. UI_character_type EMS_GSM_extended_lookup[] = { '[', ']', '{', '}', '~', '\', '^', '|', 0xA2,  /* Euro character is mapped to 0xA2 */
  992. };
  993. /*****************************************************************************
  994.  * FUNCTION
  995.  *  EMS_GSM_extended_map
  996.  * DESCRIPTION
  997.  *  
  998.  * PARAMETERS
  999.  *  c       [IN]        
  1000.  * RETURNS
  1001.  *  
  1002.  *****************************************************************************/
  1003. U8 EMS_GSM_extended_map(UI_character_type c)
  1004. {
  1005.     /*----------------------------------------------------------------*/
  1006.     /* Local Variables                                                */
  1007.     /*----------------------------------------------------------------*/
  1008.     S32 i, n;
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Code Body                                                      */
  1011.     /*----------------------------------------------------------------*/
  1012.     if (c & 0xff00)
  1013.     {
  1014.         return (0);
  1015.     }
  1016.     n = sizeof(EMS_GSM_extended_lookup) / sizeof(UI_character_type);
  1017.     for (i = 0; i < n; i++)
  1018.     {
  1019.         if (c == EMS_GSM_extended_lookup[i])
  1020.         {
  1021.             return (1);
  1022.         }
  1023.     }
  1024.     return (0);
  1025. }
  1026. /*****************************************************************************
  1027.  * FUNCTION
  1028.  *  EMS_inputbox_direct_input
  1029.  * DESCRIPTION
  1030.  *  
  1031.  * PARAMETERS
  1032.  *  c       [IN]        
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. void EMS_inputbox_direct_input(UI_character_type c)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Code Body                                                      */
  1043.     /*----------------------------------------------------------------*/
  1044.     if (UI_TEST_LF_CHARACTER(c))
  1045.     {
  1046.         gui_EMS_input_box_insert_new_line(&MMI_EMS_inputbox);
  1047.     }
  1048.     else
  1049.     {
  1050.     #if(!EMS_USE_GSM_EXTENDED)
  1051.         if (MMI_EMS_inputbox.UCS2_count == 0)
  1052.         {
  1053.             if (EMS_GSM_extended_map(c))
  1054.             {
  1055.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, 0x1b);
  1056.             }
  1057.         }
  1058.     #endif /* (!EMS_USE_GSM_EXTENDED) */ 
  1059.         gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, c);
  1060.     }
  1061.     redraw_EMS_inputbox();
  1062.     EMS_inputbox_input_callback();
  1063. }
  1064. /*****************************************************************************
  1065.  * FUNCTION
  1066.  *  EMS_inputbox_direct_input_no_LF_check
  1067.  * DESCRIPTION
  1068.  *  
  1069.  * PARAMETERS
  1070.  *  c       [IN]        
  1071.  * RETURNS
  1072.  *  void
  1073.  *****************************************************************************/
  1074. void EMS_inputbox_direct_input_no_LF_check(UI_character_type c)
  1075. {
  1076.     /*----------------------------------------------------------------*/
  1077.     /* Local Variables                                                */
  1078.     /*----------------------------------------------------------------*/
  1079.     /*----------------------------------------------------------------*/
  1080.     /* Code Body                                                      */
  1081.     /*----------------------------------------------------------------*/
  1082.     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, c);
  1083.     redraw_EMS_inputbox();
  1084.     EMS_inputbox_input_callback();
  1085. }
  1086. /*****************************************************************************
  1087.  * FUNCTION
  1088.  *  EMS_inputbox_backspace
  1089.  * DESCRIPTION
  1090.  *  
  1091.  * PARAMETERS
  1092.  *  void
  1093.  * RETURNS
  1094.  *  void
  1095.  *****************************************************************************/
  1096. void EMS_inputbox_backspace(void)
  1097. {
  1098.     /*----------------------------------------------------------------*/
  1099.     /* Local Variables                                                */
  1100.     /*----------------------------------------------------------------*/
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Code Body                                                      */
  1103.     /*----------------------------------------------------------------*/
  1104.     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1105.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  1106.     redraw_EMS_inputbox();
  1107.     EMS_inputbox_input_callback();
  1108. }
  1109. /*****************************************************************************
  1110.  * FUNCTION
  1111.  *  EMS_inputbox_delete_all
  1112.  * DESCRIPTION
  1113.  *  
  1114.  * PARAMETERS
  1115.  *  void
  1116.  * RETURNS
  1117.  *  void
  1118.  *****************************************************************************/
  1119. void EMS_inputbox_delete_all(void)
  1120. {
  1121.     /*----------------------------------------------------------------*/
  1122.     /* Local Variables                                                */
  1123.     /*----------------------------------------------------------------*/
  1124.     /*----------------------------------------------------------------*/
  1125.     /* Code Body                                                      */
  1126.     /*----------------------------------------------------------------*/
  1127.     gui_EMS_input_box_delete_all(&MMI_EMS_inputbox);
  1128.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  1129.     redraw_EMS_inputbox();
  1130.     EMS_inputbox_input_callback();
  1131. }
  1132. /*****************************************************************************
  1133.  * FUNCTION
  1134.  *  EMS_inputbox_toggle_insert_mode
  1135.  * DESCRIPTION
  1136.  *  
  1137.  * PARAMETERS
  1138.  *  void
  1139.  * RETURNS
  1140.  *  void
  1141.  *****************************************************************************/
  1142. void EMS_inputbox_toggle_insert_mode(void)
  1143. {
  1144.     /*----------------------------------------------------------------*/
  1145.     /* Local Variables                                                */
  1146.     /*----------------------------------------------------------------*/
  1147.     /*----------------------------------------------------------------*/
  1148.     /* Code Body                                                      */
  1149.     /*----------------------------------------------------------------*/
  1150.     gui_EMS_input_box_toggle_insert_mode(&MMI_EMS_inputbox);
  1151.     redraw_EMS_inputbox();
  1152. }
  1153. /*****************************************************************************
  1154.  * FUNCTION
  1155.  *  EMS_inputbox_delete
  1156.  * DESCRIPTION
  1157.  *  
  1158.  * PARAMETERS
  1159.  *  void
  1160.  * RETURNS
  1161.  *  void
  1162.  *****************************************************************************/
  1163. void EMS_inputbox_delete(void)
  1164. {
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Local Variables                                                */
  1167.     /*----------------------------------------------------------------*/
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Code Body                                                      */
  1170.     /*----------------------------------------------------------------*/
  1171.     gui_EMS_input_box_delete(&MMI_EMS_inputbox);
  1172.     wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
  1173.     redraw_EMS_inputbox();
  1174.     EMS_inputbox_input_callback();
  1175. }
  1176. /*****************************************************************************
  1177.  * FUNCTION
  1178.  *  EMS_inputbox_insert_new_line
  1179.  * DESCRIPTION
  1180.  *  
  1181.  * PARAMETERS
  1182.  *  void
  1183.  * RETURNS
  1184.  *  void
  1185.  *****************************************************************************/
  1186. void EMS_inputbox_insert_new_line(void)
  1187. {
  1188.     /*----------------------------------------------------------------*/
  1189.     /* Local Variables                                                */
  1190.     /*----------------------------------------------------------------*/
  1191.     /*----------------------------------------------------------------*/
  1192.     /* Code Body                                                      */
  1193.     /*----------------------------------------------------------------*/
  1194.     gui_EMS_input_box_insert_new_line(&MMI_EMS_inputbox);
  1195.     EMS_inputbox_input_callback();
  1196. }
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  EMS_inputbox_alphanumeric_keyboard_input_handler
  1200.  * DESCRIPTION
  1201.  *  
  1202.  * PARAMETERS
  1203.  *  keyc        [IN]        
  1204.  * RETURNS
  1205.  *  void
  1206.  *****************************************************************************/
  1207. void EMS_inputbox_alphanumeric_keyboard_input_handler(S32 keyc)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     /*----------------------------------------------------------------*/
  1213.     /* Code Body                                                      */
  1214.     /*----------------------------------------------------------------*/
  1215.     if (keyc == 0xc0)
  1216.     {
  1217.         EMS_inputbox_direct_input_no_LF_check((UI_character_type) 'n');
  1218.     }
  1219.     else if (keyc == 0xbb)
  1220.     {
  1221.         EMS_inputbox_direct_input((UI_character_type) 0x0d);
  1222.     }
  1223.     else if (keyc == 0x08)
  1224.     {
  1225.         EMS_inputbox_backspace();
  1226.     }
  1227.     else if (keyc == 0x1b)
  1228.     {
  1229.         EMS_inputbox_delete_all();
  1230.     }
  1231.     else if (keyc == 0x0d)
  1232.     {
  1233.         EMS_inputbox_direct_input((UI_character_type) 'n');
  1234.     }
  1235.     else if (keyc == 0xbd)
  1236.     {
  1237.         EMS_inputbox_direct_input((UI_character_type) 0x1b);
  1238.     }
  1239.     else if (keyc > 0x1f)
  1240.     {
  1241.         EMS_inputbox_direct_input((UI_character_type) keyc);
  1242.     }
  1243. }
  1244. /*****************************************************************************
  1245.  * FUNCTION
  1246.  *  EMS_inputbox_key_handler
  1247.  * DESCRIPTION
  1248.  *  
  1249.  * PARAMETERS
  1250.  *  vkey_code       [IN]        
  1251.  *  key_state       [IN]        
  1252.  * RETURNS
  1253.  *  void
  1254.  *****************************************************************************/
  1255. void EMS_inputbox_key_handler(S32 vkey_code, S32 key_state)
  1256. {
  1257. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1258.     /*----------------------------------------------------------------*/
  1259.     /* Local Variables                                                */
  1260.     /*----------------------------------------------------------------*/
  1261.     /*----------------------------------------------------------------*/
  1262.     /* Code Body                                                      */
  1263.     /*----------------------------------------------------------------*/
  1264.     if (key_state)
  1265.     {
  1266.         switch (vkey_code)
  1267.         {
  1268.             case 37:
  1269.         #if(ENABLE_EMS_TEST_WORD_HIGHLIGHT)
  1270.                 MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
  1271.         #endif 
  1272.                 EMS_inputbox_previous();
  1273.                 break;
  1274.             case 38:
  1275.         #if(ENABLE_EMS_TEST_WORD_HIGHLIGHT)
  1276.                 gui_EMS_input_box_highlight_cursor_start(&MMI_EMS_inputbox);
  1277.                 show_EMS_inputbox();
  1278.         #else /* (ENABLE_EMS_TEST_WORD_HIGHLIGHT) */ 
  1279.                 EMS_inputbox_previous_line();
  1280.         #endif /* (ENABLE_EMS_TEST_WORD_HIGHLIGHT) */ 
  1281.                 break;
  1282.             case 39:
  1283.         #if(ENABLE_EMS_TEST_WORD_HIGHLIGHT)
  1284.                 MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
  1285.         #endif 
  1286.                 EMS_inputbox_next();
  1287.                 break;
  1288.             case 40:
  1289.         #if(ENABLE_EMS_TEST_WORD_HIGHLIGHT)
  1290.                 gui_EMS_input_box_highlight_cursor_end(&MMI_EMS_inputbox);
  1291.                 show_EMS_inputbox();
  1292.         #else /* (ENABLE_EMS_TEST_WORD_HIGHLIGHT) */ 
  1293.                 EMS_inputbox_next_line();
  1294.         #endif /* (ENABLE_EMS_TEST_WORD_HIGHLIGHT) */ 
  1295.                 break;
  1296.             case 36:    /* home */
  1297.                 break;
  1298.             case 35:    /* end */
  1299.                 break;
  1300.             case 33:    /* page up */
  1301.                 break;
  1302.             case 34:    /* page down */
  1303.                 break;
  1304.             case 45:
  1305.                 EMS_inputbox_toggle_insert_mode();
  1306.                 break;
  1307.             case 46:
  1308.                 EMS_inputbox_delete();
  1309.                 break;
  1310.         }
  1311.     }
  1312. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1313.     UI_UNUSED_PARAMETER(vkey_code);
  1314.     UI_UNUSED_PARAMETER(key_state);
  1315. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1316. }
  1317. /*****************************************************************************
  1318.  * FUNCTION
  1319.  *  EMS_inputbox_viewer_key_handler
  1320.  * DESCRIPTION
  1321.  *  
  1322.  * PARAMETERS
  1323.  *  vkey_code       [IN]        
  1324.  *  key_state       [IN]        
  1325.  * RETURNS
  1326.  *  void
  1327.  *****************************************************************************/
  1328. void EMS_inputbox_viewer_key_handler(S32 vkey_code, S32 key_state)
  1329. {
  1330. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1331.     /*----------------------------------------------------------------*/
  1332.     /* Local Variables                                                */
  1333.     /*----------------------------------------------------------------*/
  1334.     /*----------------------------------------------------------------*/
  1335.     /* Code Body                                                      */
  1336.     /*----------------------------------------------------------------*/
  1337.     if (key_state)
  1338.     {
  1339.         switch (vkey_code)
  1340.         {
  1341.             case 37:
  1342.         #ifdef __MMI_MESSAGES_EMS__
  1343.                 EMS_inputbox_previous_object();
  1344.         #else 
  1345.                 EMS_inputbox_previous();
  1346.         #endif 
  1347.                 break;
  1348.             case 38:
  1349.                 EMS_inputbox_previous_line();
  1350.                 break;
  1351.             case 39:
  1352.         #ifdef __MMI_MESSAGES_EMS__
  1353.                 EMS_inputbox_next_object();
  1354.         #else 
  1355.                 EMS_inputbox_next();
  1356.         #endif 
  1357.                 break;
  1358.             case 40:
  1359.                 EMS_inputbox_next_line();
  1360.                 break;
  1361.             case 36:    /* home */
  1362.                 break;
  1363.             case 35:    /* end */
  1364.                 break;
  1365.             case 33:    /* page up */
  1366.                 break;
  1367.             case 34:    /* page down */
  1368.                 break;
  1369.             case 45:    /* insert */
  1370.                 break;
  1371.             case 46:    /* delete */
  1372.                 break;
  1373.         }
  1374.     }
  1375. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1376.     UI_UNUSED_PARAMETER(vkey_code);
  1377.     UI_UNUSED_PARAMETER(key_state);
  1378. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1379. }
  1380. /*****************************************************************************
  1381.  * FUNCTION
  1382.  *  EMS_inputbox_multitap_input
  1383.  * DESCRIPTION
  1384.  *  
  1385.  * PARAMETERS
  1386.  *  c       [IN]        
  1387.  * RETURNS
  1388.  *  void
  1389.  *****************************************************************************/
  1390. void EMS_inputbox_multitap_input(UI_character_type c)
  1391. {
  1392.     /*----------------------------------------------------------------*/
  1393.     /* Local Variables                                                */
  1394.     /*----------------------------------------------------------------*/
  1395.     /*----------------------------------------------------------------*/
  1396.     /* Code Body                                                      */
  1397.     /*----------------------------------------------------------------*/
  1398.     gui_EMS_input_box_insert_multitap_character(&MMI_EMS_inputbox, c);
  1399.     redraw_EMS_inputbox();
  1400.     EMS_inputbox_input_callback();
  1401. }
  1402. /*****************************************************************************
  1403.  * FUNCTION
  1404.  *  EMS_inputbox_multitap_input_complete
  1405.  * DESCRIPTION
  1406.  *  
  1407.  * PARAMETERS
  1408.  *  void
  1409.  * RETURNS
  1410.  *  void
  1411.  *****************************************************************************/
  1412. void EMS_inputbox_multitap_input_complete(void)
  1413. {
  1414.     /*----------------------------------------------------------------*/
  1415.     /* Local Variables                                                */
  1416.     /*----------------------------------------------------------------*/
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Code Body                                                      */
  1419.     /*----------------------------------------------------------------*/
  1420.     gui_EMS_input_box_confirm_multitap_character(&MMI_EMS_inputbox);
  1421.     redraw_EMS_inputbox();
  1422. }
  1423. /*****************************************************************************
  1424.  * FUNCTION
  1425.  *  EMS_inputbox_numeric_keyboard_input_handler
  1426.  * DESCRIPTION
  1427.  *  
  1428.  * PARAMETERS
  1429.  *  keyc        [IN]        
  1430.  * RETURNS
  1431.  *  void
  1432.  *****************************************************************************/
  1433. void EMS_inputbox_numeric_keyboard_input_handler(S32 keyc)
  1434. {
  1435.     /*----------------------------------------------------------------*/
  1436.     /* Local Variables                                                */
  1437.     /*----------------------------------------------------------------*/
  1438.     /*----------------------------------------------------------------*/
  1439.     /* Code Body                                                      */
  1440.     /*----------------------------------------------------------------*/
  1441.     if (keyc >= '0' && keyc <= '9')
  1442.     {
  1443.         EMS_inputbox_direct_input((U8) keyc);
  1444.     }
  1445.     else if (keyc == 0x08)
  1446.     {
  1447.         EMS_inputbox_backspace();
  1448.     }
  1449.     else if (keyc == 0x1b)
  1450.     {
  1451.         EMS_inputbox_delete_all();
  1452.     }
  1453. }
  1454. /*****************************************************************************
  1455.  * FUNCTION
  1456.  *  EMS_inputbox_handle_key_down
  1457.  * DESCRIPTION
  1458.  *  
  1459.  * PARAMETERS
  1460.  *  k       [IN]        
  1461.  * RETURNS
  1462.  *  void
  1463.  *****************************************************************************/
  1464. void EMS_inputbox_handle_key_down(MMI_key_code_type k)
  1465. {
  1466.     /*----------------------------------------------------------------*/
  1467.     /* Local Variables                                                */
  1468.     /*----------------------------------------------------------------*/
  1469.     /*----------------------------------------------------------------*/
  1470.     /* Code Body                                                      */
  1471.     /*----------------------------------------------------------------*/
  1472.     EMS_inputbox_direct_input((UI_character_type) ('0' + k));
  1473. }
  1474. /*****************************************************************************
  1475.  * FUNCTION
  1476.  *  register_EMS_inputbox_keys
  1477.  * DESCRIPTION
  1478.  *  
  1479.  * PARAMETERS
  1480.  *  void
  1481.  * RETURNS
  1482.  *  void
  1483.  *****************************************************************************/
  1484. void register_EMS_inputbox_keys(void)
  1485. {
  1486.     /*----------------------------------------------------------------*/
  1487.     /* Local Variables                                                */
  1488.     /*----------------------------------------------------------------*/
  1489.     /*----------------------------------------------------------------*/
  1490.     /* Code Body                                                      */
  1491.     /*----------------------------------------------------------------*/
  1492.     SetKeyHandler(EMS_inputbox_previous, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1493.     SetKeyHandler(EMS_inputbox_next, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1494.     SetKeyHandler(EMS_inputbox_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1495.     SetKeyHandler(EMS_inputbox_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1496.     /* SetKeyHandler(EMS_inputbox_backspace,KEY_CLEAR,KEY_EVENT_DOWN); */
  1497.     register_keyboard_key_handler(EMS_inputbox_key_handler);
  1498. }
  1499. /*****************************************************************************
  1500.  * FUNCTION
  1501.  *  wgui_EMS_inputbox_handle_symbol_picker_star_key
  1502.  * DESCRIPTION
  1503.  *  
  1504.  * PARAMETERS
  1505.  *  void
  1506.  * RETURNS
  1507.  *  void
  1508.  *****************************************************************************/
  1509. void wgui_EMS_inputbox_handle_symbol_picker_star_key(void)
  1510. {
  1511.     /*----------------------------------------------------------------*/
  1512.     /* Local Variables                                                */
  1513.     /*----------------------------------------------------------------*/
  1514.     /*----------------------------------------------------------------*/
  1515.     /* Code Body                                                      */
  1516.     /*----------------------------------------------------------------*/
  1517.     disable_active_multitap();
  1518.     EntrySymbolPickerScreen();
  1519. }
  1520. /* MTK Elvis modify for Thai */
  1521. #if !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
  1522. #else /* !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */ 
  1523. extern FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE];
  1524. #endif /* !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */ 
  1525. /* PMT dara added for Multitap thai */
  1526. #ifdef __MMI_MULTITAP_THAI__
  1527. //return 0 not accept input
  1528. //return 1 accept input
  1529. //return 2 normal
  1530. //return 3 means reset the MMI_active_multitap. not use
  1531. /*****************************************************************************
  1532.  * FUNCTION
  1533.  *  EMS_inputbox_check_multitap_thai_input
  1534.  * DESCRIPTION
  1535.  *  
  1536.  * PARAMETERS
  1537.  *  inputchar       [IN]        
  1538.  *  updatef         [?]         
  1539.  * RETURNS
  1540.  *  
  1541.  *****************************************************************************/
  1542. U8 EMS_inputbox_check_multitap_thai_input(UI_character_type inputchar, U8 *updatef)
  1543. {
  1544.     /*----------------------------------------------------------------*/
  1545.     /* Local Variables                                                */
  1546.     /*----------------------------------------------------------------*/
  1547.     EMSPosition p = MMI_EMS_inputbox.data->CurrentPosition;
  1548.     EMSObject *current_object;
  1549.     UI_character_type c;
  1550.     U8 r;
  1551.     UI_character_type cc;
  1552.     /*----------------------------------------------------------------*/
  1553.     /* Code Body                                                      */
  1554.     /*----------------------------------------------------------------*/
  1555.     r = gui_EMS_input_box_get_previous_object(MMI_EMS_inputbox.data, &p, &c, &current_object);
  1556.     if (r == 1) /* means that the previous is character */
  1557.     {
  1558.         if ((inputchar >= 0x0e34 && inputchar <= 0x0e39) || inputchar == 0x0e31)        /* Above Vowels and Below Vowels */
  1559.         {
  1560.             if (c == 0x0e30 || c == 0x0e32 || c == 0x0e33 || c == 0x0e46 || c == 0x0e2f || c == 0x0e3f ||
  1561.                 (c >= 0x0e40 && c <= 0x0e44) || c == 0x0030)
  1562.             {
  1563.                 if (c == 0x0030 && *updatef == 1)
  1564.                 {
  1565.                     MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_STATE_MULTITAP;
  1566.                     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1567.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1568.                     redraw_EMS_inputbox();
  1569.                     wgui_EMS_redraw_remaining_characters_display();
  1570.                     return 1;
  1571.                 }
  1572.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, 0x0030);
  1573.                 redraw_EMS_inputbox();
  1574.                 wgui_EMS_redraw_remaining_characters_display();
  1575.                 return 0;   /* not accept input */
  1576.             }
  1577.             else if ((c == 0x0e31 || (c >= 0x0e34 && c <= 0x0e39)))
  1578.             {   /* Above Vowels and Below Vowels */
  1579.                 if (*updatef == 0)
  1580.                 {
  1581.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, 0x0030);
  1582.                     redraw_EMS_inputbox();
  1583.                     wgui_EMS_redraw_remaining_characters_display();
  1584.                     return 0;
  1585.                 }
  1586.                 gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1587.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1588.                 redraw_EMS_inputbox();
  1589.                 wgui_EMS_redraw_remaining_characters_display();
  1590.                 return 1;
  1591.             }
  1592.             else if (c >= 0x0e47 && c <= 0x0e4c)
  1593.             {   /* tone */
  1594.                 if (*updatef == 0)
  1595.                 {
  1596.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, 0x0030);
  1597.                     redraw_EMS_inputbox();
  1598.                     wgui_EMS_redraw_remaining_characters_display();
  1599.                     return 0;
  1600.                 }
  1601.                 gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1602.                 if (c == 0x0e47)
  1603.                 {
  1604.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1605.                     redraw_EMS_inputbox();
  1606.                     wgui_EMS_redraw_remaining_characters_display();
  1607.                     return 1;
  1608.                 }
  1609.                 r = gui_EMS_input_box_get_previous_object(MMI_EMS_inputbox.data, &p, &cc, &current_object);
  1610.                 if (r == 1 && ((cc >= 0x0e34 && cc <= 0x0e39) || cc == 0x0e31))
  1611.                 {
  1612.                     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1613.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1614.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, c);
  1615.                     redraw_EMS_inputbox();
  1616.                     wgui_EMS_redraw_remaining_characters_display();
  1617.                 }
  1618.                 else
  1619.                 {
  1620.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1621.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, c);
  1622.                     redraw_EMS_inputbox();
  1623.                     wgui_EMS_redraw_remaining_characters_display();
  1624.                 }
  1625.                 return 1;
  1626.             }
  1627.             else if (c >= 0x0e01 && c <= 0x0e2e)
  1628.             {
  1629.                 /* msz00065_20051010 peng hua add for multitap thai begin */
  1630.                 if (gui_EMS_check_input_test_overflow(&MMI_EMS_inputbox, inputchar))
  1631.                     /* msz00065_20051010 peng hua add for multitap thai end */
  1632.                 {
  1633.                     *updatef = 1;
  1634.                 }
  1635.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1636.                 redraw_EMS_inputbox();
  1637.                 wgui_EMS_redraw_remaining_characters_display();
  1638.                 return 1;
  1639.             }
  1640.             else
  1641.             {
  1642.                 if (*updatef == 0)
  1643.                 {
  1644.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, 0x0030);
  1645.                     *updatef = 0;
  1646.                     redraw_EMS_inputbox();
  1647.                     wgui_EMS_redraw_remaining_characters_display();
  1648.                 }
  1649.                 return 0;
  1650.             }
  1651.         }
  1652.         else if (inputchar == 0x0030)
  1653.         {
  1654.             if (*updatef == 1)
  1655.             {
  1656.                 gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1657.                 /* redraw_EMS_inputbox(); */
  1658.                 return 2;
  1659.             }
  1660.         }
  1661.         else if (inputchar >= 0x0e47 && inputchar <= 0x0e4c)
  1662.         {
  1663.             if (c == 0x0e30 || c == 0x0e32 || c == 0x0e33 || c == 0x0e46 || c == 0x0e2f || c == 0x0e3f ||
  1664.                 (c >= 0x0e40 && c <= 0x0e44) || c == 0x0030)
  1665.             {
  1666.                 if ((c == 0x0e46 || c == 0x0e2f || c == 0x0e3f) && *updatef == 1)
  1667.                 {
  1668.                     MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_STATE_MULTITAP;
  1669.                     redraw_EMS_inputbox();
  1670.                     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1671.                     gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1672.                     redraw_EMS_inputbox();
  1673.                     wgui_EMS_redraw_remaining_characters_display();
  1674.                 }
  1675.                 return 1;   /* not accept input */
  1676.             }
  1677.             else if ((c >= 0x0e47 && c <= 0x0e4c))
  1678.             {   /* tone */
  1679.                 if (*updatef == 0)
  1680.                 {
  1681.                     return 1;
  1682.                 }
  1683.                 gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1684.                 if (inputchar == 0x0e47)    /*  */
  1685.                 {
  1686.                     r = gui_EMS_input_box_get_previous_object(MMI_EMS_inputbox.data, &p, &cc, &current_object);
  1687.                     if (r == 1 && ((cc >= 0x0e34 && cc <= 0x0e39) || cc == 0x0e31))
  1688.                     {
  1689.                         gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1690.                         gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1691.                         redraw_EMS_inputbox();
  1692.                         wgui_EMS_redraw_remaining_characters_display();
  1693.                         return 1;
  1694.                     }
  1695.                 }
  1696.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1697.                 redraw_EMS_inputbox();
  1698.                 wgui_EMS_redraw_remaining_characters_display();
  1699.                 return 1;
  1700.             }
  1701.             else if (c >= 0x0e01 && c <= 0x0e2e)
  1702.             {
  1703.                 /* msz00065_20051010 peng hua add for multitap thai begin */
  1704.                 if (gui_EMS_check_input_test_overflow(&MMI_EMS_inputbox, inputchar))
  1705.                     /* msz00065_20051010 peng hua add for multitap thai end */
  1706.                 {
  1707.                     *updatef = 1;
  1708.                 }
  1709.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1710.                 redraw_EMS_inputbox();
  1711.                 wgui_EMS_redraw_remaining_characters_display();
  1712.                 return 1;
  1713.             }
  1714.             else if ((c >= 0x0e34 && c <= 0x0e39) || c == 0x0e31)
  1715.             {
  1716.                 /* msz00065_20051010 peng hua add for multitap thai begin */
  1717.                 if (gui_EMS_check_input_test_overflow(&MMI_EMS_inputbox, inputchar))
  1718.                     /* msz00065_20051010 peng hua add for multitap thai end */
  1719.                 {
  1720.                     *updatef = 1;
  1721.                 }
  1722.                 if (inputchar == 0x0e47)    /*  */
  1723.                 {
  1724.                     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1725.                 }
  1726.                 gui_EMS_input_box_insert_character(&MMI_EMS_inputbox, inputchar);
  1727.                 redraw_EMS_inputbox();
  1728.                 wgui_EMS_redraw_remaining_characters_display();
  1729.                 return 1;
  1730.             }
  1731.             else
  1732.             {
  1733.                 if (*updatef == 1)
  1734.                 {
  1735.                     gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1736.                 }
  1737.                 return 1;
  1738.             }
  1739.         }
  1740.         if ((inputchar == 0x0e46 || inputchar == 0x0e2f || inputchar == 0x0e3f) && *updatef == 1)
  1741.         {
  1742.             gui_EMS_input_box_backspace(&MMI_EMS_inputbox);
  1743.             MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_STATE_MULTITAP;
  1744.             //                      gui_EMS_input_box_insert_character(&MMI_EMS_inputbox,inputchar);
  1745.             //                      redraw_EMS_inputbox();
  1746.             return 2;
  1747.         }
  1748.     }
  1749.     else    /* object */
  1750.     {
  1751.         if ((inputchar >= 0x0e34 && inputchar <= 0x0e39) || inputchar == 0x0e31)
  1752.         {
  1753.             return 0;
  1754.         }
  1755.         if (inputchar >= 0x0e47 && inputchar <= 0x0e4c)
  1756.         {
  1757.             return 0;
  1758.         }
  1759.     }
  1760.     return 2;
  1761. }
  1762. #endif /* __MMI_MULTITAP_THAI__ */ 
  1763. /*****************************************************************************
  1764.  * FUNCTION
  1765.  *  register_EMS_multitap_function
  1766.  * DESCRIPTION
  1767.  *  
  1768.  * PARAMETERS
  1769.  *  void
  1770.  * RETURNS
  1771.  *  void
  1772.  *****************************************************************************/
  1773. void register_EMS_multitap_function(void)
  1774. {
  1775.     /*----------------------------------------------------------------*/
  1776.     /* Local Variables                                                */
  1777.     /*----------------------------------------------------------------*/
  1778.     /*----------------------------------------------------------------*/
  1779.     /* Code Body                                                      */
  1780.     /*----------------------------------------------------------------*/
  1781.     /* W06.09 Touch Screen With Keypad V1 */
  1782. #if defined(__MMI_FULL_SCREEN_EDITOR__) || defined(__MMI_TOUCH_SCREEN__)
  1783.     register_multitap_no_draw_key_handlers();
  1784. #else 
  1785.     register_multitap_key_handlers();
  1786. #endif 
  1787.     register_keyboard_input_handler(EMS_inputbox_alphanumeric_keyboard_input_handler);
  1788.     set_multitap_functions(EMS_inputbox_multitap_input, EMS_inputbox_multitap_input_complete);
  1789.     wgui_set_EMS_inputbox_RSK();
  1790.     register_EMS_inputbox_keys();
  1791.     SetKeyHandler(wgui_EMS_inputbox_handle_symbol_picker_star_key, KEY_STAR, KEY_EVENT_DOWN);
  1792. }
  1793. /*****************************************************************************
  1794.  * FUNCTION
  1795.  *  register_EMS_inputbox_viewer_keys
  1796.  * DESCRIPTION
  1797.  *  
  1798.  * PARAMETERS
  1799.  *  void
  1800.  * RETURNS
  1801.  *  void
  1802.  *****************************************************************************/
  1803. void register_EMS_inputbox_viewer_keys(void)
  1804. {
  1805. #ifdef __MMI_MESSAGES_EMS__
  1806.     /*----------------------------------------------------------------*/
  1807.     /* Local Variables                                                */
  1808.     /*----------------------------------------------------------------*/
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Code Body                                                      */
  1811.     /*----------------------------------------------------------------*/
  1812.     SetKeyHandler(EMS_inputbox_previous_object, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1813.     SetKeyHandler(EMS_inputbox_next_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1814. #else /* __MMI_MESSAGES_EMS__ */ 
  1815.     SetKeyHandler(EMS_inputbox_previous, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1816.     SetKeyHandler(EMS_inputbox_next, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1817. #endif /* __MMI_MESSAGES_EMS__ */ 
  1818.     SetKeyHandler(EMS_inputbox_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1819.     SetKeyHandler(EMS_inputbox_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1820.     SetKeyHandler(EMS_inputbox_previous_line, KEY_VOL_UP, KEY_EVENT_DOWN);
  1821.     SetKeyHandler(EMS_inputbox_next_line, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1822.     register_keyboard_key_handler(EMS_inputbox_viewer_key_handler);
  1823. }
  1824. /*****************************************************************************
  1825.  * FUNCTION
  1826.  *  reset_EMS_inputbox
  1827.  * DESCRIPTION
  1828.  *  
  1829.  * PARAMETERS
  1830.  *  void
  1831.  * RETURNS
  1832.  *  void
  1833.  *****************************************************************************/
  1834. void reset_EMS_inputbox(void)
  1835. {
  1836. #if(UI_BLINKING_CURSOR_SUPPORT)
  1837.     /*----------------------------------------------------------------*/
  1838.     /* Local Variables                                                */
  1839.     /*----------------------------------------------------------------*/
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Code Body                                                      */
  1842.     /*----------------------------------------------------------------*/
  1843.     //gui_cancel_timer(UI_inputbox_blink_cursor);
  1844.     //MTK Elvis
  1845.     StopMyTimer(BLINKING_CURSOR);
  1846.     /* MTK end */
  1847. #endif /* (UI_BLINKING_CURSOR_SUPPORT) */ 
  1848. #ifdef __MMI_MESSAGES_EMS__
  1849.     EMS_cancel_object_focus();
  1850. #endif 
  1851.     reset_multitaps();
  1852.     clear_keyboard_key_handler();
  1853.     clear_keyboard_input_handler();
  1854.     clear_multitap_key_handlers();
  1855.     ClearKeyHandler(KEY_CLEAR, KEY_EVENT_DOWN);
  1856.     ClearKeyHandler(KEY_CLEAR, KEY_EVENT_UP);
  1857.     ClearKeyHandler(KEY_CLEAR, KEY_EVENT_LONG_PRESS);
  1858. #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
  1859.     gui_cancel_timer(wgui_EMS_inputbox_end_frame);
  1860.     wgui_EMS_inputbox_frame_counter = 0;
  1861. #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING)) */ 
  1862.     EMS_inputbox_input_callback = UI_dummy_function;
  1863. }
  1864. /*****************************************************************************
  1865.  * FUNCTION
  1866.  *  test_EMS_inputbox_change_mode
  1867.  * DESCRIPTION
  1868.  *  
  1869.  * PARAMETERS
  1870.  *  void
  1871.  * RETURNS
  1872.  *  
  1873.  *****************************************************************************/
  1874. U8 test_EMS_inputbox_change_mode(void)
  1875. {
  1876.     /*----------------------------------------------------------------*/
  1877.     /* Local Variables                                                */
  1878.     /*----------------------------------------------------------------*/
  1879.     /*----------------------------------------------------------------*/
  1880.     /* Code Body                                                      */
  1881.     /*----------------------------------------------------------------*/
  1882.     /* MTK Elvis */
  1883.     if (MMI_EMS_inputbox.UCS2_count == 0)
  1884.     {
  1885.         if (EMSSetDCS(MMI_EMS_inputbox.data, SMSAL_UCS2_DCS) == EMS_OK &&
  1886.             EMS_get_remaining_length(MMI_EMS_inputbox.data) >= 2)
  1887.         {
  1888.             EMSSetDCS(MMI_EMS_inputbox.data, SMSAL_DEFAULT_DCS);
  1889.             return 1;
  1890.         }
  1891.         else
  1892.         {
  1893.             EMSSetDCS(MMI_EMS_inputbox.data, SMSAL_DEFAULT_DCS);
  1894.             return 0;
  1895.         }
  1896.     }
  1897.     else
  1898.     {
  1899.         return 1;
  1900.     }
  1901.     /* MTK end */
  1902. }
  1903. /* Temporary data: for testing         */
  1904. #ifdef __MMI_MESSAGES_EMS__
  1905. const U8 EMS_sample_melody_object_PDU_1[] = 
  1906. {
  1907. #if(0)
  1908. EMS_PREDEFINED_MELODY, 0x69, 0x00,
  1909. 'B','E','G','I','N',':','I','M','E','L','O','D','Y','n',
  1910. 'V','E','R','S','I','O','N',':','1','.','2','n',
  1911. 'F','O','R','M','A','T',':','C','L','A','S','S','1','.','0','n',
  1912. 'M','E','L','O','D','Y',':','*','4','#','f','2','*','4','a','3','.','*','4','#','f','3','*','4','#','f','4','*','4','#','a','3','*','4','#','f','3','*','4','e','3','*','4','#','f','2','*','5','c','3','n',
  1913. 'E','N','D',':','I','M','E','L','O','D','Y','n',
  1914. #else /* (0) */ 
  1915.     EMS_PREDEFINED_MELODY, 0x74, 0x00,
  1916.     'B', 'E', 'G', 'I', 'N', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1917.     'V', 'E', 'R', 'S', 'I', 'O', 'N', ':', '1', '.', '2', 'n',
  1918.     'F', 'O', 'R', 'M', 'A', 'T', ':', 'C', 'L', 'A', 'S', 'S', '1', '.', '0', 'n',
  1919.     'B', 'E', 'A', 'T', ':', '1', '2', '0', 'n',
  1920.     'C', 'O', 'M', 'P', 'O', 'S', 'E', 'R', ':', 'M', 'T', 'K', '(', '2', ')', 'n',
  1921.     'M', 'E', 'L', 'O', 'D', 'Y', ':', 'c', '2', 'd', '2', 'e', '2', 'f', '2', 'g', '2', 'a', '2', 'b', '2', 'n',
  1922.     'E', 'N', 'D', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1923. #endif /* (0) */ 
  1924. };
  1925. const U8 EMS_sample_melody_object_PDU_2[] = {EMS_PREDEFINED_MELODY, 0x6c, 0x00,
  1926.     'B', 'E', 'G', 'I', 'N', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1927.     'V', 'E', 'R', 'S', 'I', 'O', 'N', ':', '1', '.', '2', 'n',
  1928.     'F', 'O', 'R', 'M', 'A', 'T', ':', 'C', 'L', 'A', 'S', 'S', '1', '.', '0', 'n',
  1929.     'M', 'E', 'L', 'O', 'D', 'Y', ':', '*', '5', 'f', '0', '*', '5', '#', 'g', '2', '*', '5', 'g', '3', '*', '5', '#',
  1930.         'd', '0', '*', '5', '#', 'g', '2', '*', '5', 'g', '3', '*', '5', 'c', '0', '*', '5', '#', 'g', '2', '*', '5',
  1931.         'g', '3', '*', '4', '#', 'g', '0', 'n',
  1932.     'E', 'N', 'D', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1933. };
  1934. const U8 EMS_sample_picture_object_PDU_1[] = {EMS_USERDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1935.     0x07, 0xE0, 0x08, 0x10, 0x30, 0x0C, 0x20, 0x04, 0x4E, 0x72, 0x9A, 0x59, 0x86, 0x61, 0x80, 0x01,
  1936.     0x80, 0x01, 0x90, 0x09, 0x88, 0x11, 0x47, 0xE2, 0x23, 0xC4, 0x30, 0x0C, 0x08, 0x10, 0x07, 0xE0,
  1937. };
  1938. #if(!ENABLE_EMS_TEST_OBJECTS)
  1939. const U8 EMS_sample_picture_object_PDU_2[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1940.     0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x03, 0xA0, 0x05, 0x90, 0x09, 0x88, 0x11, 0x8C, 0x31,
  1941.     0x93, 0xC9, 0xA0, 0x05, 0xC0, 0x03, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1942. };
  1943. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1944. const U8 EMS_sample_picture_object_PDU_2[] = {EMS_PREDEFINED_MELODY, 0x6a, 0x00,
  1945.     'B', 'E', 'G', 'I', 'N', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1946.     'V', 'E', 'R', 'S', 'I', 'O', 'N', ':', '1', '.', '2', 'n',
  1947.     'F', 'O', 'R', 'M', 'A', 'T', ':', 'C', 'L', 'A', 'S', 'S', '1', '.', '0', 'n',
  1948.     'M', 'E', 'L', 'O', 'D', 'Y', ':', '*', '4', '#', 'f', '2', '*', '4', 'a', '3', '.', '*', '4', '#', 'f', '3', '*',
  1949.         '4', '#', 'f', '4', '*', '4', '#', 'a', '3', '*', '4', '#', 'f', '3', '*', '4', 'e', '3', '*', '4', '#', 'f',
  1950.         '2', '*', '5', 'c', '3', 'n',
  1951.     'E', 'N', 'D', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1952. };
  1953. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1954. #if(!ENABLE_EMS_TEST_OBJECTS)
  1955. const U8 EMS_sample_picture_object_PDU_3[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1956.     0x01, 0x80, 0x03, 0xC0, 0x03, 0xC0, 0x07, 0xE0, 0x0F, 0xF0, 0x1F, 0xF8, 0x3F, 0xFC, 0x3F, 0xFC,
  1957.     0x7F, 0xFE, 0x7F, 0xFE, 0x7F, 0xFE, 0x3D, 0xBC, 0x19, 0x98, 0x01, 0x80, 0x01, 0x80, 0x07, 0xE0,
  1958. };
  1959. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1960. const U8 EMS_sample_picture_object_PDU_3[] = {EMS_PREDEFINED_ANIMATION, 0x01,
  1961. };
  1962. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1963. #if(!ENABLE_EMS_TEST_OBJECTS)
  1964. const U8 EMS_sample_picture_object_PDU_4[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1965.     0x07, 0xE0, 0x08, 0x10, 0x30, 0x0C, 0x20, 0x04, 0x5C, 0x3A, 0x86, 0x61, 0x86, 0x61, 0x80, 0x01,
  1966.     0x80, 0x01, 0x81, 0xC1, 0x82, 0x21, 0x44, 0x12, 0x20, 0x04, 0x30, 0x0C, 0x08, 0x10, 0x07, 0xE0,
  1967. };
  1968. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1969. const U8 EMS_sample_picture_object_PDU_4[] = {EMS_PREDEFINED_MELODY, 0x6c, 0x00,
  1970.     'B', 'E', 'G', 'I', 'N', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1971.     'V', 'E', 'R', 'S', 'I', 'O', 'N', ':', '1', '.', '2', 'n',
  1972.     'F', 'O', 'R', 'M', 'A', 'T', ':', 'C', 'L', 'A', 'S', 'S', '1', '.', '0', 'n',
  1973.     'M', 'E', 'L', 'O', 'D', 'Y', ':', '*', '5', 'f', '0', '*', '5', '#', 'g', '2', '*', '5', 'g', '3', '*', '5', '#',
  1974.         'd', '0', '*', '5', '#', 'g', '2', '*', '5', 'g', '3', '*', '5', 'c', '0', '*', '5', '#', 'g', '2', '*', '5',
  1975.         'g', '3', '*', '4', '#', 'g', '0', 'n',
  1976.     'E', 'N', 'D', ':', 'I', 'M', 'E', 'L', 'O', 'D', 'Y', 'n',
  1977. };
  1978. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1979. const U8 EMS_sample_picture_object_PDU_5[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x18, 0x00, 0x18, 0x00, 0x48, 0x00,
  1980.     0x05, 0x80, 0x00, 0x10, 0x60, 0x00, 0x42, 0x1D, 0xC0, 0x80, 0x06, 0x30, 0x00, 0x29, 0x8C, 0x98,
  1981.     0x02, 0xA2, 0x9E, 0x00, 0xB5, 0x9F, 0x82, 0x77, 0x1F, 0xE1, 0x5B, 0x9F, 0xF9, 0x75, 0x9F, 0xF9,
  1982.     0x5B, 0x1F, 0xF9, 0x75, 0x9F, 0xF9, 0x5B, 0x9F, 0xF9, 0x77, 0x1F, 0xF9, 0x5B, 0xC7, 0xF9, 0x75,
  1983.     0xA1, 0xF9, 0xBA, 0x38, 0x78, 0xDC, 0x0E, 0x1A, 0xB8, 0x03, 0x81, 0x70, 0x00, 0xF1, 0x50, 0x00,
  1984.     0x3D, 0x70, 0x00, 0x0E, 0xE0, 0x00, 0x03, 0x80,
  1985. };
  1986. #if(!ENABLE_EMS_TEST_OBJECTS)
  1987. const U8 EMS_sample_picture_object_PDU_6[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1988.     0x07, 0xE0, 0x08, 0x10, 0x30, 0x0C, 0x26, 0x64, 0x48, 0x12, 0x90, 0x09, 0x86, 0x61, 0x86, 0x61,
  1989.     0x80, 0x01, 0x83, 0xC1, 0x87, 0xE1, 0x47, 0xE2, 0x23, 0xC4, 0x30, 0x0C, 0x08, 0x10, 0x07, 0xE0,
  1990. };
  1991. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1992. const U8 EMS_sample_picture_object_PDU_6[] = {EMS_PREDEFINED_SOUND, 0x01,
  1993. };
  1994. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  1995. #if(!ENABLE_EMS_TEST_OBJECTS)
  1996. const U8 EMS_sample_picture_object_PDU_7[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  1997.     0x07, 0xE0, 0x08, 0x10, 0x30, 0x0C, 0x2C, 0x64, 0x52, 0x92, 0x96, 0xB1, 0x8C, 0x61, 0x80, 0x01,
  1998.     0xBF, 0xFD, 0xA9, 0x25, 0x99, 0x29, 0x59, 0x2A, 0x29, 0x34, 0x37, 0xEC, 0x08, 0x10, 0x07, 0xE0,
  1999. };
  2000. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2001. const U8 EMS_sample_picture_object_PDU_7[] = {EMS_PREDEFINED_ANIMATION, 0x02,
  2002. };
  2003. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2004. #if(!ENABLE_EMS_TEST_OBJECTS)
  2005. const U8 EMS_sample_picture_object_PDU_8[] = {0x01, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  2006.     0x03, 0xC0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x19, 0x98, 0x3D, 0xBC,
  2007.     0x7F, 0xFE, 0x7F, 0xFE, 0x7F, 0xFE, 0x3D, 0xBC, 0x19, 0x98, 0x01, 0x80, 0x01, 0x80, 0x07, 0xE0,
  2008. };
  2009. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2010. const U8 EMS_sample_picture_object_PDU_8[] = {EMS_USERDEFINED_ANIMATION, 0x01, 0x08, 0x00, 0x08, 0x00, 0x20, 0x00,
  2011.     0xFF, 0x81, 0x81, 0x81, 0xF1, 0xD1, 0xF1, 0xFF,
  2012.     0xFF, 0x81, 0x81, 0x81, 0x8F, 0x8B, 0x8F, 0xFF,
  2013.     0xFF, 0x8F, 0x8B, 0x8F, 0x81, 0x81, 0x81, 0xFF,
  2014.     0xFF, 0xF1, 0xD1, 0xF1, 0x81, 0x81, 0x81, 0xFF,
  2015. };
  2016. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2017. #if(!ENABLE_EMS_TEST_OBJECTS)
  2018. const U8 EMS_sample_picture_object_PDU_9[] = {0x01, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  2019.     0x07, 0xE0, 0x08, 0x10, 0x30, 0x0C, 0x20, 0x04, 0x79, 0xCE, 0xBF, 0xF9, 0xB9, 0xC1, 0x80, 0x01,
  2020.     0x80, 0x01, 0x9F, 0x01, 0x9F, 0x81, 0x4F, 0xC2, 0x27, 0xC4, 0x30, 0x0C, 0x08, 0x10, 0x07, 0xE0,
  2021. };
  2022. #else /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2023. const U8 EMS_sample_picture_object_PDU_9[] = {EMS_USERDEFINED_ANIMATION, 0x01, 0x10, 0x00, 0x10, 0x00, 0x80, 0x00,
  2024.     0x0F, 0xF8, 0x0F, 0xF8, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x02, 0x20, 0x01, 0x40,
  2025.     0x01, 0x40, 0x02, 0x20, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x0F, 0xF8, 0x0F, 0xF8,
  2026.     0x06, 0x00, 0x0E, 0x00, 0x1F, 0x00, 0x38, 0x80, 0x70, 0x40, 0xE0, 0x40, 0x60, 0x40, 0x10, 0x40,
  2027.     0x0F, 0x3C, 0x00, 0x82, 0x00, 0x81, 0x00, 0x83, 0x00, 0x87, 0x00, 0x4E, 0x00, 0x3C, 0x00, 0x38,
  2028.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0xFC, 0x3F, 0xC2, 0x43, 0xC1, 0x83, 0xC0, 0x03,
  2029.     0xC1, 0x83, 0xC2, 0x43, 0xFC, 0x3F, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  2030.     0x00, 0x38, 0x00, 0x3C, 0x00, 0x4E, 0x00, 0x87, 0x00, 0x83, 0x00, 0x81, 0x00, 0x82, 0x0F, 0x3C,
  2031.     0x10, 0x40, 0x60, 0x40, 0xE0, 0x40, 0x70, 0x40, 0x38, 0x80, 0x1F, 0x00, 0x0E, 0x00, 0x06, 0x00,
  2032. };
  2033. #endif /* (!ENABLE_EMS_TEST_OBJECTS) */ 
  2034. const U8 EMS_sample_picture_object_PDU_10[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x20, 0x00, 0x20, 0x00, 0x80, 0x00,
  2035.     0x00, 0xFE, 0x00, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x3F, 0xFF, 0x70, 0x00, 0x7F, 0xFF, 0x8E, 0x00,
  2036.     0x47, 0xFF, 0xC1, 0xC0, 0x40, 0xFF, 0xE0, 0x38, 0x40, 0x1F, 0xF0, 0x06, 0x40, 0x03, 0xF8, 0x02,
  2037.     0x40, 0x00, 0x7C, 0x0E, 0x40, 0x00, 0x0E, 0x3E, 0x40, 0x00, 0x00, 0xFE, 0x20, 0x78, 0x03, 0xFC,
  2038.     0x22, 0x1D, 0x03, 0xFC, 0x27, 0x0F, 0x03, 0xFC, 0x2F, 0x87, 0x03, 0xFC, 0x23, 0xCF, 0x07, 0xF8,
  2039.     0x23, 0x03, 0x07, 0xF8, 0x13, 0x00, 0x07, 0xF8, 0x11, 0x00, 0x07, 0xF8, 0x11, 0x08, 0x8F, 0xF0,
  2040.     0x10, 0x88, 0x8F, 0xF0, 0x10, 0x59, 0x8F, 0xF0, 0x08, 0x3F, 0x8F, 0xE0, 0x08, 0x1F, 0x1F, 0xE0,
  2041.     0x08, 0x0C, 0x1F, 0xE0, 0x04, 0x02, 0x1F, 0xE0, 0x03, 0x00, 0x1F, 0xC0, 0x00, 0xC0, 0x1F, 0xC0,
  2042.     0x00, 0x30, 0x3F, 0xC0, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0x03, 0x3C, 0x00, 0x00, 0x00, 0xF0, 0x00,
  2043. };
  2044. const U8 EMS_sample_picture_object_PDU_11[] = {0x01, 0x01, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00,
  2045.     0x00, 0x00, 0x1F, 0xF8, 0x20, 0x06, 0x26, 0x66, 0x23, 0xC6, 0x21, 0x86, 0x23, 0xC6, 0x26, 0x66,
  2046.     0x20, 0x06, 0x20, 0x06, 0x2A, 0xAE, 0x20, 0x06, 0x35, 0x56, 0x2A, 0xAE, 0x3F, 0xFE, 0x1F, 0xFC,
  2047. };
  2048. const U8 EMS_sample_animation_object_PDU_11[] = {EMS_USERDEFINED_ANIMATION, 0x01, 0x08, 0x00, 0x08, 0x00, 0x20, 0x00,
  2049.     0xFF, 0x81, 0x81, 0x81, 0xF1, 0xD1, 0xF1, 0xFF,
  2050.     0xFF, 0x81, 0x81, 0x81, 0x8F, 0x8B, 0x8F, 0xFF,
  2051.     0xFF, 0x8F, 0x8B, 0x8F, 0x81, 0x81, 0x81, 0xFF,
  2052.     0xFF, 0xF1, 0xD1, 0xF1, 0x81, 0x81, 0x81, 0xFF,
  2053. };
  2054. #define MAX_EMS_PREDEFINED_PICTURES    10
  2055. #if(ENABLE_EMS_TEST_OBJECTS)
  2056. /* Temporary: Needs to populated with actual picture data   */
  2057. U8 *EMS_predefined_pictures[MAX_EMS_PREDEFINED_PICTURES] = { (U8 *) EMS_sample_picture_object_PDU_1,
  2058.     (U8 *) EMS_sample_picture_object_PDU_2,
  2059.     (U8 *) EMS_sample_picture_object_PDU_3,
  2060.     (U8 *) EMS_sample_picture_object_PDU_4,
  2061.     (U8 *) EMS_sample_picture_object_PDU_5,
  2062.     (U8 *) EMS_sample_picture_object_PDU_6,
  2063.     (U8 *) EMS_sample_picture_object_PDU_7,
  2064.     (U8 *) EMS_sample_picture_object_PDU_8,
  2065.     (U8 *) EMS_sample_picture_object_PDU_9,
  2066.     (U8 *) EMS_sample_picture_object_PDU_10,
  2067. };
  2068. #else /* (ENABLE_EMS_TEST_OBJECTS) */ 
  2069. /* This gets populated at run time with picture data     */
  2070. U8 *EMS_predefined_pictures[MAX_EMS_PREDEFINED_PICTURES] = { (U8 *) EMS_sample_picture_object_PDU_11,
  2071.     (U8 *) EMS_sample_picture_object_PDU_11,
  2072.     (U8 *) EMS_sample_picture_object_PDU_11,
  2073.     (U8 *) EMS_sample_picture_object_PDU_11,
  2074.     (U8 *) EMS_sample_picture_object_PDU_11,
  2075.     (U8 *) EMS_sample_picture_object_PDU_11,
  2076.     (U8 *) EMS_sample_picture_object_PDU_11,
  2077.     (U8 *) EMS_sample_picture_object_PDU_11,
  2078.     (U8 *) EMS_sample_picture_object_PDU_11,
  2079.     (U8 *) EMS_sample_picture_object_PDU_11,
  2080. };
  2081. #endif /* (ENABLE_EMS_TEST_OBJECTS) */ 
  2082. U16 EMS_predefined_images[MAX_EMS_PREDEFINED_PICTURES] = {IMG_EMS01_PIC,
  2083.     IMG_EMS02_PIC,
  2084.     IMG_EMS03_PIC,
  2085.     IMG_EMS04_PIC,
  2086.     IMG_EMS05_PIC,
  2087.     IMG_EMS06_PIC,
  2088.     IMG_EMS07_PIC,
  2089.     IMG_EMS08_PIC,
  2090.     IMG_EMS09_PIC,
  2091.     IMG_EMS010_PIC
  2092. };
  2093. #define MAX_EMS_PREDEFINED_ANIMATIONS  15
  2094. U16 EMS_predefined_animations[MAX_EMS_PREDEFINED_ANIMATIONS] = {EMS_BI_ANIMATION_0_ID,
  2095.     EMS_BI_ANIMATION_1_ID,
  2096.     EMS_BI_ANIMATION_2_ID,
  2097.     EMS_BI_ANIMATION_3_ID,
  2098.     EMS_BI_ANIMATION_4_ID,
  2099.     EMS_BI_ANIMATION_5_ID,
  2100.     EMS_BI_ANIMATION_6_ID,
  2101.     EMS_BI_ANIMATION_7_ID,
  2102.     EMS_BI_ANIMATION_8_ID,
  2103.     EMS_BI_ANIMATION_9_ID,
  2104.     EMS_BI_ANIMATION_10_ID,
  2105.     EMS_BI_ANIMATION_11_ID,
  2106.     EMS_BI_ANIMATION_12_ID,
  2107.     EMS_BI_ANIMATION_13_ID,
  2108.     EMS_BI_ANIMATION_14_ID,
  2109. };
  2110. #define MAX_EMS_PREDEFINED_SOUNDS      10
  2111. /* Temporary: Needs to be populated with the actual sound IDs  */
  2112. U16 EMS_predefined_sounds[MAX_EMS_PREDEFINED_SOUNDS] = 
  2113. {
  2114.     EMS_CHIMES_HIGH,
  2115.     EMS_CHIMES_LOW,
  2116.     EMS_DING,
  2117.     EMS_TADA,
  2118.     EMS_NOTIFY,
  2119.     EMS_DRUM,
  2120.     EMS_CLAPS,
  2121.     EMS_FANFAR,
  2122.     EMS_CHORE_HGH,
  2123.     EMS_CHORE_LOW,
  2124. };
  2125. #define MAX_EMS_PREDEFINED_MELODIES    10
  2126. /* Temporary: Needs to be populated with the actual melody data   */
  2127. U8 *EMS_predefined_melodies[MAX_EMS_PREDEFINED_MELODIES] = 
  2128. {
  2129.     (U8 *) EMS_sample_melody_object_PDU_1,
  2130.     (U8 *) EMS_sample_melody_object_PDU_2,
  2131.     (U8 *) EMS_sample_melody_object_PDU_1,
  2132.     (U8 *) EMS_sample_melody_object_PDU_2,
  2133.     (U8 *) EMS_sample_melody_object_PDU_1,
  2134.     (U8 *) EMS_sample_melody_object_PDU_2,
  2135.     (U8 *) EMS_sample_melody_object_PDU_1,
  2136.     (U8 *) EMS_sample_melody_object_PDU_2,
  2137.     (U8 *) EMS_sample_melody_object_PDU_1,
  2138.     (U8 *) EMS_sample_melody_object_PDU_2,
  2139. };
  2140. /* data used for EMS_USERDEFINED_PICTURE, EMS_USERDEFINED_ANIMATION, EMS_USER_DEFINED_MELODY
  2141.    index used for EMS_PREDEFINED_PICTURE, EMS_PREDEFINED_MELODY.
  2142.    If index==-1, data is used for EMS_PREDEFINED_PICTURE, EMS_PREDEFINED_MELODY. */
  2143. /*****************************************************************************
  2144.  * FUNCTION
  2145.  *  EMS_load_object
  2146.  * DESCRIPTION
  2147.  *  
  2148.  * PARAMETERS
  2149.  *  type        [IN]        
  2150.  *  data        [?]         
  2151.  *  index       [IN]        
  2152.  *  object      [?]         
  2153.  * RETURNS
  2154.  *  
  2155.  *****************************************************************************/
  2156. EMSTATUS EMS_load_object(U32 type, U8 *data, S32 index, EMSObjData *object)
  2157. {
  2158.     /*----------------------------------------------------------------*/
  2159.     /* Local Variables                                                */
  2160.     /*----------------------------------------------------------------*/
  2161.     U8 ID;
  2162.     /*----------------------------------------------------------------*/
  2163.     /* Code Body                                                      */
  2164.     /*----------------------------------------------------------------*/
  2165.     switch (type & 0xff)
  2166.     {
  2167.         case EMS_PREDEFINED_PICTURE:
  2168.         {
  2169.             if ((index >= MAX_EMS_PREDEFINED_PICTURES))
  2170.             {
  2171.                 return (EMS_INVALID_OBJECT);
  2172.             }
  2173.             if (index >= 0)
  2174.             {
  2175.                 data = EMS_predefined_pictures[index];
  2176.             }
  2177.             if (data == NULL)
  2178.             {
  2179.                 return (EMS_NULL_POINTER);
  2180.             }
  2181.             ID = data[0];
  2182.             if (ID == EMS_PREDEFINED_PICTURE)
  2183.             {
  2184.                 object->picture.bitsPerPixel = data[1];
  2185.                 object->picture.attribute = data[2];
  2186.                 object->picture.hDim = data[3] | (data[4] << 8);
  2187.                 object->picture.vDim = data[5] | (data[6] << 8);
  2188.                 object->picture.pdu_length = data[7] | (data[8] << 8);
  2189.                 data += 9;
  2190.                 object->picture.pdu = data;
  2191.             #ifdef __EMS_REL5__
  2192.                 if ((object->picture.hDim == 0) || (object->picture.vDim == 0)
  2193.                     || (object->picture.pdu_length == 0) || (object->picture.attribute == 1))
  2194.             #else /* __EMS_REL5__ */ 
  2195.                 if ((object->picture.hDim == 0) || (object->picture.vDim == 0)
  2196.                     || (object->picture.pdu_length == 0) || (object->picture.pdu_length > EMS_MAX_IMELODY_SIZE))
  2197.             #endif /* __EMS_REL5__ */ 
  2198.                     return (EMS_INVALID_OBJECT);
  2199.             }
  2200.             else
  2201.             {
  2202.                 return (EMS_INVALID_OBJECT);
  2203.             }
  2204.         }
  2205.             break;
  2206.         case EMS_USERDEFINED_PICTURE:
  2207.         {
  2208.             if (data == NULL)
  2209.             {
  2210.                 return (EMS_NULL_POINTER);
  2211.             }
  2212.             ID = data[0];
  2213.             if (ID == EMS_USERDEFINED_PICTURE)
  2214.             {
  2215.                 object->picture.bitsPerPixel = data[1];
  2216.                 object->picture.attribute = data[2];
  2217.                 object->picture.hDim = data[3] | (data[4] << 8);
  2218.                 object->picture.vDim = data[5] | (data[6] << 8);
  2219.                 object->picture.pdu_length = data[7] | (data[8] << 8);
  2220.                 data += 9;
  2221.                 object->picture.pdu = data;
  2222.             #ifdef __EMS_REL5__
  2223.                 if ((object->picture.hDim == 0) || (object->picture.vDim == 0)
  2224.                     || (object->picture.pdu_length == 0) || (object->picture.attribute == 1))
  2225.             #else /* __EMS_REL5__ */ 
  2226.                 if ((object->picture.hDim == 0) || (object->picture.vDim == 0)
  2227.                     || (object->picture.pdu_length == 0) || (object->picture.pdu_length > EMS_MAX_IMELODY_SIZE))
  2228.             #endif /* __EMS_REL5__ */ 
  2229.                     return (EMS_INVALID_OBJECT);
  2230.             }
  2231.             else
  2232.             {
  2233.                 return (EMS_INVALID_OBJECT);
  2234.             }
  2235.         }
  2236.             break;
  2237.         case EMS_USERDEFINED_ANIMATION:
  2238.         {
  2239.             if (data == NULL)
  2240.             {
  2241.                 return (EMS_NULL_POINTER);
  2242.             }
  2243.             ID = data[0];
  2244.             if (ID == EMS_USERDEFINED_ANIMATION)
  2245.             {
  2246.                 object->animation.bitsPerPixel = data[1];
  2247.                 object->animation.attribute = data[2];
  2248.                 object->animation.cFrame = data[3];
  2249.                 object->animation.cRepeat = data[4];
  2250.                 object->animation.Duration = data[5];
  2251.                 object->animation.hDim = data[6] | (data[7] << 8);
  2252.                 object->animation.vDim = data[8] | (data[9] << 8);
  2253.                 object->animation.pdu_length = data[10] | (data[11] << 8);
  2254.                 data += 12;
  2255.                 object->animation.pdu = data;
  2256.             #ifdef __EMS_REL5__
  2257.                 if ((object->animation.hDim == 0) || (object->animation.vDim == 0)
  2258.                     || (object->animation.pdu_length == 0)
  2259.                     || (object->animation.attribute == 1) || (object->animation.cFrame == 0))
  2260.             #else /* __EMS_REL5__ */ 
  2261.                 if ((object->animation.hDim == 0) || (object->animation.vDim == 0)
  2262.                     || (object->animation.pdu_length == 0) || (object->animation.pdu_length > EMS_MAX_IMELODY_SIZE))
  2263.             #endif /* __EMS_REL5__ */ 
  2264.                     return (EMS_INVALID_OBJECT);
  2265.             }
  2266.             else
  2267.             {
  2268.                 return (EMS_INVALID_OBJECT);
  2269.             }
  2270.         }
  2271.             break;
  2272.             /* MTK Joy added for customization, 1014 */
  2273.     #if defined(__MMI_IMELODY_SUPPORT__)
  2274.         case EMS_PREDEFINED_MELODY:
  2275.         {
  2276.             if ((index >= MAX_EMS_PREDEFINED_MELODIES))
  2277.             {
  2278.                 return (EMS_INVALID_OBJECT);
  2279.             }
  2280.             if (index >= 0)
  2281.             {
  2282.                 data = EMS_predefined_melodies[index];
  2283.             }
  2284.             if (data == NULL)
  2285.             {
  2286.                 return (EMS_NULL_POINTER);
  2287.             }
  2288.             ID = data[0];
  2289.             if (ID == EMS_PREDEFINED_MELODY)
  2290.             {
  2291.                 object->sound.attribute = data[1];
  2292.                 object->sound.pdu_length = data[2] | (data[3] << 8);
  2293.                 data += 4;
  2294.                 object->sound.pdu = data;
  2295.             #ifdef __EMS_REL5__
  2296.                 if ((object->sound.pdu_length == 0) || (object->sound.attribute == 1))
  2297.             #else 
  2298.                 if ((object->sound.pdu_length == 0) || (object->sound.pdu_length > EMS_MAX_IMELODY_SIZE))
  2299.             #endif 
  2300.                     return (EMS_INVALID_OBJECT);
  2301.             }
  2302.             else
  2303.             {
  2304.                 return (EMS_INVALID_OBJECT);
  2305.             }
  2306.         }
  2307.             break;
  2308.         case EMS_USERDEFINED_MELODY:
  2309.         {
  2310.             if (data == NULL)
  2311.             {
  2312.                 return (EMS_NULL_POINTER);
  2313.             }
  2314.             ID = data[0];
  2315.             if (ID == EMS_USERDEFINED_MELODY)
  2316.             {
  2317.                 object->sound.attribute = data[1];
  2318.                 object->sound.pdu_length = data[2] | (data[3] << 8);
  2319.                 data += 4;
  2320.                 object->sound.pdu = data;
  2321.             #ifdef __EMS_REL5__
  2322.                 if ((object->sound.pdu_length == 0) || (object->sound.attribute == 1))
  2323.             #else 
  2324.                 if ((object->sound.pdu_length == 0) || (object->sound.pdu_length > EMS_MAX_IMELODY_SIZE))
  2325.             #endif 
  2326.                     return (EMS_INVALID_OBJECT);
  2327.             }
  2328.             else
  2329.             {
  2330.                 return (EMS_INVALID_OBJECT);
  2331.             }
  2332.         }
  2333.             break;
  2334.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  2335.             /* MTK end */
  2336.     }
  2337.     return (EMS_OK);
  2338. }
  2339. #if(ENABLE_EMS_TEST_DEMO || ENABLE_EMS_TEST_OBJECTS)    /* test_block  */
  2340. #define MAX_EMS_TEST_OBJECTS  10
  2341. U8 EMS_test_object_count = 0;
  2342. U8 *EMS_test_objects[MAX_EMS_TEST_OBJECTS] = { (U8 *) EMS_sample_picture_object_PDU_1,
  2343.     (U8 *) EMS_sample_picture_object_PDU_2,
  2344.     (U8 *) EMS_sample_picture_object_PDU_3,
  2345.     (U8 *) EMS_sample_picture_object_PDU_4,
  2346.     (U8 *) EMS_sample_picture_object_PDU_5,
  2347.     (U8 *) EMS_sample_picture_object_PDU_6,
  2348.     (U8 *) EMS_sample_picture_object_PDU_7,
  2349.     (U8 *) EMS_sample_picture_object_PDU_8,
  2350.     (U8 *) EMS_sample_picture_object_PDU_9,
  2351.     (U8 *) EMS_sample_picture_object_PDU_10,
  2352. };
  2353. #endif /* (ENABLE_EMS_TEST_DEMO || ENABLE_EMS_TEST_OBJECTS) */ 
  2354. #if(ENABLE_EMS_TEST_DEMO)       /* test_block  */
  2355. /*****************************************************************************
  2356.  * FUNCTION
  2357.  *  EMS_inputbox_insert_object
  2358.  * DESCRIPTION
  2359.  *  
  2360.  * PARAMETERS
  2361.  *  void
  2362.  * RETURNS
  2363.  *  void
  2364.  *****************************************************************************/
  2365. void EMS_inputbox_insert_object(void)
  2366. {
  2367.     /*----------------------------------------------------------------*/
  2368.     /* Local Variables                                                */
  2369.     /*----------------------------------------------------------------*/
  2370.     EMSObjData object;
  2371.     EMSTATUS ret;
  2372.     U8 *data;
  2373.     U8 ID;
  2374.     S32 index = EMS_test_object_count++;
  2375.     /*----------------------------------------------------------------*/
  2376.     /* Code Body                                                      */
  2377.     /*----------------------------------------------------------------*/
  2378.     if (EMS_test_object_count > 9)
  2379.     {
  2380.         EMS_test_object_count = 0;
  2381.     }
  2382.     data = EMS_test_objects[index];
  2383.     ID = data[0];
  2384.     switch (ID)
  2385.     {
  2386.         case EMS_PREDEFINED_PICTURE:
  2387.         case EMS_USERDEFINED_PICTURE:
  2388.             ret = EMS_load_object(EMS_PREDEFINED_PICTURE, data, index, &object);
  2389.             if (ret == EMS_OK)
  2390.             {
  2391.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PIC, &object, 0);
  2392.             }
  2393.             break;
  2394.         case EMS_USERDEFINED_ANIMATION:
  2395.             ret = EMS_load_object(EMS_USERDEFINED_ANIMATION, data, index, &object);
  2396.             if (ret == EMS_OK)
  2397.             {
  2398.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_USERDEF_ANM, &object, 0);
  2399.             }
  2400.             break;
  2401.         case EMS_PREDEFINED_ANIMATION:
  2402.             ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PREDEF_ANM, NULL, data[1]);
  2403.             break;
  2404.         case EMS_PREDEFINED_SOUND:
  2405.             ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PREDEF_SND, NULL, data[1]);
  2406.             break;
  2407.         case EMS_PREDEFINED_MELODY:
  2408.             ret = EMS_load_object(EMS_PREDEFINED_MELODY, data, index, &object);
  2409.             if (ret == EMS_OK)
  2410.             {
  2411.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_USERDEF_SND, &object, 0);
  2412.             }
  2413.             break;
  2414.     }
  2415.     /* show_EMS_inputbox(); */
  2416. }
  2417. #endif /* (ENABLE_EMS_TEST_DEMO) */ 
  2418. #if(ENABLE_EMS_TEST_OBJECTS)
  2419. /*****************************************************************************
  2420.  * FUNCTION
  2421.  *  EMS_inputbox_insert_predefined_picture
  2422.  * DESCRIPTION
  2423.  *  
  2424.  * PARAMETERS
  2425.  *  index       [IN]        
  2426.  * RETURNS
  2427.  *  
  2428.  *****************************************************************************/
  2429. EMSTATUS EMS_inputbox_insert_predefined_picture(S32 index)
  2430. {
  2431.     /*----------------------------------------------------------------*/
  2432.     /* Local Variables                                                */
  2433.     /*----------------------------------------------------------------*/
  2434.     EMSObjData object;
  2435.     EMSTATUS ret;
  2436.     U8 *data;
  2437.     U8 ID;
  2438.     /*----------------------------------------------------------------*/
  2439.     /* Code Body                                                      */
  2440.     /*----------------------------------------------------------------*/
  2441.     if (index < 0)
  2442.     {
  2443.         index = 0;
  2444.     }
  2445.     if (index > (MAX_EMS_TEST_OBJECTS - 1))
  2446.     {
  2447.         index = MAX_EMS_TEST_OBJECTS - 1;
  2448.     }
  2449.     data = EMS_test_objects[index];
  2450.     ID = data[0];
  2451.     switch (ID)
  2452.     {
  2453.         case EMS_PREDEFINED_PICTURE:
  2454.         case EMS_USERDEFINED_PICTURE:
  2455.             ret = EMS_load_object(EMS_PREDEFINED_PICTURE, data, index, &object);
  2456.             if (ret == EMS_OK)
  2457.             {
  2458.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PIC, &object, 0);
  2459.             }
  2460.             break;
  2461.         case EMS_USERDEFINED_ANIMATION:
  2462.             ret = EMS_load_object(EMS_USERDEFINED_ANIMATION, data, index, &object);
  2463.             if (ret == EMS_OK)
  2464.             {
  2465.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_USERDEF_ANM, &object, 0);
  2466.             }
  2467.             break;
  2468.         case EMS_PREDEFINED_ANIMATION:
  2469.             ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PREDEF_ANM, NULL, data[1]);
  2470.             break;
  2471.         case EMS_PREDEFINED_SOUND:
  2472.             ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PREDEF_SND, NULL, data[1]);
  2473.             break;
  2474.         case EMS_PREDEFINED_MELODY:
  2475.             ret = EMS_load_object(EMS_PREDEFINED_MELODY, data, index, &object);
  2476.             if (ret == EMS_OK)
  2477.             {
  2478.                 ret = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_USERDEF_SND, &object, 0);
  2479.             }
  2480.             break;
  2481.     }
  2482.     return (ret);
  2483. }
  2484. #else /* (ENABLE_EMS_TEST_OBJECTS) */ 
  2485. /*****************************************************************************
  2486.  * FUNCTION
  2487.  *  EMS_inputbox_insert_predefined_picture
  2488.  * DESCRIPTION
  2489.  *  
  2490.  * PARAMETERS
  2491.  *  index       [IN]        
  2492.  * RETURNS
  2493.  *  
  2494.  *****************************************************************************/
  2495. EMSTATUS EMS_inputbox_insert_predefined_picture(S32 index)
  2496. {
  2497.     /*----------------------------------------------------------------*/
  2498.     /* Local Variables                                                */
  2499.     /*----------------------------------------------------------------*/
  2500.     EMSObjData object;
  2501.     U8 *data = NULL;
  2502.     EMSTATUS r = EMS_load_object(EMS_PREDEFINED_PICTURE, data, index, &object);
  2503.     /*----------------------------------------------------------------*/
  2504.     /* Code Body                                                      */
  2505.     /*----------------------------------------------------------------*/
  2506.     if (r == EMS_OK)
  2507.     {
  2508.         r = gui_EMS_inputbox_add_object(&MMI_EMS_inputbox, EMS_TYPE_PIC, &object, 0);
  2509.     }
  2510.     return (r);
  2511. }
  2512. #endif /* (ENABLE_EMS_TEST_OBJECTS) */ 
  2513. /*****************************************************************************
  2514.  * FUNCTION
  2515.  *  EMS_get_object_size
  2516.  * DESCRIPTION
  2517.  *  
  2518.  * PARAMETERS
  2519.  *  type        [IN]        
  2520.  *  objdata     [?]         
  2521.  * RETURNS
  2522.  *  
  2523.  *****************************************************************************/
  2524. S32 EMS_get_object_size(U8 type, EMSObjData *objdata)
  2525. {
  2526.     /*----------------------------------------------------------------*/
  2527.     /* Local Variables                                                */
  2528.     /*----------------------------------------------------------------*/
  2529.     /*----------------------------------------------------------------*/
  2530.     /* Code Body                                                      */
  2531.     /*----------------------------------------------------------------*/
  2532.     return (EMSGetObjectSize(type, objdata));
  2533. }
  2534. /*****************************************************************************
  2535.  * FUNCTION
  2536.  *  EMS_check_object_size
  2537.  * DESCRIPTION
  2538.  *  
  2539.  * PARAMETERS
  2540.  *  type        [IN]        
  2541.  *  objdata     [?]         
  2542.  *  allowed     [?]         
  2543.  * RETURNS
  2544.  *  
  2545.  *****************************************************************************/
  2546. S32 EMS_check_object_size(U8 type, EMSObjData *objdata, U8 *allowed)
  2547. {
  2548.     /*----------------------------------------------------------------*/
  2549.     /* Local Variables                                                */
  2550.     /*----------------------------------------------------------------*/
  2551.     kal_bool flag;
  2552.     S32 size = EMSGetObjectSizeWithCheck(type, objdata, &flag);
  2553.     /*----------------------------------------------------------------*/
  2554.     /* Code Body                                                      */
  2555.     /*----------------------------------------------------------------*/
  2556.     if (flag == KAL_TRUE)
  2557.     {
  2558.         *allowed = 1;
  2559.     }
  2560.     else
  2561.     {
  2562.         *allowed = 0;
  2563.     }
  2564.     return (size);
  2565. }
  2566. /*****************************************************************************
  2567.  * FUNCTION
  2568.  *  EMS_load_predefined_picture
  2569.  * DESCRIPTION
  2570.  *  
  2571.  * PARAMETERS
  2572.  *  index       [IN]        
  2573.  *  data        [?]         
  2574.  * RETURNS
  2575.  *  void
  2576.  *****************************************************************************/
  2577. void EMS_load_predefined_picture(S32 index, U8 *data)
  2578. {
  2579.     /*----------------------------------------------------------------*/
  2580.     /* Local Variables                                                */
  2581.     /*----------------------------------------------------------------*/
  2582.     /*----------------------------------------------------------------*/
  2583.     /* Code Body                                                      */
  2584.     /*----------------------------------------------------------------*/
  2585.     if ((index >= 0) && (index < MAX_EMS_PREDEFINED_PICTURES))
  2586.     {
  2587.         EMS_predefined_pictures[index] = data;
  2588.     }
  2589. }
  2590. /*****************************************************************************
  2591.  * FUNCTION
  2592.  *  EMS_get_predefined_picture_size
  2593.  * DESCRIPTION
  2594.  *  
  2595.  * PARAMETERS
  2596.  *  index       [IN]        
  2597.  * RETURNS
  2598.  *  
  2599.  *****************************************************************************/
  2600. S32 EMS_get_predefined_picture_size(S32 index)
  2601. {
  2602.     /*----------------------------------------------------------------*/
  2603.     /* Local Variables                                                */
  2604.     /*----------------------------------------------------------------*/
  2605.     EMSObjData object;
  2606.     U8 *data = NULL;
  2607.     EMSTATUS r = EMS_load_object(EMS_PREDEFINED_PICTURE, data, index, &object);
  2608.     /*----------------------------------------------------------------*/