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

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_categories_ems.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is for EMS category screens.
  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.  *
  100.  *------------------------------------------------------------------------------
  101.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  102.  *============================================================================
  103.  ****************************************************************************/
  104. /* start - added by magesh */
  105. #define ENABLE_EMS_TEST_SAVE_OBJECTS         1  /* 0- enable, 1-disable */
  106. #define ENABLE_EMS_TEST_SAVE_PIC_OBJECTS     0  /* 1- enable, 0-disable */
  107. #define ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS    1  /* 1- enable, 0-disable */
  108. #define ENABLE_EMS_TEST_SAVE_MELO_OBJECTS    0  /* 1- enable, 0-disable */
  109. /* end - added by magesh */
  110. #include "PixtelDataTypes.h"
  111. #include "MMI_features.h"
  112. #include "TimerEvents.h"
  113. #include "FileSystemDef.h"
  114. #include "FileSystemGProt.h"
  115. #include "conversions.h"
  116. //#include "CustDataProts.h"
  117. #include "HistoryGprot.h"
  118. //#include "CustMenuRes.h"
  119. #include "DebugInitDef.h"
  120. //#include "GlobalDefs.h"
  121. //#include "SettingProfile.h"
  122. //#include "wgui.h"
  123. //#include "wgui_categories.h"
  124. #include "wgui_categories_inputs.h"
  125. #include "wgui_categories_defs.h"
  126. //#include "wgui_softkeys.h"
  127. #include "gdi_include.h"
  128. #include "wgui_ems.h"
  129. #include "wgui_categories_ems.h"
  130. #include "wgui_touch_screen.h"
  131. #include "MessagesResourceData.h"
  132. #include "PhoneSetupGprots.h"
  133. //#include "CommonScreens.h"
  134. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  135. #include "FileMgr.h"
  136. #include "FileManagerDef.h"
  137. #include "FileManagerGProt.h"
  138. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  139. #include "wgui_draw_manager.h"
  140. #include "wgui_status_icons.h"//120406 warning remove
  141. #include "EmsMiscell.h"
  142. //#include "t9def.h"
  143. #ifdef __MMI_HINDI_ALG__
  144. //#include "hf_rules.h"
  145. #endif 
  146. //#include "wgui_virtual_keyboard.h"
  147. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  148. //#include "EditorPen.h"
  149. #endif 
  150. #ifdef __MMI_MESSAGES_EMS__
  151. #include "ScrMemMgrGprot.h"//062206 EMS category
  152. extern void initialize_EMS_objects(void);
  153. extern void close_EMS_objects(void);
  154. extern U8 *EMS_predefined_pictures[];
  155. extern U8 *EMS_predefined_melodies[];
  156. EMSObjData temp_EMS_obj_data;
  157. #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  158. small_image_selector_struct small_image_selector;
  159. #endif 
  160. /*****************************************************************************
  161.  * FUNCTION
  162.  *  CreateCategory143ObjectList
  163.  * DESCRIPTION
  164.  *  
  165.  * PARAMETERS
  166.  *  data            [?]         
  167.  *  object_list     [IN]        
  168.  * RETURNS
  169.  *  void
  170.  *****************************************************************************/
  171. void CreateCategory143ObjectList(EMSData *data, EMSObject **object_list)
  172. {
  173.     /*----------------------------------------------------------------*/
  174.     /* Local Variables                                                */
  175.     /*----------------------------------------------------------------*/
  176.     EMSObject *p = data->listHead;
  177.     EMSObject *q;
  178. #if(ENABLE_EMS_TEST_SAVE_OBJECTS)
  179.     S32 type;
  180. #endif /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */ 
  181.     /*----------------------------------------------------------------*/
  182.     /* Code Body                                                      */
  183.     /*----------------------------------------------------------------*/
  184.     *object_list = q = NULL;
  185. #if(ENABLE_EMS_TEST_SAVE_OBJECTS)
  186.     if (data == NULL)
  187.     {
  188.         return;
  189.     }
  190.     if (data->listHead == NULL)
  191.     {
  192.         return;
  193.     }
  194.     while (p != NULL)
  195.     {
  196.         type = p->Type;
  197.         /* reused object will not be put in category_143_object_list */
  198.         if (
  199.     #ifdef __EMS_REL5__
  200.                (!EMSIsReusedObj(data, p)) &&
  201.     #endif 
  202.                ((type == EMS_TYPE_PIC) || (type == EMS_TYPE_USERDEF_ANM)
  203.     #if defined(__MMI_IMELODY_SUPPORT__)
  204.                 || (type == EMS_TYPE_USERDEF_SND)
  205.     #endif 
  206.                ))
  207.         {
  208.             if (q == NULL)
  209.             {
  210.                 *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
  211.                 q->next = NULL;
  212.                 q->prev = NULL;
  213.                 q->data = p->data;
  214.                 q->OffsetToText = p->OffsetToText;
  215.                 q->PredefNo = p->PredefNo;
  216.                 q->Type = p->Type;
  217.             }
  218.             else
  219.             {
  220.                 EMSObject *temp;
  221.                 temp = (EMSObject*) gui_malloc(sizeof(EMSObject));
  222.                 temp->next = NULL;
  223.                 temp->data = p->data;
  224.                 temp->OffsetToText = p->OffsetToText;
  225.                 temp->PredefNo = p->PredefNo;
  226.                 temp->Type = p->Type;
  227.                 temp->prev = q;
  228.                 q->next = temp;
  229.                 q = temp;
  230.             }
  231.         }
  232.         p = p->next;
  233.     }
  234. #else /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */ 
  235. #if(ENABLE_EMS_TEST_SAVE_PIC_OBJECTS)   /* picture */
  236.     temp_EMS_obj_data.picture.bitsPerPixel = 1;
  237.     temp_EMS_obj_data.picture.hDim = 16;
  238.     temp_EMS_obj_data.picture.vDim = 16;
  239.     temp_EMS_obj_data.picture.pdu_length = 32;
  240.     temp_EMS_obj_data.picture.pdu = (U8*) (EMS_sample_picture_object_PDU_11 + 8);
  241.     *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
  242.     q->next = NULL;
  243.     q->prev = NULL;
  244.     q->data = &temp_EMS_obj_data;
  245.     q->OffsetToText = 0;
  246.     q->PredefNo = 0;
  247.     q->Type = EMS_TYPE_PIC;
  248. #endif /* (ENABLE_EMS_TEST_SAVE_PIC_OBJECTS) */ 
  249. #if(ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS)  /* animation */
  250.     temp_EMS_obj_data.animation.bitsPerPixel = 1;
  251.     temp_EMS_obj_data.animation.hDim = 8;
  252.     temp_EMS_obj_data.animation.vDim = 8;
  253.     temp_EMS_obj_data.animation.pdu_length = 32;
  254.     temp_EMS_obj_data.animation.pdu = (U8*) (EMS_sample_animation_object_PDU_11 + 8);
  255.     *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
  256.     q->next = NULL;
  257.     q->prev = NULL;
  258.     q->data = &temp_EMS_obj_data;
  259.     q->OffsetToText = 0;
  260.     q->PredefNo = 0;
  261.     q->Type = EMS_TYPE_USERDEF_ANM;
  262. #endif /* (ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS) */ 
  263. #if(ENABLE_EMS_TEST_SAVE_MELO_OBJECTS)  /* melodies */
  264.     /* MTK Joy added for customization, 1014 */
  265. #if defined(__MMI_IMELODY_SUPPORT__)
  266.     temp_EMS_obj_data.sound.pdu_length =
  267.         (U16) (EMS_sample_melody_object_PDU_1[1] | (EMS_sample_melody_object_PDU_1[2] << 8));
  268.     temp_EMS_obj_data.sound.pdu = (U8*) (EMS_sample_melody_object_PDU_1 + 3);
  269.     *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
  270.     q->next = NULL;
  271.     q->prev = NULL;
  272.     q->data = &temp_EMS_obj_data;
  273.     q->OffsetToText = 0;
  274.     q->PredefNo = 0;
  275.     q->Type = EMS_TYPE_USERDEF_SND;
  276. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  277.     /* MTK end */
  278. #endif /* (ENABLE_EMS_TEST_SAVE_MELO_OBJECTS) */ 
  279. #endif /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */ 
  280. }
  281. /*****************************************************************************
  282.  * FUNCTION
  283.  *  FreeCategory143ObjectList
  284.  * DESCRIPTION
  285.  *  
  286.  * PARAMETERS
  287.  *  object_list     [IN]        
  288.  * RETURNS
  289.  *  void
  290.  *****************************************************************************/
  291. void FreeCategory143ObjectList(EMSObject **object_list)
  292. {
  293.     /*----------------------------------------------------------------*/
  294.     /* Local Variables                                                */
  295.     /*----------------------------------------------------------------*/
  296.     EMSObject *q, *temp;
  297.     /*----------------------------------------------------------------*/
  298.     /* Code Body                                                      */
  299.     /*----------------------------------------------------------------*/
  300.     if (object_list == NULL)
  301.     {
  302.         return;
  303.     }
  304.     q = *object_list;
  305.     while (q != NULL)
  306.     {
  307.         temp = q;
  308.         q = q->next;
  309.         gui_free(temp);
  310.     }
  311.     *object_list = NULL;
  312. }
  313. /*****************************************************************************
  314.  * FUNCTION
  315.  *  category_143_redraw_highlighted_item
  316.  * DESCRIPTION
  317.  *  Redraws the object list screen
  318.  * PARAMETERS
  319.  *  void
  320.  * RETURNS
  321.  *  void
  322.  *****************************************************************************/
  323. S32 *category_143_object_list_index = NULL;
  324. S32 category_143_object_list_n_items = 0;
  325. vertical_scrollbar category143_vbar;
  326. EMSObject *category_143_object_list;
  327. EMSObject *category_143_current_object;
  328. extern U8 EMS_view_mode;
  329. void category_143_redraw_highlighted_item(void)
  330. {
  331.     /*----------------------------------------------------------------*/
  332.     /* Local Variables                                                */
  333.     /*----------------------------------------------------------------*/
  334.     S32 x, y, w, h;
  335.     color c;
  336.     S32 vbar_x = 0, vbar_button_x = 0;
  337.     /*----------------------------------------------------------------*/
  338.     /* Code Body                                                      */
  339.     /*----------------------------------------------------------------*/
  340.     EMS_cancel_object_focus();
  341.     gui_reset_clip();
  342.     c = gui_color(255, 255, 255);
  343.     gui_fill_rectangle(
  344.         0,
  345.         (MMI_title_y + MMI_title_height),
  346.         UI_device_width - 1,
  347.         UI_device_height - MMI_button_bar_height - 1,
  348.         c);
  349.     gui_set_clip(
  350.         0,
  351.         (MMI_title_y + MMI_title_height),
  352.         UI_device_width - current_MMI_theme->scrollbar_size,
  353.         MMI_content_height + 2);
  354.     if (category_143_current_object != NULL)
  355.     {
  356.         gui_EMS_input_box_measure_object(category_143_current_object, &w, &h);
  357.         x = (UI_device_width >> 1) - (w >> 1);
  358.         y = (UI_device_height >> 1) - (h >> 1);
  359.         gui_EMS_input_box_display_object(x, y, category_143_current_object, 1);
  360.     }
  361.     /* Uncomment below line for auto-disable scrollbar    */
  362.     if (category_143_object_list_n_items > 1)
  363.     {
  364.         gui_set_vertical_scrollbar_range(&category143_vbar, category_143_object_list_n_items);
  365.         gui_set_vertical_scrollbar_scale(&category143_vbar, 1);
  366.         gui_set_vertical_scrollbar_value(&category143_vbar, *category_143_object_list_index);
  367.         /* MTK Elvis for R2L characters */
  368.         if (r2lMMIFlag)
  369.         {
  370.             vbar_x = category143_vbar.x;
  371.             vbar_button_x = category143_vbar.scroll_button.x;
  372.             category143_vbar.x = category143_vbar.x + category143_vbar.width - (UI_device_width - 1);
  373.             category143_vbar.scroll_button.x =
  374.                 category143_vbar.scroll_button.x + category143_vbar.scroll_button.width - (UI_device_width - 1);
  375.             gui_show_vertical_scrollbar(&category143_vbar);
  376.         }
  377.         else
  378.         {
  379.             gui_show_vertical_scrollbar(&category143_vbar);
  380.         }
  381.         /* MTK end */
  382.         if (r2lMMIFlag)
  383.         {
  384.             category143_vbar.x = vbar_x;
  385.             category143_vbar.scroll_button.x = vbar_button_x;
  386.         }
  387.     }
  388.     gui_BLT_double_buffer(
  389.         0,
  390.         (MMI_title_y + MMI_title_height),
  391.         UI_device_width - 1,
  392.         UI_device_height - MMI_button_bar_height - 1);
  393. }
  394. /*****************************************************************************
  395.  * FUNCTION
  396.  *  category_143_highlight_handler
  397.  * DESCRIPTION
  398.  *  
  399.  * PARAMETERS
  400.  *  index       [IN]        
  401.  * RETURNS
  402.  *  void
  403.  *****************************************************************************/
  404. void category_143_highlight_handler(S32 index)
  405. {
  406.     /*----------------------------------------------------------------*/
  407.     /* Local Variables                                                */
  408.     /*----------------------------------------------------------------*/
  409.     /*----------------------------------------------------------------*/
  410.     /* Code Body                                                      */
  411.     /*----------------------------------------------------------------*/
  412.     MMI_menu_shortcut_number = index + 1;
  413.     if (!menu_shortcut_handler_display)
  414.     {
  415.         draw_title();
  416.     }
  417.     MMI_list_highlight_handler(index);
  418. }
  419. /*****************************************************************************
  420.  * FUNCTION
  421.  *  category_143_goto_item
  422.  * DESCRIPTION
  423.  *  
  424.  * PARAMETERS
  425.  *  index       [IN]        
  426.  * RETURNS
  427.  *  void
  428.  *****************************************************************************/
  429. void category_143_goto_item(S32 index)
  430. {
  431.     /*----------------------------------------------------------------*/
  432.     /* Local Variables                                                */
  433.     /*----------------------------------------------------------------*/
  434.     /*----------------------------------------------------------------*/
  435.     /* Code Body                                                      */
  436.     /*----------------------------------------------------------------*/
  437.     if (category_143_object_list != NULL)
  438.     {
  439.         if (index < 0)
  440.         {
  441.             return; /* index=0; */
  442.         }
  443.         if (index > (category_143_object_list_n_items - 1))
  444.         {
  445.             return; /* index=category_143_image_list_n_items-1;  */
  446.         }
  447.         *category_143_object_list_index = index;
  448.         category_143_current_object = category_143_object_list;
  449.         if (category_143_current_object != NULL)
  450.         {
  451.             S32 i;
  452.             for (i = 0; i < index; i++)
  453.             {
  454.                 category_143_current_object = category_143_current_object->next;
  455.             }
  456.         }
  457.     }
  458.     category_143_redraw_highlighted_item();
  459.     category_143_highlight_handler(index);
  460. }
  461. /*****************************************************************************
  462.  * FUNCTION
  463.  *  category_143_goto_previous_item
  464.  * DESCRIPTION
  465.  *  
  466.  * PARAMETERS
  467.  *  void
  468.  * RETURNS
  469.  *  void
  470.  *****************************************************************************/
  471. void category_143_goto_previous_item(void)
  472. {
  473.     /*----------------------------------------------------------------*/
  474.     /* Local Variables                                                */
  475.     /*----------------------------------------------------------------*/
  476.     S32 index = *category_143_object_list_index;
  477.     /*----------------------------------------------------------------*/
  478.     /* Code Body                                                      */
  479.     /*----------------------------------------------------------------*/
  480.     index--;
  481.     if (index < 0)
  482.     {
  483.         index = category_143_object_list_n_items - 1;
  484.     }
  485.     *category_143_object_list_index = index;
  486.     if (category_143_current_object != NULL)
  487.     {
  488.         if (category_143_current_object->prev == NULL)
  489.         {
  490.             category_143_current_object = category_143_object_list;
  491.             while (category_143_current_object->next != NULL)
  492.             {
  493.                 category_143_current_object = category_143_current_object->next;
  494.             }
  495.         }
  496.         else
  497.         {
  498.             category_143_current_object = category_143_current_object->prev;
  499.         }
  500.     }
  501.     category_143_redraw_highlighted_item();
  502.     category_143_highlight_handler(index);
  503. }
  504. /*****************************************************************************
  505.  * FUNCTION
  506.  *  category_143_goto_next_item
  507.  * DESCRIPTION
  508.  *  
  509.  * PARAMETERS
  510.  *  void
  511.  * RETURNS
  512.  *  void
  513.  *****************************************************************************/
  514. void category_143_goto_next_item(void)
  515. {
  516.     /*----------------------------------------------------------------*/
  517.     /* Local Variables                                                */
  518.     /*----------------------------------------------------------------*/
  519.     S32 index = *category_143_object_list_index;
  520.     /*----------------------------------------------------------------*/
  521.     /* Code Body                                                      */
  522.     /*----------------------------------------------------------------*/
  523.     index++;
  524.     if (index > (category_143_object_list_n_items - 1))
  525.     {
  526.         index = 0;
  527.     }
  528.     *category_143_object_list_index = index;
  529.     if (category_143_current_object != NULL)
  530.     {
  531.         if (category_143_current_object->next == NULL)
  532.         {
  533.             category_143_current_object = category_143_object_list;
  534.         }
  535.         else
  536.         {
  537.             category_143_current_object = category_143_current_object->next;
  538.         }
  539.     }
  540.     category_143_redraw_highlighted_item();
  541.     category_143_highlight_handler(index);
  542. }
  543. /*****************************************************************************
  544.  * FUNCTION
  545.  *  category_143_key_handler
  546.  * DESCRIPTION
  547.  *  
  548.  * PARAMETERS
  549.  *  vkey_code       [IN]        
  550.  *  key_state       [IN]        
  551.  * RETURNS
  552.  *  void
  553.  *****************************************************************************/
  554. void category_143_key_handler(S32 vkey_code, S32 key_state)
  555. {
  556. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  557.     /*----------------------------------------------------------------*/
  558.     /* Local Variables                                                */
  559.     /*----------------------------------------------------------------*/
  560.     /*----------------------------------------------------------------*/
  561.     /* Code Body                                                      */
  562.     /*----------------------------------------------------------------*/
  563.     if (key_state)
  564.     {
  565.         switch (vkey_code)
  566.         {
  567.             case 37:    /* left */
  568.                 break;
  569.             case 39:    /* right */
  570.                 break;
  571.             case 38:
  572.                 category_143_goto_previous_item();
  573.                 break;
  574.             case 40:
  575.                 category_143_goto_next_item();
  576.                 break;
  577.         }
  578.     }
  579. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  580.     UI_UNUSED_PARAMETER(vkey_code);
  581.     UI_UNUSED_PARAMETER(key_state);
  582. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  583. }
  584. #ifdef __MMI_TOUCH_SCREEN__
  585. /*****************************************************************************
  586.  * FUNCTION
  587.  *  category_143_pen_down_hdlr
  588.  * DESCRIPTION
  589.  *  
  590.  * PARAMETERS
  591.  *  pos     [IN]        
  592.  * RETURNS
  593.  *  
  594.  *****************************************************************************/
  595. MMI_BOOL category_143_pen_down_hdlr(mmi_pen_point_struct pos)
  596. {
  597.     /*----------------------------------------------------------------*/
  598.     /* Local Variables                                                */
  599.     /*----------------------------------------------------------------*/
  600.     gui_scrollbar_pen_enum scrollbar_event;
  601.     gui_pen_event_param_struct scrollbar_param;
  602.     /*----------------------------------------------------------------*/
  603.     /* Code Body                                                      */
  604.     /*----------------------------------------------------------------*/
  605.     if (PEN_CHECK_BOUND
  606.         (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
  607.     {
  608.         gui_vertical_scrollbar_translate_pen_event(
  609.             &category143_vbar,
  610.             MMI_PEN_EVENT_DOWN,
  611.             pos.x,
  612.             pos.y,
  613.             &scrollbar_event,
  614.             &scrollbar_param);
  615.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  616.         {
  617.             category_143_goto_item((S32) scrollbar_param._u.i);
  618.         }
  619.         return MMI_TRUE;
  620.     }
  621.     return MMI_FALSE;
  622. }
  623. /*****************************************************************************
  624.  * FUNCTION
  625.  *  category_143_pen_up_hdlr
  626.  * DESCRIPTION
  627.  *  
  628.  * PARAMETERS
  629.  *  pos     [IN]        
  630.  * RETURNS
  631.  *  
  632.  *****************************************************************************/
  633. MMI_BOOL category_143_pen_up_hdlr(mmi_pen_point_struct pos)
  634. {
  635.     /*----------------------------------------------------------------*/
  636.     /* Local Variables                                                */
  637.     /*----------------------------------------------------------------*/
  638.     gui_scrollbar_pen_enum scrollbar_event;
  639.     gui_pen_event_param_struct scrollbar_param;
  640.     /*----------------------------------------------------------------*/
  641.     /* Code Body                                                      */
  642.     /*----------------------------------------------------------------*/
  643.     if (PEN_CHECK_BOUND
  644.         (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
  645.     {
  646.         gui_vertical_scrollbar_translate_pen_event(
  647.             &category143_vbar,
  648.             MMI_PEN_EVENT_UP,
  649.             pos.x,
  650.             pos.y,
  651.             &scrollbar_event,
  652.             &scrollbar_param);
  653.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  654.         {
  655.             category_143_goto_item((S32) scrollbar_param._u.i);
  656.         }
  657.         return MMI_TRUE;
  658.     }
  659.     return MMI_FALSE;
  660. }
  661. /*****************************************************************************
  662.  * FUNCTION
  663.  *  category_143_pen_move_hdlr
  664.  * DESCRIPTION
  665.  *  
  666.  * PARAMETERS
  667.  *  pos     [IN]        
  668.  * RETURNS
  669.  *  
  670.  *****************************************************************************/
  671. MMI_BOOL category_143_pen_move_hdlr(mmi_pen_point_struct pos)
  672. {
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     gui_scrollbar_pen_enum scrollbar_event;
  677.     gui_pen_event_param_struct scrollbar_param;
  678.     /*----------------------------------------------------------------*/
  679.     /* Code Body                                                      */
  680.     /*----------------------------------------------------------------*/
  681.     if (PEN_CHECK_BOUND
  682.         (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
  683.     {
  684.         gui_vertical_scrollbar_translate_pen_event(
  685.             &category143_vbar,
  686.             MMI_PEN_EVENT_MOVE,
  687.             pos.x,
  688.             pos.y,
  689.             &scrollbar_event,
  690.             &scrollbar_param);
  691.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  692.         {
  693.             category_143_goto_item((S32) scrollbar_param._u.i);
  694.         }
  695.         return MMI_TRUE;
  696.     }
  697.     return MMI_FALSE;
  698. }
  699. /*****************************************************************************
  700.  * FUNCTION
  701.  *  category_143_pen_repeat_hdlr
  702.  * DESCRIPTION
  703.  *  
  704.  * PARAMETERS
  705.  *  pos     [IN]        
  706.  * RETURNS
  707.  *  
  708.  *****************************************************************************/
  709. MMI_BOOL category_143_pen_repeat_hdlr(mmi_pen_point_struct pos)
  710. {
  711.     /*----------------------------------------------------------------*/
  712.     /* Local Variables                                                */
  713.     /*----------------------------------------------------------------*/
  714.     gui_scrollbar_pen_enum scrollbar_event;
  715.     gui_pen_event_param_struct scrollbar_param;
  716.     /*----------------------------------------------------------------*/
  717.     /* Code Body                                                      */
  718.     /*----------------------------------------------------------------*/
  719.     if (PEN_CHECK_BOUND
  720.         (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
  721.     {
  722.         gui_vertical_scrollbar_translate_pen_event(
  723.             &category143_vbar,
  724.             MMI_PEN_EVENT_REPEAT,
  725.             pos.x,
  726.             pos.y,
  727.             &scrollbar_event,
  728.             &scrollbar_param);
  729.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  730.         {
  731.             category_143_goto_item((S32) scrollbar_param._u.i);
  732.         }
  733.         return MMI_TRUE;
  734.     }
  735.     return MMI_FALSE;
  736. }
  737. #endif /* __MMI_TOUCH_SCREEN__ */ 
  738. /*****************************************************************************
  739.  * FUNCTION
  740.  *  DrawCate143CategoryControlArea
  741.  * DESCRIPTION
  742.  *  Draws the category143 category control area
  743.  * PARAMETERS
  744.  *  coordinate      [IN/OUT]        Coordinates of category controlled area.
  745.  * RETURNS
  746.  *  void
  747.  *****************************************************************************/
  748. void DrawCate143CategoryControlArea(dm_coordinates *coordinate)
  749. {
  750.     /*----------------------------------------------------------------*/
  751.     /* Local Variables                                                */
  752.     /*----------------------------------------------------------------*/
  753.     /*----------------------------------------------------------------*/
  754.     /* Code Body                                                      */
  755.     /*----------------------------------------------------------------*/
  756.     category_143_redraw_highlighted_item();
  757. }
  758. /*****************************************************************************
  759.  * FUNCTION
  760.  *  ShowCategory143Screen
  761.  * DESCRIPTION
  762.  *  Displays the object list screen
  763.  * PARAMETERS
  764.  *  title                   [IN]        Title for the screen
  765.  *  title_icon              [IN]        Icon displayed with the title
  766.  *  left_softkey            [IN]        Left softkey label
  767.  *  left_softkey_icon       [IN]        Left softkey icon
  768.  *  right_softkey           [IN]        Right softkey label
  769.  *  right_softkey_icon      [IN]        Right softkey icon
  770.  *  object_list             [IN]        Array of items
  771.  *  n_items                 [IN]        Number of items in the menu
  772.  *  index                   [IN]        Default item to be highlighted (if there is no history)
  773.  *  history_buffer          [IN]        History buffer
  774.  * RETURNS
  775.  *  void
  776.  *****************************************************************************/
  777. void ShowCategory143Screen(
  778.         U16 title,
  779.         U16 title_icon,
  780.         U16 left_softkey,
  781.         U16 left_softkey_icon,
  782.         U16 right_softkey,
  783.         U16 right_softkey_icon,
  784.         EMSObject *object_list,
  785.         S32 *n_items,
  786.         S32 *index,
  787.         U8 *history_buffer)
  788. {
  789.     /*----------------------------------------------------------------*/
  790.     /* Local Variables                                                */
  791.     /*----------------------------------------------------------------*/
  792.     dm_data_struct dm_data;
  793.     S32 shortcut_width, n = 0;
  794.     U8 h_flag;
  795.     /*----------------------------------------------------------------*/
  796.     /* Code Body                                                      */
  797.     /*----------------------------------------------------------------*/
  798.     gdi_layer_lock_frame_buffer();
  799.     EMS_view_mode = 1;
  800.     initialize_EMS_objects();
  801.     MMI_menu_shortcut_number = -1;
  802.     MMI_disable_title_shortcut_display = 0;
  803.     clear_left_softkey();
  804.     clear_right_softkey();
  805.     change_left_softkey(left_softkey, left_softkey_icon);
  806.     change_right_softkey(right_softkey, right_softkey_icon);
  807.     SetupCategoryKeyHandlers();
  808.     MMI_title_icon = get_image(title_icon);
  809.     MMI_title_string = get_string(title);
  810.     category_143_object_list = object_list;
  811.     category_143_object_list_index = index;
  812.     h_flag = set_object_list_category_history(MMI_CATEGORY143_ID, history_buffer, category_143_object_list_index);
  813.     if (h_flag)
  814.     {
  815.         *index = *category_143_object_list_index;
  816.     }
  817.     if (category_143_object_list == NULL)
  818.     {
  819.         n = 0;
  820.         category_143_current_object = NULL;
  821.     }
  822.     else
  823.     {
  824.         S32 i;
  825.         EMSObject *p = object_list->next;
  826.         ++n;
  827.         while (p != NULL)
  828.         {
  829.             p = p->next;
  830.             ++n;
  831.         }
  832.         if (*index < 0)
  833.         {
  834.             *index = 0;
  835.         }
  836.         if (*index >= n)
  837.         {
  838.             *index = n - 1;
  839.         }
  840.         category_143_current_object = category_143_object_list;
  841.         for (i = 0; i < *index; i++)
  842.         {
  843.             category_143_current_object = category_143_current_object->next;
  844.         }
  845.     }
  846.     *n_items = n;
  847.     MMI_menu_shortcut_number = *index + 1;
  848.     category_143_object_list_n_items = n;
  849.     category_143_object_list_index = index;
  850.     if (*category_143_object_list_index < 0)
  851.     {
  852.         *category_143_object_list_index = 0;
  853.     }
  854.     if (*category_143_object_list_index >= category_143_object_list_n_items)
  855.     {
  856.         *category_143_object_list_index = category_143_object_list_n_items - 1;
  857.     }
  858.     gui_create_vertical_scrollbar(
  859.         &category143_vbar,
  860.         UI_device_width - current_MMI_theme->scrollbar_size,
  861.         (MMI_title_y + MMI_title_height),
  862.         current_MMI_theme->scrollbar_size,
  863.         MMI_content_height);
  864.     /* ShortCut */
  865.     register_fixed_list_shortcut_handler();
  866.     shortcut_width = set_menu_item_count(*n_items) + 7;
  867.     resize_menu_shortcut_handler(shortcut_width, (MMI_title_height));
  868.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  869.     register_hide_menu_shortcut(draw_title);
  870.     register_keyboard_key_handler(category_143_key_handler);
  871.     register_menu_shortcut_keys();
  872.     register_menu_shortcut_handler(category_143_goto_item);
  873.     SetKeyHandler(category_143_goto_previous_item, KEY_UP_ARROW, KEY_EVENT_UP);
  874.     SetKeyHandler(category_143_goto_next_item, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  875.     SetKeyHandler(category_143_goto_previous_item, KEY_VOL_UP, KEY_EVENT_UP);
  876.     SetKeyHandler(category_143_goto_next_item, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  877.     gdi_layer_unlock_frame_buffer();
  878.     ExitCategoryFunction = ExitCategory143Screen;
  879.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory143History, GetCategory143HistorySize);
  880.     dm_register_category_controlled_callback(DrawCate143CategoryControlArea);
  881. #ifdef __MMI_TOUCH_SCREEN__
  882.     wgui_register_category_screen_control_area_pen_handlers(category_143_pen_down_hdlr, MMI_PEN_EVENT_DOWN);
  883.     wgui_register_category_screen_control_area_pen_handlers(category_143_pen_up_hdlr, MMI_PEN_EVENT_UP);
  884.     wgui_register_category_screen_control_area_pen_handlers(category_143_pen_move_hdlr, MMI_PEN_EVENT_MOVE);
  885.     wgui_register_category_screen_control_area_pen_handlers(category_143_pen_repeat_hdlr, MMI_PEN_EVENT_REPEAT);
  886. #endif /* __MMI_TOUCH_SCREEN__ */ 
  887.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  888.     dm_data.s32CatId = MMI_CATEGORY143_ID;
  889.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  890.     dm_setup_data(&dm_data);
  891.     dm_redraw_category_screen();
  892. }
  893. /*****************************************************************************
  894.  * FUNCTION
  895.  *  ExitCategory143Screen
  896.  * DESCRIPTION
  897.  *  Exits the object list screen
  898.  * PARAMETERS
  899.  *  void
  900.  * RETURNS
  901.  *  void
  902.  *****************************************************************************/
  903. void ExitCategory143Screen(void)
  904. {
  905.     /*----------------------------------------------------------------*/
  906.     /* Local Variables                                                */
  907.     /*----------------------------------------------------------------*/
  908.     /*----------------------------------------------------------------*/
  909.     /* Code Body                                                      */
  910.     /*----------------------------------------------------------------*/
  911.     EMS_view_mode = 0;
  912.     EMS_cancel_object_focus();
  913.     close_EMS_objects();
  914.     reset_menu_shortcut_handler();
  915.     category_143_object_list = NULL;
  916.     category_143_object_list_index = NULL;
  917.     category_143_object_list_n_items = 0;
  918.     ExitCategoryFunction = MMI_dummy_function;
  919.     RedrawCategoryFunction = MMI_dummy_function;
  920.     GetCategoryHistory = dummy_get_history;
  921.     GetCategoryHistorySize = dummy_get_history_size;
  922. }
  923. /*****************************************************************************
  924.  * FUNCTION
  925.  *  GetCategory143HistorySize
  926.  * DESCRIPTION
  927.  *  Gets the history buffer size for the object list screen
  928.  * PARAMETERS
  929.  *  void
  930.  * RETURNS
  931.  *  size in U8s of the history buffer
  932.  *****************************************************************************/
  933. S32 GetCategory143HistorySize(void)
  934. {
  935.     /*----------------------------------------------------------------*/
  936.     /* Local Variables                                                */
  937.     /*----------------------------------------------------------------*/
  938.     /*----------------------------------------------------------------*/
  939.     /* Code Body                                                      */
  940.     /*----------------------------------------------------------------*/
  941.     return (sizeof(object_list_category_history));
  942. }
  943. /*****************************************************************************
  944.  * FUNCTION
  945.  *  GetCategory143History
  946.  * DESCRIPTION
  947.  *  Gets the history buffer for the object list screen
  948.  * PARAMETERS
  949.  *  history_buffer      [IN]        Is the buffer into which the history data is stored
  950.  * RETURNS
  951.  *  pointer to the history buffer
  952.  *****************************************************************************/
  953. U8 *GetCategory143History(U8 *history_buffer)
  954. {
  955.     /*----------------------------------------------------------------*/
  956.     /* Local Variables                                                */
  957.     /*----------------------------------------------------------------*/
  958.     /*----------------------------------------------------------------*/
  959.     /* Code Body                                                      */
  960.     /*----------------------------------------------------------------*/
  961.     get_object_list_category_history(MMI_CATEGORY143_ID, history_buffer, category_143_object_list_index);
  962.     return (history_buffer);
  963. }
  964. /* Supports only user defined objects  */
  965. /*****************************************************************************
  966.  * FUNCTION
  967.  *  GetCategory143DataType
  968.  * DESCRIPTION
  969.  *  
  970.  * PARAMETERS
  971.  *  void
  972.  * RETURNS
  973.  *  
  974.  *****************************************************************************/
  975. U8 GetCategory143DataType(void)
  976. {
  977.     /*----------------------------------------------------------------*/
  978.     /* Local Variables                                                */
  979.     /*----------------------------------------------------------------*/
  980.     /*----------------------------------------------------------------*/
  981.     /* Code Body                                                      */
  982.     /*----------------------------------------------------------------*/
  983.     switch (category_143_current_object->Type)
  984.     {
  985.         case EMS_TYPE_PIC:
  986.             return (EMS_USERDEFINED_PICTURE);
  987.         case EMS_TYPE_USERDEF_ANM:
  988.             return (EMS_USERDEFINED_ANIMATION);
  989.             /* MTK Joy added for customization, 1014 */
  990.     #if defined(__MMI_IMELODY_SUPPORT__)
  991.         case EMS_TYPE_USERDEF_SND:
  992.             return (EMS_USERDEFINED_MELODY);
  993.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  994.             /* MTK end */
  995.     }
  996.     return (0);
  997. }
  998. /* Supports only user defined objects  */
  999. /*****************************************************************************
  1000.  * FUNCTION
  1001.  *  GetCategory143DataSize
  1002.  * DESCRIPTION
  1003.  *  
  1004.  * PARAMETERS
  1005.  *  void
  1006.  * RETURNS
  1007.  *  
  1008.  *****************************************************************************/
  1009. S32 GetCategory143DataSize(void)
  1010. {
  1011.     /*----------------------------------------------------------------*/
  1012.     /* Local Variables                                                */
  1013.     /*----------------------------------------------------------------*/
  1014.     S32 size = 0;
  1015.     /*----------------------------------------------------------------*/
  1016.     /* Code Body                                                      */
  1017.     /*----------------------------------------------------------------*/
  1018.     switch (category_143_current_object->Type)
  1019.     {
  1020.         case EMS_TYPE_PIC:
  1021.             size = 9 + category_143_current_object->data->picture.pdu_length;
  1022.             break;
  1023.         case EMS_TYPE_USERDEF_ANM:
  1024.             size = 12 + category_143_current_object->data->animation.pdu_length;
  1025.             break;
  1026.             /* MTK Joy added for customization, 1014 */
  1027.     #if defined(__MMI_IMELODY_SUPPORT__)
  1028.         case EMS_TYPE_USERDEF_SND:
  1029.             size = 4 + category_143_current_object->data->sound.pdu_length;
  1030.             break;
  1031.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1032.             /* MTK end */
  1033.     }
  1034.     return (size);
  1035. }
  1036. /* Supports only user defined objects  */
  1037. /*****************************************************************************
  1038.  * FUNCTION
  1039.  *  GetCategory143Data
  1040.  * DESCRIPTION
  1041.  *  
  1042.  * PARAMETERS
  1043.  *  data        [?]     
  1044.  * RETURNS
  1045.  *  
  1046.  *****************************************************************************/
  1047. U8 *GetCategory143Data(U8 *data)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     if (data != NULL)
  1056.     {
  1057.         switch (category_143_current_object->Type)
  1058.         {
  1059.             case EMS_TYPE_PIC:
  1060.                 data[0] = (U8) EMS_USERDEFINED_PICTURE;
  1061.                 data[1] = (U8) category_143_current_object->data->picture.bitsPerPixel;
  1062.                 data[2] = (U8) category_143_current_object->data->picture.attribute;
  1063.                 data[3] = (U8) category_143_current_object->data->picture.hDim;
  1064.                 data[4] = (U8) (category_143_current_object->data->picture.hDim >> 8);
  1065.                 data[5] = (U8) category_143_current_object->data->picture.vDim;
  1066.                 data[6] = (U8) (category_143_current_object->data->picture.vDim >> 8);
  1067.                 data[7] = (U8) category_143_current_object->data->picture.pdu_length;
  1068.                 data[8] = (U8) (category_143_current_object->data->picture.pdu_length >> 8);
  1069.                 gui_memcpy(
  1070.                     data + 9,
  1071.                     category_143_current_object->data->picture.pdu,
  1072.                     category_143_current_object->data->picture.pdu_length);
  1073.                 break;
  1074.             case EMS_TYPE_USERDEF_ANM:
  1075.                 data[0] = (U8) EMS_USERDEFINED_ANIMATION;
  1076.                 data[1] = (U8) category_143_current_object->data->animation.bitsPerPixel;
  1077.                 data[2] = (U8) category_143_current_object->data->animation.attribute;
  1078.                 data[3] = (U8) category_143_current_object->data->animation.cFrame;
  1079.                 data[4] = (U8) category_143_current_object->data->animation.cRepeat;
  1080.                 data[5] = (U8) category_143_current_object->data->animation.Duration;
  1081.                 data[6] = (U8) category_143_current_object->data->animation.hDim;
  1082.                 data[7] = (U8) (category_143_current_object->data->animation.hDim >> 8);
  1083.                 data[8] = (U8) category_143_current_object->data->animation.vDim;
  1084.                 data[9] = (U8) (category_143_current_object->data->animation.vDim >> 8);
  1085.                 data[10] = (U8) category_143_current_object->data->animation.pdu_length;
  1086.                 data[11] = (U8) (category_143_current_object->data->animation.pdu_length >> 8);
  1087.                 gui_memcpy(
  1088.                     data + 12,
  1089.                     category_143_current_object->data->animation.pdu,
  1090.                     category_143_current_object->data->animation.pdu_length);
  1091.                 break;
  1092.                 /* MTK Joy added for customization, 1014 */
  1093.         #if defined(__MMI_IMELODY_SUPPORT__)
  1094.             case EMS_TYPE_USERDEF_SND:
  1095.                 data[0] = (U8) EMS_USERDEFINED_MELODY;
  1096.                 data[1] = (U8) category_143_current_object->data->sound.attribute;
  1097.                 data[2] = (U8) category_143_current_object->data->sound.pdu_length;
  1098.                 data[3] = (U8) (category_143_current_object->data->sound.pdu_length >> 8);
  1099.                 gui_memcpy(
  1100.                     data + 4,
  1101.                     category_143_current_object->data->sound.pdu,
  1102.                     category_143_current_object->data->sound.pdu_length);
  1103.                 break;
  1104.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1105.                 /* MTK end */
  1106.         }
  1107.     }
  1108.     return (data);
  1109. }
  1110. #define EMS_PREDEFINED_PICTURE_HEADER_SIZE         3
  1111. #define EMS_USERDEFINED_PICTURE_HEADER_SIZE        3
  1112. #define EMS_PREDEFINED_ANIMATION_HEADER_SIZE    1
  1113. #define EMS_USERDEFINED_ANIMATION_HEADER_SIZE      3
  1114. #define EMS_PREDEFINED_SOUND_HEADER_SIZE        1
  1115. #define EMS_PREDEFINED_MELODY_HEADER_SIZE       1
  1116. #define EMS_USERDEFINED_MELODY_HEADER_SIZE         1
  1117. /*****************************************************************************
  1118.  * FUNCTION
  1119.  *  InsertEMSObjectUIHeader
  1120.  * DESCRIPTION
  1121.  *  
  1122.  * PARAMETERS
  1123.  *  object_type     [IN]        
  1124.  *  object_size     [IN]        
  1125.  *  source          [?]         
  1126.  *  destination     [?]         
  1127.  * RETURNS
  1128.  *  void
  1129.  *****************************************************************************/
  1130. void InsertEMSObjectUIHeader(U32 object_type, S32 object_size, U8 *source, U8 *destination)
  1131. {
  1132.     /*----------------------------------------------------------------*/
  1133.     /* Local Variables                                                */
  1134.     /*----------------------------------------------------------------*/
  1135.     /*----------------------------------------------------------------*/
  1136.     /* Code Body                                                      */
  1137.     /*----------------------------------------------------------------*/
  1138.     switch (object_type & 0xff)
  1139.     {
  1140.         case EMS_USERDEFINED_MELODY:
  1141.             gui_memcpy((destination + 3), source, object_size);
  1142.             destination[0] = (U8) EMS_USERDEFINED_MELODY;
  1143.             destination[1] = (U8) object_size;
  1144.             destination[2] = (U8) object_size >> 8;
  1145.             break;
  1146.     }
  1147. }
  1148. /*****************************************************************************
  1149.  * FUNCTION
  1150.  *  RemoveEMSObjectUIHeader
  1151.  * DESCRIPTION
  1152.  *  
  1153.  * PARAMETERS
  1154.  *  object_type     [IN]        
  1155.  *  source          [?]         
  1156.  *  destination     [?]         
  1157.  * RETURNS
  1158.  *  void
  1159.  *****************************************************************************/
  1160. void RemoveEMSObjectUIHeader(U32 object_type, U8 *source, U8 *destination)
  1161. {
  1162.     /*----------------------------------------------------------------*/
  1163.     /* Local Variables                                                */
  1164.     /*----------------------------------------------------------------*/
  1165.     S32 object_size;
  1166.     /*----------------------------------------------------------------*/
  1167.     /* Code Body                                                      */
  1168.     /*----------------------------------------------------------------*/
  1169.     switch (object_type & 0xff)
  1170.     {
  1171.         case EMS_USERDEFINED_MELODY:
  1172.             object_size = destination[1];
  1173.             object_size |= destination[2] << 8;
  1174.             gui_memcpy(destination, (source + 3), object_size);
  1175.             break;
  1176.     }
  1177. }
  1178. /*****************************************************************************
  1179.  * FUNCTION
  1180.  *  GetEMSObjectPDUSize
  1181.  * DESCRIPTION
  1182.  *  
  1183.  * PARAMETERS
  1184.  *  data        [?]     
  1185.  *  size        [?]     
  1186.  * RETURNS
  1187.  *  void
  1188.  *****************************************************************************/
  1189. void GetEMSObjectPDUSize(U8 *data, S32 *size)
  1190. {
  1191.     /*----------------------------------------------------------------*/
  1192.     /* Local Variables                                                */
  1193.     /*----------------------------------------------------------------*/
  1194.     /*----------------------------------------------------------------*/
  1195.     /* Code Body                                                      */
  1196.     /*----------------------------------------------------------------*/
  1197.     if (data != NULL)
  1198.     {
  1199.         U8 ID = data[0];
  1200.         switch (ID)
  1201.         {
  1202.             case EMS_PREDEFINED_PICTURE:
  1203.                 *size = *size - 8;
  1204.                 *size = *size + EMS_PREDEFINED_PICTURE_HEADER_SIZE;
  1205.                 break;
  1206.             case EMS_USERDEFINED_PICTURE:
  1207.                 *size = *size - 8;
  1208.                 *size = *size + EMS_USERDEFINED_PICTURE_HEADER_SIZE;
  1209.                 break;
  1210.             case EMS_PREDEFINED_ANIMATION:
  1211.                 *size = *size + EMS_PREDEFINED_ANIMATION_HEADER_SIZE;
  1212.                 break;
  1213.             case EMS_USERDEFINED_ANIMATION:
  1214.                 *size = *size - 8;
  1215.                 *size = *size + EMS_USERDEFINED_ANIMATION_HEADER_SIZE;
  1216.                 break;
  1217.             case EMS_PREDEFINED_SOUND:
  1218.                 *size = *size + EMS_PREDEFINED_SOUND_HEADER_SIZE;
  1219.                 break;
  1220.             case EMS_USERDEFINED_MELODY:
  1221.                 *size = *size - 3;
  1222.                 *size = *size + EMS_USERDEFINED_MELODY_HEADER_SIZE;
  1223.                 break;
  1224.             case EMS_PREDEFINED_MELODY:
  1225.                 *size = *size - 3;
  1226.                 *size = *size + EMS_PREDEFINED_MELODY_HEADER_SIZE;
  1227.                 break;
  1228.         }
  1229.     }
  1230. }
  1231. /*****************************************************************************
  1232.  * FUNCTION
  1233.  *  GetEMSPredefinedObjectPDUSize
  1234.  * DESCRIPTION
  1235.  *  
  1236.  * PARAMETERS
  1237.  *  object_type     [IN]        
  1238.  * RETURNS
  1239.  *  
  1240.  *****************************************************************************/
  1241. S32 GetEMSPredefinedObjectPDUSize(U32 object_type)
  1242. {
  1243.     /*----------------------------------------------------------------*/
  1244.     /* Local Variables                                                */
  1245.     /*----------------------------------------------------------------*/
  1246.     S32 size = 0;
  1247.     /*----------------------------------------------------------------*/
  1248.     /* Code Body                                                      */
  1249.     /*----------------------------------------------------------------*/
  1250.     switch (object_type & 0xff)
  1251.     {
  1252.         case EMS_PREDEFINED_ANIMATION:
  1253.             size = (1 + EMS_PREDEFINED_ANIMATION_HEADER_SIZE);
  1254.         case EMS_PREDEFINED_SOUND:
  1255.             size = (1 + EMS_PREDEFINED_SOUND_HEADER_SIZE);
  1256.     }
  1257.     return (size);
  1258. }
  1259. const U8 EMS_invalid_object_symbol[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x18, 0x00, 0x18, 0x00, 0x48, 0x00,
  1260.     0x00, 0xFF, 0x00, 0x03, 0x00, 0xC0, 0x04, 0x00, 0x20, 0x18, 0x7E, 0x18, 0x11, 0xFF, 0x88, 0x23,
  1261.     0xFF, 0xC4, 0x47, 0xC3, 0xE2, 0x4F, 0x81, 0xF2, 0x8F, 0x3C, 0xF1, 0x9F, 0x3C, 0xF9, 0x9F, 0xFC,
  1262.     0xF9, 0x9F, 0xF9, 0xF9, 0x9F, 0xF3, 0xF9, 0x9F, 0xE7, 0xF9, 0x9F, 0xE7, 0xF9, 0x8F, 0xFF, 0xF1,
  1263.     0x4F, 0xFF, 0xF2, 0x47, 0xE7, 0xE2, 0x23, 0xE7, 0xC4, 0x11, 0xFF, 0x88, 0x18, 0x7E, 0x18, 0x04,
  1264.     0x00, 0x20, 0x03, 0x00, 0xC0, 0x00, 0xFF, 0x00,
  1265. };
  1266. /*****************************************************************************
  1267.  * FUNCTION
  1268.  *  category_144_load_invalid_object_symbol
  1269.  * DESCRIPTION
  1270.  *  Redraws the object list screen
  1271.  * PARAMETERS
  1272.  *  obj     [?]     
  1273.  * RETURNS
  1274.  *  void
  1275.  *****************************************************************************/
  1276. S32 *category_144_object_list_index = NULL;
  1277. S32 category_144_object_list_n_items = 0;
  1278. S32 category_144_object_list_default_index = 0;
  1279. vertical_scrollbar category144_vbar;
  1280. EMSObject category_144_current_object;
  1281. EMSObjData category_144_current_object_data;
  1282. U8 **category_144_userdefined_objects = NULL;
  1283. U16 *category_144_predefined_objects = NULL;
  1284. U8 **category_144_list_of_titles = NULL;
  1285. U32 category_144_object_list_flags = 0;
  1286. /* image pre-loading for objects stored on a file system */
  1287. U8 category_144_object_file_flag = 0;
  1288. U8 *(*load_EMS_object_file) (S32 index) = NULL;
  1289. U8 category_144_autodetect_object_type;
  1290. U8 *category_144_data_ptr[1];
  1291. /* 062206 EMS category Start */
  1292. //U8 category_144_file_data[1600] = {0, 0};
  1293. static U8 *category_144_file_data = NULL;
  1294. /* 062206 EMS category End */
  1295. void category_144_load_invalid_object_symbol(EMSObject *obj)
  1296. {
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Local Variables                                                */
  1299.     /*----------------------------------------------------------------*/
  1300.     EMSObjData *object = obj->data;
  1301.     U8 *data = (U8*) EMS_invalid_object_symbol;
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305.     obj->Type = EMS_TYPE_PIC;
  1306.     object->picture.bitsPerPixel = data[1];
  1307.     object->picture.hDim = data[2] | (data[3] << 8);
  1308.     object->picture.vDim = data[4] | (data[5] << 8);
  1309.     object->picture.pdu_length = data[6] | (data[7] << 8);
  1310.     data += 8;
  1311.     object->picture.pdu = data;
  1312. }
  1313. /*****************************************************************************
  1314.  * FUNCTION
  1315.  *  category_144_load_object
  1316.  * DESCRIPTION
  1317.  *  
  1318.  * PARAMETERS
  1319.  *  index       [IN]        
  1320.  * RETURNS
  1321.  *  void
  1322.  *****************************************************************************/
  1323. void category_144_load_object(S32 index)
  1324. {
  1325.     /*----------------------------------------------------------------*/
  1326.     /* Local Variables                                                */
  1327.     /*----------------------------------------------------------------*/
  1328.     U8 object_type;
  1329.     /*----------------------------------------------------------------*/
  1330.     /* Code Body                                                      */
  1331.     /*----------------------------------------------------------------*/
  1332.     if ((index < 0) || (index >= category_144_object_list_n_items))
  1333.     {
  1334.         return;
  1335.     }
  1336.     object_type = (U8) (category_144_object_list_flags & 0x0f);
  1337.     /* image pre-loading for objects stored on a file system */
  1338.     if ((category_144_object_file_flag) || (category_144_autodetect_object_type))
  1339.     {
  1340.         U8 *object_data;
  1341.         if (load_EMS_object_file != NULL)
  1342.         {
  1343.             object_data = (U8*) load_EMS_object_file(index);
  1344.             if (object_data != NULL)
  1345.             {
  1346.                 if (category_144_autodetect_object_type)
  1347.                 {
  1348.                     object_type = (U8) object_data[0];
  1349.                 }
  1350.                 switch (object_type)
  1351.                 {
  1352.                     case EMS_PREDEFINED_PICTURE:
  1353.                         category_144_current_object.Type = EMS_TYPE_PIC;
  1354.                         EMS_predefined_pictures[index] = object_data;
  1355.                         break;
  1356.                     case EMS_USERDEFINED_PICTURE:
  1357.                         category_144_current_object.Type = EMS_TYPE_PIC;
  1358.                         category_144_userdefined_objects[index] = object_data;
  1359.                         break;
  1360.                     case EMS_USERDEFINED_ANIMATION:
  1361.                         category_144_current_object.Type = EMS_TYPE_USERDEF_ANM;
  1362.                         category_144_userdefined_objects[index] = object_data;
  1363.                         break;
  1364.                         /* MTK Joy added for customization, 1014 */
  1365.                 #if defined(__MMI_IMELODY_SUPPORT__)
  1366.                     case EMS_PREDEFINED_MELODY:
  1367.                         category_144_current_object.Type = EMS_TYPE_USERDEF_SND;
  1368.                         EMS_predefined_melodies[index] = object_data;
  1369.                         break;
  1370.                     case EMS_USERDEFINED_MELODY:
  1371.                         category_144_current_object.Type = EMS_TYPE_USERDEF_SND;
  1372.                         category_144_userdefined_objects[index] = object_data;
  1373.                         break;
  1374.                 #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1375.                         /* MTK end */
  1376.                 }
  1377.             }
  1378.         }
  1379.     }
  1380.     switch (object_type)
  1381.     {
  1382.         case EMS_PREDEFINED_PICTURE:
  1383.     #ifdef __EMS_REL5__
  1384.             if (EMS_load_object
  1385.                 (object_type, NULL, category_144_predefined_objects[index],
  1386.                  category_144_current_object.data) == EMS_INVALID_OBJECT &&
  1387.                 category_144_current_object.data->picture.attribute != 1)
  1388.     #else /* __EMS_REL5__ */ 
  1389.             if (EMS_load_object
  1390.                 (object_type, NULL, category_144_predefined_objects[index],
  1391.                  category_144_current_object.data) == EMS_INVALID_OBJECT)
  1392.     #endif /* __EMS_REL5__ */ 
  1393.                 category_144_load_invalid_object_symbol(&category_144_current_object);
  1394.             break;
  1395.         case EMS_USERDEFINED_PICTURE:
  1396.     #ifdef __EMS_REL5__
  1397.             if (EMS_load_object
  1398.                 (object_type, category_144_userdefined_objects[index], 0,
  1399.                  category_144_current_object.data) == EMS_INVALID_OBJECT &&
  1400.                 category_144_current_object.data->picture.attribute != 1)
  1401.     #else /* __EMS_REL5__ */ 
  1402.             if (EMS_load_object
  1403.                 (object_type, category_144_userdefined_objects[index], 0,
  1404.                  category_144_current_object.data) == EMS_INVALID_OBJECT)
  1405.     #endif /* __EMS_REL5__ */ 
  1406.                 category_144_load_invalid_object_symbol(&category_144_current_object);
  1407.             break;
  1408.         case EMS_USERDEFINED_ANIMATION:
  1409.     #ifdef __EMS_REL5__
  1410.             if (EMS_load_object
  1411.                 (object_type, category_144_userdefined_objects[index], 0,
  1412.                  category_144_current_object.data) == EMS_INVALID_OBJECT &&
  1413.                 category_144_current_object.data->animation.attribute != 1)
  1414.     #else /* __EMS_REL5__ */ 
  1415.             if (EMS_load_object
  1416.                 (object_type, category_144_userdefined_objects[index], 0,
  1417.                  category_144_current_object.data) == EMS_INVALID_OBJECT)
  1418.     #endif /* __EMS_REL5__ */ 
  1419.                 category_144_load_invalid_object_symbol(&category_144_current_object);
  1420.             break;
  1421.         case EMS_PREDEFINED_ANIMATION:
  1422.             category_144_current_object.Type = EMS_TYPE_PREDEF_ANM;
  1423.             category_144_current_object.PredefNo = (U8) category_144_predefined_objects[index];
  1424.             break;
  1425.         case EMS_PREDEFINED_SOUND:
  1426.             category_144_current_object.Type = EMS_TYPE_PREDEF_SND;
  1427.             category_144_current_object.PredefNo = (U8) category_144_predefined_objects[index];
  1428.             break;
  1429.             /* MTK Joy added for customization, 1014 */
  1430.     #if defined(__MMI_IMELODY_SUPPORT__)
  1431.         case EMS_PREDEFINED_MELODY:
  1432.     #ifdef __EMS_REL5__
  1433.             if (EMS_load_object
  1434.                 (EMS_PREDEFINED_MELODY, NULL, category_144_predefined_objects[index],
  1435.                  category_144_current_object.data) == EMS_INVALID_OBJECT &&
  1436.                 category_144_current_object.data->sound.attribute != 1)
  1437.     #else /* __EMS_REL5__ */ 
  1438.             if (EMS_load_object
  1439.                 (EMS_PREDEFINED_MELODY, NULL, category_144_predefined_objects[index],
  1440.                  category_144_current_object.data) == EMS_INVALID_OBJECT)
  1441.     #endif /* __EMS_REL5__ */ 
  1442.                 category_144_load_invalid_object_symbol(&category_144_current_object);
  1443.             break;
  1444.         case EMS_USERDEFINED_MELODY:
  1445.     #ifdef __EMS_REL5__
  1446.             if (EMS_load_object
  1447.                 (EMS_USERDEFINED_MELODY, category_144_userdefined_objects[index], 0,
  1448.                  category_144_current_object.data) == EMS_INVALID_OBJECT &&
  1449.                 category_144_current_object.data->sound.attribute != 1)
  1450.     #else /* __EMS_REL5__ */ 
  1451.             if (EMS_load_object
  1452.                 (EMS_USERDEFINED_MELODY, category_144_userdefined_objects[index], 0,
  1453.                  category_144_current_object.data) == EMS_INVALID_OBJECT)
  1454.     #endif /* __EMS_REL5__ */ 
  1455.                 category_144_load_invalid_object_symbol(&category_144_current_object);
  1456.             break;
  1457.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1458.             /* MTK end */
  1459.     }
  1460. }
  1461. /*****************************************************************************
  1462.  * FUNCTION
  1463.  *  category_144_redraw_highlighted_item
  1464.  * DESCRIPTION
  1465.  *  
  1466.  * PARAMETERS
  1467.  *  void
  1468.  * RETURNS
  1469.  *  void
  1470.  *****************************************************************************/
  1471. void category_144_redraw_highlighted_item(void)
  1472. {
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Local Variables                                                */
  1475.     /*----------------------------------------------------------------*/
  1476.     S32 x, y, w, h;
  1477.     color c;
  1478.     S32 index = 0;
  1479.     S32 vbar_x = 0, vbar_button_x = 0;
  1480.     /*----------------------------------------------------------------*/
  1481.     /* Code Body                                                      */
  1482.     /*----------------------------------------------------------------*/
  1483.     if (category_144_object_list_index != NULL)
  1484.     {
  1485.         index = *category_144_object_list_index;
  1486.     }
  1487.     EMS_cancel_object_focus();
  1488.     gui_reset_clip();
  1489.     c = gui_color(255, 255, 255);
  1490.     gui_fill_rectangle(
  1491.         0,
  1492.         (MMI_title_y + MMI_title_height),
  1493.         UI_device_width - 1,
  1494.         UI_device_height - MMI_button_bar_height - 1,
  1495.         c);
  1496.     gui_set_clip(
  1497.         0,
  1498.         (MMI_title_y + MMI_title_height),
  1499.         UI_device_width - current_MMI_theme->scrollbar_size,
  1500.         MMI_content_height + 2);
  1501.     gui_EMS_input_box_measure_object(&category_144_current_object, &w, &h);
  1502.     x = (UI_device_width >> 1) - (w >> 1);
  1503.     y = (UI_device_height >> 1) - (h >> 1);
  1504.     gui_EMS_input_box_display_object(x, y, &category_144_current_object, 1);
  1505.     if (category_144_list_of_titles != NULL)
  1506.     {
  1507.         MMI_title_string = (UI_string_type) category_144_list_of_titles[index];
  1508.         draw_title();
  1509.     }
  1510.     /* Uncomment below line for auto-disable scrollbar    */
  1511.     if (category_144_object_list_n_items > 1)
  1512.     {
  1513.         gui_set_vertical_scrollbar_range(&category144_vbar, category_144_object_list_n_items);
  1514.         gui_set_vertical_scrollbar_scale(&category144_vbar, 1);
  1515.         gui_set_vertical_scrollbar_value(&category144_vbar, *category_144_object_list_index);
  1516.         /* MTK Elvis for R2L characters */
  1517.         if (r2lMMIFlag)
  1518.         {
  1519.             vbar_x = category144_vbar.x;
  1520.             vbar_button_x = category144_vbar.scroll_button.x;
  1521.             category144_vbar.x = category144_vbar.x + category144_vbar.width - (UI_device_width - 1);
  1522.             category144_vbar.scroll_button.x =
  1523.                 category144_vbar.scroll_button.x + category144_vbar.scroll_button.width - (UI_device_width - 1);
  1524.             gui_show_vertical_scrollbar(&category144_vbar);
  1525.         }
  1526.         else
  1527.         {
  1528.             gui_show_vertical_scrollbar(&category144_vbar);
  1529.         }
  1530.         /* MTK end */
  1531.         if (r2lMMIFlag)
  1532.         {
  1533.             category144_vbar.x = vbar_x;
  1534.             category144_vbar.scroll_button.x = vbar_button_x;
  1535.         }
  1536.     }
  1537.     gui_BLT_double_buffer(
  1538.         0,
  1539.         (MMI_title_y + MMI_title_height),
  1540.         UI_device_width - 1,
  1541.         UI_device_height - MMI_button_bar_height - 1);
  1542. }
  1543. /*****************************************************************************
  1544.  * FUNCTION
  1545.  *  category_144_highlight_handler
  1546.  * DESCRIPTION
  1547.  *  
  1548.  * PARAMETERS
  1549.  *  index       [IN]        
  1550.  * RETURNS
  1551.  *  void
  1552.  *****************************************************************************/
  1553. void category_144_highlight_handler(S32 index)
  1554. {
  1555.     /*----------------------------------------------------------------*/
  1556.     /* Local Variables                                                */
  1557.     /*----------------------------------------------------------------*/
  1558.     /*----------------------------------------------------------------*/
  1559.     /* Code Body                                                      */
  1560.     /*----------------------------------------------------------------*/
  1561.     MMI_menu_shortcut_number = index + 1;
  1562.     if (!menu_shortcut_handler_display)
  1563.     {
  1564.         draw_title();
  1565.     }
  1566.     MMI_list_highlight_handler(index);
  1567. }
  1568. /*****************************************************************************
  1569.  * FUNCTION
  1570.  *  category_144_goto_item
  1571.  * DESCRIPTION
  1572.  *  
  1573.  * PARAMETERS
  1574.  *  index       [IN]        
  1575.  * RETURNS
  1576.  *  void
  1577.  *****************************************************************************/
  1578. void category_144_goto_item(S32 index)
  1579. {
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Local Variables                                                */
  1582.     /*----------------------------------------------------------------*/
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Code Body                                                      */
  1585.     /*----------------------------------------------------------------*/
  1586.     if (index < 0)
  1587.     {
  1588.         return;
  1589.     }
  1590.     if (index > (category_144_object_list_n_items - 1))
  1591.     {
  1592.         return;
  1593.     }
  1594.     if (!whether_no_small_screen())
  1595.     {
  1596.         *category_144_object_list_index = index;
  1597.     }
  1598.     category_144_load_object(index);
  1599.     if (!whether_no_small_screen())
  1600.     {
  1601.         category_144_redraw_highlighted_item();
  1602.     }
  1603.     category_144_highlight_handler(index);
  1604. }
  1605. /*****************************************************************************
  1606.  * FUNCTION
  1607.  *  category_144_goto_previous_item
  1608.  * DESCRIPTION
  1609.  *  
  1610.  * PARAMETERS
  1611.  *  void
  1612.  * RETURNS
  1613.  *  void
  1614.  *****************************************************************************/
  1615. void category_144_goto_previous_item(void)
  1616. {
  1617.     /*----------------------------------------------------------------*/
  1618.     /* Local Variables                                                */
  1619.     /*----------------------------------------------------------------*/
  1620.     S32 index = *category_144_object_list_index;
  1621.     /*----------------------------------------------------------------*/
  1622.     /* Code Body                                                      */
  1623.     /*----------------------------------------------------------------*/
  1624.     index--;
  1625.     if (index < 0)
  1626.     {
  1627.         index = category_144_object_list_n_items - 1;
  1628.     }
  1629.     *category_144_object_list_index = index;
  1630. #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  1631.     /* do not load object if the small screen is on because redraw_small_image_selector_images will take care of it */
  1632.     if (whether_no_small_screen())
  1633.     {
  1634.         small_image_selector_configure_current_display(&small_image_selector, *category_144_object_list_index);
  1635.         redraw_small_image_selector_images();
  1636.     }
  1637.     else
  1638. #endif /* UI_SMALL_IMAGE_SELECTOR_SCREEN */ 
  1639.     {
  1640.         category_144_load_object(index);
  1641.         category_144_redraw_highlighted_item();
  1642.         category_144_highlight_handler(index);
  1643.     }
  1644. }
  1645. /*****************************************************************************
  1646.  * FUNCTION
  1647.  *  category_144_goto_next_item
  1648.  * DESCRIPTION
  1649.  *  
  1650.  * PARAMETERS
  1651.  *  void
  1652.  * RETURNS
  1653.  *  void
  1654.  *****************************************************************************/
  1655. void category_144_goto_next_item(void)
  1656. {
  1657.     /*----------------------------------------------------------------*/
  1658.     /* Local Variables                                                */
  1659.     /*----------------------------------------------------------------*/
  1660.     S32 index = *category_144_object_list_index;
  1661.     /*----------------------------------------------------------------*/
  1662.     /* Code Body                                                      */
  1663.     /*----------------------------------------------------------------*/
  1664.     index++;
  1665.     if (index > (category_144_object_list_n_items - 1))
  1666.     {
  1667.         index = 0;
  1668.     }
  1669.     *category_144_object_list_index = index;
  1670. #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  1671.     /* do not load object if the small screen is on because redraw_small_image_selector_images will take care of it */
  1672.     if (whether_no_small_screen())
  1673.     {
  1674.         small_image_selector_configure_current_display(&small_image_selector, *category_144_object_list_index);
  1675.         redraw_small_image_selector_images();
  1676.     }
  1677.     else
  1678. #endif /* UI_SMALL_IMAGE_SELECTOR_SCREEN */ 
  1679.     {
  1680.         category_144_load_object(index);
  1681.         category_144_redraw_highlighted_item();
  1682.         category_144_highlight_handler(index);
  1683.     }
  1684. }
  1685. /*****************************************************************************
  1686.  * FUNCTION
  1687.  *  category_144_key_handler
  1688.  * DESCRIPTION
  1689.  *  
  1690.  * PARAMETERS
  1691.  *  vkey_code       [IN]        
  1692.  *  key_state       [IN]        
  1693.  * RETURNS
  1694.  *  void
  1695.  *****************************************************************************/
  1696. void category_144_key_handler(S32 vkey_code, S32 key_state)
  1697. {
  1698. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1699.     /*----------------------------------------------------------------*/
  1700.     /* Local Variables                                                */
  1701.     /*----------------------------------------------------------------*/
  1702.     /*----------------------------------------------------------------*/
  1703.     /* Code Body                                                      */
  1704.     /*----------------------------------------------------------------*/
  1705.     if (key_state)
  1706.     {
  1707.         switch (vkey_code)
  1708.         {
  1709.             case 37:    /* left */
  1710.                 break;
  1711.             case 39:    /* right */
  1712.                 break;
  1713.             case 38:
  1714.                 category_144_goto_previous_item();
  1715.                 break;
  1716.             case 40:
  1717.                 category_144_goto_next_item();
  1718.                 break;
  1719.         }
  1720.     }
  1721. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1722.     UI_UNUSED_PARAMETER(vkey_code);
  1723.     UI_UNUSED_PARAMETER(key_state);
  1724. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1725. }
  1726. /*****************************************************************************
  1727.  * FUNCTION
  1728.  *  RegisterCategory144ObjectLoader
  1729.  * DESCRIPTION
  1730.  *  
  1731.  * PARAMETERS
  1732.  *  f       [IN]        
  1733.  * RETURNS
  1734.  *  void
  1735.  *****************************************************************************/
  1736. void RegisterCategory144ObjectLoader(U8 *(*f) (S32 index))
  1737. {
  1738.     /*----------------------------------------------------------------*/
  1739.     /* Local Variables                                                */
  1740.     /*----------------------------------------------------------------*/
  1741.     /*----------------------------------------------------------------*/
  1742.     /* Code Body                                                      */
  1743.     /*----------------------------------------------------------------*/
  1744.     load_EMS_object_file = f;
  1745. }
  1746. #ifdef __MMI_TOUCH_SCREEN__
  1747. /*****************************************************************************
  1748.  * FUNCTION
  1749.  *  category_144_pen_down_hdlr
  1750.  * DESCRIPTION
  1751.  *  
  1752.  * PARAMETERS
  1753.  *  pos     [IN]        
  1754.  * RETURNS
  1755.  *  
  1756.  *****************************************************************************/
  1757. MMI_BOOL category_144_pen_down_hdlr(mmi_pen_point_struct pos)
  1758. {
  1759.     /*----------------------------------------------------------------*/
  1760.     /* Local Variables                                                */
  1761.     /*----------------------------------------------------------------*/
  1762.     gui_scrollbar_pen_enum scrollbar_event;
  1763.     gui_pen_event_param_struct scrollbar_param;
  1764.     /*----------------------------------------------------------------*/
  1765.     /* Code Body                                                      */
  1766.     /*----------------------------------------------------------------*/
  1767.     if (PEN_CHECK_BOUND
  1768.         (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
  1769.     {
  1770.         gui_vertical_scrollbar_translate_pen_event(
  1771.             &category144_vbar,
  1772.             MMI_PEN_EVENT_DOWN,
  1773.             pos.x,
  1774.             pos.y,
  1775.             &scrollbar_event,
  1776.             &scrollbar_param);
  1777.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1778.         {
  1779.             category_144_goto_item((S32) scrollbar_param._u.i);
  1780.         }
  1781.         return MMI_TRUE;
  1782.     }
  1783.     return MMI_FALSE;
  1784. }
  1785. /*****************************************************************************
  1786.  * FUNCTION
  1787.  *  category_144_pen_up_hdlr
  1788.  * DESCRIPTION
  1789.  *  
  1790.  * PARAMETERS
  1791.  *  pos     [IN]        
  1792.  * RETURNS
  1793.  *  
  1794.  *****************************************************************************/
  1795. MMI_BOOL category_144_pen_up_hdlr(mmi_pen_point_struct pos)
  1796. {
  1797.     /*----------------------------------------------------------------*/
  1798.     /* Local Variables                                                */
  1799.     /*----------------------------------------------------------------*/
  1800.     gui_scrollbar_pen_enum scrollbar_event;
  1801.     gui_pen_event_param_struct scrollbar_param;
  1802.     /*----------------------------------------------------------------*/
  1803.     /* Code Body                                                      */
  1804.     /*----------------------------------------------------------------*/
  1805.     if (PEN_CHECK_BOUND
  1806.         (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
  1807.     {
  1808.         gui_vertical_scrollbar_translate_pen_event(
  1809.             &category144_vbar,
  1810.             MMI_PEN_EVENT_UP,
  1811.             pos.x,
  1812.             pos.y,
  1813.             &scrollbar_event,
  1814.             &scrollbar_param);
  1815.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1816.         {
  1817.             category_144_goto_item((S32) scrollbar_param._u.i);
  1818.         }
  1819.         return MMI_TRUE;
  1820.     }
  1821.     return MMI_FALSE;
  1822. }
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  category_144_pen_move_hdlr
  1826.  * DESCRIPTION
  1827.  *  
  1828.  * PARAMETERS
  1829.  *  pos     [IN]        
  1830.  * RETURNS
  1831.  *  
  1832.  *****************************************************************************/
  1833. MMI_BOOL category_144_pen_move_hdlr(mmi_pen_point_struct pos)
  1834. {
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Local Variables                                                */
  1837.     /*----------------------------------------------------------------*/
  1838.     gui_scrollbar_pen_enum scrollbar_event;
  1839.     gui_pen_event_param_struct scrollbar_param;
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Code Body                                                      */
  1842.     /*----------------------------------------------------------------*/
  1843.     if (PEN_CHECK_BOUND
  1844.         (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
  1845.     {
  1846.         gui_vertical_scrollbar_translate_pen_event(
  1847.             &category144_vbar,
  1848.             MMI_PEN_EVENT_MOVE,
  1849.             pos.x,
  1850.             pos.y,
  1851.             &scrollbar_event,
  1852.             &scrollbar_param);
  1853.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1854.         {
  1855.             category_144_goto_item((S32) scrollbar_param._u.i);
  1856.         }
  1857.         return MMI_TRUE;
  1858.     }
  1859.     return MMI_FALSE;
  1860. }
  1861. /*****************************************************************************
  1862.  * FUNCTION
  1863.  *  category_144_pen_repeat_hdlr
  1864.  * DESCRIPTION
  1865.  *  
  1866.  * PARAMETERS
  1867.  *  pos     [IN]        
  1868.  * RETURNS
  1869.  *  
  1870.  *****************************************************************************/
  1871. MMI_BOOL category_144_pen_repeat_hdlr(mmi_pen_point_struct pos)
  1872. {
  1873.     /*----------------------------------------------------------------*/
  1874.     /* Local Variables                                                */
  1875.     /*----------------------------------------------------------------*/
  1876.     gui_scrollbar_pen_enum scrollbar_event;
  1877.     gui_pen_event_param_struct scrollbar_param;
  1878.     /*----------------------------------------------------------------*/
  1879.     /* Code Body                                                      */
  1880.     /*----------------------------------------------------------------*/
  1881.     if (PEN_CHECK_BOUND
  1882.         (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
  1883.     {
  1884.         gui_vertical_scrollbar_translate_pen_event(
  1885.             &category144_vbar,
  1886.             MMI_PEN_EVENT_REPEAT,
  1887.             pos.x,
  1888.             pos.y,
  1889.             &scrollbar_event,
  1890.             &scrollbar_param);
  1891.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1892.         {
  1893.             category_144_goto_item((S32) scrollbar_param._u.i);
  1894.         }
  1895.         return MMI_TRUE;
  1896.     }
  1897.     return MMI_FALSE;
  1898. }
  1899. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1900. /*****************************************************************************
  1901.  * FUNCTION
  1902.  *  DrawCate144CategoryControlArea
  1903.  * DESCRIPTION
  1904.  *  Draws the category144 category control area
  1905.  * PARAMETERS
  1906.  *  coordinate      [IN/OUT]        Coordinates of category controlled area.
  1907.  * RETURNS
  1908.  *  void
  1909.  *****************************************************************************/
  1910. void DrawCate144CategoryControlArea(dm_coordinates *coordinate)
  1911. {
  1912.     /*----------------------------------------------------------------*/
  1913.     /* Local Variables                                                */
  1914.     /*----------------------------------------------------------------*/
  1915.     /*----------------------------------------------------------------*/
  1916.     /* Code Body                                                      */
  1917.     /*----------------------------------------------------------------*/
  1918.     category_144_redraw_highlighted_item();
  1919. }
  1920. /* START VIJAY PMT 20050930 */
  1921. #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  1922. extern U16 title_bg_id;//092906 popup title
  1923. U16 g_small_image_selector = 0;
  1924. static S16 small_image_selector_index[MAX_IMAGE_SELECTOR_ROW][MAX_IMAGE_SELECTOR_COL];
  1925. /* PMT VIKAS START 20051217 */
  1926. /*****************************************************************************
  1927.  * FUNCTION
  1928.  *  small_image_selector_configure_current_display
  1929.  * DESCRIPTION
  1930.  *  function used to configure the current items to be displayed on the small screen
  1931.  *  calculates the first item to be displayed
  1932.  * PARAMETERS
  1933.  *  s                           [IN]        Small image sleector structure
  1934.  *  new_highlighted_image       [IN]        New highlighted image
  1935.  * RETURNS
  1936.  *  void
  1937.  *****************************************************************************/
  1938. void small_image_selector_configure_current_display(small_image_selector_struct *s, S32 new_highlighted_image)
  1939. {
  1940.     /*----------------------------------------------------------------*/
  1941.     /* Local Variables                                                */
  1942.     /*----------------------------------------------------------------*/
  1943.     S32 new_highlighted_row, new_highlighted_column;
  1944.     /*----------------------------------------------------------------*/
  1945.     /* Code Body                                                      */
  1946.     /*----------------------------------------------------------------*/
  1947.     new_highlighted_row = new_highlighted_image / s->n_columns;
  1948.     new_highlighted_column = new_highlighted_image % s->n_columns;
  1949.     if (s->flags & UI_SMALL_IMAGE_SELECTOR_SHOW_VERTICAL_SCROLLBAR)
  1950.     {
  1951.         if (new_highlighted_row == 0)
  1952.         {
  1953.             s->first_displayed_row = 0;
  1954.         }
  1955.         else if (new_highlighted_row > s->highlighted_row)
  1956.         {
  1957.             if (new_highlighted_row == s->n_rows - 1 && s->highlighted_row == 0)
  1958.             {
  1959.                 s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
  1960.             }
  1961.             else if ((new_highlighted_row - s->first_displayed_row) >= s->displayed_rows &&
  1962.                      (s->n_rows - new_highlighted_row) > s->displayed_rows)
  1963.             {
  1964.                 s->first_displayed_row = new_highlighted_row;
  1965.             }
  1966.             else if ((new_highlighted_row - s->first_displayed_row) >= s->displayed_rows &&
  1967.                      (s->n_rows - new_highlighted_row) > 0)
  1968.             {
  1969.                 s->first_displayed_row = new_highlighted_row - 1;
  1970.             }
  1971.         }
  1972.         else if (new_highlighted_row <= (s->first_displayed_row - 1))
  1973.         {
  1974.             if (new_highlighted_row == s->n_rows - 1)
  1975.             {
  1976.                 s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
  1977.             }
  1978.             else if (new_highlighted_row >= s->displayed_rows - 1)
  1979.             {
  1980.                 s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
  1981.             }
  1982.             else
  1983.             {
  1984.                 s->first_displayed_row = new_highlighted_row - 1;
  1985.             }
  1986.         }
  1987.     }
  1988.     if (s->flags & UI_SMALL_IMAGE_SELECTOR_SHOW_HORIZONTAL_SCROLLBAR)
  1989.     {
  1990.         if (new_highlighted_column == 0)
  1991.         {
  1992.             s->first_displayed_column = 0;
  1993.         }
  1994.         else if (new_highlighted_column > s->highlighted_column)
  1995.         {
  1996.             if (new_highlighted_column == s->n_columns - 1 && s->highlighted_column == 0)
  1997.             {
  1998.                 s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
  1999.             }
  2000.             else if ((new_highlighted_column - s->first_displayed_column) >= s->displayed_columns &&
  2001.                      (s->n_columns - new_highlighted_column) > s->displayed_columns)
  2002.             {
  2003.                 s->first_displayed_column = new_highlighted_column;
  2004.             }
  2005.             else if ((new_highlighted_column - s->first_displayed_column) >= s->displayed_columns &&
  2006.                      (s->n_columns - new_highlighted_column) > 0)
  2007.             {
  2008.                 s->first_displayed_column = new_highlighted_column - 1;
  2009.             }
  2010.         }
  2011.         else if (new_highlighted_column <= (s->first_displayed_column - 1))
  2012.         {
  2013.             if (new_highlighted_column == s->n_columns - 1)
  2014.             {
  2015.                 s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
  2016.             }
  2017.             else if (new_highlighted_column >= s->displayed_columns - 1)
  2018.             {
  2019.                 s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
  2020.             }
  2021.             else
  2022.             {
  2023.                 s->first_displayed_column = new_highlighted_column - 1;
  2024.             }
  2025.         }
  2026.     }
  2027.     s->first_displayed_image = s->first_displayed_row * s->n_columns + s->first_displayed_column;
  2028.     s->highlighted_column = new_highlighted_column;
  2029.     s->highlighted_row = new_highlighted_row;
  2030. }
  2031. /*****************************************************************************
  2032.  * FUNCTION
  2033.  *  associate_small_image_selector
  2034.  * DESCRIPTION
  2035.  *  function used to initialize the small image selector structure
  2036.  * PARAMETERS
  2037.  *  s       [IN]        Small image sleector structure
  2038.  * RETURNS
  2039.  *  void
  2040.  *****************************************************************************/
  2041. void associate_small_image_selector(small_image_selector_struct *s)
  2042. {
  2043.     /*----------------------------------------------------------------*/
  2044.     /* Local Variables                                                */
  2045.     /*----------------------------------------------------------------*/
  2046.     /*----------------------------------------------------------------*/
  2047.     /* Code Body                                                      */
  2048.     /*----------------------------------------------------------------*/
  2049.     s->displayed_columns = 0;
  2050.     s->displayed_rows = 0;
  2051.     s->first_displayed_column = 0;
  2052.     s->first_displayed_row = 0;
  2053.     s->first_displayed_image = 0;
  2054.     s->highlighted_column = 0;
  2055.     s->highlighted_row = 0;
  2056.     s->highlighted_image = 0;
  2057.     s->n_columns = 0;
  2058.     s->n_rows = 0;
  2059.     s->flags = 0;
  2060. }
  2061. /*****************************************************************************
  2062.  * FUNCTION
  2063.  *  small_image_selector_auto_calculate
  2064.  * DESCRIPTION
  2065.  *  Function used to auto calculate the no. of rows and columns depending upon the display area.
  2066.  * PARAMETERS
  2067.  *  s       [IN]        Small image sleector structure
  2068.  * RETURNS
  2069.  *  void
  2070.  *****************************************************************************/
  2071. void small_image_selector_auto_calculate(small_image_selector_struct *s)
  2072. {
  2073.     /*----------------------------------------------------------------*/
  2074.     /* Local Variables                                                */
  2075.     /*----------------------------------------------------------------*/