wgui_categories_ems.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:163k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * wgui_categories_ems.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is for EMS category screens.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /* start - added by magesh */
- #define ENABLE_EMS_TEST_SAVE_OBJECTS 1 /* 0- enable, 1-disable */
- #define ENABLE_EMS_TEST_SAVE_PIC_OBJECTS 0 /* 1- enable, 0-disable */
- #define ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS 1 /* 1- enable, 0-disable */
- #define ENABLE_EMS_TEST_SAVE_MELO_OBJECTS 0 /* 1- enable, 0-disable */
- /* end - added by magesh */
- #include "PixtelDataTypes.h"
- #include "MMI_features.h"
- #include "TimerEvents.h"
- #include "FileSystemDef.h"
- #include "FileSystemGProt.h"
- #include "conversions.h"
- //#include "CustDataProts.h"
- #include "HistoryGprot.h"
- //#include "CustMenuRes.h"
- #include "DebugInitDef.h"
- //#include "GlobalDefs.h"
- //#include "SettingProfile.h"
- //#include "wgui.h"
- //#include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "wgui_categories_defs.h"
- //#include "wgui_softkeys.h"
- #include "gdi_include.h"
- #include "wgui_ems.h"
- #include "wgui_categories_ems.h"
- #include "wgui_touch_screen.h"
- #include "MessagesResourceData.h"
- #include "PhoneSetupGprots.h"
- //#include "CommonScreens.h"
- #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
- #include "FileMgr.h"
- #include "FileManagerDef.h"
- #include "FileManagerGProt.h"
- #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */
- #include "wgui_draw_manager.h"
- #include "wgui_status_icons.h"//120406 warning remove
- #include "EmsMiscell.h"
- //#include "t9def.h"
- #ifdef __MMI_HINDI_ALG__
- //#include "hf_rules.h"
- #endif
- //#include "wgui_virtual_keyboard.h"
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- //#include "EditorPen.h"
- #endif
- #ifdef __MMI_MESSAGES_EMS__
- #include "ScrMemMgrGprot.h"//062206 EMS category
- extern void initialize_EMS_objects(void);
- extern void close_EMS_objects(void);
- extern U8 *EMS_predefined_pictures[];
- extern U8 *EMS_predefined_melodies[];
- EMSObjData temp_EMS_obj_data;
- #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
- small_image_selector_struct small_image_selector;
- #endif
- /*****************************************************************************
- * FUNCTION
- * CreateCategory143ObjectList
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * object_list [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void CreateCategory143ObjectList(EMSData *data, EMSObject **object_list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSObject *p = data->listHead;
- EMSObject *q;
- #if(ENABLE_EMS_TEST_SAVE_OBJECTS)
- S32 type;
- #endif /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *object_list = q = NULL;
- #if(ENABLE_EMS_TEST_SAVE_OBJECTS)
- if (data == NULL)
- {
- return;
- }
- if (data->listHead == NULL)
- {
- return;
- }
- while (p != NULL)
- {
- type = p->Type;
- /* reused object will not be put in category_143_object_list */
- if (
- #ifdef __EMS_REL5__
- (!EMSIsReusedObj(data, p)) &&
- #endif
- ((type == EMS_TYPE_PIC) || (type == EMS_TYPE_USERDEF_ANM)
- #if defined(__MMI_IMELODY_SUPPORT__)
- || (type == EMS_TYPE_USERDEF_SND)
- #endif
- ))
- {
- if (q == NULL)
- {
- *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
- q->next = NULL;
- q->prev = NULL;
- q->data = p->data;
- q->OffsetToText = p->OffsetToText;
- q->PredefNo = p->PredefNo;
- q->Type = p->Type;
- }
- else
- {
- EMSObject *temp;
- temp = (EMSObject*) gui_malloc(sizeof(EMSObject));
- temp->next = NULL;
- temp->data = p->data;
- temp->OffsetToText = p->OffsetToText;
- temp->PredefNo = p->PredefNo;
- temp->Type = p->Type;
- temp->prev = q;
- q->next = temp;
- q = temp;
- }
- }
- p = p->next;
- }
- #else /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */
- #if(ENABLE_EMS_TEST_SAVE_PIC_OBJECTS) /* picture */
- temp_EMS_obj_data.picture.bitsPerPixel = 1;
- temp_EMS_obj_data.picture.hDim = 16;
- temp_EMS_obj_data.picture.vDim = 16;
- temp_EMS_obj_data.picture.pdu_length = 32;
- temp_EMS_obj_data.picture.pdu = (U8*) (EMS_sample_picture_object_PDU_11 + 8);
- *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
- q->next = NULL;
- q->prev = NULL;
- q->data = &temp_EMS_obj_data;
- q->OffsetToText = 0;
- q->PredefNo = 0;
- q->Type = EMS_TYPE_PIC;
- #endif /* (ENABLE_EMS_TEST_SAVE_PIC_OBJECTS) */
- #if(ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS) /* animation */
- temp_EMS_obj_data.animation.bitsPerPixel = 1;
- temp_EMS_obj_data.animation.hDim = 8;
- temp_EMS_obj_data.animation.vDim = 8;
- temp_EMS_obj_data.animation.pdu_length = 32;
- temp_EMS_obj_data.animation.pdu = (U8*) (EMS_sample_animation_object_PDU_11 + 8);
- *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
- q->next = NULL;
- q->prev = NULL;
- q->data = &temp_EMS_obj_data;
- q->OffsetToText = 0;
- q->PredefNo = 0;
- q->Type = EMS_TYPE_USERDEF_ANM;
- #endif /* (ENABLE_EMS_TEST_SAVE_ANIA_OBJECTS) */
- #if(ENABLE_EMS_TEST_SAVE_MELO_OBJECTS) /* melodies */
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- temp_EMS_obj_data.sound.pdu_length =
- (U16) (EMS_sample_melody_object_PDU_1[1] | (EMS_sample_melody_object_PDU_1[2] << 8));
- temp_EMS_obj_data.sound.pdu = (U8*) (EMS_sample_melody_object_PDU_1 + 3);
- *object_list = q = (EMSObject*) gui_malloc(sizeof(EMSObject));
- q->next = NULL;
- q->prev = NULL;
- q->data = &temp_EMS_obj_data;
- q->OffsetToText = 0;
- q->PredefNo = 0;
- q->Type = EMS_TYPE_USERDEF_SND;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- #endif /* (ENABLE_EMS_TEST_SAVE_MELO_OBJECTS) */
- #endif /* (ENABLE_EMS_TEST_SAVE_OBJECTS) */
- }
- /*****************************************************************************
- * FUNCTION
- * FreeCategory143ObjectList
- * DESCRIPTION
- *
- * PARAMETERS
- * object_list [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void FreeCategory143ObjectList(EMSObject **object_list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSObject *q, *temp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (object_list == NULL)
- {
- return;
- }
- q = *object_list;
- while (q != NULL)
- {
- temp = q;
- q = q->next;
- gui_free(temp);
- }
- *object_list = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_redraw_highlighted_item
- * DESCRIPTION
- * Redraws the object list screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- S32 *category_143_object_list_index = NULL;
- S32 category_143_object_list_n_items = 0;
- vertical_scrollbar category143_vbar;
- EMSObject *category_143_object_list;
- EMSObject *category_143_current_object;
- extern U8 EMS_view_mode;
- void category_143_redraw_highlighted_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x, y, w, h;
- color c;
- S32 vbar_x = 0, vbar_button_x = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_cancel_object_focus();
- gui_reset_clip();
- c = gui_color(255, 255, 255);
- gui_fill_rectangle(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - 1,
- UI_device_height - MMI_button_bar_height - 1,
- c);
- gui_set_clip(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - current_MMI_theme->scrollbar_size,
- MMI_content_height + 2);
- if (category_143_current_object != NULL)
- {
- gui_EMS_input_box_measure_object(category_143_current_object, &w, &h);
- x = (UI_device_width >> 1) - (w >> 1);
- y = (UI_device_height >> 1) - (h >> 1);
- gui_EMS_input_box_display_object(x, y, category_143_current_object, 1);
- }
- /* Uncomment below line for auto-disable scrollbar */
- if (category_143_object_list_n_items > 1)
- {
- gui_set_vertical_scrollbar_range(&category143_vbar, category_143_object_list_n_items);
- gui_set_vertical_scrollbar_scale(&category143_vbar, 1);
- gui_set_vertical_scrollbar_value(&category143_vbar, *category_143_object_list_index);
- /* MTK Elvis for R2L characters */
- if (r2lMMIFlag)
- {
- vbar_x = category143_vbar.x;
- vbar_button_x = category143_vbar.scroll_button.x;
- category143_vbar.x = category143_vbar.x + category143_vbar.width - (UI_device_width - 1);
- category143_vbar.scroll_button.x =
- category143_vbar.scroll_button.x + category143_vbar.scroll_button.width - (UI_device_width - 1);
- gui_show_vertical_scrollbar(&category143_vbar);
- }
- else
- {
- gui_show_vertical_scrollbar(&category143_vbar);
- }
- /* MTK end */
- if (r2lMMIFlag)
- {
- category143_vbar.x = vbar_x;
- category143_vbar.scroll_button.x = vbar_button_x;
- }
- }
- gui_BLT_double_buffer(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - 1,
- UI_device_height - MMI_button_bar_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_highlight_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_143_highlight_handler(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_menu_shortcut_number = index + 1;
- if (!menu_shortcut_handler_display)
- {
- draw_title();
- }
- MMI_list_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_goto_item
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_143_goto_item(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (category_143_object_list != NULL)
- {
- if (index < 0)
- {
- return; /* index=0; */
- }
- if (index > (category_143_object_list_n_items - 1))
- {
- return; /* index=category_143_image_list_n_items-1; */
- }
- *category_143_object_list_index = index;
- category_143_current_object = category_143_object_list;
- if (category_143_current_object != NULL)
- {
- S32 i;
- for (i = 0; i < index; i++)
- {
- category_143_current_object = category_143_current_object->next;
- }
- }
- }
- category_143_redraw_highlighted_item();
- category_143_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_goto_previous_item
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void category_143_goto_previous_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 index = *category_143_object_list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- index--;
- if (index < 0)
- {
- index = category_143_object_list_n_items - 1;
- }
- *category_143_object_list_index = index;
- if (category_143_current_object != NULL)
- {
- if (category_143_current_object->prev == NULL)
- {
- category_143_current_object = category_143_object_list;
- while (category_143_current_object->next != NULL)
- {
- category_143_current_object = category_143_current_object->next;
- }
- }
- else
- {
- category_143_current_object = category_143_current_object->prev;
- }
- }
- category_143_redraw_highlighted_item();
- category_143_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_goto_next_item
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void category_143_goto_next_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 index = *category_143_object_list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- index++;
- if (index > (category_143_object_list_n_items - 1))
- {
- index = 0;
- }
- *category_143_object_list_index = index;
- if (category_143_current_object != NULL)
- {
- if (category_143_current_object->next == NULL)
- {
- category_143_current_object = category_143_object_list;
- }
- else
- {
- category_143_current_object = category_143_current_object->next;
- }
- }
- category_143_redraw_highlighted_item();
- category_143_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_143_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37: /* left */
- break;
- case 39: /* right */
- break;
- case 38:
- category_143_goto_previous_item();
- break;
- case 40:
- category_143_goto_next_item();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- #ifdef __MMI_TOUCH_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * category_143_pen_down_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_143_pen_down_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category143_vbar,
- MMI_PEN_EVENT_DOWN,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_143_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_pen_up_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_143_pen_up_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category143_vbar,
- MMI_PEN_EVENT_UP,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_143_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_pen_move_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_143_pen_move_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category143_vbar,
- MMI_PEN_EVENT_MOVE,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_143_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_143_pen_repeat_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_143_pen_repeat_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category143_vbar.x, category143_vbar.y, category143_vbar.width, category143_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category143_vbar,
- MMI_PEN_EVENT_REPEAT,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_143_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * DrawCate143CategoryControlArea
- * DESCRIPTION
- * Draws the category143 category control area
- * PARAMETERS
- * coordinate [IN/OUT] Coordinates of category controlled area.
- * RETURNS
- * void
- *****************************************************************************/
- void DrawCate143CategoryControlArea(dm_coordinates *coordinate)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- category_143_redraw_highlighted_item();
- }
- /*****************************************************************************
- * FUNCTION
- * ShowCategory143Screen
- * DESCRIPTION
- * Displays the object list screen
- * PARAMETERS
- * title [IN] Title for the screen
- * title_icon [IN] Icon displayed with the title
- * left_softkey [IN] Left softkey label
- * left_softkey_icon [IN] Left softkey icon
- * right_softkey [IN] Right softkey label
- * right_softkey_icon [IN] Right softkey icon
- * object_list [IN] Array of items
- * n_items [IN] Number of items in the menu
- * index [IN] Default item to be highlighted (if there is no history)
- * history_buffer [IN] History buffer
- * RETURNS
- * void
- *****************************************************************************/
- void ShowCategory143Screen(
- U16 title,
- U16 title_icon,
- U16 left_softkey,
- U16 left_softkey_icon,
- U16 right_softkey,
- U16 right_softkey_icon,
- EMSObject *object_list,
- S32 *n_items,
- S32 *index,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_data_struct dm_data;
- S32 shortcut_width, n = 0;
- U8 h_flag;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- EMS_view_mode = 1;
- initialize_EMS_objects();
- MMI_menu_shortcut_number = -1;
- MMI_disable_title_shortcut_display = 0;
- clear_left_softkey();
- clear_right_softkey();
- change_left_softkey(left_softkey, left_softkey_icon);
- change_right_softkey(right_softkey, right_softkey_icon);
- SetupCategoryKeyHandlers();
- MMI_title_icon = get_image(title_icon);
- MMI_title_string = get_string(title);
- category_143_object_list = object_list;
- category_143_object_list_index = index;
- h_flag = set_object_list_category_history(MMI_CATEGORY143_ID, history_buffer, category_143_object_list_index);
- if (h_flag)
- {
- *index = *category_143_object_list_index;
- }
- if (category_143_object_list == NULL)
- {
- n = 0;
- category_143_current_object = NULL;
- }
- else
- {
- S32 i;
- EMSObject *p = object_list->next;
- ++n;
- while (p != NULL)
- {
- p = p->next;
- ++n;
- }
- if (*index < 0)
- {
- *index = 0;
- }
- if (*index >= n)
- {
- *index = n - 1;
- }
- category_143_current_object = category_143_object_list;
- for (i = 0; i < *index; i++)
- {
- category_143_current_object = category_143_current_object->next;
- }
- }
- *n_items = n;
- MMI_menu_shortcut_number = *index + 1;
- category_143_object_list_n_items = n;
- category_143_object_list_index = index;
- if (*category_143_object_list_index < 0)
- {
- *category_143_object_list_index = 0;
- }
- if (*category_143_object_list_index >= category_143_object_list_n_items)
- {
- *category_143_object_list_index = category_143_object_list_n_items - 1;
- }
- gui_create_vertical_scrollbar(
- &category143_vbar,
- UI_device_width - current_MMI_theme->scrollbar_size,
- (MMI_title_y + MMI_title_height),
- current_MMI_theme->scrollbar_size,
- MMI_content_height);
- /* ShortCut */
- register_fixed_list_shortcut_handler();
- shortcut_width = set_menu_item_count(*n_items) + 7;
- resize_menu_shortcut_handler(shortcut_width, (MMI_title_height));
- move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
- register_hide_menu_shortcut(draw_title);
- register_keyboard_key_handler(category_143_key_handler);
- register_menu_shortcut_keys();
- register_menu_shortcut_handler(category_143_goto_item);
- SetKeyHandler(category_143_goto_previous_item, KEY_UP_ARROW, KEY_EVENT_UP);
- SetKeyHandler(category_143_goto_next_item, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(category_143_goto_previous_item, KEY_VOL_UP, KEY_EVENT_UP);
- SetKeyHandler(category_143_goto_next_item, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- gdi_layer_unlock_frame_buffer();
- ExitCategoryFunction = ExitCategory143Screen;
- dm_setup_category_functions(dm_redraw_category_screen, GetCategory143History, GetCategory143HistorySize);
- dm_register_category_controlled_callback(DrawCate143CategoryControlArea);
- #ifdef __MMI_TOUCH_SCREEN__
- wgui_register_category_screen_control_area_pen_handlers(category_143_pen_down_hdlr, MMI_PEN_EVENT_DOWN);
- wgui_register_category_screen_control_area_pen_handlers(category_143_pen_up_hdlr, MMI_PEN_EVENT_UP);
- wgui_register_category_screen_control_area_pen_handlers(category_143_pen_move_hdlr, MMI_PEN_EVENT_MOVE);
- wgui_register_category_screen_control_area_pen_handlers(category_143_pen_repeat_hdlr, MMI_PEN_EVENT_REPEAT);
- #endif /* __MMI_TOUCH_SCREEN__ */
- dm_data.s32ScrId = (S32) GetActiveScreenId();
- dm_data.s32CatId = MMI_CATEGORY143_ID;
- dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
- dm_setup_data(&dm_data);
- dm_redraw_category_screen();
- }
- /*****************************************************************************
- * FUNCTION
- * ExitCategory143Screen
- * DESCRIPTION
- * Exits the object list screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitCategory143Screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EMS_view_mode = 0;
- EMS_cancel_object_focus();
- close_EMS_objects();
- reset_menu_shortcut_handler();
- category_143_object_list = NULL;
- category_143_object_list_index = NULL;
- category_143_object_list_n_items = 0;
- ExitCategoryFunction = MMI_dummy_function;
- RedrawCategoryFunction = MMI_dummy_function;
- GetCategoryHistory = dummy_get_history;
- GetCategoryHistorySize = dummy_get_history_size;
- }
- /*****************************************************************************
- * FUNCTION
- * GetCategory143HistorySize
- * DESCRIPTION
- * Gets the history buffer size for the object list screen
- * PARAMETERS
- * void
- * RETURNS
- * size in U8s of the history buffer
- *****************************************************************************/
- S32 GetCategory143HistorySize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (sizeof(object_list_category_history));
- }
- /*****************************************************************************
- * FUNCTION
- * GetCategory143History
- * DESCRIPTION
- * Gets the history buffer for the object list screen
- * PARAMETERS
- * history_buffer [IN] Is the buffer into which the history data is stored
- * RETURNS
- * pointer to the history buffer
- *****************************************************************************/
- U8 *GetCategory143History(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- get_object_list_category_history(MMI_CATEGORY143_ID, history_buffer, category_143_object_list_index);
- return (history_buffer);
- }
- /* Supports only user defined objects */
- /*****************************************************************************
- * FUNCTION
- * GetCategory143DataType
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- U8 GetCategory143DataType(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (category_143_current_object->Type)
- {
- case EMS_TYPE_PIC:
- return (EMS_USERDEFINED_PICTURE);
- case EMS_TYPE_USERDEF_ANM:
- return (EMS_USERDEFINED_ANIMATION);
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_TYPE_USERDEF_SND:
- return (EMS_USERDEFINED_MELODY);
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- return (0);
- }
- /* Supports only user defined objects */
- /*****************************************************************************
- * FUNCTION
- * GetCategory143DataSize
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S32 GetCategory143DataSize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 size = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (category_143_current_object->Type)
- {
- case EMS_TYPE_PIC:
- size = 9 + category_143_current_object->data->picture.pdu_length;
- break;
- case EMS_TYPE_USERDEF_ANM:
- size = 12 + category_143_current_object->data->animation.pdu_length;
- break;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_TYPE_USERDEF_SND:
- size = 4 + category_143_current_object->data->sound.pdu_length;
- break;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- return (size);
- }
- /* Supports only user defined objects */
- /*****************************************************************************
- * FUNCTION
- * GetCategory143Data
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 *GetCategory143Data(U8 *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (data != NULL)
- {
- switch (category_143_current_object->Type)
- {
- case EMS_TYPE_PIC:
- data[0] = (U8) EMS_USERDEFINED_PICTURE;
- data[1] = (U8) category_143_current_object->data->picture.bitsPerPixel;
- data[2] = (U8) category_143_current_object->data->picture.attribute;
- data[3] = (U8) category_143_current_object->data->picture.hDim;
- data[4] = (U8) (category_143_current_object->data->picture.hDim >> 8);
- data[5] = (U8) category_143_current_object->data->picture.vDim;
- data[6] = (U8) (category_143_current_object->data->picture.vDim >> 8);
- data[7] = (U8) category_143_current_object->data->picture.pdu_length;
- data[8] = (U8) (category_143_current_object->data->picture.pdu_length >> 8);
- gui_memcpy(
- data + 9,
- category_143_current_object->data->picture.pdu,
- category_143_current_object->data->picture.pdu_length);
- break;
- case EMS_TYPE_USERDEF_ANM:
- data[0] = (U8) EMS_USERDEFINED_ANIMATION;
- data[1] = (U8) category_143_current_object->data->animation.bitsPerPixel;
- data[2] = (U8) category_143_current_object->data->animation.attribute;
- data[3] = (U8) category_143_current_object->data->animation.cFrame;
- data[4] = (U8) category_143_current_object->data->animation.cRepeat;
- data[5] = (U8) category_143_current_object->data->animation.Duration;
- data[6] = (U8) category_143_current_object->data->animation.hDim;
- data[7] = (U8) (category_143_current_object->data->animation.hDim >> 8);
- data[8] = (U8) category_143_current_object->data->animation.vDim;
- data[9] = (U8) (category_143_current_object->data->animation.vDim >> 8);
- data[10] = (U8) category_143_current_object->data->animation.pdu_length;
- data[11] = (U8) (category_143_current_object->data->animation.pdu_length >> 8);
- gui_memcpy(
- data + 12,
- category_143_current_object->data->animation.pdu,
- category_143_current_object->data->animation.pdu_length);
- break;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_TYPE_USERDEF_SND:
- data[0] = (U8) EMS_USERDEFINED_MELODY;
- data[1] = (U8) category_143_current_object->data->sound.attribute;
- data[2] = (U8) category_143_current_object->data->sound.pdu_length;
- data[3] = (U8) (category_143_current_object->data->sound.pdu_length >> 8);
- gui_memcpy(
- data + 4,
- category_143_current_object->data->sound.pdu,
- category_143_current_object->data->sound.pdu_length);
- break;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- }
- return (data);
- }
- #define EMS_PREDEFINED_PICTURE_HEADER_SIZE 3
- #define EMS_USERDEFINED_PICTURE_HEADER_SIZE 3
- #define EMS_PREDEFINED_ANIMATION_HEADER_SIZE 1
- #define EMS_USERDEFINED_ANIMATION_HEADER_SIZE 3
- #define EMS_PREDEFINED_SOUND_HEADER_SIZE 1
- #define EMS_PREDEFINED_MELODY_HEADER_SIZE 1
- #define EMS_USERDEFINED_MELODY_HEADER_SIZE 1
- /*****************************************************************************
- * FUNCTION
- * InsertEMSObjectUIHeader
- * DESCRIPTION
- *
- * PARAMETERS
- * object_type [IN]
- * object_size [IN]
- * source [?]
- * destination [?]
- * RETURNS
- * void
- *****************************************************************************/
- void InsertEMSObjectUIHeader(U32 object_type, S32 object_size, U8 *source, U8 *destination)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type & 0xff)
- {
- case EMS_USERDEFINED_MELODY:
- gui_memcpy((destination + 3), source, object_size);
- destination[0] = (U8) EMS_USERDEFINED_MELODY;
- destination[1] = (U8) object_size;
- destination[2] = (U8) object_size >> 8;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * RemoveEMSObjectUIHeader
- * DESCRIPTION
- *
- * PARAMETERS
- * object_type [IN]
- * source [?]
- * destination [?]
- * RETURNS
- * void
- *****************************************************************************/
- void RemoveEMSObjectUIHeader(U32 object_type, U8 *source, U8 *destination)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 object_size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type & 0xff)
- {
- case EMS_USERDEFINED_MELODY:
- object_size = destination[1];
- object_size |= destination[2] << 8;
- gui_memcpy(destination, (source + 3), object_size);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetEMSObjectPDUSize
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * size [?]
- * RETURNS
- * void
- *****************************************************************************/
- void GetEMSObjectPDUSize(U8 *data, S32 *size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (data != NULL)
- {
- U8 ID = data[0];
- switch (ID)
- {
- case EMS_PREDEFINED_PICTURE:
- *size = *size - 8;
- *size = *size + EMS_PREDEFINED_PICTURE_HEADER_SIZE;
- break;
- case EMS_USERDEFINED_PICTURE:
- *size = *size - 8;
- *size = *size + EMS_USERDEFINED_PICTURE_HEADER_SIZE;
- break;
- case EMS_PREDEFINED_ANIMATION:
- *size = *size + EMS_PREDEFINED_ANIMATION_HEADER_SIZE;
- break;
- case EMS_USERDEFINED_ANIMATION:
- *size = *size - 8;
- *size = *size + EMS_USERDEFINED_ANIMATION_HEADER_SIZE;
- break;
- case EMS_PREDEFINED_SOUND:
- *size = *size + EMS_PREDEFINED_SOUND_HEADER_SIZE;
- break;
- case EMS_USERDEFINED_MELODY:
- *size = *size - 3;
- *size = *size + EMS_USERDEFINED_MELODY_HEADER_SIZE;
- break;
- case EMS_PREDEFINED_MELODY:
- *size = *size - 3;
- *size = *size + EMS_PREDEFINED_MELODY_HEADER_SIZE;
- break;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetEMSPredefinedObjectPDUSize
- * DESCRIPTION
- *
- * PARAMETERS
- * object_type [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 GetEMSPredefinedObjectPDUSize(U32 object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 size = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type & 0xff)
- {
- case EMS_PREDEFINED_ANIMATION:
- size = (1 + EMS_PREDEFINED_ANIMATION_HEADER_SIZE);
- case EMS_PREDEFINED_SOUND:
- size = (1 + EMS_PREDEFINED_SOUND_HEADER_SIZE);
- }
- return (size);
- }
- const U8 EMS_invalid_object_symbol[] = {EMS_PREDEFINED_PICTURE, 0x01, 0x18, 0x00, 0x18, 0x00, 0x48, 0x00,
- 0x00, 0xFF, 0x00, 0x03, 0x00, 0xC0, 0x04, 0x00, 0x20, 0x18, 0x7E, 0x18, 0x11, 0xFF, 0x88, 0x23,
- 0xFF, 0xC4, 0x47, 0xC3, 0xE2, 0x4F, 0x81, 0xF2, 0x8F, 0x3C, 0xF1, 0x9F, 0x3C, 0xF9, 0x9F, 0xFC,
- 0xF9, 0x9F, 0xF9, 0xF9, 0x9F, 0xF3, 0xF9, 0x9F, 0xE7, 0xF9, 0x9F, 0xE7, 0xF9, 0x8F, 0xFF, 0xF1,
- 0x4F, 0xFF, 0xF2, 0x47, 0xE7, 0xE2, 0x23, 0xE7, 0xC4, 0x11, 0xFF, 0x88, 0x18, 0x7E, 0x18, 0x04,
- 0x00, 0x20, 0x03, 0x00, 0xC0, 0x00, 0xFF, 0x00,
- };
- /*****************************************************************************
- * FUNCTION
- * category_144_load_invalid_object_symbol
- * DESCRIPTION
- * Redraws the object list screen
- * PARAMETERS
- * obj [?]
- * RETURNS
- * void
- *****************************************************************************/
- S32 *category_144_object_list_index = NULL;
- S32 category_144_object_list_n_items = 0;
- S32 category_144_object_list_default_index = 0;
- vertical_scrollbar category144_vbar;
- EMSObject category_144_current_object;
- EMSObjData category_144_current_object_data;
- U8 **category_144_userdefined_objects = NULL;
- U16 *category_144_predefined_objects = NULL;
- U8 **category_144_list_of_titles = NULL;
- U32 category_144_object_list_flags = 0;
- /* image pre-loading for objects stored on a file system */
- U8 category_144_object_file_flag = 0;
- U8 *(*load_EMS_object_file) (S32 index) = NULL;
- U8 category_144_autodetect_object_type;
- U8 *category_144_data_ptr[1];
- /* 062206 EMS category Start */
- //U8 category_144_file_data[1600] = {0, 0};
- static U8 *category_144_file_data = NULL;
- /* 062206 EMS category End */
- void category_144_load_invalid_object_symbol(EMSObject *obj)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSObjData *object = obj->data;
- U8 *data = (U8*) EMS_invalid_object_symbol;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- obj->Type = EMS_TYPE_PIC;
- object->picture.bitsPerPixel = data[1];
- object->picture.hDim = data[2] | (data[3] << 8);
- object->picture.vDim = data[4] | (data[5] << 8);
- object->picture.pdu_length = data[6] | (data[7] << 8);
- data += 8;
- object->picture.pdu = data;
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_load_object
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_load_object(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 object_type;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((index < 0) || (index >= category_144_object_list_n_items))
- {
- return;
- }
- object_type = (U8) (category_144_object_list_flags & 0x0f);
- /* image pre-loading for objects stored on a file system */
- if ((category_144_object_file_flag) || (category_144_autodetect_object_type))
- {
- U8 *object_data;
- if (load_EMS_object_file != NULL)
- {
- object_data = (U8*) load_EMS_object_file(index);
- if (object_data != NULL)
- {
- if (category_144_autodetect_object_type)
- {
- object_type = (U8) object_data[0];
- }
- switch (object_type)
- {
- case EMS_PREDEFINED_PICTURE:
- category_144_current_object.Type = EMS_TYPE_PIC;
- EMS_predefined_pictures[index] = object_data;
- break;
- case EMS_USERDEFINED_PICTURE:
- category_144_current_object.Type = EMS_TYPE_PIC;
- category_144_userdefined_objects[index] = object_data;
- break;
- case EMS_USERDEFINED_ANIMATION:
- category_144_current_object.Type = EMS_TYPE_USERDEF_ANM;
- category_144_userdefined_objects[index] = object_data;
- break;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_PREDEFINED_MELODY:
- category_144_current_object.Type = EMS_TYPE_USERDEF_SND;
- EMS_predefined_melodies[index] = object_data;
- break;
- case EMS_USERDEFINED_MELODY:
- category_144_current_object.Type = EMS_TYPE_USERDEF_SND;
- category_144_userdefined_objects[index] = object_data;
- break;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- }
- }
- }
- switch (object_type)
- {
- case EMS_PREDEFINED_PICTURE:
- #ifdef __EMS_REL5__
- if (EMS_load_object
- (object_type, NULL, category_144_predefined_objects[index],
- category_144_current_object.data) == EMS_INVALID_OBJECT &&
- category_144_current_object.data->picture.attribute != 1)
- #else /* __EMS_REL5__ */
- if (EMS_load_object
- (object_type, NULL, category_144_predefined_objects[index],
- category_144_current_object.data) == EMS_INVALID_OBJECT)
- #endif /* __EMS_REL5__ */
- category_144_load_invalid_object_symbol(&category_144_current_object);
- break;
- case EMS_USERDEFINED_PICTURE:
- #ifdef __EMS_REL5__
- if (EMS_load_object
- (object_type, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT &&
- category_144_current_object.data->picture.attribute != 1)
- #else /* __EMS_REL5__ */
- if (EMS_load_object
- (object_type, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT)
- #endif /* __EMS_REL5__ */
- category_144_load_invalid_object_symbol(&category_144_current_object);
- break;
- case EMS_USERDEFINED_ANIMATION:
- #ifdef __EMS_REL5__
- if (EMS_load_object
- (object_type, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT &&
- category_144_current_object.data->animation.attribute != 1)
- #else /* __EMS_REL5__ */
- if (EMS_load_object
- (object_type, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT)
- #endif /* __EMS_REL5__ */
- category_144_load_invalid_object_symbol(&category_144_current_object);
- break;
- case EMS_PREDEFINED_ANIMATION:
- category_144_current_object.Type = EMS_TYPE_PREDEF_ANM;
- category_144_current_object.PredefNo = (U8) category_144_predefined_objects[index];
- break;
- case EMS_PREDEFINED_SOUND:
- category_144_current_object.Type = EMS_TYPE_PREDEF_SND;
- category_144_current_object.PredefNo = (U8) category_144_predefined_objects[index];
- break;
- /* MTK Joy added for customization, 1014 */
- #if defined(__MMI_IMELODY_SUPPORT__)
- case EMS_PREDEFINED_MELODY:
- #ifdef __EMS_REL5__
- if (EMS_load_object
- (EMS_PREDEFINED_MELODY, NULL, category_144_predefined_objects[index],
- category_144_current_object.data) == EMS_INVALID_OBJECT &&
- category_144_current_object.data->sound.attribute != 1)
- #else /* __EMS_REL5__ */
- if (EMS_load_object
- (EMS_PREDEFINED_MELODY, NULL, category_144_predefined_objects[index],
- category_144_current_object.data) == EMS_INVALID_OBJECT)
- #endif /* __EMS_REL5__ */
- category_144_load_invalid_object_symbol(&category_144_current_object);
- break;
- case EMS_USERDEFINED_MELODY:
- #ifdef __EMS_REL5__
- if (EMS_load_object
- (EMS_USERDEFINED_MELODY, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT &&
- category_144_current_object.data->sound.attribute != 1)
- #else /* __EMS_REL5__ */
- if (EMS_load_object
- (EMS_USERDEFINED_MELODY, category_144_userdefined_objects[index], 0,
- category_144_current_object.data) == EMS_INVALID_OBJECT)
- #endif /* __EMS_REL5__ */
- category_144_load_invalid_object_symbol(&category_144_current_object);
- break;
- #endif /* defined(__MMI_IMELODY_SUPPORT__) */
- /* MTK end */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_redraw_highlighted_item
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_redraw_highlighted_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x, y, w, h;
- color c;
- S32 index = 0;
- S32 vbar_x = 0, vbar_button_x = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (category_144_object_list_index != NULL)
- {
- index = *category_144_object_list_index;
- }
- EMS_cancel_object_focus();
- gui_reset_clip();
- c = gui_color(255, 255, 255);
- gui_fill_rectangle(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - 1,
- UI_device_height - MMI_button_bar_height - 1,
- c);
- gui_set_clip(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - current_MMI_theme->scrollbar_size,
- MMI_content_height + 2);
- gui_EMS_input_box_measure_object(&category_144_current_object, &w, &h);
- x = (UI_device_width >> 1) - (w >> 1);
- y = (UI_device_height >> 1) - (h >> 1);
- gui_EMS_input_box_display_object(x, y, &category_144_current_object, 1);
- if (category_144_list_of_titles != NULL)
- {
- MMI_title_string = (UI_string_type) category_144_list_of_titles[index];
- draw_title();
- }
- /* Uncomment below line for auto-disable scrollbar */
- if (category_144_object_list_n_items > 1)
- {
- gui_set_vertical_scrollbar_range(&category144_vbar, category_144_object_list_n_items);
- gui_set_vertical_scrollbar_scale(&category144_vbar, 1);
- gui_set_vertical_scrollbar_value(&category144_vbar, *category_144_object_list_index);
- /* MTK Elvis for R2L characters */
- if (r2lMMIFlag)
- {
- vbar_x = category144_vbar.x;
- vbar_button_x = category144_vbar.scroll_button.x;
- category144_vbar.x = category144_vbar.x + category144_vbar.width - (UI_device_width - 1);
- category144_vbar.scroll_button.x =
- category144_vbar.scroll_button.x + category144_vbar.scroll_button.width - (UI_device_width - 1);
- gui_show_vertical_scrollbar(&category144_vbar);
- }
- else
- {
- gui_show_vertical_scrollbar(&category144_vbar);
- }
- /* MTK end */
- if (r2lMMIFlag)
- {
- category144_vbar.x = vbar_x;
- category144_vbar.scroll_button.x = vbar_button_x;
- }
- }
- gui_BLT_double_buffer(
- 0,
- (MMI_title_y + MMI_title_height),
- UI_device_width - 1,
- UI_device_height - MMI_button_bar_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_highlight_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_highlight_handler(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_menu_shortcut_number = index + 1;
- if (!menu_shortcut_handler_display)
- {
- draw_title();
- }
- MMI_list_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_goto_item
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_goto_item(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index < 0)
- {
- return;
- }
- if (index > (category_144_object_list_n_items - 1))
- {
- return;
- }
- if (!whether_no_small_screen())
- {
- *category_144_object_list_index = index;
- }
- category_144_load_object(index);
- if (!whether_no_small_screen())
- {
- category_144_redraw_highlighted_item();
- }
- category_144_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_goto_previous_item
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_goto_previous_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 index = *category_144_object_list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- index--;
- if (index < 0)
- {
- index = category_144_object_list_n_items - 1;
- }
- *category_144_object_list_index = index;
- #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
- /* do not load object if the small screen is on because redraw_small_image_selector_images will take care of it */
- if (whether_no_small_screen())
- {
- small_image_selector_configure_current_display(&small_image_selector, *category_144_object_list_index);
- redraw_small_image_selector_images();
- }
- else
- #endif /* UI_SMALL_IMAGE_SELECTOR_SCREEN */
- {
- category_144_load_object(index);
- category_144_redraw_highlighted_item();
- category_144_highlight_handler(index);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_goto_next_item
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_goto_next_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 index = *category_144_object_list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- index++;
- if (index > (category_144_object_list_n_items - 1))
- {
- index = 0;
- }
- *category_144_object_list_index = index;
- #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
- /* do not load object if the small screen is on because redraw_small_image_selector_images will take care of it */
- if (whether_no_small_screen())
- {
- small_image_selector_configure_current_display(&small_image_selector, *category_144_object_list_index);
- redraw_small_image_selector_images();
- }
- else
- #endif /* UI_SMALL_IMAGE_SELECTOR_SCREEN */
- {
- category_144_load_object(index);
- category_144_redraw_highlighted_item();
- category_144_highlight_handler(index);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void category_144_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37: /* left */
- break;
- case 39: /* right */
- break;
- case 38:
- category_144_goto_previous_item();
- break;
- case 40:
- category_144_goto_next_item();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * RegisterCategory144ObjectLoader
- * DESCRIPTION
- *
- * PARAMETERS
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void RegisterCategory144ObjectLoader(U8 *(*f) (S32 index))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- load_EMS_object_file = f;
- }
- #ifdef __MMI_TOUCH_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * category_144_pen_down_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_144_pen_down_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category144_vbar,
- MMI_PEN_EVENT_DOWN,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_144_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_pen_up_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_144_pen_up_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category144_vbar,
- MMI_PEN_EVENT_UP,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_144_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_pen_move_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_144_pen_move_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category144_vbar,
- MMI_PEN_EVENT_MOVE,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_144_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * category_144_pen_repeat_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL category_144_pen_repeat_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- gui_scrollbar_pen_enum scrollbar_event;
- gui_pen_event_param_struct scrollbar_param;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND
- (pos.x, pos.y, category144_vbar.x, category144_vbar.y, category144_vbar.width, category144_vbar.height))
- {
- gui_vertical_scrollbar_translate_pen_event(
- &category144_vbar,
- MMI_PEN_EVENT_REPEAT,
- pos.x,
- pos.y,
- &scrollbar_event,
- &scrollbar_param);
- if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
- {
- category_144_goto_item((S32) scrollbar_param._u.i);
- }
- return MMI_TRUE;
- }
- return MMI_FALSE;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * DrawCate144CategoryControlArea
- * DESCRIPTION
- * Draws the category144 category control area
- * PARAMETERS
- * coordinate [IN/OUT] Coordinates of category controlled area.
- * RETURNS
- * void
- *****************************************************************************/
- void DrawCate144CategoryControlArea(dm_coordinates *coordinate)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- category_144_redraw_highlighted_item();
- }
- /* START VIJAY PMT 20050930 */
- #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
- extern U16 title_bg_id;//092906 popup title
- U16 g_small_image_selector = 0;
- static S16 small_image_selector_index[MAX_IMAGE_SELECTOR_ROW][MAX_IMAGE_SELECTOR_COL];
- /* PMT VIKAS START 20051217 */
- /*****************************************************************************
- * FUNCTION
- * small_image_selector_configure_current_display
- * DESCRIPTION
- * function used to configure the current items to be displayed on the small screen
- * calculates the first item to be displayed
- * PARAMETERS
- * s [IN] Small image sleector structure
- * new_highlighted_image [IN] New highlighted image
- * RETURNS
- * void
- *****************************************************************************/
- void small_image_selector_configure_current_display(small_image_selector_struct *s, S32 new_highlighted_image)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 new_highlighted_row, new_highlighted_column;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- new_highlighted_row = new_highlighted_image / s->n_columns;
- new_highlighted_column = new_highlighted_image % s->n_columns;
- if (s->flags & UI_SMALL_IMAGE_SELECTOR_SHOW_VERTICAL_SCROLLBAR)
- {
- if (new_highlighted_row == 0)
- {
- s->first_displayed_row = 0;
- }
- else if (new_highlighted_row > s->highlighted_row)
- {
- if (new_highlighted_row == s->n_rows - 1 && s->highlighted_row == 0)
- {
- s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
- }
- else if ((new_highlighted_row - s->first_displayed_row) >= s->displayed_rows &&
- (s->n_rows - new_highlighted_row) > s->displayed_rows)
- {
- s->first_displayed_row = new_highlighted_row;
- }
- else if ((new_highlighted_row - s->first_displayed_row) >= s->displayed_rows &&
- (s->n_rows - new_highlighted_row) > 0)
- {
- s->first_displayed_row = new_highlighted_row - 1;
- }
- }
- else if (new_highlighted_row <= (s->first_displayed_row - 1))
- {
- if (new_highlighted_row == s->n_rows - 1)
- {
- s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
- }
- else if (new_highlighted_row >= s->displayed_rows - 1)
- {
- s->first_displayed_row = new_highlighted_row - s->displayed_rows + 1;
- }
- else
- {
- s->first_displayed_row = new_highlighted_row - 1;
- }
- }
- }
- if (s->flags & UI_SMALL_IMAGE_SELECTOR_SHOW_HORIZONTAL_SCROLLBAR)
- {
- if (new_highlighted_column == 0)
- {
- s->first_displayed_column = 0;
- }
- else if (new_highlighted_column > s->highlighted_column)
- {
- if (new_highlighted_column == s->n_columns - 1 && s->highlighted_column == 0)
- {
- s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
- }
- else if ((new_highlighted_column - s->first_displayed_column) >= s->displayed_columns &&
- (s->n_columns - new_highlighted_column) > s->displayed_columns)
- {
- s->first_displayed_column = new_highlighted_column;
- }
- else if ((new_highlighted_column - s->first_displayed_column) >= s->displayed_columns &&
- (s->n_columns - new_highlighted_column) > 0)
- {
- s->first_displayed_column = new_highlighted_column - 1;
- }
- }
- else if (new_highlighted_column <= (s->first_displayed_column - 1))
- {
- if (new_highlighted_column == s->n_columns - 1)
- {
- s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
- }
- else if (new_highlighted_column >= s->displayed_columns - 1)
- {
- s->first_displayed_column = new_highlighted_column - s->displayed_columns + 1;
- }
- else
- {
- s->first_displayed_column = new_highlighted_column - 1;
- }
- }
- }
- s->first_displayed_image = s->first_displayed_row * s->n_columns + s->first_displayed_column;
- s->highlighted_column = new_highlighted_column;
- s->highlighted_row = new_highlighted_row;
- }
- /*****************************************************************************
- * FUNCTION
- * associate_small_image_selector
- * DESCRIPTION
- * function used to initialize the small image selector structure
- * PARAMETERS
- * s [IN] Small image sleector structure
- * RETURNS
- * void
- *****************************************************************************/
- void associate_small_image_selector(small_image_selector_struct *s)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- s->displayed_columns = 0;
- s->displayed_rows = 0;
- s->first_displayed_column = 0;
- s->first_displayed_row = 0;
- s->first_displayed_image = 0;
- s->highlighted_column = 0;
- s->highlighted_row = 0;
- s->highlighted_image = 0;
- s->n_columns = 0;
- s->n_rows = 0;
- s->flags = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * small_image_selector_auto_calculate
- * DESCRIPTION
- * Function used to auto calculate the no. of rows and columns depending upon the display area.
- * PARAMETERS
- * s [IN] Small image sleector structure
- * RETURNS
- * void
- *****************************************************************************/
- void small_image_selector_auto_calculate(small_image_selector_struct *s)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/